diff --git a/Makefile b/Makefile index 653367c00a..4a9c1cda08 100644 --- a/Makefile +++ b/Makefile @@ -214,7 +214,7 @@ gen-c: $(call announce-begin,"Formatting C code") cd $(SWIFTNAV_ROOT)/c; \ - mkdir -p build/ && cd build/; \ + mkdir -p build.format/ && cd build.format/; \ cmake $(CMAKEFLAGS) ../; \ $(MAKE) clang-format-all diff --git a/c/BUILD.bazel b/c/BUILD.bazel index dce1d70c66..44fccbdeb6 100644 --- a/c/BUILD.bazel +++ b/c/BUILD.bazel @@ -67,30 +67,6 @@ filegroup( visibility = ["//visibility:public"], ) -SBP_LEGACY_C_SOURCES = glob(["test/legacy/auto*.c"]) - -swift_cc_test( - name = "sbp-legacy-test", - srcs = [ - "test/check_main_legacy.c", - "test/check_edc.c", - "test/check_sbp.c", - "test/check_bitfield_macros.c", - "test/check_suites_legacy.h", - ] + SBP_LEGACY_C_SOURCES, - includes = [ - "include/libsbp", - ], - copts = [ - "-Wno-deprecated-declarations", - ], - type = UNIT, - deps = [ - ":sbp", - "@check", - ], -) - SBP_C_SOURCES = glob(["test/auto*.c"]) swift_cc_test( @@ -140,22 +116,3 @@ swift_cc_test( ], ) -SBP_CPP_LEGACY_SOURCES = glob(["test/legacy/cpp/auto*.cc"]) - -swift_cc_test( - name = "sbp-cpp-legacy-test", - srcs = [ - "test/legacy/cpp/test_sbp_stdio.cc", - ] + SBP_CPP_LEGACY_SOURCES, - data = [ - "test/legacy/cpp/sbp_data/gnss_data.sbp", - ], - copts = [ - "-Wno-deprecated-declarations", - ], - type = UNIT, - deps = [ - ":sbp", - "@googletest//:gtest_main", - ], -) diff --git a/c/examples/CMakeLists.txt b/c/examples/CMakeLists.txt index 66d7c1f0b8..94656201e4 100644 --- a/c/examples/CMakeLists.txt +++ b/c/examples/CMakeLists.txt @@ -2,6 +2,5 @@ option(BUILD_EXAMPLES "" OFF) if(BUILD_EXAMPLES) add_custom_target(examples) - add_subdirectory(legacy) add_subdirectory(libsbp) endif() diff --git a/c/examples/legacy/CMakeLists.txt b/c/examples/legacy/CMakeLists.txt deleted file mode 100644 index 268b4967ad..0000000000 --- a/c/examples/legacy/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -foreach(target example cpp_example tcp_example tcp_2sigma_example) - add_subdirectory(${target}) - add_dependencies(examples libsbp_legacy_${target}) -endforeach() diff --git a/c/examples/legacy/cpp_example/CMakeLists.txt b/c/examples/legacy/cpp_example/CMakeLists.txt deleted file mode 100644 index 05051a49b0..0000000000 --- a/c/examples/legacy/cpp_example/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) -project(libsbp_legacy_cpp_example) - -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") - -set(CMAKE_C_FLAGS "-Wall -Wextra -Wno-strict-prototypes -Werror -std=gnu99 -Wno-error=deprecated-declarations ${CMAKE_C_FLAGS}") -set(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror -std=c++11 -Wno-error=deprecated-declarations ${CMAKE_CXX_FLAGS}") - -find_package(PkgConfig) - -link_directories("/usr/local/lib/") -include_directories("/usr/local/include/") - -add_executable(libsbp_legacy_cpp_example cpp_example.cc) -target_link_libraries(libsbp_legacy_cpp_example sbp) diff --git a/c/examples/legacy/cpp_example/README.md b/c/examples/legacy/cpp_example/README.md deleted file mode 100644 index 4e7412ba0f..0000000000 --- a/c/examples/legacy/cpp_example/README.md +++ /dev/null @@ -1,49 +0,0 @@ -## Example of using the C++ classes for libsbp - -This example demonstrates parsing SBP from a file using the C++ classes - -## Requirements -On Debian-based systems (including Ubuntu 12.10 or later) you can get all -the requirements with: - -```shell -sudo apt-get install build-essential pkg-config cmake -``` - -On mac: - -```shell -brew install cmake -``` - -On other systems, you can obtain CMake from your operating system -package manager or from http://www.cmake.org/. - -## Installation - -Once you have the dependencies installed, create a build directory where the example will be built: - -```shell -mkdir build -cd build -``` - -Then invoke CMake to configure the build, and then build, - -```shell -cmake ../ -make -``` - -## Usage - -```shell -./libsbp_cpp_example -usage: ./libsbp_cpp_example [filename.sbp] -``` - -## LICENSE - -Copyright © 2019-2021 Swift Navigation - -Distributed under MIT. diff --git a/c/examples/legacy/cpp_example/cpp_example.cc b/c/examples/legacy/cpp_example/cpp_example.cc deleted file mode 100644 index f0fb61a7c1..0000000000 --- a/c/examples/legacy/cpp_example/cpp_example.cc +++ /dev/null @@ -1,118 +0,0 @@ -#include -#include - -#include -#include -#include - -void usage(char *prog_name) { - fprintf(stderr, "usage: %s [filename]\n", prog_name); -} - -class SbpFileReader : public sbp::IReader { - public: - SbpFileReader(const char *file_path) : file_stream_(file_path, std::ios::binary | std::ios_base::in) { } - - bool is_open() const { return file_stream_.is_open(); } - bool eof() const { return file_stream_.eof(); } - - s32 read(u8 *buffer, u32 buffer_length) override { - auto start_index = file_stream_.tellg(); - if (start_index == -1) { - return -1; - } - file_stream_.read(reinterpret_cast(buffer), buffer_length); - auto end_index = file_stream_.tellg(); - if (end_index == -1 || file_stream_.fail()) { - return -1; - } - - return static_cast(end_index - start_index); - } - - private: - std::ifstream file_stream_; -}; - -class ECEFHandler : private sbp::PayloadHandler { - public: - ECEFHandler(sbp::LegacyState *state) : sbp::PayloadHandler(state) { - } - - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, const msg_gps_time_t& msg) { - (void)sender_id; - (void)message_length; - std::cout << "Received new GPS_TME message with WN = " << msg.wn << ", TOW = " << msg.tow << "\n"; - } - - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, const msg_pos_ecef_t& msg) { - (void)sender_id; - (void)message_length; - std::cout << "Received new POS_ECEF message with TOW = " << msg.tow; - std::cout << ", (X,Y,Z) = (" << msg.x << "," << msg.y << "," << msg.z << ")\n"; - } -}; - -class LLHFrameHandler : private sbp::FrameHandler { - public: - LLHFrameHandler(sbp::LegacyState *state) : sbp::FrameHandler(state) { - } - - void handle_sbp_frame(uint16_t sender_id, uint16_t msg_type, - uint8_t payload_len, uint8_t payload[], - uint16_t frame_len, uint8_t frame[]) { - (void)sender_id; - (void)payload; - (void)frame; - if (msg_type == SBP_MSG_POS_LLH) { - std::cout << "Received new POS_LLH frame, payload length " << (int)payload_len << ", frame length " << frame_len << "\n"; - } else if (msg_type == SBP_MSG_GPS_TIME) { - std::cout << "Received new GPS_TIME frame, payload length " << (int)payload_len << ", frame length " << frame_len << "\n"; - } - } -}; - -class EverythingHandler : private sbp::AllFrameHandler { - public: - EverythingHandler(sbp::LegacyState *state) : sbp::AllFrameHandler(state) { - } - - void handle_sbp_frame(uint16_t sender_id, uint16_t msg_type, - uint8_t payload_len, uint8_t payload[], - uint16_t frame_len, uint8_t frame[]) { - (void)sender_id; - (void)payload; - (void)frame; - std::cout << "Received new frame, message type " << msg_type << ", payload length " << (int)payload_len << ", frame length " << frame_len << "\n"; - } -}; - -int main(int argc, char **argv) -{ - if (argc <= 1) { - usage(argv[0]); - exit(EXIT_FAILURE); - } - - const char *file_path = argv[1]; - - SbpFileReader reader(file_path); - if (!reader.is_open()) { - usage(argv[0]); - exit(EXIT_FAILURE); - } - - sbp::LegacyState s; - ECEFHandler ecef_handler(&s); - LLHFrameHandler llh_handler(&s); - EverythingHandler everything_handler(&s); - - s.set_reader(&reader); - - while(!reader.eof()) { - s.process(); - } - - return 0; -} - diff --git a/c/examples/legacy/example/CMakeLists.txt b/c/examples/legacy/example/CMakeLists.txt deleted file mode 100644 index e146e49d62..0000000000 --- a/c/examples/legacy/example/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) -project(libsbp_legacy_example) - -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") - -set(CMAKE_C_FLAGS "-Wall -Werror -Wno-error=deprecated-declarations -std=gnu99") - -add_executable(libsbp_legacy_example example.c) - -find_package(PkgConfig) -pkg_check_modules(LIBSERIALPORT libserialport) -link_directories(${LIBSERIALPORT_LIBRARY_DIRS}) -include_directories(${LIBSERIALPORT_INCLUDE_DIRS}) - -link_directories("/usr/local/lib/") -include_directories("/usr/local/include/") - -target_link_libraries(libsbp_legacy_example serialport sbp) diff --git a/c/examples/legacy/example/README.md b/c/examples/legacy/example/README.md deleted file mode 100644 index acde46a31f..0000000000 --- a/c/examples/legacy/example/README.md +++ /dev/null @@ -1,53 +0,0 @@ -## C example for libsbp - -An example C program, intended to be run on a host computer connected to -the Piksi, that parses incoming SBP messages from the Piksi and prints some of -them to the screen. - -## Requirements -On Debian-based systems (including Ubuntu 12.10 or later) you can get all -the requirements with: - -```shell -sudo apt-get install build-essential pkg-config cmake -``` - -On mac: - -```shell -brew install cmake -``` - -You should also install [libserialport](http://sigrok.org/wiki/Libserialport). - -On other systems, you can obtain CMake from your operating system -package manager or from http://www.cmake.org/. - -## Installation - -Once you have the dependencies installed, create a build directory where the example will be built: - -```shell -mkdir build -cd build -``` - -Then invoke CMake to configure the build, and then build, - -```shell -cmake ../ -make -``` - -## Usage - -```shell -./libsbp_example -usage: ./libsbp_example [-p serial port] -``` - -## LICENSE - -Copyright © 2015-2021 Swift Navigation - -Distributed under MIT. diff --git a/c/examples/legacy/example/example.c b/c/examples/legacy/example/example.c deleted file mode 100644 index 900c6b3746..0000000000 --- a/c/examples/legacy/example/example.c +++ /dev/null @@ -1,149 +0,0 @@ -#include -#include -#include -#include - -#include - -#include -#include -#include - -char *serial_port_name = NULL; -struct sp_port *piksi_port = NULL; -static sbp_msg_callbacks_node_t heartbeat_callback_node; - -void usage(char *prog_name) { - fprintf(stderr, "usage: %s [-p serial port]\n", prog_name); -} - -void setup_port() -{ - int result; - - printf("Attempting to configure the serial port...\n"); - - result = sp_set_baudrate(piksi_port, 115200); - if (result != SP_OK) { - fprintf(stderr, "Cannot set port baud rate!\n"); - exit(EXIT_FAILURE); - } - printf("Configured the baud rate...\n"); - - result = sp_set_flowcontrol(piksi_port, SP_FLOWCONTROL_NONE); - if (result != SP_OK) { - fprintf(stderr, "Cannot set flow control!\n"); - exit(EXIT_FAILURE); - } - printf("Configured the flow control...\n"); - - result = sp_set_bits(piksi_port, 8); - if (result != SP_OK) { - fprintf(stderr, "Cannot set data bits!\n"); - exit(EXIT_FAILURE); - } - printf("Configured the number of data bits...\n"); - - result = sp_set_parity(piksi_port, SP_PARITY_NONE); - if (result != SP_OK) { - fprintf(stderr, "Cannot set parity!\n"); - exit(EXIT_FAILURE); - } - - printf("Configured the parity...\n"); - - result = sp_set_stopbits(piksi_port, 1); - if (result != SP_OK) { - fprintf(stderr, "Cannot set stop bits!\n"); - exit(EXIT_FAILURE); - } - - printf("Configured the number of stop bits... done.\n"); -} - -void heartbeat_callback(u16 sender_id, u8 len, u8 msg[], void *context) -{ - (void)sender_id, (void)len, (void)msg, (void)context; - fprintf(stdout, "%s\n", __FUNCTION__); -} - -s32 piksi_port_read(u8 *buff, u32 n, void *context) -{ - (void)context; - s32 result; - - result = sp_blocking_read(piksi_port, buff, n, 0); - - return result; -} - -int main(int argc, char **argv) -{ - int opt; - int result = 0; - - sbp_state_t s; - - if (argc <= 1) { - usage(argv[0]); - exit(EXIT_FAILURE); - } - - while ((opt = getopt(argc, argv, "p:")) != -1) { - switch (opt) { - case 'p': - serial_port_name = (char *)calloc(strlen(optarg) + 1, sizeof(char)); - if (!serial_port_name) { - fprintf(stderr, "Cannot allocate memory!\n"); - exit(EXIT_FAILURE); - } - strcpy(serial_port_name, optarg); - break; - case 'h': - usage(argv[0]); - exit(EXIT_FAILURE); - } - } - - if (!serial_port_name) { - fprintf(stderr, "Please supply the serial port path where the Piksi is " \ - "connected!\n"); - exit(EXIT_FAILURE); - } - - result = sp_get_port_by_name(serial_port_name, &piksi_port); - if (result != SP_OK) { - fprintf(stderr, "Cannot find provided serial port!\n"); - exit(EXIT_FAILURE); - } - - printf("Attempting to open the serial port...\n"); - - result = sp_open(piksi_port, SP_MODE_READ); - if (result != SP_OK) { - fprintf(stderr, "Cannot open %s for reading!\n", serial_port_name); - exit(EXIT_FAILURE); - } - - setup_port(); - - sbp_state_init(&s); - - sbp_payload_callback_register(&s, SBP_MSG_HEARTBEAT, &heartbeat_callback, NULL, - &heartbeat_callback_node); - - while(1) { - sbp_process(&s, &piksi_port_read); - } - - result = sp_close(piksi_port); - if (result != SP_OK) { - fprintf(stderr, "Cannot close %s properly!\n", serial_port_name); - } - - sp_free_port(piksi_port); - - free(serial_port_name); - - return 0; -} diff --git a/c/examples/legacy/tcp_2sigma_example/CMakeLists.txt b/c/examples/legacy/tcp_2sigma_example/CMakeLists.txt deleted file mode 100644 index 990ceda50b..0000000000 --- a/c/examples/legacy/tcp_2sigma_example/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) -project(libsbp_legacy_tcp_2sigma_example) - -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") - -set(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror -Wno-error=deprecated-declarations -std=c++14") - -add_executable(libsbp_legacy_tcp_2sigma_example tcp_2sigma_example.cc) - -find_package(PkgConfig) -find_package(Eigen3) - -option(SHOW_PLOT "" OFF) - -link_directories("/usr/local/lib/") -include_directories("/usr/local/include/") - -target_link_libraries(libsbp_legacy_tcp_2sigma_example sbp) - -if (SHOW_PLOT) - find_package(OpenCV) - set(CMAKE_CXX_FLAGS "-DSHOW_PLOT ${CMAKE_CXX_FLAGS}") - target_link_libraries(libsbp_legacy_tcp_2sigma_example opencv_core opencv_imgproc opencv_highgui) -endif() diff --git a/c/examples/legacy/tcp_2sigma_example/README.md b/c/examples/legacy/tcp_2sigma_example/README.md deleted file mode 100644 index 805ab1e169..0000000000 --- a/c/examples/legacy/tcp_2sigma_example/README.md +++ /dev/null @@ -1,67 +0,0 @@ -## 2 sigma calculation example for libsbp - -Example demonstrating how to parse SBP data from a TCP port and compute the -ellipse representing the 2 sigma/95% confidence level. - -## Requirements for basic build -Requires Eigen 3 and cmake. On Debian-based systems you can get all of -the requirements with: - -```shell -sudo apt-get install build-essential pkg-config cmake libeigen3-dev -``` - -On mac: - -```shell -brew install cmake eigen -``` - -On other systems, you can obtain CMake from your operating system -package manager or from http://www.cmake.org/. - -## Requirements for graphical build -If compiled with -DSHOW\_PLOT then the ellipses will be graphically displayed. -This functionality requires OpenCV3. On Debian-based systems: - -```shell -sudo apt-get install libopencv-dev -``` - -On mac: - -```shell -brew install opencv@3 -``` - -## Installation - -Once you have the dependencies installed, create a build directory where the example will be built: - -```shell -mkdir build -cd build -``` - -Then invoke CMake to configure the build. For a non-graphical build: - -```shell -cmake .. -``` - -Or for a graphical build: - -```shell -cmake .. -DSHOW_PLOT=true -``` - -## Usage - -```shell -./libsbp_tcp_2sigma_example -usage: ./libsbp_tcp_2sigma_example [-a address -p port] -``` - -## LICENSE - -Copyright © 2021 Swift Navigation diff --git a/c/examples/legacy/tcp_2sigma_example/tcp_2sigma_example.cc b/c/examples/legacy/tcp_2sigma_example/tcp_2sigma_example.cc deleted file mode 100644 index b9e67b436f..0000000000 --- a/c/examples/legacy/tcp_2sigma_example/tcp_2sigma_example.cc +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Example demonstrating how to parse SBP data from a TCP port and compute the - * ellipse representing the 2 sigma confidence level. - * - * Requires libsbp (https://github.com/swift-nav/libsbp) and Eigen 3 (https://eigen.tuxfamily.org/). - * Eigen 3 is provided by the libeigen3-dev package on Debian-like Linux distributions. - * - * Compile using: - * g++ tcp_2sigma_example.cc -I ${LIBSBP}/c/include/ -L ${LIBSBP}/c/build/src/ -lsbp - * - * If compiled with -DSHOW_PLOT then the ellipses will be graphically displayed. - * This functionality requires OpenCV3 (https://opencv.org/) which is provided - * by the libopencv-dev package on Debian-like Linux distributions. - * - * Compile using: - * g++ tcp_2sigma_example.cc -DSHOW_PLOT -I ${LIBSBP}/c/include/ -L ${LIBSBP}/c/build/src/ -lsbp -lopencv_core -lopencv_imgproc -lopencv_highgui - * - * Originally adapted from https://github.com/swift-nav/libsbp/blob/master/c/example/tcp_example/tcp_example.c - */ - -#ifndef SHOW_PLOT -#define SHOW_PLOT 0 -#endif /* SHOW_PLOT */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if SHOW_PLOT -#include -#include -#include -#include -#endif /* SHOW_PLOT */ - -#include -#include -#include - -// width and height of the plot window in pixels -#define SIZE_PIXELS 300 -// width and height of the plot window in metres -#define SIZE_METRES 10 - - -void usage(const char* prog_name) { - fprintf(stderr, "usage: %s [-a address -p port]\n", prog_name); -} - - -int open_socket(const char* host, int port) { - struct sockaddr_in server; - int fd = socket(AF_INET , SOCK_STREAM , 0); - - if(fd < 0) { - fprintf(stderr, "Could not create socket\n"); - return -1; - } - - memset(&server, '0', sizeof(server)); - server.sin_addr.s_addr = inet_addr(host); - server.sin_family = AF_INET; - server.sin_port = htons(port); - - if(connect(fd, (struct sockaddr *)&server , sizeof(server)) < 0) { - fprintf(stderr, "Connection error\n"); - close(fd); - return -1; - } - - return fd; -} - - -/* - * Calculate the half major axis length, half minor axis length and rotation - * angle for an error ellipse corresponding to the confidence interval - * 'chi_squared' with the covariance matrix 'covmat'. - * - * Assumes normal distribution. - * - * See https://www.visiondummy.com/2014/04/draw-error-ellipse-representing-covariance-matrix/ - * for an explanation of the algorithm. - */ -bool get_ellipse_parameters(const double& chi_squared, const Eigen::Matrix2d& covmat, double& half_major_axis, double& half_minor_axis, double& angle) { - std::vector> eigen_vectors_and_values; - - // compute eigenvalues and eigenvectors - Eigen::SelfAdjointEigenSolver eigensolver(covmat); - if(eigensolver.info() != Eigen::Success) { - return false; - } - - // copy results into eigen_vectors_and_values - Eigen::Vector2d eigen_values = eigensolver.eigenvalues(); - Eigen::Matrix2d eigen_vectors = eigensolver.eigenvectors(); - for(int i = 0; i < eigen_values.size(); i++) { - std::tuple vec_and_val(eigen_values[i], eigen_vectors.col(i)); - eigen_vectors_and_values.push_back(vec_and_val); - } - - // sort eigen_vectors_and_values in descending order of eigenvalue - std::sort(eigen_vectors_and_values.begin(), eigen_vectors_and_values.end(), - [&](const std::tuple& a, const std::tuple& b) -> bool{ - return std::get(b) < std::get(a); - }); - - // calculate the angle between the largest eigenvector and the x-axis - Eigen::Vector2d largest_eigenvector = std::get(eigen_vectors_and_values[0]); - angle = atan2(largest_eigenvector[1], largest_eigenvector[0]); - - // shift the angle to the [0, 2pi] interval instead of [-pi, pi] - if(angle < 0) angle += 2 * M_PI; - - // convert to degrees - angle = 180. * angle / M_PI; - - // calculate the length of the minor and major axes - half_major_axis = chi_squared * sqrt(std::get(eigen_vectors_and_values[0])); - half_minor_axis = chi_squared * sqrt(std::get(eigen_vectors_and_values[1])); - - return true; -} - - -#if SHOW_PLOT -void plot_ellipse(const double& half_major_axis, const double& half_minor_axis, const double& angle) { - // the mean is nominally at the origin (i.e. reported lat/lon) but - // for graphing purposes we shift it to the middle of our plot window - cv::Point2f mean(SIZE_PIXELS/2, SIZE_PIXELS/2); - - // scale factor from metres to pixels - double scale = SIZE_PIXELS / SIZE_METRES; - - // negative angle because OpenCV defines the angle clockwise instead of - // anti-clockwise - cv::RotatedRect ellipse(mean, cv::Size2f(half_major_axis * scale, half_minor_axis * scale), -angle); - - //Show the result - cv::Mat visualizeimage(SIZE_PIXELS, SIZE_PIXELS, CV_8UC1, cv::Scalar::all(0)); - cv::ellipse(visualizeimage, ellipse, cv::Scalar::all(255), 2); - cv::imshow("2 Sigma Ellipse", visualizeimage); -} -#endif /* SHOW_PLOT */ - - -void pos_llh_cov_callback(u16 /*sender_id*/, u8 /*len*/, u8 msg[], void* /*context*/) { - const msg_pos_llh_cov_t* msg_pos_llh_cov = (msg_pos_llh_cov_t*)msg; - if((msg_pos_llh_cov->flags & 0x7) != 0) { - printf("TOW %u ms, Lat: %.15f deg, Lon: %.15f deg, Hgt: %.15f m\n", msg_pos_llh_cov->tow, msg_pos_llh_cov->lat, msg_pos_llh_cov->lon, msg_pos_llh_cov->height); - - // north/east submatrix - Eigen::Matrix2d covmat; - covmat << msg_pos_llh_cov->cov_n_n, msg_pos_llh_cov->cov_n_e, msg_pos_llh_cov->cov_n_e, msg_pos_llh_cov->cov_e_e; - - /* - * Starling computes horizontal accuracy (as reported in - * MSG_POS_LLH.h_accuracy) as the square root of the L2 norm of - * the north/east submatrix. So the naive (but inaccurate) approach - * is just to double it to get the worst-case 2 \Sigma value - */ - double hrms = sqrt(covmat.operatorNorm()) * 2.; - printf("\t2DRMS (naive): %.3f m -> area %.3f m^2\n", hrms, M_PI * hrms * hrms); - - /* - * A more accurate approach is to compute the error ellipse corresponding to - * the 95% confidence interval - */ - double half_major_axis, half_minor_axis, angle; - - /* - * From https://people.richland.edu/james/lecture/m170/tbl-chi.html - * 95% confidence interval => area to the right = 0.05, 2 degrees of freedom => - * sqrt(5.991) = 2.4477 - * - * For 99% confidence interval this would be sqrt(9.210) = 3.0348 - */ - const double chi_squared = 2.4477; - - if(get_ellipse_parameters(chi_squared, covmat, half_major_axis, half_minor_axis, angle)) { - double area = M_PI * half_major_axis * half_minor_axis; - printf("\tEllipse parameters: half major axis %g m, half minor axis %g m, angle %g deg -> area %.3f m^2\n", half_major_axis, half_minor_axis, angle, area); - -#if SHOW_PLOT - plot_ellipse(half_major_axis, half_minor_axis, angle); -#endif /* SHOW_PLOT */ - } - } else { - printf("No fix\n"); - } -} - - -s32 socket_read(u8* buff, u32 n, void* context) { - int fd = *(int*)context; - return read(fd, buff, n); -} - - -int main(int argc, char* const argv[]) { - int opt; - char* host = NULL; - char* port = NULL; - sbp_state_t sbp_state; - sbp_msg_callbacks_node_t callback_node[1]; // note: one node is required per callback - int fd; - - if(argc <= 2) { - usage(argv[0]); - exit(EXIT_FAILURE); - } - - while((opt = getopt(argc, argv, "a:p:")) != -1) { - switch (opt) { - case 'a': - host = optarg; - break; - case 'p': - port = optarg; - break; - case 'h': - usage(argv[0]); - exit(EXIT_FAILURE); - default: - break; - } - } - - if(!host || !port) { - fprintf(stderr, "Please supply the address and port of the SBP data stream!\n"); - exit(EXIT_FAILURE); - } - - fd = open_socket(host, atoi(port)); - if(fd < 0) { - return EXIT_FAILURE; - } - -#if SHOW_PLOT - cv::namedWindow("2 Sigma Ellipse"); - cv::startWindowThread(); -#endif /* SHOW_PLOT */ - - sbp_state_init(&sbp_state); - sbp_state_set_io_context(&sbp_state, (void*)&fd); - sbp_payload_callback_register(&sbp_state, SBP_MSG_POS_LLH_COV, &pos_llh_cov_callback, NULL, &callback_node[0]); - - while(1) { - switch(sbp_process(&sbp_state, &socket_read)) { - case SBP_OK: - case SBP_OK_CALLBACK_EXECUTED: - case SBP_OK_CALLBACK_UNDEFINED: - break; - case SBP_CRC_ERROR: - printf("CRC Error\n"); - break; - } - } - - close(fd); - return EXIT_SUCCESS; -} diff --git a/c/examples/legacy/tcp_example/CMakeLists.txt b/c/examples/legacy/tcp_example/CMakeLists.txt deleted file mode 100644 index b262ad7f82..0000000000 --- a/c/examples/legacy/tcp_example/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) -project(libsbp_legacy_tcp_example) - -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") - -set(CMAKE_C_FLAGS "-Wall -Wextra -Wno-strict-prototypes -Werror -Wno-error=deprecated-declarations -std=gnu99 ${CMAKE_C_FLAGS}") - -add_executable(libsbp_legacy_tcp_example tcp_example.c) - -find_package(PkgConfig) - -link_directories("/usr/local/lib/") -include_directories("/usr/local/include/") - -target_link_libraries(libsbp_legacy_tcp_example sbp) diff --git a/c/examples/legacy/tcp_example/README.md b/c/examples/legacy/tcp_example/README.md deleted file mode 100644 index c90ea26ea0..0000000000 --- a/c/examples/legacy/tcp_example/README.md +++ /dev/null @@ -1,49 +0,0 @@ -## TCP example in C for libsbp - -This example demonstrates parsing SBP over a TCP connection. - -## Requirements -On Debian-based systems (including Ubuntu 12.10 or later) you can get all -the requirements with: - -```shell -sudo apt-get install build-essential pkg-config cmake -``` - -On mac: - -```shell -brew install cmake -``` - -On other systems, you can obtain CMake from your operating system -package manager or from http://www.cmake.org/. - -## Installation - -Once you have the dependencies installed, create a build directory where the example will be built: - -```shell -mkdir build -cd build -``` - -Then invoke CMake to configure the build, and then build, - -```shell -cmake ../ -make -``` - -## Usage - -```shell -./libsbp_tcp_example -usage: ./libsbp_tcp_example [-a address -p port] -``` - -## LICENSE - -Copyright © 2018-2021 Swift Navigation - -Distributed under MIT. diff --git a/c/examples/legacy/tcp_example/tcp_example.c b/c/examples/legacy/tcp_example/tcp_example.c deleted file mode 100644 index e0327bc096..0000000000 --- a/c/examples/legacy/tcp_example/tcp_example.c +++ /dev/null @@ -1,116 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -char *tcp_ip_addr = NULL; -char *tcp_ip_port = NULL; -static sbp_msg_callbacks_node_t heartbeat_callback_node; -int socket_desc = -1; - -void usage(char *prog_name) { - fprintf(stderr, "usage: %s [-a address -p port]\n", prog_name); -} - -void setup_socket() -{ - struct sockaddr_in server; - socket_desc = socket(AF_INET , SOCK_STREAM , 0); - if (socket_desc == -1) - { - fprintf(stderr, "Could not create socket\n"); - } - - memset(&server, '0', sizeof(server)); - server.sin_addr.s_addr = inet_addr(tcp_ip_addr); - server.sin_family = AF_INET; - server.sin_port = htons(atoi(tcp_ip_port)); - - if (connect(socket_desc, (struct sockaddr *)&server , sizeof(server)) < 0) - { - fprintf(stderr, "Connection error\n"); - } -} - -void close_socket() -{ - close(socket_desc); -} - -void heartbeat_callback(u16 sender_id, u8 len, u8 msg[], void *context) -{ - (void)sender_id, (void)len, (void)msg, (void)context; - fprintf(stdout, "%s\n", __FUNCTION__); -} - -s32 socket_read(u8 *buff, u32 n, void *context) -{ - (void)context; - s32 result; - - result = read(socket_desc, buff, n); - return result; -} - -int main(int argc, char **argv) -{ - int opt; - int result = 0; - sbp_state_t s; - - if (argc <= 2) { - usage(argv[0]); - exit(EXIT_FAILURE); - } - - while ((opt = getopt(argc, argv, "a:p:")) != -1) { - switch (opt) { - case 'a': - tcp_ip_addr = (char *)calloc(strlen(optarg) + 1, sizeof(char)); - if (!tcp_ip_addr) { - fprintf(stderr, "Cannot allocate memory!\n"); - exit(EXIT_FAILURE); - } - strcpy(tcp_ip_addr, optarg); - break; - case 'p': - tcp_ip_port = (char *)calloc(strlen(optarg) + 1, sizeof(char)); - if (!tcp_ip_port) { - fprintf(stderr, "Cannot allocate memory!\n"); - exit(EXIT_FAILURE); - } - strcpy(tcp_ip_port, optarg); - break; - case 'h': - usage(argv[0]); - exit(EXIT_FAILURE); - default: - break; - } - } - - if ((!tcp_ip_addr) || (!tcp_ip_port)) { - fprintf(stderr, "Please supply the address and port of the SBP data stream!\n"); - exit(EXIT_FAILURE); - } - - setup_socket(); - sbp_state_init(&s); - sbp_payload_callback_register(&s, SBP_MSG_HEARTBEAT, &heartbeat_callback, NULL, - &heartbeat_callback_node); - - while(1) { - sbp_process(&s, &socket_read); - } - - close_socket(); - free(tcp_ip_addr); - free(tcp_ip_port); - return result; -} diff --git a/c/include/libsbp/acquisition/AcqSvProfile.h b/c/include/libsbp/acquisition/AcqSvProfile.h index f9eaa76dac..ed9d778d89 100644 --- a/c/include/libsbp/acquisition/AcqSvProfile.h +++ b/c/include/libsbp/acquisition/AcqSvProfile.h @@ -69,7 +69,7 @@ typedef struct { /** * GNSS signal for which acquisition was attempted */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; /** * Acq frequency bin width [Hz] diff --git a/c/include/libsbp/acquisition/MSG_ACQ_RESULT.h b/c/include/libsbp/acquisition/MSG_ACQ_RESULT.h index fae18d7411..4b7d4d19ba 100644 --- a/c/include/libsbp/acquisition/MSG_ACQ_RESULT.h +++ b/c/include/libsbp/acquisition/MSG_ACQ_RESULT.h @@ -65,7 +65,7 @@ typedef struct { /** * GNSS signal for which acquisition was attempted */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; } sbp_msg_acq_result_t; /** diff --git a/c/include/libsbp/acquisition_macros.h b/c/include/libsbp/acquisition_macros.h index 61fa17f10b..afad21051b 100644 --- a/c/include/libsbp/acquisition_macros.h +++ b/c/include/libsbp/acquisition_macros.h @@ -18,88 +18,70 @@ #ifndef LIBSBP_ACQUISITION_MACROS_H #define LIBSBP_ACQUISITION_MACROS_H -#define SBP_MSG_ACQ_RESULT 0x002F /** - * Encoded length of sbp_msg_acq_result_t (V4 API) and - * msg_acq_result_t (legacy API) + * Encoded length of sbp_msg_acq_result_t (V4 API) */ #define SBP_MSG_ACQ_RESULT_ENCODED_LEN 14u -#define SBP_MSG_ACQ_RESULT_DEP_C 0x001F /** - * Encoded length of sbp_msg_acq_result_dep_c_t (V4 API) and - * msg_acq_result_dep_c_t (legacy API) + * Encoded length of sbp_msg_acq_result_dep_c_t (V4 API) */ #define SBP_MSG_ACQ_RESULT_DEP_C_ENCODED_LEN 16u -#define SBP_MSG_ACQ_RESULT_DEP_B 0x0014 /** - * Encoded length of sbp_msg_acq_result_dep_b_t (V4 API) and - * msg_acq_result_dep_b_t (legacy API) + * Encoded length of sbp_msg_acq_result_dep_b_t (V4 API) */ #define SBP_MSG_ACQ_RESULT_DEP_B_ENCODED_LEN 16u -#define SBP_MSG_ACQ_RESULT_DEP_A 0x0015 /** - * Encoded length of sbp_msg_acq_result_dep_a_t (V4 API) and - * msg_acq_result_dep_a_t (legacy API) + * Encoded length of sbp_msg_acq_result_dep_a_t (V4 API) */ #define SBP_MSG_ACQ_RESULT_DEP_A_ENCODED_LEN 13u /** - * Encoded length of sbp_acq_sv_profile_t (V4 API) and - * acq_sv_profile_t (legacy API) + * Encoded length of sbp_acq_sv_profile_t (V4 API) */ #define SBP_ACQ_SV_PROFILE_ENCODED_LEN 33u /** - * Encoded length of sbp_acq_sv_profile_dep_t (V4 API) and - * acq_sv_profile_dep_t (legacy API) + * Encoded length of sbp_acq_sv_profile_dep_t (V4 API) */ #define SBP_ACQ_SV_PROFILE_DEP_ENCODED_LEN 35u -#define SBP_MSG_ACQ_SV_PROFILE 0x002E /** * The maximum number of items that can be stored in - * sbp_msg_acq_sv_profile_t::acq_sv_profile (V4 API) or - * msg_acq_sv_profile_t::acq_sv_profile (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_acq_sv_profile_t::acq_sv_profile before the maximum SBP message size + * is exceeded */ #define SBP_MSG_ACQ_SV_PROFILE_ACQ_SV_PROFILE_MAX 7u /** - * Encoded length of sbp_msg_acq_sv_profile_t (V4 API) and - * msg_acq_sv_profile_t (legacy API) + * Encoded length of sbp_msg_acq_sv_profile_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_acq_sv_profile_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_ACQ_SV_PROFILE_ENCODED_OVERHEAD 0u -#define SBP_MSG_ACQ_SV_PROFILE_DEP 0x001E /** * The maximum number of items that can be stored in - * sbp_msg_acq_sv_profile_dep_t::acq_sv_profile (V4 API) or - * msg_acq_sv_profile_dep_t::acq_sv_profile (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_acq_sv_profile_dep_t::acq_sv_profile before the maximum SBP message + * size is exceeded */ #define SBP_MSG_ACQ_SV_PROFILE_DEP_ACQ_SV_PROFILE_MAX 7u /** - * Encoded length of sbp_msg_acq_sv_profile_dep_t (V4 API) and - * msg_acq_sv_profile_dep_t (legacy API) + * Encoded length of sbp_msg_acq_sv_profile_dep_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_acq_sv_profile_dep_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) diff --git a/c/include/libsbp/bootload_macros.h b/c/include/libsbp/bootload_macros.h index eb9771fa39..721f4274e4 100644 --- a/c/include/libsbp/bootload_macros.h +++ b/c/include/libsbp/bootload_macros.h @@ -18,14 +18,11 @@ #ifndef LIBSBP_BOOTLOAD_MACROS_H #define LIBSBP_BOOTLOAD_MACROS_H -#define SBP_MSG_BOOTLOADER_HANDSHAKE_REQ 0x00B3 /** - * Encoded length of sbp_msg_bootloader_handshake_req_t (V4 API) and - * msg_bootloader_handshake_req_t (legacy API) + * Encoded length of sbp_msg_bootloader_handshake_req_t (V4 API) */ #define SBP_MSG_BOOTLOADER_HANDSHAKE_REQ_ENCODED_LEN 0u -#define SBP_MSG_BOOTLOADER_HANDSHAKE_RESP 0x00B4 #define SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MAJOR_PROTOCOL_VERSION_NUMBER_MASK \ (0xffu) #define SBP_BOOTLOADER_HANDSHAKE_RESP_SBP_MAJOR_PROTOCOL_VERSION_NUMBER_SHIFT \ @@ -74,73 +71,60 @@ /** * The maximum number of items that can be stored in - * sbp_msg_bootloader_handshake_resp_t::version (V4 API) or - * msg_bootloader_handshake_resp_t::version (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_bootloader_handshake_resp_t::version before the maximum SBP message + * size is exceeded */ #define SBP_MSG_BOOTLOADER_HANDSHAKE_RESP_VERSION_MAX 251u /** - * Encoded length of sbp_msg_bootloader_handshake_resp_t (V4 API) and - * msg_bootloader_handshake_resp_t (legacy API) + * Encoded length of sbp_msg_bootloader_handshake_resp_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_bootloader_handshake_resp_encoded_len to determine the actual size - * of an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * of an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_BOOTLOADER_HANDSHAKE_RESP_ENCODED_OVERHEAD 4u -#define SBP_MSG_BOOTLOADER_JUMP_TO_APP 0x00B1 /** - * Encoded length of sbp_msg_bootloader_jump_to_app_t (V4 API) and - * msg_bootloader_jump_to_app_t (legacy API) + * Encoded length of sbp_msg_bootloader_jump_to_app_t (V4 API) */ #define SBP_MSG_BOOTLOADER_JUMP_TO_APP_ENCODED_LEN 1u -#define SBP_MSG_NAP_DEVICE_DNA_REQ 0x00DE /** - * Encoded length of sbp_msg_nap_device_dna_req_t (V4 API) and - * msg_nap_device_dna_req_t (legacy API) + * Encoded length of sbp_msg_nap_device_dna_req_t (V4 API) */ #define SBP_MSG_NAP_DEVICE_DNA_REQ_ENCODED_LEN 0u -#define SBP_MSG_NAP_DEVICE_DNA_RESP 0x00DD /** * The maximum number of items that can be stored in - * sbp_msg_nap_device_dna_resp_t::dna (V4 API) or msg_nap_device_dna_resp_t::dna - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_nap_device_dna_resp_t::dna before the maximum SBP message size is + * exceeded */ #define SBP_MSG_NAP_DEVICE_DNA_RESP_DNA_MAX 8u /** - * Encoded length of sbp_msg_nap_device_dna_resp_t (V4 API) and - * msg_nap_device_dna_resp_t (legacy API) + * Encoded length of sbp_msg_nap_device_dna_resp_t (V4 API) */ #define SBP_MSG_NAP_DEVICE_DNA_RESP_ENCODED_LEN 8u -#define SBP_MSG_BOOTLOADER_HANDSHAKE_DEP_A 0x00B0 /** * The maximum number of items that can be stored in - * sbp_msg_bootloader_handshake_dep_a_t::handshake (V4 API) or - * msg_bootloader_handshake_dep_a_t::handshake (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_bootloader_handshake_dep_a_t::handshake before the maximum SBP + * message size is exceeded */ #define SBP_MSG_BOOTLOADER_HANDSHAKE_DEP_A_HANDSHAKE_MAX 255u /** - * Encoded length of sbp_msg_bootloader_handshake_dep_a_t (V4 API) and - * msg_bootloader_handshake_dep_a_t (legacy API) + * Encoded length of sbp_msg_bootloader_handshake_dep_a_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_bootloader_handshake_dep_a_encoded_len to determine the actual size - * of an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * of an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) diff --git a/c/include/libsbp/ext_events_macros.h b/c/include/libsbp/ext_events_macros.h index 9637908da2..69be8aa876 100644 --- a/c/include/libsbp/ext_events_macros.h +++ b/c/include/libsbp/ext_events_macros.h @@ -18,7 +18,6 @@ #ifndef LIBSBP_EXT_EVENTS_MACROS_H #define LIBSBP_EXT_EVENTS_MACROS_H -#define SBP_MSG_EXT_EVENT 0x0101 #define SBP_EXT_EVENT_TIME_QUALITY_MASK (0x1u) #define SBP_EXT_EVENT_TIME_QUALITY_SHIFT (1u) #define SBP_EXT_EVENT_TIME_QUALITY_GET(flags) \ @@ -50,8 +49,7 @@ #define SBP_EXT_EVENT_NEW_LEVEL_OF_PIN_LOW (0) #define SBP_EXT_EVENT_NEW_LEVEL_OF_PIN_HIGH (1) /** - * Encoded length of sbp_msg_ext_event_t (V4 API) and - * msg_ext_event_t (legacy API) + * Encoded length of sbp_msg_ext_event_t (V4 API) */ #define SBP_MSG_EXT_EVENT_ENCODED_LEN 12u diff --git a/c/include/libsbp/file_io_macros.h b/c/include/libsbp/file_io_macros.h index d9de091d2f..e016887014 100644 --- a/c/include/libsbp/file_io_macros.h +++ b/c/include/libsbp/file_io_macros.h @@ -18,174 +18,145 @@ #ifndef LIBSBP_FILE_IO_MACROS_H #define LIBSBP_FILE_IO_MACROS_H -#define SBP_MSG_FILEIO_READ_REQ 0x00A8 /** * The maximum number of items that can be stored in - * sbp_msg_fileio_read_req_t::filename (V4 API) or - * msg_fileio_read_req_t::filename (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_fileio_read_req_t::filename before the maximum SBP message size is + * exceeded */ #define SBP_MSG_FILEIO_READ_REQ_FILENAME_MAX 246u /** - * Encoded length of sbp_msg_fileio_read_req_t (V4 API) and - * msg_fileio_read_req_t (legacy API) + * Encoded length of sbp_msg_fileio_read_req_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_fileio_read_req_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_FILEIO_READ_REQ_ENCODED_OVERHEAD 9u -#define SBP_MSG_FILEIO_READ_RESP 0x00A3 /** * The maximum number of items that can be stored in - * sbp_msg_fileio_read_resp_t::contents (V4 API) or - * msg_fileio_read_resp_t::contents (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_fileio_read_resp_t::contents before the maximum SBP message size is + * exceeded */ #define SBP_MSG_FILEIO_READ_RESP_CONTENTS_MAX 251u /** - * Encoded length of sbp_msg_fileio_read_resp_t (V4 API) and - * msg_fileio_read_resp_t (legacy API) + * Encoded length of sbp_msg_fileio_read_resp_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_fileio_read_resp_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_FILEIO_READ_RESP_ENCODED_OVERHEAD 4u -#define SBP_MSG_FILEIO_READ_DIR_REQ 0x00A9 /** * The maximum number of items that can be stored in - * sbp_msg_fileio_read_dir_req_t::dirname (V4 API) or - * msg_fileio_read_dir_req_t::dirname (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_fileio_read_dir_req_t::dirname before the maximum SBP message size is + * exceeded */ #define SBP_MSG_FILEIO_READ_DIR_REQ_DIRNAME_MAX 247u /** - * Encoded length of sbp_msg_fileio_read_dir_req_t (V4 API) and - * msg_fileio_read_dir_req_t (legacy API) + * Encoded length of sbp_msg_fileio_read_dir_req_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_fileio_read_dir_req_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_FILEIO_READ_DIR_REQ_ENCODED_OVERHEAD 8u -#define SBP_MSG_FILEIO_READ_DIR_RESP 0x00AA /** * The maximum number of items that can be stored in - * sbp_msg_fileio_read_dir_resp_t::contents (V4 API) or - * msg_fileio_read_dir_resp_t::contents (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_fileio_read_dir_resp_t::contents before the maximum SBP message size + * is exceeded */ #define SBP_MSG_FILEIO_READ_DIR_RESP_CONTENTS_MAX 251u /** - * Encoded length of sbp_msg_fileio_read_dir_resp_t (V4 API) and - * msg_fileio_read_dir_resp_t (legacy API) + * Encoded length of sbp_msg_fileio_read_dir_resp_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_fileio_read_dir_resp_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_FILEIO_READ_DIR_RESP_ENCODED_OVERHEAD 4u -#define SBP_MSG_FILEIO_REMOVE 0x00AC /** * The maximum number of items that can be stored in - * sbp_msg_fileio_remove_t::filename (V4 API) or msg_fileio_remove_t::filename - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_fileio_remove_t::filename before the maximum SBP message size is + * exceeded */ #define SBP_MSG_FILEIO_REMOVE_FILENAME_MAX 255u /** - * Encoded length of sbp_msg_fileio_remove_t (V4 API) and - * msg_fileio_remove_t (legacy API) + * Encoded length of sbp_msg_fileio_remove_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_fileio_remove_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_FILEIO_REMOVE_ENCODED_OVERHEAD 0u -#define SBP_MSG_FILEIO_WRITE_REQ 0x00AD /** * The maximum number of items that can be stored in - * sbp_msg_fileio_write_req_t::filename (V4 API) or - * msg_fileio_write_req_t::filename (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_fileio_write_req_t::filename before the maximum SBP message size is + * exceeded */ #define SBP_MSG_FILEIO_WRITE_REQ_FILENAME_MAX 247u /** * The maximum number of items that can be stored in - * sbp_msg_fileio_write_req_t::data (V4 API) or msg_fileio_write_req_t::data - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_fileio_write_req_t::data before the maximum SBP message size is + * exceeded */ #define SBP_MSG_FILEIO_WRITE_REQ_DATA_MAX 247u /** - * Encoded length of sbp_msg_fileio_write_req_t (V4 API) and - * msg_fileio_write_req_t (legacy API) + * Encoded length of sbp_msg_fileio_write_req_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_fileio_write_req_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_FILEIO_WRITE_REQ_ENCODED_OVERHEAD 8u -#define SBP_MSG_FILEIO_WRITE_RESP 0x00AB /** - * Encoded length of sbp_msg_fileio_write_resp_t (V4 API) and - * msg_fileio_write_resp_t (legacy API) + * Encoded length of sbp_msg_fileio_write_resp_t (V4 API) */ #define SBP_MSG_FILEIO_WRITE_RESP_ENCODED_LEN 4u -#define SBP_MSG_FILEIO_CONFIG_REQ 0x1001 /** - * Encoded length of sbp_msg_fileio_config_req_t (V4 API) and - * msg_fileio_config_req_t (legacy API) + * Encoded length of sbp_msg_fileio_config_req_t (V4 API) */ #define SBP_MSG_FILEIO_CONFIG_REQ_ENCODED_LEN 4u -#define SBP_MSG_FILEIO_CONFIG_RESP 0x1002 /** - * Encoded length of sbp_msg_fileio_config_resp_t (V4 API) and - * msg_fileio_config_resp_t (legacy API) + * Encoded length of sbp_msg_fileio_config_resp_t (V4 API) */ #define SBP_MSG_FILEIO_CONFIG_RESP_ENCODED_LEN 16u diff --git a/c/include/libsbp/flash_macros.h b/c/include/libsbp/flash_macros.h index 39a8e87666..70cd7ab909 100644 --- a/c/include/libsbp/flash_macros.h +++ b/c/include/libsbp/flash_macros.h @@ -18,7 +18,6 @@ #ifndef LIBSBP_FLASH_MACROS_H #define LIBSBP_FLASH_MACROS_H -#define SBP_MSG_FLASH_PROGRAM 0x00E6 #define SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_MASK (0x1u) #define SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_SHIFT (0u) #define SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_GET(flags) \ @@ -37,35 +36,30 @@ #define SBP_FLASH_PROGRAM_FLASH_TARGET_TO_READ_FLASH_M25 (1) /** * The maximum number of items that can be stored in - * sbp_msg_flash_program_t::addr_start (V4 API) or - * msg_flash_program_t::addr_start (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_flash_program_t::addr_start before the maximum SBP message size is + * exceeded */ #define SBP_MSG_FLASH_PROGRAM_ADDR_START_MAX 3u /** * The maximum number of items that can be stored in - * sbp_msg_flash_program_t::data (V4 API) or msg_flash_program_t::data (legacy - * API) before the maximum SBP message size is exceeded + * sbp_msg_flash_program_t::data before the maximum SBP message size is exceeded */ #define SBP_MSG_FLASH_PROGRAM_DATA_MAX 250u /** - * Encoded length of sbp_msg_flash_program_t (V4 API) and - * msg_flash_program_t (legacy API) + * Encoded length of sbp_msg_flash_program_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_flash_program_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_FLASH_PROGRAM_ENCODED_OVERHEAD 5u -#define SBP_MSG_FLASH_DONE 0x00E0 #define SBP_FLASH_DONE_RESPONSE_CODE_MASK (0x7u) #define SBP_FLASH_DONE_RESPONSE_CODE_SHIFT (0u) #define SBP_FLASH_DONE_RESPONSE_CODE_GET(flags) \ @@ -86,12 +80,10 @@ #define SBP_FLASH_DONE_RESPONSE_CODE_FLASH_INVALID_RANGE (4) #define SBP_FLASH_DONE_RESPONSE_CODE_FLASH_INVALID_SECTOR (5) /** - * Encoded length of sbp_msg_flash_done_t (V4 API) and - * msg_flash_done_t (legacy API) + * Encoded length of sbp_msg_flash_done_t (V4 API) */ #define SBP_MSG_FLASH_DONE_ENCODED_LEN 1u -#define SBP_MSG_FLASH_READ_REQ 0x00E7 #define SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_MASK (0x1u) #define SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_SHIFT (0u) #define SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_GET(flags) \ @@ -110,19 +102,16 @@ #define SBP_FLASH_READ_REQ_FLASH_TARGET_TO_READ_FLASH_M25 (1) /** * The maximum number of items that can be stored in - * sbp_msg_flash_read_req_t::addr_start (V4 API) or - * msg_flash_read_req_t::addr_start (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_flash_read_req_t::addr_start before the maximum SBP message size is + * exceeded */ #define SBP_MSG_FLASH_READ_REQ_ADDR_START_MAX 3u /** - * Encoded length of sbp_msg_flash_read_req_t (V4 API) and - * msg_flash_read_req_t (legacy API) + * Encoded length of sbp_msg_flash_read_req_t (V4 API) */ #define SBP_MSG_FLASH_READ_REQ_ENCODED_LEN 5u -#define SBP_MSG_FLASH_READ_RESP 0x00E1 #define SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_MASK (0x1u) #define SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_SHIFT (0u) #define SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_GET(flags) \ @@ -141,19 +130,16 @@ #define SBP_FLASH_READ_RESP_FLASH_TARGET_TO_READ_FLASH_M25 (1) /** * The maximum number of items that can be stored in - * sbp_msg_flash_read_resp_t::addr_start (V4 API) or - * msg_flash_read_resp_t::addr_start (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_flash_read_resp_t::addr_start before the maximum SBP message size is + * exceeded */ #define SBP_MSG_FLASH_READ_RESP_ADDR_START_MAX 3u /** - * Encoded length of sbp_msg_flash_read_resp_t (V4 API) and - * msg_flash_read_resp_t (legacy API) + * Encoded length of sbp_msg_flash_read_resp_t (V4 API) */ #define SBP_MSG_FLASH_READ_RESP_ENCODED_LEN 5u -#define SBP_MSG_FLASH_ERASE 0x00E2 #define SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_MASK (0x1u) #define SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_SHIFT (0u) #define SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_GET(flags) \ @@ -171,59 +157,46 @@ #define SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_FLASH_STM (0) #define SBP_FLASH_ERASE_FLASH_TARGET_TO_READ_FLASH_M25 (1) /** - * Encoded length of sbp_msg_flash_erase_t (V4 API) and - * msg_flash_erase_t (legacy API) + * Encoded length of sbp_msg_flash_erase_t (V4 API) */ #define SBP_MSG_FLASH_ERASE_ENCODED_LEN 5u -#define SBP_MSG_STM_FLASH_LOCK_SECTOR 0x00E3 /** - * Encoded length of sbp_msg_stm_flash_lock_sector_t (V4 API) and - * msg_stm_flash_lock_sector_t (legacy API) + * Encoded length of sbp_msg_stm_flash_lock_sector_t (V4 API) */ #define SBP_MSG_STM_FLASH_LOCK_SECTOR_ENCODED_LEN 4u -#define SBP_MSG_STM_FLASH_UNLOCK_SECTOR 0x00E4 /** - * Encoded length of sbp_msg_stm_flash_unlock_sector_t (V4 API) and - * msg_stm_flash_unlock_sector_t (legacy API) + * Encoded length of sbp_msg_stm_flash_unlock_sector_t (V4 API) */ #define SBP_MSG_STM_FLASH_UNLOCK_SECTOR_ENCODED_LEN 4u -#define SBP_MSG_STM_UNIQUE_ID_REQ 0x00E8 /** - * Encoded length of sbp_msg_stm_unique_id_req_t (V4 API) and - * msg_stm_unique_id_req_t (legacy API) + * Encoded length of sbp_msg_stm_unique_id_req_t (V4 API) */ #define SBP_MSG_STM_UNIQUE_ID_REQ_ENCODED_LEN 0u -#define SBP_MSG_STM_UNIQUE_ID_RESP 0x00E5 /** * The maximum number of items that can be stored in - * sbp_msg_stm_unique_id_resp_t::stm_id (V4 API) or - * msg_stm_unique_id_resp_t::stm_id (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_stm_unique_id_resp_t::stm_id before the maximum SBP message size is + * exceeded */ #define SBP_MSG_STM_UNIQUE_ID_RESP_STM_ID_MAX 12u /** - * Encoded length of sbp_msg_stm_unique_id_resp_t (V4 API) and - * msg_stm_unique_id_resp_t (legacy API) + * Encoded length of sbp_msg_stm_unique_id_resp_t (V4 API) */ #define SBP_MSG_STM_UNIQUE_ID_RESP_ENCODED_LEN 12u -#define SBP_MSG_M25_FLASH_WRITE_STATUS 0x00F3 /** * The maximum number of items that can be stored in - * sbp_msg_m25_flash_write_status_t::status (V4 API) or - * msg_m25_flash_write_status_t::status (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_m25_flash_write_status_t::status before the maximum SBP message size + * is exceeded */ #define SBP_MSG_M25_FLASH_WRITE_STATUS_STATUS_MAX 1u /** - * Encoded length of sbp_msg_m25_flash_write_status_t (V4 API) and - * msg_m25_flash_write_status_t (legacy API) + * Encoded length of sbp_msg_m25_flash_write_status_t (V4 API) */ #define SBP_MSG_M25_FLASH_WRITE_STATUS_ENCODED_LEN 1u diff --git a/c/include/libsbp/gnss/GPSTime.h b/c/include/libsbp/gnss/GPSTime.h index 0bae6919a6..e79b16bdca 100644 --- a/c/include/libsbp/gnss/GPSTime.h +++ b/c/include/libsbp/gnss/GPSTime.h @@ -60,21 +60,21 @@ typedef struct { * GPS week number [week] */ u16 wn; -} sbp_v4_gps_time_t; +} sbp_gps_time_t; /** - * Get encoded size of an instance of sbp_v4_gps_time_t + * Get encoded size of an instance of sbp_gps_time_t * - * @param msg sbp_v4_gps_time_t instance + * @param msg sbp_gps_time_t instance * @return Length of on-wire representation */ -static inline size_t sbp_v4_gps_time_encoded_len(const sbp_v4_gps_time_t *msg) { +static inline size_t sbp_gps_time_encoded_len(const sbp_gps_time_t *msg) { (void)msg; - return SBP_V4_GPS_TIME_ENCODED_LEN; + return SBP_GPS_TIME_ENCODED_LEN; } /** - * Encode an instance of sbp_v4_gps_time_t to wire representation + * Encode an instance of sbp_gps_time_t to wire representation * * This function encodes the given instance in to the user provided buffer. The * buffer provided to this function must be large enough to store the encoded @@ -89,33 +89,32 @@ static inline size_t sbp_v4_gps_time_encoded_len(const sbp_v4_gps_time_t *msg) { * @param len Length of \p buf * @param n_written If not null, on success will be set to the number of bytes * written to \p buf - * @param msg Instance of sbp_v4_gps_time_t to encode + * @param msg Instance of sbp_gps_time_t to encode * @return SBP_OK on success, or other libsbp error code */ -SBP_EXPORT s8 sbp_v4_gps_time_encode(uint8_t *buf, uint8_t len, - uint8_t *n_written, - const sbp_v4_gps_time_t *msg); +SBP_EXPORT s8 sbp_gps_time_encode(uint8_t *buf, uint8_t len, uint8_t *n_written, + const sbp_gps_time_t *msg); /** - * Decode an instance of sbp_v4_gps_time_t from wire representation + * Decode an instance of sbp_gps_time_t from wire representation * - * This function decodes the wire representation of a sbp_v4_gps_time_t message - * to the given instance. The caller must specify the length of the buffer in - * the \p len parameter. If non-null the number of bytes read from the buffer - * will be returned in \p n_read. + * This function decodes the wire representation of a sbp_gps_time_t message to + * the given instance. The caller must specify the length of the buffer in the + * \p len parameter. If non-null the number of bytes read from the buffer will + * be returned in \p n_read. * - * @param buf Wire representation of the sbp_v4_gps_time_t instance + * @param buf Wire representation of the sbp_gps_time_t instance * @param len Length of \p buf * @param n_read If not null, on success will be set to the number of bytes read * from \p buf * @param msg Destination * @return SBP_OK on success, or other libsbp error code */ -SBP_EXPORT s8 sbp_v4_gps_time_decode(const uint8_t *buf, uint8_t len, - uint8_t *n_read, sbp_v4_gps_time_t *msg); +SBP_EXPORT s8 sbp_gps_time_decode(const uint8_t *buf, uint8_t len, + uint8_t *n_read, sbp_gps_time_t *msg); /** - * Compare two instances of sbp_v4_gps_time_t + * Compare two instances of sbp_gps_time_t * * The two instances will be compared and a value returned consistent with the * return codes of comparison functions from the C standard library @@ -125,44 +124,44 @@ SBP_EXPORT s8 sbp_v4_gps_time_decode(const uint8_t *buf, uint8_t len, * b A value greater than 0 will be returned if \p b is considered to be greater * than \p b * - * @param a sbp_v4_gps_time_t instance - * @param b sbp_v4_gps_time_t instance + * @param a sbp_gps_time_t instance + * @param b sbp_gps_time_t instance * @return 0, <0, >0 */ -SBP_EXPORT int sbp_v4_gps_time_cmp(const sbp_v4_gps_time_t *a, - const sbp_v4_gps_time_t *b); +SBP_EXPORT int sbp_gps_time_cmp(const sbp_gps_time_t *a, + const sbp_gps_time_t *b); #ifdef __cplusplus } -static inline bool operator==(const sbp_v4_gps_time_t &lhs, - const sbp_v4_gps_time_t &rhs) { - return sbp_v4_gps_time_cmp(&lhs, &rhs) == 0; +static inline bool operator==(const sbp_gps_time_t &lhs, + const sbp_gps_time_t &rhs) { + return sbp_gps_time_cmp(&lhs, &rhs) == 0; } -static inline bool operator!=(const sbp_v4_gps_time_t &lhs, - const sbp_v4_gps_time_t &rhs) { - return sbp_v4_gps_time_cmp(&lhs, &rhs) != 0; +static inline bool operator!=(const sbp_gps_time_t &lhs, + const sbp_gps_time_t &rhs) { + return sbp_gps_time_cmp(&lhs, &rhs) != 0; } -static inline bool operator<(const sbp_v4_gps_time_t &lhs, - const sbp_v4_gps_time_t &rhs) { - return sbp_v4_gps_time_cmp(&lhs, &rhs) < 0; +static inline bool operator<(const sbp_gps_time_t &lhs, + const sbp_gps_time_t &rhs) { + return sbp_gps_time_cmp(&lhs, &rhs) < 0; } -static inline bool operator<=(const sbp_v4_gps_time_t &lhs, - const sbp_v4_gps_time_t &rhs) { - return sbp_v4_gps_time_cmp(&lhs, &rhs) <= 0; +static inline bool operator<=(const sbp_gps_time_t &lhs, + const sbp_gps_time_t &rhs) { + return sbp_gps_time_cmp(&lhs, &rhs) <= 0; } -static inline bool operator>(const sbp_v4_gps_time_t &lhs, - const sbp_v4_gps_time_t &rhs) { - return sbp_v4_gps_time_cmp(&lhs, &rhs) > 0; +static inline bool operator>(const sbp_gps_time_t &lhs, + const sbp_gps_time_t &rhs) { + return sbp_gps_time_cmp(&lhs, &rhs) > 0; } -static inline bool operator>=(const sbp_v4_gps_time_t &lhs, - const sbp_v4_gps_time_t &rhs) { - return sbp_v4_gps_time_cmp(&lhs, &rhs) >= 0; +static inline bool operator>=(const sbp_gps_time_t &lhs, + const sbp_gps_time_t &rhs) { + return sbp_gps_time_cmp(&lhs, &rhs) >= 0; } #endif // ifdef __cplusplus diff --git a/c/include/libsbp/gnss/GnssSignal.h b/c/include/libsbp/gnss/GnssSignal.h index f7816fb37d..3a1a0451d5 100644 --- a/c/include/libsbp/gnss/GnssSignal.h +++ b/c/include/libsbp/gnss/GnssSignal.h @@ -53,22 +53,21 @@ typedef struct { * Signal constellation, band and code */ u8 code; -} sbp_v4_gnss_signal_t; +} sbp_gnss_signal_t; /** - * Get encoded size of an instance of sbp_v4_gnss_signal_t + * Get encoded size of an instance of sbp_gnss_signal_t * - * @param msg sbp_v4_gnss_signal_t instance + * @param msg sbp_gnss_signal_t instance * @return Length of on-wire representation */ -static inline size_t sbp_v4_gnss_signal_encoded_len( - const sbp_v4_gnss_signal_t *msg) { +static inline size_t sbp_gnss_signal_encoded_len(const sbp_gnss_signal_t *msg) { (void)msg; - return SBP_V4_GNSS_SIGNAL_ENCODED_LEN; + return SBP_GNSS_SIGNAL_ENCODED_LEN; } /** - * Encode an instance of sbp_v4_gnss_signal_t to wire representation + * Encode an instance of sbp_gnss_signal_t to wire representation * * This function encodes the given instance in to the user provided buffer. The * buffer provided to this function must be large enough to store the encoded @@ -83,34 +82,33 @@ static inline size_t sbp_v4_gnss_signal_encoded_len( * @param len Length of \p buf * @param n_written If not null, on success will be set to the number of bytes * written to \p buf - * @param msg Instance of sbp_v4_gnss_signal_t to encode + * @param msg Instance of sbp_gnss_signal_t to encode * @return SBP_OK on success, or other libsbp error code */ -SBP_EXPORT s8 sbp_v4_gnss_signal_encode(uint8_t *buf, uint8_t len, - uint8_t *n_written, - const sbp_v4_gnss_signal_t *msg); +SBP_EXPORT s8 sbp_gnss_signal_encode(uint8_t *buf, uint8_t len, + uint8_t *n_written, + const sbp_gnss_signal_t *msg); /** - * Decode an instance of sbp_v4_gnss_signal_t from wire representation + * Decode an instance of sbp_gnss_signal_t from wire representation * - * This function decodes the wire representation of a sbp_v4_gnss_signal_t - * message to the given instance. The caller must specify the length of the - * buffer in the \p len parameter. If non-null the number of bytes read from the - * buffer will be returned in \p n_read. + * This function decodes the wire representation of a sbp_gnss_signal_t message + * to the given instance. The caller must specify the length of the buffer in + * the \p len parameter. If non-null the number of bytes read from the buffer + * will be returned in \p n_read. * - * @param buf Wire representation of the sbp_v4_gnss_signal_t instance + * @param buf Wire representation of the sbp_gnss_signal_t instance * @param len Length of \p buf * @param n_read If not null, on success will be set to the number of bytes read * from \p buf * @param msg Destination * @return SBP_OK on success, or other libsbp error code */ -SBP_EXPORT s8 sbp_v4_gnss_signal_decode(const uint8_t *buf, uint8_t len, - uint8_t *n_read, - sbp_v4_gnss_signal_t *msg); +SBP_EXPORT s8 sbp_gnss_signal_decode(const uint8_t *buf, uint8_t len, + uint8_t *n_read, sbp_gnss_signal_t *msg); /** - * Compare two instances of sbp_v4_gnss_signal_t + * Compare two instances of sbp_gnss_signal_t * * The two instances will be compared and a value returned consistent with the * return codes of comparison functions from the C standard library @@ -120,44 +118,44 @@ SBP_EXPORT s8 sbp_v4_gnss_signal_decode(const uint8_t *buf, uint8_t len, * b A value greater than 0 will be returned if \p b is considered to be greater * than \p b * - * @param a sbp_v4_gnss_signal_t instance - * @param b sbp_v4_gnss_signal_t instance + * @param a sbp_gnss_signal_t instance + * @param b sbp_gnss_signal_t instance * @return 0, <0, >0 */ -SBP_EXPORT int sbp_v4_gnss_signal_cmp(const sbp_v4_gnss_signal_t *a, - const sbp_v4_gnss_signal_t *b); +SBP_EXPORT int sbp_gnss_signal_cmp(const sbp_gnss_signal_t *a, + const sbp_gnss_signal_t *b); #ifdef __cplusplus } -static inline bool operator==(const sbp_v4_gnss_signal_t &lhs, - const sbp_v4_gnss_signal_t &rhs) { - return sbp_v4_gnss_signal_cmp(&lhs, &rhs) == 0; +static inline bool operator==(const sbp_gnss_signal_t &lhs, + const sbp_gnss_signal_t &rhs) { + return sbp_gnss_signal_cmp(&lhs, &rhs) == 0; } -static inline bool operator!=(const sbp_v4_gnss_signal_t &lhs, - const sbp_v4_gnss_signal_t &rhs) { - return sbp_v4_gnss_signal_cmp(&lhs, &rhs) != 0; +static inline bool operator!=(const sbp_gnss_signal_t &lhs, + const sbp_gnss_signal_t &rhs) { + return sbp_gnss_signal_cmp(&lhs, &rhs) != 0; } -static inline bool operator<(const sbp_v4_gnss_signal_t &lhs, - const sbp_v4_gnss_signal_t &rhs) { - return sbp_v4_gnss_signal_cmp(&lhs, &rhs) < 0; +static inline bool operator<(const sbp_gnss_signal_t &lhs, + const sbp_gnss_signal_t &rhs) { + return sbp_gnss_signal_cmp(&lhs, &rhs) < 0; } -static inline bool operator<=(const sbp_v4_gnss_signal_t &lhs, - const sbp_v4_gnss_signal_t &rhs) { - return sbp_v4_gnss_signal_cmp(&lhs, &rhs) <= 0; +static inline bool operator<=(const sbp_gnss_signal_t &lhs, + const sbp_gnss_signal_t &rhs) { + return sbp_gnss_signal_cmp(&lhs, &rhs) <= 0; } -static inline bool operator>(const sbp_v4_gnss_signal_t &lhs, - const sbp_v4_gnss_signal_t &rhs) { - return sbp_v4_gnss_signal_cmp(&lhs, &rhs) > 0; +static inline bool operator>(const sbp_gnss_signal_t &lhs, + const sbp_gnss_signal_t &rhs) { + return sbp_gnss_signal_cmp(&lhs, &rhs) > 0; } -static inline bool operator>=(const sbp_v4_gnss_signal_t &lhs, - const sbp_v4_gnss_signal_t &rhs) { - return sbp_v4_gnss_signal_cmp(&lhs, &rhs) >= 0; +static inline bool operator>=(const sbp_gnss_signal_t &lhs, + const sbp_gnss_signal_t &rhs) { + return sbp_gnss_signal_cmp(&lhs, &rhs) >= 0; } #endif // ifdef __cplusplus diff --git a/c/include/libsbp/gnss_macros.h b/c/include/libsbp/gnss_macros.h index dbe39595b2..a61210153c 100644 --- a/c/include/libsbp/gnss_macros.h +++ b/c/include/libsbp/gnss_macros.h @@ -42,10 +42,9 @@ #define SBP_GNSSSIGNAL_GAL_E7I (20) #define SBP_GNSSSIGNAL_BDS3_B2A (47) /** - * Encoded length of sbp_v4_gnss_signal_t (V4 API) and - * sbp_gnss_signal_t (legacy API) + * Encoded length of sbp_gnss_signal_t (V4 API) */ -#define SBP_V4_GNSS_SIGNAL_ENCODED_LEN 2u +#define SBP_GNSS_SIGNAL_ENCODED_LEN 2u #define SBP_SVID__MASK (0xffu) #define SBP_SVID__SHIFT (0u) @@ -61,8 +60,7 @@ #define SBP_SVID_BDS (3) #define SBP_SVID_GAL (5) /** - * Encoded length of sbp_sv_id_t (V4 API) and - * sv_id_t (legacy API) + * Encoded length of sbp_sv_id_t (V4 API) */ #define SBP_SV_ID_ENCODED_LEN 2u @@ -85,32 +83,27 @@ #define SBP_GNSSSIGNALDEP_GPS_L1P (5) #define SBP_GNSSSIGNALDEP_GPS_L2P (6) /** - * Encoded length of sbp_gnss_signal_dep_t (V4 API) and - * gnss_signal_dep_t (legacy API) + * Encoded length of sbp_gnss_signal_dep_t (V4 API) */ #define SBP_GNSS_SIGNAL_DEP_ENCODED_LEN 4u /** - * Encoded length of sbp_gps_time_dep_t (V4 API) and - * gps_time_dep_t (legacy API) + * Encoded length of sbp_gps_time_dep_t (V4 API) */ #define SBP_GPS_TIME_DEP_ENCODED_LEN 6u /** - * Encoded length of sbp_gps_time_sec_t (V4 API) and - * gps_time_sec_t (legacy API) + * Encoded length of sbp_gps_time_sec_t (V4 API) */ #define SBP_GPS_TIME_SEC_ENCODED_LEN 6u /** - * Encoded length of sbp_v4_gps_time_t (V4 API) and - * sbp_gps_time_t (legacy API) + * Encoded length of sbp_gps_time_t (V4 API) */ -#define SBP_V4_GPS_TIME_ENCODED_LEN 10u +#define SBP_GPS_TIME_ENCODED_LEN 10u /** - * Encoded length of sbp_carrier_phase_t (V4 API) and - * carrier_phase_t (legacy API) + * Encoded length of sbp_carrier_phase_t (V4 API) */ #define SBP_CARRIER_PHASE_ENCODED_LEN 5u diff --git a/c/include/libsbp/imu_macros.h b/c/include/libsbp/imu_macros.h index b2a1055813..63ae4a9b25 100644 --- a/c/include/libsbp/imu_macros.h +++ b/c/include/libsbp/imu_macros.h @@ -18,7 +18,6 @@ #ifndef LIBSBP_IMU_MACROS_H #define LIBSBP_IMU_MACROS_H -#define SBP_MSG_IMU_RAW 0x0900 #define SBP_IMU_RAW_TIME_STATUS_MASK (0x3u) #define SBP_IMU_RAW_TIME_STATUS_SHIFT (30u) #define SBP_IMU_RAW_TIME_STATUS_GET(flags) \ @@ -55,12 +54,10 @@ } while (0) /** - * Encoded length of sbp_msg_imu_raw_t (V4 API) and - * msg_imu_raw_t (legacy API) + * Encoded length of sbp_msg_imu_raw_t (V4 API) */ #define SBP_MSG_IMU_RAW_ENCODED_LEN 17u -#define SBP_MSG_IMU_AUX 0x0901 #define SBP_IMU_AUX_IMU_TYPE_MASK (0xffu) #define SBP_IMU_AUX_IMU_TYPE_SHIFT (0u) #define SBP_IMU_AUX_IMU_TYPE_GET(flags) \ @@ -128,8 +125,7 @@ #define SBP_IMU_AUX_ACCELEROMETER_RANGE__6G (4) #define SBP_IMU_AUX_ACCELEROMETER_RANGE_6G (4) /** - * Encoded length of sbp_msg_imu_aux_t (V4 API) and - * msg_imu_aux_t (legacy API) + * Encoded length of sbp_msg_imu_aux_t (V4 API) */ #define SBP_MSG_IMU_AUX_ENCODED_LEN 4u diff --git a/c/include/libsbp/integrity_macros.h b/c/include/libsbp/integrity_macros.h index 4f2d83d14f..ce37006eec 100644 --- a/c/include/libsbp/integrity_macros.h +++ b/c/include/libsbp/integrity_macros.h @@ -19,12 +19,10 @@ #define LIBSBP_INTEGRITY_MACROS_H /** - * Encoded length of sbp_integrity_ssr_header_t (V4 API) and - * integrity_ssr_header_t (legacy API) + * Encoded length of sbp_integrity_ssr_header_t (V4 API) */ #define SBP_INTEGRITY_SSR_HEADER_ENCODED_LEN 14u -#define SBP_MSG_SSR_FLAG_HIGH_LEVEL 0x0BB9 #define SBP_SSR_FLAG_HIGH_LEVEL_USE_GPS_SATELLITES_MASK (0x7u) #define SBP_SSR_FLAG_HIGH_LEVEL_USE_GPS_SATELLITES_SHIFT (0u) #define SBP_SSR_FLAG_HIGH_LEVEL_USE_GPS_SATELLITES_GET(flags) \ @@ -81,9 +79,8 @@ #define SBP_SSR_FLAG_HIGH_LEVEL_USE_BDS_SATELLITES_NOT_MONITORED (3) /** * The maximum number of items that can be stored in - * sbp_msg_ssr_flag_high_level_t::reserved (V4 API) or - * msg_ssr_flag_high_level_t::reserved (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_ssr_flag_high_level_t::reserved before the maximum SBP message size + * is exceeded */ #define SBP_MSG_SSR_FLAG_HIGH_LEVEL_RESERVED_MAX 6u @@ -169,132 +166,110 @@ #define SBP_SSR_FLAG_HIGH_LEVEL_USE_IONO_GRID_POINT_SATELLITE_LOS_NOT_MONITORED \ (3) /** - * Encoded length of sbp_msg_ssr_flag_high_level_t (V4 API) and - * msg_ssr_flag_high_level_t (legacy API) + * Encoded length of sbp_msg_ssr_flag_high_level_t (V4 API) */ #define SBP_MSG_SSR_FLAG_HIGH_LEVEL_ENCODED_LEN 31u -#define SBP_MSG_SSR_FLAG_SATELLITES 0x0BBD /** * The maximum number of items that can be stored in - * sbp_msg_ssr_flag_satellites_t::faulty_sats (V4 API) or - * msg_ssr_flag_satellites_t::faulty_sats (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_ssr_flag_satellites_t::faulty_sats before the maximum SBP message + * size is exceeded */ #define SBP_MSG_SSR_FLAG_SATELLITES_FAULTY_SATS_MAX 243u /** - * Encoded length of sbp_msg_ssr_flag_satellites_t (V4 API) and - * msg_ssr_flag_satellites_t (legacy API) + * Encoded length of sbp_msg_ssr_flag_satellites_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_flag_satellites_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SSR_FLAG_SATELLITES_ENCODED_OVERHEAD 12u -#define SBP_MSG_SSR_FLAG_TROPO_GRID_POINTS 0x0BC3 /** * The maximum number of items that can be stored in - * sbp_msg_ssr_flag_tropo_grid_points_t::faulty_points (V4 API) or - * msg_ssr_flag_tropo_grid_points_t::faulty_points (legacy API) before the - * maximum SBP message size is exceeded + * sbp_msg_ssr_flag_tropo_grid_points_t::faulty_points before the maximum SBP + * message size is exceeded */ #define SBP_MSG_SSR_FLAG_TROPO_GRID_POINTS_FAULTY_POINTS_MAX 120u /** - * Encoded length of sbp_msg_ssr_flag_tropo_grid_points_t (V4 API) and - * msg_ssr_flag_tropo_grid_points_t (legacy API) + * Encoded length of sbp_msg_ssr_flag_tropo_grid_points_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_flag_tropo_grid_points_encoded_len to determine the actual size - * of an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * of an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SSR_FLAG_TROPO_GRID_POINTS_ENCODED_OVERHEAD 15u -#define SBP_MSG_SSR_FLAG_IONO_GRID_POINTS 0x0BC7 /** * The maximum number of items that can be stored in - * sbp_msg_ssr_flag_iono_grid_points_t::faulty_points (V4 API) or - * msg_ssr_flag_iono_grid_points_t::faulty_points (legacy API) before the - * maximum SBP message size is exceeded + * sbp_msg_ssr_flag_iono_grid_points_t::faulty_points before the maximum SBP + * message size is exceeded */ #define SBP_MSG_SSR_FLAG_IONO_GRID_POINTS_FAULTY_POINTS_MAX 120u /** - * Encoded length of sbp_msg_ssr_flag_iono_grid_points_t (V4 API) and - * msg_ssr_flag_iono_grid_points_t (legacy API) + * Encoded length of sbp_msg_ssr_flag_iono_grid_points_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_flag_iono_grid_points_encoded_len to determine the actual size - * of an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * of an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SSR_FLAG_IONO_GRID_POINTS_ENCODED_OVERHEAD 15u -#define SBP_MSG_SSR_FLAG_IONO_TILE_SAT_LOS 0x0BCD /** * The maximum number of items that can be stored in - * sbp_msg_ssr_flag_iono_tile_sat_los_t::faulty_los (V4 API) or - * msg_ssr_flag_iono_tile_sat_los_t::faulty_los (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_ssr_flag_iono_tile_sat_los_t::faulty_los before the maximum SBP + * message size is exceeded */ #define SBP_MSG_SSR_FLAG_IONO_TILE_SAT_LOS_FAULTY_LOS_MAX 120u /** - * Encoded length of sbp_msg_ssr_flag_iono_tile_sat_los_t (V4 API) and - * msg_ssr_flag_iono_tile_sat_los_t (legacy API) + * Encoded length of sbp_msg_ssr_flag_iono_tile_sat_los_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_flag_iono_tile_sat_los_encoded_len to determine the actual size - * of an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * of an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SSR_FLAG_IONO_TILE_SAT_LOS_ENCODED_OVERHEAD 15u -#define SBP_MSG_SSR_FLAG_IONO_GRID_POINT_SAT_LOS 0x0BD1 /** * The maximum number of items that can be stored in - * sbp_msg_ssr_flag_iono_grid_point_sat_los_t::faulty_los (V4 API) or - * msg_ssr_flag_iono_grid_point_sat_los_t::faulty_los (legacy API) before the - * maximum SBP message size is exceeded + * sbp_msg_ssr_flag_iono_grid_point_sat_los_t::faulty_los before the maximum SBP + * message size is exceeded */ #define SBP_MSG_SSR_FLAG_IONO_GRID_POINT_SAT_LOS_FAULTY_LOS_MAX 119u /** - * Encoded length of sbp_msg_ssr_flag_iono_grid_point_sat_los_t (V4 API) and - * msg_ssr_flag_iono_grid_point_sat_los_t (legacy API) + * Encoded length of sbp_msg_ssr_flag_iono_grid_point_sat_los_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_flag_iono_grid_point_sat_los_encoded_len to determine the actual - * size of an instance of this message. Users of the legacy API are required to - * track the encoded message length when interacting with the legacy type. + * size of an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SSR_FLAG_IONO_GRID_POINT_SAT_LOS_ENCODED_OVERHEAD 17u -#define SBP_MSG_ACKNOWLEDGE 0x0BD2 #define SBP_ACKNOWLEDGE_RESPONSE_CODE_MASK (0xffu) #define SBP_ACKNOWLEDGE_RESPONSE_CODE_SHIFT (0u) #define SBP_ACKNOWLEDGE_RESPONSE_CODE_GET(flags) \ @@ -485,8 +460,7 @@ #define SBP_ACKNOWLEDGE_CERTIFICATE_CHAIN_NOT_REQUESTED (0) #define SBP_ACKNOWLEDGE_CERTIFICATE_CHAIN_REQUESTED (1) /** - * Encoded length of sbp_msg_acknowledge_t (V4 API) and - * msg_acknowledge_t (legacy API) + * Encoded length of sbp_msg_acknowledge_t (V4 API) */ #define SBP_MSG_ACKNOWLEDGE_ENCODED_LEN 11u diff --git a/c/include/libsbp/legacy/acquisition.h b/c/include/libsbp/legacy/acquisition.h deleted file mode 100644 index 5876656f2e..0000000000 --- a/c/include/libsbp/legacy/acquisition.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/acquisition.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup acquisition Acquisition - * - * Satellite acquisition messages from the device. - * \{ */ - -#ifndef LIBSBP_LEGACY_ACQUISITION_MESSAGES_H -#define LIBSBP_LEGACY_ACQUISITION_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include -#include - -SBP_PACK_START - -/** Satellite acquisition result - * - * This message describes the results from an attempted GPS signal acquisition - * search for a satellite PRN over a code phase/carrier frequency range. It - * contains the parameters of the point in the acquisition search space with - * the best carrier-to-noise (CN/0) ratio. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - float cn0; /**< CN/0 of best point [dB Hz] */ - float cp; /**< Code phase of best point [chips] */ - float cf; /**< Carrier frequency of best point [hz] */ - sbp_gnss_signal_t sid; /**< GNSS signal for which acquisition was - attempted */ -} msg_acq_result_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - float cn0; /**< CN/0 of best point [dB Hz] */ - float cp; /**< Code phase of best point [chips] */ - float cf; /**< Carrier frequency of best point [hz] */ - gnss_signal_dep_t sid; /**< GNSS signal for which acquisition was - attempted */ -} msg_acq_result_dep_c_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - float snr; /**< SNR of best point. Currently in arbitrary SNR points, but - will be in units of dB Hz in a later revision of this - message. */ - float cp; /**< Code phase of best point [chips] */ - float cf; /**< Carrier frequency of best point [hz] */ - gnss_signal_dep_t sid; /**< GNSS signal for which acquisition was - attempted */ -} msg_acq_result_dep_b_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - float snr; /**< SNR of best point. Currently dimensionless, but will have - units of dB Hz in the revision of this message. */ - float cp; /**< Code phase of best point [chips] */ - float cf; /**< Carrier frequency of best point [hz] */ - u8 prn; /**< PRN-1 identifier of the satellite signal for which - acquisition was attempted */ -} msg_acq_result_dep_a_t; - -/** Acq perfomance measurement and debug - * - * Profile for a specific SV for debugging purposes. The message describes SV - * profile during acquisition time. The message is used to debug and measure - * the performance. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 job_type; /**< SV search job type (deep, fallback, etc) */ - u8 status; /**< Acquisition status 1 is Success, 0 is Failure */ - u16 cn0; /**< CN0 value. Only valid if status is '1' [dB-Hz*10] */ - u8 int_time; /**< Acquisition integration time [ms] */ - sbp_gnss_signal_t sid; /**< GNSS signal for which acquisition was - attempted */ - u16 bin_width; /**< Acq frequency bin width [Hz] */ - u32 timestamp; /**< Timestamp of the job complete event [ms] */ - u32 time_spent; /**< Time spent to search for sid.code [us] */ - s32 cf_min; /**< Doppler range lowest frequency [Hz] */ - s32 cf_max; /**< Doppler range highest frequency [Hz] */ - s32 cf; /**< Doppler value of detected peak. Only valid if status - is '1' [Hz] */ - u32 cp; /**< Codephase of detected peak. Only valid if status is - '1' [chips*10] */ -} acq_sv_profile_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 job_type; /**< SV search job type (deep, fallback, etc) */ - u8 status; /**< Acquisition status 1 is Success, 0 is Failure */ - u16 cn0; /**< CN0 value. Only valid if status is '1' [dB-Hz*10] */ - u8 int_time; /**< Acquisition integration time [ms] */ - gnss_signal_dep_t sid; /**< GNSS signal for which acquisition was - attempted */ - u16 bin_width; /**< Acq frequency bin width [Hz] */ - u32 timestamp; /**< Timestamp of the job complete event [ms] */ - u32 time_spent; /**< Time spent to search for sid.code [us] */ - s32 cf_min; /**< Doppler range lowest frequency [Hz] */ - s32 cf_max; /**< Doppler range highest frequency [Hz] */ - s32 cf; /**< Doppler value of detected peak. Only valid if status - is '1' [Hz] */ - u32 cp; /**< Codephase of detected peak. Only valid if status is - '1' [chips*10] */ -} acq_sv_profile_dep_t; - -/** Acquisition perfomance measurement and debug - * - * The message describes all SV profiles during acquisition time. The message - * is used to debug and measure the performance. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - acq_sv_profile_t - acq_sv_profile[0]; /**< SV profiles during acquisition time */ -} msg_acq_sv_profile_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - acq_sv_profile_dep_t acq_sv_profile[0]; /**< SV profiles during acquisition - time */ -} msg_acq_sv_profile_dep_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_ACQUISITION_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/api.h b/c/include/libsbp/legacy/api.h deleted file mode 100644 index a65c42e128..0000000000 --- a/c/include/libsbp/legacy/api.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (C) 2011-2021 Swift Navigation Inc. - * Contact: Swift Navigation - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifndef LIBSBP_LEGACY_API_H -#define LIBSBP_LEGACY_API_H - -#include -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols contained will " - "be removed in version 6. You should immediately switch over to the modern libsbp API.") - -#ifdef __cplusplus -extern "C" { -#endif - -/** Register a payload callback for a message type. - * - * Register a payload callback that is called when a message - * with type msg_type is received. Note, this might better - * be called sbp_register_payload_callback, but is left - * as sbp_register_callback for backwards compatibility. - * - * \param s Pointer to sbp_state - * \param msg_type Message type associated with callback - * \param cb Pointer to message callback function - * \param context Pointer to context for callback function - * \param node Statically allocated #sbp_msg_callbacks_node_t struct - * \return `SBP_OK` (0) if successful, `SBP_NULL_ERROR` on usage errors, - * `SBP_CALLBACK_ERROR` if the callback was already - * registered for that message type. - */ -SBP_EXPORT SBP_DEPRECATED s8 sbp_payload_callback_register(sbp_state_t* s, u16 msg_type, sbp_msg_callback_t cb, void* context, - sbp_msg_callbacks_node_t *node); - - /** Register a frame callback for a msg_type. - * - * \param s Pointer to sbp_state - * \param cb Pointer to message callback function - * \param msg_type Message type on which to fire frame callback, - * SBP_MSG_ALL will fire for every message - * \param context Pointer to context for callback function - * \param node Statically allocated #sbp_msg_callbacks_node_t struct - * \return `SBP_OK` (0) if successful, `SBP_NULL_ERROR` on usage errors, - * `SBP_CALLBACK_ERROR` if the if callback was already - * registered for that message type. - */ -SBP_EXPORT SBP_DEPRECATED s8 sbp_frame_callback_register(sbp_state_t* s, u16 msg_type, - sbp_frame_callback_t cb, void* context, - sbp_msg_callbacks_node_t *node); - -/** Register a frame callback for ANY message. - * - * \param s Pointer to sbp_state - * \param cb Pointer to message callback function - * \param context Pointer to context for callback function - * \param node Statically allocated #sbp_msg_callbacks_node_t struct - * \return `SBP_OK` (0) if successful, `SBP_NULL_ERROR` if a usage error, - * `SBP_CALLBACK_ERROR` if the node already exists - */ -SBP_EXPORT SBP_DEPRECATED s8 sbp_all_payload_callback_register(sbp_state_t *s, sbp_frame_callback_t cb, - void *context, sbp_msg_callbacks_node_t *node); - -/** Directly process an SBP frame. - * Use this function to directly process the entire SBP frame after - * it is succesfully deframed and the CRC has passed. It will fire any - * callbacks registered for the message which match the cb_mask. - * - * \param s State structure - * \param sender_id SBP message sender id - * \param msg_type SBP message type. Type SBP_MSG_ALL will fire for all messages. - * \param payload_len SBP message length - * \param payload SBP Message payload - * \param frame_len Length of ENTIRE frame (from header to CRC). Max of 263. - * \param frame Pointer to the entire SBP frame (stored on state struct) - * \param cb_mask Bitmask defining which callbacks to include/exclude from - * processing. Use SBP_CALLBACK_ALL_MASK for all callback - * types or construct custom mask using - * SBP_CALLBACK_FLAG(cb_type). - * \return `SBP_OK_CALLBACK_EXECUTED` (1) if message decoded and callback executed - * SBP_OK_CALLBACK_UNDEFINED` (2) if message decoded with no - * associated callback. - */ -SBP_EXPORT SBP_DEPRECATED s8 sbp_frame_process(sbp_state_t *s, u16 sender_id, u16 msg_type, - u8 payload_len, u8 payload[], u16 frame_len, u8 frame[], u8 cb_mask); - -/** Directly process an SBP message. - * If a SBP message has already been decoded (for example, from a binary - * stream or from a JSON log file) use this function to directly process it. - * - * \param s State structure - * \param sender_id SBP message sender id - * \param msg_type SBP message type - * \param msg_len SBP message length - * \param payload SBP message payload - * \return `SBP_OK_CALLBACK_EXECUTED` (1) if message decoded and callback executed, - * `SBP_OK_CALLBACK_UNDEFINED` (2) if message decoded with no associated - * callback. - */ -SBP_EXPORT SBP_DEPRECATED s8 sbp_payload_process(sbp_state_t *s, u16 sender_id, u16 msg_type, u8 msg_len, - u8 payload[]); - -/** Send SBP messages. - * Takes an SBP message payload, type and sender ID then writes a message to - * the output stream using the supplied `write` function with the correct - * framing and CRC. - * - * The supplied `write` function must have the prototype: - * - * ~~~ - * u32 write(u8 *buff, u32 n, void* context) - * ~~~ - * - * where `n` is the number of bytes to be written and `buff` is the buffer from - * which to read the data to be written, and `context` is the arbitrary pointer - * set by `sbp_state_set_io_context`. The function should return the number - * of bytes successfully written which may be between 0 and `n`. Currently, if - * the number of bytes written is different from `n` then `sbp_payload_send` - * will immediately return with an error. - * - * Note that `sbp_payload_send` makes multiple calls to write and therefore if - * a `write` call fails then this may result in a partial message being written - * to the output. This should be caught by the CRC check on the receiving end - * but will result in lost messages. - * - * \param write Function pointer to a function that writes `n` bytes from - * `buff` to the output stream and returns the number of bytes - * successfully written. - * \return `SBP_OK` (0) if successful, `SBP_WRITE_ERROR` if the message could - * not be sent or was only partially sent. - */ -SBP_EXPORT SBP_DEPRECATED s8 sbp_payload_send(sbp_state_t *s, u16 msg_type, u16 sender_id, u8 len, u8 *payload, - sbp_write_fn_t write); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBSBP_LEGACY_API_H */ - diff --git a/c/include/libsbp/legacy/bootload.h b/c/include/libsbp/legacy/bootload.h deleted file mode 100644 index 2936d41850..0000000000 --- a/c/include/libsbp/legacy/bootload.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/bootload.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup bootload Bootload - * - * Messages for the bootloading configuration of a Piksi 2.3.1. This message - * group does not apply to Piksi Multi. - * - * Note that some of these messages share the same message type ID for both - * the host request and the device response. - * \{ */ - -#ifndef LIBSBP_LEGACY_BOOTLOAD_MESSAGES_H -#define LIBSBP_LEGACY_BOOTLOAD_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -/** Bootloading handshake request (host => device) - * - * The handshake message request from the host establishes a handshake between - * the device bootloader and the host. The response from the device is - * MSG_BOOTLOADER_HANDSHAKE_RESP. - */ - -/** Bootloading handshake response (host <= device) - * - * The handshake message response from the device establishes a handshake - * between the device bootloader and the host. The request from the host is - * MSG_BOOTLOADER_HANDSHAKE_REQ. The payload contains the bootloader version - * number and the SBP protocol version number. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 flags; /**< Bootloader flags */ - char version[0]; /**< Bootloader version number */ -} msg_bootloader_handshake_resp_t; - -/** Bootloader jump to application (host => device) - * - * The host initiates the bootloader to jump to the application. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 jump; /**< Ignored by the device */ -} msg_bootloader_jump_to_app_t; - -/** Read FPGA device ID over UART request (host => device) - * - * The device message from the host reads a unique device identifier from the - * SwiftNAP, an FPGA. The host requests the ID by sending a - * MSG_NAP_DEVICE_DNA_REQ message. The device responds with a - * MSG_NAP_DEVICE_DNA_RESP message with the device ID in the payload. Note - * that this ID is tied to the FPGA, and not related to the Piksi's serial - * number. - */ - -/** Read FPGA device ID over UART response (host <= device) - * - * The device message from the host reads a unique device identifier from the - * SwiftNAP, an FPGA. The host requests the ID by sending a - * MSG_NAP_DEVICE_DNA_REQ message. The device responds with a - * MSG_NAP_DEVICE_DNA_RESP message with the device ID in the payload. Note - * that this ID is tied to the FPGA, and not related to the Piksi's serial - * number. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 dna[8]; /**< 57-bit SwiftNAP FPGA Device ID. Remaining bits are padded on - the right. */ -} msg_nap_device_dna_resp_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 handshake[0]; /**< Version number string (not NULL terminated) */ -} msg_bootloader_handshake_dep_a_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_BOOTLOAD_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/callbacks.h b/c/include/libsbp/legacy/callbacks.h deleted file mode 100644 index fa840ebba3..0000000000 --- a/c/include/libsbp/legacy/callbacks.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2011-2021 Swift Navigation Inc. - * Contact: Swift Navigation - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifndef LIBSBP_SBP_CALLBACKS_H -#define LIBSBP_SBP_CALLBACKS_H - -#include - -/** SBP callback function prototype definitions. */ -typedef void (*sbp_msg_callback_t)(u16 sender_id, u8 len, u8 msg[], void *context); -typedef void (*sbp_frame_callback_t)(u16 sender_id, u16 msg_type, - u8 payload_len, u8 payload[], - u16 frame_len, u8 frame[], void *context); - -#endif - diff --git a/c/include/libsbp/legacy/compat.h b/c/include/libsbp/legacy/compat.h deleted file mode 100644 index 0c6b501761..0000000000 --- a/c/include/libsbp/legacy/compat.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2011-2021 Swift Navigation Inc. - * Contact: Swift Navigation - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifndef LIBSBP_LEGACY_COMPAT_H -#define LIBSBP_LEGACY_COMPAT_H - -#include -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols contained will " - "be removed in version 6. You should immediately switch over to the modern libsbp API.") - - -#ifdef __cplusplus -extern "C" { -#endif - -SBP_DEPRECATED -static inline s8 sbp_register_callback(sbp_state_t* s, u16 msg_type, sbp_msg_callback_t cb, void* context, sbp_msg_callbacks_node_t *node) -{ - return sbp_payload_callback_register(s, msg_type, cb, context, node); -} - -SBP_DEPRECATED -static inline s8 sbp_register_frame_callback(sbp_state_t* s, u16 msg_type, sbp_frame_callback_t cb, void* context, sbp_msg_callbacks_node_t *node) -{ - return sbp_frame_callback_register(s, msg_type, cb, context, node); -} - -SBP_DEPRECATED -static inline s8 sbp_register_all_msg_callback(sbp_state_t* s, sbp_frame_callback_t cb, void* context, sbp_msg_callbacks_node_t *node) -{ - return sbp_all_payload_callback_register(s, cb, context, node); -} - -SBP_DEPRECATED -static inline s8 sbp_process_frame(sbp_state_t *s, u16 sender_id, u16 msg_type, u8 payload_len, u8 payload[], u16 frame_len, u8 frame[], u8 cb_mask) -{ - return sbp_frame_process(s, sender_id, msg_type, payload_len, payload, frame_len, frame, cb_mask); -} - -SBP_DEPRECATED -static inline s8 sbp_process_payload(sbp_state_t *s, u16 sender_id, u16 msg_type, u8 msg_len, u8 payload[]) -{ - return sbp_payload_process(s, sender_id, msg_type, msg_len, payload); -} - -SBP_DEPRECATED -static inline s8 sbp_send_message(sbp_state_t *s, u16 msg_type, u16 sender_id, u8 len, u8 payload[], sbp_write_fn_t write) -{ - return sbp_payload_send(s, msg_type, sender_id, len, payload, write); -} - -#ifdef __cplusplus -} -#endif - -#endif /* LIBSBP_LEGACY_COMPAT_H */ diff --git a/c/include/libsbp/legacy/cpp/frame_handler.h b/c/include/libsbp/legacy/cpp/frame_handler.h deleted file mode 100644 index f8dca47c7b..0000000000 --- a/c/include/libsbp/legacy/cpp/frame_handler.h +++ /dev/null @@ -1,201 +0,0 @@ -/** - * Copyright (C) 2020-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifndef SBP_LEGACY_CPP_FRAME_HANDLER_H -#define SBP_LEGACY_CPP_FRAME_HANDLER_H - -#include -#include -#include - -#include -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols contained will " - "be removed in version 6. You should immediately switch over to the modern libsbp API.") - -namespace sbp { - -/** - * A helper function for calling a C++ object member function from a libsbp frame callback. - * - * This function is registered with libsbp as a callback and calls the `handle_sbp_frame` - * member function of an object from that callback passing through all of the arguments. - * The instance of the object is passed in via the `context` parameter. - * - * @tparam ClassT The class type to call the function on - * - * @param sender_id The decoded sender ID, is forwarded - * @param msg_type The message type, is forwarded - * @param payload_len The length of the payload, is forwarded - * @param payload A pointer to the payload, is forwarded - * @param frame_len The length of the frame, is forwarded - * @param frame A pointer to the frame, is forwarded - * @param context Pointer to an instance of `ClassT` to use - */ -template -inline void sbp_frame_cb_passthrough(uint16_t sender_id, uint16_t msg_type, - uint8_t payload_len, uint8_t payload[], - uint16_t frame_len, uint8_t frame[], - void *context) { - assert(nullptr != context); - - auto instance = static_cast(context); - instance->handle_sbp_frame(sender_id, msg_type, payload_len, payload, frame_len, frame); -} - -/** - * Base type for defining classes that handle specific SBP Frames - * - * Application classes should derive from this class if they wish to handle - * entire frames of specific SBP messages with a member function. `FrameHandler` - * instantiates all of the callback nodes, and registers the member function with - * the given `sbp_state_t`. - * - * Classes that derive from `FrameHandler` need to implement - * @code - * void handle_sbp_frame(uint16_t sender_id, uint16_t msg_type, - * uint8_t payload_len, uint8_t payload[], - * uint16_t frame_len, uint8_t frame[]); - * @endcode - * - * This member function will be called for each message specified in the template parameters. - * You will be able to differentiate the message types based on the `msg_type` argument. - * - * Due to the nature of the callback registration in libsbp we dissallow copying or - * moving of `FrameHandler`. - * - * @note It should not matter if the class derives publicly or privately from `FrameHandler` - * or if the `handle_sbp_frame` function is public or private. - * - * @example - * class ECEFHandler : private sbp::FrameHandler { - * public: - * ECEFHandler(sbp::LegacyState *state) : sbp::FrameHandler(state) { - * // The callbacks have already been registered - * // Perform other initialization tasks - * } - * - * void handle_sbp_frame(uint16_t sender_id, uint16_t msg_type, - * uint8_t payload_len, uint8_t payload[], - * uint16_t frame_len, uint8_t frame[]) { - * // handle either GPS_TIME or POS_ECEF message types - * } - * }; - * - * @tparam MsgTypes List of SBP message types to register callbacks for - */ -template -class SBP_DEPRECATED FrameHandler { - static constexpr std::size_t kMsgCount = sizeof...(MsgTypes); - - LegacyState &state_; - std::array callback_nodes_; - - public: - - explicit FrameHandler(LegacyState *state) : state_(*state), callback_nodes_() { - static constexpr std::array ids = { sbp::MessageTraits::id... }; - - for (std::size_t i = 0; i < kMsgCount; ++i) { - sbp_frame_callback_register(state_.get_state(), - ids[i], - &sbp_frame_cb_passthrough, - this, - &callback_nodes_[i]); - } - } - - virtual ~FrameHandler() { - for (auto& node : callback_nodes_) { - sbp_remove_callback(state_.get_state(), &node); - } - } - - FrameHandler(const FrameHandler&) = delete; - FrameHandler(FrameHandler&& other) = delete; - FrameHandler& operator=(const FrameHandler&) = delete; - FrameHandler& operator=(FrameHandler&&) = delete; - - virtual void handle_sbp_frame(uint16_t sender_id, uint16_t msg_type, - uint8_t payload_len, uint8_t payload[], - uint16_t frame_len, uint8_t frame[]) = 0; -}; - -/** - * Base type for defining classes that handle all SBP frames. - * - * Application classes should derive from this class if they wish to handle - * all valid SBP frames with a single member function. `AllFrameHandler` - * instantiates the callback node, and registers the member functions with - * the given `sbp_state_t`. - * - * Classes that derive from `AllFrameHandler` need to implement - * @code - * void handle_sbp_frame(uint16_t sender_id, uint16_t msg_type, - * uint8_t payload_len, uint8_t payload[], - * uint16_t frame_len, uint8_t frame[]); - * @endcode - * - * Due to the nature of the callback registration in libsbp we dissallow copying or - * moving of `AllFrameHandler`. - * - * @note It should not matter if the class derives publicly or privately from `AllFrameHandler` - * or if the `handle_sbp_frame` function is public or private. - * - * @example - * class EverythingHandler : private sbp::AllFrameHandler { - * public: - * EverythingHandler(sbp::LegacyState *state) : sbp::AllFrameHandler(state) { - * // The callbacks have already been registered - * // Perform other initialization tasks - * } - * - * void handle_sbp_frame(uint16_t sender_id, uint16_t msg_type, - * uint8_t payload_len, uint8_t payload[], - * uint16_t frame_len, uint8_t frame[]) { - * // handle all frames here - * } - * }; - * - */ -class SBP_DEPRECATED AllFrameHandler { - LegacyState &state_; - sbp_msg_callbacks_node_t callback_node_; - - public: - - explicit AllFrameHandler(LegacyState *state) : state_(*state), callback_node_() { - sbp_all_payload_callback_register(state_.get_state(), - sbp_frame_cb_passthrough, - this, - &callback_node_); - } - - virtual ~AllFrameHandler() { - sbp_remove_callback(state_.get_state(), &callback_node_); - } - - AllFrameHandler(const AllFrameHandler&) = delete; - AllFrameHandler(AllFrameHandler&& other) = delete; - AllFrameHandler& operator=(const AllFrameHandler&) = delete; - AllFrameHandler& operator=(AllFrameHandler&&) = delete; - - virtual void handle_sbp_frame(uint16_t sender_id, uint16_t msg_type, - uint8_t payload_len, uint8_t payload[], - uint16_t frame_len, uint8_t frame[]) = 0; -}; - -} /* namespace sbp */ - -#endif /* SBP_LEGACY_CPP_FRAME_HANDLER_H */ diff --git a/c/include/libsbp/legacy/cpp/legacy_state.h b/c/include/libsbp/legacy/cpp/legacy_state.h deleted file mode 100644 index 0c13eb333c..0000000000 --- a/c/include/libsbp/legacy/cpp/legacy_state.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (C) 2019-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifndef SBP_LEGACY_CPP_LEGACY_STATE_H -#define SBP_LEGACY_CPP_LEGACY_STATE_H - -#include -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols contained will " - "be removed in version 6. You should immediately switch over to the modern libsbp API.") - -namespace sbp { - -class SBP_DEPRECATED LegacyState : public State { -public: - using State::State; - - SBP_DEPRECATED s8 send_message(u16 msg_type, u16 sender_id, u8 length, const u8 payload[]) { - // NOLINTNEXTLINE - return sbp_payload_send(get_state(), msg_type, sender_id, length, - const_cast(payload), &State::write_func); - } - - SBP_DEPRECATED s8 process_payload(u16 sender_id, u16 msg_type, u8 msg_length, - const u8 payload[]) { - // NOLINTNEXTLINE - return sbp_payload_process(get_state(), sender_id, msg_type, msg_length, - const_cast(payload)); - } -}; - -} // namespace sbp - -#endif diff --git a/c/include/libsbp/legacy/cpp/message_traits.h b/c/include/libsbp/legacy/cpp/message_traits.h deleted file mode 100644 index ff67209207..0000000000 --- a/c/include/libsbp/legacy/cpp/message_traits.h +++ /dev/null @@ -1,1403 +0,0 @@ -/** - * Copyright (C) 2019-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifndef SBP_CPP_MESSAGE_TRAITS_H -#define SBP_CPP_MESSAGE_TRAITS_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace sbp { - -/** - * Type traits containing meta-information for each SBP message type. - * - * These are only meant to be used by the C++ library at compile time. - * These are automatically generated, DO NOT EDIT. - */ -template -struct MessageTraits; - - -template<> -struct MessageTraits { - static constexpr u16 id = 16; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 17; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 19; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 20; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 21; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 22; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 23; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 24; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 25; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 26; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 27; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 28; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 29; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 30; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 31; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 33; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 34; -}; - - - -template<> -struct MessageTraits { - static constexpr u16 id = 43; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 44; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 45; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 46; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 47; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 65; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 67; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 68; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 69; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 70; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 71; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 72; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 73; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 74; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 80; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 81; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 97; -}; - - - - -template<> -struct MessageTraits { - static constexpr u16 id = 112; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 113; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 114; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 115; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 117; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 128; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 129; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 130; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 131; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 132; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 133; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 134; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 135; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 136; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 137; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 138; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 139; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 140; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 141; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 142; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 144; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 145; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 146; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 147; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 148; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 149; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 150; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 151; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 160; -}; - - - -template<> -struct MessageTraits { - static constexpr u16 id = 162; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 163; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 164; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 165; -}; - - - -template<> -struct MessageTraits { - static constexpr u16 id = 167; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 168; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 169; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 170; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 171; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 172; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 173; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 174; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 175; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 176; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 177; -}; - - - - -template<> -struct MessageTraits { - static constexpr u16 id = 180; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 181; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 182; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 184; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 185; -}; - - - -template<> -struct MessageTraits { - static constexpr u16 id = 187; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 188; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 189; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 190; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 191; -}; - - - - -template<> -struct MessageTraits { - static constexpr u16 id = 221; -}; - - - -template<> -struct MessageTraits { - static constexpr u16 id = 224; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 225; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 226; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 227; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 228; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 229; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 230; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 231; -}; - - - -template<> -struct MessageTraits { - static constexpr u16 id = 243; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 256; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 257; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 258; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 259; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 260; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 261; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 288; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 431; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 512; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 513; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 514; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 515; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 516; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 517; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 518; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 519; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 520; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 521; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 522; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 523; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 524; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 525; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 526; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 527; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 528; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 529; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 530; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 531; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 532; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 533; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 534; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 535; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 536; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 540; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 544; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 545; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 546; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 553; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 554; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 557; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 558; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 561; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 562; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 564; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 565; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 570; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 580; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 581; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1024; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1025; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1026; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1500; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1501; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1502; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1503; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1505; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1510; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1515; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1516; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1520; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1525; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1526; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1527; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1528; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1530; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1531; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1532; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1533; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1534; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1540; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1541; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 1600; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 2048; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 2304; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 2305; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 2306; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 2307; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 2308; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 3001; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 3005; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 3011; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 3015; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 3021; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 3025; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 3026; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 3073; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 3074; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 3075; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 3076; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 3077; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 3078; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 3079; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 3080; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 3081; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 4097; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 4098; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 30583; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 32512; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 32513; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 32514; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 32515; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 32516; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 32517; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 32518; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 32519; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 32520; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 32521; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 32522; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 52992; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 65280; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 65282; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 65283; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 65284; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 65285; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 65286; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 65287; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 65288; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 65289; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 65290; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 65294; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 65295; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 65533; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 65534; -}; - - -template<> -struct MessageTraits { - static constexpr u16 id = 65535; -}; - - - - -} // namespace sbp - -#endif //SBP_CPP_MESSAGE_TRAITS_H \ No newline at end of file diff --git a/c/include/libsbp/legacy/cpp/payload_handler.h b/c/include/libsbp/legacy/cpp/payload_handler.h deleted file mode 100644 index 8d448cfb6d..0000000000 --- a/c/include/libsbp/legacy/cpp/payload_handler.h +++ /dev/null @@ -1,175 +0,0 @@ -/** - * Copyright (C) 2019 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifndef SBP_LEGACY_CPP_PAYLOAD_HANDLER_H_ -#define SBP_LEGACY_CPP_PAYLOAD_HANDLER_H_ - -#include -#include - -#include -#include -#include - -namespace sbp { - -/** - * A convenience type alias for class member functions that accept SBP message callbacks - */ -template -using PayloadCallbackFn = void (ClassT::*)(uint16_t, uint8_t, const ArgT &); - -/** - * A helper function for calling a C++ object member function from a libsbp callback. - * - * This function is registered with libsbp as a callback and calls a specific member function - * of an object from that callback with the SBP message decoded. The member function pointer - * is encoded into the template parameter, and the instance of the object is passed in via - * the `context` parameter. - * - * @tparam MsgT The message type to decode the payload as - * @tparam ClassT The class type to call the function on - * @tparam func Pointer to the member function to call - * - * @param sender_id The decoded sender ID, is forwarded on to `func` - * @param len The length of the message, is forwarded on to `func` - * @param msg The raw message payload - * @param context Pointer to an instance of `ClassT` to call `func` on - */ -template func> -inline void sbp_payload_cb_passthrough(uint16_t sender_id, uint8_t len, uint8_t msg[], void *context) { - assert(nullptr != context); - - auto instance = static_cast(context); - auto val = reinterpret_cast(msg); // NOLINT - ((*instance).*(func))(sender_id, len, *val); -} - -namespace details { - -/** - * Recursive interface type for defining the interface functions for `PayloadHandler`. - * - * These types define a virtual `handle_sbp_msg()` for handling a specific SBP message type, - * as well as a function for registering it as a SBP callback. - * - * @note These types aren't meant to be used directly by application code. - * - * @tparam MsgType The type of SBP message to define an interface for - * @tparam OtherTypes Other types to recursively define interfaces for - */ -template -class SBP_DEPRECATED PayloadCallbackInterface : PayloadCallbackInterface { - public: - PayloadCallbackInterface() = default; - ~PayloadCallbackInterface() override = default; - - using PayloadCallbackInterface::handle_sbp_msg; - virtual void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, const MsgType& msg) = 0; - - protected: - void register_callback(sbp_state_t *state, sbp_msg_callbacks_node_t nodes[]) { - sbp_payload_callback_register(state, - sbp::MessageTraits::id, - &sbp_payload_cb_passthrough, - this, - &nodes[0]); - PayloadCallbackInterface::register_callback(state, &nodes[1]); - } -}; - -template -class SBP_DEPRECATED PayloadCallbackInterface { - public: - PayloadCallbackInterface() = default; - virtual ~PayloadCallbackInterface() = default; - - virtual void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, const MsgType& msg) = 0; - protected: - void register_callback(sbp_state_t *state, sbp_msg_callbacks_node_t nodes[]) { - sbp_payload_callback_register(state, - sbp::MessageTraits::id, - &sbp_payload_cb_passthrough, - this, - &nodes[0]); - } -}; - -} // namespace details - -/** - * Base type for defining classes that handle SBP messages - * - * Application classes should derive from this class if they wish to handle - * SBP messages with a member function. `PayloadHandler` instantiates all of - * the callback nodes, and registers the member functions with the given - * `sbp_state_t`. - * - * Classes that derive from `PayloadHandler` need to implement - * void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, const MsgType& msg); - * for each `MsgType` in the list of message types given as template parameters. - * - * Due to the nature of the callback registration in libsbp we dissallow copying or - * moving of `PayloadHandler`. - * - * @note It should not matter if the class derives publicly or privately from `PayloadHandler` - * or if the `handle_sbp_msg` functions are public or private. - * - * @example - * class ECEFHandler : private sbp::PayloadHandler { - * public: - * ECEFHandler(sbp::LegacyState *state) : sbp::PayloadHandler(state) { - * // The callbacks have already been registered - * // Perform other initialization tasks - * } - * - * void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, const msg_gps_time_t& msg) { - * // handle GPS time message - * } - * - * void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, const msg_pos_ecef_t& msg) { - * // handle pos ECEF message - * } - * }; - * - * @tparam MsgTypes List of SBP message types to register callbacks for - */ -template -class SBP_DEPRECATED PayloadHandler : public details::PayloadCallbackInterface { - static constexpr std::size_t kMsgCount = sizeof...(MsgTypes); - - LegacyState &state_; - std::array callback_nodes_; - - public: - - explicit PayloadHandler(LegacyState *state) : details::PayloadCallbackInterface(), state_(*state), callback_nodes_() { - details::PayloadCallbackInterface::register_callback(state_.get_state(), callback_nodes_.data()); - } - - ~PayloadHandler() override { - for (auto& node : callback_nodes_) { - sbp_remove_callback(state_.get_state(), &node); - } - } - - PayloadHandler(const PayloadHandler&) = delete; - PayloadHandler(PayloadHandler&& other) = delete; - PayloadHandler& operator=(const PayloadHandler&) = delete; - PayloadHandler& operator=(PayloadHandler&&) = delete; - - using details::PayloadCallbackInterface::handle_sbp_msg; -}; - -} /* namespace sbp */ - -#endif /* SBP_LEGACY_CPP_PAYLOAD_HANDLER_H_ */ diff --git a/c/include/libsbp/legacy/cpp/sbp_stdio.h b/c/include/libsbp/legacy/cpp/sbp_stdio.h deleted file mode 100644 index 4185f80ae8..0000000000 --- a/c/include/libsbp/legacy/cpp/sbp_stdio.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright (C) 2020-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifndef SBP_LEGACY_CPP_STDIO_H -#define SBP_LEGACY_CPP_STDIO_H - -#include - -#include - -namespace sbp { - -class SbpFileReader : public sbp::IReader { - public: - explicit SbpFileReader(const char *file_path) - : file_stream_(file_path, std::ios::binary | std::ios_base::in) {} - - bool is_open() const { return file_stream_.is_open(); } - - bool eof() const { return file_stream_.eof(); } - - s32 read(u8 *buffer, const u32 buffer_length) override { - auto start_index = file_stream_.tellg(); - if (start_index == -1) { - return -1; - } - - // NOLINTNEXTLINE - file_stream_.read(reinterpret_cast(buffer), buffer_length); - auto end_index = file_stream_.tellg(); - if (end_index == -1 || file_stream_.fail()) { - return -1; - } - - return static_cast(end_index - start_index); - } - - private: - std::ifstream file_stream_; -}; - -class SbpFileWriter : public sbp::IWriter { - public: - explicit SbpFileWriter(const char *file_path) - : file_stream_(file_path, std::ios::binary | std::ios_base::out) {} - - bool is_open() const { return file_stream_.is_open(); }; - - bool eof() const { return file_stream_.eof(); } - - s32 write(const u8 *buffer, const u32 buffer_length) override { - // NOLINTNEXTLINE - file_stream_.write(reinterpret_cast(buffer), buffer_length); - return static_cast(buffer_length); - } - - private: - std::ofstream file_stream_; -}; - -} // namespace sbp - -#endif // SBP_LEGACY_CPP_STDIO_H diff --git a/c/include/libsbp/legacy/ext_events.h b/c/include/libsbp/legacy/ext_events.h deleted file mode 100644 index bd59cfe26b..0000000000 --- a/c/include/libsbp/legacy/ext_events.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/ext_events.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup ext_events Ext_events - * - * Messages reporting accurately-timestamped external events, e.g. camera - * shutter time. - * \{ */ - -#ifndef LIBSBP_LEGACY_EXT_EVENTS_MESSAGES_H -#define LIBSBP_LEGACY_EXT_EVENTS_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -/** Reports timestamped external pin event - * - * Reports detection of an external event, the GPS time it occurred, which pin - * it was and whether it was rising or falling. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 wn; /**< GPS week number [weeks] */ - u32 tow; /**< GPS time of week rounded to the nearest millisecond [ms] */ - s32 ns_residual; /**< Nanosecond residual of millisecond-rounded TOW - (ranges from -500000 to 500000) [ns] */ - u8 flags; /**< Flags */ - u8 pin; /**< Pin number. 0..9 = DEBUG0..9. */ -} msg_ext_event_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_EXT_EVENTS_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/file_io.h b/c/include/libsbp/legacy/file_io.h deleted file mode 100644 index cd23b4c8b5..0000000000 --- a/c/include/libsbp/legacy/file_io.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/file_io.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup file_io File_io - * - * Messages for using device's onboard flash filesystem functionality. This - * allows data to be stored persistently in the device's program flash with - * wear-levelling using a simple filesystem interface. The file system - * interface (CFS) defines an abstract API for reading directories and for - * reading and writing files. - * - * Note that some of these messages share the same message type ID for both - * the host request and the device response. - * \{ */ - -#ifndef LIBSBP_LEGACY_FILE_IO_MESSAGES_H -#define LIBSBP_LEGACY_FILE_IO_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -/** Read file from the file system (host => device) - * - * The file read message reads a certain length (up to 255 bytes) from a given - * offset into a file, and returns the data in a MSG_FILEIO_READ_RESP message - * where the message length field indicates how many bytes were successfully - * read. The sequence number in the request will be returned in the response. - * If the message is invalid, a followup MSG_PRINT message will print "Invalid - * fileio read message". A device will only respond to this message when it is - * received from sender ID 0x42. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 sequence; /**< Read sequence number */ - u32 offset; /**< File offset [bytes] */ - u8 chunk_size; /**< Chunk size to read [bytes] */ - char filename[0]; /**< Name of the file to read from */ -} msg_fileio_read_req_t; - -/** File read from the file system (host <= device) - * - * The file read message reads a certain length (up to 255 bytes) from a given - * offset into a file, and returns the data in a message where the message - * length field indicates how many bytes were successfully read. The sequence - * number in the response is preserved from the request. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 sequence; /**< Read sequence number */ - u8 contents[0]; /**< Contents of read file */ -} msg_fileio_read_resp_t; - -/** List files in a directory (host => device) - * - * The read directory message lists the files in a directory on the device's - * onboard flash file system. The offset parameter can be used to skip the - * first n elements of the file list. Returns a MSG_FILEIO_READ_DIR_RESP - * message containing the directory listings as a NULL delimited list. The - * listing is chunked over multiple SBP packets. The sequence number in the - * request will be returned in the response. If message is invalid, a - * followup MSG_PRINT message will print "Invalid fileio read message". A - * device will only respond to this message when it is received from sender ID - * 0x42. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 sequence; /**< Read sequence number */ - u32 offset; /**< The offset to skip the first n elements of the file - list */ - char dirname[0]; /**< Name of the directory to list */ -} msg_fileio_read_dir_req_t; - -/** Files listed in a directory (host <= device) - * - * The read directory message lists the files in a directory on the device's - * onboard flash file system. Message contains the directory listings as a - * NULL delimited list. The listing is chunked over multiple SBP packets and - * the end of the list is identified by an packet with no entries. The - * sequence number in the response is preserved from the request. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 sequence; /**< Read sequence number */ - char contents[0]; /**< Contents of read directory */ -} msg_fileio_read_dir_resp_t; - -/** Delete a file from the file system (host => device) - * - * The file remove message deletes a file from the file system. If the message - * is invalid, a followup MSG_PRINT message will print "Invalid fileio remove - * message". A device will only process this message when it is received from - * sender ID 0x42. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - char filename[0]; /**< Name of the file to delete */ -} msg_fileio_remove_t; - -/** Write to file (host => device) - * - * The file write message writes a certain length (up to 255 bytes) of data to - * a file at a given offset. Returns a copy of the original - * MSG_FILEIO_WRITE_RESP message to check integrity of the write. The sequence - * number in the request will be returned in the response. If message is - * invalid, a followup MSG_PRINT message will print "Invalid fileio write - * message". A device will only process this message when it is received from - * sender ID 0x42. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 sequence; /**< Write sequence number */ - u32 offset; /**< Offset into the file at which to start writing in - bytes [bytes] */ - char filename[0]; /**< Name of the file to write to */ - u8 data[0]; /**< Variable-length array of data to write */ -} msg_fileio_write_req_t; - -/** File written to (host <= device) - * - * The file write message writes a certain length (up to 255 bytes) of data to - * a file at a given offset. The message is a copy of the original - * MSG_FILEIO_WRITE_REQ message to check integrity of the write. The sequence - * number in the response is preserved from the request. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 sequence; /**< Write sequence number */ -} msg_fileio_write_resp_t; - -/** Request advice on the optimal configuration for FileIO - * - * Requests advice on the optimal configuration for a FileIO transfer. Newer - * version of FileIO can support greater throughput by supporting a large - * window of FileIO data that can be in-flight during read or write - * operations. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 sequence; /**< Advice sequence number */ -} msg_fileio_config_req_t; - -/** Response with advice on the optimal configuration for FileIO. - - * - * The advice on the optimal configuration for a FileIO transfer. Newer - * version of FileIO can support greater throughput by supporting a large - * window of FileIO data that can be in-flight during read or write - * operations. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 sequence; /**< Advice sequence number */ - u32 window_size; /**< The number of SBP packets in the data in-flight - window */ - u32 batch_size; /**< The number of SBP packets sent in one PDU */ - u32 fileio_version; /**< The version of FileIO that is supported */ -} msg_fileio_config_resp_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_FILE_IO_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/flash.h b/c/include/libsbp/legacy/flash.h deleted file mode 100644 index c19d2f5537..0000000000 --- a/c/include/libsbp/legacy/flash.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/flash.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup flash Flash - * - * Messages for reading/writing the device's onboard flash memory. Many of - * these messages target specific flash memory peripherals used in Swift - * Navigation devices: the STM32 flash and the M25Pxx FPGA configuration flash - * from Piksi 2.3.1. This module does not apply to Piksi Multi. - * \{ */ - -#ifndef LIBSBP_LEGACY_FLASH_MESSAGES_H -#define LIBSBP_LEGACY_FLASH_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -/** Program flash addresses - * - * The flash program message programs a set of addresses of either the STM or - * M25 flash. The device replies with either a MSG_FLASH_DONE message - * containing the return code FLASH_OK (0) on success, or FLASH_INVALID_LEN - * (2) if the maximum write size is exceeded. Note that the sector-containing - * addresses must be erased before addresses can be programmed. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 target; /**< Target flags */ - u8 addr_start[3]; /**< Starting address offset to program [bytes] */ - u8 addr_len; /**< Length of set of addresses to program, counting up - from starting address [bytes] */ - u8 data[0]; /**< Data to program addresses with, with length - N=addr_len */ -} msg_flash_program_t; - -/** Flash response message (host <= device) - * - * This message defines success or failure codes for a variety of flash memory - * requests from the host to the device. Flash read and write messages, such - * as MSG_FLASH_READ_REQ, or MSG_FLASH_PROGRAM, may return this message on - * failure. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 response; /**< Response flags */ -} msg_flash_done_t; - -/** Read STM or M25 flash address request (host => device) - * - * The flash read message reads a set of addresses of either the STM or M25 - * onboard flash. The device replies with a MSG_FLASH_READ_RESP message - * containing either the read data on success or a MSG_FLASH_DONE message - * containing the return code FLASH_INVALID_LEN (2) if the maximum read size - * is exceeded or FLASH_INVALID_ADDR (3) if the address is outside of the - * allowed range. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 target; /**< Target flags */ - u8 addr_start[3]; /**< Starting address offset to read from [bytes] */ - u8 addr_len; /**< Length of set of addresses to read, counting up from - starting address [bytes] */ -} msg_flash_read_req_t; - -/** Read STM or M25 flash address response (host <= device) - * - * The flash read message reads a set of addresses of either the STM or M25 - * onboard flash. The device replies with a MSG_FLASH_READ_RESP message - * containing either the read data on success or a MSG_FLASH_DONE message - * containing the return code FLASH_INVALID_LEN (2) if the maximum read size - * is exceeded or FLASH_INVALID_ADDR (3) if the address is outside of the - * allowed range. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 target; /**< Target flags */ - u8 addr_start[3]; /**< Starting address offset to read from [bytes] */ - u8 addr_len; /**< Length of set of addresses to read, counting up from - starting address [bytes] */ -} msg_flash_read_resp_t; - -/** Erase sector of device flash memory (host => device) - * - * The flash erase message from the host erases a sector of either the STM or - * M25 onboard flash memory. The device will reply with a MSG_FLASH_DONE - * message containing the return code - FLASH_OK (0) on success or - * FLASH_INVALID_FLASH (1) if the flash specified is invalid. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 target; /**< Target flags */ - u32 sector_num; /**< Flash sector number to erase (0-11 for the STM, 0-15 - for the M25) */ -} msg_flash_erase_t; - -/** Lock sector of STM flash memory (host => device) - * - * The flash lock message locks a sector of the STM flash memory. The device - * replies with a MSG_FLASH_DONE message. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 sector; /**< Flash sector number to lock */ -} msg_stm_flash_lock_sector_t; - -/** Unlock sector of STM flash memory (host => device) - * - * The flash unlock message unlocks a sector of the STM flash memory. The - * device replies with a MSG_FLASH_DONE message. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 sector; /**< Flash sector number to unlock */ -} msg_stm_flash_unlock_sector_t; - -/** Read device's hard-coded unique ID request (host => device) - - * - * This message reads the device's hard-coded unique ID. The host requests the - * ID by sending a MSG_STM_UNIQUE_ID_REQ. The device responds with a - * MSG_STM_UNIQUE_ID_RESP with the 12-byte unique ID in the payload. - */ - -/** Read device's hard-coded unique ID response (host <= device) - - * - * This message reads the device's hard-coded unique ID. The host requests the - * ID by sending a MSG_STM_UNIQUE_ID_REQ. The device responds with a - * MSG_STM_UNIQUE_ID_RESP with the 12-byte unique ID in the payload. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 stm_id[12]; /**< Device unique ID */ -} msg_stm_unique_id_resp_t; - -/** Write M25 flash status register (host => device) - * - * The flash status message writes to the 8-bit M25 flash status register. The - * device replies with a MSG_FLASH_DONE message. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 status[1]; /**< Byte to write to the M25 flash status register */ -} msg_m25_flash_write_status_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_FLASH_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/gnss.h b/c/include/libsbp/legacy/gnss.h deleted file mode 100644 index 672c74abde..0000000000 --- a/c/include/libsbp/legacy/gnss.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/gnss.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup gnss Gnss - * - * Various structs shared between modules - * \{ */ - -#ifndef LIBSBP_LEGACY_GNSS_MESSAGES_H -#define LIBSBP_LEGACY_GNSS_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -/** Represents all the relevant information about the signal - * - * Signal identifier containing constellation, band, and satellite identifier. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 sat; /**< Constellation-specific satellite id. For GLO can either be - (100+FCN) where FCN is in [-7,+6] or the Slot ID in [1,28]. */ - u8 code; /**< Signal constellation, band and code */ -} sbp_gnss_signal_t; - -/** Space vehicle identifier - * - * A (Constellation ID, satellite ID) tuple that uniquely identifies a space - * vehicle. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 satId; /**< Constellation-specific satellite id. For GLO can - either be (100+FCN) where FCN is in [-7,+6] or the - Slot ID in [1,28]. */ - u8 constellation; /**< Constellation ID to which the SV belongs */ -} sv_id_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 sat; /**< Constellation-specific satellite identifier. - - Note: unlike GnssSignal, GPS satellites are encoded as - (PRN - 1). Other constellations do not have this - offset. */ - u8 code; /**< Signal constellation, band and code */ - u8 reserved; /**< Reserved */ -} gnss_signal_dep_t; - -/** Millisecond-accurate GPS time - * - * A wire-appropriate GPS time, defined as the number of milliseconds since - * beginning of the week on the Saturday/Sunday transition. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< Milliseconds since start of GPS week [ms] */ - u16 wn; /**< GPS week number [week] */ -} gps_time_dep_t; - -/** Whole second accurate GPS time - * - * A GPS time, defined as the number of seconds since beginning of the week on - * the Saturday/Sunday transition. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< Seconds since start of GPS week [s] */ - u16 wn; /**< GPS week number [week] */ -} gps_time_sec_t; - -/** Nanosecond-accurate receiver clock time - * - * A wire-appropriate receiver clock time, defined as the time since the - * beginning of the week on the Saturday/Sunday transition. In most cases, - * observations are epoch aligned so ns field will be 0. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< Milliseconds since start of GPS week [ms] */ - s32 ns_residual; /**< Nanosecond residual of millisecond-rounded TOW - (ranges from -500000 to 500000) [ns] */ - u16 wn; /**< GPS week number [week] */ -} sbp_gps_time_t; - -/** GNSS carrier phase measurement - * - * Carrier phase measurement in cycles represented as a 40-bit fixed point - * number with Q32.8 layout, i.e. 32-bits of whole cycles and 8-bits of - * fractional cycles. This phase has the same sign as the pseudorange. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - s32 i; /**< Carrier phase whole cycles [cycles] */ - u8 f; /**< Carrier phase fractional part [cycles / 256] */ -} carrier_phase_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_GNSS_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/imu.h b/c/include/libsbp/legacy/imu.h deleted file mode 100644 index fd64009ce0..0000000000 --- a/c/include/libsbp/legacy/imu.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/imu.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup imu Imu - * - * Inertial Measurement Unit (IMU) messages. - * \{ */ - -#ifndef LIBSBP_LEGACY_IMU_MESSAGES_H -#define LIBSBP_LEGACY_IMU_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -/** Raw IMU data - * - * Raw data from the Inertial Measurement Unit, containing accelerometer and - * gyroscope readings. The sense of the measurements are to be aligned with - * the indications on the device itself. Measurement units, which are specific - * to the device hardware and settings, are communicated via the MSG_IMU_AUX - * message. If using "time since startup" local time tags, the receiving end - * will expect either a MSG_GNSS_TIME_OFFSET or MSG_PPS_TIME to establish the - * relationship between IMU time and GNSS time. - * Regardless of the timestamping mode, the timestamp is required to roll over - * to zero when reaching one week (604800 seconds, or 604800000 milliseconds). - * The time-tagging mode should not change throughout a run. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< Milliseconds since reference epoch and time status. */ - u8 tow_f; /**< Milliseconds since reference epoch, fractional part [ms / 256] - */ - s16 acc_x; /**< Acceleration in the IMU frame X axis */ - s16 acc_y; /**< Acceleration in the IMU frame Y axis */ - s16 acc_z; /**< Acceleration in the IMU frame Z axis */ - s16 gyr_x; /**< Angular rate around IMU frame X axis */ - s16 gyr_y; /**< Angular rate around IMU frame Y axis */ - s16 gyr_z; /**< Angular rate around IMU frame Z axis */ -} msg_imu_raw_t; - -/** Auxiliary IMU data - * - * Auxiliary data specific to a particular IMU. The `imu_type` field will - * always be consistent but the rest of the payload is device specific and - * depends on the value of `imu_type`. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 imu_type; /**< IMU type */ - s16 temp; /**< Raw IMU temperature */ - u8 imu_conf; /**< IMU configuration */ -} msg_imu_aux_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_IMU_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/integrity.h b/c/include/libsbp/legacy/integrity.h deleted file mode 100644 index 911a95c72f..0000000000 --- a/c/include/libsbp/legacy/integrity.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/integrity.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup integrity Integrity - * - * Integrity flag messages - * \{ */ - -#ifndef LIBSBP_LEGACY_INTEGRITY_MESSAGES_H -#define LIBSBP_LEGACY_INTEGRITY_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include -#include - -SBP_PACK_START - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_sec_t obs_time; /**< GNSS reference time of the observation - used to generate the flag. */ - u8 num_msgs; /**< Number of messages in the dataset */ - u8 seq_num; /**< Position of this message in the dataset */ - u8 ssr_sol_id; /**< SSR Solution ID. */ - u16 tile_set_id; /**< Unique identifier of the set this tile belongs to. */ - u16 tile_id; /**< Unique identifier of this tile in the tile set. */ - u8 chain_id; /**< Chain and type of flag. */ -} integrity_ssr_header_t; - -/** High level integrity flags - * - * Integrity monitoring flags for multiple aggregated elements. An element - * could be a satellite, SSR grid point, or SSR tile. A group of aggregated - * elements being monitored for integrity could refer to: - * - * - Satellites in a particular {GPS, GAL, BDS} constellation. - * - * - Satellites in the line-of-sight of a particular SSR tile. - * - * - Satellites in the line-of-sight of a particular SSR grid point. - * - * The integrity usage for a group of aggregated elements varies according to - * the integrity flag of the satellites comprising that group. - * - * SSR_INTEGRITY_USAGE_NOMINAL: All satellites received passed the integrity - * check and have flag INTEGRITY_FLAG_OK. - * - * SSR_INTEGRITY_USAGE_WARNING: A limited number of elements in the group - * failed the integrity check. Refer to more granular integrity messages for - * details on the specific failing elements. - * - * SSR_INTEGRITY_USAGE_ALERT: Most elements in the group failed the integrity - * check, do not use for positioning. - * - * SSR_INTEGRITY_USAGE_NOT_MONITORED: Unable to verify the integrity flag of - * elements in the group. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_sec_t obs_time; /**< GNSS reference time of - the observation used to - generate the flag. */ - gps_time_sec_t corr_time; /**< GNSS reference time of - the correction - associated to the flag. */ - u8 ssr_sol_id; /**< SSR Solution ID. */ - u16 tile_set_id; /**< Unique identifier of the set this - tile belongs to. */ - u16 tile_id; /**< Unique identifier of this tile in - the tile set. */ - u8 chain_id; /**< Chain and type of flag. */ - u8 use_gps_sat; /**< Use GPS satellites. */ - u8 use_gal_sat; /**< Use GAL satellites. */ - u8 use_bds_sat; /**< Use BDS satellites. */ - u8 reserved[6]; /**< Reserved */ - u8 use_tropo_grid_points; /**< Use tropo grid points. */ - u8 use_iono_grid_points; /**< Use iono grid points. */ - u8 use_iono_tile_sat_los; /**< Use iono tile satellite LoS. */ - u8 use_iono_grid_point_sat_los; /**< Use iono grid point satellite LoS. */ -} msg_ssr_flag_high_level_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_sec_t obs_time; /**< GNSS reference time of the observation - used to generate the flag. */ - u8 num_msgs; /**< Number of messages in the dataset */ - u8 seq_num; /**< Position of this message in the dataset */ - u8 ssr_sol_id; /**< SSR Solution ID. */ - u8 chain_id; /**< Chain and type of flag. */ - u8 const_id; /**< Constellation ID. */ - u8 n_faulty_sats; /**< Number of faulty satellites. */ - u8 faulty_sats[0]; /**< List of faulty satellites. */ -} msg_ssr_flag_satellites_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - integrity_ssr_header_t header; /**< Header of an integrity - message. */ - u8 n_faulty_points; /**< Number of faulty grid points. */ - u16 faulty_points[0]; /**< List of faulty grid points. */ -} msg_ssr_flag_tropo_grid_points_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - integrity_ssr_header_t header; /**< Header of an integrity - message. */ - u8 n_faulty_points; /**< Number of faulty grid points. */ - u16 faulty_points[0]; /**< List of faulty grid points. */ -} msg_ssr_flag_iono_grid_points_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - integrity_ssr_header_t header; /**< Header of an integrity message. */ - u8 n_faulty_los; /**< Number of faulty LOS. */ - sv_id_t faulty_los[0]; /**< List of faulty LOS */ -} msg_ssr_flag_iono_tile_sat_los_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - integrity_ssr_header_t header; /**< Header of an integrity - message. */ - u16 grid_point_id; /**< Index of the grid point. */ - u8 n_faulty_los; /**< Number of faulty LOS. */ - sv_id_t faulty_los[0]; /**< List of faulty LOS */ -} msg_ssr_flag_iono_grid_point_sat_los_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 request_id; /**< Echo of the request ID field from the - corresponding CRA message, or 255 if - no request ID was provided. */ - u32 area_id; /**< Echo of the Area ID field from the - corresponding CRA message. */ - u8 response_code; /**< Reported status of the request. */ - u16 correction_mask_on_demand; /**< Contains the message group(s) that - will be sent in response from the - corresponding CRA correction mask. An - echo of the correction mask field - from the corresponding CRA message. */ - u16 correction_mask_stream; /**< For future expansion. Always set to - 0. */ - u8 solution_id; /**< The solution ID of the instance - providing the corrections. */ -} msg_acknowledge_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_INTEGRITY_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/linux.h b/c/include/libsbp/legacy/linux.h deleted file mode 100644 index 4c4f8619a7..0000000000 --- a/c/include/libsbp/legacy/linux.h +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/linux.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup linux Linux - * - * Linux state monitoring. - * \{ */ - -#ifndef LIBSBP_LEGACY_LINUX_MESSAGES_H -#define LIBSBP_LEGACY_LINUX_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 index; /**< sequence of this status message, values from 0-9 */ - u16 pid; /**< the PID of the process */ - u8 pcpu; /**< percent of cpu used, expressed as a fraction of 256 */ - char tname[15]; /**< fixed length string representing the thread name */ - char cmdline[0]; /**< the command line (as much as it fits in the remaining - packet) */ -} msg_linux_cpu_state_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 index; /**< sequence of this status message, values from 0-9 */ - u16 pid; /**< the PID of the process */ - u8 pmem; /**< percent of memory used, expressed as a fraction of 256 */ - char tname[15]; /**< fixed length string representing the thread name */ - char cmdline[0]; /**< the command line (as much as it fits in the remaining - packet) */ -} msg_linux_mem_state_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 mem_total; /**< total system memory */ - u8 pcpu; /**< percent of total cpu currently utilized */ - u8 pmem; /**< percent of total memory currently utilized */ - u16 procs_starting; /**< number of processes that started during - collection phase */ - u16 procs_stopping; /**< number of processes that stopped during - collection phase */ - u16 pid_count; /**< the count of processes on the system */ -} msg_linux_sys_state_dep_a_t; - -/** A list of processes with high socket counts - * - * Top 10 list of processes with high socket counts. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 index; /**< sequence of this status message, values from 0-9 */ - u16 pid; /**< the PID of the process in question */ - u16 socket_count; /**< the number of sockets the process is using */ - u16 socket_types; /**< A bitfield indicating the socket types used: 0x1 - (tcp), 0x2 (udp), 0x4 (unix stream), 0x8 (unix - dgram), 0x10 (netlink), and 0x8000 (unknown) */ - u16 socket_states; /**< A bitfield indicating the socket states: 0x1 - (established), 0x2 (syn-sent), 0x4 (syn-recv), - 0x8 (fin-wait-1), 0x10 (fin-wait-2), 0x20 (time- - wait), 0x40 (closed), 0x80 (close-wait), 0x100 - (last-ack), 0x200 (listen), 0x400 (closing), - 0x800 (unconnected), and 0x8000 (unknown) */ - char cmdline[0]; /**< the command line of the process in question */ -} msg_linux_process_socket_counts_t; - -/** A list of processes with deep socket queues - * - * Top 10 list of sockets with deep queues. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 index; /**< sequence of this status message, values from - 0-9 */ - u16 pid; /**< the PID of the process in question */ - u16 recv_queued; /**< the total amount of receive data queued for - this process */ - u16 send_queued; /**< the total amount of send data queued for - this process */ - u16 socket_types; /**< A bitfield indicating the socket types used: - 0x1 (tcp), 0x2 (udp), 0x4 (unix stream), 0x8 - (unix dgram), 0x10 (netlink), and 0x8000 - (unknown) */ - u16 socket_states; /**< A bitfield indicating the socket states: 0x1 - (established), 0x2 (syn-sent), 0x4 (syn- - recv), 0x8 (fin-wait-1), 0x10 (fin-wait-2), - 0x20 (time-wait), 0x40 (closed), 0x80 - (close-wait), 0x100 (last-ack), 0x200 - (listen), 0x400 (closing), 0x800 - (unconnected), and 0x8000 (unknown) */ - char address_of_largest[64]; /**< Address of the largest queue, remote or - local depending on the directionality of - the connection. */ - char cmdline[0]; /**< the command line of the process in question */ -} msg_linux_process_socket_queues_t; - -/** Summary of socket usage across the system - * - * Summaries the socket usage across the system. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 avg_queue_depth; /**< average socket queue depths across all - sockets on the system */ - u32 max_queue_depth; /**< the max queue depth seen within the - reporting period */ - u16 socket_state_counts[16]; /**< A count for each socket type reported in - the `socket_types_reported` field, the - first entry corresponds to the first - enabled bit in `types_reported`. */ - u16 socket_type_counts[16]; /**< A count for each socket type reported in - the `socket_types_reported` field, the - first entry corresponds to the first - enabled bit in `types_reported`. */ -} msg_linux_socket_usage_t; - -/** Summary of processes with large amounts of open file descriptors - * - * Top 10 list of processes with a large number of open file descriptors. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 index; /**< sequence of this status message, values from 0-9 */ - u16 pid; /**< the PID of the process in question */ - u16 fd_count; /**< a count of the number of file descriptors opened by - the process */ - char cmdline[0]; /**< the command line of the process in question */ -} msg_linux_process_fd_count_t; - -/** Summary of open file descriptors on the system - * - * Summary of open file descriptors on the system. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 sys_fd_count; /**< count of total FDs open on the system */ - char most_opened[0]; /**< A null delimited list of strings which alternates - between a string representation of the process - count and the file name whose count it being - reported. That is, in C string syntax - "32\0/var/log/syslog\012\0/tmp/foo\0" with the - end of the list being 2 NULL terminators in a - row. */ -} msg_linux_process_fd_summary_t; - -/** List CPU state on the system - * - * This message indicates the process state of the top 10 heaviest consumers - * of CPU on the system, including a timestamp. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 index; /**< sequence of this status message, values from 0-9 */ - u16 pid; /**< the PID of the process */ - u8 pcpu; /**< percent of CPU used, expressed as a fraction of 256 */ - u32 time; /**< timestamp of message, refer to flags field for how to - interpret */ - u8 flags; /**< flags */ - char tname[15]; /**< fixed length string representing the thread name */ - char cmdline[0]; /**< the command line (as much as it fits in the remaining - packet) */ -} msg_linux_cpu_state_t; - -/** List memory state on the system - * - * This message indicates the process state of the top 10 heaviest consumers - * of memory on the system, including a timestamp. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 index; /**< sequence of this status message, values from 0-9 */ - u16 pid; /**< the PID of the process */ - u8 pmem; /**< percent of memory used, expressed as a fraction of 256 */ - u32 time; /**< timestamp of message, refer to flags field for how to - interpret */ - u8 flags; /**< flags */ - char tname[15]; /**< fixed length string representing the thread name */ - char cmdline[0]; /**< the command line (as much as it fits in the remaining - packet) */ -} msg_linux_mem_state_t; - -/** CPU, Memory and Process Starts/Stops - * - * This presents a summary of CPU and memory utilization, including a - * timestamp. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 mem_total; /**< total system memory, in MiB */ - u8 pcpu; /**< percent of CPU used, expressed as a fraction of - 256 */ - u8 pmem; /**< percent of memory used, expressed as a fraction - of 256 */ - u16 procs_starting; /**< number of processes that started during - collection phase */ - u16 procs_stopping; /**< number of processes that stopped during - collection phase */ - u16 pid_count; /**< the count of processes on the system */ - u32 time; /**< timestamp of message, refer to flags field for - how to interpret */ - u8 flags; /**< flags */ -} msg_linux_sys_state_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_LINUX_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/logging.h b/c/include/libsbp/legacy/logging.h deleted file mode 100644 index 72de1371bf..0000000000 --- a/c/include/libsbp/legacy/logging.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/logging.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup logging Logging - * - * Logging and debugging messages from the device. - * \{ */ - -#ifndef LIBSBP_LEGACY_LOGGING_MESSAGES_H -#define LIBSBP_LEGACY_LOGGING_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -/** Plaintext logging messages with levels - * - * This message contains a human-readable payload string from the device - * containing errors, warnings and informational messages at ERROR, WARNING, - * DEBUG, INFO logging levels. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 level; /**< Logging level */ - char text[0]; /**< Human-readable string */ -} msg_log_t; - -/** Wrapper for FWD a separate stream of information over SBP - * - * This message provides the ability to forward messages over SBP. This may - * take the form of wrapping up SBP messages received by Piksi for logging - * purposes or wrapping another protocol with SBP. - * - * The source identifier indicates from what interface a forwarded stream - * derived. The protocol identifier identifies what the expected protocol the - * forwarded msg contains. Protocol 0 represents SBP and the remaining values - * are implementation defined. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 source; /**< source identifier */ - u8 protocol; /**< protocol identifier */ - u8 fwd_payload[0]; /**< variable length wrapped binary message */ -} msg_fwd_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - char text[0]; /**< Human-readable string */ -} msg_print_dep_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_LOGGING_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/mag.h b/c/include/libsbp/legacy/mag.h deleted file mode 100644 index 23ae921f98..0000000000 --- a/c/include/libsbp/legacy/mag.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/mag.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup mag Mag - * - * Magnetometer (mag) messages. - * \{ */ - -#ifndef LIBSBP_LEGACY_MAG_MESSAGES_H -#define LIBSBP_LEGACY_MAG_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -/** Raw magnetometer data - * - * Raw data from the magnetometer. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< Milliseconds since start of GPS week. If the high bit is - set, the time is unknown or invalid. [ms] */ - u8 tow_f; /**< Milliseconds since start of GPS week, fractional part [ms / - 256] */ - s16 mag_x; /**< Magnetic field in the body frame X axis [microteslas] */ - s16 mag_y; /**< Magnetic field in the body frame Y axis [microteslas] */ - s16 mag_z; /**< Magnetic field in the body frame Z axis [microteslas] */ -} msg_mag_raw_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_MAG_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/navigation.h b/c/include/libsbp/legacy/navigation.h deleted file mode 100644 index b794a7893b..0000000000 --- a/c/include/libsbp/legacy/navigation.h +++ /dev/null @@ -1,1068 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/navigation.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup navigation Navigation - * - * Geodetic navigation messages reporting GPS time, position, velocity, and - * baseline position solutions. For position solutions, these messages define - * several different position solutions: single-point (SPP), RTK, and pseudo- - * absolute position solutions. - * - * The SPP is the standalone, absolute GPS position solution using only a - * single receiver. The RTK solution is the differential GPS solution, which - * can use either a fixed/integer or floating carrier phase ambiguity. The - * pseudo-absolute position solution uses a user-provided, well-surveyed base - * station position (if available) and the RTK solution in tandem. - * - * When the inertial navigation mode indicates that the IMU is used, all - * messages are reported in the vehicle body frame as defined by device - * settings. By default, the vehicle body frame is configured to be - * coincident with the antenna phase center. When there is no inertial - * navigation, the solution will be reported at the phase center of the - * antenna. There is no inertial navigation capability on Piksi Multi or Duro. - * - * The tow field, when valid, is most often the Time of Measurement. When this - * is the case, the 5th bit of flags is set to the default value of 0. When - * this is not the case, the tow may be a time of arrival or a local system - * timestamp, irrespective of the time reference (GPS Week or else), but not a - * Time of Measurement. - * \{ */ - -#ifndef LIBSBP_LEGACY_NAVIGATION_MESSAGES_H -#define LIBSBP_LEGACY_NAVIGATION_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -/** GPS Time (GNSS + inertial) - * - * This message reports the GPS time, representing the time since the GPS - * epoch began on midnight January 6, 1980 UTC. GPS time counts the weeks and - * seconds of the week. The weeks begin at the Saturday/Sunday transition. GPS - * week 0 began at the beginning of the GPS time scale. - * - * Within each week number, the GPS time of the week is between between 0 and - * 604800 seconds (=60*60*24*7). Note that GPS time does not accumulate leap - * seconds, and as of now, has a small offset from UTC. In a message stream, - * this message precedes a set of other navigation messages referenced to the - * same time (but lacking the ns field) and indicates a more precise time of - * these messages. - * - * The values in this message are from GNSS measurements fused with inertial - * measurements. To get values from GNSS measurements only use - * MSG_GPS_TIME_GNSS. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 wn; /**< GPS week number [weeks] */ - u32 tow; /**< GPS time of week rounded to the nearest millisecond [ms] */ - s32 ns_residual; /**< Nanosecond residual of millisecond-rounded TOW - (ranges from -500000 to 500000) [ns] */ - u8 flags; /**< Status flags (reserved) */ -} msg_gps_time_t; - -/** GNSS-only GPS Time - * - * This message reports the GPS time, representing the time since the GPS - * epoch began on midnight January 6, 1980 UTC. GPS time counts the weeks and - * seconds of the week. The weeks begin at the Saturday/Sunday transition. GPS - * week 0 began at the beginning of the GPS time scale. - * - * Within each week number, the GPS time of the week is between between 0 and - * 604800 seconds (=60*60*24*7). Note that GPS time does not accumulate leap - * seconds, and as of now, has a small offset from UTC. In a message stream, - * this message precedes a set of other navigation messages referenced to the - * same time (but lacking the ns field) and indicates a more precise time of - * these messages. - * - * The values in this message are from GNSS measurements only. To get values - * fused with inertial measurements use MSG_GPS_TIME. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 wn; /**< GPS week number [weeks] */ - u32 tow; /**< GPS time of week rounded to the nearest millisecond [ms] */ - s32 ns_residual; /**< Nanosecond residual of millisecond-rounded TOW - (ranges from -500000 to 500000) [ns] */ - u8 flags; /**< Status flags (reserved) */ -} msg_gps_time_gnss_t; - -/** UTC Time - * - * This message reports the Universal Coordinated Time (UTC). Note the flags - * which indicate the source of the UTC offset value and source of the time - * fix. - * - * The values in this message are from GNSS measurements fused with inertial - * measurements. To get values from GNSS measurements only use - * MSG_UTC_TIME_GNSS. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 flags; /**< Indicates source and time validity */ - u32 tow; /**< GPS time of week rounded to the nearest millisecond [ms] */ - u16 year; /**< Year [year] */ - u8 month; /**< Month (range 1 .. 12) [months] */ - u8 day; /**< days in the month (range 1-31) [day] */ - u8 hours; /**< hours of day (range 0-23) [hours] */ - u8 minutes; /**< minutes of hour (range 0-59) [minutes] */ - u8 seconds; /**< seconds of minute (range 0-60) rounded down [seconds] */ - u32 ns; /**< nanoseconds of second (range 0-999999999) [nanoseconds] */ -} msg_utc_time_t; - -/** GNSS-only UTC Time - * - * This message reports the Universal Coordinated Time (UTC). Note the flags - * which indicate the source of the UTC offset value and source of the time - * fix. - * - * The values in this message are from GNSS measurements only. To get values - * fused with inertial measurements use MSG_UTC_TIME. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 flags; /**< Indicates source and time validity */ - u32 tow; /**< GPS time of week rounded to the nearest millisecond [ms] */ - u16 year; /**< Year [year] */ - u8 month; /**< Month (range 1 .. 12) [months] */ - u8 day; /**< days in the month (range 1-31) [day] */ - u8 hours; /**< hours of day (range 0-23) [hours] */ - u8 minutes; /**< minutes of hour (range 0-59) [minutes] */ - u8 seconds; /**< seconds of minute (range 0-60) rounded down [seconds] */ - u32 ns; /**< nanoseconds of second (range 0-999999999) [nanoseconds] */ -} msg_utc_time_gnss_t; - -/** GNSS-only Dilution of Precision - * - * This dilution of precision (DOP) message describes the effect of navigation - * satellite geometry on positional measurement precision. The flags field - * indicated whether the DOP reported corresponds to differential or SPP - * solution. - * - * The values in this message are from GNSS measurements only. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - u16 gdop; /**< Geometric Dilution of Precision [0.01] */ - u16 pdop; /**< Position Dilution of Precision [0.01] */ - u16 tdop; /**< Time Dilution of Precision [0.01] */ - u16 hdop; /**< Horizontal Dilution of Precision [0.01] */ - u16 vdop; /**< Vertical Dilution of Precision [0.01] */ - u8 flags; /**< Indicates the position solution with which the DOPS - message corresponds */ -} msg_dops_t; - -/** Position in ECEF - * - * The position solution message reports absolute Earth Centered Earth Fixed - * (ECEF) coordinates and the status (single point vs pseudo-absolute RTK) of - * the position solution. If the rover receiver knows the surveyed position of - * the base station and has an RTK solution, this reports a pseudo-absolute - * position solution using the base station position and the rover's RTK - * baseline vector. The full GPS time is given by the preceding MSG_GPS_TIME - * with the matching time-of-week (tow). - * - * The values in this message are from GNSS measurements fused with inertial - * measurements. To get values from GNSS measurements only use - * MSG_POS_ECEF_GNSS. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - double x; /**< ECEF X coordinate [m] */ - double y; /**< ECEF Y coordinate [m] */ - double z; /**< ECEF Z coordinate [m] */ - u16 accuracy; /**< Position estimated standard deviation [mm] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_pos_ecef_t; - -/** Position in ECEF with Covariances - * - * The position solution message reports absolute Earth Centered Earth Fixed - * (ECEF) coordinates and the status (single point vs pseudo-absolute RTK) of - * the position solution. The message also reports the upper triangular - * portion of the 3x3 covariance matrix. If the receiver knows the surveyed - * position of the base station and has an RTK solution, this reports a - * pseudo-absolute position solution using the base station position and the - * rover's RTK baseline vector. The full GPS time is given by the preceding - * MSG_GPS_TIME with the matching time-of-week (tow). - * - * The values in this message are from GNSS measurements fused with inertial - * measurements. To get values from GNSS measurements only use - * MSG_POS_ECEF_COV_GNSS. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - double x; /**< ECEF X coordinate [m] */ - double y; /**< ECEF Y coordinate [m] */ - double z; /**< ECEF Z coordinate [m] */ - float cov_x_x; /**< Estimated variance of x [m^2] */ - float cov_x_y; /**< Estimated covariance of x and y [m^2] */ - float cov_x_z; /**< Estimated covariance of x and z [m^2] */ - float cov_y_y; /**< Estimated variance of y [m^2] */ - float cov_y_z; /**< Estimated covariance of y and z [m^2] */ - float cov_z_z; /**< Estimated variance of z [m^2] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_pos_ecef_cov_t; - -/** Geodetic Position - * - * This position solution message reports the absolute geodetic coordinates - * and the status (single point vs pseudo-absolute RTK) of the position - * solution. If the rover receiver knows the surveyed position of the base - * station and has an RTK solution, this reports a pseudo-absolute position - * solution using the base station position and the rover's RTK baseline - * vector. The full GPS time is given by the preceding MSG_GPS_TIME with the - * matching time-of-week (tow). - * - * The values in this message are from GNSS measurements fused with inertial - * measurements. To get values from GNSS measurements only use - * MSG_POS_LLH_GNSS. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - double lat; /**< Latitude [deg] */ - double lon; /**< Longitude [deg] */ - double height; /**< Height above WGS84 ellipsoid [m] */ - u16 h_accuracy; /**< Horizontal position estimated standard deviation [mm] */ - u16 v_accuracy; /**< Vertical position estimated standard deviation [mm] */ - u8 n_sats; /**< Number of satellites used in solution. */ - u8 flags; /**< Status flags */ -} msg_pos_llh_t; - -/** Geodetic Position with Covariances - * - * This position solution message reports the absolute geodetic coordinates - * and the status (single point vs pseudo-absolute RTK) of the position - * solution as well as the upper triangle of the 3x3 covariance matrix. The - * position information and Fix Mode flags follow the MSG_POS_LLH message. - * Since the covariance matrix is computed in the local-level North, East, - * Down frame, the covariance terms follow that convention. Thus, covariances - * are reported against the "downward" measurement and care should be taken - * with the sign convention. - * - * The values in this message are from GNSS measurements fused with inertial - * measurements. To get values from GNSS measurements only use - * MSG_POS_LLH_COV_GNSS. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - double lat; /**< Latitude [deg] */ - double lon; /**< Longitude [deg] */ - double height; /**< Height above WGS84 ellipsoid [m] */ - float cov_n_n; /**< Estimated variance of northing [m^2] */ - float cov_n_e; /**< Covariance of northing and easting [m^2] */ - float cov_n_d; /**< Covariance of northing and downward measurement [m^2] */ - float cov_e_e; /**< Estimated variance of easting [m^2] */ - float cov_e_d; /**< Covariance of easting and downward measurement [m^2] */ - float cov_d_d; /**< Estimated variance of downward measurement [m^2] */ - u8 n_sats; /**< Number of satellites used in solution. */ - u8 flags; /**< Status flags */ -} msg_pos_llh_cov_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - float semi_major; /**< The semi major axis of the estimated horizontal - error ellipse at the user-configured confidence - level; zero implies invalid. [m] */ - float semi_minor; /**< The semi minor axis of the estimated horizontal - error ellipse at the user-configured confidence - level; zero implies invalid. [m] */ - float orientation; /**< The orientation of the semi major axis of the - estimated horizontal error ellipse with respect - to North. [deg] */ -} estimated_horizontal_error_ellipse_t; - -/** Geodetic Position and Accuracy - * - * This position solution message reports the absolute geodetic coordinates - * and the status (single point vs pseudo-absolute RTK) of the position - * solution as well as the estimated horizontal, vertical, cross-track and - * along-track errors. The position information and Fix Mode flags follow - * the MSG_POS_LLH message. Since the covariance matrix is computed in the - * local-level North, East, Down frame, the estimated error terms follow that - * convention. - * - * The estimated errors are reported at a user-configurable confidence level. - * The user-configured percentile is encoded in the percentile field. - * - * The values in this message are from GNSS measurements fused with inertial - * measurements. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - double lat; /**< Latitude [deg] */ - double lon; /**< Longitude [deg] */ - double height; /**< Height above WGS84 ellipsoid [m] */ - double orthometric_height; /**< Height above the geoid (i.e. height - above mean sea level). See - confidence_and_geoid for geoid model - used. [m] */ - float h_accuracy; /**< Estimated horizontal error at the user- - configured confidence level; zero - implies invalid. [m] */ - float v_accuracy; /**< Estimated vertical error at the user- - configured confidence level; zero - implies invalid. [m] */ - float ct_accuracy; /**< Estimated cross-track error at the user- - configured confidence level; zero - implies invalid. [m] */ - float at_accuracy; /**< Estimated along-track error at the user- - configured confidence level; zero - implies invalid. [m] */ - estimated_horizontal_error_ellipse_t h_ellipse; /**< The - estimated - horizontal - error - ellipse - at the - user- - configured - confidence - level. */ - u8 confidence_and_geoid; /**< The lower bits describe the configured - confidence level for the estimated position - error. The middle bits describe the geoid - model used to calculate the orthometric - height. */ - u8 n_sats; /**< Number of satellites used in solution. */ - u8 flags; /**< Status flags */ -} msg_pos_llh_acc_t; - -/** GNSS-only Baseline Position in ECEF - * - * This message reports the baseline solution in Earth Centered Earth Fixed - * (ECEF) coordinates. This baseline is the relative vector distance from the - * base station to the rover receiver. The full GPS time is given by the - * preceding MSG_GPS_TIME with the matching time-of-week (tow). - * - * The values in this message are from GNSS measurements only. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 x; /**< Baseline ECEF X coordinate [mm] */ - s32 y; /**< Baseline ECEF Y coordinate [mm] */ - s32 z; /**< Baseline ECEF Z coordinate [mm] */ - u16 accuracy; /**< Position estimated standard deviation [mm] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_baseline_ecef_t; - -/** GNSS-only Baseline in NED - * - * This message reports the baseline solution in North East Down (NED) - * coordinates. This baseline is the relative vector distance from the base - * station to the rover receiver, and NED coordinate system is defined at the - * local WGS84 tangent plane centered at the base station position. The full - * GPS time is given by the preceding MSG_GPS_TIME with the matching time-of- - * week (tow). - * - * The values in this message are from GNSS measurements only. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 n; /**< Baseline North coordinate [mm] */ - s32 e; /**< Baseline East coordinate [mm] */ - s32 d; /**< Baseline Down coordinate [mm] */ - u16 h_accuracy; /**< Horizontal position estimated standard deviation [mm] */ - u16 v_accuracy; /**< Vertical position estimated standard deviation [mm] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_baseline_ned_t; - -/** Velocity in ECEF - * - * This message reports the velocity in Earth Centered Earth Fixed (ECEF) - * coordinates. The full GPS time is given by the preceding MSG_GPS_TIME with - * the matching time-of-week (tow). - * - * The values in this message are from GNSS measurements fused with inertial - * measurements. To get values from GNSS measurements only use - * MSG_VEL_ECEF_GNSS. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 x; /**< Velocity ECEF X coordinate [mm/s] */ - s32 y; /**< Velocity ECEF Y coordinate [mm/s] */ - s32 z; /**< Velocity ECEF Z coordinate [mm/s] */ - u16 accuracy; /**< Velocity estimated standard deviation [mm/s] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_vel_ecef_t; - -/** Velocity in ECEF with Covariances - * - * This message reports the velocity in Earth Centered Earth Fixed (ECEF) - * coordinates. The full GPS time is given by the preceding MSG_GPS_TIME with - * the matching time-of-week (tow). - * - * The values in this message are from GNSS measurements fused with inertial - * measurements. To get values from GNSS measurements only use - * MSG_VEL_ECEF_COV_GNSS. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 x; /**< Velocity ECEF X coordinate [mm/s] */ - s32 y; /**< Velocity ECEF Y coordinate [mm/s] */ - s32 z; /**< Velocity ECEF Z coordinate [mm/s] */ - float cov_x_x; /**< Estimated variance of x [m^2/s^2] */ - float cov_x_y; /**< Estimated covariance of x and y [m^2/s^2] */ - float cov_x_z; /**< Estimated covariance of x and z [m^2/s^2] */ - float cov_y_y; /**< Estimated variance of y [m^2/s^2] */ - float cov_y_z; /**< Estimated covariance of y and z [m^2/s^2] */ - float cov_z_z; /**< Estimated variance of z [m^2/s^2] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_vel_ecef_cov_t; - -/** Velocity in NED - * - * This message reports the velocity in local North East Down (NED) - * coordinates. The NED coordinate system is defined as the local WGS84 - * tangent plane centered at the current position. The full GPS time is given - * by the preceding MSG_GPS_TIME with the matching time-of-week (tow). - * - * The values in this message are from GNSS measurements fused with inertial - * measurements. To get values from GNSS measurements only use - * MSG_VEL_NED_GNSS. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 n; /**< Velocity North coordinate [mm/s] */ - s32 e; /**< Velocity East coordinate [mm/s] */ - s32 d; /**< Velocity Down coordinate [mm/s] */ - u16 h_accuracy; /**< Horizontal velocity estimated standard deviation [mm/s] - */ - u16 v_accuracy; /**< Vertical velocity estimated standard deviation [mm/s] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_vel_ned_t; - -/** Velocity in NED with Covariances - * - * This message reports the velocity in local North East Down (NED) - * coordinates. The NED coordinate system is defined as the local WGS84 - * tangent plane centered at the current position. The full GPS time is given - * by the preceding MSG_GPS_TIME with the matching time-of-week (tow). This - * message is similar to the MSG_VEL_NED, but it includes the upper triangular - * portion of the 3x3 covariance matrix. - * - * The values in this message are from GNSS measurements fused with inertial - * measurements. To get values from GNSS measurements only use - * MSG_VEL_NED_COV_GNSS. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 n; /**< Velocity North coordinate [mm/s] */ - s32 e; /**< Velocity East coordinate [mm/s] */ - s32 d; /**< Velocity Down coordinate [mm/s] */ - float cov_n_n; /**< Estimated variance of northward measurement [m^2] */ - float cov_n_e; /**< Covariance of northward and eastward measurement [m^2] */ - float cov_n_d; /**< Covariance of northward and downward measurement [m^2] */ - float cov_e_e; /**< Estimated variance of eastward measurement [m^2] */ - float cov_e_d; /**< Covariance of eastward and downward measurement [m^2] */ - float cov_d_d; /**< Estimated variance of downward measurement [m^2] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_vel_ned_cov_t; - -/** GNSS-only Position in ECEF - * - * The position solution message reports absolute Earth Centered Earth Fixed - * (ECEF) coordinates and the status (single point vs pseudo-absolute RTK) of - * the position solution. If the rover receiver knows the surveyed position of - * the base station and has an RTK solution, this reports a pseudo-absolute - * position solution using the base station position and the rover's RTK - * baseline vector. The full GPS time is given by the preceding - * MSG_GPS_TIME_GNSS with the matching time-of-week (tow). - * - * The values in this message are from GNSS measurements only. To get values - * fused with inertial measurements use MSG_POS_ECEF. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - double x; /**< ECEF X coordinate [m] */ - double y; /**< ECEF Y coordinate [m] */ - double z; /**< ECEF Z coordinate [m] */ - u16 accuracy; /**< Position estimated standard deviation [mm] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_pos_ecef_gnss_t; - -/** GNSS-only Position in ECEF with Covariances - * - * The position solution message reports absolute Earth Centered Earth Fixed - * (ECEF) coordinates and the status (single point vs pseudo-absolute RTK) of - * the position solution. The message also reports the upper triangular - * portion of the 3x3 covariance matrix. If the receiver knows the surveyed - * position of the base station and has an RTK solution, this reports a - * pseudo-absolute position solution using the base station position and the - * rover's RTK baseline vector. The full GPS time is given by the preceding - * MSG_GPS_TIME_GNSS with the matching time-of-week (tow). - * - * The values in this message are from GNSS measurements only. To get values - * fused with inertial measurements use MSG_POS_ECEF_COV. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - double x; /**< ECEF X coordinate [m] */ - double y; /**< ECEF Y coordinate [m] */ - double z; /**< ECEF Z coordinate [m] */ - float cov_x_x; /**< Estimated variance of x [m^2] */ - float cov_x_y; /**< Estimated covariance of x and y [m^2] */ - float cov_x_z; /**< Estimated covariance of x and z [m^2] */ - float cov_y_y; /**< Estimated variance of y [m^2] */ - float cov_y_z; /**< Estimated covariance of y and z [m^2] */ - float cov_z_z; /**< Estimated variance of z [m^2] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_pos_ecef_cov_gnss_t; - -/** GNSS-only Geodetic Position - * - * This position solution message reports the absolute geodetic coordinates - * and the status (single point vs pseudo-absolute RTK) of the position - * solution. If the rover receiver knows the surveyed position of the base - * station and has an RTK solution, this reports a pseudo-absolute position - * solution using the base station position and the rover's RTK baseline - * vector. The full GPS time is given by the preceding MSG_GPS_TIME_GNSS with - * the matching time-of-week (tow). - * - * The values in this message are from GNSS measurements only. To get values - * fused with inertial measurements use MSG_POS_LLH. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - double lat; /**< Latitude [deg] */ - double lon; /**< Longitude [deg] */ - double height; /**< Height above WGS84 ellipsoid [m] */ - u16 h_accuracy; /**< Horizontal position estimated standard deviation [mm] */ - u16 v_accuracy; /**< Vertical position estimated standard deviation [mm] */ - u8 n_sats; /**< Number of satellites used in solution. */ - u8 flags; /**< Status flags */ -} msg_pos_llh_gnss_t; - -/** GNSS-only Geodetic Position with Covariances - * - * This position solution message reports the absolute geodetic coordinates - * and the status (single point vs pseudo-absolute RTK) of the position - * solution as well as the upper triangle of the 3x3 covariance matrix. The - * position information and Fix Mode flags should follow the MSG_POS_LLH_GNSS - * message. Since the covariance matrix is computed in the local-level North, - * East, Down frame, the covariance terms follow with that convention. Thus, - * covariances are reported against the "downward" measurement and care should - * be taken with the sign convention. - * - * The values in this message are from GNSS measurements only. To get values - * fused with inertial measurements use MSG_POS_LLH_COV. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - double lat; /**< Latitude [deg] */ - double lon; /**< Longitude [deg] */ - double height; /**< Height above WGS84 ellipsoid [m] */ - float cov_n_n; /**< Estimated variance of northing [m^2] */ - float cov_n_e; /**< Covariance of northing and easting [m^2] */ - float cov_n_d; /**< Covariance of northing and downward measurement [m^2] */ - float cov_e_e; /**< Estimated variance of easting [m^2] */ - float cov_e_d; /**< Covariance of easting and downward measurement [m^2] */ - float cov_d_d; /**< Estimated variance of downward measurement [m^2] */ - u8 n_sats; /**< Number of satellites used in solution. */ - u8 flags; /**< Status flags */ -} msg_pos_llh_cov_gnss_t; - -/** GNSS-only Velocity in ECEF - * - * This message reports the velocity in Earth Centered Earth Fixed (ECEF) - * coordinates. The full GPS time is given by the preceding MSG_GPS_TIME_GNSS - * with the matching time-of-week (tow). - * - * The values in this message are from GNSS measurements only. To get values - * fused with inertial measurements use MSG_VEL_ECEF. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 x; /**< Velocity ECEF X coordinate [mm/s] */ - s32 y; /**< Velocity ECEF Y coordinate [mm/s] */ - s32 z; /**< Velocity ECEF Z coordinate [mm/s] */ - u16 accuracy; /**< Velocity estimated standard deviation [mm/s] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_vel_ecef_gnss_t; - -/** GNSS-only Velocity in ECEF with Covariances - * - * This message reports the velocity in Earth Centered Earth Fixed (ECEF) - * coordinates. The full GPS time is given by the preceding MSG_GPS_TIME_GNSS - * with the matching time-of-week (tow). - * - * The values in this message are from GNSS measurements only. To get values - * fused with inertial measurements use MSG_VEL_ECEF_COV. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 x; /**< Velocity ECEF X coordinate [mm/s] */ - s32 y; /**< Velocity ECEF Y coordinate [mm/s] */ - s32 z; /**< Velocity ECEF Z coordinate [mm/s] */ - float cov_x_x; /**< Estimated variance of x [m^2/s^2] */ - float cov_x_y; /**< Estimated covariance of x and y [m^2/s^2] */ - float cov_x_z; /**< Estimated covariance of x and z [m^2/s^2] */ - float cov_y_y; /**< Estimated variance of y [m^2/s^2] */ - float cov_y_z; /**< Estimated covariance of y and z [m^2/s^2] */ - float cov_z_z; /**< Estimated variance of z [m^2/s^2] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_vel_ecef_cov_gnss_t; - -/** GNSS-only Velocity in NED - * - * This message reports the velocity in local North East Down (NED) - * coordinates. The NED coordinate system is defined as the local WGS84 - * tangent plane centered at the current position. The full GPS time is given - * by the preceding MSG_GPS_TIME_GNSS with the matching time-of-week (tow). - * - * The values in this message are from GNSS measurements only. To get values - * fused with inertial measurements use MSG_VEL_NED. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 n; /**< Velocity North coordinate [mm/s] */ - s32 e; /**< Velocity East coordinate [mm/s] */ - s32 d; /**< Velocity Down coordinate [mm/s] */ - u16 h_accuracy; /**< Horizontal velocity estimated standard deviation [mm/s] - */ - u16 v_accuracy; /**< Vertical velocity estimated standard deviation [mm/s] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_vel_ned_gnss_t; - -/** GNSS-only Velocity in NED with Covariances - * - * This message reports the velocity in local North East Down (NED) - * coordinates. The NED coordinate system is defined as the local WGS84 - * tangent plane centered at the current position. The full GPS time is given - * by the preceding MSG_GPS_TIME_GNSS with the matching time-of-week (tow). - * This message is similar to the MSG_VEL_NED_GNSS, but it includes the upper - * triangular portion of the 3x3 covariance matrix. - * - * The values in this message are from GNSS measurements only. To get values - * fused with inertial measurements use MSG_VEL_NED_COV. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 n; /**< Velocity North coordinate [mm/s] */ - s32 e; /**< Velocity East coordinate [mm/s] */ - s32 d; /**< Velocity Down coordinate [mm/s] */ - float cov_n_n; /**< Estimated variance of northward measurement [m^2] */ - float cov_n_e; /**< Covariance of northward and eastward measurement [m^2] */ - float cov_n_d; /**< Covariance of northward and downward measurement [m^2] */ - float cov_e_e; /**< Estimated variance of eastward measurement [m^2] */ - float cov_e_d; /**< Covariance of eastward and downward measurement [m^2] */ - float cov_d_d; /**< Estimated variance of downward measurement [m^2] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_vel_ned_cov_gnss_t; - -/** Velocity in User Frame - * - * This message reports the velocity in the Vehicle Body Frame. By convention, - * the x-axis should point out the nose of the vehicle and represent the - * forward direction, while as the y-axis should point out the right hand side - * of the vehicle. Since this is a right handed system, z should point out the - * bottom of the vehicle. The orientation and origin of the Vehicle Body Frame - * are specified via the device settings. The full GPS time is given by the - * preceding MSG_GPS_TIME with the matching time-of-week (tow). This message - * is only produced by inertial versions of Swift products and is not - * available from Piksi Multi or Duro. - * - * The values in this message are from GNSS measurements fused with inertial - * measurements. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 x; /**< Velocity in x direction [mm/s] */ - s32 y; /**< Velocity in y direction [mm/s] */ - s32 z; /**< Velocity in z direction [mm/s] */ - float cov_x_x; /**< Estimated variance of x [m^2] */ - float cov_x_y; /**< Covariance of x and y [m^2] */ - float cov_x_z; /**< Covariance of x and z [m^2] */ - float cov_y_y; /**< Estimated variance of y [m^2] */ - float cov_y_z; /**< Covariance of y and z [m^2] */ - float cov_z_z; /**< Estimated variance of z [m^2] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_vel_body_t; - -/** Velocity expressed as course over ground - * - * This message reports the receiver course over ground (COG) and speed over - * ground (SOG) based on the horizontal (N-E) components of the NED velocity - * vector. It also includes the vertical velocity coordinate. A flag is - * provided to indicate whether the COG value has been frozen. When the flag - * is set to true, the COG field is set to its last valid value until the - * system exceeds a minimum velocity threshold. No other fields are affected - * by this flag. The NED coordinate system is defined as the local WGS84 - * tangent plane centered at the current position. The full GPS time is given - * by the preceding MSG_GPS_TIME with the matching time-of-week (tow). Note: - * course over ground represents the receiver's direction of travel, but not - * necessarily the device heading. - * - * The values in this message are from GNSS measurements fused with inertial - * measurements. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - u32 cog; /**< Course over ground relative to north direction [microdegrees] */ - u32 sog; /**< Speed over ground (based on horizontal velocity) [mm/s] */ - s32 v_up; /**< Vertical velocity component (positive up) [mm/s] */ - u32 cog_accuracy; /**< Course over ground estimated standard deviation - [microdegrees] */ - u32 sog_accuracy; /**< Speed over ground estimated standard deviation [mm/s] - */ - u32 v_up_accuracy; /**< Vertical velocity estimated standard deviation [mm/s] - */ - u16 flags; /**< Status flags */ -} msg_vel_cog_t; - -/** Age of corrections - * - * This message reports the Age of the corrections used for the current - * Differential solution. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - u16 age; /**< Age of the corrections (0xFFFF indicates invalid) [deciseconds] - */ -} msg_age_corrections_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 wn; /**< GPS week number [weeks] */ - u32 tow; /**< GPS time of week rounded to the nearest millisecond [ms] */ - s32 ns_residual; /**< Nanosecond residual of millisecond-rounded TOW - (ranges from -500000 to 500000) [ns] */ - u8 flags; /**< Status flags (reserved) */ -} msg_gps_time_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - u16 gdop; /**< Geometric Dilution of Precision [0.01] */ - u16 pdop; /**< Position Dilution of Precision [0.01] */ - u16 tdop; /**< Time Dilution of Precision [0.01] */ - u16 hdop; /**< Horizontal Dilution of Precision [0.01] */ - u16 vdop; /**< Vertical Dilution of Precision [0.01] */ -} msg_dops_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - double x; /**< ECEF X coordinate [m] */ - double y; /**< ECEF Y coordinate [m] */ - double z; /**< ECEF Z coordinate [m] */ - u16 accuracy; /**< Position accuracy estimate (not implemented). Defaults - to 0. [mm] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_pos_ecef_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - double lat; /**< Latitude [deg] */ - double lon; /**< Longitude [deg] */ - double height; /**< Height [m] */ - u16 h_accuracy; /**< Horizontal position accuracy estimate (not - implemented). Defaults to 0. [mm] */ - u16 v_accuracy; /**< Vertical position accuracy estimate (not - implemented). Defaults to 0. [mm] */ - u8 n_sats; /**< Number of satellites used in solution. */ - u8 flags; /**< Status flags */ -} msg_pos_llh_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 x; /**< Baseline ECEF X coordinate [mm] */ - s32 y; /**< Baseline ECEF Y coordinate [mm] */ - s32 z; /**< Baseline ECEF Z coordinate [mm] */ - u16 accuracy; /**< Position accuracy estimate [mm] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_baseline_ecef_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 n; /**< Baseline North coordinate [mm] */ - s32 e; /**< Baseline East coordinate [mm] */ - s32 d; /**< Baseline Down coordinate [mm] */ - u16 h_accuracy; /**< Horizontal position accuracy estimate (not - implemented). Defaults to 0. [mm] */ - u16 v_accuracy; /**< Vertical position accuracy estimate (not - implemented). Defaults to 0. [mm] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_baseline_ned_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 x; /**< Velocity ECEF X coordinate [mm/s] */ - s32 y; /**< Velocity ECEF Y coordinate [mm/s] */ - s32 z; /**< Velocity ECEF Z coordinate [mm/s] */ - u16 accuracy; /**< Velocity accuracy estimate (not implemented). Defaults - to 0. [mm/s] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags (reserved) */ -} msg_vel_ecef_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 n; /**< Velocity North coordinate [mm/s] */ - s32 e; /**< Velocity East coordinate [mm/s] */ - s32 d; /**< Velocity Down coordinate [mm/s] */ - u16 h_accuracy; /**< Horizontal velocity accuracy estimate (not - implemented). Defaults to 0. [mm/s] */ - u16 v_accuracy; /**< Vertical velocity accuracy estimate (not - implemented). Defaults to 0. [mm/s] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags (reserved) */ -} msg_vel_ned_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - u32 heading; /**< Heading [mdeg] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_baseline_heading_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - u16 vpl; /**< Vertical protection level [cm] */ - u16 hpl; /**< Horizontal protection level [cm] */ - double lat; /**< Latitude [deg] */ - double lon; /**< Longitude [deg] */ - double height; /**< Height [m] */ - u8 flags; /**< Status flags */ -} msg_protection_level_dep_a_t; - -/** Computed state and Protection Levels - * - * This message reports the protection levels associated to the given state - * estimate. The full GPS time is given by the preceding MSG_GPS_TIME with the - * matching time-of-week (tow). - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s16 wn; /**< GPS week number [weeks] */ - u16 hpl; /**< Horizontal protection level [cm] */ - u16 vpl; /**< Vertical protection level [cm] */ - u16 atpl; /**< Along-track position error protection level [cm] */ - u16 ctpl; /**< Cross-track position error protection level [cm] */ - u16 hvpl; /**< Protection level for the error vector between estimated - and true along/cross track velocity vector [mm/s] */ - u16 vvpl; /**< Protection level for the velocity in vehicle upright - direction (different from vertical direction if on a - slope) [mm/s] */ - u16 hopl; /**< Heading orientation protection level [mdeg] */ - u16 popl; /**< Pitch orientation protection level [mdeg] */ - u16 ropl; /**< Roll orientation protection level [mdeg] */ - double lat; /**< Latitude [deg] */ - double lon; /**< Longitude [deg] */ - double height; /**< Height [m] */ - s32 v_x; /**< Velocity in vehicle x direction [mm/s] */ - s32 v_y; /**< Velocity in vehicle y direction [mm/s] */ - s32 v_z; /**< Velocity in vehicle z direction [mm/s] */ - s32 roll; /**< Roll angle [udeg] */ - s32 pitch; /**< Pitch angle [udeg] */ - s32 heading; /**< Heading angle [udeg] */ - u32 flags; /**< Status flags */ -} msg_protection_level_t; - -/** Leap second SBP message. - - * - * UTC-GPST leap seconds before and after the most recent (past, or future, - * for announced insertions) UTC leap second insertion. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - s16 reserved_0; /**< Reserved. */ - s16 reserved_1; /**< Reserved. */ - s8 reserved_2; /**< Reserved. */ - s8 count_before; /**< Leap second count before insertion. [s] */ - u16 reserved_3; /**< Reserved. */ - u16 reserved_4; /**< Reserved. */ - u16 ref_wn; /**< Leap second reference GPS week number. [weeks] */ - u8 ref_dn; /**< Leap second reference day number. [days] */ - s8 count_after; /**< Leap second count after insertion. [s] */ -} msg_utc_leap_second_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 ssr_iod; /**< SSR IOD parameter. */ - char sn[32]; /**< Name of source coordinate-system. */ - char tn[32]; /**< Name of target coordinate-system. */ - u8 sin; /**< System Identification Number. */ - u16 utn; /**< Utilized Transformation Message. */ - u16 re_t0; /**< Reference Epoch t0 for transformation parameter - set given as Modified Julian Day (MJD) Number - minus 44244 days. [1 day] */ - s32 delta_X0; /**< Translation in X for Reference Epoch t0. [0.001 m] */ - s32 delta_Y0; /**< Translation in Y for Reference Epoch t0. [0.001 m] */ - s32 delta_Z0; /**< Translation in Z for Reference Epoch t0. [0.001 m] */ - s32 theta_01; /**< Rotation around the X-axis for Reference Epoch t0. [0.00002 - "] */ - s32 theta_02; /**< Rotation around the Y-axis for Reference Epoch t0. [0.00002 - "] */ - s32 theta_03; /**< Rotation around the Z-axis for Reference Epoch t0. [0.00002 - "] */ - s32 scale; /**< Scale correction for Reference Epoch t0. [0.00001 ppm] */ - s32 dot_delta_X0; /**< Rate of change of translation in X. [0.00002 m/yr] */ - s32 dot_delta_Y0; /**< Rate of change of translation in Y. [0.00002 m/yr] */ - s32 dot_delta_Z0; /**< Rate of change of translation in Z. [0.00002 m/yr] */ - s32 dot_theta_01; /**< Rate of change of rotation around the X-axis. - [0.0000004 "/yr] */ - s32 dot_theta_02; /**< Rate of change of rotation around the Y-axis. - [0.0000004 "/yr] */ - s32 dot_theta_03; /**< Rate of change of rotation around the Z-axis. - [0.0000004 "/yr] */ - s16 dot_scale; /**< Rate of change of scale correction. [0.0000002 ppm/yr] */ -} msg_reference_frame_param_t; - -/** Relative Pose - * - * This solution message reports the relative pose of a sensor between two - * time instances. The relative pose comprises of a rotation and a translation - * which relates the sensor (e.g. camera) frame at a given time (first - * keyframe) to the sensor frame at another time (second keyframe). The - * relative translations is a 3x1 vector described in the first keyframe. - * Relative rotation is described by a quaternion from second keyframe to the - * first keyframe. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - u8 sensor_id; /**< ID of the sensor producing this message */ - u32 timestamp_1; /**< Timestamp of first keyframe [ms] */ - u32 timestamp_2; /**< Timestamp of second keyframe [ms] */ - s32 trans[3]; /**< Relative translation [x,y,z] described in first - keyframe [mm] */ - s32 w; /**< Real component of quaternion to describe relative - rotation (second to first keyframe) [2^-31] */ - s32 x; /**< 1st imaginary component of quaternion to describe - relative rotation (second to first keyframe) [2^-31] */ - s32 y; /**< 2nd imaginary component of quaternion to describe - relative rotation (second to first keyframe) [2^-31] */ - s32 z; /**< 3rd imaginary component of quaternion to describe - relative rotation (second to first keyframe) [2^-31] */ - float cov_r_x_x; /**< Estimated variance of x (relative translation) [m^2] */ - float cov_r_x_y; /**< Covariance of x and y (relative translation) [m^2] */ - float cov_r_x_z; /**< Covariance of x and z (relative translation) [m^2] */ - float cov_r_y_y; /**< Estimated variance of y (relative translation) [m^2] */ - float cov_r_y_z; /**< Covariance of y and z (relative translation) [m^2] */ - float cov_r_z_z; /**< Estimated variance of z (relative translation) [m^2] */ - float cov_c_x_x; /**< Estimated variance of x (relative rotation) [rad^2] */ - float cov_c_x_y; /**< Covariance of x and y (relative rotation) [rad^2] */ - float cov_c_x_z; /**< Covariance of x and z (relative rotation) [rad^2] */ - float cov_c_y_y; /**< Estimated variance of y (relative rotation) [rad^2] */ - float cov_c_y_z; /**< Covariance of y and z (relative rotation) [rad^2] */ - float cov_c_z_z; /**< Estimated variance of z (relative rotation) [rad^2] */ - u8 flags; /**< Status flags of relative translation and rotation */ -} msg_pose_relative_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_NAVIGATION_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/ndb.h b/c/include/libsbp/legacy/ndb.h deleted file mode 100644 index f5031c1ecc..0000000000 --- a/c/include/libsbp/legacy/ndb.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/ndb.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup ndb Ndb - * - * Messages for logging NDB events. - * \{ */ - -#ifndef LIBSBP_LEGACY_NDB_MESSAGES_H -#define LIBSBP_LEGACY_NDB_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include -#include - -SBP_PACK_START - -/** Navigation DataBase Event - * - * This message is sent out when an object is stored into NDB. If needed - * message could also be sent out when fetching an object from NDB. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u64 recv_time; /**< HW time in milliseconds. [ms] */ - u8 event; /**< Event type. */ - u8 object_type; /**< Event object type. */ - u8 result; /**< Event result. */ - u8 data_source; /**< Data source for STORE event, reserved for other - events. */ - sbp_gnss_signal_t object_sid; /**< GNSS signal identifier, If - object_type is Ephemeris OR - Almanac, sid indicates for which - signal the object belongs to. - Reserved in other cases. */ - sbp_gnss_signal_t src_sid; /**< GNSS signal identifier, If - object_type is Almanac, Almanac - WN, Iono OR L2C capabilities AND - data_source is NDB_DS_RECEIVER - sid indicates from which SV data - was decoded. Reserved in other - cases. */ - u16 original_sender; /**< A unique identifier of the sending hardware. - For v1.0, set to the 2 least significant bytes - of the device serial number, valid only if - data_source is NDB_DS_SBP. Reserved in case of - other data_source. */ -} msg_ndb_event_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_NDB_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/observation.h b/c/include/libsbp/legacy/observation.h deleted file mode 100644 index a016407386..0000000000 --- a/c/include/libsbp/legacy/observation.h +++ /dev/null @@ -1,1275 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/observation.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup observation Observation - * - * Satellite observation messages from the device. The SBP sender ID of 0 - * indicates remote observations from a GNSS base station, correction network, - * or Skylark, Swift's cloud GNSS correction product. - * \{ */ - -#ifndef LIBSBP_LEGACY_OBSERVATION_MESSAGES_H -#define LIBSBP_LEGACY_OBSERVATION_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include -#include - -SBP_PACK_START - -/** Header for observation message - * - * Header of a GNSS observation message. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - sbp_gps_time_t t; /**< GNSS time of this observation */ - u8 n_obs; /**< Total number of observations. First nibble is the size of - the sequence (n), second nibble is the zero-indexed - counter (ith packet of n) */ -} observation_header_t; - -/** GNSS doppler measurement - * - * Doppler measurement in Hz represented as a 24-bit fixed point number with - * Q16.8 layout, i.e. 16-bits of whole doppler and 8-bits of fractional - * doppler. This doppler is defined as positive for approaching satellites. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - s16 i; /**< Doppler whole Hz [Hz] */ - u8 f; /**< Doppler fractional part [Hz / 256] */ -} doppler_t; - -/** GNSS observations for a particular satellite signal - * - * Pseudorange and carrier phase observation for a satellite being tracked. - * The observations are interoperable with 3rd party receivers and conform - * with typical RTCM 3.1 message GPS/GLO observations. - * - * Carrier phase observations are not guaranteed to be aligned to the RINEX 3 - * or RTCM 3.3 MSM reference signal and no 1/4 cycle adjustments are currently - * performed. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 P; /**< Pseudorange observation [2 cm] */ - carrier_phase_t L; /**< Carrier phase observation with typical sign - convention. [cycles] */ - doppler_t D; /**< Doppler observation with typical sign convention. [Hz] */ - u8 cn0; /**< Carrier-to-Noise density. Zero implies invalid cn0. [dB Hz / 4] - */ - u8 lock; /**< Lock timer. This value gives an indication of the time for - which a signal has maintained continuous phase lock. - Whenever a signal has lost and regained lock, this value - is reset to zero. It is encoded according to DF402 from - the RTCM 10403.2 Amendment 2 specification. Valid values - range from 0 to 15 and the most significant nibble is - reserved for future use. */ - u8 flags; /**< Measurement status flags. A bit field of flags providing - the status of this observation. If this field is 0 it - means only the Cn0 estimate for the signal is valid. */ - sbp_gnss_signal_t sid; /**< GNSS signal identifier (16 bit) */ -} packed_obs_content_t; - -/** Network correction for a particular satellite signal - * - * Pseudorange and carrier phase network corrections for a satellite signal. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 P; /**< Pseudorange observation [2 cm] */ - carrier_phase_t L; /**< Carrier phase observation with typical - sign convention. [cycles] */ - u8 lock; /**< Lock timer. This value gives an indication of the time - for which a signal has maintained continuous phase - lock. Whenever a signal has lost and regained lock, - this value is reset to zero. It is encoded according - to DF402 from the RTCM 10403.2 Amendment 2 - specification. Valid values range from 0 to 15 and - the most significant nibble is reserved for future - use. */ - u8 flags; /**< Correction flags. */ - sbp_gnss_signal_t sid; /**< GNSS signal identifier (16 bit) */ - u16 iono_std; /**< Slant ionospheric correction standard deviation [5 mm] */ - u16 tropo_std; /**< Slant tropospheric correction standard deviation [5 mm] */ - u16 range_std; /**< Orbit/clock/bias correction projected on range - standard deviation [5 mm] */ -} packed_osr_content_t; - -/** GPS satellite observations - * - * The GPS observations message reports all the raw pseudorange and carrier - * phase observations for the satellites being tracked by the device. Carrier - * phase observation here is represented as a 40-bit fixed point number with - * Q32.8 layout (i.e. 32-bits of whole cycles and 8-bits of fractional - * cycles). The observations are be interoperable with 3rd party receivers and - * conform with typical RTCMv3 GNSS observations. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - observation_header_t header; /**< Header of a GPS observation message */ - packed_obs_content_t obs[0]; /**< Pseudorange and carrier phase - observation for a satellite being - tracked. */ -} msg_obs_t; - -/** Base station position - * - * The base station position message is the position reported by the base - * station itself. It is used for pseudo-absolute RTK positioning, and is - * required to be a high-accuracy surveyed location of the base station. Any - * error here will result in an error in the pseudo-absolute position output. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - double lat; /**< Latitude [deg] */ - double lon; /**< Longitude [deg] */ - double height; /**< Height [m] */ -} msg_base_pos_llh_t; - -/** Base station position in ECEF - * - * The base station position message is the position reported by the base - * station itself in absolute Earth Centered Earth Fixed coordinates. It is - * used for pseudo-absolute RTK positioning, and is required to be a high- - * accuracy surveyed location of the base station. Any error here will result - * in an error in the pseudo-absolute position output. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - double x; /**< ECEF X coordinate [m] */ - double y; /**< ECEF Y coordinate [m] */ - double z; /**< ECEF Z coordinate [m] */ -} msg_base_pos_ecef_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - sbp_gnss_signal_t sid; /**< GNSS signal identifier (16 bit) */ - gps_time_sec_t toe; /**< Time of Ephemerides */ - float ura; /**< User Range Accuracy [m] */ - u32 fit_interval; /**< Curve fit interval [s] */ - u8 valid; /**< Status of ephemeris, 1 = valid, 0 = invalid */ - u8 health_bits; /**< Satellite health status. - GPS: ICD-GPS-200, chapter 20.3.3.3.1.4 - SBAS: 0 = valid, non-zero = invalid - GLO: 0 = valid, non-zero = invalid */ -} ephemeris_common_content_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - sbp_gnss_signal_t sid; /**< GNSS signal identifier (16 bit) */ - gps_time_sec_t toe; /**< Time of Ephemerides */ - double ura; /**< User Range Accuracy [m] */ - u32 fit_interval; /**< Curve fit interval [s] */ - u8 valid; /**< Status of ephemeris, 1 = valid, 0 = invalid */ - u8 health_bits; /**< Satellite health status. - GPS: ICD-GPS-200, chapter 20.3.3.3.1.4 - Others: 0 = valid, non-zero = invalid */ -} ephemeris_common_content_dep_b_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gnss_signal_dep_t sid; /**< GNSS signal identifier */ - gps_time_dep_t toe; /**< Time of Ephemerides */ - double ura; /**< User Range Accuracy [m] */ - u32 fit_interval; /**< Curve fit interval [s] */ - u8 valid; /**< Status of ephemeris, 1 = valid, 0 = invalid */ - u8 health_bits; /**< Satellite health status. - GPS: ICD-GPS-200, chapter 20.3.3.3.1.4 - SBAS: 0 = valid, non-zero = invalid - GLO: 0 = valid, non-zero = invalid */ -} ephemeris_common_content_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - ephemeris_common_content_dep_a_t common; /**< Values common for all - ephemeris types */ - double tgd; /**< Group delay differential between L1 and L2 [s] */ - double c_rs; /**< Amplitude of the sine harmonic correction term to - the orbit radius [m] */ - double c_rc; /**< Amplitude of the cosine harmonic correction term to - the orbit radius [m] */ - double c_uc; /**< Amplitude of the cosine harmonic correction term to - the argument of latitude [rad] */ - double c_us; /**< Amplitude of the sine harmonic correction term to - the argument of latitude [rad] */ - double c_ic; /**< Amplitude of the cosine harmonic correction term to - the angle of inclination [rad] */ - double c_is; /**< Amplitude of the sine harmonic correction term to - the angle of inclination [rad] */ - double dn; /**< Mean motion difference [rad/s] */ - double m0; /**< Mean anomaly at reference time [rad] */ - double ecc; /**< Eccentricity of satellite orbit */ - double sqrta; /**< Square root of the semi-major axis of orbit [m^(1/2)] */ - double omega0; /**< Longitude of ascending node of orbit plane at - weekly epoch [rad] */ - double omegadot; /**< Rate of right ascension [rad/s] */ - double w; /**< Argument of perigee [rad] */ - double inc; /**< Inclination [rad] */ - double inc_dot; /**< Inclination first derivative [rad/s] */ - double af0; /**< Polynomial clock correction coefficient (clock - bias) [s] */ - double af1; /**< Polynomial clock correction coefficient (clock - drift) [s/s] */ - double af2; /**< Polynomial clock correction coefficient (rate of - clock drift) [s/s^2] */ - gps_time_dep_t toc; /**< Clock reference */ - u8 iode; /**< Issue of ephemeris data */ - u16 iodc; /**< Issue of clock data */ -} msg_ephemeris_gps_dep_e_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - ephemeris_common_content_dep_b_t common; /**< Values common for all - ephemeris types */ - double tgd; /**< Group delay differential between L1 and L2 [s] */ - double c_rs; /**< Amplitude of the sine harmonic correction term to - the orbit radius [m] */ - double c_rc; /**< Amplitude of the cosine harmonic correction term to - the orbit radius [m] */ - double c_uc; /**< Amplitude of the cosine harmonic correction term to - the argument of latitude [rad] */ - double c_us; /**< Amplitude of the sine harmonic correction term to - the argument of latitude [rad] */ - double c_ic; /**< Amplitude of the cosine harmonic correction term to - the angle of inclination [rad] */ - double c_is; /**< Amplitude of the sine harmonic correction term to - the angle of inclination [rad] */ - double dn; /**< Mean motion difference [rad/s] */ - double m0; /**< Mean anomaly at reference time [rad] */ - double ecc; /**< Eccentricity of satellite orbit */ - double sqrta; /**< Square root of the semi-major axis of orbit [m^(1/2)] */ - double omega0; /**< Longitude of ascending node of orbit plane at - weekly epoch [rad] */ - double omegadot; /**< Rate of right ascension [rad/s] */ - double w; /**< Argument of perigee [rad] */ - double inc; /**< Inclination [rad] */ - double inc_dot; /**< Inclination first derivative [rad/s] */ - double af0; /**< Polynomial clock correction coefficient (clock - bias) [s] */ - double af1; /**< Polynomial clock correction coefficient (clock - drift) [s/s] */ - double af2; /**< Polynomial clock correction coefficient (rate of - clock drift) [s/s^2] */ - gps_time_sec_t toc; /**< Clock reference */ - u8 iode; /**< Issue of ephemeris data */ - u16 iodc; /**< Issue of clock data */ -} msg_ephemeris_gps_dep_f_t; - -/** Satellite broadcast ephemeris for GPS - * - * The ephemeris message returns a set of satellite orbit parameters that is - * used to calculate GPS satellite position, velocity, and clock offset. - * Please see the Navstar GPS Space Segment/Navigation user interfaces (ICD- - * GPS-200, Table 20-III) for more details. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - ephemeris_common_content_t common; /**< Values common for all ephemeris - types */ - float tgd; /**< Group delay differential between L1 and L2 [s] */ - float c_rs; /**< Amplitude of the sine harmonic correction term to - the orbit radius [m] */ - float c_rc; /**< Amplitude of the cosine harmonic correction term to - the orbit radius [m] */ - float c_uc; /**< Amplitude of the cosine harmonic correction term to - the argument of latitude [rad] */ - float c_us; /**< Amplitude of the sine harmonic correction term to - the argument of latitude [rad] */ - float c_ic; /**< Amplitude of the cosine harmonic correction term to - the angle of inclination [rad] */ - float c_is; /**< Amplitude of the sine harmonic correction term to - the angle of inclination [rad] */ - double dn; /**< Mean motion difference [rad/s] */ - double m0; /**< Mean anomaly at reference time [rad] */ - double ecc; /**< Eccentricity of satellite orbit */ - double sqrta; /**< Square root of the semi-major axis of orbit [m^(1/2)] */ - double omega0; /**< Longitude of ascending node of orbit plane at - weekly epoch [rad] */ - double omegadot; /**< Rate of right ascension [rad/s] */ - double w; /**< Argument of perigee [rad] */ - double inc; /**< Inclination [rad] */ - double inc_dot; /**< Inclination first derivative [rad/s] */ - float af0; /**< Polynomial clock correction coefficient (clock bias) [s] */ - float af1; /**< Polynomial clock correction coefficient (clock - drift) [s/s] */ - float af2; /**< Polynomial clock correction coefficient (rate of - clock drift) [s/s^2] */ - gps_time_sec_t toc; /**< Clock reference */ - u8 iode; /**< Issue of ephemeris data */ - u16 iodc; /**< Issue of clock data */ -} msg_ephemeris_gps_t; - -/** Satellite broadcast ephemeris for QZSS - * - * The ephemeris message returns a set of satellite orbit parameters that is - * used to calculate QZSS satellite position, velocity, and clock offset. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - ephemeris_common_content_t common; /**< Values common for all ephemeris - types */ - float tgd; /**< Group delay differential between L1 and L2 [s] */ - float c_rs; /**< Amplitude of the sine harmonic correction term to - the orbit radius [m] */ - float c_rc; /**< Amplitude of the cosine harmonic correction term to - the orbit radius [m] */ - float c_uc; /**< Amplitude of the cosine harmonic correction term to - the argument of latitude [rad] */ - float c_us; /**< Amplitude of the sine harmonic correction term to - the argument of latitude [rad] */ - float c_ic; /**< Amplitude of the cosine harmonic correction term to - the angle of inclination [rad] */ - float c_is; /**< Amplitude of the sine harmonic correction term to - the angle of inclination [rad] */ - double dn; /**< Mean motion difference [rad/s] */ - double m0; /**< Mean anomaly at reference time [rad] */ - double ecc; /**< Eccentricity of satellite orbit */ - double sqrta; /**< Square root of the semi-major axis of orbit [m^(1/2)] */ - double omega0; /**< Longitude of ascending node of orbit plane at - weekly epoch [rad] */ - double omegadot; /**< Rate of right ascension [rad/s] */ - double w; /**< Argument of perigee [rad] */ - double inc; /**< Inclination [rad] */ - double inc_dot; /**< Inclination first derivative [rad/s] */ - float af0; /**< Polynomial clock correction coefficient (clock bias) [s] */ - float af1; /**< Polynomial clock correction coefficient (clock - drift) [s/s] */ - float af2; /**< Polynomial clock correction coefficient (rate of - clock drift) [s/s^2] */ - gps_time_sec_t toc; /**< Clock reference */ - u8 iode; /**< Issue of ephemeris data */ - u16 iodc; /**< Issue of clock data */ -} msg_ephemeris_qzss_t; - -/** Satellite broadcast ephemeris for BDS - * - * The ephemeris message returns a set of satellite orbit parameters that is - * used to calculate BDS satellite position, velocity, and clock offset. - * Please see the BeiDou Navigation Satellite System SIS-ICD Version 2.1, - * Table 5-9 for more details. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - ephemeris_common_content_t common; /**< Values common for all ephemeris - types */ - float tgd1; /**< Group delay differential for B1 [s] */ - float tgd2; /**< Group delay differential for B2 [s] */ - float c_rs; /**< Amplitude of the sine harmonic correction term to - the orbit radius [m] */ - float c_rc; /**< Amplitude of the cosine harmonic correction term to - the orbit radius [m] */ - float c_uc; /**< Amplitude of the cosine harmonic correction term to - the argument of latitude [rad] */ - float c_us; /**< Amplitude of the sine harmonic correction term to - the argument of latitude [rad] */ - float c_ic; /**< Amplitude of the cosine harmonic correction term to - the angle of inclination [rad] */ - float c_is; /**< Amplitude of the sine harmonic correction term to - the angle of inclination [rad] */ - double dn; /**< Mean motion difference [rad/s] */ - double m0; /**< Mean anomaly at reference time [rad] */ - double ecc; /**< Eccentricity of satellite orbit */ - double sqrta; /**< Square root of the semi-major axis of orbit [m^(1/2)] */ - double omega0; /**< Longitude of ascending node of orbit plane at - weekly epoch [rad] */ - double omegadot; /**< Rate of right ascension [rad/s] */ - double w; /**< Argument of perigee [rad] */ - double inc; /**< Inclination [rad] */ - double inc_dot; /**< Inclination first derivative [rad/s] */ - double af0; /**< Polynomial clock correction coefficient (clock - bias) [s] */ - float af1; /**< Polynomial clock correction coefficient (clock - drift) [s/s] */ - float af2; /**< Polynomial clock correction coefficient (rate of - clock drift) [s/s^2] */ - gps_time_sec_t toc; /**< Clock reference */ - u8 iode; /**< Issue of ephemeris data - Calculated from the navigation data parameter t_oe per - RTCM/CSNO recommendation: IODE = mod (t_oe / 720, 240) */ - u16 iodc; /**< Issue of clock data - Calculated from the navigation data parameter t_oe per - RTCM/CSNO recommendation: IODE = mod (t_oc / 720, 240) */ -} msg_ephemeris_bds_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - ephemeris_common_content_t common; /**< Values common for all - ephemeris types */ - float bgd_e1e5a; /**< E1-E5a Broadcast Group Delay [s] */ - float bgd_e1e5b; /**< E1-E5b Broadcast Group Delay [s] */ - float c_rs; /**< Amplitude of the sine harmonic correction term to - the orbit radius [m] */ - float c_rc; /**< Amplitude of the cosine harmonic correction term to - the orbit radius [m] */ - float c_uc; /**< Amplitude of the cosine harmonic correction term to - the argument of latitude [rad] */ - float c_us; /**< Amplitude of the sine harmonic correction term to - the argument of latitude [rad] */ - float c_ic; /**< Amplitude of the cosine harmonic correction term to - the angle of inclination [rad] */ - float c_is; /**< Amplitude of the sine harmonic correction term to - the angle of inclination [rad] */ - double dn; /**< Mean motion difference [rad/s] */ - double m0; /**< Mean anomaly at reference time [rad] */ - double ecc; /**< Eccentricity of satellite orbit */ - double sqrta; /**< Square root of the semi-major axis of orbit [m^(1/2)] */ - double omega0; /**< Longitude of ascending node of orbit plane at - weekly epoch [rad] */ - double omegadot; /**< Rate of right ascension [rad/s] */ - double w; /**< Argument of perigee [rad] */ - double inc; /**< Inclination [rad] */ - double inc_dot; /**< Inclination first derivative [rad/s] */ - double af0; /**< Polynomial clock correction coefficient (clock - bias) [s] */ - double af1; /**< Polynomial clock correction coefficient (clock - drift) [s/s] */ - float af2; /**< Polynomial clock correction coefficient (rate of - clock drift) [s/s^2] */ - gps_time_sec_t toc; /**< Clock reference */ - u16 iode; /**< Issue of data (IODnav) */ - u16 iodc; /**< Issue of data (IODnav). Always equal to iode */ -} msg_ephemeris_gal_dep_a_t; - -/** Satellite broadcast ephemeris for Galileo - * - * The ephemeris message returns a set of satellite orbit parameters that is - * used to calculate Galileo satellite position, velocity, and clock offset. - * Please see the Signal In Space ICD OS SIS ICD, Issue 1.3, December 2016 for - * more details. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - ephemeris_common_content_t common; /**< Values common for all - ephemeris types */ - float bgd_e1e5a; /**< E1-E5a Broadcast Group Delay [s] */ - float bgd_e1e5b; /**< E1-E5b Broadcast Group Delay [s] */ - float c_rs; /**< Amplitude of the sine harmonic correction term to - the orbit radius [m] */ - float c_rc; /**< Amplitude of the cosine harmonic correction term to - the orbit radius [m] */ - float c_uc; /**< Amplitude of the cosine harmonic correction term to - the argument of latitude [rad] */ - float c_us; /**< Amplitude of the sine harmonic correction term to - the argument of latitude [rad] */ - float c_ic; /**< Amplitude of the cosine harmonic correction term to - the angle of inclination [rad] */ - float c_is; /**< Amplitude of the sine harmonic correction term to - the angle of inclination [rad] */ - double dn; /**< Mean motion difference [rad/s] */ - double m0; /**< Mean anomaly at reference time [rad] */ - double ecc; /**< Eccentricity of satellite orbit */ - double sqrta; /**< Square root of the semi-major axis of orbit [m^(1/2)] */ - double omega0; /**< Longitude of ascending node of orbit plane at - weekly epoch [rad] */ - double omegadot; /**< Rate of right ascension [rad/s] */ - double w; /**< Argument of perigee [rad] */ - double inc; /**< Inclination [rad] */ - double inc_dot; /**< Inclination first derivative [rad/s] */ - double af0; /**< Polynomial clock correction coefficient (clock - bias) [s] */ - double af1; /**< Polynomial clock correction coefficient (clock - drift) [s/s] */ - float af2; /**< Polynomial clock correction coefficient (rate of - clock drift) [s/s^2] */ - gps_time_sec_t toc; /**< Clock reference */ - u16 iode; /**< Issue of data (IODnav) */ - u16 iodc; /**< Issue of data (IODnav). Always equal to iode */ - u8 source; /**< 0=I/NAV, 1=F/NAV */ -} msg_ephemeris_gal_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - ephemeris_common_content_dep_a_t common; /**< Values common for all - ephemeris types */ - double pos[3]; /**< Position of the GEO at time toe [m] */ - double vel[3]; /**< Velocity of the GEO at time toe [m/s] */ - double acc[3]; /**< Acceleration of the GEO at time toe [m/s^2] */ - double - a_gf0; /**< Time offset of the GEO clock w.r.t. SBAS Network Time [s] */ - double a_gf1; /**< Drift of the GEO clock w.r.t. SBAS Network Time [s/s] */ -} msg_ephemeris_sbas_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - ephemeris_common_content_dep_a_t common; /**< Values common for all - ephemeris types */ - double gamma; /**< Relative deviation of predicted carrier frequency - from nominal */ - double tau; /**< Correction to the SV time [s] */ - double pos[3]; /**< Position of the SV at tb in PZ-90.02 coordinates - system [m] */ - double vel[3]; /**< Velocity vector of the SV at tb in PZ-90.02 - coordinates system [m/s] */ - double acc[3]; /**< Acceleration vector of the SV at tb in PZ-90.02 - coordinates sys [m/s^2] */ -} msg_ephemeris_glo_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - ephemeris_common_content_dep_b_t common; /**< Values common for all - ephemeris types */ - double pos[3]; /**< Position of the GEO at time toe [m] */ - double vel[3]; /**< Velocity of the GEO at time toe [m/s] */ - double acc[3]; /**< Acceleration of the GEO at time toe [m/s^2] */ - double - a_gf0; /**< Time offset of the GEO clock w.r.t. SBAS Network Time [s] */ - double a_gf1; /**< Drift of the GEO clock w.r.t. SBAS Network Time [s/s] */ -} msg_ephemeris_sbas_dep_b_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - ephemeris_common_content_t common; /**< Values common for all ephemeris - types */ - double pos[3]; /**< Position of the GEO at time toe [m] */ - float vel[3]; /**< Velocity of the GEO at time toe [m/s] */ - float acc[3]; /**< Acceleration of the GEO at time toe [m/s^2] */ - float a_gf0; /**< Time offset of the GEO clock w.r.t. SBAS Network Time [s] */ - float a_gf1; /**< Drift of the GEO clock w.r.t. SBAS Network Time [s/s] */ -} msg_ephemeris_sbas_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - ephemeris_common_content_dep_b_t common; /**< Values common for all - ephemeris types */ - double gamma; /**< Relative deviation of predicted carrier frequency - from nominal */ - double tau; /**< Correction to the SV time [s] */ - double pos[3]; /**< Position of the SV at tb in PZ-90.02 coordinates - system [m] */ - double vel[3]; /**< Velocity vector of the SV at tb in PZ-90.02 - coordinates system [m/s] */ - double acc[3]; /**< Acceleration vector of the SV at tb in PZ-90.02 - coordinates sys [m/s^2] */ -} msg_ephemeris_glo_dep_b_t; - -/** Deprecated - * - * The ephemeris message returns a set of satellite orbit parameters that is - * used to calculate GLO satellite position, velocity, and clock offset. - * Please see the GLO ICD 5.1 "Table 4.5 Characteristics of words of immediate - * information (ephemeris parameters)" for more details. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - ephemeris_common_content_dep_b_t common; /**< Values common for all - ephemeris types */ - double gamma; /**< Relative deviation of predicted carrier frequency - from nominal */ - double tau; /**< Correction to the SV time [s] */ - double d_tau; /**< Equipment delay between L1 and L2 [s] */ - double pos[3]; /**< Position of the SV at tb in PZ-90.02 coordinates - system [m] */ - double vel[3]; /**< Velocity vector of the SV at tb in PZ-90.02 - coordinates system [m/s] */ - double acc[3]; /**< Acceleration vector of the SV at tb in PZ-90.02 - coordinates sys [m/s^2] */ - u8 fcn; /**< Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for - invalid */ -} msg_ephemeris_glo_dep_c_t; - -/** Deprecated - * - * This observation message has been deprecated in favor of ephemeris message - * using floats for size reduction. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - ephemeris_common_content_dep_b_t common; /**< Values common for all - ephemeris types */ - double gamma; /**< Relative deviation of predicted carrier frequency - from nominal */ - double tau; /**< Correction to the SV time [s] */ - double d_tau; /**< Equipment delay between L1 and L2 [s] */ - double pos[3]; /**< Position of the SV at tb in PZ-90.02 coordinates - system [m] */ - double vel[3]; /**< Velocity vector of the SV at tb in PZ-90.02 - coordinates system [m/s] */ - double acc[3]; /**< Acceleration vector of the SV at tb in PZ-90.02 - coordinates sys [m/s^2] */ - u8 fcn; /**< Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for - invalid */ - u8 iod; /**< Issue of data. Equal to the 7 bits of the immediate data - word t_b */ -} msg_ephemeris_glo_dep_d_t; - -/** Satellite broadcast ephemeris for GLO - * - * The ephemeris message returns a set of satellite orbit parameters that is - * used to calculate GLO satellite position, velocity, and clock offset. - * Please see the GLO ICD 5.1 "Table 4.5 Characteristics of words of immediate - * information (ephemeris parameters)" for more details. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - ephemeris_common_content_t common; /**< Values common for all ephemeris - types */ - float gamma; /**< Relative deviation of predicted carrier frequency from - nominal */ - float tau; /**< Correction to the SV time [s] */ - float d_tau; /**< Equipment delay between L1 and L2 [s] */ - double pos[3]; /**< Position of the SV at tb in PZ-90.02 coordinates - system [m] */ - double vel[3]; /**< Velocity vector of the SV at tb in PZ-90.02 - coordinates system [m/s] */ - float acc[3]; /**< Acceleration vector of the SV at tb in PZ-90.02 - coordinates sys [m/s^2] */ - u8 fcn; /**< Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for - invalid */ - u8 iod; /**< Issue of data. Equal to the 7 bits of the immediate data - word t_b */ -} msg_ephemeris_glo_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - double tgd; /**< Group delay differential between L1 and L2 [s] */ - double c_rs; /**< Amplitude of the sine harmonic correction term to - the orbit radius [m] */ - double c_rc; /**< Amplitude of the cosine harmonic correction term to - the orbit radius [m] */ - double c_uc; /**< Amplitude of the cosine harmonic correction term to - the argument of latitude [rad] */ - double c_us; /**< Amplitude of the sine harmonic correction term to - the argument of latitude [rad] */ - double c_ic; /**< Amplitude of the cosine harmonic correction term to - the angle of inclination [rad] */ - double c_is; /**< Amplitude of the sine harmonic correction term to - the angle of inclination [rad] */ - double dn; /**< Mean motion difference [rad/s] */ - double m0; /**< Mean anomaly at reference time [rad] */ - double ecc; /**< Eccentricity of satellite orbit */ - double sqrta; /**< Square root of the semi-major axis of orbit [m^(1/2)] */ - double omega0; /**< Longitude of ascending node of orbit plane at - weekly epoch [rad] */ - double omegadot; /**< Rate of right ascension [rad/s] */ - double w; /**< Argument of perigee [rad] */ - double inc; /**< Inclination [rad] */ - double inc_dot; /**< Inclination first derivative [rad/s] */ - double af0; /**< Polynomial clock correction coefficient (clock - bias) [s] */ - double af1; /**< Polynomial clock correction coefficient (clock - drift) [s/s] */ - double af2; /**< Polynomial clock correction coefficient (rate of - clock drift) [s/s^2] */ - double toe_tow; /**< Time of week [s] */ - u16 toe_wn; /**< Week number [week] */ - double toc_tow; /**< Clock reference time of week [s] */ - u16 toc_wn; /**< Clock reference week number [week] */ - u8 valid; /**< Is valid? */ - u8 healthy; /**< Satellite is healthy? */ - gnss_signal_dep_t sid; /**< GNSS signal identifier */ - u8 iode; /**< Issue of ephemeris data */ - u16 iodc; /**< Issue of clock data */ - u32 reserved; /**< Reserved field */ -} msg_ephemeris_dep_d_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - double tgd; /**< Group delay differential between L1 and L2 [s] */ - double c_rs; /**< Amplitude of the sine harmonic correction term to - the orbit radius [m] */ - double c_rc; /**< Amplitude of the cosine harmonic correction term to - the orbit radius [m] */ - double c_uc; /**< Amplitude of the cosine harmonic correction term to - the argument of latitude [rad] */ - double c_us; /**< Amplitude of the sine harmonic correction term to - the argument of latitude [rad] */ - double c_ic; /**< Amplitude of the cosine harmonic correction term to - the angle of inclination [rad] */ - double c_is; /**< Amplitude of the sine harmonic correction term to - the angle of inclination [rad] */ - double dn; /**< Mean motion difference [rad/s] */ - double m0; /**< Mean anomaly at reference time [rad] */ - double ecc; /**< Eccentricity of satellite orbit */ - double sqrta; /**< Square root of the semi-major axis of orbit [m^(1/2)] */ - double omega0; /**< Longitude of ascending node of orbit plane at - weekly epoch [rad] */ - double omegadot; /**< Rate of right ascension [rad/s] */ - double w; /**< Argument of perigee [rad] */ - double inc; /**< Inclination [rad] */ - double inc_dot; /**< Inclination first derivative [rad/s] */ - double af0; /**< Polynomial clock correction coefficient (clock - bias) [s] */ - double af1; /**< Polynomial clock correction coefficient (clock - drift) [s/s] */ - double af2; /**< Polynomial clock correction coefficient (rate of - clock drift) [s/s^2] */ - double toe_tow; /**< Time of week [s] */ - u16 toe_wn; /**< Week number [week] */ - double toc_tow; /**< Clock reference time of week [s] */ - u16 toc_wn; /**< Clock reference week number [week] */ - u8 valid; /**< Is valid? */ - u8 healthy; /**< Satellite is healthy? */ - u8 prn; /**< PRN being tracked */ -} msg_ephemeris_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - double tgd; /**< Group delay differential between L1 and L2 [s] */ - double c_rs; /**< Amplitude of the sine harmonic correction term to - the orbit radius [m] */ - double c_rc; /**< Amplitude of the cosine harmonic correction term to - the orbit radius [m] */ - double c_uc; /**< Amplitude of the cosine harmonic correction term to - the argument of latitude [rad] */ - double c_us; /**< Amplitude of the sine harmonic correction term to - the argument of latitude [rad] */ - double c_ic; /**< Amplitude of the cosine harmonic correction term to - the angle of inclination [rad] */ - double c_is; /**< Amplitude of the sine harmonic correction term to - the angle of inclination [rad] */ - double dn; /**< Mean motion difference [rad/s] */ - double m0; /**< Mean anomaly at reference time [rad] */ - double ecc; /**< Eccentricity of satellite orbit */ - double sqrta; /**< Square root of the semi-major axis of orbit [m^(1/2)] */ - double omega0; /**< Longitude of ascending node of orbit plane at - weekly epoch [rad] */ - double omegadot; /**< Rate of right ascension [rad/s] */ - double w; /**< Argument of perigee [rad] */ - double inc; /**< Inclination [rad] */ - double inc_dot; /**< Inclination first derivative [rad/s] */ - double af0; /**< Polynomial clock correction coefficient (clock - bias) [s] */ - double af1; /**< Polynomial clock correction coefficient (clock - drift) [s/s] */ - double af2; /**< Polynomial clock correction coefficient (rate of - clock drift) [s/s^2] */ - double toe_tow; /**< Time of week [s] */ - u16 toe_wn; /**< Week number [week] */ - double toc_tow; /**< Clock reference time of week [s] */ - u16 toc_wn; /**< Clock reference week number [week] */ - u8 valid; /**< Is valid? */ - u8 healthy; /**< Satellite is healthy? */ - u8 prn; /**< PRN being tracked */ - u8 iode; /**< Issue of ephemeris data */ -} msg_ephemeris_dep_b_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - double tgd; /**< Group delay differential between L1 and L2 [s] */ - double c_rs; /**< Amplitude of the sine harmonic correction term to - the orbit radius [m] */ - double c_rc; /**< Amplitude of the cosine harmonic correction term to - the orbit radius [m] */ - double c_uc; /**< Amplitude of the cosine harmonic correction term to - the argument of latitude [rad] */ - double c_us; /**< Amplitude of the sine harmonic correction term to - the argument of latitude [rad] */ - double c_ic; /**< Amplitude of the cosine harmonic correction term to - the angle of inclination [rad] */ - double c_is; /**< Amplitude of the sine harmonic correction term to - the angle of inclination [rad] */ - double dn; /**< Mean motion difference [rad/s] */ - double m0; /**< Mean anomaly at reference time [rad] */ - double ecc; /**< Eccentricity of satellite orbit */ - double sqrta; /**< Square root of the semi-major axis of orbit [m^(1/2)] */ - double omega0; /**< Longitude of ascending node of orbit plane at - weekly epoch [rad] */ - double omegadot; /**< Rate of right ascension [rad/s] */ - double w; /**< Argument of perigee [rad] */ - double inc; /**< Inclination [rad] */ - double inc_dot; /**< Inclination first derivative [rad/s] */ - double af0; /**< Polynomial clock correction coefficient (clock - bias) [s] */ - double af1; /**< Polynomial clock correction coefficient (clock - drift) [s/s] */ - double af2; /**< Polynomial clock correction coefficient (rate of - clock drift) [s/s^2] */ - double toe_tow; /**< Time of week [s] */ - u16 toe_wn; /**< Week number [week] */ - double toc_tow; /**< Clock reference time of week [s] */ - u16 toc_wn; /**< Clock reference week number [week] */ - u8 valid; /**< Is valid? */ - u8 healthy; /**< Satellite is healthy? */ - gnss_signal_dep_t sid; /**< GNSS signal identifier */ - u8 iode; /**< Issue of ephemeris data */ - u16 iodc; /**< Issue of clock data */ - u32 reserved; /**< Reserved field */ -} msg_ephemeris_dep_c_t; - -/** Header for observation message - * - * Header of a GPS observation message. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_dep_t t; /**< GPS time of this observation */ - u8 n_obs; /**< Total number of observations. First nibble is the size of - the sequence (n), second nibble is the zero-indexed - counter (ith packet of n) */ -} observation_header_dep_t; - -/** GPS carrier phase measurement - * - * Carrier phase measurement in cycles represented as a 40-bit fixed point - * number with Q32.8 layout, i.e. 32-bits of whole cycles and 8-bits of - * fractional cycles. This has the opposite sign convention than a typical GPS - * receiver and the phase has the opposite sign as the pseudorange. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - s32 i; /**< Carrier phase whole cycles [cycles] */ - u8 f; /**< Carrier phase fractional part [cycles / 256] */ -} carrier_phase_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 P; /**< Pseudorange observation [cm] */ - carrier_phase_dep_a_t L; /**< Carrier phase observation with opposite - sign from typical convention */ - u8 cn0; /**< Carrier-to-Noise density [dB Hz / 4] */ - u16 lock; /**< Lock indicator. This value changes whenever a satellite - signal has lost and regained lock, indicating that the - carrier phase ambiguity may have changed. */ - u8 prn; /**< PRN-1 identifier of the satellite signal */ -} packed_obs_content_dep_a_t; - -/** GPS observations for a particular satellite signal - * - * Pseudorange and carrier phase observation for a satellite being tracked. - * Pseudoranges are referenced to a nominal pseudorange. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 P; /**< Pseudorange observation [cm] */ - carrier_phase_dep_a_t L; /**< Carrier phase observation with opposite - sign from typical convention. */ - u8 cn0; /**< Carrier-to-Noise density [dB Hz / 4] */ - u16 lock; /**< Lock indicator. This value changes whenever a satellite - signal has lost and regained lock, indicating that the - carrier phase ambiguity may have changed. */ - gnss_signal_dep_t sid; /**< GNSS signal identifier */ -} packed_obs_content_dep_b_t; - -/** GPS observations for a particular satellite signal - * - * Pseudorange and carrier phase observation for a satellite being tracked. - * The observations are be interoperable with 3rd party receivers and conform - * with typical RTCMv3 GNSS observations. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 P; /**< Pseudorange observation [2 cm] */ - carrier_phase_t L; /**< Carrier phase observation with typical sign - convention. [cycles] */ - u8 cn0; /**< Carrier-to-Noise density [dB Hz / 4] */ - u16 lock; /**< Lock indicator. This value changes whenever a satellite - signal has lost and regained lock, indicating that the - carrier phase ambiguity may have changed. */ - gnss_signal_dep_t sid; /**< GNSS signal identifier */ -} packed_obs_content_dep_c_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - observation_header_dep_t header; /**< Header of a GPS observation message */ - packed_obs_content_dep_a_t obs[0]; /**< Pseudorange and carrier phase - observation for a satellite being - tracked. */ -} msg_obs_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - observation_header_dep_t header; /**< Header of a GPS observation message */ - packed_obs_content_dep_b_t obs[0]; /**< Pseudorange and carrier phase - observation for a satellite being - tracked. */ -} msg_obs_dep_b_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - observation_header_dep_t header; /**< Header of a GPS observation message */ - packed_obs_content_dep_c_t obs[0]; /**< Pseudorange and carrier phase - observation for a satellite being - tracked. */ -} msg_obs_dep_c_t; - -/** Iono corrections - * - * The ionospheric parameters which allow the "L1 only" or "L2 only" user to - * utilize the ionospheric model for computation of the ionospheric delay. - * Please see ICD-GPS-200 (Chapter 20.3.3.5.1.7) for more details. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_sec_t t_nmct; /**< Navigation Message Correction Table Validity - Time */ - double a0; - double a1; - double a2; - double a3; - double b0; - double b1; - double b2; - double b3; -} msg_iono_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_sec_t t_nmct; /**< Navigation Message Correction Table - Validity Time */ - u32 l2c_mask; /**< L2C capability mask, SV32 bit being MSB, SV1 bit being - LSB */ -} msg_sv_configuration_gps_dep_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u64 gps_active; /**< GPS SV active mask */ - u64 gps_l2c; /**< GPS L2C active mask */ - u64 gps_l5; /**< GPS L5 active mask */ - u32 glo_active; /**< GLO active mask */ - u32 glo_l2of; /**< GLO L2OF active mask */ - u32 glo_l3; /**< GLO L3 active mask */ - u64 sbas_active; /**< SBAS active mask (PRNs 120..158, AN 7/62.2.2-18/18 - Table B-23, - https://www.caat.or.th/wp-content/uploads/2018/03/SL-2018.18.E-1.pdf) - */ - u64 sbas_l5; /**< SBAS L5 active mask (PRNs 120..158, AN - 7/62.2.2-18/18 Table B-23, - https://www.caat.or.th/wp-content/uploads/2018/03/SL-2018.18.E-1.pdf) - */ - u64 bds_active; /**< BDS active mask */ - u64 bds_d2nav; /**< BDS D2NAV active mask */ - u64 bds_b2; /**< BDS B2 active mask */ - u64 bds_b2a; /**< BDS B2A active mask */ - u32 qzss_active; /**< QZSS active mask */ - u64 gal_active; /**< GAL active mask */ - u64 gal_e5; /**< GAL E5 active mask */ -} gnss_capb_t; - -/** GNSS capabilities masks - * - * Bit masks of signal capabilities for each GNSS satellite PRN. - * Please see ICD-GPS-200 (Chapter 20.3.3.5.1.4) for more details. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_sec_t t_nmct; /**< Navigation Message Correction Table Validity - Time */ - gnss_capb_t gc; /**< GNSS capabilities masks */ -} msg_gnss_capb_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_dep_t t_op; /**< Data Predict Time of Week */ - u8 prn; /**< Satellite number */ - u8 valid; /**< bit-field indicating validity of the values, LSB - indicating tgd validity etc. 1 = value is valid, 0 = - value is not valid. */ - s16 tgd; - s16 isc_l1ca; - s16 isc_l2c; -} msg_group_delay_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_sec_t t_op; /**< Data Predict Time of Week */ - gnss_signal_dep_t sid; /**< GNSS signal identifier */ - u8 valid; /**< bit-field indicating validity of the values, LSB - indicating tgd validity etc. 1 = value is valid, 0 = - value is not valid. */ - s16 tgd; - s16 isc_l1ca; - s16 isc_l2c; -} msg_group_delay_dep_b_t; - -/** Group Delay - * - * Please see ICD-GPS-200 (30.3.3.3.1.1) for more details. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_sec_t t_op; /**< Data Predict Time of Week */ - sbp_gnss_signal_t sid; /**< GNSS signal identifier */ - u8 valid; /**< bit-field indicating validity of the values, LSB - indicating tgd validity etc. 1 = value is valid, 0 = - value is not valid. */ - s16 tgd; - s16 isc_l1ca; - s16 isc_l2c; -} msg_group_delay_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - sbp_gnss_signal_t sid; /**< GNSS signal identifier */ - gps_time_sec_t toa; /**< Reference time of almanac */ - double ura; /**< User Range Accuracy [m] */ - u32 fit_interval; /**< Curve fit interval [s] */ - u8 valid; /**< Status of almanac, 1 = valid, 0 = invalid */ - u8 health_bits; /**< Satellite health status for GPS: - - bits 5-7: NAV data health status. See IS- - GPS-200H - Table 20-VII: NAV Data Health Indications. - - bits 0-4: Signal health status. See IS-GPS-200H - Table 20-VIII. Codes for Health of SV Signal - Components. - Satellite health status for GLO (see GLO ICD 5.1 - table 5.1 for details): - - bit 0: C(n), "unhealthy" flag that is - transmitted within - non-immediate data and indicates overall - constellation status - at the moment of almanac uploading. - '0' indicates malfunction of n-satellite. - '1' indicates that n-satellite is operational. - - bit 1: Bn(ln), '0' indicates the satellite is - operational - and suitable for navigation. */ -} almanac_common_content_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gnss_signal_dep_t sid; /**< GNSS signal identifier */ - gps_time_sec_t toa; /**< Reference time of almanac */ - double ura; /**< User Range Accuracy [m] */ - u32 fit_interval; /**< Curve fit interval [s] */ - u8 valid; /**< Status of almanac, 1 = valid, 0 = invalid */ - u8 health_bits; /**< Satellite health status for GPS: - - bits 5-7: NAV data health status. See IS- - GPS-200H - Table 20-VII: NAV Data Health Indications. - - bits 0-4: Signal health status. See IS-GPS-200H - Table 20-VIII. Codes for Health of SV Signal - Components. - Satellite health status for GLO (see GLO ICD 5.1 - table 5.1 for details): - - bit 0: C(n), "unhealthy" flag that is - transmitted within - non-immediate data and indicates overall - constellation status - at the moment of almanac uploading. - '0' indicates malfunction of n-satellite. - '1' indicates that n-satellite is operational. - - bit 1: Bn(ln), '0' indicates the satellite is - operational - and suitable for navigation. */ -} almanac_common_content_dep_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - almanac_common_content_dep_t common; /**< Values common for all almanac - types */ - double m0; /**< Mean anomaly at reference time [rad] */ - double ecc; /**< Eccentricity of satellite orbit */ - double sqrta; /**< Square root of the semi-major axis of orbit [m^(1/2)] */ - double omega0; /**< Longitude of ascending node of orbit plane at - weekly epoch [rad] */ - double omegadot; /**< Rate of right ascension [rad/s] */ - double w; /**< Argument of perigee [rad] */ - double inc; /**< Inclination [rad] */ - double af0; /**< Polynomial clock correction coefficient (clock - bias) [s] */ - double af1; /**< Polynomial clock correction coefficient (clock - drift) [s/s] */ -} msg_almanac_gps_dep_t; - -/** Satellite broadcast almanac for GPS - * - * The almanac message returns a set of satellite orbit parameters. Almanac - * data is not very precise and is considered valid for up to several months. - * Please see the Navstar GPS Space Segment/Navigation user interfaces (ICD- - * GPS-200, Chapter 20.3.3.5.1.2 Almanac Data) for more details. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - almanac_common_content_t common; /**< Values common for all almanac - types */ - double m0; /**< Mean anomaly at reference time [rad] */ - double ecc; /**< Eccentricity of satellite orbit */ - double sqrta; /**< Square root of the semi-major axis of orbit [m^(1/2)] */ - double omega0; /**< Longitude of ascending node of orbit plane at - weekly epoch [rad] */ - double omegadot; /**< Rate of right ascension [rad/s] */ - double w; /**< Argument of perigee [rad] */ - double inc; /**< Inclination [rad] */ - double af0; /**< Polynomial clock correction coefficient (clock - bias) [s] */ - double af1; /**< Polynomial clock correction coefficient (clock - drift) [s/s] */ -} msg_almanac_gps_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - almanac_common_content_dep_t common; /**< Values common for all - almanac types */ - double lambda_na; /**< Longitude of the first ascending node of the - orbit in PZ-90.02 coordinate system [rad] */ - double t_lambda_na; /**< Time of the first ascending node passage [s] */ - double i; /**< Value of inclination at instant of t_lambda [rad] */ - double t; /**< Value of Draconian period at instant of t_lambda [s/orbital - period] */ - double t_dot; /**< Rate of change of the Draconian period [s/(orbital - period^2)] */ - double epsilon; /**< Eccentricity at instant of t_lambda */ - double omega; /**< Argument of perigee at instant of t_lambda [rad] */ -} msg_almanac_glo_dep_t; - -/** Satellite broadcast almanac for GLO - * - * The almanac message returns a set of satellite orbit parameters. Almanac - * data is not very precise and is considered valid for up to several months. - * Please see the GLO ICD 5.1 "Chapter 4.5 Non-immediate information and - * almanac" for details. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - almanac_common_content_t common; /**< Values common for all almanac - types */ - double lambda_na; /**< Longitude of the first ascending node of the - orbit in PZ-90.02 coordinate system [rad] */ - double t_lambda_na; /**< Time of the first ascending node passage [s] */ - double i; /**< Value of inclination at instant of t_lambda [rad] */ - double t; /**< Value of Draconian period at instant of t_lambda [s/orbital - period] */ - double t_dot; /**< Rate of change of the Draconian period [s/(orbital - period^2)] */ - double epsilon; /**< Eccentricity at instant of t_lambda */ - double omega; /**< Argument of perigee at instant of t_lambda [rad] */ -} msg_almanac_glo_t; - -/** GLONASS L1/L2 Code-Phase biases - * - * The GLONASS L1/L2 Code-Phase biases allows to perform GPS+GLONASS integer - * ambiguity resolution for baselines with mixed receiver types (e.g. receiver - * of different manufacturers). - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 mask; /**< GLONASS FDMA signals mask [boolean] */ - s16 l1ca_bias; /**< GLONASS L1 C/A Code-Phase Bias [m * 0.02] */ - s16 l1p_bias; /**< GLONASS L1 P Code-Phase Bias [m * 0.02] */ - s16 l2ca_bias; /**< GLONASS L2 C/A Code-Phase Bias [m * 0.02] */ - s16 l2p_bias; /**< GLONASS L2 P Code-Phase Bias [m * 0.02] */ -} msg_glo_biases_t; - -/** Satellite azimuth and elevation - * - * Satellite azimuth and elevation. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - sbp_gnss_signal_t sid; /**< GNSS signal identifier */ - u8 az; /**< Azimuth angle (range 0..179) [deg * 2] */ - s8 el; /**< Elevation angle (range -90..90) [deg] */ -} sv_az_el_t; - -/** Satellite azimuths and elevations - * - * Azimuth and elevation angles of all the visible satellites that the device - * does have ephemeris or almanac for. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - sv_az_el_t azel[0]; /**< Azimuth and elevation per satellite */ -} msg_sv_az_el_t; - -/** OSR corrections - * - * The OSR message contains network corrections in an observation-like format. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - observation_header_t header; /**< Header of a GPS observation message */ - packed_osr_content_t obs[0]; /**< Network correction for a satellite - signal. */ -} msg_osr_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_OBSERVATION_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/orientation.h b/c/include/libsbp/legacy/orientation.h deleted file mode 100644 index 19573dceac..0000000000 --- a/c/include/libsbp/legacy/orientation.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/orientation.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup orientation Orientation - * - * Orientation Messages - * \{ */ - -#ifndef LIBSBP_LEGACY_ORIENTATION_MESSAGES_H -#define LIBSBP_LEGACY_ORIENTATION_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -/** Heading relative to True North - * - * This message reports the baseline heading pointing from the base station to - * the rover relative to True North. The full GPS time is given by the - * preceding MSG_GPS_TIME with the matching time-of-week (tow). It is intended - * that time-matched RTK mode is used when the base station is moving. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - u32 heading; /**< Heading [mdeg] */ - u8 n_sats; /**< Number of satellites used in solution */ - u8 flags; /**< Status flags */ -} msg_baseline_heading_t; - -/** Quaternion 4 component vector - * - * This message reports the quaternion vector describing the vehicle body - * frame's orientation with respect to a local-level NED frame. The components - * of the vector should sum to a unit vector assuming that the LSB of each - * component as a value of 2^-31. This message will only be available in - * future INS versions of Swift Products and is not produced by Piksi Multi or - * Duro. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 w; /**< Real component [2^-31] */ - s32 x; /**< 1st imaginary component [2^-31] */ - s32 y; /**< 2nd imaginary component [2^-31] */ - s32 z; /**< 3rd imaginary component [2^-31] */ - float w_accuracy; /**< Estimated standard deviation of w [N/A] */ - float x_accuracy; /**< Estimated standard deviation of x [N/A] */ - float y_accuracy; /**< Estimated standard deviation of y [N/A] */ - float z_accuracy; /**< Estimated standard deviation of z [N/A] */ - u8 flags; /**< Status flags */ -} msg_orient_quat_t; - -/** Euler angles - * - * This message reports the yaw, pitch, and roll angles of the vehicle body - * frame. The rotations should applied intrinsically in the order yaw, pitch, - * and roll in order to rotate the from a frame aligned with the local-level - * NED frame to the vehicle body frame. This message will only be available - * in future INS versions of Swift Products and is not produced by Piksi Multi - * or Duro. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 roll; /**< rotation about the forward axis of the vehicle [microdegrees] - */ - s32 pitch; /**< rotation about the rightward axis of the vehicle - [microdegrees] */ - s32 yaw; /**< rotation about the downward axis of the vehicle [microdegrees] - */ - float roll_accuracy; /**< Estimated standard deviation of roll [degrees] */ - float pitch_accuracy; /**< Estimated standard deviation of pitch [degrees] */ - float yaw_accuracy; /**< Estimated standard deviation of yaw [degrees] */ - u8 flags; /**< Status flags */ -} msg_orient_euler_t; - -/** Vehicle Body Frame instantaneous angular rates - * - * This message reports the orientation rates in the vehicle body frame. The - * values represent the measurements a strapped down gyroscope would make and - * are not equivalent to the time derivative of the Euler angles. The - * orientation and origin of the user frame is specified via device settings. - * By convention, the vehicle x-axis is expected to be aligned with the - * forward direction, while the vehicle y-axis is expected to be aligned with - * the right direction, and the vehicle z-axis should be aligned with the down - * direction. This message will only be available in future INS versions of - * Swift Products and is not produced by Piksi Multi or Duro. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - s32 x; /**< angular rate about x axis [microdegrees/s] */ - s32 y; /**< angular rate about y axis [microdegrees/s] */ - s32 z; /**< angular rate about z axis [microdegrees/s] */ - u8 flags; /**< Status flags */ -} msg_angular_rate_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_ORIENTATION_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/piksi.h b/c/include/libsbp/legacy/piksi.h deleted file mode 100644 index fbb947bf07..0000000000 --- a/c/include/libsbp/legacy/piksi.h +++ /dev/null @@ -1,392 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/piksi.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup piksi Piksi - * - * System health, configuration, and diagnostic messages specific to the Piksi - * L1 receiver, including a variety of legacy messages that may no longer be - * used. - * \{ */ - -#ifndef LIBSBP_LEGACY_PIKSI_MESSAGES_H -#define LIBSBP_LEGACY_PIKSI_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include -#include - -SBP_PACK_START - -/** Legacy message to load satellite almanac (host => Piksi) - * - * This is a legacy message for sending and loading a satellite alamanac onto - * the Piksi's flash memory from the host. - */ - -/** Send GPS time from host (host => Piksi) - * - * This message sets up timing functionality using a coarse GPS time estimate - * sent by the host. - */ - -/** Reset the device (host => Piksi) - * - * This message from the host resets the Piksi back into the bootloader. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 flags; /**< Reset flags */ -} msg_reset_t; - -/** Deprecated - * - * Deprecated. - */ - -/** Legacy message for CW interference channel (Piksi => host) - * - * This is an unused legacy message for result reporting from the CW - * interference channel on the SwiftNAP. This message will be removed in a - * future release. - */ - -/** Legacy message for CW interference channel (host => Piksi) - * - * This is an unused legacy message from the host for starting the CW - * interference channel on the SwiftNAP. This message will be removed in a - * future release. - */ - -/** Reset IAR filters (host => Piksi) - * - * This message resets either the DGNSS Kalman filters or Integer Ambiguity - * Resolution (IAR) process. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 filter; /**< Filter flags */ -} msg_reset_filters_t; - -/** Deprecated - * - * Deprecated. - */ - -/** State of an RTOS thread - * - * The thread usage message from the device reports real-time operating system - * (RTOS) thread usage statistics for the named thread. The reported - * percentage values must be normalized. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - char name[20]; /**< Thread name (NULL terminated) */ - u16 cpu; /**< Percentage cpu use for this thread. Values range - from 0 - 1000 and needs to be renormalized to 100 */ - u32 stack_free; /**< Free stack space for this thread [bytes] */ -} msg_thread_state_t; - -/** State of the UART channel - * - * Throughput, utilization, and error counts on the RX/TX buffers of this UART - * channel. The reported percentage values must be normalized. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - float tx_throughput; /**< UART transmit throughput [kB/s] */ - float rx_throughput; /**< UART receive throughput [kB/s] */ - u16 crc_error_count; /**< UART CRC error count */ - u16 io_error_count; /**< UART IO error count */ - u8 tx_buffer_level; /**< UART transmit buffer percentage utilization - (ranges from 0 to 255) */ - u8 rx_buffer_level; /**< UART receive buffer percentage utilization - (ranges from 0 to 255) */ -} uart_channel_t; - -/** base station observation message receipt period - * - * Statistics on the period of observations received from the base station. As - * complete observation sets are received, their time of reception is compared - * with the prior set''s time of reception. This measurement provides a proxy - * for link quality as incomplete or missing sets will increase the period. - * Long periods can cause momentary RTK solution outages. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - s32 avg; /**< Average period [ms] */ - s32 pmin; /**< Minimum period [ms] */ - s32 pmax; /**< Maximum period [ms] */ - s32 current; /**< Smoothed estimate of the current period [ms] */ -} period_t; - -/** Receiver-to-base station latency - * - * Statistics on the latency of observations received from the base station. - * As observation packets are received their GPS time is compared to the - * current GPS time calculated locally by the receiver to give a precise - * measurement of the end-to-end communication latency in the system. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - s32 avg; /**< Average latency [ms] */ - s32 lmin; /**< Minimum latency [ms] */ - s32 lmax; /**< Maximum latency [ms] */ - s32 current; /**< Smoothed estimate of the current latency [ms] */ -} latency_t; - -/** State of the UART channels - * - * The UART message reports data latency and throughput of the UART channels - * providing SBP I/O. On the default Piksi configuration, UARTs A and B are - * used for telemetry radios, but can also be host access ports for embedded - * hosts, or other interfaces in future. The reported percentage values must - * be normalized. Observations latency and period can be used to assess the - * health of the differential corrections link. Latency provides the - * timeliness of received base observations while the period indicates their - * likelihood of transmission. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - uart_channel_t uart_a; /**< State of UART A */ - uart_channel_t uart_b; /**< State of UART B */ - uart_channel_t uart_ftdi; /**< State of UART FTDI (USB logger) */ - latency_t latency; /**< UART communication latency */ - period_t obs_period; /**< Observation receipt period */ -} msg_uart_state_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - uart_channel_t uart_a; /**< State of UART A */ - uart_channel_t uart_b; /**< State of UART B */ - uart_channel_t uart_ftdi; /**< State of UART FTDI (USB logger) */ - latency_t latency; /**< UART communication latency */ -} msg_uart_state_depa_t; - -/** State of the Integer Ambiguity Resolution (IAR) process - * - * This message reports the state of the Integer Ambiguity Resolution (IAR) - * process, which resolves unknown integer ambiguities from double-differenced - * carrier-phase measurements from satellite observations. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 num_hyps; /**< Number of integer ambiguity hypotheses remaining */ -} msg_iar_state_t; - -/** Mask a satellite from use in Piksi subsystems - * - * This message allows setting a mask to prevent a particular satellite from - * being used in various Piksi subsystems. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 mask; /**< Mask of systems that should ignore this satellite. */ - sbp_gnss_signal_t sid; /**< GNSS signal for which the mask is applied */ -} msg_mask_satellite_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 mask; /**< Mask of systems that should ignore this satellite. */ - gnss_signal_dep_t sid; /**< GNSS signal for which the mask is applied */ -} msg_mask_satellite_dep_t; - -/** Device temperature and voltage levels - * - * This message contains temperature and voltage level measurements from the - * processor's monitoring system and the RF frontend die temperature if - * available. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - s16 dev_vin; /**< Device V_in [V / 1000] */ - s16 cpu_vint; /**< Processor V_int [V / 1000] */ - s16 cpu_vaux; /**< Processor V_aux [V / 1000] */ - s16 cpu_temperature; /**< Processor temperature [degrees C / 100] */ - s16 fe_temperature; /**< Frontend temperature (if available) [degrees C / 100] - */ -} msg_device_monitor_t; - -/** Execute a command (host => device) - * - * Request the recipient to execute an command. Output will be sent in MSG_LOG - * messages, and the exit code will be returned with MSG_COMMAND_RESP. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 sequence; /**< Sequence number */ - char command[0]; /**< Command line to execute */ -} msg_command_req_t; - -/** Exit code from executed command (device => host) - * - * The response to MSG_COMMAND_REQ with the return code of the command. A - * return code of zero indicates success. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 sequence; /**< Sequence number */ - s32 code; /**< Exit code */ -} msg_command_resp_t; - -/** Command output - * - * Returns the standard output and standard error of the command requested by - * MSG_COMMAND_REQ. The sequence number can be used to filter for filtering - * the correct command. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 sequence; /**< Sequence number */ - char line[0]; /**< Line of standard output or standard error */ -} msg_command_output_t; - -/** Request state of Piksi network interfaces - * - * Request state of Piksi network interfaces. Output will be sent in - * MSG_NETWORK_STATE_RESP messages. - */ - -/** State of network interface - * - * The state of a network interface on the Piksi. Data is made to reflect - * output of ifaddrs struct returned by getifaddrs in c. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 ipv4_address[4]; /**< IPv4 address (all zero when unavailable) */ - u8 ipv4_mask_size; /**< IPv4 netmask CIDR notation */ - u8 ipv6_address[16]; /**< IPv6 address (all zero when unavailable) */ - u8 ipv6_mask_size; /**< IPv6 netmask CIDR notation */ - u32 rx_bytes; /**< Number of Rx bytes */ - u32 tx_bytes; /**< Number of Tx bytes */ - char interface_name[16]; /**< Interface Name */ - u32 flags; /**< Interface flags from SIOCGIFFLAGS */ -} msg_network_state_resp_t; - -/** Bandwidth usage measurement for a single interface - * - * The bandwidth usage for each interface can be reported within this struct - * and utilize multiple fields to fully specify the type of traffic that is - * being tracked. As either the interval of collection or the collection time - * may vary, both a timestamp and period field is provided, though may not - * necessarily be populated with a value. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u64 duration; /**< Duration over which the measurement was - collected [ms] */ - u64 total_bytes; /**< Number of bytes handled in total within period */ - u32 rx_bytes; /**< Number of bytes transmitted within period */ - u32 tx_bytes; /**< Number of bytes received within period */ - char interface_name[16]; /**< Interface Name */ -} network_usage_t; - -/** Bandwidth usage reporting message - * - * The bandwidth usage, a list of usage by interface. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - network_usage_t interfaces[0]; /**< Usage measurement array */ -} msg_network_bandwidth_usage_t; - -/** Cell modem information update message - * - * If a cell modem is present on a piksi device, this message will be send - * periodically to update the host on the status of the modem and its various - * parameters. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - s8 signal_strength; /**< Received cell signal strength in dBm, zero - translates to unknown [dBm] */ - float signal_error_rate; /**< BER as reported by the modem, zero - translates to unknown */ - u8 reserved[0]; /**< Unspecified data TBD for this schema */ -} msg_cell_modem_status_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 channel_tag; /**< Channel ID */ - gps_time_dep_t t; /**< Receiver time of this observation */ - float freq_ref; /**< Reference frequency of this packet [MHz] */ - float freq_step; /**< Frequency step of points in this packet [MHz] */ - float amplitude_ref; /**< Reference amplitude of this packet [dB] */ - float - amplitude_unit; /**< Amplitude unit value of points in this packet [dB] */ - u8 amplitude_value[0]; /**< Amplitude values (in the above units) of points - in this packet */ -} msg_specan_dep_t; - -/** Spectrum analyzer - * - * Spectrum analyzer packet. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 channel_tag; /**< Channel ID */ - sbp_gps_time_t t; /**< Receiver time of this observation */ - float freq_ref; /**< Reference frequency of this packet [MHz] */ - float freq_step; /**< Frequency step of points in this packet [MHz] */ - float amplitude_ref; /**< Reference amplitude of this packet [dB] */ - float - amplitude_unit; /**< Amplitude unit value of points in this packet [dB] */ - u8 amplitude_value[0]; /**< Amplitude values (in the above units) of points - in this packet */ -} msg_specan_t; - -/** RF AGC status - * - * This message describes the gain of each channel in the receiver frontend. - * Each gain is encoded as a non-dimensional percentage relative to the - * maximum range possible for the gain stage of the frontend. By convention, - * each gain array has 8 entries and the index of the array corresponding to - * the index of the rf channel in the frontend. A gain of 127 percent encodes - * that rf channel is not present in the hardware. A negative value implies an - * error for the particular gain stage as reported by the frontend. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - s8 rf_gain[8]; /**< RF gain for each frontend channel [percent] */ - s8 if_gain[8]; /**< Intermediate frequency gain for each frontend channel - [percent] */ -} msg_front_end_gain_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_PIKSI_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/profiling.h b/c/include/libsbp/legacy/profiling.h deleted file mode 100644 index 624913e2ed..0000000000 --- a/c/include/libsbp/legacy/profiling.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/profiling.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup profiling Profiling - * - * Standardized profiling messages from Swift Navigation devices. - * \{ */ - -#ifndef LIBSBP_LEGACY_PROFILING_MESSAGES_H -#define LIBSBP_LEGACY_PROFILING_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -/** Profiling Measurement Point - * - * Tracks execution time of certain code paths in specially built products. - * This message should only be expected and processed on the direction of - * Swift's engineering teams. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 total_time; /**< Total time spent in measurement point - (microseconds) */ - u16 num_executions; /**< Number of times measurement point has executed */ - u32 min; /**< Minimum execution time (microseconds) */ - u32 max; /**< Maximum execution time (microseconds) */ - u64 return_addr; /**< Return address */ - u64 id; /**< Unique ID */ - u64 slice_time; /**< CPU slice time (milliseconds) */ - u16 line; /**< Line number */ - char func[0]; /**< Function name */ -} msg_measurement_point_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_PROFILING_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/sbas.h b/c/include/libsbp/legacy/sbas.h deleted file mode 100644 index 09768e6da5..0000000000 --- a/c/include/libsbp/legacy/sbas.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/sbas.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup sbas Sbas - * - * SBAS data - * \{ */ - -#ifndef LIBSBP_LEGACY_SBAS_MESSAGES_H -#define LIBSBP_LEGACY_SBAS_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include -#include - -SBP_PACK_START - -/** Raw SBAS data - * - * This message is sent once per second per SBAS satellite. ME checks the - * parity of the data block and sends only blocks that pass the check. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - sbp_gnss_signal_t sid; /**< GNSS signal identifier. */ - u32 tow; /**< GPS time-of-week at the start of the data block. [ms] */ - u8 message_type; /**< SBAS message type (0-63) */ - u8 data[27]; /**< Raw SBAS data field of 212 bits (last byte padded - with zeros). */ -} msg_sbas_raw_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_SBAS_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/settings.h b/c/include/libsbp/legacy/settings.h deleted file mode 100644 index 6534104aa9..0000000000 --- a/c/include/libsbp/legacy/settings.h +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/settings.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup settings Settings - * - * Messages for reading, writing, and discovering device settings. Settings - * with a "string" field have multiple values in this field delimited with a - * null character (the c style null terminator). For instance, when querying - * the 'firmware_version' setting in the 'system_info' section, the following - * array of characters needs to be sent for the string field in - * MSG_SETTINGS_READ: "system_info\0firmware_version\0", where the delimiting - * null characters are specified with the escape sequence '\0' and all - * quotation marks should be omitted. - * - * In the message descriptions below, the generic strings SECTION_SETTING and - * SETTING are used to refer to the two strings that comprise the identifier - * of an individual setting.In firmware_version example above, SECTION_SETTING - * is the 'system_info', and the SETTING portion is 'firmware_version'. - * See the "Software Settings Manual" on support.swiftnav.com for detailed - * documentation about all settings and sections available for each Swift - * firmware version. Settings manuals are available for each firmware version - * at the following link: [Piksi Multi - * Specifications](https://support.swiftnav.com/support/solutions/articles/44001850753-piksi-multi-specification). - * The latest settings document is also available at the following link: - * [Latest settings document](http://swiftnav.com/latest/piksi-multi-settings) - * . See lastly - * [settings.py](https://github.com/swift-nav/piksi_tools/blob/master/piksi_tools/settings.py) - * , the open source python command line utility for reading, writing, and - * saving settings in the piksi_tools repository on github as a helpful - * reference and example. - * \{ */ - -#ifndef LIBSBP_LEGACY_SETTINGS_MESSAGES_H -#define LIBSBP_LEGACY_SETTINGS_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -/** Save settings to flash (host => device) - * - * The save settings message persists the device's current settings - * configuration to its onboard flash memory file system. - */ - -/** Write device configuration settings (host => device) - * - * The setting message writes the device configuration for a particular - * setting via A NULL-terminated and NULL-delimited string with contents - * "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence denotes - * the NULL character and where quotation marks are omitted. A device will - * only process to this message when it is received from sender ID 0x42. An - * example string that could be sent to a device is - * "solution\0soln_freq\010\0". - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - char setting[0]; /**< A NULL-terminated and NULL-delimited string with - contents "SECTION_SETTING\0SETTING\0VALUE\0" */ -} msg_settings_write_t; - -/** Acknowledgement with status of MSG_SETTINGS_WRITE - * - * Return the status of a write request with the new value of the setting. If - * the requested value is rejected, the current value will be returned. The - * string field is a NULL-terminated and NULL-delimited string with contents - * "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence denotes - * the NULL character and where quotation marks are omitted. An example string - * that could be sent from device is "solution\0soln_freq\010\0". - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 status; /**< Write status */ - char setting[0]; /**< A NULL-terminated and delimited string with contents - "SECTION_SETTING\0SETTING\0VALUE\0" */ -} msg_settings_write_resp_t; - -/** Read device configuration settings (host => device) - * - * The setting message that reads the device configuration. The string field - * is a NULL-terminated and NULL-delimited string with contents - * "SECTION_SETTING\0SETTING\0" where the '\0' escape sequence denotes the - * NULL character and where quotation marks are omitted. An example string - * that could be sent to a device is "solution\0soln_freq\0". A device will - * only respond to this message when it is received from sender ID 0x42. A - * device should respond with a MSG_SETTINGS_READ_RESP message (msg_id - * 0x00A5). - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - char setting[0]; /**< A NULL-terminated and NULL-delimited string with - contents "SECTION_SETTING\0SETTING\0" */ -} msg_settings_read_req_t; - -/** Read device configuration settings (host <= device) - * - * The setting message with which the device responds after a - * MSG_SETTING_READ_REQ is sent to device. The string field is a NULL- - * terminated and NULL-delimited string with contents - * "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence denotes - * the NULL character and where quotation marks are omitted. An example string - * that could be sent from device is "solution\0soln_freq\010\0". - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - char setting[0]; /**< A NULL-terminated and NULL-delimited string with - contents "SECTION_SETTING\0SETTING\0VALUE\0" */ -} msg_settings_read_resp_t; - -/** Read setting by direct index (host => device) - * - * The settings message for iterating through the settings values. A device - * will respond to this message with a "MSG_SETTINGS_READ_BY_INDEX_RESP". - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 index; /**< An index into the device settings, with values ranging - from 0 to length(settings). */ -} msg_settings_read_by_index_req_t; - -/** Read setting by direct index (host <= device) - * - * The settings message that reports the value of a setting at an index. - * - * In the string field, it reports NULL-terminated and delimited string with - * contents "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0". where the '\0' - * escape sequence denotes the NULL character and where quotation marks are - * omitted. The FORMAT_TYPE field is optional and denotes possible string - * values of the setting as a hint to the user. If included, the format type - * portion of the string has the format "enum:value1,value2,value3". An - * example string that could be sent from the device is - * "simulator\0enabled\0True\0enum:True,False\0". - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 index; /**< An index into the device settings, with values ranging - from 0 to length(settings) */ - char setting[0]; /**< A NULL-terminated and delimited string with contents - "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0" */ -} msg_settings_read_by_index_resp_t; - -/** Finished reading settings (host <= device) - * - * The settings message for indicating end of the settings values. - */ - -/** Register setting and default value (device => host) - * - * This message registers the presence and default value of a setting with a - * settings daemon. The host should reply with MSG_SETTINGS_WRITE for this - * setting to set the initial value. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - char setting[0]; /**< A NULL-terminated and delimited string with contents - "SECTION_SETTING\0SETTING\0VALUE". */ -} msg_settings_register_t; - -/** Register setting and default value (device <= host) - * - * This message responds to setting registration with the effective value. The - * effective value shall differ from the given default value if setting was - * already registered or is available in the permanent setting storage and had - * a different value. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 status; /**< Register status */ - char setting[0]; /**< A NULL-terminated and delimited string with contents - "SECTION_SETTING\0SETTING\0VALUE". The meaning of - value is defined according to the status field. */ -} msg_settings_register_resp_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_SETTINGS_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/signing.h b/c/include/libsbp/legacy/signing.h deleted file mode 100644 index daf6809157..0000000000 --- a/c/include/libsbp/legacy/signing.h +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/signing.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup signing Signing - * - * Messages relating to signatures - * \{ */ - -#ifndef LIBSBP_LEGACY_SIGNING_MESSAGES_H -#define LIBSBP_LEGACY_SIGNING_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 year; /**< Year [year] */ - u8 month; /**< Month (range 1 .. 12) [months] */ - u8 day; /**< days in the month (range 1-31) [day] */ - u8 hours; /**< hours of day (range 0-23) [hours] */ - u8 minutes; /**< minutes of hour (range 0-59) [minutes] */ - u8 seconds; /**< seconds of minute (range 0-60) rounded down [seconds] */ - u32 ns; /**< nanoseconds of second (range 0-999999999) [nanoseconds] */ -} utc_time_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 len; /**< Number of bytes to use of the signature field. The DER - encoded signature has a maximum size of 72 bytes but can - vary between 70 and 72 bytes in length. */ - u8 data[72]; /**< DER encoded ECDSA signature for the messages using SHA-256 - as the digest algorithm. */ -} ecdsa_signature_t; - -/** An ECDSA certificate split over multiple messages - * - * A DER encoded x.509 ECDSA-256 certificate (using curve secp256r1). - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 n_msg; /**< Total number messages that make up the - certificate. The first nibble (mask 0xF0 or - left shifted by 4 bits) is the size of the - sequence (n), second nibble (mask 0x0F) is the - zero-indexed counter (ith packet of n). */ - u8 certificate_id[4]; /**< The last 4 bytes of the certificate's SHA-1 - fingerprint */ - u8 flags; - u8 certificate_bytes[0]; /**< DER encoded x.509 ECDSA certificate bytes */ -} msg_ecdsa_certificate_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 root_certificate[20]; /**< SHA-1 fingerprint of the root - certificate */ - u8 intermediate_certificate[20]; /**< SHA-1 fingerprint of the intermediate - certificate */ - u8 corrections_certificate[20]; /**< SHA-1 fingerprint of the corrections - certificate */ - utc_time_t expiration; /**< The time after which the - signature given is no longer - valid. Implementors should - consult a time source (such as - GNSS) to check if the current - time is later than the - expiration time, if the - condition is true, signatures - in the stream should not be - considered valid. */ - ecdsa_signature_t signature; /**< Signature (created by - the root certificate) - over the concatenation - of the SBP payload bytes - preceding this field. - That is, the - concatenation of - `root_certificate`, - `intermediate_certificate`, - `corrections_certificate` - and `expiration`. This - certificate chain (allow - list) can also be - validated by fetching it - from - `http(s)://certs.swiftnav.com/chain`. */ -} msg_certificate_chain_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 root_certificate[20]; /**< SHA-1 fingerprint of the root - certificate */ - u8 intermediate_certificate[20]; /**< SHA-1 fingerprint of the intermediate - certificate */ - u8 corrections_certificate[20]; /**< SHA-1 fingerprint of the corrections - certificate */ - utc_time_t expiration; /**< The certificate chain comprised - of three fingerprints: root - certificate, intermediate - certificate and corrections - certificate. */ - u8 signature[64]; /**< An ECDSA signature (created by the root - certificate) over the concatenation of - the SBP payload bytes preceding this - field. That is, the concatenation of - `root_certificate`, - `intermediate_certificate`, - `corrections_certificate` and - `expiration`. This certificate chain - (allow list) can also be validated by - fetching it from - `http(s)://certs.swiftnav.com/chain`. */ -} msg_certificate_chain_dep_t; - -/** An ECDSA signature - * - * An ECDSA-256 signature using SHA-256 as the message digest algorithm. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 flags; /**< Describes the format of the `signed\_messages` - field below. */ - u8 stream_counter; /**< Signature message counter. Zero indexed and - incremented with each signature message. The - counter will not increment if this message was - in response to an on demand request. The - counter will roll over after 256 messages. - Upon connection, the value of the counter may - not initially be zero. */ - u8 on_demand_counter; /**< On demand message counter. Zero indexed and - incremented with each signature message sent - in response to an on demand message. The - counter will roll over after 256 messages. - Upon connection, the value of the counter may - not initially be zero. */ - u8 certificate_id[4]; /**< The last 4 bytes of the certificate's SHA-1 - fingerprint */ - ecdsa_signature_t signature; /**< Signature over the frames of - this message group. */ - u8 signed_messages[0]; /**< CRCs of the messages covered by this - signature. For Skylark, which delivers SBP - messages wrapped in Swift's proprietary RTCM - message, these are the 24-bit CRCs from the - RTCM message framing. For SBP only streams, - this will be 16-bit CRCs from the SBP framing. - See the `flags` field to determine the type of - CRCs covered. */ -} msg_ecdsa_signature_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 flags; /**< Describes the format of the `signed\_messages` - field below. */ - u8 stream_counter; /**< Signature message counter. Zero indexed and - incremented with each signature message. The - counter will not increment if this message was - in response to an on demand request. The - counter will roll over after 256 messages. - Upon connection, the value of the counter may - not initially be zero. */ - u8 on_demand_counter; /**< On demand message counter. Zero indexed and - incremented with each signature message sent - in response to an on demand message. The - counter will roll over after 256 messages. - Upon connection, the value of the counter may - not initially be zero. */ - u8 certificate_id[4]; /**< The last 4 bytes of the certificate's SHA-1 - fingerprint */ - u8 n_signature_bytes; /**< Number of bytes to use of the signature field. - The DER encoded signature has a maximum size - of 72 bytes but can vary between 70 and 72 - bytes in length. */ - u8 signature[72]; /**< DER encoded ECDSA signature for the messages - using SHA-256 as the digest algorithm. */ - u8 signed_messages[0]; /**< CRCs of the messages covered by this - signature. For Skylark, which delivers SBP - messages wrapped in Swift's proprietary RTCM - message, these are the 24-bit CRCs from the - RTCM message framing. For SBP only streams, - this will be 16-bit CRCs from the SBP framing. - See the `flags` field to determine the type of - CRCs covered. */ -} msg_ecdsa_signature_dep_b_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 flags; /**< Describes the format of the `signed\_messages` - field below. */ - u8 stream_counter; /**< Signature message counter. Zero indexed and - incremented with each signature message. The - counter will not increment if this message was - in response to an on demand request. The - counter will roll over after 256 messages. - Upon connection, the value of the counter may - not initially be zero. */ - u8 on_demand_counter; /**< On demand message counter. Zero indexed and - incremented with each signature message sent - in response to an on demand message. The - counter will roll over after 256 messages. - Upon connection, the value of the counter may - not initially be zero. */ - u8 certificate_id[4]; /**< The last 4 bytes of the certificate's SHA-1 - fingerprint */ - u8 signature[64]; /**< ECDSA signature for the messages using SHA-256 - as the digest algorithm. */ - u8 signed_messages[0]; /**< CRCs of the messages covered by this - signature. For Skylark, which delivers SBP - messages wrapped in Swift's proprietary RTCM - message, these are the 24-bit CRCs from the - RTCM message framing. For SBP only streams, - this will be 16-bit CRCs from the SBP framing. - See the `flags` field to determine the type of - CRCs covered. */ -} msg_ecdsa_signature_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 n_msg; /**< Total number messages that make up the - certificate. First nibble is the size of the - sequence (n), second nibble is the zero- - indexed counter (ith packet of n) */ - u8 fingerprint[20]; /**< SHA-1 fingerprint of the associated - certificate. */ - u8 certificate_bytes[0]; /**< ED25519 certificate bytes. */ -} msg_ed25519_certificate_dep_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 signature[64]; /**< ED25519 signature for messages. */ - u8 fingerprint[20]; /**< SHA-1 fingerprint of the associated certificate. */ - u32 signed_messages[0]; /**< CRCs of signed messages. */ -} msg_ed25519_signature_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 stream_counter; /**< Signature message counter. Zero indexed and - incremented with each signature message. The - counter will not increment if this message was - in response to an on demand request. The - counter will roll over after 256 messages. - Upon connection, the value of the counter may - not initially be zero. */ - u8 on_demand_counter; /**< On demand message counter. Zero indexed and - incremented with each signature message sent - in response to an on demand message. The - counter will roll over after 256 messages. - Upon connection, the value of the counter may - not initially be zero. */ - u8 signature[64]; /**< ED25519 signature for messages. */ - u8 fingerprint[20]; /**< SHA-1 fingerprint of the associated - certificate. */ - u32 signed_messages[0]; /**< CRCs of signed messages. */ -} msg_ed25519_signature_dep_b_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_SIGNING_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/solution_meta.h b/c/include/libsbp/legacy/solution_meta.h deleted file mode 100644 index 43986fc143..0000000000 --- a/c/include/libsbp/legacy/solution_meta.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/solution_meta.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup solution_meta Solution_meta - * - * Standardized Metadata messages for Fuzed Solution from Swift Navigation - * devices. - * \{ */ - -#ifndef LIBSBP_LEGACY_SOLUTION_META_MESSAGES_H -#define LIBSBP_LEGACY_SOLUTION_META_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -/** Flags for a given solution input type - * - * Metadata describing which sensors were involved in the solution. The - * structure is fixed no matter what the actual sensor type is. The - * sensor_type field tells you which sensor we are talking about. It also - * tells you whether the sensor data was actually used or not. The flags - * field, always a u8, contains the sensor-specific data. The content of - * flags, for each sensor type, is described in the relevant structures in - * this section. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 sensor_type; /**< The type of sensor */ - u8 flags; /**< Refer to each InputType description [(XX)InputType] */ -} solution_input_type_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 pdop; /**< Position Dilution of Precision as per - last available DOPS from PVT engine - (0xFFFF indicates invalid) [0.01] */ - u16 hdop; /**< Horizontal Dilution of Precision as per - last available DOPS from PVT engine - (0xFFFF indicates invalid) [0.01] */ - u16 vdop; /**< Vertical Dilution of Precision as per - last available DOPS from PVT engine - (0xFFFF indicates invalid) [0.01] */ - u8 n_sats; /**< Number of satellites as per last - available solution from PVT engine */ - u16 age_corrections; /**< Age of corrections as per last available - AGE_CORRECTIONS from PVT engine (0xFFFF - indicates invalid) [deciseconds] */ - u8 alignment_status; /**< State of alignment and the status and - receipt of the alignment inputs */ - u32 last_used_gnss_pos_tow; /**< Tow of last-used GNSS position - measurement [ms] */ - u32 last_used_gnss_vel_tow; /**< Tow of last-used GNSS velocity - measurement [ms] */ - solution_input_type_t sol_in[0]; /**< Array of Metadata - describing the sensors - potentially involved - in the solution. Each - element in the array - represents a single - sensor type and - consists of flags - containing (meta)data - pertaining to that - specific single - sensor. Refer to each - (XX)InputType - descriptor in the - present doc. */ -} msg_soln_meta_dep_a_t; - -/** Solution Sensors Metadata - * - * This message contains all metadata about the sensors received and/or used - * in computing the sensorfusion solution. It focuses primarily, but not only, - * on GNSS metadata. Regarding the age of the last received valid GNSS - * solution, the highest two bits are time status, indicating whether age gnss - * can or can not be used to retrieve time of measurement (noted TOM, also - * known as time of validity) If it can, subtract 'age gnss' from 'tow' in - * navigation messages to get TOM. Can be used before alignment is complete in - * the Fusion Engine, when output solution is the last received valid GNSS - * solution and its tow is not a TOM. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS time of week rounded to the nearest - millisecond [ms] */ - u16 pdop; /**< Position Dilution of Precision as per last - available DOPS from PVT engine (0xFFFF - indicates invalid) [0.01] */ - u16 hdop; /**< Horizontal Dilution of Precision as per last - available DOPS from PVT engine (0xFFFF - indicates invalid) [0.01] */ - u16 vdop; /**< Vertical Dilution of Precision as per last - available DOPS from PVT engine (0xFFFF - indicates invalid) [0.01] */ - u16 age_corrections; /**< Age of corrections as per last available - AGE_CORRECTIONS from PVT engine (0xFFFF - indicates invalid) [deciseconds] */ - u32 age_gnss; /**< Age and Time Status of the last received valid - GNSS solution. [ms] */ - solution_input_type_t sol_in[0]; /**< Array of Metadata describing - the sensors potentially - involved in the solution. - Each element in the array - represents a single sensor - type and consists of flags - containing (meta)data - pertaining to that specific - single sensor. Refer to each - (XX)InputType descriptor in - the present doc. */ -} msg_soln_meta_t; - -/** Instruments the physical type of GNSS sensor input to the fuzed solution - * - * Metadata around the GNSS sensors involved in the fuzed solution. Accessible - * through sol_in[N].flags in a MSG_SOLN_META. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 flags; /**< flags that store all relevant info specific to this sensor - type. */ -} gnss_input_type_t; - -/** Provides detail about the IMU sensor, its timestamping mode, and its quality - for input to the fuzed solution - - * - * Metadata around the IMU sensors involved in the fuzed solution. Accessible - * through sol_in[N].flags in a MSG_SOLN_META. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 flags; /**< Instrument time, grade, and architecture for a sensor. */ -} imu_input_type_t; - -/** Provides detail about the Odometry sensor, its timestamping mode, and its - quality for input to the fuzed solution - - * - * Metadata around the Odometry sensors involved in the fuzed solution. - * Accessible through sol_in[N].flags in a MSG_SOLN_META. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 flags; /**< Instrument ODO rate, grade, and quality. */ -} odo_input_type_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_SOLUTION_META_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/ssr.h b/c/include/libsbp/legacy/ssr.h deleted file mode 100644 index 9fb2923ae6..0000000000 --- a/c/include/libsbp/legacy/ssr.h +++ /dev/null @@ -1,892 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/ssr.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup ssr Ssr - * - * Precise State Space Representation (SSR) corrections format - * \{ */ - -#ifndef LIBSBP_LEGACY_SSR_MESSAGES_H -#define LIBSBP_LEGACY_SSR_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include -#include - -SBP_PACK_START - -/** SSR code biases corrections for a particular satellite - * - * Code biases are to be added to pseudorange. The corrections conform with - * RTCMv3 MT 1059 / 1065. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 code; /**< Signal encoded following RTCM specifications (DF380, - DF381, DF382 and DF467). */ - s16 value; /**< Code bias value [0.01 m] */ -} code_biases_content_t; - -/** SSR phase biases corrections for a particular satellite - * - * Phase biases are to be added to carrier phase measurements. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 code; /**< Signal encoded following RTCM - specifications (DF380, DF381, DF382 - and DF467) */ - u8 integer_indicator; /**< Indicator for integer property */ - u8 widelane_integer_indicator; /**< Indicator for two groups of Wide- - Lane(s) integer property */ - u8 discontinuity_counter; /**< Signal phase discontinuity counter. - Increased for every discontinuity in - phase. */ - s32 bias; /**< Phase bias for specified signal [0.1 mm] */ -} phase_biases_content_t; - -/** Header for the MSG_SSR_STEC_CORRECTION message - * - * A full set of STEC information will likely span multiple SBP messages, - * since SBP message a limited to 255 bytes. The header is used to tie - * multiple SBP messages into a sequence. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 tile_set_id; /**< Unique identifier of the tile set this tile - belongs to. */ - u16 tile_id; /**< Unique identifier of this tile in the tile set. */ - gps_time_sec_t time; /**< GNSS reference time of the - correction */ - u8 num_msgs; /**< Number of messages in the dataset */ - u8 seq_num; /**< Position of this message in the dataset */ - u8 update_interval; /**< Update interval between consecutive corrections. - Encoded following RTCM DF391 specification. */ - u8 iod_atmo; /**< IOD of the SSR atmospheric correction */ -} stec_header_t; - -/** Header for the MSG_SSR_GRIDDED_CORRECTION message - * - * The LPP message contains nested variable length arrays which are not - * supported in SBP, so each grid point will be identified by the index. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 tile_set_id; /**< Unique identifier of the tile set this - tile belongs to. */ - u16 tile_id; /**< Unique identifier of this tile in the - tile set. */ - gps_time_sec_t time; /**< GNSS reference time of the - correction */ - u16 num_msgs; /**< Number of messages in the dataset */ - u16 seq_num; /**< Position of this message in the dataset */ - u8 update_interval; /**< Update interval between consecutive - corrections. Encoded following RTCM - DF391 specification. */ - u8 iod_atmo; /**< IOD of the SSR atmospheric correction */ - u8 tropo_quality_indicator; /**< Quality of the troposphere data. Encoded - following RTCM DF389 specification in - units of m. */ -} gridded_correction_header_t; - -/** None - * - * STEC polynomial for the given satellite. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - sv_id_t sv_id; /**< Unique space vehicle identifier */ - u8 stec_quality_indicator; /**< Quality of the STEC data. Encoded - following RTCM DF389 specification but in - units of TECU instead of m. */ - s16 stec_coeff[4]; /**< Coefficients of the STEC polynomial in - the order of C00, C01, C10, C11. C00 = - 0.05 TECU, C01/C10 = 0.02 TECU/deg, C11 - 0.02 TECU/deg^2 */ -} stec_sat_element_t; - -/** None - * - * Troposphere vertical delays at the grid point. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - s16 hydro; /**< Hydrostatic vertical delay [4 mm (add 2.3 m to get actual - vertical hydro delay)] */ - s8 wet; /**< Wet vertical delay [4 mm (add 0.252 m to get actual vertical wet - delay)] */ -} tropospheric_delay_correction_no_std_t; - -/** None - * - * Troposphere vertical delays (mean and standard deviation) at the grid - * point. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - s16 hydro; /**< Hydrostatic vertical delay. Add 2.3 m to get actual - value. [4 mm] */ - s8 wet; /**< Wet vertical delay. Add 0.252 m to get actual value. [4 mm] */ - u8 stddev; /**< Modified DF389. class 3 MSB, value 5 LSB. stddev = - (3^class * (1 + value/16) - 1) [mm] */ -} tropospheric_delay_correction_t; - -/** None - * - * STEC residual for the given satellite at the grid point. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - sv_id_t sv_id; /**< space vehicle identifier */ - s16 residual; /**< STEC residual [0.04 TECU] */ -} stec_residual_no_std_t; - -/** None - * - * STEC residual (mean and standard deviation) for the given satellite at the - * grid point. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - sv_id_t sv_id; /**< space vehicle identifier */ - s16 residual; /**< STEC residual [0.04 TECU] */ - u8 stddev; /**< Modified DF389. class 3 MSB, value 5 LSB. stddev = - (3^class * (1 + value/16) - 1) * 10 */ -} stec_residual_t; - -/** Precise orbit and clock correction - * - * The precise orbit and clock correction message is to be applied as a delta - * correction to broadcast ephemeris and is an equivalent to the 1060 /1066 - * RTCM message types. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_sec_t time; /**< GNSS reference time of the - correction */ - sbp_gnss_signal_t sid; /**< GNSS signal identifier (16 bit) */ - u8 update_interval; /**< Update interval between consecutive corrections. - Encoded following RTCM DF391 specification. */ - u8 iod_ssr; /**< IOD of the SSR correction. A change of Issue Of - Data SSR is used to indicate a change in the SSR - generating configuration */ - u32 iod; /**< Issue of broadcast ephemeris data or IODCRC - (Beidou) */ - s32 radial; /**< Orbit radial delta correction [0.1 mm] */ - s32 along; /**< Orbit along delta correction [0.4 mm] */ - s32 cross; /**< Orbit along delta correction [0.4 mm] */ - s32 dot_radial; /**< Velocity of orbit radial delta correction [0.001 mm/s] */ - s32 dot_along; /**< Velocity of orbit along delta correction [0.004 mm/s] */ - s32 dot_cross; /**< Velocity of orbit cross delta correction [0.004 mm/s] */ - s32 c0; /**< C0 polynomial coefficient for correction of - broadcast satellite clock [0.1 mm] */ - s32 c1; /**< C1 polynomial coefficient for correction of - broadcast satellite clock [0.001 mm/s] */ - s32 c2; /**< C2 polynomial coefficient for correction of - broadcast satellite clock [0.00002 mm/s^-2] */ -} msg_ssr_orbit_clock_t; - -/** Precise code biases correction - * - * The precise code biases message is to be added to the pseudorange of the - * corresponding signal to get corrected pseudorange. It is an equivalent to - * the 1059 / 1065 RTCM message types. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_sec_t time; /**< GNSS reference time of the - correction */ - sbp_gnss_signal_t sid; /**< GNSS signal identifier (16 bit) */ - u8 update_interval; /**< Update interval between consecutive corrections. - Encoded following RTCM DF391 specification. */ - u8 iod_ssr; /**< IOD of the SSR correction. A change of Issue Of - Data SSR is used to indicate a change in the SSR - generating configuration */ - code_biases_content_t biases[0]; /**< Code biases for the different - satellite signals */ -} msg_ssr_code_biases_t; - -/** Precise phase biases correction - * - * The precise phase biases message contains the biases to be added to the - * carrier phase of the corresponding signal to get corrected carrier phase - * measurement, as well as the satellite yaw angle to be applied to compute - * the phase wind-up correction. It is typically an equivalent to the 1265 - * RTCM message types. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_sec_t time; /**< GNSS reference time of the - correction */ - sbp_gnss_signal_t sid; /**< GNSS signal identifier (16 bit) */ - u8 update_interval; /**< Update interval between consecutive corrections. - Encoded following RTCM DF391 specification. */ - u8 iod_ssr; /**< IOD of the SSR correction. A change of Issue Of - Data SSR is used to indicate a change in the SSR - generating configuration */ - u8 dispersive_bias; /**< Indicator for the dispersive phase biases - property. */ - u8 mw_consistency; /**< Consistency indicator for Melbourne-Wubbena - linear combinations */ - u16 yaw; /**< Satellite yaw angle [1 / 256 semi-circle] */ - s8 yaw_rate; /**< Satellite yaw angle rate [1 / 8192 semi-circle / s] */ - phase_biases_content_t biases[0]; /**< Phase biases corrections for - a satellite being tracked. */ -} msg_ssr_phase_biases_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - stec_header_t header; /**< Header of a STEC polynomial coefficient - message. */ - stec_sat_element_t stec_sat_list[0]; /**< Array of STEC polynomial - coefficients for each space - vehicle. */ -} msg_ssr_stec_correction_dep_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_sec_t time; /**< GNSS reference time of the bound */ - u8 num_msgs; /**< Number of messages in the dataset */ - u8 seq_num; /**< Position of this message in the dataset */ - u8 update_interval; /**< Update interval between consecutive bounds. - Similar to RTCM DF391. */ - u8 sol_id; /**< SSR Solution ID. */ -} bounds_header_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - bounds_header_t header; /**< Header of a STEC correction with - bounds message. */ - u8 ssr_iod_atmo; /**< IOD of the SSR atmospheric correction */ - u16 tile_set_id; /**< Tile set ID */ - u16 tile_id; /**< Tile ID */ - u8 n_sats; /**< Number of satellites. */ - stec_sat_element_t stec_sat_list[0]; /**< Array of STEC polynomial - coefficients for each space - vehicle. */ -} msg_ssr_stec_correction_t; - -/** Gridded troposphere and STEC correction residuals - * - * STEC residuals are per space vehicle, troposphere is not. - * - * It is typically equivalent to the QZSS CLAS Sub Type 9 messages. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gridded_correction_header_t header; /**< Header of a - gridded - correction - message */ - u16 index; /**< Index of the grid point. */ - tropospheric_delay_correction_t tropo_delay_correction; /**< Wet and - hydrostatic - vertical - delays - (mean, - stddev). */ - stec_residual_t stec_residuals[0]; /**< STEC residuals for each - satellite (mean, stddev). */ -} msg_ssr_gridded_correction_t; - -/** None - * - * STEC polynomial and bounds for the given satellite. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - stec_residual_t stec_residual; /**< STEC residuals (mean, stddev) */ - u8 stec_bound_mu; /**< Error Bound Mean. See Note 1. [m] */ - u8 stec_bound_sig; /**< Error Bound StDev. See Note 1. [m] */ - u8 stec_bound_mu_dot; /**< Error Bound Mean First derivative. [0.00005 m/s] */ - u8 stec_bound_sig_dot; /**< Error Bound StDev First derivative. [0.00005 m/s] - */ -} stec_sat_element_integrity_t; - -/** Gridded troposhere and STEC correction residuals bounds - * - * Note 1: Range: 0-17.5 m. i<= 200, mean = 0.01i; 200230, mean=5+0.5(i-230). - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - bounds_header_t header; /**< Header of a bounds message. */ - u8 ssr_iod_atmo; /**< IOD of the correction. */ - u16 tile_set_id; /**< Set this tile belongs to. */ - u16 tile_id; /**< Unique identifier of this tile in the - tile set. */ - u8 tropo_qi; /**< Tropo Quality Indicator. Similar to RTCM - DF389. */ - u16 grid_point_id; /**< Index of the Grid Point. */ - tropospheric_delay_correction_t tropo_delay_correction; /**< Tropospheric - delay at - grid point. */ - u8 tropo_v_hydro_bound_mu; /**< Vertical Hydrostatic Error Bound Mean. [0.005 - m] */ - u8 tropo_v_hydro_bound_sig; /**< Vertical Hydrostatic Error Bound StDev. - [0.005 m] */ - u8 tropo_v_wet_bound_mu; /**< Vertical Wet Error Bound Mean. [0.005 m] */ - u8 tropo_v_wet_bound_sig; /**< Vertical Wet Error Bound StDev. [0.005 m] */ - u8 n_sats; /**< Number of satellites. */ - stec_sat_element_integrity_t stec_sat_list[0]; /**< Array of STEC - polynomial - coefficients - and its bounds - for each space - vehicle. */ -} msg_ssr_gridded_correction_bounds_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 tile_set_id; /**< Unique identifier of the tile set this tile - belongs to. */ - u16 tile_id; /**< Unique identifier of this tile in the tile set. - See GNSS-SSR-ArrayOfCorrectionPoints field - correctionPointSetID. */ - s16 corner_nw_lat; /**< North-West corner correction point latitude. - - The relation between the latitude X in the range - [-90, 90] and the coded number N is: - - N = floor((X / 90) * 2^14) - - See GNSS-SSR-ArrayOfCorrectionPoints field - referencePointLatitude. [encoded degrees] */ - s16 corner_nw_lon; /**< North-West corner correction point longitude. - - The relation between the longitude X in the range - [-180, 180] and the coded number N is: - - N = floor((X / 180) * 2^15) - - See GNSS-SSR-ArrayOfCorrectionPoints field - referencePointLongitude. [encoded degrees] */ - u16 spacing_lat; /**< Spacing of the correction points in the latitude - direction. - - See GNSS-SSR-ArrayOfCorrectionPoints field - stepOfLatitude. [0.01 degrees] */ - u16 spacing_lon; /**< Spacing of the correction points in the longitude - direction. - - See GNSS-SSR-ArrayOfCorrectionPoints field - stepOfLongitude. [0.01 degrees] */ - u16 rows; /**< Number of steps in the latitude direction. - - See GNSS-SSR-ArrayOfCorrectionPoints field - numberOfStepsLatitude. */ - u16 cols; /**< Number of steps in the longitude direction. - - See GNSS-SSR-ArrayOfCorrectionPoints field - numberOfStepsLongitude. */ - u64 bitmask; /**< Specifies the availability of correction data at - the correction points in the array. - - If a specific bit is enabled (set to 1), the - correction is not available. Only the first rows - * cols bits are used, the remainder are set to 0. - If there are more then 64 correction points the - remaining corrections are always available. - - Starting with the northwest corner of the array - (top left on a north oriented map) the correction - points are enumerated with row precedence - first - row west to east, second row west to east, until - last row west to east - ending with the southeast - corner of the array. - - See GNSS-SSR-ArrayOfCorrectionPoints field - bitmaskOfGrids but note the definition of the - bits is inverted. */ -} msg_ssr_tile_definition_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 ssr_sol_id; /**< SSR Solution ID. */ - u16 tile_set_id; /**< Unique identifier of the tile set this tile - belongs to. */ - u16 tile_id; /**< Unique identifier of this tile in the tile set. - See GNSS-SSR-ArrayOfCorrectionPoints field - correctionPointSetID. */ - s16 corner_nw_lat; /**< North-West corner correction point latitude. - - The relation between the latitude X in the range - [-90, 90] and the coded number N is: - - N = floor((X / 90) * 2^14) - - See GNSS-SSR-ArrayOfCorrectionPoints field - referencePointLatitude. [encoded degrees] */ - s16 corner_nw_lon; /**< North-West corner correction point longitude. - - The relation between the longitude X in the range - [-180, 180] and the coded number N is: - - N = floor((X / 180) * 2^15) - - See GNSS-SSR-ArrayOfCorrectionPoints field - referencePointLongitude. [encoded degrees] */ - u16 spacing_lat; /**< Spacing of the correction points in the latitude - direction. - - See GNSS-SSR-ArrayOfCorrectionPoints field - stepOfLatitude. [0.01 degrees] */ - u16 spacing_lon; /**< Spacing of the correction points in the longitude - direction. - - See GNSS-SSR-ArrayOfCorrectionPoints field - stepOfLongitude. [0.01 degrees] */ - u16 rows; /**< Number of steps in the latitude direction. - - See GNSS-SSR-ArrayOfCorrectionPoints field - numberOfStepsLatitude. */ - u16 cols; /**< Number of steps in the longitude direction. - - See GNSS-SSR-ArrayOfCorrectionPoints field - numberOfStepsLongitude. */ - u64 bitmask; /**< Specifies the availability of correction data at - the correction points in the array. - - If a specific bit is enabled (set to 1), the - correction is not available. Only the first rows - * cols bits are used, the remainder are set to 0. - If there are more then 64 correction points the - remaining corrections are always available. - - Starting with the northwest corner of the array - (top left on a north oriented map) the correction - points are enumerated with row precedence - first - row west to east, second row west to east, until - last row west to east - ending with the southeast - corner of the array. - - See GNSS-SSR-ArrayOfCorrectionPoints field - bitmaskOfGrids but note the definition of the - bits is inverted. */ -} msg_ssr_tile_definition_dep_b_t; - -/** Definition of a SSR atmospheric correction tile. - - * - * Provides the correction point coordinates for the atmospheric correction - * values in the MSG_SSR_STEC_CORRECTION and MSG_SSR_GRIDDED_CORRECTION - * messages. - * - * Based on ETSI TS 137 355 V16.1.0 (LTE Positioning Protocol) information - * element GNSS-SSR-CorrectionPoints. SBP only supports gridded arrays of - * correction points, not lists of points. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_sec_t time; /**< GNSS reference time of the - correction */ - u8 update_interval; /**< Update interval between consecutive corrections. - Encoded following RTCM DF391 specification. */ - u8 sol_id; /**< SSR Solution ID. Similar to RTCM DF415. */ - u8 iod_atmo; /**< IOD of the SSR atmospheric correction. */ - u16 tile_set_id; /**< Unique identifier of the tile set this tile - belongs to. */ - u16 tile_id; /**< Unique identifier of this tile in the tile set. - See GNSS-SSR-ArrayOfCorrectionPoints field - correctionPointSetID. */ - s16 corner_nw_lat; /**< North-West corner correction point latitude. - - The relation between the latitude X in the - range [-90, 90] and the coded number N is: N = - floor((X / 90) * 2^14) - - See GNSS-SSR-ArrayOfCorrectionPoints field - referencePointLatitude. [encoded degrees] */ - s16 corner_nw_lon; /**< North-West corner correction point longitude. - - The relation between the longitude X in the - range [-180, 180] and the coded number N is: N - = floor((X / 180) * 2^15) - - See GNSS-SSR-ArrayOfCorrectionPoints field - referencePointLongitude. [encoded degrees] */ - u16 spacing_lat; /**< Spacing of the correction points in the - latitude direction. - - See GNSS-SSR-ArrayOfCorrectionPoints field - stepOfLatitude. [0.01 degrees] */ - u16 spacing_lon; /**< Spacing of the correction points in the - longitude direction. - - See GNSS-SSR-ArrayOfCorrectionPoints field - stepOfLongitude. [0.01 degrees] */ - u16 rows; /**< Number of steps in the latitude direction. - - See GNSS-SSR-ArrayOfCorrectionPoints field - numberOfStepsLatitude. */ - u16 cols; /**< Number of steps in the longitude direction. - - See GNSS-SSR-ArrayOfCorrectionPoints field - numberOfStepsLongitude. */ - u64 bitmask; /**< Specifies the absence of correction data at the - correction points in the array (grid). - - Only the first rows * cols bits are used, and - if a specific bit is enabled (set to 1), the - correction is not available. If there are more - than 64 correction points the remaining - corrections are always available. - - The correction points are packed by rows, - starting with the northwest corner of the array - (top-left on a north oriented map), with each - row spanning west to east, ending with the - southeast corner of the array. - - See GNSS-SSR-ArrayOfCorrectionPoints field - bitmaskOfGrids but note the definition of the - bits is inverted. */ -} msg_ssr_tile_definition_t; - -/** Antenna phase center correction - * - * Contains phase center offset and elevation variation corrections for one - * signal on a satellite. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - sbp_gnss_signal_t sid; /**< GNSS signal identifier (16 bit) */ - u8 sat_info; /**< Additional satellite information */ - u16 svn; /**< Satellite Code, as defined by IGS. Typically the space - vehicle number. */ - s16 pco[3]; /**< Mean phase center offset, X Y and Z axes. See IGS - ANTEX file format description for coordinate system - definition. [1 mm] */ - s8 pcv[21]; /**< Elevation dependent phase center variations. First - element is 0 degrees separation from the Z axis, - subsequent elements represent elevation variations in 1 - degree increments. [1 mm] */ -} satellite_apc_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - satellite_apc_t apc[0]; /**< Satellite antenna phase center corrections */ -} msg_ssr_satellite_apc_dep_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_sec_t time; /**< GNSS reference time of the - correction */ - u8 update_interval; /**< Update interval between consecutive corrections. - Encoded following RTCM DF391 specification. */ - u8 sol_id; /**< SSR Solution ID. Similar to RTCM DF415. */ - u8 iod_ssr; /**< IOD of the SSR correction. A change of Issue Of - Data SSR is used to indicate a change in the SSR - generating configuration */ - satellite_apc_t apc[0]; /**< Satellite antenna phase center - corrections */ -} msg_ssr_satellite_apc_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_sec_t time; /**< GNSS reference time of the - correction */ - sbp_gnss_signal_t sid; /**< GNSS signal identifier (16 bit) */ - u8 update_interval; /**< Update interval between consecutive corrections. - Encoded following RTCM DF391 specification. */ - u8 iod_ssr; /**< IOD of the SSR correction. A change of Issue Of - Data SSR is used to indicate a change in the SSR - generating configuration */ - u8 iod; /**< Issue of broadcast ephemeris data */ - s32 radial; /**< Orbit radial delta correction [0.1 mm] */ - s32 along; /**< Orbit along delta correction [0.4 mm] */ - s32 cross; /**< Orbit along delta correction [0.4 mm] */ - s32 dot_radial; /**< Velocity of orbit radial delta correction [0.001 mm/s] */ - s32 dot_along; /**< Velocity of orbit along delta correction [0.004 mm/s] */ - s32 dot_cross; /**< Velocity of orbit cross delta correction [0.004 mm/s] */ - s32 c0; /**< C0 polynomial coefficient for correction of - broadcast satellite clock [0.1 mm] */ - s32 c1; /**< C1 polynomial coefficient for correction of - broadcast satellite clock [0.001 mm/s] */ - s32 c2; /**< C2 polynomial coefficient for correction of - broadcast satellite clock [0.00002 mm/s^-2] */ -} msg_ssr_orbit_clock_dep_a_t; - -/** Header for MSG_SSR_STEC_CORRECTION_DEP message - * - * A full set of STEC information will likely span multiple SBP messages, - * since SBP message a limited to 255 bytes. The header is used to tie - * multiple SBP messages into a sequence. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_sec_t time; /**< GNSS reference time of the - correction */ - u8 num_msgs; /**< Number of messages in the dataset */ - u8 seq_num; /**< Position of this message in the dataset */ - u8 update_interval; /**< Update interval between consecutive corrections. - Encoded following RTCM DF391 specification. */ - u8 iod_atmo; /**< IOD of the SSR atmospheric correction */ -} stec_header_dep_a_t; - -/** Header for MSG_SSR_GRIDDED_CORRECTION_DEP - * - * The 3GPP message contains nested variable length arrays which are not - * supported in SBP, so each grid point will be identified by the index. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gps_time_sec_t time; /**< GNSS reference time of the - correction */ - u16 num_msgs; /**< Number of messages in the dataset */ - u16 seq_num; /**< Position of this message in the dataset */ - u8 update_interval; /**< Update interval between consecutive - corrections. Encoded following RTCM - DF391 specification. */ - u8 iod_atmo; /**< IOD of the SSR atmospheric correction */ - u8 tropo_quality_indicator; /**< Quality of the troposphere data. Encoded - following RTCM DF389 specification in - units of m. */ -} gridded_correction_header_dep_a_t; - -/** Defines the grid for MSG_SSR_GRIDDED_CORRECTION messages - * - * Defines the grid for MSG_SSR_GRIDDED_CORRECTION messages. Also includes an - * RLE encoded validity list. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 region_size_inverse; /**< region_size (deg) = 10 / region_size_inverse - 0 is an invalid value. [inverse degrees] */ - u16 area_width; /**< grid height (deg) = grid width (deg) = - area_width / region_size 0 is an invalid - value. */ - u16 lat_nw_corner_enc; /**< North-West corner latitude (deg) = - region_size * lat_nw_corner_enc - 90 */ - u16 lon_nw_corner_enc; /**< North-West corner longitude (deg) = - region_size * lon_nw_corner_enc - 180 */ - u8 num_msgs; /**< Number of messages in the dataset */ - u8 seq_num; /**< Position of this message in the dataset */ -} grid_definition_header_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - stec_header_dep_a_t header; /**< Header of a STEC message */ - stec_sat_element_t stec_sat_list[0]; /**< Array of STEC information for each - space vehicle */ -} msg_ssr_stec_correction_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gridded_correction_header_dep_a_t header; /**< Header of - a Gridded - Correction - message */ - u16 index; /**< Index of the grid point */ - tropospheric_delay_correction_no_std_t - tropo_delay_correction; /**< Wet - and - hydrostatic - vertical - delays */ - stec_residual_no_std_t stec_residuals[0]; /**< STEC residuals for - each satellite */ -} msg_ssr_gridded_correction_no_std_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - gridded_correction_header_dep_a_t header; /**< Header of - a Gridded - Correction - message */ - u16 index; /**< Index of the grid point */ - tropospheric_delay_correction_t tropo_delay_correction; /**< Wet and - hydrostatic - vertical - delays - (mean, - stddev) */ - stec_residual_t stec_residuals[0]; /**< STEC residuals for each - satellite (mean, stddev) */ -} msg_ssr_gridded_correction_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - grid_definition_header_dep_a_t header; /**< Header of a Gridded - Correction message */ - u8 rle_list[0]; /**< Run Length Encode list of quadrants that contain valid - data. The spec describes the encoding scheme in detail, - but essentially the index of the quadrants that contain - transitions between valid and invalid (and vice versa) - are encoded as u8 integers. */ -} msg_ssr_grid_definition_dep_a_t; - -/** None - * - * Orbit and clock bound. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 sat_id; /**< Satellite ID. Similar to either RTCM DF068 - (GPS), DF252 (Galileo), or DF488 (BDS) - depending on the constellation. */ - u8 orb_radial_bound_mu; /**< Mean Radial. See Note 1. [m] */ - u8 orb_along_bound_mu; /**< Mean Along-Track. See Note 1. [m] */ - u8 orb_cross_bound_mu; /**< Mean Cross-Track. See Note 1. [m] */ - u8 orb_radial_bound_sig; /**< Standard Deviation Radial. See Note 2. [m] */ - u8 orb_along_bound_sig; /**< Standard Deviation Along-Track. See Note 2. [m] - */ - u8 orb_cross_bound_sig; /**< Standard Deviation Cross-Track. See Note 2. [m] - */ - u8 clock_bound_mu; /**< Clock Bound Mean. See Note 1. [m] */ - u8 clock_bound_sig; /**< Clock Bound Standard Deviation. See Note 2. [m] */ -} orbit_clock_bound_t; - -/** Combined Orbit and Clock Bound - * - * Note 1: Range: 0-17.5 m. i<=200, mean=0.01i; 200230, mean=5+0.5(i-230). - * - * Note 2: Range: 0-17.5 m. i<=200, std=0.01i; 200230, std=5+0.5(i-230). - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - bounds_header_t header; /**< Header of a bounds message. */ - u8 ssr_iod; /**< IOD of the SSR bound. */ - u8 const_id; /**< Constellation ID to which the SVs belong. */ - u8 n_sats; /**< Number of satellites. */ - orbit_clock_bound_t orbit_clock_bounds[0]; /**< Orbit and Clock Bounds per - Satellite */ -} msg_ssr_orbit_clock_bounds_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 sat_id; /**< Satellite ID. Similar to either RTCM DF068 - (GPS), DF252 (Galileo), or DF488 (BDS) - depending on the constellation. */ - u8 signal_id; /**< Signal and Tracking Mode Identifier. - Similar to either RTCM DF380 (GPS), DF382 - (Galileo) or DF467 (BDS) depending on the - constellation. */ - u8 code_bias_bound_mu; /**< Code Bias Mean. Range: 0-1.275 m [0.005 m] */ - u8 code_bias_bound_sig; /**< Code Bias Standard Deviation. Range: - 0-1.275 m [0.005 m] */ - u8 phase_bias_bound_mu; /**< Phase Bias Mean. Range: 0-1.275 m [0.005 m] */ - u8 phase_bias_bound_sig; /**< Phase Bias Standard Deviation. Range: - 0-1.275 m [0.005 m] */ -} code_phase_biases_sat_sig_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - bounds_header_t header; /**< Header of a bounds message. */ - u8 ssr_iod; /**< IOD of the SSR bound. */ - u8 const_id; /**< Constellation ID to which the SVs belong. */ - u8 n_sats_signals; /**< Number of satellite-signal couples. */ - code_phase_biases_sat_sig_t satellites_signals[0]; /**< Code and Phase - Biases Bounds per - Satellite-Signal - couple. */ -} msg_ssr_code_phase_biases_bounds_t; - -/** None - * - * Orbit and clock bound degradation. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 orb_radial_bound_mu_dot; /**< Orbit Bound Mean Radial First - derivative. Range: 0-0.255 m/s [0.001 m/s] */ - u8 orb_along_bound_mu_dot; /**< Orbit Bound Mean Along-Track First - derivative. Range: 0-0.255 m/s [0.001 m/s] */ - u8 orb_cross_bound_mu_dot; /**< Orbit Bound Mean Cross-Track First - derivative. Range: 0-0.255 m/s [0.001 m/s] */ - u8 orb_radial_bound_sig_dot; /**< Orbit Bound Standard Deviation Radial - First derivative. Range: 0-0.255 m/s [0.001 - m/s] */ - u8 orb_along_bound_sig_dot; /**< Orbit Bound Standard Deviation Along- - Track First derivative. Range: 0-0.255 - m/s [0.001 m/s] */ - u8 orb_cross_bound_sig_dot; /**< Orbit Bound Standard Deviation Cross- - Track First derivative. Range: 0-0.255 - m/s [0.001 m/s] */ - u8 clock_bound_mu_dot; /**< Clock Bound Mean First derivative. - Range: 0-0.255 m/s [0.001 m/s] */ - u8 clock_bound_sig_dot; /**< Clock Bound Standard Deviation First - derivative. Range: 0-0.255 m/s [0.001 m/s] */ -} orbit_clock_bound_degradation_t; - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - bounds_header_t header; /**< Header of a bounds - message. */ - u8 ssr_iod; /**< IOD of the SSR bound degradation - parameter. */ - u8 const_id; /**< Constellation ID to which the SVs - belong. */ - u64 sat_bitmask; /**< Satellite Bit Mask. Put 1 for - each satellite where the - following degradation parameters - are applicable, 0 otherwise. - Encoded following RTCM DF394 - specification. */ - orbit_clock_bound_degradation_t - orbit_clock_bounds_degradation; /**< Orbit - and - Clock - Bounds - Degradation - Parameters */ -} msg_ssr_orbit_clock_bounds_degradation_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_SSR_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/system.h b/c/include/libsbp/legacy/system.h deleted file mode 100644 index b5b3de63c2..0000000000 --- a/c/include/libsbp/legacy/system.h +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/system.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup system System - * - * Standardized system messages from Swift Navigation devices. - * \{ */ - -#ifndef LIBSBP_LEGACY_SYSTEM_MESSAGES_H -#define LIBSBP_LEGACY_SYSTEM_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -/** System start-up message - * - * The system start-up message is sent once on system start-up. It notifies - * the host or other attached devices that the system has started and is now - * ready to respond to commands or configuration requests. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 cause; /**< Cause of startup */ - u8 startup_type; /**< Startup type */ - u16 reserved; /**< Reserved */ -} msg_startup_t; - -/** Status of received corrections - * - * This message provides information about the receipt of Differential - * corrections. It is expected to be sent with each receipt of a complete - * corrections packet. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 flags; /**< Status flags */ - u16 latency; /**< Latency of observation receipt [deci-seconds] */ - u8 num_signals; /**< Number of signals from base station */ - char source[0]; /**< Corrections source string */ -} msg_dgnss_status_t; - -/** System heartbeat message - * - * The heartbeat message is sent periodically to inform the host or other - * attached devices that the system is running. It is used to monitor system - * malfunctions. It also contains status flags that indicate to the host the - * status of the system and whether it is operating correctly. Currently, the - * expected heartbeat interval is 1 sec. - * - * The system error flag is used to indicate that an error has occurred in the - * system. To determine the source of the error, the remaining error flags - * should be inspected. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 flags; /**< Status flags */ -} msg_heartbeat_t; - -/** Subsystem Status report - * - * Report the general and specific state of a subsystem. If the generic state - * is reported as initializing, the specific state should be ignored. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 component; /**< Identity of reporting subsystem */ - u8 generic; /**< Generic form status report */ - u8 specific; /**< Subsystem specific status code */ -} sub_system_report_t; - -/** Status report message - * - * The status report is sent periodically to inform the host or other attached - * devices that the system is running. It is used to monitor system - * malfunctions. It contains status reports that indicate to the host the - * status of each subsystem and whether it is operating correctly. - * - * Interpretation of the subsystem specific status code is product dependent, - * but if the generic status code is initializing, it should be ignored. - * Refer to product documentation for details. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 reporting_system; /**< Identity of reporting system */ - u16 sbp_version; /**< SBP protocol version */ - u32 sequence; /**< Increments on each status report sent */ - u32 uptime; /**< Number of seconds since system start-up */ - sub_system_report_t status[0]; /**< Reported status of individual - subsystems */ -} msg_status_report_t; - -/** Subsystem Status report - * - * Reports the uptime and the state of a subsystem via generic and specific - * status codes. If the generic state is reported as initializing, the - * specific state should be ignored. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 uptime; /**< Milliseconds since system startup */ - sub_system_report_t report; -} status_journal_item_t; - -/** Status report journal - * - * The status journal message contains past status reports (see - * MSG_STATUS_REPORT) and functions as a error/event storage for telemetry - * purposes. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 reporting_system; /**< Identity of reporting system */ - u16 sbp_version; /**< SBP protocol version */ - u32 total_status_reports; /**< Total number of status reports sent since - system startup */ - u8 sequence_descriptor; /**< Index and number of messages in this - sequence. First nibble is the size of the - sequence (n), second nibble is the zero- - indexed counter (ith packet of n) */ - status_journal_item_t journal[0]; /**< Status journal */ -} msg_status_journal_t; - -/** Inertial Navigation System status message - * - * The INS status message describes the state of the operation and - * initialization of the inertial navigation system. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 flags; /**< Status flags */ -} msg_ins_status_t; - -/** Experimental telemetry message - * - * The CSAC telemetry message has an implementation defined telemetry string - * from a device. It is not produced or available on general Swift Products. - * It is intended to be a low rate message for status purposes. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 id; /**< Index representing the type of telemetry in use. It - is implementation defined. */ - char telemetry[0]; /**< Comma separated list of values as defined by the - index */ -} msg_csac_telemetry_t; - -/** Experimental telemetry message labels - * - * The CSAC telemetry message provides labels for each member of the string - * produced by MSG_CSAC_TELEMETRY. It should be provided by a device at a - * lower rate than the MSG_CSAC_TELEMETRY. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 id; /**< Index representing the type of telemetry in - use. It is implementation defined. */ - char telemetry_labels[0]; /**< Comma separated list of telemetry field - values */ -} msg_csac_telemetry_labels_t; - -/** Inertial Navigation System update status message - * - * The INS update status message contains information about executed and - * rejected INS updates. This message is expected to be extended in the future - * as new types of measurements are being added. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< GPS Time of Week [ms] */ - u8 gnsspos; /**< GNSS position update status flags */ - u8 gnssvel; /**< GNSS velocity update status flags */ - u8 wheelticks; /**< Wheelticks update status flags */ - u8 speed; /**< Wheelticks update status flags */ - u8 nhc; /**< NHC update status flags */ - u8 zerovel; /**< Zero velocity update status flags */ -} msg_ins_updates_t; - -/** Offset of the local time with respect to GNSS time - * - * The GNSS time offset message contains the information that is needed to - * translate messages tagged with a local timestamp (e.g. IMU or wheeltick - * messages) to GNSS time for the sender producing this message. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - s16 weeks; /**< Weeks portion of the time offset [weeks] */ - s32 milliseconds; /**< Milliseconds portion of the time offset [ms] */ - s16 microseconds; /**< Microseconds portion of the time offset [microseconds] - */ - u8 flags; /**< Status flags (reserved) */ -} msg_gnss_time_offset_t; - -/** Local time at detection of PPS pulse - * - * The PPS time message contains the value of the sender's local time in - * microseconds at the moment a pulse is detected on the PPS input. This is to - * be used for synchronisation of sensor data sampled with a local timestamp - * (e.g. IMU or wheeltick messages) where GNSS time is unknown to the sender. - * - * The local time used to timestamp the PPS pulse must be generated by the - * same clock which is used to timestamp the IMU/wheel sensor data and should - * follow the same roll-over rules (i.e. it should roll over to zero after - * 604800 seconds). A separate MSG_PPS_TIME message should be sent for each - * source of sensor data which uses local timestamping. The sender ID for - * each of these MSG_PPS_TIME messages should match the sender ID of the - * respective sensor data. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u64 time; /**< Local time in microseconds [microseconds] */ - u8 flags; /**< Status flags */ -} msg_pps_time_t; - -/** Sensor state and update status data - * - * This diagnostic message contains state and update status information for - * all sensors that are being used by the fusion engine. This message will be - * generated asynchronously to the solution messages and will be emitted - * anytime a sensor update is being processed. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 time; /**< Update timestamp in milliseconds. [milliseconds] */ - u8 sensor_type; /**< Sensor type */ - u16 sensor_id; /**< Sensor identifier */ - u8 sensor_state; /**< Reserved for future use */ - u8 n_available_meas; /**< Number of available measurements in this epoch */ - u8 n_attempted_meas; /**< Number of attempted measurements in this epoch */ - u8 n_accepted_meas; /**< Number of accepted measurements in this epoch */ - u32 flags; /**< Reserved for future use */ -} msg_sensor_aid_event_t; - -/** Solution Group Metadata - * - * This leading message lists the time metadata of the Solution Group. It also - * lists the atomic contents (i.e. types of messages included) of the Solution - * Group. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 group_id; /**< Id of the Msgs Group, 0 is Unknown, 1 is Bestpos, 2 - is Gnss */ - u8 flags; /**< Status flags (reserved) */ - u8 n_group_msgs; /**< Size of list group_msgs */ - u16 group_msgs[0]; /**< An in-order list of message types included in the - Solution Group, including GROUP_META itself */ -} msg_group_meta_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_SYSTEM_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/telemetry.h b/c/include/libsbp/legacy/telemetry.h deleted file mode 100644 index 224dd0cbd6..0000000000 --- a/c/include/libsbp/legacy/telemetry.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/telemetry.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup telemetry Telemetry - * - * Telemetry messages reported by Starling engine. The messages include - * various byproducts of state estimation and other logic across Starling and - * are aimed at efficient issue diagnostics. - * \{ */ - -#ifndef LIBSBP_LEGACY_TELEMETRY_MESSAGES_H -#define LIBSBP_LEGACY_TELEMETRY_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include -#include - -SBP_PACK_START - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 az; /**< Azimuth angle (range 0..179) [deg * 2] */ - s8 el; /**< Elevation angle (range -90..90) [deg] */ - u8 availability_flags; /**< Observation availability at filter update */ - s16 pseudorange_residual; /**< Pseudorange observation residual [1 dm] */ - s16 phase_residual; /**< Carrier-phase or carrier-phase-derived - observation residual [5 mm] */ - u8 outlier_flags; /**< Reports if observation is marked as an - outlier and is excluded from the update */ - u8 ephemeris_flags; /**< Ephemeris metadata */ - u8 correction_flags; /**< Reserved */ - sbp_gnss_signal_t sid; /**< GNSS signal identifier (16 - bit) */ -} telemetry_sv_t; - -/** Per-signal telemetry - * - * This message includes telemetry pertinent to satellite signals available to - * Starling. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u16 wn; /**< GPS week number [weeks] */ - u32 tow; /**< GPS Time of Week [ms] */ - u8 n_obs; /**< Total number of observations. First nibble is the - size of the sequence (n), second nibble is the - zero-indexed counter (ith packet of n) */ - u8 origin_flags; /**< Flags to identify the filter type from which the - telemetry is reported from */ - telemetry_sv_t sv_tel[0]; /**< Array of per-signal telemetry entries */ -} msg_tel_sv_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_TELEMETRY_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/tracking.h b/c/include/libsbp/legacy/tracking.h deleted file mode 100644 index 1f9e34483a..0000000000 --- a/c/include/libsbp/legacy/tracking.h +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/tracking.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup tracking Tracking - * - * Satellite code and carrier-phase tracking messages from the device. - * \{ */ - -#ifndef LIBSBP_LEGACY_TRACKING_MESSAGES_H -#define LIBSBP_LEGACY_TRACKING_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include -#include - -SBP_PACK_START - -/** Detailed signal tracking channel states. DEPRECATED - * - * The tracking message returns a set tracking channel parameters for a single - * tracking channel useful for debugging issues. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u64 recv_time; /**< Receiver clock time. [ns] */ - sbp_gps_time_t tot; /**< Time of transmission of signal from - satellite. TOW only valid when TOW - status is decoded or propagated. WN - only valid when week number valid flag - is set. */ - u32 P; /**< Pseudorange observation. Valid only when - pseudorange valid flag is set. [2 cm] */ - u16 P_std; /**< Pseudorange observation standard deviation. Valid - only when pseudorange valid flag is set. [2 cm] */ - carrier_phase_t L; /**< Carrier phase observation with typical - sign convention. Valid only when PLL - pessimistic lock is achieved. [cycles] */ - u8 cn0; /**< Carrier-to-Noise density [dB Hz / 4] */ - u16 lock; /**< Lock time. It is encoded according to DF402 from - the RTCM 10403.2 Amendment 2 specification. Valid - values range from 0 to 15. */ - sbp_gnss_signal_t sid; /**< GNSS signal identifier. */ - s32 doppler; /**< Carrier Doppler frequency. [Hz / 16] */ - u16 doppler_std; /**< Carrier Doppler frequency standard deviation. [Hz / 16] - */ - u32 uptime; /**< Number of seconds of continuous tracking. - Specifies how much time signal is in continuous - track. [s] */ - s16 clock_offset; /**< TCXO clock offset. Valid only when valid clock - valid flag is set. [s / (2 ^ 20)] */ - s16 clock_drift; /**< TCXO clock drift. Valid only when valid clock - valid flag is set. [(s / s) / (2 ^ 31)] */ - u16 corr_spacing; /**< Early-Prompt (EP) and Prompt-Late (PL) correlators - spacing. [ns] */ - s8 acceleration; /**< Acceleration. Valid only when acceleration valid - flag is set. [g / 8] */ - u8 sync_flags; /**< Synchronization status flags. */ - u8 tow_flags; /**< TOW status flags. */ - u8 track_flags; /**< Tracking loop status flags. */ - u8 nav_flags; /**< Navigation data status flags. */ - u8 pset_flags; /**< Parameters sets flags. */ - u8 misc_flags; /**< Miscellaneous flags. */ -} msg_tracking_state_detailed_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u64 recv_time; /**< Receiver clock time. [ns] */ - gps_time_dep_t tot; /**< Time of transmission of signal from - satellite. TOW only valid when TOW - status is decoded or propagated. WN - only valid when week number valid flag - is set. */ - u32 P; /**< Pseudorange observation. Valid only when - pseudorange valid flag is set. [2 cm] */ - u16 P_std; /**< Pseudorange observation standard deviation. Valid - only when pseudorange valid flag is set. [2 cm] */ - carrier_phase_t L; /**< Carrier phase observation with typical - sign convention. Valid only when PLL - pessimistic lock is achieved. [cycles] */ - u8 cn0; /**< Carrier-to-Noise density [dB Hz / 4] */ - u16 lock; /**< Lock time. It is encoded according to DF402 from - the RTCM 10403.2 Amendment 2 specification. Valid - values range from 0 to 15. */ - gnss_signal_dep_t sid; /**< GNSS signal identifier. */ - s32 doppler; /**< Carrier Doppler frequency. [Hz / 16] */ - u16 doppler_std; /**< Carrier Doppler frequency standard deviation. [Hz / 16] - */ - u32 uptime; /**< Number of seconds of continuous tracking. - Specifies how much time signal is in continuous - track. [s] */ - s16 clock_offset; /**< TCXO clock offset. Valid only when valid clock - valid flag is set. [s / (2 ^ 20)] */ - s16 clock_drift; /**< TCXO clock drift. Valid only when valid clock - valid flag is set. [(s / s) / (2 ^ 31)] */ - u16 corr_spacing; /**< Early-Prompt (EP) and Prompt-Late (PL) correlators - spacing. [ns] */ - s8 acceleration; /**< Acceleration. Valid only when acceleration valid - flag is set. [g / 8] */ - u8 sync_flags; /**< Synchronization status flags. */ - u8 tow_flags; /**< TOW status flags. */ - u8 track_flags; /**< Tracking loop status flags. */ - u8 nav_flags; /**< Navigation data status flags. */ - u8 pset_flags; /**< Parameters sets flags. */ - u8 misc_flags; /**< Miscellaneous flags. */ -} msg_tracking_state_detailed_dep_t; - -/** Signal tracking channel state - * - * Tracking channel state for a specific satellite signal and measured signal - * power. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - sbp_gnss_signal_t sid; /**< GNSS signal being tracked */ - u8 fcn; /**< Frequency channel number (GLONASS only) */ - u8 cn0; /**< Carrier-to-Noise density. Zero implies invalid cn0. [dB Hz / 4] - */ -} tracking_channel_state_t; - -/** Signal tracking channel states - * - * The tracking message returns a variable-length array of tracking channel - * states. It reports status and carrier-to-noise density measurements for all - * tracked satellites. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - tracking_channel_state_t states[0]; /**< Signal tracking channel state */ -} msg_tracking_state_t; - -/** Measurement Engine signal tracking channel state - * - * Measurement Engine tracking channel state for a specific satellite signal - * and measured signal power. The mesid field for Glonass can either carry the - * FCN as 100 + FCN where FCN is in [-7, +6] or the Slot ID (from 1 to 28). - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - sbp_gnss_signal_t mesid; /**< Measurement Engine GNSS signal being - tracked (carries either Glonass FCN or - SLOT) */ - u8 cn0; /**< Carrier-to-Noise density. Zero implies invalid cn0. [dB Hz / 4] - */ -} measurement_state_t; - -/** Measurement Engine signal tracking channel states - * - * The tracking message returns a variable-length array of tracking channel - * states. It reports status and carrier-to-noise density measurements for all - * tracked satellites. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - measurement_state_t states[0]; /**< ME signal tracking channel state */ -} msg_measurement_state_t; - -/** Complex correlation structure - * - * Structure containing in-phase and quadrature correlation components. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - s16 I; /**< In-phase correlation */ - s16 Q; /**< Quadrature correlation */ -} tracking_channel_correlation_t; - -/** Tracking channel correlations - * - * When enabled, a tracking channel can output the correlations at each update - * interval. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 channel; /**< Tracking channel of origin */ - sbp_gnss_signal_t sid; /**< GNSS signal identifier */ - tracking_channel_correlation_t corrs[3]; /**< Early, Prompt and Late - correlations */ -} msg_tracking_iq_t; - -/** Complex correlation structure - * - * Structure containing in-phase and quadrature correlation components. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - s32 I; /**< In-phase correlation */ - s32 Q; /**< Quadrature correlation */ -} tracking_channel_correlation_dep_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 channel; /**< Tracking channel of origin */ - sbp_gnss_signal_t sid; /**< GNSS signal identifier */ - tracking_channel_correlation_dep_t corrs[3]; /**< Early, Prompt and Late - correlations */ -} msg_tracking_iq_dep_b_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 channel; /**< Tracking channel of origin */ - gnss_signal_dep_t sid; /**< GNSS signal identifier */ - tracking_channel_correlation_dep_t corrs[3]; /**< Early, Prompt and Late - correlations */ -} msg_tracking_iq_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 state; /**< Status of tracking channel */ - u8 prn; /**< PRN-1 being tracked */ - float cn0; /**< Carrier-to-noise density [dB Hz] */ -} tracking_channel_state_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - tracking_channel_state_dep_a_t states[0]; /**< Satellite tracking channel - state */ -} msg_tracking_state_dep_a_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 state; /**< Status of tracking channel */ - gnss_signal_dep_t sid; /**< GNSS signal being tracked */ - float cn0; /**< Carrier-to-noise density [dB Hz] */ -} tracking_channel_state_dep_b_t; - -/** Deprecated - * - * Deprecated. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - tracking_channel_state_dep_b_t - states[0]; /**< Signal tracking channel state */ -} msg_tracking_state_dep_b_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_TRACKING_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/user.h b/c/include/libsbp/legacy/user.h deleted file mode 100644 index ac33a5a50c..0000000000 --- a/c/include/libsbp/legacy/user.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/user.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup user User - * - * Messages reserved for use by the user. - * \{ */ - -#ifndef LIBSBP_LEGACY_USER_MESSAGES_H -#define LIBSBP_LEGACY_USER_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -/** User data - * - * This message can contain any application specific user data up to a maximum - * length of 255 bytes per message. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u8 contents[0]; /**< User data payload */ -} msg_user_data_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_USER_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/legacy/vehicle.h b/c/include/libsbp/legacy/vehicle.h deleted file mode 100644 index 6f8ec96b26..0000000000 --- a/c/include/libsbp/legacy/vehicle.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/swiftnav/sbp/vehicle.yaml - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup vehicle Vehicle - * - * Messages from a vehicle. - * \{ */ - -#ifndef LIBSBP_LEGACY_VEHICLE_MESSAGES_H -#define LIBSBP_LEGACY_VEHICLE_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols " - "contained will " - "be removed in version 6. You should immediately switch over to the modern " - "libsbp API.") - -#include - -SBP_PACK_START - -/** Vehicle forward (x-axis) velocity - * - * Message representing the x component of vehicle velocity in the user frame - * at the odometry reference point(s) specified by the user. The offset for - * the odometry reference point and the definition and origin of the user - * frame are defined through the device settings interface. There are 4 - * possible user-defined sources of this message which are labeled arbitrarily - * source 0 through 3. - * If using "processor time" time tags, the receiving end will expect either - * `MSG_GNSS_TIME_OFFSET` or `MSG_PPS_TIME` to sync incoming odometry data to - * GNSS time. Processor time shall roll over to zero after one week. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u32 tow; /**< Time field representing either milliseconds in the GPS - Week or local CPU time from the producing system in - milliseconds. See the tow_source flag for the exact - source of this timestamp. [ms] */ - s32 velocity; /**< The signed forward component of vehicle velocity. [mm/s] */ - u8 flags; /**< Status flags */ -} msg_odometry_t; - -/** Accumulated wheeltick count message - * - * Message containing the accumulated distance travelled by a wheel located at - * an odometry reference point defined by the user. The offset for the - * odometry reference point and the definition and origin of the user frame - * are defined through the device settings interface. The source of this - * message is identified by the source field, which is an integer ranging from - * 0 to 255. The timestamp associated with this message should represent the - * time when the accumulated tick count reached the value given by the - * contents of this message as accurately as possible. If using "local CPU - * time" time tags, the receiving end will also expect either - * `MSG_GNSS_TIME_OFFSET` or `MSG_PPS_TIME` to sync incoming wheeltick data to - * GNSS time. - * Local CPU time shall roll over to zero after one week. - */ - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - u64 time; /**< Time field representing either microseconds since the - last PPS, microseconds in the GPS Week or local CPU time - from the producing system in microseconds. See the - synch_type field for the exact meaning of this - timestamp. [us] */ - u8 flags; /**< Field indicating the type of timestamp contained in the - time field. */ - u8 source; /**< ID of the sensor producing this message */ - s32 ticks; /**< Free-running counter of the accumulated distance for - this sensor. The counter should be incrementing if - travelling into one direction and decrementing when - travelling in the opposite direction. [arbitrary distance - units] */ -} msg_wheeltick_t; - -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_VEHICLE_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/linux_macros.h b/c/include/libsbp/linux_macros.h index fd3308e643..54f69928a0 100644 --- a/c/include/libsbp/linux_macros.h +++ b/c/include/libsbp/linux_macros.h @@ -18,205 +18,171 @@ #ifndef LIBSBP_LINUX_MACROS_H #define LIBSBP_LINUX_MACROS_H -#define SBP_MSG_LINUX_CPU_STATE_DEP_A 0x7F00 /** * The maximum number of items that can be stored in - * sbp_msg_linux_cpu_state_dep_a_t::tname (V4 API) or - * msg_linux_cpu_state_dep_a_t::tname (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_linux_cpu_state_dep_a_t::tname before the maximum SBP message size is + * exceeded */ #define SBP_MSG_LINUX_CPU_STATE_DEP_A_TNAME_MAX 15u /** * The maximum number of items that can be stored in - * sbp_msg_linux_cpu_state_dep_a_t::cmdline (V4 API) or - * msg_linux_cpu_state_dep_a_t::cmdline (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_linux_cpu_state_dep_a_t::cmdline before the maximum SBP message size + * is exceeded */ #define SBP_MSG_LINUX_CPU_STATE_DEP_A_CMDLINE_MAX 236u /** - * Encoded length of sbp_msg_linux_cpu_state_dep_a_t (V4 API) and - * msg_linux_cpu_state_dep_a_t (legacy API) + * Encoded length of sbp_msg_linux_cpu_state_dep_a_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_linux_cpu_state_dep_a_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_LINUX_CPU_STATE_DEP_A_ENCODED_OVERHEAD 19u -#define SBP_MSG_LINUX_MEM_STATE_DEP_A 0x7F01 /** * The maximum number of items that can be stored in - * sbp_msg_linux_mem_state_dep_a_t::tname (V4 API) or - * msg_linux_mem_state_dep_a_t::tname (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_linux_mem_state_dep_a_t::tname before the maximum SBP message size is + * exceeded */ #define SBP_MSG_LINUX_MEM_STATE_DEP_A_TNAME_MAX 15u /** * The maximum number of items that can be stored in - * sbp_msg_linux_mem_state_dep_a_t::cmdline (V4 API) or - * msg_linux_mem_state_dep_a_t::cmdline (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_linux_mem_state_dep_a_t::cmdline before the maximum SBP message size + * is exceeded */ #define SBP_MSG_LINUX_MEM_STATE_DEP_A_CMDLINE_MAX 236u /** - * Encoded length of sbp_msg_linux_mem_state_dep_a_t (V4 API) and - * msg_linux_mem_state_dep_a_t (legacy API) + * Encoded length of sbp_msg_linux_mem_state_dep_a_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_linux_mem_state_dep_a_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_LINUX_MEM_STATE_DEP_A_ENCODED_OVERHEAD 19u -#define SBP_MSG_LINUX_SYS_STATE_DEP_A 0x7F02 /** - * Encoded length of sbp_msg_linux_sys_state_dep_a_t (V4 API) and - * msg_linux_sys_state_dep_a_t (legacy API) + * Encoded length of sbp_msg_linux_sys_state_dep_a_t (V4 API) */ #define SBP_MSG_LINUX_SYS_STATE_DEP_A_ENCODED_LEN 10u -#define SBP_MSG_LINUX_PROCESS_SOCKET_COUNTS 0x7F03 /** * The maximum number of items that can be stored in - * sbp_msg_linux_process_socket_counts_t::cmdline (V4 API) or - * msg_linux_process_socket_counts_t::cmdline (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_linux_process_socket_counts_t::cmdline before the maximum SBP message + * size is exceeded */ #define SBP_MSG_LINUX_PROCESS_SOCKET_COUNTS_CMDLINE_MAX 246u /** - * Encoded length of sbp_msg_linux_process_socket_counts_t (V4 API) and - * msg_linux_process_socket_counts_t (legacy API) + * Encoded length of sbp_msg_linux_process_socket_counts_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_linux_process_socket_counts_encoded_len to determine the actual size - * of an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * of an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_LINUX_PROCESS_SOCKET_COUNTS_ENCODED_OVERHEAD 9u -#define SBP_MSG_LINUX_PROCESS_SOCKET_QUEUES 0x7F04 /** * The maximum number of items that can be stored in - * sbp_msg_linux_process_socket_queues_t::address_of_largest (V4 API) or - * msg_linux_process_socket_queues_t::address_of_largest (legacy API) before the - * maximum SBP message size is exceeded + * sbp_msg_linux_process_socket_queues_t::address_of_largest before the maximum + * SBP message size is exceeded */ #define SBP_MSG_LINUX_PROCESS_SOCKET_QUEUES_ADDRESS_OF_LARGEST_MAX 64u /** * The maximum number of items that can be stored in - * sbp_msg_linux_process_socket_queues_t::cmdline (V4 API) or - * msg_linux_process_socket_queues_t::cmdline (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_linux_process_socket_queues_t::cmdline before the maximum SBP message + * size is exceeded */ #define SBP_MSG_LINUX_PROCESS_SOCKET_QUEUES_CMDLINE_MAX 180u /** - * Encoded length of sbp_msg_linux_process_socket_queues_t (V4 API) and - * msg_linux_process_socket_queues_t (legacy API) + * Encoded length of sbp_msg_linux_process_socket_queues_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_linux_process_socket_queues_encoded_len to determine the actual size - * of an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * of an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_LINUX_PROCESS_SOCKET_QUEUES_ENCODED_OVERHEAD 75u -#define SBP_MSG_LINUX_SOCKET_USAGE 0x7F05 /** * The maximum number of items that can be stored in - * sbp_msg_linux_socket_usage_t::socket_state_counts (V4 API) or - * msg_linux_socket_usage_t::socket_state_counts (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_linux_socket_usage_t::socket_state_counts before the maximum SBP + * message size is exceeded */ #define SBP_MSG_LINUX_SOCKET_USAGE_SOCKET_STATE_COUNTS_MAX 16u /** * The maximum number of items that can be stored in - * sbp_msg_linux_socket_usage_t::socket_type_counts (V4 API) or - * msg_linux_socket_usage_t::socket_type_counts (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_linux_socket_usage_t::socket_type_counts before the maximum SBP + * message size is exceeded */ #define SBP_MSG_LINUX_SOCKET_USAGE_SOCKET_TYPE_COUNTS_MAX 16u /** - * Encoded length of sbp_msg_linux_socket_usage_t (V4 API) and - * msg_linux_socket_usage_t (legacy API) + * Encoded length of sbp_msg_linux_socket_usage_t (V4 API) */ #define SBP_MSG_LINUX_SOCKET_USAGE_ENCODED_LEN 72u -#define SBP_MSG_LINUX_PROCESS_FD_COUNT 0x7F06 /** * The maximum number of items that can be stored in - * sbp_msg_linux_process_fd_count_t::cmdline (V4 API) or - * msg_linux_process_fd_count_t::cmdline (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_linux_process_fd_count_t::cmdline before the maximum SBP message size + * is exceeded */ #define SBP_MSG_LINUX_PROCESS_FD_COUNT_CMDLINE_MAX 250u /** - * Encoded length of sbp_msg_linux_process_fd_count_t (V4 API) and - * msg_linux_process_fd_count_t (legacy API) + * Encoded length of sbp_msg_linux_process_fd_count_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_linux_process_fd_count_encoded_len to determine the actual size of - * an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_LINUX_PROCESS_FD_COUNT_ENCODED_OVERHEAD 5u -#define SBP_MSG_LINUX_PROCESS_FD_SUMMARY 0x7F07 /** * The maximum number of items that can be stored in - * sbp_msg_linux_process_fd_summary_t::most_opened (V4 API) or - * msg_linux_process_fd_summary_t::most_opened (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_linux_process_fd_summary_t::most_opened before the maximum SBP + * message size is exceeded */ #define SBP_MSG_LINUX_PROCESS_FD_SUMMARY_MOST_OPENED_MAX 251u /** - * Encoded length of sbp_msg_linux_process_fd_summary_t (V4 API) and - * msg_linux_process_fd_summary_t (legacy API) + * Encoded length of sbp_msg_linux_process_fd_summary_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_linux_process_fd_summary_encoded_len to determine the actual size of - * an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_LINUX_PROCESS_FD_SUMMARY_ENCODED_OVERHEAD 4u -#define SBP_MSG_LINUX_CPU_STATE 0x7F08 #define SBP_LINUX_CPU_STATE_TIMESTAMP_TYPE_MASK (0x7u) #define SBP_LINUX_CPU_STATE_TIMESTAMP_TYPE_SHIFT (0u) #define SBP_LINUX_CPU_STATE_TIMESTAMP_TYPE_GET(flags) \ @@ -235,34 +201,31 @@ #define SBP_LINUX_CPU_STATE_TIMESTAMP_TYPE_GPS_TOW_IN_MILLISECONDS (1) /** * The maximum number of items that can be stored in - * sbp_msg_linux_cpu_state_t::tname (V4 API) or msg_linux_cpu_state_t::tname - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_linux_cpu_state_t::tname before the maximum SBP message size is + * exceeded */ #define SBP_MSG_LINUX_CPU_STATE_TNAME_MAX 15u /** * The maximum number of items that can be stored in - * sbp_msg_linux_cpu_state_t::cmdline (V4 API) or msg_linux_cpu_state_t::cmdline - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_linux_cpu_state_t::cmdline before the maximum SBP message size is + * exceeded */ #define SBP_MSG_LINUX_CPU_STATE_CMDLINE_MAX 231u /** - * Encoded length of sbp_msg_linux_cpu_state_t (V4 API) and - * msg_linux_cpu_state_t (legacy API) + * Encoded length of sbp_msg_linux_cpu_state_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_linux_cpu_state_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_LINUX_CPU_STATE_ENCODED_OVERHEAD 24u -#define SBP_MSG_LINUX_MEM_STATE 0x7F09 #define SBP_LINUX_MEM_STATE_TIMESTAMP_TYPE_MASK (0x7u) #define SBP_LINUX_MEM_STATE_TIMESTAMP_TYPE_SHIFT (0u) #define SBP_LINUX_MEM_STATE_TIMESTAMP_TYPE_GET(flags) \ @@ -281,34 +244,31 @@ #define SBP_LINUX_MEM_STATE_TIMESTAMP_TYPE_GPS_TOW_IN_MILLISECONDS (1) /** * The maximum number of items that can be stored in - * sbp_msg_linux_mem_state_t::tname (V4 API) or msg_linux_mem_state_t::tname - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_linux_mem_state_t::tname before the maximum SBP message size is + * exceeded */ #define SBP_MSG_LINUX_MEM_STATE_TNAME_MAX 15u /** * The maximum number of items that can be stored in - * sbp_msg_linux_mem_state_t::cmdline (V4 API) or msg_linux_mem_state_t::cmdline - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_linux_mem_state_t::cmdline before the maximum SBP message size is + * exceeded */ #define SBP_MSG_LINUX_MEM_STATE_CMDLINE_MAX 231u /** - * Encoded length of sbp_msg_linux_mem_state_t (V4 API) and - * msg_linux_mem_state_t (legacy API) + * Encoded length of sbp_msg_linux_mem_state_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_linux_mem_state_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_LINUX_MEM_STATE_ENCODED_OVERHEAD 24u -#define SBP_MSG_LINUX_SYS_STATE 0x7F0A #define SBP_LINUX_SYS_STATE_TIMESTAMP_TYPE_MASK (0x7u) #define SBP_LINUX_SYS_STATE_TIMESTAMP_TYPE_SHIFT (0u) #define SBP_LINUX_SYS_STATE_TIMESTAMP_TYPE_GET(flags) \ @@ -326,8 +286,7 @@ #define SBP_LINUX_SYS_STATE_TIMESTAMP_TYPE_SYSTEM_TIME_IN_SECONDS (0) #define SBP_LINUX_SYS_STATE_TIMESTAMP_TYPE_GPS_TOW_IN_MILLISECONDS (1) /** - * Encoded length of sbp_msg_linux_sys_state_t (V4 API) and - * msg_linux_sys_state_t (legacy API) + * Encoded length of sbp_msg_linux_sys_state_t (V4 API) */ #define SBP_MSG_LINUX_SYS_STATE_ENCODED_LEN 15u diff --git a/c/include/libsbp/logging_macros.h b/c/include/libsbp/logging_macros.h index 66791cb801..faf5345ab6 100644 --- a/c/include/libsbp/logging_macros.h +++ b/c/include/libsbp/logging_macros.h @@ -18,7 +18,6 @@ #ifndef LIBSBP_LOGGING_MACROS_H #define LIBSBP_LOGGING_MACROS_H -#define SBP_MSG_LOG 0x0401 #define SBP_LOG_LOGGING_LEVEL_MASK (0x7u) #define SBP_LOG_LOGGING_LEVEL_SHIFT (0u) #define SBP_LOG_LOGGING_LEVEL_GET(flags) \ @@ -41,67 +40,56 @@ #define SBP_LOG_LOGGING_LEVEL_INFO (6) #define SBP_LOG_LOGGING_LEVEL_DEBUG (7) /** - * The maximum number of items that can be stored in sbp_msg_log_t::text (V4 - * API) or msg_log_t::text (legacy API) before the maximum SBP message size is - * exceeded + * The maximum number of items that can be stored in sbp_msg_log_t::text before + * the maximum SBP message size is exceeded */ #define SBP_MSG_LOG_TEXT_MAX 254u /** - * Encoded length of sbp_msg_log_t (V4 API) and - * msg_log_t (legacy API) + * Encoded length of sbp_msg_log_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_log_encoded_len to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_LOG_ENCODED_OVERHEAD 1u -#define SBP_MSG_FWD 0x0402 /** * The maximum number of items that can be stored in sbp_msg_fwd_t::fwd_payload - * (V4 API) or msg_fwd_t::fwd_payload (legacy API) before the maximum SBP - * message size is exceeded + * before the maximum SBP message size is exceeded */ #define SBP_MSG_FWD_FWD_PAYLOAD_MAX 253u /** - * Encoded length of sbp_msg_fwd_t (V4 API) and - * msg_fwd_t (legacy API) + * Encoded length of sbp_msg_fwd_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_fwd_encoded_len to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_FWD_ENCODED_OVERHEAD 2u -#define SBP_MSG_PRINT_DEP 0x0010 /** * The maximum number of items that can be stored in sbp_msg_print_dep_t::text - * (V4 API) or msg_print_dep_t::text (legacy API) before the maximum SBP message - * size is exceeded + * before the maximum SBP message size is exceeded */ #define SBP_MSG_PRINT_DEP_TEXT_MAX 255u /** - * Encoded length of sbp_msg_print_dep_t (V4 API) and - * msg_print_dep_t (legacy API) + * Encoded length of sbp_msg_print_dep_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_print_dep_encoded_len to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) diff --git a/c/include/libsbp/mag_macros.h b/c/include/libsbp/mag_macros.h index 12e382bf7b..9cdf5059fb 100644 --- a/c/include/libsbp/mag_macros.h +++ b/c/include/libsbp/mag_macros.h @@ -18,10 +18,8 @@ #ifndef LIBSBP_MAG_MACROS_H #define LIBSBP_MAG_MACROS_H -#define SBP_MSG_MAG_RAW 0x0902 /** - * Encoded length of sbp_msg_mag_raw_t (V4 API) and - * msg_mag_raw_t (legacy API) + * Encoded length of sbp_msg_mag_raw_t (V4 API) */ #define SBP_MSG_MAG_RAW_ENCODED_LEN 11u diff --git a/c/include/libsbp/navigation_macros.h b/c/include/libsbp/navigation_macros.h index 35b5e131cf..4d026ede1c 100644 --- a/c/include/libsbp/navigation_macros.h +++ b/c/include/libsbp/navigation_macros.h @@ -18,7 +18,6 @@ #ifndef LIBSBP_NAVIGATION_MACROS_H #define LIBSBP_NAVIGATION_MACROS_H -#define SBP_MSG_GPS_TIME 0x0102 #define SBP_GPS_TIME_TIME_SOURCE_MASK (0x7u) #define SBP_GPS_TIME_TIME_SOURCE_SHIFT (0u) #define SBP_GPS_TIME_TIME_SOURCE_GET(flags) \ @@ -36,12 +35,10 @@ #define SBP_GPS_TIME_TIME_SOURCE_GNSS_SOLUTION (1) #define SBP_GPS_TIME_TIME_SOURCE_PROPAGATED (2) /** - * Encoded length of sbp_msg_gps_time_t (V4 API) and - * msg_gps_time_t (legacy API) + * Encoded length of sbp_msg_gps_time_t (V4 API) */ #define SBP_MSG_GPS_TIME_ENCODED_LEN 11u -#define SBP_MSG_GPS_TIME_GNSS 0x0104 #define SBP_GPS_TIME_GNSS_TIME_SOURCE_MASK (0x7u) #define SBP_GPS_TIME_GNSS_TIME_SOURCE_SHIFT (0u) #define SBP_GPS_TIME_GNSS_TIME_SOURCE_GET(flags) \ @@ -59,12 +56,10 @@ #define SBP_GPS_TIME_GNSS_TIME_SOURCE_GNSS_SOLUTION (1) #define SBP_GPS_TIME_GNSS_TIME_SOURCE_PROPAGATED (2) /** - * Encoded length of sbp_msg_gps_time_gnss_t (V4 API) and - * msg_gps_time_gnss_t (legacy API) + * Encoded length of sbp_msg_gps_time_gnss_t (V4 API) */ #define SBP_MSG_GPS_TIME_GNSS_ENCODED_LEN 11u -#define SBP_MSG_UTC_TIME 0x0103 #define SBP_UTC_TIME_UTC_OFFSET_SOURCE_MASK (0x3u) #define SBP_UTC_TIME_UTC_OFFSET_SOURCE_SHIFT (3u) #define SBP_UTC_TIME_UTC_OFFSET_SOURCE_GET(flags) \ @@ -98,12 +93,10 @@ #define SBP_UTC_TIME_TIME_SOURCE_GNSS_SOLUTION (1) #define SBP_UTC_TIME_TIME_SOURCE_PROPAGATED (2) /** - * Encoded length of sbp_msg_utc_time_t (V4 API) and - * msg_utc_time_t (legacy API) + * Encoded length of sbp_msg_utc_time_t (V4 API) */ #define SBP_MSG_UTC_TIME_ENCODED_LEN 16u -#define SBP_MSG_UTC_TIME_GNSS 0x0105 #define SBP_UTC_TIME_GNSS_UTC_OFFSET_SOURCE_MASK (0x3u) #define SBP_UTC_TIME_GNSS_UTC_OFFSET_SOURCE_SHIFT (3u) #define SBP_UTC_TIME_GNSS_UTC_OFFSET_SOURCE_GET(flags) \ @@ -138,12 +131,10 @@ #define SBP_UTC_TIME_GNSS_TIME_SOURCE_GNSS_SOLUTION (1) #define SBP_UTC_TIME_GNSS_TIME_SOURCE_PROPAGATED (2) /** - * Encoded length of sbp_msg_utc_time_gnss_t (V4 API) and - * msg_utc_time_gnss_t (legacy API) + * Encoded length of sbp_msg_utc_time_gnss_t (V4 API) */ #define SBP_MSG_UTC_TIME_GNSS_ENCODED_LEN 16u -#define SBP_MSG_DOPS 0x0208 #define SBP_DOPS_RAIM_REPAIR_FLAG_MASK (0x1u) #define SBP_DOPS_RAIM_REPAIR_FLAG_SHIFT (7u) #define SBP_DOPS_RAIM_REPAIR_FLAG_GET(flags) \ @@ -176,12 +167,10 @@ #define SBP_DOPS_FIX_MODE_UNDEFINED (5) #define SBP_DOPS_FIX_MODE_SBAS_POSITION (6) /** - * Encoded length of sbp_msg_dops_t (V4 API) and - * msg_dops_t (legacy API) + * Encoded length of sbp_msg_dops_t (V4 API) */ #define SBP_MSG_DOPS_ENCODED_LEN 15u -#define SBP_MSG_POS_ECEF 0x0209 #define SBP_POS_ECEF_TOW_TYPE_MASK (0x1u) #define SBP_POS_ECEF_TOW_TYPE_SHIFT (5u) #define SBP_POS_ECEF_TOW_TYPE_GET(flags) \ @@ -234,12 +223,10 @@ #define SBP_POS_ECEF_FIX_MODE_DEAD_RECKONING (5) #define SBP_POS_ECEF_FIX_MODE_SBAS_POSITION (6) /** - * Encoded length of sbp_msg_pos_ecef_t (V4 API) and - * msg_pos_ecef_t (legacy API) + * Encoded length of sbp_msg_pos_ecef_t (V4 API) */ #define SBP_MSG_POS_ECEF_ENCODED_LEN 32u -#define SBP_MSG_POS_ECEF_COV 0x0214 #define SBP_POS_ECEF_COV_TYPE_OF_REPORTED_TOW_MASK (0x1u) #define SBP_POS_ECEF_COV_TYPE_OF_REPORTED_TOW_SHIFT (5u) #define SBP_POS_ECEF_COV_TYPE_OF_REPORTED_TOW_GET(flags) \ @@ -293,12 +280,10 @@ #define SBP_POS_ECEF_COV_FIX_MODE_DEAD_RECKONING (5) #define SBP_POS_ECEF_COV_FIX_MODE_SBAS_POSITION (6) /** - * Encoded length of sbp_msg_pos_ecef_cov_t (V4 API) and - * msg_pos_ecef_cov_t (legacy API) + * Encoded length of sbp_msg_pos_ecef_cov_t (V4 API) */ #define SBP_MSG_POS_ECEF_COV_ENCODED_LEN 54u -#define SBP_MSG_POS_LLH 0x020A #define SBP_POS_LLH_TYPE_OF_REPORTED_TOW_MASK (0x1u) #define SBP_POS_LLH_TYPE_OF_REPORTED_TOW_SHIFT (5u) #define SBP_POS_LLH_TYPE_OF_REPORTED_TOW_GET(flags) \ @@ -351,12 +336,10 @@ #define SBP_POS_LLH_FIX_MODE_DEAD_RECKONING (5) #define SBP_POS_LLH_FIX_MODE_SBAS_POSITION (6) /** - * Encoded length of sbp_msg_pos_llh_t (V4 API) and - * msg_pos_llh_t (legacy API) + * Encoded length of sbp_msg_pos_llh_t (V4 API) */ #define SBP_MSG_POS_LLH_ENCODED_LEN 34u -#define SBP_MSG_POS_LLH_COV 0x0211 #define SBP_POS_LLH_COV_TYPE_OF_REPORTED_TOW_MASK (0x1u) #define SBP_POS_LLH_COV_TYPE_OF_REPORTED_TOW_SHIFT (5u) #define SBP_POS_LLH_COV_TYPE_OF_REPORTED_TOW_GET(flags) \ @@ -410,18 +393,15 @@ #define SBP_POS_LLH_COV_FIX_MODE_DEAD_RECKONING (5) #define SBP_POS_LLH_COV_FIX_MODE_SBAS_POSITION (6) /** - * Encoded length of sbp_msg_pos_llh_cov_t (V4 API) and - * msg_pos_llh_cov_t (legacy API) + * Encoded length of sbp_msg_pos_llh_cov_t (V4 API) */ #define SBP_MSG_POS_LLH_COV_ENCODED_LEN 54u /** - * Encoded length of sbp_estimated_horizontal_error_ellipse_t (V4 API) and - * estimated_horizontal_error_ellipse_t (legacy API) + * Encoded length of sbp_estimated_horizontal_error_ellipse_t (V4 API) */ #define SBP_ESTIMATED_HORIZONTAL_ERROR_ELLIPSE_ENCODED_LEN 12u -#define SBP_MSG_POS_LLH_ACC 0x0218 #define SBP_POS_LLH_ACC_GEOID_MODEL_MASK (0x7u) #define SBP_POS_LLH_ACC_GEOID_MODEL_SHIFT (4u) #define SBP_POS_LLH_ACC_GEOID_MODEL_GET(flags) \ @@ -507,12 +487,10 @@ #define SBP_POS_LLH_ACC_FIX_MODE_DEAD_RECKONING (5) #define SBP_POS_LLH_ACC_FIX_MODE_SBAS_POSITION (6) /** - * Encoded length of sbp_msg_pos_llh_acc_t (V4 API) and - * msg_pos_llh_acc_t (legacy API) + * Encoded length of sbp_msg_pos_llh_acc_t (V4 API) */ #define SBP_MSG_POS_LLH_ACC_ENCODED_LEN 67u -#define SBP_MSG_BASELINE_ECEF 0x020B #define SBP_BASELINE_ECEF_FIX_MODE_MASK (0x7u) #define SBP_BASELINE_ECEF_FIX_MODE_SHIFT (0u) #define SBP_BASELINE_ECEF_FIX_MODE_GET(flags) \ @@ -531,12 +509,10 @@ #define SBP_BASELINE_ECEF_FIX_MODE_FLOAT_RTK (3) #define SBP_BASELINE_ECEF_FIX_MODE_FIXED_RTK (4) /** - * Encoded length of sbp_msg_baseline_ecef_t (V4 API) and - * msg_baseline_ecef_t (legacy API) + * Encoded length of sbp_msg_baseline_ecef_t (V4 API) */ #define SBP_MSG_BASELINE_ECEF_ENCODED_LEN 20u -#define SBP_MSG_BASELINE_NED 0x020C #define SBP_BASELINE_NED_FIX_MODE_MASK (0x7u) #define SBP_BASELINE_NED_FIX_MODE_SHIFT (0u) #define SBP_BASELINE_NED_FIX_MODE_GET(flags) \ @@ -555,12 +531,10 @@ #define SBP_BASELINE_NED_FIX_MODE_FLOAT_RTK (3) #define SBP_BASELINE_NED_FIX_MODE_FIXED_RTK (4) /** - * Encoded length of sbp_msg_baseline_ned_t (V4 API) and - * msg_baseline_ned_t (legacy API) + * Encoded length of sbp_msg_baseline_ned_t (V4 API) */ #define SBP_MSG_BASELINE_NED_ENCODED_LEN 22u -#define SBP_MSG_VEL_ECEF 0x020D #define SBP_VEL_ECEF_TYPE_OF_REPORTED_TOW_MASK (0x1u) #define SBP_VEL_ECEF_TYPE_OF_REPORTED_TOW_SHIFT (5u) #define SBP_VEL_ECEF_TYPE_OF_REPORTED_TOW_GET(flags) \ @@ -609,12 +583,10 @@ #define SBP_VEL_ECEF_VELOCITY_MODE_COMPUTED_DOPPLER_DERIVED (2) #define SBP_VEL_ECEF_VELOCITY_MODE_DEAD_RECKONING (3) /** - * Encoded length of sbp_msg_vel_ecef_t (V4 API) and - * msg_vel_ecef_t (legacy API) + * Encoded length of sbp_msg_vel_ecef_t (V4 API) */ #define SBP_MSG_VEL_ECEF_ENCODED_LEN 20u -#define SBP_MSG_VEL_ECEF_COV 0x0215 #define SBP_VEL_ECEF_COV_TYPE_OF_REPORTED_TOW_MASK (0x1u) #define SBP_VEL_ECEF_COV_TYPE_OF_REPORTED_TOW_SHIFT (5u) #define SBP_VEL_ECEF_COV_TYPE_OF_REPORTED_TOW_GET(flags) \ @@ -665,12 +637,10 @@ #define SBP_VEL_ECEF_COV_VELOCITY_MODE_COMPUTED_DOPPLER_DERIVED (2) #define SBP_VEL_ECEF_COV_VELOCITY_MODE_DEAD_RECKONING (3) /** - * Encoded length of sbp_msg_vel_ecef_cov_t (V4 API) and - * msg_vel_ecef_cov_t (legacy API) + * Encoded length of sbp_msg_vel_ecef_cov_t (V4 API) */ #define SBP_MSG_VEL_ECEF_COV_ENCODED_LEN 42u -#define SBP_MSG_VEL_NED 0x020E #define SBP_VEL_NED_TYPE_OF_REPORTED_TOW_MASK (0x1u) #define SBP_VEL_NED_TYPE_OF_REPORTED_TOW_SHIFT (5u) #define SBP_VEL_NED_TYPE_OF_REPORTED_TOW_GET(flags) \ @@ -719,12 +689,10 @@ #define SBP_VEL_NED_VELOCITY_MODE_COMPUTED_DOPPLER_DERIVED (2) #define SBP_VEL_NED_VELOCITY_MODE_DEAD_RECKONING (3) /** - * Encoded length of sbp_msg_vel_ned_t (V4 API) and - * msg_vel_ned_t (legacy API) + * Encoded length of sbp_msg_vel_ned_t (V4 API) */ #define SBP_MSG_VEL_NED_ENCODED_LEN 22u -#define SBP_MSG_VEL_NED_COV 0x0212 #define SBP_VEL_NED_COV_TYPE_OF_REPORTED_TOW_MASK (0x1u) #define SBP_VEL_NED_COV_TYPE_OF_REPORTED_TOW_SHIFT (5u) #define SBP_VEL_NED_COV_TYPE_OF_REPORTED_TOW_GET(flags) \ @@ -775,12 +743,10 @@ #define SBP_VEL_NED_COV_VELOCITY_MODE_COMPUTED_DOPPLER_DERIVED (2) #define SBP_VEL_NED_COV_VELOCITY_MODE_DEAD_RECKONING (3) /** - * Encoded length of sbp_msg_vel_ned_cov_t (V4 API) and - * msg_vel_ned_cov_t (legacy API) + * Encoded length of sbp_msg_vel_ned_cov_t (V4 API) */ #define SBP_MSG_VEL_NED_COV_ENCODED_LEN 42u -#define SBP_MSG_POS_ECEF_GNSS 0x0229 #define SBP_POS_ECEF_GNSS_FIX_MODE_MASK (0x7u) #define SBP_POS_ECEF_GNSS_FIX_MODE_SHIFT (0u) #define SBP_POS_ECEF_GNSS_FIX_MODE_GET(flags) \ @@ -801,12 +767,10 @@ #define SBP_POS_ECEF_GNSS_FIX_MODE_FIXED_RTK (4) #define SBP_POS_ECEF_GNSS_FIX_MODE_SBAS_POSITION (6) /** - * Encoded length of sbp_msg_pos_ecef_gnss_t (V4 API) and - * msg_pos_ecef_gnss_t (legacy API) + * Encoded length of sbp_msg_pos_ecef_gnss_t (V4 API) */ #define SBP_MSG_POS_ECEF_GNSS_ENCODED_LEN 32u -#define SBP_MSG_POS_ECEF_COV_GNSS 0x0234 #define SBP_POS_ECEF_COV_GNSS_FIX_MODE_MASK (0x7u) #define SBP_POS_ECEF_COV_GNSS_FIX_MODE_SHIFT (0u) #define SBP_POS_ECEF_COV_GNSS_FIX_MODE_GET(flags) \ @@ -827,12 +791,10 @@ #define SBP_POS_ECEF_COV_GNSS_FIX_MODE_FIXED_RTK (4) #define SBP_POS_ECEF_COV_GNSS_FIX_MODE_SBAS_POSITION (6) /** - * Encoded length of sbp_msg_pos_ecef_cov_gnss_t (V4 API) and - * msg_pos_ecef_cov_gnss_t (legacy API) + * Encoded length of sbp_msg_pos_ecef_cov_gnss_t (V4 API) */ #define SBP_MSG_POS_ECEF_COV_GNSS_ENCODED_LEN 54u -#define SBP_MSG_POS_LLH_GNSS 0x022A #define SBP_POS_LLH_GNSS_FIX_MODE_MASK (0x7u) #define SBP_POS_LLH_GNSS_FIX_MODE_SHIFT (0u) #define SBP_POS_LLH_GNSS_FIX_MODE_GET(flags) \ @@ -853,12 +815,10 @@ #define SBP_POS_LLH_GNSS_FIX_MODE_FIXED_RTK (4) #define SBP_POS_LLH_GNSS_FIX_MODE_SBAS_POSITION (6) /** - * Encoded length of sbp_msg_pos_llh_gnss_t (V4 API) and - * msg_pos_llh_gnss_t (legacy API) + * Encoded length of sbp_msg_pos_llh_gnss_t (V4 API) */ #define SBP_MSG_POS_LLH_GNSS_ENCODED_LEN 34u -#define SBP_MSG_POS_LLH_COV_GNSS 0x0231 #define SBP_POS_LLH_COV_GNSS_FIX_MODE_MASK (0x7u) #define SBP_POS_LLH_COV_GNSS_FIX_MODE_SHIFT (0u) #define SBP_POS_LLH_COV_GNSS_FIX_MODE_GET(flags) \ @@ -880,12 +840,10 @@ #define SBP_POS_LLH_COV_GNSS_FIX_MODE_DEAD_RECKONING (5) #define SBP_POS_LLH_COV_GNSS_FIX_MODE_SBAS_POSITION (6) /** - * Encoded length of sbp_msg_pos_llh_cov_gnss_t (V4 API) and - * msg_pos_llh_cov_gnss_t (legacy API) + * Encoded length of sbp_msg_pos_llh_cov_gnss_t (V4 API) */ #define SBP_MSG_POS_LLH_COV_GNSS_ENCODED_LEN 54u -#define SBP_MSG_VEL_ECEF_GNSS 0x022D #define SBP_VEL_ECEF_GNSS_VELOCITY_MODE_MASK (0x7u) #define SBP_VEL_ECEF_GNSS_VELOCITY_MODE_SHIFT (0u) #define SBP_VEL_ECEF_GNSS_VELOCITY_MODE_GET(flags) \ @@ -903,12 +861,10 @@ #define SBP_VEL_ECEF_GNSS_VELOCITY_MODE_MEASURED_DOPPLER_DERIVED (1) #define SBP_VEL_ECEF_GNSS_VELOCITY_MODE_COMPUTED_DOPPLER_DERIVED (2) /** - * Encoded length of sbp_msg_vel_ecef_gnss_t (V4 API) and - * msg_vel_ecef_gnss_t (legacy API) + * Encoded length of sbp_msg_vel_ecef_gnss_t (V4 API) */ #define SBP_MSG_VEL_ECEF_GNSS_ENCODED_LEN 20u -#define SBP_MSG_VEL_ECEF_COV_GNSS 0x0235 #define SBP_VEL_ECEF_COV_GNSS_VELOCITY_MODE_MASK (0x7u) #define SBP_VEL_ECEF_COV_GNSS_VELOCITY_MODE_SHIFT (0u) #define SBP_VEL_ECEF_COV_GNSS_VELOCITY_MODE_GET(flags) \ @@ -927,12 +883,10 @@ #define SBP_VEL_ECEF_COV_GNSS_VELOCITY_MODE_MEASURED_DOPPLER_DERIVED (1) #define SBP_VEL_ECEF_COV_GNSS_VELOCITY_MODE_COMPUTED_DOPPLER_DERIVED (2) /** - * Encoded length of sbp_msg_vel_ecef_cov_gnss_t (V4 API) and - * msg_vel_ecef_cov_gnss_t (legacy API) + * Encoded length of sbp_msg_vel_ecef_cov_gnss_t (V4 API) */ #define SBP_MSG_VEL_ECEF_COV_GNSS_ENCODED_LEN 42u -#define SBP_MSG_VEL_NED_GNSS 0x022E #define SBP_VEL_NED_GNSS_VELOCITY_MODE_MASK (0x7u) #define SBP_VEL_NED_GNSS_VELOCITY_MODE_SHIFT (0u) #define SBP_VEL_NED_GNSS_VELOCITY_MODE_GET(flags) \ @@ -950,12 +904,10 @@ #define SBP_VEL_NED_GNSS_VELOCITY_MODE_MEASURED_DOPPLER_DERIVED (1) #define SBP_VEL_NED_GNSS_VELOCITY_MODE_COMPUTED_DOPPLER_DERIVED (2) /** - * Encoded length of sbp_msg_vel_ned_gnss_t (V4 API) and - * msg_vel_ned_gnss_t (legacy API) + * Encoded length of sbp_msg_vel_ned_gnss_t (V4 API) */ #define SBP_MSG_VEL_NED_GNSS_ENCODED_LEN 22u -#define SBP_MSG_VEL_NED_COV_GNSS 0x0232 #define SBP_VEL_NED_COV_GNSS_VELOCITY_MODE_MASK (0x7u) #define SBP_VEL_NED_COV_GNSS_VELOCITY_MODE_SHIFT (0u) #define SBP_VEL_NED_COV_GNSS_VELOCITY_MODE_GET(flags) \ @@ -974,12 +926,10 @@ #define SBP_VEL_NED_COV_GNSS_VELOCITY_MODE_MEASURED_DOPPLER_DERIVED (1) #define SBP_VEL_NED_COV_GNSS_VELOCITY_MODE_COMPUTED_DOPPLER_DERIVED (2) /** - * Encoded length of sbp_msg_vel_ned_cov_gnss_t (V4 API) and - * msg_vel_ned_cov_gnss_t (legacy API) + * Encoded length of sbp_msg_vel_ned_cov_gnss_t (V4 API) */ #define SBP_MSG_VEL_NED_COV_GNSS_ENCODED_LEN 42u -#define SBP_MSG_VEL_BODY 0x0213 #define SBP_VEL_BODY_INS_NAVIGATION_MODE_MASK (0x3u) #define SBP_VEL_BODY_INS_NAVIGATION_MODE_SHIFT (3u) #define SBP_VEL_BODY_INS_NAVIGATION_MODE_GET(flags) \ @@ -1013,12 +963,10 @@ #define SBP_VEL_BODY_VELOCITY_MODE_COMPUTED_DOPPLER_DERIVED (2) #define SBP_VEL_BODY_VELOCITY_MODE_DEAD_RECKONING (3) /** - * Encoded length of sbp_msg_vel_body_t (V4 API) and - * msg_vel_body_t (legacy API) + * Encoded length of sbp_msg_vel_body_t (V4 API) */ #define SBP_MSG_VEL_BODY_ENCODED_LEN 42u -#define SBP_MSG_VEL_COG 0x021C #define SBP_VEL_COG_COG_FROZEN_MASK (0x1u) #define SBP_VEL_COG_COG_FROZEN_SHIFT (9u) #define SBP_VEL_COG_COG_FROZEN_GET(flags) \ @@ -1128,33 +1076,25 @@ #define SBP_VEL_COG_VELOCITY_MODE_COMPUTED_DOPPLER_DERIVED (2) #define SBP_VEL_COG_VELOCITY_MODE_DEAD_RECKONING (3) /** - * Encoded length of sbp_msg_vel_cog_t (V4 API) and - * msg_vel_cog_t (legacy API) + * Encoded length of sbp_msg_vel_cog_t (V4 API) */ #define SBP_MSG_VEL_COG_ENCODED_LEN 30u -#define SBP_MSG_AGE_CORRECTIONS 0x0210 /** - * Encoded length of sbp_msg_age_corrections_t (V4 API) and - * msg_age_corrections_t (legacy API) + * Encoded length of sbp_msg_age_corrections_t (V4 API) */ #define SBP_MSG_AGE_CORRECTIONS_ENCODED_LEN 6u -#define SBP_MSG_GPS_TIME_DEP_A 0x0100 /** - * Encoded length of sbp_msg_gps_time_dep_a_t (V4 API) and - * msg_gps_time_dep_a_t (legacy API) + * Encoded length of sbp_msg_gps_time_dep_a_t (V4 API) */ #define SBP_MSG_GPS_TIME_DEP_A_ENCODED_LEN 11u -#define SBP_MSG_DOPS_DEP_A 0x0206 /** - * Encoded length of sbp_msg_dops_dep_a_t (V4 API) and - * msg_dops_dep_a_t (legacy API) + * Encoded length of sbp_msg_dops_dep_a_t (V4 API) */ #define SBP_MSG_DOPS_DEP_A_ENCODED_LEN 14u -#define SBP_MSG_POS_ECEF_DEP_A 0x0200 #define SBP_POS_ECEF_DEP_A_RAIM_REPAIR_FLAG_MASK (0x1u) #define SBP_POS_ECEF_DEP_A_RAIM_REPAIR_FLAG_SHIFT (4u) #define SBP_POS_ECEF_DEP_A_RAIM_REPAIR_FLAG_GET(flags) \ @@ -1205,12 +1145,10 @@ #define SBP_POS_ECEF_DEP_A_FIX_MODE_FIXED_RTK (1) #define SBP_POS_ECEF_DEP_A_FIX_MODE_FLOAT_RTK (2) /** - * Encoded length of sbp_msg_pos_ecef_dep_a_t (V4 API) and - * msg_pos_ecef_dep_a_t (legacy API) + * Encoded length of sbp_msg_pos_ecef_dep_a_t (V4 API) */ #define SBP_MSG_POS_ECEF_DEP_A_ENCODED_LEN 32u -#define SBP_MSG_POS_LLH_DEP_A 0x0201 #define SBP_POS_LLH_DEP_A_RAIM_REPAIR_FLAG_MASK (0x1u) #define SBP_POS_LLH_DEP_A_RAIM_REPAIR_FLAG_SHIFT (5u) #define SBP_POS_LLH_DEP_A_RAIM_REPAIR_FLAG_GET(flags) \ @@ -1276,12 +1214,10 @@ #define SBP_POS_LLH_DEP_A_FIX_MODE_FIXED_RTK (1) #define SBP_POS_LLH_DEP_A_FIX_MODE_FLOAT_RTK (2) /** - * Encoded length of sbp_msg_pos_llh_dep_a_t (V4 API) and - * msg_pos_llh_dep_a_t (legacy API) + * Encoded length of sbp_msg_pos_llh_dep_a_t (V4 API) */ #define SBP_MSG_POS_LLH_DEP_A_ENCODED_LEN 34u -#define SBP_MSG_BASELINE_ECEF_DEP_A 0x0202 #define SBP_BASELINE_ECEF_DEP_A_RAIM_REPAIR_FLAG_MASK (0x1u) #define SBP_BASELINE_ECEF_DEP_A_RAIM_REPAIR_FLAG_SHIFT (4u) #define SBP_BASELINE_ECEF_DEP_A_RAIM_REPAIR_FLAG_GET(flags) \ @@ -1335,12 +1271,10 @@ #define SBP_BASELINE_ECEF_DEP_A_FIX_MODE_FLOAT_RTK (0) #define SBP_BASELINE_ECEF_DEP_A_FIX_MODE_FIXED_RTK (1) /** - * Encoded length of sbp_msg_baseline_ecef_dep_a_t (V4 API) and - * msg_baseline_ecef_dep_a_t (legacy API) + * Encoded length of sbp_msg_baseline_ecef_dep_a_t (V4 API) */ #define SBP_MSG_BASELINE_ECEF_DEP_A_ENCODED_LEN 20u -#define SBP_MSG_BASELINE_NED_DEP_A 0x0203 #define SBP_BASELINE_NED_DEP_A_RAIM_REPAIR_FLAG_MASK (0x1u) #define SBP_BASELINE_NED_DEP_A_RAIM_REPAIR_FLAG_SHIFT (4u) #define SBP_BASELINE_NED_DEP_A_RAIM_REPAIR_FLAG_GET(flags) \ @@ -1393,26 +1327,20 @@ #define SBP_BASELINE_NED_DEP_A_FIX_MODE_FLOAT_RTK (0) #define SBP_BASELINE_NED_DEP_A_FIX_MODE_FIXED_RTK (1) /** - * Encoded length of sbp_msg_baseline_ned_dep_a_t (V4 API) and - * msg_baseline_ned_dep_a_t (legacy API) + * Encoded length of sbp_msg_baseline_ned_dep_a_t (V4 API) */ #define SBP_MSG_BASELINE_NED_DEP_A_ENCODED_LEN 22u -#define SBP_MSG_VEL_ECEF_DEP_A 0x0204 /** - * Encoded length of sbp_msg_vel_ecef_dep_a_t (V4 API) and - * msg_vel_ecef_dep_a_t (legacy API) + * Encoded length of sbp_msg_vel_ecef_dep_a_t (V4 API) */ #define SBP_MSG_VEL_ECEF_DEP_A_ENCODED_LEN 20u -#define SBP_MSG_VEL_NED_DEP_A 0x0205 /** - * Encoded length of sbp_msg_vel_ned_dep_a_t (V4 API) and - * msg_vel_ned_dep_a_t (legacy API) + * Encoded length of sbp_msg_vel_ned_dep_a_t (V4 API) */ #define SBP_MSG_VEL_NED_DEP_A_ENCODED_LEN 22u -#define SBP_MSG_BASELINE_HEADING_DEP_A 0x0207 #define SBP_BASELINE_HEADING_DEP_A_RAIM_REPAIR_FLAG_MASK (0x1u) #define SBP_BASELINE_HEADING_DEP_A_RAIM_REPAIR_FLAG_SHIFT (4u) #define SBP_BASELINE_HEADING_DEP_A_RAIM_REPAIR_FLAG_GET(flags) \ @@ -1467,12 +1395,10 @@ #define SBP_BASELINE_HEADING_DEP_A_FIX_MODE_FLOAT_RTK (0) #define SBP_BASELINE_HEADING_DEP_A_FIX_MODE_FIXED_RTK (1) /** - * Encoded length of sbp_msg_baseline_heading_dep_a_t (V4 API) and - * msg_baseline_heading_dep_a_t (legacy API) + * Encoded length of sbp_msg_baseline_heading_dep_a_t (V4 API) */ #define SBP_MSG_BASELINE_HEADING_DEP_A_ENCODED_LEN 10u -#define SBP_MSG_PROTECTION_LEVEL_DEP_A 0x0216 #define SBP_PROTECTION_LEVEL_DEP_A_TARGET_INTEGRITY_RISK_TIR_LEVEL_MASK (0x7u) #define SBP_PROTECTION_LEVEL_DEP_A_TARGET_INTEGRITY_RISK_TIR_LEVEL_SHIFT (0u) #define SBP_PROTECTION_LEVEL_DEP_A_TARGET_INTEGRITY_RISK_TIR_LEVEL_GET(flags) \ @@ -1501,12 +1427,10 @@ #define SBP_PROTECTION_LEVEL_DEP_A_TARGET_INTEGRITY_RISK_TIR_LEVEL_TIR_LEVEL_3 \ (3) /** - * Encoded length of sbp_msg_protection_level_dep_a_t (V4 API) and - * msg_protection_level_dep_a_t (legacy API) + * Encoded length of sbp_msg_protection_level_dep_a_t (V4 API) */ #define SBP_MSG_PROTECTION_LEVEL_DEP_A_ENCODED_LEN 33u -#define SBP_MSG_PROTECTION_LEVEL 0x0217 #define SBP_PROTECTION_LEVEL_TARGET_INTEGRITY_RISK_TIR_LEVEL_MASK (0x7u) #define SBP_PROTECTION_LEVEL_TARGET_INTEGRITY_RISK_TIR_LEVEL_SHIFT (0u) #define SBP_PROTECTION_LEVEL_TARGET_INTEGRITY_RISK_TIR_LEVEL_GET(flags) \ @@ -1731,46 +1655,38 @@ } while (0) /** - * Encoded length of sbp_msg_protection_level_t (V4 API) and - * msg_protection_level_t (legacy API) + * Encoded length of sbp_msg_protection_level_t (V4 API) */ #define SBP_MSG_PROTECTION_LEVEL_ENCODED_LEN 76u -#define SBP_MSG_UTC_LEAP_SECOND 0x023A /** - * Encoded length of sbp_msg_utc_leap_second_t (V4 API) and - * msg_utc_leap_second_t (legacy API) + * Encoded length of sbp_msg_utc_leap_second_t (V4 API) */ #define SBP_MSG_UTC_LEAP_SECOND_ENCODED_LEN 14u -#define SBP_MSG_REFERENCE_FRAME_PARAM 0x0244 /** * The maximum number of items that can be stored in - * sbp_msg_reference_frame_param_t::sn (V4 API) or - * msg_reference_frame_param_t::sn (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_reference_frame_param_t::sn before the maximum SBP message size is + * exceeded */ #define SBP_MSG_REFERENCE_FRAME_PARAM_SN_MAX 32u /** * The maximum number of items that can be stored in - * sbp_msg_reference_frame_param_t::tn (V4 API) or - * msg_reference_frame_param_t::tn (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_reference_frame_param_t::tn before the maximum SBP message size is + * exceeded */ #define SBP_MSG_REFERENCE_FRAME_PARAM_TN_MAX 32u /** - * Encoded length of sbp_msg_reference_frame_param_t (V4 API) and - * msg_reference_frame_param_t (legacy API) + * Encoded length of sbp_msg_reference_frame_param_t (V4 API) */ #define SBP_MSG_REFERENCE_FRAME_PARAM_ENCODED_LEN 124u -#define SBP_MSG_POSE_RELATIVE 0x0245 /** * The maximum number of items that can be stored in - * sbp_msg_pose_relative_t::trans (V4 API) or msg_pose_relative_t::trans (legacy - * API) before the maximum SBP message size is exceeded + * sbp_msg_pose_relative_t::trans before the maximum SBP message size is + * exceeded */ #define SBP_MSG_POSE_RELATIVE_TRANS_MAX 3u @@ -1824,8 +1740,7 @@ #define SBP_POSE_RELATIVE_RELATIVE_ROTATION_STATUS_INVALID (0) #define SBP_POSE_RELATIVE_RELATIVE_ROTATION_STATUS_VALID (1) /** - * Encoded length of sbp_msg_pose_relative_t (V4 API) and - * msg_pose_relative_t (legacy API) + * Encoded length of sbp_msg_pose_relative_t (V4 API) */ #define SBP_MSG_POSE_RELATIVE_ENCODED_LEN 90u diff --git a/c/include/libsbp/ndb/MSG_NDB_EVENT.h b/c/include/libsbp/ndb/MSG_NDB_EVENT.h index 5ce9debfa2..2683ae139d 100644 --- a/c/include/libsbp/ndb/MSG_NDB_EVENT.h +++ b/c/include/libsbp/ndb/MSG_NDB_EVENT.h @@ -74,14 +74,14 @@ typedef struct { * GNSS signal identifier, If object_type is Ephemeris OR Almanac, sid * indicates for which signal the object belongs to. Reserved in other cases. */ - sbp_v4_gnss_signal_t object_sid; + sbp_gnss_signal_t object_sid; /** * GNSS signal identifier, If object_type is Almanac, Almanac WN, Iono OR L2C * capabilities AND data_source is NDB_DS_RECEIVER sid indicates from which SV * data was decoded. Reserved in other cases. */ - sbp_v4_gnss_signal_t src_sid; + sbp_gnss_signal_t src_sid; /** * A unique identifier of the sending hardware. For v1.0, set to the 2 least diff --git a/c/include/libsbp/ndb_macros.h b/c/include/libsbp/ndb_macros.h index e034bb4447..c5d8988d87 100644 --- a/c/include/libsbp/ndb_macros.h +++ b/c/include/libsbp/ndb_macros.h @@ -18,7 +18,6 @@ #ifndef LIBSBP_NDB_MACROS_H #define LIBSBP_NDB_MACROS_H -#define SBP_MSG_NDB_EVENT 0x0400 #define SBP_NDB_EVENT_EVENT_TYPE_MASK (0x3u) #define SBP_NDB_EVENT_EVENT_TYPE_SHIFT (0u) #define SBP_NDB_EVENT_EVENT_TYPE_GET(flags) \ @@ -98,8 +97,7 @@ #define SBP_NDB_EVENT_DATA_SOURCE_NDB_DS_RECEIVER (2) #define SBP_NDB_EVENT_DATA_SOURCE_NDB_DS_SBP (3) /** - * Encoded length of sbp_msg_ndb_event_t (V4 API) and - * msg_ndb_event_t (legacy API) + * Encoded length of sbp_msg_ndb_event_t (V4 API) */ #define SBP_MSG_NDB_EVENT_ENCODED_LEN 18u diff --git a/c/include/libsbp/observation/AlmanacCommonContent.h b/c/include/libsbp/observation/AlmanacCommonContent.h index ce840dc4f6..b1e22b5016 100644 --- a/c/include/libsbp/observation/AlmanacCommonContent.h +++ b/c/include/libsbp/observation/AlmanacCommonContent.h @@ -44,7 +44,7 @@ typedef struct { /** * GNSS signal identifier */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; /** * Reference time of almanac diff --git a/c/include/libsbp/observation/EphemerisCommonContent.h b/c/include/libsbp/observation/EphemerisCommonContent.h index 62fa8f0a03..b8849af406 100644 --- a/c/include/libsbp/observation/EphemerisCommonContent.h +++ b/c/include/libsbp/observation/EphemerisCommonContent.h @@ -44,7 +44,7 @@ typedef struct { /** * GNSS signal identifier (16 bit) */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; /** * Time of Ephemerides diff --git a/c/include/libsbp/observation/EphemerisCommonContentDepB.h b/c/include/libsbp/observation/EphemerisCommonContentDepB.h index 6ab8f5ca41..16e49c42c8 100644 --- a/c/include/libsbp/observation/EphemerisCommonContentDepB.h +++ b/c/include/libsbp/observation/EphemerisCommonContentDepB.h @@ -44,7 +44,7 @@ typedef struct { /** * GNSS signal identifier (16 bit) */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; /** * Time of Ephemerides diff --git a/c/include/libsbp/observation/MSG_GROUP_DELAY.h b/c/include/libsbp/observation/MSG_GROUP_DELAY.h index f8ce71bd18..85f2763a85 100644 --- a/c/include/libsbp/observation/MSG_GROUP_DELAY.h +++ b/c/include/libsbp/observation/MSG_GROUP_DELAY.h @@ -53,7 +53,7 @@ typedef struct { /** * GNSS signal identifier */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; /** * bit-field indicating validity of the values, LSB indicating tgd validity diff --git a/c/include/libsbp/observation/ObservationHeader.h b/c/include/libsbp/observation/ObservationHeader.h index c3c91a4f49..f4d17e4e7e 100644 --- a/c/include/libsbp/observation/ObservationHeader.h +++ b/c/include/libsbp/observation/ObservationHeader.h @@ -47,7 +47,7 @@ typedef struct { /** * GNSS time of this observation */ - sbp_v4_gps_time_t t; + sbp_gps_time_t t; /** * Total number of observations. First nibble is the size of the sequence (n), diff --git a/c/include/libsbp/observation/PackedObsContent.h b/c/include/libsbp/observation/PackedObsContent.h index e1d0552072..8df969c23a 100644 --- a/c/include/libsbp/observation/PackedObsContent.h +++ b/c/include/libsbp/observation/PackedObsContent.h @@ -88,7 +88,7 @@ typedef struct { /** * GNSS signal identifier (16 bit) */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; } sbp_packed_obs_content_t; /** diff --git a/c/include/libsbp/observation/PackedOsrContent.h b/c/include/libsbp/observation/PackedOsrContent.h index a0e430f267..636c2d3c91 100644 --- a/c/include/libsbp/observation/PackedOsrContent.h +++ b/c/include/libsbp/observation/PackedOsrContent.h @@ -72,7 +72,7 @@ typedef struct { /** * GNSS signal identifier (16 bit) */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; /** * Slant ionospheric correction standard deviation [5 mm] diff --git a/c/include/libsbp/observation/SvAzEl.h b/c/include/libsbp/observation/SvAzEl.h index dbfc171066..624a18f27d 100644 --- a/c/include/libsbp/observation/SvAzEl.h +++ b/c/include/libsbp/observation/SvAzEl.h @@ -47,7 +47,7 @@ typedef struct { /** * GNSS signal identifier */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; /** * Azimuth angle (range 0..179) [deg * 2] diff --git a/c/include/libsbp/observation_macros.h b/c/include/libsbp/observation_macros.h index 1825d69d06..c17a6bc700 100644 --- a/c/include/libsbp/observation_macros.h +++ b/c/include/libsbp/observation_macros.h @@ -19,14 +19,12 @@ #define LIBSBP_OBSERVATION_MACROS_H /** - * Encoded length of sbp_observation_header_t (V4 API) and - * observation_header_t (legacy API) + * Encoded length of sbp_observation_header_t (V4 API) */ #define SBP_OBSERVATION_HEADER_ENCODED_LEN 11u /** - * Encoded length of sbp_doppler_t (V4 API) and - * doppler_t (legacy API) + * Encoded length of sbp_doppler_t (V4 API) */ #define SBP_DOPPLER_ENCODED_LEN 3u @@ -118,8 +116,7 @@ #define SBP_PACKEDOBSCONTENT_PSEUDORANGE_VALID_VALID_PSEUDORANGE_MEASUREMENT_AND_COARSE_TOW_DECODED \ (1) /** - * Encoded length of sbp_packed_obs_content_t (V4 API) and - * packed_obs_content_t (legacy API) + * Encoded length of sbp_packed_obs_content_t (V4 API) */ #define SBP_PACKED_OBS_CONTENT_ENCODED_LEN 17u @@ -210,613 +207,500 @@ #define SBP_PACKEDOSRCONTENT_CORRECTION_VALIDITY_DO_NOT_USE_SIGNAL (0) #define SBP_PACKEDOSRCONTENT_CORRECTION_VALIDITY_VALID_SIGNAL (1) /** - * Encoded length of sbp_packed_osr_content_t (V4 API) and - * packed_osr_content_t (legacy API) + * Encoded length of sbp_packed_osr_content_t (V4 API) */ #define SBP_PACKED_OSR_CONTENT_ENCODED_LEN 19u -#define SBP_MSG_OBS 0x004A /** - * The maximum number of items that can be stored in sbp_msg_obs_t::obs (V4 API) - * or msg_obs_t::obs (legacy API) before the maximum SBP message size is - * exceeded + * The maximum number of items that can be stored in sbp_msg_obs_t::obs before + * the maximum SBP message size is exceeded */ #define SBP_MSG_OBS_OBS_MAX 14u /** - * Encoded length of sbp_msg_obs_t (V4 API) and - * msg_obs_t (legacy API) + * Encoded length of sbp_msg_obs_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_obs_encoded_len to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_OBS_ENCODED_OVERHEAD 11u -#define SBP_MSG_BASE_POS_LLH 0x0044 /** - * Encoded length of sbp_msg_base_pos_llh_t (V4 API) and - * msg_base_pos_llh_t (legacy API) + * Encoded length of sbp_msg_base_pos_llh_t (V4 API) */ #define SBP_MSG_BASE_POS_LLH_ENCODED_LEN 24u -#define SBP_MSG_BASE_POS_ECEF 0x0048 /** - * Encoded length of sbp_msg_base_pos_ecef_t (V4 API) and - * msg_base_pos_ecef_t (legacy API) + * Encoded length of sbp_msg_base_pos_ecef_t (V4 API) */ #define SBP_MSG_BASE_POS_ECEF_ENCODED_LEN 24u /** - * Encoded length of sbp_ephemeris_common_content_t (V4 API) and - * ephemeris_common_content_t (legacy API) + * Encoded length of sbp_ephemeris_common_content_t (V4 API) */ #define SBP_EPHEMERIS_COMMON_CONTENT_ENCODED_LEN 18u /** - * Encoded length of sbp_ephemeris_common_content_dep_b_t (V4 API) and - * ephemeris_common_content_dep_b_t (legacy API) + * Encoded length of sbp_ephemeris_common_content_dep_b_t (V4 API) */ #define SBP_EPHEMERIS_COMMON_CONTENT_DEP_B_ENCODED_LEN 22u /** - * Encoded length of sbp_ephemeris_common_content_dep_a_t (V4 API) and - * ephemeris_common_content_dep_a_t (legacy API) + * Encoded length of sbp_ephemeris_common_content_dep_a_t (V4 API) */ #define SBP_EPHEMERIS_COMMON_CONTENT_DEP_A_ENCODED_LEN 24u -#define SBP_MSG_EPHEMERIS_GPS_DEP_E 0x0081 /** - * Encoded length of sbp_msg_ephemeris_gps_dep_e_t (V4 API) and - * msg_ephemeris_gps_dep_e_t (legacy API) + * Encoded length of sbp_msg_ephemeris_gps_dep_e_t (V4 API) */ #define SBP_MSG_EPHEMERIS_GPS_DEP_E_ENCODED_LEN 185u -#define SBP_MSG_EPHEMERIS_GPS_DEP_F 0x0086 /** - * Encoded length of sbp_msg_ephemeris_gps_dep_f_t (V4 API) and - * msg_ephemeris_gps_dep_f_t (legacy API) + * Encoded length of sbp_msg_ephemeris_gps_dep_f_t (V4 API) */ #define SBP_MSG_EPHEMERIS_GPS_DEP_F_ENCODED_LEN 183u -#define SBP_MSG_EPHEMERIS_GPS 0x008A /** - * Encoded length of sbp_msg_ephemeris_gps_t (V4 API) and - * msg_ephemeris_gps_t (legacy API) + * Encoded length of sbp_msg_ephemeris_gps_t (V4 API) */ #define SBP_MSG_EPHEMERIS_GPS_ENCODED_LEN 139u -#define SBP_MSG_EPHEMERIS_QZSS 0x008E /** - * Encoded length of sbp_msg_ephemeris_qzss_t (V4 API) and - * msg_ephemeris_qzss_t (legacy API) + * Encoded length of sbp_msg_ephemeris_qzss_t (V4 API) */ #define SBP_MSG_EPHEMERIS_QZSS_ENCODED_LEN 139u -#define SBP_MSG_EPHEMERIS_BDS 0x0089 /** - * Encoded length of sbp_msg_ephemeris_bds_t (V4 API) and - * msg_ephemeris_bds_t (legacy API) + * Encoded length of sbp_msg_ephemeris_bds_t (V4 API) */ #define SBP_MSG_EPHEMERIS_BDS_ENCODED_LEN 147u -#define SBP_MSG_EPHEMERIS_GAL_DEP_A 0x0095 /** - * Encoded length of sbp_msg_ephemeris_gal_dep_a_t (V4 API) and - * msg_ephemeris_gal_dep_a_t (legacy API) + * Encoded length of sbp_msg_ephemeris_gal_dep_a_t (V4 API) */ #define SBP_MSG_EPHEMERIS_GAL_DEP_A_ENCODED_LEN 152u -#define SBP_MSG_EPHEMERIS_GAL 0x008D /** - * Encoded length of sbp_msg_ephemeris_gal_t (V4 API) and - * msg_ephemeris_gal_t (legacy API) + * Encoded length of sbp_msg_ephemeris_gal_t (V4 API) */ #define SBP_MSG_EPHEMERIS_GAL_ENCODED_LEN 153u -#define SBP_MSG_EPHEMERIS_SBAS_DEP_A 0x0082 /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_sbas_dep_a_t::pos (V4 API) or - * msg_ephemeris_sbas_dep_a_t::pos (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_ephemeris_sbas_dep_a_t::pos before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_SBAS_DEP_A_POS_MAX 3u /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_sbas_dep_a_t::vel (V4 API) or - * msg_ephemeris_sbas_dep_a_t::vel (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_ephemeris_sbas_dep_a_t::vel before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_SBAS_DEP_A_VEL_MAX 3u /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_sbas_dep_a_t::acc (V4 API) or - * msg_ephemeris_sbas_dep_a_t::acc (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_ephemeris_sbas_dep_a_t::acc before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_SBAS_DEP_A_ACC_MAX 3u /** - * Encoded length of sbp_msg_ephemeris_sbas_dep_a_t (V4 API) and - * msg_ephemeris_sbas_dep_a_t (legacy API) + * Encoded length of sbp_msg_ephemeris_sbas_dep_a_t (V4 API) */ #define SBP_MSG_EPHEMERIS_SBAS_DEP_A_ENCODED_LEN 112u -#define SBP_MSG_EPHEMERIS_GLO_DEP_A 0x0083 /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_glo_dep_a_t::pos (V4 API) or msg_ephemeris_glo_dep_a_t::pos - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_glo_dep_a_t::pos before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_GLO_DEP_A_POS_MAX 3u /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_glo_dep_a_t::vel (V4 API) or msg_ephemeris_glo_dep_a_t::vel - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_glo_dep_a_t::vel before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_GLO_DEP_A_VEL_MAX 3u /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_glo_dep_a_t::acc (V4 API) or msg_ephemeris_glo_dep_a_t::acc - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_glo_dep_a_t::acc before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_GLO_DEP_A_ACC_MAX 3u /** - * Encoded length of sbp_msg_ephemeris_glo_dep_a_t (V4 API) and - * msg_ephemeris_glo_dep_a_t (legacy API) + * Encoded length of sbp_msg_ephemeris_glo_dep_a_t (V4 API) */ #define SBP_MSG_EPHEMERIS_GLO_DEP_A_ENCODED_LEN 112u -#define SBP_MSG_EPHEMERIS_SBAS_DEP_B 0x0084 /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_sbas_dep_b_t::pos (V4 API) or - * msg_ephemeris_sbas_dep_b_t::pos (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_ephemeris_sbas_dep_b_t::pos before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_SBAS_DEP_B_POS_MAX 3u /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_sbas_dep_b_t::vel (V4 API) or - * msg_ephemeris_sbas_dep_b_t::vel (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_ephemeris_sbas_dep_b_t::vel before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_SBAS_DEP_B_VEL_MAX 3u /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_sbas_dep_b_t::acc (V4 API) or - * msg_ephemeris_sbas_dep_b_t::acc (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_ephemeris_sbas_dep_b_t::acc before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_SBAS_DEP_B_ACC_MAX 3u /** - * Encoded length of sbp_msg_ephemeris_sbas_dep_b_t (V4 API) and - * msg_ephemeris_sbas_dep_b_t (legacy API) + * Encoded length of sbp_msg_ephemeris_sbas_dep_b_t (V4 API) */ #define SBP_MSG_EPHEMERIS_SBAS_DEP_B_ENCODED_LEN 110u -#define SBP_MSG_EPHEMERIS_SBAS 0x008C /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_sbas_t::pos (V4 API) or msg_ephemeris_sbas_t::pos (legacy - * API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_sbas_t::pos before the maximum SBP message size is exceeded */ #define SBP_MSG_EPHEMERIS_SBAS_POS_MAX 3u /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_sbas_t::vel (V4 API) or msg_ephemeris_sbas_t::vel (legacy - * API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_sbas_t::vel before the maximum SBP message size is exceeded */ #define SBP_MSG_EPHEMERIS_SBAS_VEL_MAX 3u /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_sbas_t::acc (V4 API) or msg_ephemeris_sbas_t::acc (legacy - * API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_sbas_t::acc before the maximum SBP message size is exceeded */ #define SBP_MSG_EPHEMERIS_SBAS_ACC_MAX 3u /** - * Encoded length of sbp_msg_ephemeris_sbas_t (V4 API) and - * msg_ephemeris_sbas_t (legacy API) + * Encoded length of sbp_msg_ephemeris_sbas_t (V4 API) */ #define SBP_MSG_EPHEMERIS_SBAS_ENCODED_LEN 74u -#define SBP_MSG_EPHEMERIS_GLO_DEP_B 0x0085 /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_glo_dep_b_t::pos (V4 API) or msg_ephemeris_glo_dep_b_t::pos - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_glo_dep_b_t::pos before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_GLO_DEP_B_POS_MAX 3u /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_glo_dep_b_t::vel (V4 API) or msg_ephemeris_glo_dep_b_t::vel - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_glo_dep_b_t::vel before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_GLO_DEP_B_VEL_MAX 3u /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_glo_dep_b_t::acc (V4 API) or msg_ephemeris_glo_dep_b_t::acc - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_glo_dep_b_t::acc before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_GLO_DEP_B_ACC_MAX 3u /** - * Encoded length of sbp_msg_ephemeris_glo_dep_b_t (V4 API) and - * msg_ephemeris_glo_dep_b_t (legacy API) + * Encoded length of sbp_msg_ephemeris_glo_dep_b_t (V4 API) */ #define SBP_MSG_EPHEMERIS_GLO_DEP_B_ENCODED_LEN 110u -#define SBP_MSG_EPHEMERIS_GLO_DEP_C 0x0087 /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_glo_dep_c_t::pos (V4 API) or msg_ephemeris_glo_dep_c_t::pos - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_glo_dep_c_t::pos before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_GLO_DEP_C_POS_MAX 3u /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_glo_dep_c_t::vel (V4 API) or msg_ephemeris_glo_dep_c_t::vel - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_glo_dep_c_t::vel before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_GLO_DEP_C_VEL_MAX 3u /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_glo_dep_c_t::acc (V4 API) or msg_ephemeris_glo_dep_c_t::acc - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_glo_dep_c_t::acc before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_GLO_DEP_C_ACC_MAX 3u /** - * Encoded length of sbp_msg_ephemeris_glo_dep_c_t (V4 API) and - * msg_ephemeris_glo_dep_c_t (legacy API) + * Encoded length of sbp_msg_ephemeris_glo_dep_c_t (V4 API) */ #define SBP_MSG_EPHEMERIS_GLO_DEP_C_ENCODED_LEN 119u -#define SBP_MSG_EPHEMERIS_GLO_DEP_D 0x0088 /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_glo_dep_d_t::pos (V4 API) or msg_ephemeris_glo_dep_d_t::pos - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_glo_dep_d_t::pos before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_GLO_DEP_D_POS_MAX 3u /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_glo_dep_d_t::vel (V4 API) or msg_ephemeris_glo_dep_d_t::vel - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_glo_dep_d_t::vel before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_GLO_DEP_D_VEL_MAX 3u /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_glo_dep_d_t::acc (V4 API) or msg_ephemeris_glo_dep_d_t::acc - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_glo_dep_d_t::acc before the maximum SBP message size is + * exceeded */ #define SBP_MSG_EPHEMERIS_GLO_DEP_D_ACC_MAX 3u /** - * Encoded length of sbp_msg_ephemeris_glo_dep_d_t (V4 API) and - * msg_ephemeris_glo_dep_d_t (legacy API) + * Encoded length of sbp_msg_ephemeris_glo_dep_d_t (V4 API) */ #define SBP_MSG_EPHEMERIS_GLO_DEP_D_ENCODED_LEN 120u -#define SBP_MSG_EPHEMERIS_GLO 0x008B /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_glo_t::pos (V4 API) or msg_ephemeris_glo_t::pos (legacy - * API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_glo_t::pos before the maximum SBP message size is exceeded */ #define SBP_MSG_EPHEMERIS_GLO_POS_MAX 3u /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_glo_t::vel (V4 API) or msg_ephemeris_glo_t::vel (legacy - * API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_glo_t::vel before the maximum SBP message size is exceeded */ #define SBP_MSG_EPHEMERIS_GLO_VEL_MAX 3u /** * The maximum number of items that can be stored in - * sbp_msg_ephemeris_glo_t::acc (V4 API) or msg_ephemeris_glo_t::acc (legacy - * API) before the maximum SBP message size is exceeded + * sbp_msg_ephemeris_glo_t::acc before the maximum SBP message size is exceeded */ #define SBP_MSG_EPHEMERIS_GLO_ACC_MAX 3u /** - * Encoded length of sbp_msg_ephemeris_glo_t (V4 API) and - * msg_ephemeris_glo_t (legacy API) + * Encoded length of sbp_msg_ephemeris_glo_t (V4 API) */ #define SBP_MSG_EPHEMERIS_GLO_ENCODED_LEN 92u -#define SBP_MSG_EPHEMERIS_DEP_D 0x0080 /** - * Encoded length of sbp_msg_ephemeris_dep_d_t (V4 API) and - * msg_ephemeris_dep_d_t (legacy API) + * Encoded length of sbp_msg_ephemeris_dep_d_t (V4 API) */ #define SBP_MSG_EPHEMERIS_DEP_D_ENCODED_LEN 185u -#define SBP_MSG_EPHEMERIS_DEP_A 0x001A /** - * Encoded length of sbp_msg_ephemeris_dep_a_t (V4 API) and - * msg_ephemeris_dep_a_t (legacy API) + * Encoded length of sbp_msg_ephemeris_dep_a_t (V4 API) */ #define SBP_MSG_EPHEMERIS_DEP_A_ENCODED_LEN 175u -#define SBP_MSG_EPHEMERIS_DEP_B 0x0046 /** - * Encoded length of sbp_msg_ephemeris_dep_b_t (V4 API) and - * msg_ephemeris_dep_b_t (legacy API) + * Encoded length of sbp_msg_ephemeris_dep_b_t (V4 API) */ #define SBP_MSG_EPHEMERIS_DEP_B_ENCODED_LEN 176u -#define SBP_MSG_EPHEMERIS_DEP_C 0x0047 /** - * Encoded length of sbp_msg_ephemeris_dep_c_t (V4 API) and - * msg_ephemeris_dep_c_t (legacy API) + * Encoded length of sbp_msg_ephemeris_dep_c_t (V4 API) */ #define SBP_MSG_EPHEMERIS_DEP_C_ENCODED_LEN 185u /** - * Encoded length of sbp_observation_header_dep_t (V4 API) and - * observation_header_dep_t (legacy API) + * Encoded length of sbp_observation_header_dep_t (V4 API) */ #define SBP_OBSERVATION_HEADER_DEP_ENCODED_LEN 7u /** - * Encoded length of sbp_carrier_phase_dep_a_t (V4 API) and - * carrier_phase_dep_a_t (legacy API) + * Encoded length of sbp_carrier_phase_dep_a_t (V4 API) */ #define SBP_CARRIER_PHASE_DEP_A_ENCODED_LEN 5u /** - * Encoded length of sbp_packed_obs_content_dep_a_t (V4 API) and - * packed_obs_content_dep_a_t (legacy API) + * Encoded length of sbp_packed_obs_content_dep_a_t (V4 API) */ #define SBP_PACKED_OBS_CONTENT_DEP_A_ENCODED_LEN 13u /** - * Encoded length of sbp_packed_obs_content_dep_b_t (V4 API) and - * packed_obs_content_dep_b_t (legacy API) + * Encoded length of sbp_packed_obs_content_dep_b_t (V4 API) */ #define SBP_PACKED_OBS_CONTENT_DEP_B_ENCODED_LEN 16u /** - * Encoded length of sbp_packed_obs_content_dep_c_t (V4 API) and - * packed_obs_content_dep_c_t (legacy API) + * Encoded length of sbp_packed_obs_content_dep_c_t (V4 API) */ #define SBP_PACKED_OBS_CONTENT_DEP_C_ENCODED_LEN 16u -#define SBP_MSG_OBS_DEP_A 0x0045 /** * The maximum number of items that can be stored in sbp_msg_obs_dep_a_t::obs - * (V4 API) or msg_obs_dep_a_t::obs (legacy API) before the maximum SBP message - * size is exceeded + * before the maximum SBP message size is exceeded */ #define SBP_MSG_OBS_DEP_A_OBS_MAX 19u /** - * Encoded length of sbp_msg_obs_dep_a_t (V4 API) and - * msg_obs_dep_a_t (legacy API) + * Encoded length of sbp_msg_obs_dep_a_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_obs_dep_a_encoded_len to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_OBS_DEP_A_ENCODED_OVERHEAD 7u -#define SBP_MSG_OBS_DEP_B 0x0043 /** * The maximum number of items that can be stored in sbp_msg_obs_dep_b_t::obs - * (V4 API) or msg_obs_dep_b_t::obs (legacy API) before the maximum SBP message - * size is exceeded + * before the maximum SBP message size is exceeded */ #define SBP_MSG_OBS_DEP_B_OBS_MAX 15u /** - * Encoded length of sbp_msg_obs_dep_b_t (V4 API) and - * msg_obs_dep_b_t (legacy API) + * Encoded length of sbp_msg_obs_dep_b_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_obs_dep_b_encoded_len to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_OBS_DEP_B_ENCODED_OVERHEAD 7u -#define SBP_MSG_OBS_DEP_C 0x0049 /** * The maximum number of items that can be stored in sbp_msg_obs_dep_c_t::obs - * (V4 API) or msg_obs_dep_c_t::obs (legacy API) before the maximum SBP message - * size is exceeded + * before the maximum SBP message size is exceeded */ #define SBP_MSG_OBS_DEP_C_OBS_MAX 15u /** - * Encoded length of sbp_msg_obs_dep_c_t (V4 API) and - * msg_obs_dep_c_t (legacy API) + * Encoded length of sbp_msg_obs_dep_c_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_obs_dep_c_encoded_len to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_OBS_DEP_C_ENCODED_OVERHEAD 7u -#define SBP_MSG_IONO 0x0090 /** - * Encoded length of sbp_msg_iono_t (V4 API) and - * msg_iono_t (legacy API) + * Encoded length of sbp_msg_iono_t (V4 API) */ #define SBP_MSG_IONO_ENCODED_LEN 70u -#define SBP_MSG_SV_CONFIGURATION_GPS_DEP 0x0091 /** - * Encoded length of sbp_msg_sv_configuration_gps_dep_t (V4 API) and - * msg_sv_configuration_gps_dep_t (legacy API) + * Encoded length of sbp_msg_sv_configuration_gps_dep_t (V4 API) */ #define SBP_MSG_SV_CONFIGURATION_GPS_DEP_ENCODED_LEN 10u /** - * Encoded length of sbp_gnss_capb_t (V4 API) and - * gnss_capb_t (legacy API) + * Encoded length of sbp_gnss_capb_t (V4 API) */ #define SBP_GNSS_CAPB_ENCODED_LEN 104u -#define SBP_MSG_GNSS_CAPB 0x0096 /** - * Encoded length of sbp_msg_gnss_capb_t (V4 API) and - * msg_gnss_capb_t (legacy API) + * Encoded length of sbp_msg_gnss_capb_t (V4 API) */ #define SBP_MSG_GNSS_CAPB_ENCODED_LEN 110u -#define SBP_MSG_GROUP_DELAY_DEP_A 0x0092 /** - * Encoded length of sbp_msg_group_delay_dep_a_t (V4 API) and - * msg_group_delay_dep_a_t (legacy API) + * Encoded length of sbp_msg_group_delay_dep_a_t (V4 API) */ #define SBP_MSG_GROUP_DELAY_DEP_A_ENCODED_LEN 14u -#define SBP_MSG_GROUP_DELAY_DEP_B 0x0093 /** - * Encoded length of sbp_msg_group_delay_dep_b_t (V4 API) and - * msg_group_delay_dep_b_t (legacy API) + * Encoded length of sbp_msg_group_delay_dep_b_t (V4 API) */ #define SBP_MSG_GROUP_DELAY_DEP_B_ENCODED_LEN 17u -#define SBP_MSG_GROUP_DELAY 0x0094 /** - * Encoded length of sbp_msg_group_delay_t (V4 API) and - * msg_group_delay_t (legacy API) + * Encoded length of sbp_msg_group_delay_t (V4 API) */ #define SBP_MSG_GROUP_DELAY_ENCODED_LEN 15u /** - * Encoded length of sbp_almanac_common_content_t (V4 API) and - * almanac_common_content_t (legacy API) + * Encoded length of sbp_almanac_common_content_t (V4 API) */ #define SBP_ALMANAC_COMMON_CONTENT_ENCODED_LEN 22u /** - * Encoded length of sbp_almanac_common_content_dep_t (V4 API) and - * almanac_common_content_dep_t (legacy API) + * Encoded length of sbp_almanac_common_content_dep_t (V4 API) */ #define SBP_ALMANAC_COMMON_CONTENT_DEP_ENCODED_LEN 24u -#define SBP_MSG_ALMANAC_GPS_DEP 0x0070 /** - * Encoded length of sbp_msg_almanac_gps_dep_t (V4 API) and - * msg_almanac_gps_dep_t (legacy API) + * Encoded length of sbp_msg_almanac_gps_dep_t (V4 API) */ #define SBP_MSG_ALMANAC_GPS_DEP_ENCODED_LEN 96u -#define SBP_MSG_ALMANAC_GPS 0x0072 /** - * Encoded length of sbp_msg_almanac_gps_t (V4 API) and - * msg_almanac_gps_t (legacy API) + * Encoded length of sbp_msg_almanac_gps_t (V4 API) */ #define SBP_MSG_ALMANAC_GPS_ENCODED_LEN 94u -#define SBP_MSG_ALMANAC_GLO_DEP 0x0071 /** - * Encoded length of sbp_msg_almanac_glo_dep_t (V4 API) and - * msg_almanac_glo_dep_t (legacy API) + * Encoded length of sbp_msg_almanac_glo_dep_t (V4 API) */ #define SBP_MSG_ALMANAC_GLO_DEP_ENCODED_LEN 80u -#define SBP_MSG_ALMANAC_GLO 0x0073 /** - * Encoded length of sbp_msg_almanac_glo_t (V4 API) and - * msg_almanac_glo_t (legacy API) + * Encoded length of sbp_msg_almanac_glo_t (V4 API) */ #define SBP_MSG_ALMANAC_GLO_ENCODED_LEN 78u -#define SBP_MSG_GLO_BIASES 0x0075 /** - * Encoded length of sbp_msg_glo_biases_t (V4 API) and - * msg_glo_biases_t (legacy API) + * Encoded length of sbp_msg_glo_biases_t (V4 API) */ #define SBP_MSG_GLO_BIASES_ENCODED_LEN 9u /** - * Encoded length of sbp_sv_az_el_t (V4 API) and - * sv_az_el_t (legacy API) + * Encoded length of sbp_sv_az_el_t (V4 API) */ #define SBP_SV_AZ_EL_ENCODED_LEN 4u -#define SBP_MSG_SV_AZ_EL 0x0097 /** * The maximum number of items that can be stored in sbp_msg_sv_az_el_t::azel - * (V4 API) or msg_sv_az_el_t::azel (legacy API) before the maximum SBP message - * size is exceeded + * before the maximum SBP message size is exceeded */ #define SBP_MSG_SV_AZ_EL_AZEL_MAX 63u /** - * Encoded length of sbp_msg_sv_az_el_t (V4 API) and - * msg_sv_az_el_t (legacy API) + * Encoded length of sbp_msg_sv_az_el_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_sv_az_el_encoded_len to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SV_AZ_EL_ENCODED_OVERHEAD 0u -#define SBP_MSG_OSR 0x0640 /** - * The maximum number of items that can be stored in sbp_msg_osr_t::obs (V4 API) - * or msg_osr_t::obs (legacy API) before the maximum SBP message size is - * exceeded + * The maximum number of items that can be stored in sbp_msg_osr_t::obs before + * the maximum SBP message size is exceeded */ #define SBP_MSG_OSR_OBS_MAX 12u /** - * Encoded length of sbp_msg_osr_t (V4 API) and - * msg_osr_t (legacy API) + * Encoded length of sbp_msg_osr_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_osr_encoded_len to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) diff --git a/c/include/libsbp/orientation_macros.h b/c/include/libsbp/orientation_macros.h index b29f3e9077..a73d21dd40 100644 --- a/c/include/libsbp/orientation_macros.h +++ b/c/include/libsbp/orientation_macros.h @@ -18,7 +18,6 @@ #ifndef LIBSBP_ORIENTATION_MACROS_H #define LIBSBP_ORIENTATION_MACROS_H -#define SBP_MSG_BASELINE_HEADING 0x020F #define SBP_BASELINE_HEADING_FIX_MODE_MASK (0x7u) #define SBP_BASELINE_HEADING_FIX_MODE_SHIFT (0u) #define SBP_BASELINE_HEADING_FIX_MODE_GET(flags) \ @@ -37,12 +36,10 @@ #define SBP_BASELINE_HEADING_FIX_MODE_FLOAT_RTK (3) #define SBP_BASELINE_HEADING_FIX_MODE_FIXED_RTK (4) /** - * Encoded length of sbp_msg_baseline_heading_t (V4 API) and - * msg_baseline_heading_t (legacy API) + * Encoded length of sbp_msg_baseline_heading_t (V4 API) */ #define SBP_MSG_BASELINE_HEADING_ENCODED_LEN 10u -#define SBP_MSG_ORIENT_QUAT 0x0220 #define SBP_ORIENT_QUAT_INS_NAVIGATION_MODE_MASK (0x7u) #define SBP_ORIENT_QUAT_INS_NAVIGATION_MODE_SHIFT (0u) #define SBP_ORIENT_QUAT_INS_NAVIGATION_MODE_GET(flags) \ @@ -60,12 +57,10 @@ #define SBP_ORIENT_QUAT_INS_NAVIGATION_MODE_INVALID (0) #define SBP_ORIENT_QUAT_INS_NAVIGATION_MODE_VALID (1) /** - * Encoded length of sbp_msg_orient_quat_t (V4 API) and - * msg_orient_quat_t (legacy API) + * Encoded length of sbp_msg_orient_quat_t (V4 API) */ #define SBP_MSG_ORIENT_QUAT_ENCODED_LEN 37u -#define SBP_MSG_ORIENT_EULER 0x0221 #define SBP_ORIENT_EULER_INS_NAVIGATION_MODE_MASK (0x7u) #define SBP_ORIENT_EULER_INS_NAVIGATION_MODE_SHIFT (0u) #define SBP_ORIENT_EULER_INS_NAVIGATION_MODE_GET(flags) \ @@ -83,12 +78,10 @@ #define SBP_ORIENT_EULER_INS_NAVIGATION_MODE_INVALID (0) #define SBP_ORIENT_EULER_INS_NAVIGATION_MODE_VALID (1) /** - * Encoded length of sbp_msg_orient_euler_t (V4 API) and - * msg_orient_euler_t (legacy API) + * Encoded length of sbp_msg_orient_euler_t (V4 API) */ #define SBP_MSG_ORIENT_EULER_ENCODED_LEN 29u -#define SBP_MSG_ANGULAR_RATE 0x0222 #define SBP_ANGULAR_RATE_INS_NAVIGATION_MODE_MASK (0x7u) #define SBP_ANGULAR_RATE_INS_NAVIGATION_MODE_SHIFT (0u) #define SBP_ANGULAR_RATE_INS_NAVIGATION_MODE_GET(flags) \ @@ -106,8 +99,7 @@ #define SBP_ANGULAR_RATE_INS_NAVIGATION_MODE_INVALID (0) #define SBP_ANGULAR_RATE_INS_NAVIGATION_MODE_VALID (1) /** - * Encoded length of sbp_msg_angular_rate_t (V4 API) and - * msg_angular_rate_t (legacy API) + * Encoded length of sbp_msg_angular_rate_t (V4 API) */ #define SBP_MSG_ANGULAR_RATE_ENCODED_LEN 17u diff --git a/c/include/libsbp/piksi/MSG_MASK_SATELLITE.h b/c/include/libsbp/piksi/MSG_MASK_SATELLITE.h index 79723a4e67..fc6796231a 100644 --- a/c/include/libsbp/piksi/MSG_MASK_SATELLITE.h +++ b/c/include/libsbp/piksi/MSG_MASK_SATELLITE.h @@ -53,7 +53,7 @@ typedef struct { /** * GNSS signal for which the mask is applied */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; } sbp_msg_mask_satellite_t; /** diff --git a/c/include/libsbp/piksi/MSG_SPECAN.h b/c/include/libsbp/piksi/MSG_SPECAN.h index 0e96299a0b..e5f6128c44 100644 --- a/c/include/libsbp/piksi/MSG_SPECAN.h +++ b/c/include/libsbp/piksi/MSG_SPECAN.h @@ -52,7 +52,7 @@ typedef struct { /** * Receiver time of this observation */ - sbp_v4_gps_time_t t; + sbp_gps_time_t t; /** * Reference frequency of this packet [MHz] diff --git a/c/include/libsbp/piksi_macros.h b/c/include/libsbp/piksi_macros.h index 651616a3c5..ecb761cd75 100644 --- a/c/include/libsbp/piksi_macros.h +++ b/c/include/libsbp/piksi_macros.h @@ -18,21 +18,16 @@ #ifndef LIBSBP_PIKSI_MACROS_H #define LIBSBP_PIKSI_MACROS_H -#define SBP_MSG_ALMANAC 0x0069 /** - * Encoded length of sbp_msg_almanac_t (V4 API) and - * msg_almanac_t (legacy API) + * Encoded length of sbp_msg_almanac_t (V4 API) */ #define SBP_MSG_ALMANAC_ENCODED_LEN 0u -#define SBP_MSG_SET_TIME 0x0068 /** - * Encoded length of sbp_msg_set_time_t (V4 API) and - * msg_set_time_t (legacy API) + * Encoded length of sbp_msg_set_time_t (V4 API) */ #define SBP_MSG_SET_TIME_ENCODED_LEN 0u -#define SBP_MSG_RESET 0x00B6 #define SBP_RESET_DEFAULT_SETTINGS_MASK (0x1u) #define SBP_RESET_DEFAULT_SETTINGS_SHIFT (0u) #define SBP_RESET_DEFAULT_SETTINGS_GET(flags) \ @@ -49,33 +44,25 @@ #define SBP_RESET_DEFAULT_SETTINGS_PRESERVE_EXISTING_SETTINGS (0) #define SBP_RESET_DEFAULT_SETTINGS_RESORE_DEFAULT_SETTINGS (1) /** - * Encoded length of sbp_msg_reset_t (V4 API) and - * msg_reset_t (legacy API) + * Encoded length of sbp_msg_reset_t (V4 API) */ #define SBP_MSG_RESET_ENCODED_LEN 4u -#define SBP_MSG_RESET_DEP 0x00B2 /** - * Encoded length of sbp_msg_reset_dep_t (V4 API) and - * msg_reset_dep_t (legacy API) + * Encoded length of sbp_msg_reset_dep_t (V4 API) */ #define SBP_MSG_RESET_DEP_ENCODED_LEN 0u -#define SBP_MSG_CW_RESULTS 0x00C0 /** - * Encoded length of sbp_msg_cw_results_t (V4 API) and - * msg_cw_results_t (legacy API) + * Encoded length of sbp_msg_cw_results_t (V4 API) */ #define SBP_MSG_CW_RESULTS_ENCODED_LEN 0u -#define SBP_MSG_CW_START 0x00C1 /** - * Encoded length of sbp_msg_cw_start_t (V4 API) and - * msg_cw_start_t (legacy API) + * Encoded length of sbp_msg_cw_start_t (V4 API) */ #define SBP_MSG_CW_START_ENCODED_LEN 0u -#define SBP_MSG_RESET_FILTERS 0x0022 #define SBP_RESET_FILTERS_FILTER_OR_PROCESS_TO_RESET_MASK (0x3u) #define SBP_RESET_FILTERS_FILTER_OR_PROCESS_TO_RESET_SHIFT (0u) #define SBP_RESET_FILTERS_FILTER_OR_PROCESS_TO_RESET_GET(flags) \ @@ -94,72 +81,56 @@ #define SBP_RESET_FILTERS_FILTER_OR_PROCESS_TO_RESET_IAR_PROCESS (1) #define SBP_RESET_FILTERS_FILTER_OR_PROCESS_TO_RESET_INERTIAL_FILTER (2) /** - * Encoded length of sbp_msg_reset_filters_t (V4 API) and - * msg_reset_filters_t (legacy API) + * Encoded length of sbp_msg_reset_filters_t (V4 API) */ #define SBP_MSG_RESET_FILTERS_ENCODED_LEN 1u -#define SBP_MSG_INIT_BASE_DEP 0x0023 /** - * Encoded length of sbp_msg_init_base_dep_t (V4 API) and - * msg_init_base_dep_t (legacy API) + * Encoded length of sbp_msg_init_base_dep_t (V4 API) */ #define SBP_MSG_INIT_BASE_DEP_ENCODED_LEN 0u -#define SBP_MSG_THREAD_STATE 0x0017 /** * The maximum number of items that can be stored in - * sbp_msg_thread_state_t::name (V4 API) or msg_thread_state_t::name (legacy - * API) before the maximum SBP message size is exceeded + * sbp_msg_thread_state_t::name before the maximum SBP message size is exceeded */ #define SBP_MSG_THREAD_STATE_NAME_MAX 20u /** - * Encoded length of sbp_msg_thread_state_t (V4 API) and - * msg_thread_state_t (legacy API) + * Encoded length of sbp_msg_thread_state_t (V4 API) */ #define SBP_MSG_THREAD_STATE_ENCODED_LEN 26u /** - * Encoded length of sbp_uart_channel_t (V4 API) and - * uart_channel_t (legacy API) + * Encoded length of sbp_uart_channel_t (V4 API) */ #define SBP_UART_CHANNEL_ENCODED_LEN 14u /** - * Encoded length of sbp_period_t (V4 API) and - * period_t (legacy API) + * Encoded length of sbp_period_t (V4 API) */ #define SBP_PERIOD_ENCODED_LEN 16u /** - * Encoded length of sbp_latency_t (V4 API) and - * latency_t (legacy API) + * Encoded length of sbp_latency_t (V4 API) */ #define SBP_LATENCY_ENCODED_LEN 16u -#define SBP_MSG_UART_STATE 0x001D /** - * Encoded length of sbp_msg_uart_state_t (V4 API) and - * msg_uart_state_t (legacy API) + * Encoded length of sbp_msg_uart_state_t (V4 API) */ #define SBP_MSG_UART_STATE_ENCODED_LEN 74u -#define SBP_MSG_UART_STATE_DEPA 0x0018 /** - * Encoded length of sbp_msg_uart_state_depa_t (V4 API) and - * msg_uart_state_depa_t (legacy API) + * Encoded length of sbp_msg_uart_state_depa_t (V4 API) */ #define SBP_MSG_UART_STATE_DEPA_ENCODED_LEN 58u -#define SBP_MSG_IAR_STATE 0x0019 /** - * Encoded length of sbp_msg_iar_state_t (V4 API) and - * msg_iar_state_t (legacy API) + * Encoded length of sbp_msg_iar_state_t (V4 API) */ #define SBP_MSG_IAR_STATE_ENCODED_LEN 4u -#define SBP_MSG_MASK_SATELLITE 0x002B #define SBP_MASK_SATELLITE_TRACKING_CHANNELS_MASK (0x1u) #define SBP_MASK_SATELLITE_TRACKING_CHANNELS_SHIFT (1u) #define SBP_MASK_SATELLITE_TRACKING_CHANNELS_GET(flags) \ @@ -195,12 +166,10 @@ #define SBP_MASK_SATELLITE_ACQUISITION_CHANNEL_SKIP_THIS_SATELLITE_ON_FUTURE_ACQUISITIONS \ (1) /** - * Encoded length of sbp_msg_mask_satellite_t (V4 API) and - * msg_mask_satellite_t (legacy API) + * Encoded length of sbp_msg_mask_satellite_t (V4 API) */ #define SBP_MSG_MASK_SATELLITE_ENCODED_LEN 3u -#define SBP_MSG_MASK_SATELLITE_DEP 0x001B #define SBP_MASK_SATELLITE_DEP_TRACKING_CHANNELS_MASK (0x1u) #define SBP_MASK_SATELLITE_DEP_TRACKING_CHANNELS_SHIFT (1u) #define SBP_MASK_SATELLITE_DEP_TRACKING_CHANNELS_GET(flags) \ @@ -236,100 +205,83 @@ #define SBP_MASK_SATELLITE_DEP_ACQUISITION_CHANNEL_SKIP_THIS_SATELLITE_ON_FUTURE_ACQUISITIONS \ (1) /** - * Encoded length of sbp_msg_mask_satellite_dep_t (V4 API) and - * msg_mask_satellite_dep_t (legacy API) + * Encoded length of sbp_msg_mask_satellite_dep_t (V4 API) */ #define SBP_MSG_MASK_SATELLITE_DEP_ENCODED_LEN 5u -#define SBP_MSG_DEVICE_MONITOR 0x00B5 /** - * Encoded length of sbp_msg_device_monitor_t (V4 API) and - * msg_device_monitor_t (legacy API) + * Encoded length of sbp_msg_device_monitor_t (V4 API) */ #define SBP_MSG_DEVICE_MONITOR_ENCODED_LEN 10u -#define SBP_MSG_COMMAND_REQ 0x00B8 /** * The maximum number of items that can be stored in - * sbp_msg_command_req_t::command (V4 API) or msg_command_req_t::command (legacy - * API) before the maximum SBP message size is exceeded + * sbp_msg_command_req_t::command before the maximum SBP message size is + * exceeded */ #define SBP_MSG_COMMAND_REQ_COMMAND_MAX 251u /** - * Encoded length of sbp_msg_command_req_t (V4 API) and - * msg_command_req_t (legacy API) + * Encoded length of sbp_msg_command_req_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_command_req_encoded_len to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_COMMAND_REQ_ENCODED_OVERHEAD 4u -#define SBP_MSG_COMMAND_RESP 0x00B9 /** - * Encoded length of sbp_msg_command_resp_t (V4 API) and - * msg_command_resp_t (legacy API) + * Encoded length of sbp_msg_command_resp_t (V4 API) */ #define SBP_MSG_COMMAND_RESP_ENCODED_LEN 8u -#define SBP_MSG_COMMAND_OUTPUT 0x00BC /** * The maximum number of items that can be stored in - * sbp_msg_command_output_t::line (V4 API) or msg_command_output_t::line (legacy - * API) before the maximum SBP message size is exceeded + * sbp_msg_command_output_t::line before the maximum SBP message size is + * exceeded */ #define SBP_MSG_COMMAND_OUTPUT_LINE_MAX 251u /** - * Encoded length of sbp_msg_command_output_t (V4 API) and - * msg_command_output_t (legacy API) + * Encoded length of sbp_msg_command_output_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_command_output_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_COMMAND_OUTPUT_ENCODED_OVERHEAD 4u -#define SBP_MSG_NETWORK_STATE_REQ 0x00BA /** - * Encoded length of sbp_msg_network_state_req_t (V4 API) and - * msg_network_state_req_t (legacy API) + * Encoded length of sbp_msg_network_state_req_t (V4 API) */ #define SBP_MSG_NETWORK_STATE_REQ_ENCODED_LEN 0u -#define SBP_MSG_NETWORK_STATE_RESP 0x00BB /** * The maximum number of items that can be stored in - * sbp_msg_network_state_resp_t::ipv4_address (V4 API) or - * msg_network_state_resp_t::ipv4_address (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_network_state_resp_t::ipv4_address before the maximum SBP message + * size is exceeded */ #define SBP_MSG_NETWORK_STATE_RESP_IPV4_ADDRESS_MAX 4u /** * The maximum number of items that can be stored in - * sbp_msg_network_state_resp_t::ipv6_address (V4 API) or - * msg_network_state_resp_t::ipv6_address (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_network_state_resp_t::ipv6_address before the maximum SBP message + * size is exceeded */ #define SBP_MSG_NETWORK_STATE_RESP_IPV6_ADDRESS_MAX 16u /** * The maximum number of items that can be stored in - * sbp_msg_network_state_resp_t::interface_name (V4 API) or - * msg_network_state_resp_t::interface_name (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_network_state_resp_t::interface_name before the maximum SBP message + * size is exceeded */ #define SBP_MSG_NETWORK_STATE_RESP_INTERFACE_NAME_MAX 16u @@ -662,138 +614,118 @@ } while (0) /** - * Encoded length of sbp_msg_network_state_resp_t (V4 API) and - * msg_network_state_resp_t (legacy API) + * Encoded length of sbp_msg_network_state_resp_t (V4 API) */ #define SBP_MSG_NETWORK_STATE_RESP_ENCODED_LEN 50u /** * The maximum number of items that can be stored in - * sbp_network_usage_t::interface_name (V4 API) or - * network_usage_t::interface_name (legacy API) before the maximum SBP message - * size is exceeded + * sbp_network_usage_t::interface_name before the maximum SBP message size is + * exceeded */ #define SBP_NETWORK_USAGE_INTERFACE_NAME_MAX 16u /** - * Encoded length of sbp_network_usage_t (V4 API) and - * network_usage_t (legacy API) + * Encoded length of sbp_network_usage_t (V4 API) */ #define SBP_NETWORK_USAGE_ENCODED_LEN 40u -#define SBP_MSG_NETWORK_BANDWIDTH_USAGE 0x00BD /** * The maximum number of items that can be stored in - * sbp_msg_network_bandwidth_usage_t::interfaces (V4 API) or - * msg_network_bandwidth_usage_t::interfaces (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_network_bandwidth_usage_t::interfaces before the maximum SBP message + * size is exceeded */ #define SBP_MSG_NETWORK_BANDWIDTH_USAGE_INTERFACES_MAX 6u /** - * Encoded length of sbp_msg_network_bandwidth_usage_t (V4 API) and - * msg_network_bandwidth_usage_t (legacy API) + * Encoded length of sbp_msg_network_bandwidth_usage_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_network_bandwidth_usage_encoded_len to determine the actual size of - * an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_NETWORK_BANDWIDTH_USAGE_ENCODED_OVERHEAD 0u -#define SBP_MSG_CELL_MODEM_STATUS 0x00BE /** * The maximum number of items that can be stored in - * sbp_msg_cell_modem_status_t::reserved (V4 API) or - * msg_cell_modem_status_t::reserved (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_cell_modem_status_t::reserved before the maximum SBP message size is + * exceeded */ #define SBP_MSG_CELL_MODEM_STATUS_RESERVED_MAX 250u /** - * Encoded length of sbp_msg_cell_modem_status_t (V4 API) and - * msg_cell_modem_status_t (legacy API) + * Encoded length of sbp_msg_cell_modem_status_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_cell_modem_status_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_CELL_MODEM_STATUS_ENCODED_OVERHEAD 5u -#define SBP_MSG_SPECAN_DEP 0x0050 /** * The maximum number of items that can be stored in - * sbp_msg_specan_dep_t::amplitude_value (V4 API) or - * msg_specan_dep_t::amplitude_value (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_specan_dep_t::amplitude_value before the maximum SBP message size is + * exceeded */ #define SBP_MSG_SPECAN_DEP_AMPLITUDE_VALUE_MAX 231u /** - * Encoded length of sbp_msg_specan_dep_t (V4 API) and - * msg_specan_dep_t (legacy API) + * Encoded length of sbp_msg_specan_dep_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_specan_dep_encoded_len to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SPECAN_DEP_ENCODED_OVERHEAD 24u -#define SBP_MSG_SPECAN 0x0051 /** * The maximum number of items that can be stored in - * sbp_msg_specan_t::amplitude_value (V4 API) or msg_specan_t::amplitude_value - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_specan_t::amplitude_value before the maximum SBP message size is + * exceeded */ #define SBP_MSG_SPECAN_AMPLITUDE_VALUE_MAX 227u /** - * Encoded length of sbp_msg_specan_t (V4 API) and - * msg_specan_t (legacy API) + * Encoded length of sbp_msg_specan_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_specan_encoded_len to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SPECAN_ENCODED_OVERHEAD 28u -#define SBP_MSG_FRONT_END_GAIN 0x00BF /** * The maximum number of items that can be stored in - * sbp_msg_front_end_gain_t::rf_gain (V4 API) or msg_front_end_gain_t::rf_gain - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_front_end_gain_t::rf_gain before the maximum SBP message size is + * exceeded */ #define SBP_MSG_FRONT_END_GAIN_RF_GAIN_MAX 8u /** * The maximum number of items that can be stored in - * sbp_msg_front_end_gain_t::if_gain (V4 API) or msg_front_end_gain_t::if_gain - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_front_end_gain_t::if_gain before the maximum SBP message size is + * exceeded */ #define SBP_MSG_FRONT_END_GAIN_IF_GAIN_MAX 8u /** - * Encoded length of sbp_msg_front_end_gain_t (V4 API) and - * msg_front_end_gain_t (legacy API) + * Encoded length of sbp_msg_front_end_gain_t (V4 API) */ #define SBP_MSG_FRONT_END_GAIN_ENCODED_LEN 16u diff --git a/c/include/libsbp/profiling_macros.h b/c/include/libsbp/profiling_macros.h index fa418c76e0..4f9c7c6afd 100644 --- a/c/include/libsbp/profiling_macros.h +++ b/c/include/libsbp/profiling_macros.h @@ -18,23 +18,20 @@ #ifndef LIBSBP_PROFILING_MACROS_H #define LIBSBP_PROFILING_MACROS_H -#define SBP_MSG_MEASUREMENT_POINT 0xCF00 /** * The maximum number of items that can be stored in - * sbp_msg_measurement_point_t::func (V4 API) or msg_measurement_point_t::func - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_measurement_point_t::func before the maximum SBP message size is + * exceeded */ #define SBP_MSG_MEASUREMENT_POINT_FUNC_MAX 215u /** - * Encoded length of sbp_msg_measurement_point_t (V4 API) and - * msg_measurement_point_t (legacy API) + * Encoded length of sbp_msg_measurement_point_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_measurement_point_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) diff --git a/c/include/libsbp/sbas/MSG_SBAS_RAW.h b/c/include/libsbp/sbas/MSG_SBAS_RAW.h index 23b0c01d1e..9b4d7ea797 100644 --- a/c/include/libsbp/sbas/MSG_SBAS_RAW.h +++ b/c/include/libsbp/sbas/MSG_SBAS_RAW.h @@ -48,7 +48,7 @@ typedef struct { /** * GNSS signal identifier. */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; /** * GPS time-of-week at the start of the data block. [ms] diff --git a/c/include/libsbp/sbas_macros.h b/c/include/libsbp/sbas_macros.h index 1457e8dd7e..5e6f89210e 100644 --- a/c/include/libsbp/sbas_macros.h +++ b/c/include/libsbp/sbas_macros.h @@ -18,17 +18,14 @@ #ifndef LIBSBP_SBAS_MACROS_H #define LIBSBP_SBAS_MACROS_H -#define SBP_MSG_SBAS_RAW 0x7777 /** * The maximum number of items that can be stored in sbp_msg_sbas_raw_t::data - * (V4 API) or msg_sbas_raw_t::data (legacy API) before the maximum SBP message - * size is exceeded + * before the maximum SBP message size is exceeded */ #define SBP_MSG_SBAS_RAW_DATA_MAX 27u /** - * Encoded length of sbp_msg_sbas_raw_t (V4 API) and - * msg_sbas_raw_t (legacy API) + * Encoded length of sbp_msg_sbas_raw_t (V4 API) */ #define SBP_MSG_SBAS_RAW_ENCODED_LEN 34u diff --git a/c/include/libsbp/sbp.h b/c/include/libsbp/sbp.h index dcbdc260d2..3a5db9e35d 100644 --- a/c/include/libsbp/sbp.h +++ b/c/include/libsbp/sbp.h @@ -14,7 +14,6 @@ #define LIBSBP_SBP_H #include -#include #include #include @@ -74,39 +73,8 @@ extern "C" { /** Get message payload pointer from frame */ #define SBP_FRAME_MSG_PAYLOAD(frame_ptr) (&((frame_ptr)[SBP_FRAME_OFFSET_MSG])) -typedef void (*sbp_decoded_callback_t)(u16 sender_id, sbp_msg_type_t msg_type, const sbp_msg_t *msg, void *context); +typedef void (*sbp_callback_t)(u16 sender_id, sbp_msg_type_t msg_type, const sbp_msg_t *msg, void *context); -/** SBP callback function prototype definitions. */ -typedef union { - sbp_msg_callback_t msg; - sbp_frame_callback_t frame; - sbp_decoded_callback_t decoded; -} sbp_callback_t; - -/** SBP callback type enum: - * SBP_PAYLOAD_CALLBACK are the original callbacks in libsbp without framing args - * SBP_FRAME_CALLBACK are raw frame callbacks that include framing data as args. - * SBP_DECODED_CALLBACK are callbacks which receive decoded (ie, not raw) messages - * - * This enum is stored on each sbp_msg_callback_node struct to identify how - * to cast the callback function pointer stored within. - * - * SBP_PAYLOAD_CALLBACK and SBP_FRAME_CALLBACK are part of the legacy libsbp API. They - * are both deprecated and should not be used in new code. SBP_DECODED_CALLBACK should - * be used for all new development. - */ -enum sbp_cb_type { - SBP_MSG_CALLBACK = 0, - SBP_FRAME_CALLBACK = 1, - SBP_DECODED_CALLBACK = 2, - SBP_CALLBACK_TYPE_COUNT = 3, -}; - -#define SBP_CALLBACK_FLAG(cb_type) (1u << (cb_type)) -#define SBP_CALLBACK_ALL_MASK \ - ((SBP_CALLBACK_FLAG(SBP_CALLBACK_TYPE_COUNT)) - 1) - -typedef enum sbp_cb_type sbp_cb_type; /** SBP callback node. * Forms a linked list of callbacks. * \note Must be statically allocated for use with sbp_register_callback() @@ -117,7 +85,6 @@ struct sbp_msg_callbacks_node { sbp_callback_t cb; /**< Pointer to callback function. */ void *context; /**< Pointer to a context */ struct sbp_msg_callbacks_node *next; /**< Pointer to next node in list. */ - sbp_cb_type cb_type; /**< Enum that holds the type of callback. */ }; /** State structure for processing SBP messages. */ @@ -150,9 +117,9 @@ SBP_EXPORT void sbp_state_init(sbp_state_t *s); SBP_EXPORT void sbp_state_set_io_context(sbp_state_t *s, void* context); SBP_EXPORT s8 sbp_process(sbp_state_t *s, sbp_read_fn_t read); -SBP_EXPORT s8 sbp_callback_register(sbp_state_t* s, sbp_msg_type_t msg_type, sbp_decoded_callback_t cb, void* context, +SBP_EXPORT s8 sbp_callback_register(sbp_state_t* s, sbp_msg_type_t msg_type, sbp_callback_t cb, void* context, sbp_msg_callbacks_node_t *node); -SBP_EXPORT s8 sbp_all_message_callback_register(sbp_state_t *s, sbp_decoded_callback_t cb, void* context, +SBP_EXPORT s8 sbp_all_message_callback_register(sbp_state_t *s, sbp_callback_t cb, void* context, sbp_msg_callbacks_node_t *node); SBP_EXPORT s8 sbp_message_process(sbp_state_t *s, u16 sender_id, sbp_msg_type_t msg_type, const sbp_msg_t *msg); SBP_EXPORT s8 sbp_message_send(sbp_state_t *s, sbp_msg_type_t msg_type, u16 sender_id, const sbp_msg_t *msg, diff --git a/c/include/libsbp/sbp_msg.h b/c/include/libsbp/sbp_msg.h index cd7b589dd9..7348322dc1 100644 --- a/c/include/libsbp/sbp_msg.h +++ b/c/include/libsbp/sbp_msg.h @@ -15,8 +15,8 @@ * with generate.py. Please do not hand edit! *****************************************************************************/ -#ifndef LIBSBP_V4_SBP_MSG_H -#define LIBSBP_V4_SBP_MSG_H +#ifndef LIBSBP_SBP_MSG_H +#define LIBSBP_SBP_MSG_H #include #include @@ -2777,4 +2777,4 @@ static inline int sbp_message_cmp(sbp_msg_type_t msg_type, const sbp_msg_t *a, } #endif -#endif /* LIBSBP_V4_SBP_MSG_H */ +#endif /* LIBSBP_SBP_MSG_H */ diff --git a/c/include/libsbp/sbp_msg_type.h b/c/include/libsbp/sbp_msg_type.h index b582a78a9b..9cb1d85180 100644 --- a/c/include/libsbp/sbp_msg_type.h +++ b/c/include/libsbp/sbp_msg_type.h @@ -50,248 +50,243 @@ extern "C" { #endif -/** SBP_MSG_ID to use to register frame callback for ALL messages. */ -#define SBP_MSG_ALL 0 - typedef enum { - SbpMsgAcknowledge = SBP_MSG_ACKNOWLEDGE, - SbpMsgAcqResultDepA = SBP_MSG_ACQ_RESULT_DEP_A, - SbpMsgAcqResultDepB = SBP_MSG_ACQ_RESULT_DEP_B, - SbpMsgAcqResultDepC = SBP_MSG_ACQ_RESULT_DEP_C, - SbpMsgAcqResult = SBP_MSG_ACQ_RESULT, - SbpMsgAcqSvProfileDep = SBP_MSG_ACQ_SV_PROFILE_DEP, - SbpMsgAcqSvProfile = SBP_MSG_ACQ_SV_PROFILE, - SbpMsgAgeCorrections = SBP_MSG_AGE_CORRECTIONS, - SbpMsgAlmanacGloDep = SBP_MSG_ALMANAC_GLO_DEP, - SbpMsgAlmanacGlo = SBP_MSG_ALMANAC_GLO, - SbpMsgAlmanacGpsDep = SBP_MSG_ALMANAC_GPS_DEP, - SbpMsgAlmanacGps = SBP_MSG_ALMANAC_GPS, - SbpMsgAlmanac = SBP_MSG_ALMANAC, - SbpMsgAngularRate = SBP_MSG_ANGULAR_RATE, - SbpMsgBasePosEcef = SBP_MSG_BASE_POS_ECEF, - SbpMsgBasePosLlh = SBP_MSG_BASE_POS_LLH, - SbpMsgBaselineEcefDepA = SBP_MSG_BASELINE_ECEF_DEP_A, - SbpMsgBaselineEcef = SBP_MSG_BASELINE_ECEF, - SbpMsgBaselineHeadingDepA = SBP_MSG_BASELINE_HEADING_DEP_A, - SbpMsgBaselineHeading = SBP_MSG_BASELINE_HEADING, - SbpMsgBaselineNedDepA = SBP_MSG_BASELINE_NED_DEP_A, - SbpMsgBaselineNed = SBP_MSG_BASELINE_NED, - SbpMsgBootloaderHandshakeDepA = SBP_MSG_BOOTLOADER_HANDSHAKE_DEP_A, - SbpMsgBootloaderHandshakeReq = SBP_MSG_BOOTLOADER_HANDSHAKE_REQ, - SbpMsgBootloaderHandshakeResp = SBP_MSG_BOOTLOADER_HANDSHAKE_RESP, - SbpMsgBootloaderJumpToApp = SBP_MSG_BOOTLOADER_JUMP_TO_APP, - SbpMsgCellModemStatus = SBP_MSG_CELL_MODEM_STATUS, - SbpMsgCertificateChainDep = SBP_MSG_CERTIFICATE_CHAIN_DEP, - SbpMsgCertificateChain = SBP_MSG_CERTIFICATE_CHAIN, - SbpMsgCommandOutput = SBP_MSG_COMMAND_OUTPUT, - SbpMsgCommandReq = SBP_MSG_COMMAND_REQ, - SbpMsgCommandResp = SBP_MSG_COMMAND_RESP, - SbpMsgCsacTelemetryLabels = SBP_MSG_CSAC_TELEMETRY_LABELS, - SbpMsgCsacTelemetry = SBP_MSG_CSAC_TELEMETRY, - SbpMsgCwResults = SBP_MSG_CW_RESULTS, - SbpMsgCwStart = SBP_MSG_CW_START, - SbpMsgDeviceMonitor = SBP_MSG_DEVICE_MONITOR, - SbpMsgDgnssStatus = SBP_MSG_DGNSS_STATUS, - SbpMsgDopsDepA = SBP_MSG_DOPS_DEP_A, - SbpMsgDops = SBP_MSG_DOPS, - SbpMsgEcdsaCertificate = SBP_MSG_ECDSA_CERTIFICATE, - SbpMsgEcdsaSignatureDepA = SBP_MSG_ECDSA_SIGNATURE_DEP_A, - SbpMsgEcdsaSignatureDepB = SBP_MSG_ECDSA_SIGNATURE_DEP_B, - SbpMsgEcdsaSignature = SBP_MSG_ECDSA_SIGNATURE, - SbpMsgEd25519CertificateDep = SBP_MSG_ED25519_CERTIFICATE_DEP, - SbpMsgEd25519SignatureDepA = SBP_MSG_ED25519_SIGNATURE_DEP_A, - SbpMsgEd25519SignatureDepB = SBP_MSG_ED25519_SIGNATURE_DEP_B, - SbpMsgEphemerisBds = SBP_MSG_EPHEMERIS_BDS, - SbpMsgEphemerisDepA = SBP_MSG_EPHEMERIS_DEP_A, - SbpMsgEphemerisDepB = SBP_MSG_EPHEMERIS_DEP_B, - SbpMsgEphemerisDepC = SBP_MSG_EPHEMERIS_DEP_C, - SbpMsgEphemerisDepD = SBP_MSG_EPHEMERIS_DEP_D, - SbpMsgEphemerisGalDepA = SBP_MSG_EPHEMERIS_GAL_DEP_A, - SbpMsgEphemerisGal = SBP_MSG_EPHEMERIS_GAL, - SbpMsgEphemerisGloDepA = SBP_MSG_EPHEMERIS_GLO_DEP_A, - SbpMsgEphemerisGloDepB = SBP_MSG_EPHEMERIS_GLO_DEP_B, - SbpMsgEphemerisGloDepC = SBP_MSG_EPHEMERIS_GLO_DEP_C, - SbpMsgEphemerisGloDepD = SBP_MSG_EPHEMERIS_GLO_DEP_D, - SbpMsgEphemerisGlo = SBP_MSG_EPHEMERIS_GLO, - SbpMsgEphemerisGpsDepE = SBP_MSG_EPHEMERIS_GPS_DEP_E, - SbpMsgEphemerisGpsDepF = SBP_MSG_EPHEMERIS_GPS_DEP_F, - SbpMsgEphemerisGps = SBP_MSG_EPHEMERIS_GPS, - SbpMsgEphemerisQzss = SBP_MSG_EPHEMERIS_QZSS, - SbpMsgEphemerisSbasDepA = SBP_MSG_EPHEMERIS_SBAS_DEP_A, - SbpMsgEphemerisSbasDepB = SBP_MSG_EPHEMERIS_SBAS_DEP_B, - SbpMsgEphemerisSbas = SBP_MSG_EPHEMERIS_SBAS, - SbpMsgExtEvent = SBP_MSG_EXT_EVENT, - SbpMsgFileioConfigReq = SBP_MSG_FILEIO_CONFIG_REQ, - SbpMsgFileioConfigResp = SBP_MSG_FILEIO_CONFIG_RESP, - SbpMsgFileioReadDirReq = SBP_MSG_FILEIO_READ_DIR_REQ, - SbpMsgFileioReadDirResp = SBP_MSG_FILEIO_READ_DIR_RESP, - SbpMsgFileioReadReq = SBP_MSG_FILEIO_READ_REQ, - SbpMsgFileioReadResp = SBP_MSG_FILEIO_READ_RESP, - SbpMsgFileioRemove = SBP_MSG_FILEIO_REMOVE, - SbpMsgFileioWriteReq = SBP_MSG_FILEIO_WRITE_REQ, - SbpMsgFileioWriteResp = SBP_MSG_FILEIO_WRITE_RESP, - SbpMsgFlashDone = SBP_MSG_FLASH_DONE, - SbpMsgFlashErase = SBP_MSG_FLASH_ERASE, - SbpMsgFlashProgram = SBP_MSG_FLASH_PROGRAM, - SbpMsgFlashReadReq = SBP_MSG_FLASH_READ_REQ, - SbpMsgFlashReadResp = SBP_MSG_FLASH_READ_RESP, - SbpMsgFrontEndGain = SBP_MSG_FRONT_END_GAIN, - SbpMsgFwd = SBP_MSG_FWD, - SbpMsgGloBiases = SBP_MSG_GLO_BIASES, - SbpMsgGnssCapb = SBP_MSG_GNSS_CAPB, - SbpMsgGnssTimeOffset = SBP_MSG_GNSS_TIME_OFFSET, - SbpMsgGpsTimeDepA = SBP_MSG_GPS_TIME_DEP_A, - SbpMsgGpsTimeGnss = SBP_MSG_GPS_TIME_GNSS, - SbpMsgGpsTime = SBP_MSG_GPS_TIME, - SbpMsgGroupDelayDepA = SBP_MSG_GROUP_DELAY_DEP_A, - SbpMsgGroupDelayDepB = SBP_MSG_GROUP_DELAY_DEP_B, - SbpMsgGroupDelay = SBP_MSG_GROUP_DELAY, - SbpMsgGroupMeta = SBP_MSG_GROUP_META, - SbpMsgHeartbeat = SBP_MSG_HEARTBEAT, - SbpMsgIarState = SBP_MSG_IAR_STATE, - SbpMsgImuAux = SBP_MSG_IMU_AUX, - SbpMsgImuRaw = SBP_MSG_IMU_RAW, - SbpMsgInitBaseDep = SBP_MSG_INIT_BASE_DEP, - SbpMsgInsStatus = SBP_MSG_INS_STATUS, - SbpMsgInsUpdates = SBP_MSG_INS_UPDATES, - SbpMsgIono = SBP_MSG_IONO, - SbpMsgLinuxCpuStateDepA = SBP_MSG_LINUX_CPU_STATE_DEP_A, - SbpMsgLinuxCpuState = SBP_MSG_LINUX_CPU_STATE, - SbpMsgLinuxMemStateDepA = SBP_MSG_LINUX_MEM_STATE_DEP_A, - SbpMsgLinuxMemState = SBP_MSG_LINUX_MEM_STATE, - SbpMsgLinuxProcessFdCount = SBP_MSG_LINUX_PROCESS_FD_COUNT, - SbpMsgLinuxProcessFdSummary = SBP_MSG_LINUX_PROCESS_FD_SUMMARY, - SbpMsgLinuxProcessSocketCounts = SBP_MSG_LINUX_PROCESS_SOCKET_COUNTS, - SbpMsgLinuxProcessSocketQueues = SBP_MSG_LINUX_PROCESS_SOCKET_QUEUES, - SbpMsgLinuxSocketUsage = SBP_MSG_LINUX_SOCKET_USAGE, - SbpMsgLinuxSysStateDepA = SBP_MSG_LINUX_SYS_STATE_DEP_A, - SbpMsgLinuxSysState = SBP_MSG_LINUX_SYS_STATE, - SbpMsgLog = SBP_MSG_LOG, - SbpMsgM25FlashWriteStatus = SBP_MSG_M25_FLASH_WRITE_STATUS, - SbpMsgMagRaw = SBP_MSG_MAG_RAW, - SbpMsgMaskSatelliteDep = SBP_MSG_MASK_SATELLITE_DEP, - SbpMsgMaskSatellite = SBP_MSG_MASK_SATELLITE, - SbpMsgMeasurementPoint = SBP_MSG_MEASUREMENT_POINT, - SbpMsgMeasurementState = SBP_MSG_MEASUREMENT_STATE, - SbpMsgNapDeviceDnaReq = SBP_MSG_NAP_DEVICE_DNA_REQ, - SbpMsgNapDeviceDnaResp = SBP_MSG_NAP_DEVICE_DNA_RESP, - SbpMsgNdbEvent = SBP_MSG_NDB_EVENT, - SbpMsgNetworkBandwidthUsage = SBP_MSG_NETWORK_BANDWIDTH_USAGE, - SbpMsgNetworkStateReq = SBP_MSG_NETWORK_STATE_REQ, - SbpMsgNetworkStateResp = SBP_MSG_NETWORK_STATE_RESP, - SbpMsgObsDepA = SBP_MSG_OBS_DEP_A, - SbpMsgObsDepB = SBP_MSG_OBS_DEP_B, - SbpMsgObsDepC = SBP_MSG_OBS_DEP_C, - SbpMsgObs = SBP_MSG_OBS, - SbpMsgOdometry = SBP_MSG_ODOMETRY, - SbpMsgOrientEuler = SBP_MSG_ORIENT_EULER, - SbpMsgOrientQuat = SBP_MSG_ORIENT_QUAT, - SbpMsgOsr = SBP_MSG_OSR, - SbpMsgPosEcefCovGnss = SBP_MSG_POS_ECEF_COV_GNSS, - SbpMsgPosEcefCov = SBP_MSG_POS_ECEF_COV, - SbpMsgPosEcefDepA = SBP_MSG_POS_ECEF_DEP_A, - SbpMsgPosEcefGnss = SBP_MSG_POS_ECEF_GNSS, - SbpMsgPosEcef = SBP_MSG_POS_ECEF, - SbpMsgPosLlhAcc = SBP_MSG_POS_LLH_ACC, - SbpMsgPosLlhCovGnss = SBP_MSG_POS_LLH_COV_GNSS, - SbpMsgPosLlhCov = SBP_MSG_POS_LLH_COV, - SbpMsgPosLlhDepA = SBP_MSG_POS_LLH_DEP_A, - SbpMsgPosLlhGnss = SBP_MSG_POS_LLH_GNSS, - SbpMsgPosLlh = SBP_MSG_POS_LLH, - SbpMsgPoseRelative = SBP_MSG_POSE_RELATIVE, - SbpMsgPpsTime = SBP_MSG_PPS_TIME, - SbpMsgPrintDep = SBP_MSG_PRINT_DEP, - SbpMsgProtectionLevelDepA = SBP_MSG_PROTECTION_LEVEL_DEP_A, - SbpMsgProtectionLevel = SBP_MSG_PROTECTION_LEVEL, - SbpMsgReferenceFrameParam = SBP_MSG_REFERENCE_FRAME_PARAM, - SbpMsgResetDep = SBP_MSG_RESET_DEP, - SbpMsgResetFilters = SBP_MSG_RESET_FILTERS, - SbpMsgReset = SBP_MSG_RESET, - SbpMsgSbasRaw = SBP_MSG_SBAS_RAW, - SbpMsgSensorAidEvent = SBP_MSG_SENSOR_AID_EVENT, - SbpMsgSetTime = SBP_MSG_SET_TIME, - SbpMsgSettingsReadByIndexDone = SBP_MSG_SETTINGS_READ_BY_INDEX_DONE, - SbpMsgSettingsReadByIndexReq = SBP_MSG_SETTINGS_READ_BY_INDEX_REQ, - SbpMsgSettingsReadByIndexResp = SBP_MSG_SETTINGS_READ_BY_INDEX_RESP, - SbpMsgSettingsReadReq = SBP_MSG_SETTINGS_READ_REQ, - SbpMsgSettingsReadResp = SBP_MSG_SETTINGS_READ_RESP, - SbpMsgSettingsRegisterResp = SBP_MSG_SETTINGS_REGISTER_RESP, - SbpMsgSettingsRegister = SBP_MSG_SETTINGS_REGISTER, - SbpMsgSettingsSave = SBP_MSG_SETTINGS_SAVE, - SbpMsgSettingsWriteResp = SBP_MSG_SETTINGS_WRITE_RESP, - SbpMsgSettingsWrite = SBP_MSG_SETTINGS_WRITE, - SbpMsgSolnMetaDepA = SBP_MSG_SOLN_META_DEP_A, - SbpMsgSolnMeta = SBP_MSG_SOLN_META, - SbpMsgSpecanDep = SBP_MSG_SPECAN_DEP, - SbpMsgSpecan = SBP_MSG_SPECAN, - SbpMsgSsrCodeBiases = SBP_MSG_SSR_CODE_BIASES, - SbpMsgSsrCodePhaseBiasesBounds = SBP_MSG_SSR_CODE_PHASE_BIASES_BOUNDS, - SbpMsgSsrFlagHighLevel = SBP_MSG_SSR_FLAG_HIGH_LEVEL, - SbpMsgSsrFlagIonoGridPointSatLos = SBP_MSG_SSR_FLAG_IONO_GRID_POINT_SAT_LOS, - SbpMsgSsrFlagIonoGridPoints = SBP_MSG_SSR_FLAG_IONO_GRID_POINTS, - SbpMsgSsrFlagIonoTileSatLos = SBP_MSG_SSR_FLAG_IONO_TILE_SAT_LOS, - SbpMsgSsrFlagSatellites = SBP_MSG_SSR_FLAG_SATELLITES, - SbpMsgSsrFlagTropoGridPoints = SBP_MSG_SSR_FLAG_TROPO_GRID_POINTS, - SbpMsgSsrGridDefinitionDepA = SBP_MSG_SSR_GRID_DEFINITION_DEP_A, - SbpMsgSsrGriddedCorrectionBounds = SBP_MSG_SSR_GRIDDED_CORRECTION_BOUNDS, - SbpMsgSsrGriddedCorrectionDepA = SBP_MSG_SSR_GRIDDED_CORRECTION_DEP_A, - SbpMsgSsrGriddedCorrectionNoStdDepA = - SBP_MSG_SSR_GRIDDED_CORRECTION_NO_STD_DEP_A, - SbpMsgSsrGriddedCorrection = SBP_MSG_SSR_GRIDDED_CORRECTION, - SbpMsgSsrOrbitClockBoundsDegradation = - SBP_MSG_SSR_ORBIT_CLOCK_BOUNDS_DEGRADATION, - SbpMsgSsrOrbitClockBounds = SBP_MSG_SSR_ORBIT_CLOCK_BOUNDS, - SbpMsgSsrOrbitClockDepA = SBP_MSG_SSR_ORBIT_CLOCK_DEP_A, - SbpMsgSsrOrbitClock = SBP_MSG_SSR_ORBIT_CLOCK, - SbpMsgSsrPhaseBiases = SBP_MSG_SSR_PHASE_BIASES, - SbpMsgSsrSatelliteApcDep = SBP_MSG_SSR_SATELLITE_APC_DEP, - SbpMsgSsrSatelliteApc = SBP_MSG_SSR_SATELLITE_APC, - SbpMsgSsrStecCorrectionDepA = SBP_MSG_SSR_STEC_CORRECTION_DEP_A, - SbpMsgSsrStecCorrectionDep = SBP_MSG_SSR_STEC_CORRECTION_DEP, - SbpMsgSsrStecCorrection = SBP_MSG_SSR_STEC_CORRECTION, - SbpMsgSsrTileDefinitionDepA = SBP_MSG_SSR_TILE_DEFINITION_DEP_A, - SbpMsgSsrTileDefinitionDepB = SBP_MSG_SSR_TILE_DEFINITION_DEP_B, - SbpMsgSsrTileDefinition = SBP_MSG_SSR_TILE_DEFINITION, - SbpMsgStartup = SBP_MSG_STARTUP, - SbpMsgStatusJournal = SBP_MSG_STATUS_JOURNAL, - SbpMsgStatusReport = SBP_MSG_STATUS_REPORT, - SbpMsgStmFlashLockSector = SBP_MSG_STM_FLASH_LOCK_SECTOR, - SbpMsgStmFlashUnlockSector = SBP_MSG_STM_FLASH_UNLOCK_SECTOR, - SbpMsgStmUniqueIdReq = SBP_MSG_STM_UNIQUE_ID_REQ, - SbpMsgStmUniqueIdResp = SBP_MSG_STM_UNIQUE_ID_RESP, - SbpMsgSvAzEl = SBP_MSG_SV_AZ_EL, - SbpMsgSvConfigurationGpsDep = SBP_MSG_SV_CONFIGURATION_GPS_DEP, - SbpMsgTelSv = SBP_MSG_TEL_SV, - SbpMsgThreadState = SBP_MSG_THREAD_STATE, - SbpMsgTrackingIqDepA = SBP_MSG_TRACKING_IQ_DEP_A, - SbpMsgTrackingIqDepB = SBP_MSG_TRACKING_IQ_DEP_B, - SbpMsgTrackingIq = SBP_MSG_TRACKING_IQ, - SbpMsgTrackingStateDepA = SBP_MSG_TRACKING_STATE_DEP_A, - SbpMsgTrackingStateDepB = SBP_MSG_TRACKING_STATE_DEP_B, - SbpMsgTrackingStateDetailedDepA = SBP_MSG_TRACKING_STATE_DETAILED_DEP_A, - SbpMsgTrackingStateDetailedDep = SBP_MSG_TRACKING_STATE_DETAILED_DEP, - SbpMsgTrackingState = SBP_MSG_TRACKING_STATE, - SbpMsgUartStateDepa = SBP_MSG_UART_STATE_DEPA, - SbpMsgUartState = SBP_MSG_UART_STATE, - SbpMsgUserData = SBP_MSG_USER_DATA, - SbpMsgUtcLeapSecond = SBP_MSG_UTC_LEAP_SECOND, - SbpMsgUtcTimeGnss = SBP_MSG_UTC_TIME_GNSS, - SbpMsgUtcTime = SBP_MSG_UTC_TIME, - SbpMsgVelBody = SBP_MSG_VEL_BODY, - SbpMsgVelCog = SBP_MSG_VEL_COG, - SbpMsgVelEcefCovGnss = SBP_MSG_VEL_ECEF_COV_GNSS, - SbpMsgVelEcefCov = SBP_MSG_VEL_ECEF_COV, - SbpMsgVelEcefDepA = SBP_MSG_VEL_ECEF_DEP_A, - SbpMsgVelEcefGnss = SBP_MSG_VEL_ECEF_GNSS, - SbpMsgVelEcef = SBP_MSG_VEL_ECEF, - SbpMsgVelNedCovGnss = SBP_MSG_VEL_NED_COV_GNSS, - SbpMsgVelNedCov = SBP_MSG_VEL_NED_COV, - SbpMsgVelNedDepA = SBP_MSG_VEL_NED_DEP_A, - SbpMsgVelNedGnss = SBP_MSG_VEL_NED_GNSS, - SbpMsgVelNed = SBP_MSG_VEL_NED, - SbpMsgWheeltick = SBP_MSG_WHEELTICK, - SbpMsgAll = SBP_MSG_ALL, - SbpMsgUnknown = SBP_MSG_ALL, + SbpMsgAcknowledge = 0x0BD2, + SbpMsgAcqResultDepA = 0x0015, + SbpMsgAcqResultDepB = 0x0014, + SbpMsgAcqResultDepC = 0x001F, + SbpMsgAcqResult = 0x002F, + SbpMsgAcqSvProfileDep = 0x001E, + SbpMsgAcqSvProfile = 0x002E, + SbpMsgAgeCorrections = 0x0210, + SbpMsgAlmanacGloDep = 0x0071, + SbpMsgAlmanacGlo = 0x0073, + SbpMsgAlmanacGpsDep = 0x0070, + SbpMsgAlmanacGps = 0x0072, + SbpMsgAlmanac = 0x0069, + SbpMsgAngularRate = 0x0222, + SbpMsgBasePosEcef = 0x0048, + SbpMsgBasePosLlh = 0x0044, + SbpMsgBaselineEcefDepA = 0x0202, + SbpMsgBaselineEcef = 0x020B, + SbpMsgBaselineHeadingDepA = 0x0207, + SbpMsgBaselineHeading = 0x020F, + SbpMsgBaselineNedDepA = 0x0203, + SbpMsgBaselineNed = 0x020C, + SbpMsgBootloaderHandshakeDepA = 0x00B0, + SbpMsgBootloaderHandshakeReq = 0x00B3, + SbpMsgBootloaderHandshakeResp = 0x00B4, + SbpMsgBootloaderJumpToApp = 0x00B1, + SbpMsgCellModemStatus = 0x00BE, + SbpMsgCertificateChainDep = 0x0C05, + SbpMsgCertificateChain = 0x0C09, + SbpMsgCommandOutput = 0x00BC, + SbpMsgCommandReq = 0x00B8, + SbpMsgCommandResp = 0x00B9, + SbpMsgCsacTelemetryLabels = 0xFF05, + SbpMsgCsacTelemetry = 0xFF04, + SbpMsgCwResults = 0x00C0, + SbpMsgCwStart = 0x00C1, + SbpMsgDeviceMonitor = 0x00B5, + SbpMsgDgnssStatus = 0xFF02, + SbpMsgDopsDepA = 0x0206, + SbpMsgDops = 0x0208, + SbpMsgEcdsaCertificate = 0x0C04, + SbpMsgEcdsaSignatureDepA = 0x0C06, + SbpMsgEcdsaSignatureDepB = 0x0C07, + SbpMsgEcdsaSignature = 0x0C08, + SbpMsgEd25519CertificateDep = 0x0C02, + SbpMsgEd25519SignatureDepA = 0x0C01, + SbpMsgEd25519SignatureDepB = 0x0C03, + SbpMsgEphemerisBds = 0x0089, + SbpMsgEphemerisDepA = 0x001A, + SbpMsgEphemerisDepB = 0x0046, + SbpMsgEphemerisDepC = 0x0047, + SbpMsgEphemerisDepD = 0x0080, + SbpMsgEphemerisGalDepA = 0x0095, + SbpMsgEphemerisGal = 0x008D, + SbpMsgEphemerisGloDepA = 0x0083, + SbpMsgEphemerisGloDepB = 0x0085, + SbpMsgEphemerisGloDepC = 0x0087, + SbpMsgEphemerisGloDepD = 0x0088, + SbpMsgEphemerisGlo = 0x008B, + SbpMsgEphemerisGpsDepE = 0x0081, + SbpMsgEphemerisGpsDepF = 0x0086, + SbpMsgEphemerisGps = 0x008A, + SbpMsgEphemerisQzss = 0x008E, + SbpMsgEphemerisSbasDepA = 0x0082, + SbpMsgEphemerisSbasDepB = 0x0084, + SbpMsgEphemerisSbas = 0x008C, + SbpMsgExtEvent = 0x0101, + SbpMsgFileioConfigReq = 0x1001, + SbpMsgFileioConfigResp = 0x1002, + SbpMsgFileioReadDirReq = 0x00A9, + SbpMsgFileioReadDirResp = 0x00AA, + SbpMsgFileioReadReq = 0x00A8, + SbpMsgFileioReadResp = 0x00A3, + SbpMsgFileioRemove = 0x00AC, + SbpMsgFileioWriteReq = 0x00AD, + SbpMsgFileioWriteResp = 0x00AB, + SbpMsgFlashDone = 0x00E0, + SbpMsgFlashErase = 0x00E2, + SbpMsgFlashProgram = 0x00E6, + SbpMsgFlashReadReq = 0x00E7, + SbpMsgFlashReadResp = 0x00E1, + SbpMsgFrontEndGain = 0x00BF, + SbpMsgFwd = 0x0402, + SbpMsgGloBiases = 0x0075, + SbpMsgGnssCapb = 0x0096, + SbpMsgGnssTimeOffset = 0xFF07, + SbpMsgGpsTimeDepA = 0x0100, + SbpMsgGpsTimeGnss = 0x0104, + SbpMsgGpsTime = 0x0102, + SbpMsgGroupDelayDepA = 0x0092, + SbpMsgGroupDelayDepB = 0x0093, + SbpMsgGroupDelay = 0x0094, + SbpMsgGroupMeta = 0xFF0A, + SbpMsgHeartbeat = 0xFFFF, + SbpMsgIarState = 0x0019, + SbpMsgImuAux = 0x0901, + SbpMsgImuRaw = 0x0900, + SbpMsgInitBaseDep = 0x0023, + SbpMsgInsStatus = 0xFF03, + SbpMsgInsUpdates = 0xFF06, + SbpMsgIono = 0x0090, + SbpMsgLinuxCpuStateDepA = 0x7F00, + SbpMsgLinuxCpuState = 0x7F08, + SbpMsgLinuxMemStateDepA = 0x7F01, + SbpMsgLinuxMemState = 0x7F09, + SbpMsgLinuxProcessFdCount = 0x7F06, + SbpMsgLinuxProcessFdSummary = 0x7F07, + SbpMsgLinuxProcessSocketCounts = 0x7F03, + SbpMsgLinuxProcessSocketQueues = 0x7F04, + SbpMsgLinuxSocketUsage = 0x7F05, + SbpMsgLinuxSysStateDepA = 0x7F02, + SbpMsgLinuxSysState = 0x7F0A, + SbpMsgLog = 0x0401, + SbpMsgM25FlashWriteStatus = 0x00F3, + SbpMsgMagRaw = 0x0902, + SbpMsgMaskSatelliteDep = 0x001B, + SbpMsgMaskSatellite = 0x002B, + SbpMsgMeasurementPoint = 0xCF00, + SbpMsgMeasurementState = 0x0061, + SbpMsgNapDeviceDnaReq = 0x00DE, + SbpMsgNapDeviceDnaResp = 0x00DD, + SbpMsgNdbEvent = 0x0400, + SbpMsgNetworkBandwidthUsage = 0x00BD, + SbpMsgNetworkStateReq = 0x00BA, + SbpMsgNetworkStateResp = 0x00BB, + SbpMsgObsDepA = 0x0045, + SbpMsgObsDepB = 0x0043, + SbpMsgObsDepC = 0x0049, + SbpMsgObs = 0x004A, + SbpMsgOdometry = 0x0903, + SbpMsgOrientEuler = 0x0221, + SbpMsgOrientQuat = 0x0220, + SbpMsgOsr = 0x0640, + SbpMsgPosEcefCovGnss = 0x0234, + SbpMsgPosEcefCov = 0x0214, + SbpMsgPosEcefDepA = 0x0200, + SbpMsgPosEcefGnss = 0x0229, + SbpMsgPosEcef = 0x0209, + SbpMsgPosLlhAcc = 0x0218, + SbpMsgPosLlhCovGnss = 0x0231, + SbpMsgPosLlhCov = 0x0211, + SbpMsgPosLlhDepA = 0x0201, + SbpMsgPosLlhGnss = 0x022A, + SbpMsgPosLlh = 0x020A, + SbpMsgPoseRelative = 0x0245, + SbpMsgPpsTime = 0xFF08, + SbpMsgPrintDep = 0x0010, + SbpMsgProtectionLevelDepA = 0x0216, + SbpMsgProtectionLevel = 0x0217, + SbpMsgReferenceFrameParam = 0x0244, + SbpMsgResetDep = 0x00B2, + SbpMsgResetFilters = 0x0022, + SbpMsgReset = 0x00B6, + SbpMsgSbasRaw = 0x7777, + SbpMsgSensorAidEvent = 0xFF09, + SbpMsgSetTime = 0x0068, + SbpMsgSettingsReadByIndexDone = 0x00A6, + SbpMsgSettingsReadByIndexReq = 0x00A2, + SbpMsgSettingsReadByIndexResp = 0x00A7, + SbpMsgSettingsReadReq = 0x00A4, + SbpMsgSettingsReadResp = 0x00A5, + SbpMsgSettingsRegisterResp = 0x01AF, + SbpMsgSettingsRegister = 0x00AE, + SbpMsgSettingsSave = 0x00A1, + SbpMsgSettingsWriteResp = 0x00AF, + SbpMsgSettingsWrite = 0x00A0, + SbpMsgSolnMetaDepA = 0xFF0F, + SbpMsgSolnMeta = 0xFF0E, + SbpMsgSpecanDep = 0x0050, + SbpMsgSpecan = 0x0051, + SbpMsgSsrCodeBiases = 0x05E1, + SbpMsgSsrCodePhaseBiasesBounds = 0x05EC, + SbpMsgSsrFlagHighLevel = 0x0BB9, + SbpMsgSsrFlagIonoGridPointSatLos = 0x0BD1, + SbpMsgSsrFlagIonoGridPoints = 0x0BC7, + SbpMsgSsrFlagIonoTileSatLos = 0x0BCD, + SbpMsgSsrFlagSatellites = 0x0BBD, + SbpMsgSsrFlagTropoGridPoints = 0x0BC3, + SbpMsgSsrGridDefinitionDepA = 0x05F5, + SbpMsgSsrGriddedCorrectionBounds = 0x05FE, + SbpMsgSsrGriddedCorrectionDepA = 0x05FA, + SbpMsgSsrGriddedCorrectionNoStdDepA = 0x05F0, + SbpMsgSsrGriddedCorrection = 0x05FC, + SbpMsgSsrOrbitClockBoundsDegradation = 0x05DF, + SbpMsgSsrOrbitClockBounds = 0x05DE, + SbpMsgSsrOrbitClockDepA = 0x05DC, + SbpMsgSsrOrbitClock = 0x05DD, + SbpMsgSsrPhaseBiases = 0x05E6, + SbpMsgSsrSatelliteApcDep = 0x0604, + SbpMsgSsrSatelliteApc = 0x0605, + SbpMsgSsrStecCorrectionDepA = 0x05EB, + SbpMsgSsrStecCorrectionDep = 0x05FB, + SbpMsgSsrStecCorrection = 0x05FD, + SbpMsgSsrTileDefinitionDepA = 0x05F6, + SbpMsgSsrTileDefinitionDepB = 0x05F7, + SbpMsgSsrTileDefinition = 0x05F8, + SbpMsgStartup = 0xFF00, + SbpMsgStatusJournal = 0xFFFD, + SbpMsgStatusReport = 0xFFFE, + SbpMsgStmFlashLockSector = 0x00E3, + SbpMsgStmFlashUnlockSector = 0x00E4, + SbpMsgStmUniqueIdReq = 0x00E8, + SbpMsgStmUniqueIdResp = 0x00E5, + SbpMsgSvAzEl = 0x0097, + SbpMsgSvConfigurationGpsDep = 0x0091, + SbpMsgTelSv = 0x0120, + SbpMsgThreadState = 0x0017, + SbpMsgTrackingIqDepA = 0x001C, + SbpMsgTrackingIqDepB = 0x002C, + SbpMsgTrackingIq = 0x002D, + SbpMsgTrackingStateDepA = 0x0016, + SbpMsgTrackingStateDepB = 0x0013, + SbpMsgTrackingStateDetailedDepA = 0x0021, + SbpMsgTrackingStateDetailedDep = 0x0011, + SbpMsgTrackingState = 0x0041, + SbpMsgUartStateDepa = 0x0018, + SbpMsgUartState = 0x001D, + SbpMsgUserData = 0x0800, + SbpMsgUtcLeapSecond = 0x023A, + SbpMsgUtcTimeGnss = 0x0105, + SbpMsgUtcTime = 0x0103, + SbpMsgVelBody = 0x0213, + SbpMsgVelCog = 0x021C, + SbpMsgVelEcefCovGnss = 0x0235, + SbpMsgVelEcefCov = 0x0215, + SbpMsgVelEcefDepA = 0x0204, + SbpMsgVelEcefGnss = 0x022D, + SbpMsgVelEcef = 0x020D, + SbpMsgVelNedCovGnss = 0x0232, + SbpMsgVelNedCov = 0x0212, + SbpMsgVelNedDepA = 0x0205, + SbpMsgVelNedGnss = 0x022E, + SbpMsgVelNed = 0x020E, + SbpMsgWheeltick = 0x0904, + SbpMsgAll = 0, + SbpMsgUnknown = 0, } sbp_msg_type_t; static inline const char *sbp_msg_type_to_string(sbp_msg_type_t msg_type) { diff --git a/c/include/libsbp/settings_macros.h b/c/include/libsbp/settings_macros.h index 3611fcecb1..9a8a156b0b 100644 --- a/c/include/libsbp/settings_macros.h +++ b/c/include/libsbp/settings_macros.h @@ -18,37 +18,31 @@ #ifndef LIBSBP_SETTINGS_MACROS_H #define LIBSBP_SETTINGS_MACROS_H -#define SBP_MSG_SETTINGS_SAVE 0x00A1 /** - * Encoded length of sbp_msg_settings_save_t (V4 API) and - * msg_settings_save_t (legacy API) + * Encoded length of sbp_msg_settings_save_t (V4 API) */ #define SBP_MSG_SETTINGS_SAVE_ENCODED_LEN 0u -#define SBP_MSG_SETTINGS_WRITE 0x00A0 /** * The maximum number of items that can be stored in - * sbp_msg_settings_write_t::setting (V4 API) or msg_settings_write_t::setting - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_settings_write_t::setting before the maximum SBP message size is + * exceeded */ #define SBP_MSG_SETTINGS_WRITE_SETTING_MAX 255u /** - * Encoded length of sbp_msg_settings_write_t (V4 API) and - * msg_settings_write_t (legacy API) + * Encoded length of sbp_msg_settings_write_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_settings_write_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SETTINGS_WRITE_ENCODED_OVERHEAD 0u -#define SBP_MSG_SETTINGS_WRITE_RESP 0x00AF #define SBP_SETTINGS_WRITE_RESP_WRITE_STATUS_MASK (0x3u) #define SBP_SETTINGS_WRITE_RESP_WRITE_STATUS_SHIFT (0u) #define SBP_SETTINGS_WRITE_RESP_WRITE_STATUS_GET(flags) \ @@ -76,138 +70,114 @@ #define SBP_SETTINGS_WRITE_RESP_WRITE_STATUS_REJECTED_UNSPECIFIED_ERROR (6) /** * The maximum number of items that can be stored in - * sbp_msg_settings_write_resp_t::setting (V4 API) or - * msg_settings_write_resp_t::setting (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_settings_write_resp_t::setting before the maximum SBP message size is + * exceeded */ #define SBP_MSG_SETTINGS_WRITE_RESP_SETTING_MAX 254u /** - * Encoded length of sbp_msg_settings_write_resp_t (V4 API) and - * msg_settings_write_resp_t (legacy API) + * Encoded length of sbp_msg_settings_write_resp_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_settings_write_resp_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SETTINGS_WRITE_RESP_ENCODED_OVERHEAD 1u -#define SBP_MSG_SETTINGS_READ_REQ 0x00A4 /** * The maximum number of items that can be stored in - * sbp_msg_settings_read_req_t::setting (V4 API) or - * msg_settings_read_req_t::setting (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_settings_read_req_t::setting before the maximum SBP message size is + * exceeded */ #define SBP_MSG_SETTINGS_READ_REQ_SETTING_MAX 255u /** - * Encoded length of sbp_msg_settings_read_req_t (V4 API) and - * msg_settings_read_req_t (legacy API) + * Encoded length of sbp_msg_settings_read_req_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_settings_read_req_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SETTINGS_READ_REQ_ENCODED_OVERHEAD 0u -#define SBP_MSG_SETTINGS_READ_RESP 0x00A5 /** * The maximum number of items that can be stored in - * sbp_msg_settings_read_resp_t::setting (V4 API) or - * msg_settings_read_resp_t::setting (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_settings_read_resp_t::setting before the maximum SBP message size is + * exceeded */ #define SBP_MSG_SETTINGS_READ_RESP_SETTING_MAX 255u /** - * Encoded length of sbp_msg_settings_read_resp_t (V4 API) and - * msg_settings_read_resp_t (legacy API) + * Encoded length of sbp_msg_settings_read_resp_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_settings_read_resp_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SETTINGS_READ_RESP_ENCODED_OVERHEAD 0u -#define SBP_MSG_SETTINGS_READ_BY_INDEX_REQ 0x00A2 /** - * Encoded length of sbp_msg_settings_read_by_index_req_t (V4 API) and - * msg_settings_read_by_index_req_t (legacy API) + * Encoded length of sbp_msg_settings_read_by_index_req_t (V4 API) */ #define SBP_MSG_SETTINGS_READ_BY_INDEX_REQ_ENCODED_LEN 2u -#define SBP_MSG_SETTINGS_READ_BY_INDEX_RESP 0x00A7 /** * The maximum number of items that can be stored in - * sbp_msg_settings_read_by_index_resp_t::setting (V4 API) or - * msg_settings_read_by_index_resp_t::setting (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_settings_read_by_index_resp_t::setting before the maximum SBP message + * size is exceeded */ #define SBP_MSG_SETTINGS_READ_BY_INDEX_RESP_SETTING_MAX 253u /** - * Encoded length of sbp_msg_settings_read_by_index_resp_t (V4 API) and - * msg_settings_read_by_index_resp_t (legacy API) + * Encoded length of sbp_msg_settings_read_by_index_resp_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_settings_read_by_index_resp_encoded_len to determine the actual size - * of an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * of an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SETTINGS_READ_BY_INDEX_RESP_ENCODED_OVERHEAD 2u -#define SBP_MSG_SETTINGS_READ_BY_INDEX_DONE 0x00A6 /** - * Encoded length of sbp_msg_settings_read_by_index_done_t (V4 API) and - * msg_settings_read_by_index_done_t (legacy API) + * Encoded length of sbp_msg_settings_read_by_index_done_t (V4 API) */ #define SBP_MSG_SETTINGS_READ_BY_INDEX_DONE_ENCODED_LEN 0u -#define SBP_MSG_SETTINGS_REGISTER 0x00AE /** * The maximum number of items that can be stored in - * sbp_msg_settings_register_t::setting (V4 API) or - * msg_settings_register_t::setting (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_settings_register_t::setting before the maximum SBP message size is + * exceeded */ #define SBP_MSG_SETTINGS_REGISTER_SETTING_MAX 255u /** - * Encoded length of sbp_msg_settings_register_t (V4 API) and - * msg_settings_register_t (legacy API) + * Encoded length of sbp_msg_settings_register_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_settings_register_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SETTINGS_REGISTER_ENCODED_OVERHEAD 0u -#define SBP_MSG_SETTINGS_REGISTER_RESP 0x01AF #define SBP_SETTINGS_REGISTER_RESP_REGISTER_STATUS_MASK (0x3u) #define SBP_SETTINGS_REGISTER_RESP_REGISTER_STATUS_SHIFT (0u) #define SBP_SETTINGS_REGISTER_RESP_REGISTER_STATUS_GET(flags) \ @@ -232,21 +202,18 @@ (3) /** * The maximum number of items that can be stored in - * sbp_msg_settings_register_resp_t::setting (V4 API) or - * msg_settings_register_resp_t::setting (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_settings_register_resp_t::setting before the maximum SBP message size + * is exceeded */ #define SBP_MSG_SETTINGS_REGISTER_RESP_SETTING_MAX 254u /** - * Encoded length of sbp_msg_settings_register_resp_t (V4 API) and - * msg_settings_register_resp_t (legacy API) + * Encoded length of sbp_msg_settings_register_resp_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_settings_register_resp_encoded_len to determine the actual size of - * an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) diff --git a/c/include/libsbp/signing_macros.h b/c/include/libsbp/signing_macros.h index 9362724c32..dde123e837 100644 --- a/c/include/libsbp/signing_macros.h +++ b/c/include/libsbp/signing_macros.h @@ -19,30 +19,25 @@ #define LIBSBP_SIGNING_MACROS_H /** - * Encoded length of sbp_utc_time_t (V4 API) and - * utc_time_t (legacy API) + * Encoded length of sbp_utc_time_t (V4 API) */ #define SBP_UTC_TIME_ENCODED_LEN 11u /** * The maximum number of items that can be stored in sbp_ecdsa_signature_t::data - * (V4 API) or ecdsa_signature_t::data (legacy API) before the maximum SBP - * message size is exceeded + * before the maximum SBP message size is exceeded */ #define SBP_ECDSA_SIGNATURE_DATA_MAX 72u /** - * Encoded length of sbp_ecdsa_signature_t (V4 API) and - * ecdsa_signature_t (legacy API) + * Encoded length of sbp_ecdsa_signature_t (V4 API) */ #define SBP_ECDSA_SIGNATURE_ENCODED_LEN 73u -#define SBP_MSG_ECDSA_CERTIFICATE 0x0C04 /** * The maximum number of items that can be stored in - * sbp_msg_ecdsa_certificate_t::certificate_id (V4 API) or - * msg_ecdsa_certificate_t::certificate_id (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_ecdsa_certificate_t::certificate_id before the maximum SBP message + * size is exceeded */ #define SBP_MSG_ECDSA_CERTIFICATE_CERTIFICATE_ID_MAX 4u @@ -65,98 +60,83 @@ #define SBP_ECDSA_CERTIFICATE_CERTIFICATE_TYPE_INTERMEDIATE_CERTIFICATE (2) /** * The maximum number of items that can be stored in - * sbp_msg_ecdsa_certificate_t::certificate_bytes (V4 API) or - * msg_ecdsa_certificate_t::certificate_bytes (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_ecdsa_certificate_t::certificate_bytes before the maximum SBP message + * size is exceeded */ #define SBP_MSG_ECDSA_CERTIFICATE_CERTIFICATE_BYTES_MAX 249u /** - * Encoded length of sbp_msg_ecdsa_certificate_t (V4 API) and - * msg_ecdsa_certificate_t (legacy API) + * Encoded length of sbp_msg_ecdsa_certificate_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ecdsa_certificate_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_ECDSA_CERTIFICATE_ENCODED_OVERHEAD 6u -#define SBP_MSG_CERTIFICATE_CHAIN 0x0C09 /** * The maximum number of items that can be stored in - * sbp_msg_certificate_chain_t::root_certificate (V4 API) or - * msg_certificate_chain_t::root_certificate (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_certificate_chain_t::root_certificate before the maximum SBP message + * size is exceeded */ #define SBP_MSG_CERTIFICATE_CHAIN_ROOT_CERTIFICATE_MAX 20u /** * The maximum number of items that can be stored in - * sbp_msg_certificate_chain_t::intermediate_certificate (V4 API) or - * msg_certificate_chain_t::intermediate_certificate (legacy API) before the - * maximum SBP message size is exceeded + * sbp_msg_certificate_chain_t::intermediate_certificate before the maximum SBP + * message size is exceeded */ #define SBP_MSG_CERTIFICATE_CHAIN_INTERMEDIATE_CERTIFICATE_MAX 20u /** * The maximum number of items that can be stored in - * sbp_msg_certificate_chain_t::corrections_certificate (V4 API) or - * msg_certificate_chain_t::corrections_certificate (legacy API) before the - * maximum SBP message size is exceeded + * sbp_msg_certificate_chain_t::corrections_certificate before the maximum SBP + * message size is exceeded */ #define SBP_MSG_CERTIFICATE_CHAIN_CORRECTIONS_CERTIFICATE_MAX 20u /** - * Encoded length of sbp_msg_certificate_chain_t (V4 API) and - * msg_certificate_chain_t (legacy API) + * Encoded length of sbp_msg_certificate_chain_t (V4 API) */ #define SBP_MSG_CERTIFICATE_CHAIN_ENCODED_LEN 144u -#define SBP_MSG_CERTIFICATE_CHAIN_DEP 0x0C05 /** * The maximum number of items that can be stored in - * sbp_msg_certificate_chain_dep_t::root_certificate (V4 API) or - * msg_certificate_chain_dep_t::root_certificate (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_certificate_chain_dep_t::root_certificate before the maximum SBP + * message size is exceeded */ #define SBP_MSG_CERTIFICATE_CHAIN_DEP_ROOT_CERTIFICATE_MAX 20u /** * The maximum number of items that can be stored in - * sbp_msg_certificate_chain_dep_t::intermediate_certificate (V4 API) or - * msg_certificate_chain_dep_t::intermediate_certificate (legacy API) before the - * maximum SBP message size is exceeded + * sbp_msg_certificate_chain_dep_t::intermediate_certificate before the maximum + * SBP message size is exceeded */ #define SBP_MSG_CERTIFICATE_CHAIN_DEP_INTERMEDIATE_CERTIFICATE_MAX 20u /** * The maximum number of items that can be stored in - * sbp_msg_certificate_chain_dep_t::corrections_certificate (V4 API) or - * msg_certificate_chain_dep_t::corrections_certificate (legacy API) before the - * maximum SBP message size is exceeded + * sbp_msg_certificate_chain_dep_t::corrections_certificate before the maximum + * SBP message size is exceeded */ #define SBP_MSG_CERTIFICATE_CHAIN_DEP_CORRECTIONS_CERTIFICATE_MAX 20u /** * The maximum number of items that can be stored in - * sbp_msg_certificate_chain_dep_t::signature (V4 API) or - * msg_certificate_chain_dep_t::signature (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_certificate_chain_dep_t::signature before the maximum SBP message + * size is exceeded */ #define SBP_MSG_CERTIFICATE_CHAIN_DEP_SIGNATURE_MAX 64u /** - * Encoded length of sbp_msg_certificate_chain_dep_t (V4 API) and - * msg_certificate_chain_dep_t (legacy API) + * Encoded length of sbp_msg_certificate_chain_dep_t (V4 API) */ #define SBP_MSG_CERTIFICATE_CHAIN_DEP_ENCODED_LEN 135u -#define SBP_MSG_ECDSA_SIGNATURE 0x0C08 #define SBP_ECDSA_SIGNATURE_CRC_TYPE_MASK (0x3u) #define SBP_ECDSA_SIGNATURE_CRC_TYPE_SHIFT (0u) #define SBP_ECDSA_SIGNATURE_CRC_TYPE_GET(flags) \ @@ -174,36 +154,31 @@ #define SBP_ECDSA_SIGNATURE_CRC_TYPE_16_BIT_CRCS_FROM_SBP_FRAMING (1) /** * The maximum number of items that can be stored in - * sbp_msg_ecdsa_signature_t::certificate_id (V4 API) or - * msg_ecdsa_signature_t::certificate_id (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_ecdsa_signature_t::certificate_id before the maximum SBP message size + * is exceeded */ #define SBP_MSG_ECDSA_SIGNATURE_CERTIFICATE_ID_MAX 4u /** * The maximum number of items that can be stored in - * sbp_msg_ecdsa_signature_t::signed_messages (V4 API) or - * msg_ecdsa_signature_t::signed_messages (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_ecdsa_signature_t::signed_messages before the maximum SBP message + * size is exceeded */ #define SBP_MSG_ECDSA_SIGNATURE_SIGNED_MESSAGES_MAX 175u /** - * Encoded length of sbp_msg_ecdsa_signature_t (V4 API) and - * msg_ecdsa_signature_t (legacy API) + * Encoded length of sbp_msg_ecdsa_signature_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ecdsa_signature_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_ECDSA_SIGNATURE_ENCODED_OVERHEAD 80u -#define SBP_MSG_ECDSA_SIGNATURE_DEP_B 0x0C07 #define SBP_ECDSA_SIGNATURE_DEP_B_CRC_TYPE_MASK (0x3u) #define SBP_ECDSA_SIGNATURE_DEP_B_CRC_TYPE_SHIFT (0u) #define SBP_ECDSA_SIGNATURE_DEP_B_CRC_TYPE_GET(flags) \ @@ -222,44 +197,38 @@ #define SBP_ECDSA_SIGNATURE_DEP_B_CRC_TYPE_16_BIT_CRCS_FROM_SBP_FRAMING (1) /** * The maximum number of items that can be stored in - * sbp_msg_ecdsa_signature_dep_b_t::certificate_id (V4 API) or - * msg_ecdsa_signature_dep_b_t::certificate_id (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_ecdsa_signature_dep_b_t::certificate_id before the maximum SBP + * message size is exceeded */ #define SBP_MSG_ECDSA_SIGNATURE_DEP_B_CERTIFICATE_ID_MAX 4u /** * The maximum number of items that can be stored in - * sbp_msg_ecdsa_signature_dep_b_t::signature (V4 API) or - * msg_ecdsa_signature_dep_b_t::signature (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_ecdsa_signature_dep_b_t::signature before the maximum SBP message + * size is exceeded */ #define SBP_MSG_ECDSA_SIGNATURE_DEP_B_SIGNATURE_MAX 72u /** * The maximum number of items that can be stored in - * sbp_msg_ecdsa_signature_dep_b_t::signed_messages (V4 API) or - * msg_ecdsa_signature_dep_b_t::signed_messages (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_ecdsa_signature_dep_b_t::signed_messages before the maximum SBP + * message size is exceeded */ #define SBP_MSG_ECDSA_SIGNATURE_DEP_B_SIGNED_MESSAGES_MAX 175u /** - * Encoded length of sbp_msg_ecdsa_signature_dep_b_t (V4 API) and - * msg_ecdsa_signature_dep_b_t (legacy API) + * Encoded length of sbp_msg_ecdsa_signature_dep_b_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ecdsa_signature_dep_b_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_ECDSA_SIGNATURE_DEP_B_ENCODED_OVERHEAD 80u -#define SBP_MSG_ECDSA_SIGNATURE_DEP_A 0x0C06 #define SBP_ECDSA_SIGNATURE_DEP_A_CRC_TYPE_MASK (0x3u) #define SBP_ECDSA_SIGNATURE_DEP_A_CRC_TYPE_SHIFT (0u) #define SBP_ECDSA_SIGNATURE_DEP_A_CRC_TYPE_GET(flags) \ @@ -278,149 +247,127 @@ #define SBP_ECDSA_SIGNATURE_DEP_A_CRC_TYPE_16_BIT_CRCS_FROM_SBP_FRAMING (1) /** * The maximum number of items that can be stored in - * sbp_msg_ecdsa_signature_dep_a_t::certificate_id (V4 API) or - * msg_ecdsa_signature_dep_a_t::certificate_id (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_ecdsa_signature_dep_a_t::certificate_id before the maximum SBP + * message size is exceeded */ #define SBP_MSG_ECDSA_SIGNATURE_DEP_A_CERTIFICATE_ID_MAX 4u /** * The maximum number of items that can be stored in - * sbp_msg_ecdsa_signature_dep_a_t::signature (V4 API) or - * msg_ecdsa_signature_dep_a_t::signature (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_ecdsa_signature_dep_a_t::signature before the maximum SBP message + * size is exceeded */ #define SBP_MSG_ECDSA_SIGNATURE_DEP_A_SIGNATURE_MAX 64u /** * The maximum number of items that can be stored in - * sbp_msg_ecdsa_signature_dep_a_t::signed_messages (V4 API) or - * msg_ecdsa_signature_dep_a_t::signed_messages (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_ecdsa_signature_dep_a_t::signed_messages before the maximum SBP + * message size is exceeded */ #define SBP_MSG_ECDSA_SIGNATURE_DEP_A_SIGNED_MESSAGES_MAX 184u /** - * Encoded length of sbp_msg_ecdsa_signature_dep_a_t (V4 API) and - * msg_ecdsa_signature_dep_a_t (legacy API) + * Encoded length of sbp_msg_ecdsa_signature_dep_a_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ecdsa_signature_dep_a_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_ECDSA_SIGNATURE_DEP_A_ENCODED_OVERHEAD 71u -#define SBP_MSG_ED25519_CERTIFICATE_DEP 0x0C02 /** * The maximum number of items that can be stored in - * sbp_msg_ed25519_certificate_dep_t::fingerprint (V4 API) or - * msg_ed25519_certificate_dep_t::fingerprint (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_ed25519_certificate_dep_t::fingerprint before the maximum SBP message + * size is exceeded */ #define SBP_MSG_ED25519_CERTIFICATE_DEP_FINGERPRINT_MAX 20u /** * The maximum number of items that can be stored in - * sbp_msg_ed25519_certificate_dep_t::certificate_bytes (V4 API) or - * msg_ed25519_certificate_dep_t::certificate_bytes (legacy API) before the - * maximum SBP message size is exceeded + * sbp_msg_ed25519_certificate_dep_t::certificate_bytes before the maximum SBP + * message size is exceeded */ #define SBP_MSG_ED25519_CERTIFICATE_DEP_CERTIFICATE_BYTES_MAX 234u /** - * Encoded length of sbp_msg_ed25519_certificate_dep_t (V4 API) and - * msg_ed25519_certificate_dep_t (legacy API) + * Encoded length of sbp_msg_ed25519_certificate_dep_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ed25519_certificate_dep_encoded_len to determine the actual size of - * an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_ED25519_CERTIFICATE_DEP_ENCODED_OVERHEAD 21u -#define SBP_MSG_ED25519_SIGNATURE_DEP_A 0x0C01 /** * The maximum number of items that can be stored in - * sbp_msg_ed25519_signature_dep_a_t::signature (V4 API) or - * msg_ed25519_signature_dep_a_t::signature (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_ed25519_signature_dep_a_t::signature before the maximum SBP message + * size is exceeded */ #define SBP_MSG_ED25519_SIGNATURE_DEP_A_SIGNATURE_MAX 64u /** * The maximum number of items that can be stored in - * sbp_msg_ed25519_signature_dep_a_t::fingerprint (V4 API) or - * msg_ed25519_signature_dep_a_t::fingerprint (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_ed25519_signature_dep_a_t::fingerprint before the maximum SBP message + * size is exceeded */ #define SBP_MSG_ED25519_SIGNATURE_DEP_A_FINGERPRINT_MAX 20u /** * The maximum number of items that can be stored in - * sbp_msg_ed25519_signature_dep_a_t::signed_messages (V4 API) or - * msg_ed25519_signature_dep_a_t::signed_messages (legacy API) before the - * maximum SBP message size is exceeded + * sbp_msg_ed25519_signature_dep_a_t::signed_messages before the maximum SBP + * message size is exceeded */ #define SBP_MSG_ED25519_SIGNATURE_DEP_A_SIGNED_MESSAGES_MAX 42u /** - * Encoded length of sbp_msg_ed25519_signature_dep_a_t (V4 API) and - * msg_ed25519_signature_dep_a_t (legacy API) + * Encoded length of sbp_msg_ed25519_signature_dep_a_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ed25519_signature_dep_a_encoded_len to determine the actual size of - * an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_ED25519_SIGNATURE_DEP_A_ENCODED_OVERHEAD 84u -#define SBP_MSG_ED25519_SIGNATURE_DEP_B 0x0C03 /** * The maximum number of items that can be stored in - * sbp_msg_ed25519_signature_dep_b_t::signature (V4 API) or - * msg_ed25519_signature_dep_b_t::signature (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_ed25519_signature_dep_b_t::signature before the maximum SBP message + * size is exceeded */ #define SBP_MSG_ED25519_SIGNATURE_DEP_B_SIGNATURE_MAX 64u /** * The maximum number of items that can be stored in - * sbp_msg_ed25519_signature_dep_b_t::fingerprint (V4 API) or - * msg_ed25519_signature_dep_b_t::fingerprint (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_ed25519_signature_dep_b_t::fingerprint before the maximum SBP message + * size is exceeded */ #define SBP_MSG_ED25519_SIGNATURE_DEP_B_FINGERPRINT_MAX 20u /** * The maximum number of items that can be stored in - * sbp_msg_ed25519_signature_dep_b_t::signed_messages (V4 API) or - * msg_ed25519_signature_dep_b_t::signed_messages (legacy API) before the - * maximum SBP message size is exceeded + * sbp_msg_ed25519_signature_dep_b_t::signed_messages before the maximum SBP + * message size is exceeded */ #define SBP_MSG_ED25519_SIGNATURE_DEP_B_SIGNED_MESSAGES_MAX 42u /** - * Encoded length of sbp_msg_ed25519_signature_dep_b_t (V4 API) and - * msg_ed25519_signature_dep_b_t (legacy API) + * Encoded length of sbp_msg_ed25519_signature_dep_b_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ed25519_signature_dep_b_encoded_len to determine the actual size of - * an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) diff --git a/c/include/libsbp/solution_meta_macros.h b/c/include/libsbp/solution_meta_macros.h index 7bb333cc5b..d0685784fc 100644 --- a/c/include/libsbp/solution_meta_macros.h +++ b/c/include/libsbp/solution_meta_macros.h @@ -56,12 +56,10 @@ #define SBP_SOLUTIONINPUTTYPE_SENSOR_TYPE_ODOMETRY_SPEED (5) #define SBP_SOLUTIONINPUTTYPE_SENSOR_TYPE_IMU_SENSOR (6) /** - * Encoded length of sbp_solution_input_type_t (V4 API) and - * solution_input_type_t (legacy API) + * Encoded length of sbp_solution_input_type_t (V4 API) */ #define SBP_SOLUTION_INPUT_TYPE_ENCODED_LEN 2u -#define SBP_MSG_SOLN_META_DEP_A 0xFF0F #define SBP_SOLN_META_DEP_A_ALIGNMENT_STATUS_MASK (0x7u) #define SBP_SOLN_META_DEP_A_ALIGNMENT_STATUS_SHIFT (0u) #define SBP_SOLN_META_DEP_A_ALIGNMENT_STATUS_GET(flags) \ @@ -88,27 +86,24 @@ (4) /** * The maximum number of items that can be stored in - * sbp_msg_soln_meta_dep_a_t::sol_in (V4 API) or msg_soln_meta_dep_a_t::sol_in - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_soln_meta_dep_a_t::sol_in before the maximum SBP message size is + * exceeded */ #define SBP_MSG_SOLN_META_DEP_A_SOL_IN_MAX 118u /** - * Encoded length of sbp_msg_soln_meta_dep_a_t (V4 API) and - * msg_soln_meta_dep_a_t (legacy API) + * Encoded length of sbp_msg_soln_meta_dep_a_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_soln_meta_dep_a_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SOLN_META_DEP_A_ENCODED_OVERHEAD 18u -#define SBP_MSG_SOLN_META 0xFF0E #define SBP_SOLN_META_TIME_STATUS_MASK (0x3u) #define SBP_SOLN_META_TIME_STATUS_SHIFT (30u) #define SBP_SOLN_META_TIME_STATUS_GET(flags) \ @@ -147,20 +142,17 @@ /** * The maximum number of items that can be stored in sbp_msg_soln_meta_t::sol_in - * (V4 API) or msg_soln_meta_t::sol_in (legacy API) before the maximum SBP - * message size is exceeded + * before the maximum SBP message size is exceeded */ #define SBP_MSG_SOLN_META_SOL_IN_MAX 119u /** - * Encoded length of sbp_msg_soln_meta_t (V4 API) and - * msg_soln_meta_t (legacy API) + * Encoded length of sbp_msg_soln_meta_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_soln_meta_encoded_len to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) @@ -186,8 +178,7 @@ #define SBP_GNSSINPUTTYPE_TYPE_OF_GNSS_MEASUREMENT_GNSS_VELOCITY_DISPLACEMENT \ (2) /** - * Encoded length of sbp_gnss_input_type_t (V4 API) and - * gnss_input_type_t (legacy API) + * Encoded length of sbp_gnss_input_type_t (V4 API) */ #define SBP_GNSS_INPUT_TYPE_ENCODED_LEN 1u @@ -243,8 +234,7 @@ #define SBP_IMUINPUTTYPE_IMU_ARCHITECTURE_6_AXIS_MEMS (0) #define SBP_IMUINPUTTYPE_IMU_ARCHITECTURE_OTHER_TYPE (1) /** - * Encoded length of sbp_imu_input_type_t (V4 API) and - * imu_input_type_t (legacy API) + * Encoded length of sbp_imu_input_type_t (V4 API) */ #define SBP_IMU_INPUT_TYPE_ENCODED_LEN 1u @@ -297,8 +287,7 @@ #define SBP_ODOINPUTTYPE_ODOMETER_CLASS_MULTI_DIMENSIONAL_TICKS (2) #define SBP_ODOINPUTTYPE_ODOMETER_CLASS_MULTI_DIMENSIONAL_SPEED (3) /** - * Encoded length of sbp_odo_input_type_t (V4 API) and - * odo_input_type_t (legacy API) + * Encoded length of sbp_odo_input_type_t (V4 API) */ #define SBP_ODO_INPUT_TYPE_ENCODED_LEN 1u diff --git a/c/include/libsbp/ssr/MSG_SSR_CODE_BIASES.h b/c/include/libsbp/ssr/MSG_SSR_CODE_BIASES.h index 4b27844b4f..6cc3e9657c 100644 --- a/c/include/libsbp/ssr/MSG_SSR_CODE_BIASES.h +++ b/c/include/libsbp/ssr/MSG_SSR_CODE_BIASES.h @@ -56,7 +56,7 @@ typedef struct { /** * GNSS signal identifier (16 bit) */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; /** * Update interval between consecutive corrections. Encoded following RTCM diff --git a/c/include/libsbp/ssr/MSG_SSR_ORBIT_CLOCK.h b/c/include/libsbp/ssr/MSG_SSR_ORBIT_CLOCK.h index 678e78da43..7c3e5f225d 100644 --- a/c/include/libsbp/ssr/MSG_SSR_ORBIT_CLOCK.h +++ b/c/include/libsbp/ssr/MSG_SSR_ORBIT_CLOCK.h @@ -55,7 +55,7 @@ typedef struct { /** * GNSS signal identifier (16 bit) */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; /** * Update interval between consecutive corrections. Encoded following RTCM diff --git a/c/include/libsbp/ssr/MSG_SSR_ORBIT_CLOCK_DEP_A.h b/c/include/libsbp/ssr/MSG_SSR_ORBIT_CLOCK_DEP_A.h index 2225445fe4..8e37b1c89c 100644 --- a/c/include/libsbp/ssr/MSG_SSR_ORBIT_CLOCK_DEP_A.h +++ b/c/include/libsbp/ssr/MSG_SSR_ORBIT_CLOCK_DEP_A.h @@ -53,7 +53,7 @@ typedef struct { /** * GNSS signal identifier (16 bit) */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; /** * Update interval between consecutive corrections. Encoded following RTCM diff --git a/c/include/libsbp/ssr/MSG_SSR_PHASE_BIASES.h b/c/include/libsbp/ssr/MSG_SSR_PHASE_BIASES.h index 828112c822..e04202f251 100644 --- a/c/include/libsbp/ssr/MSG_SSR_PHASE_BIASES.h +++ b/c/include/libsbp/ssr/MSG_SSR_PHASE_BIASES.h @@ -58,7 +58,7 @@ typedef struct { /** * GNSS signal identifier (16 bit) */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; /** * Update interval between consecutive corrections. Encoded following RTCM diff --git a/c/include/libsbp/ssr/SatelliteAPC.h b/c/include/libsbp/ssr/SatelliteAPC.h index 607dd07029..a563a1a638 100644 --- a/c/include/libsbp/ssr/SatelliteAPC.h +++ b/c/include/libsbp/ssr/SatelliteAPC.h @@ -48,7 +48,7 @@ typedef struct { /** * GNSS signal identifier (16 bit) */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; /** * Additional satellite information diff --git a/c/include/libsbp/ssr_macros.h b/c/include/libsbp/ssr_macros.h index c2491dc54f..1c2ae800d2 100644 --- a/c/include/libsbp/ssr_macros.h +++ b/c/include/libsbp/ssr_macros.h @@ -19,137 +19,116 @@ #define LIBSBP_SSR_MACROS_H /** - * Encoded length of sbp_code_biases_content_t (V4 API) and - * code_biases_content_t (legacy API) + * Encoded length of sbp_code_biases_content_t (V4 API) */ #define SBP_CODE_BIASES_CONTENT_ENCODED_LEN 3u /** - * Encoded length of sbp_phase_biases_content_t (V4 API) and - * phase_biases_content_t (legacy API) + * Encoded length of sbp_phase_biases_content_t (V4 API) */ #define SBP_PHASE_BIASES_CONTENT_ENCODED_LEN 8u /** - * Encoded length of sbp_stec_header_t (V4 API) and - * stec_header_t (legacy API) + * Encoded length of sbp_stec_header_t (V4 API) */ #define SBP_STEC_HEADER_ENCODED_LEN 14u /** - * Encoded length of sbp_gridded_correction_header_t (V4 API) and - * gridded_correction_header_t (legacy API) + * Encoded length of sbp_gridded_correction_header_t (V4 API) */ #define SBP_GRIDDED_CORRECTION_HEADER_ENCODED_LEN 17u /** * The maximum number of items that can be stored in - * sbp_stec_sat_element_t::stec_coeff (V4 API) or stec_sat_element_t::stec_coeff - * (legacy API) before the maximum SBP message size is exceeded + * sbp_stec_sat_element_t::stec_coeff before the maximum SBP message size is + * exceeded */ #define SBP_STEC_SAT_ELEMENT_STEC_COEFF_MAX 4u /** - * Encoded length of sbp_stec_sat_element_t (V4 API) and - * stec_sat_element_t (legacy API) + * Encoded length of sbp_stec_sat_element_t (V4 API) */ #define SBP_STEC_SAT_ELEMENT_ENCODED_LEN 11u /** - * Encoded length of sbp_tropospheric_delay_correction_no_std_t (V4 API) and - * tropospheric_delay_correction_no_std_t (legacy API) + * Encoded length of sbp_tropospheric_delay_correction_no_std_t (V4 API) */ #define SBP_TROPOSPHERIC_DELAY_CORRECTION_NO_STD_ENCODED_LEN 3u /** - * Encoded length of sbp_tropospheric_delay_correction_t (V4 API) and - * tropospheric_delay_correction_t (legacy API) + * Encoded length of sbp_tropospheric_delay_correction_t (V4 API) */ #define SBP_TROPOSPHERIC_DELAY_CORRECTION_ENCODED_LEN 4u /** - * Encoded length of sbp_stec_residual_no_std_t (V4 API) and - * stec_residual_no_std_t (legacy API) + * Encoded length of sbp_stec_residual_no_std_t (V4 API) */ #define SBP_STEC_RESIDUAL_NO_STD_ENCODED_LEN 4u /** - * Encoded length of sbp_stec_residual_t (V4 API) and - * stec_residual_t (legacy API) + * Encoded length of sbp_stec_residual_t (V4 API) */ #define SBP_STEC_RESIDUAL_ENCODED_LEN 5u -#define SBP_MSG_SSR_ORBIT_CLOCK 0x05DD /** - * Encoded length of sbp_msg_ssr_orbit_clock_t (V4 API) and - * msg_ssr_orbit_clock_t (legacy API) + * Encoded length of sbp_msg_ssr_orbit_clock_t (V4 API) */ #define SBP_MSG_SSR_ORBIT_CLOCK_ENCODED_LEN 50u -#define SBP_MSG_SSR_CODE_BIASES 0x05E1 /** * The maximum number of items that can be stored in - * sbp_msg_ssr_code_biases_t::biases (V4 API) or msg_ssr_code_biases_t::biases - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_ssr_code_biases_t::biases before the maximum SBP message size is + * exceeded */ #define SBP_MSG_SSR_CODE_BIASES_BIASES_MAX 81u /** - * Encoded length of sbp_msg_ssr_code_biases_t (V4 API) and - * msg_ssr_code_biases_t (legacy API) + * Encoded length of sbp_msg_ssr_code_biases_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_code_biases_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SSR_CODE_BIASES_ENCODED_OVERHEAD 10u -#define SBP_MSG_SSR_PHASE_BIASES 0x05E6 /** * The maximum number of items that can be stored in - * sbp_msg_ssr_phase_biases_t::biases (V4 API) or msg_ssr_phase_biases_t::biases - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_ssr_phase_biases_t::biases before the maximum SBP message size is + * exceeded */ #define SBP_MSG_SSR_PHASE_BIASES_BIASES_MAX 30u /** - * Encoded length of sbp_msg_ssr_phase_biases_t (V4 API) and - * msg_ssr_phase_biases_t (legacy API) + * Encoded length of sbp_msg_ssr_phase_biases_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_phase_biases_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SSR_PHASE_BIASES_ENCODED_OVERHEAD 15u -#define SBP_MSG_SSR_STEC_CORRECTION_DEP 0x05FB /** * The maximum number of items that can be stored in - * sbp_msg_ssr_stec_correction_dep_t::stec_sat_list (V4 API) or - * msg_ssr_stec_correction_dep_t::stec_sat_list (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_ssr_stec_correction_dep_t::stec_sat_list before the maximum SBP + * message size is exceeded */ #define SBP_MSG_SSR_STEC_CORRECTION_DEP_STEC_SAT_LIST_MAX 21u /** - * Encoded length of sbp_msg_ssr_stec_correction_dep_t (V4 API) and - * msg_ssr_stec_correction_dep_t (legacy API) + * Encoded length of sbp_msg_ssr_stec_correction_dep_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_stec_correction_dep_encoded_len to determine the actual size of - * an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) @@ -157,53 +136,44 @@ #define SBP_MSG_SSR_STEC_CORRECTION_DEP_ENCODED_OVERHEAD 14u /** - * Encoded length of sbp_bounds_header_t (V4 API) and - * bounds_header_t (legacy API) + * Encoded length of sbp_bounds_header_t (V4 API) */ #define SBP_BOUNDS_HEADER_ENCODED_LEN 10u -#define SBP_MSG_SSR_STEC_CORRECTION 0x05FD /** * The maximum number of items that can be stored in - * sbp_msg_ssr_stec_correction_t::stec_sat_list (V4 API) or - * msg_ssr_stec_correction_t::stec_sat_list (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_ssr_stec_correction_t::stec_sat_list before the maximum SBP message + * size is exceeded */ #define SBP_MSG_SSR_STEC_CORRECTION_STEC_SAT_LIST_MAX 21u /** - * Encoded length of sbp_msg_ssr_stec_correction_t (V4 API) and - * msg_ssr_stec_correction_t (legacy API) + * Encoded length of sbp_msg_ssr_stec_correction_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_stec_correction_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SSR_STEC_CORRECTION_ENCODED_OVERHEAD 16u -#define SBP_MSG_SSR_GRIDDED_CORRECTION 0x05FC /** * The maximum number of items that can be stored in - * sbp_msg_ssr_gridded_correction_t::stec_residuals (V4 API) or - * msg_ssr_gridded_correction_t::stec_residuals (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_ssr_gridded_correction_t::stec_residuals before the maximum SBP + * message size is exceeded */ #define SBP_MSG_SSR_GRIDDED_CORRECTION_STEC_RESIDUALS_MAX 46u /** - * Encoded length of sbp_msg_ssr_gridded_correction_t (V4 API) and - * msg_ssr_gridded_correction_t (legacy API) + * Encoded length of sbp_msg_ssr_gridded_correction_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_gridded_correction_encoded_len to determine the actual size of - * an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) @@ -211,53 +181,42 @@ #define SBP_MSG_SSR_GRIDDED_CORRECTION_ENCODED_OVERHEAD 23u /** - * Encoded length of sbp_stec_sat_element_integrity_t (V4 API) and - * stec_sat_element_integrity_t (legacy API) + * Encoded length of sbp_stec_sat_element_integrity_t (V4 API) */ #define SBP_STEC_SAT_ELEMENT_INTEGRITY_ENCODED_LEN 9u -#define SBP_MSG_SSR_GRIDDED_CORRECTION_BOUNDS 0x05FE /** * The maximum number of items that can be stored in - * sbp_msg_ssr_gridded_correction_bounds_t::stec_sat_list (V4 API) or - * msg_ssr_gridded_correction_bounds_t::stec_sat_list (legacy API) before the - * maximum SBP message size is exceeded + * sbp_msg_ssr_gridded_correction_bounds_t::stec_sat_list before the maximum SBP + * message size is exceeded */ #define SBP_MSG_SSR_GRIDDED_CORRECTION_BOUNDS_STEC_SAT_LIST_MAX 25u /** - * Encoded length of sbp_msg_ssr_gridded_correction_bounds_t (V4 API) and - * msg_ssr_gridded_correction_bounds_t (legacy API) + * Encoded length of sbp_msg_ssr_gridded_correction_bounds_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_gridded_correction_bounds_encoded_len to determine the actual - * size of an instance of this message. Users of the legacy API are required to - * track the encoded message length when interacting with the legacy type. + * size of an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SSR_GRIDDED_CORRECTION_BOUNDS_ENCODED_OVERHEAD 27u -#define SBP_MSG_SSR_TILE_DEFINITION_DEP_A 0x05F6 /** - * Encoded length of sbp_msg_ssr_tile_definition_dep_a_t (V4 API) and - * msg_ssr_tile_definition_dep_a_t (legacy API) + * Encoded length of sbp_msg_ssr_tile_definition_dep_a_t (V4 API) */ #define SBP_MSG_SSR_TILE_DEFINITION_DEP_A_ENCODED_LEN 24u -#define SBP_MSG_SSR_TILE_DEFINITION_DEP_B 0x05F7 /** - * Encoded length of sbp_msg_ssr_tile_definition_dep_b_t (V4 API) and - * msg_ssr_tile_definition_dep_b_t (legacy API) + * Encoded length of sbp_msg_ssr_tile_definition_dep_b_t (V4 API) */ #define SBP_MSG_SSR_TILE_DEFINITION_DEP_B_ENCODED_LEN 25u -#define SBP_MSG_SSR_TILE_DEFINITION 0x05F8 /** - * Encoded length of sbp_msg_ssr_tile_definition_t (V4 API) and - * msg_ssr_tile_definition_t (legacy API) + * Encoded length of sbp_msg_ssr_tile_definition_t (V4 API) */ #define SBP_MSG_SSR_TILE_DEFINITION_ENCODED_LEN 33u @@ -301,187 +260,155 @@ #define SBP_SATELLITEAPC_SATELLITE_TYPE_BEIDOU_3SI_SECM (24) /** * The maximum number of items that can be stored in sbp_satellite_apc_t::pco - * (V4 API) or satellite_apc_t::pco (legacy API) before the maximum SBP message - * size is exceeded + * before the maximum SBP message size is exceeded */ #define SBP_SATELLITE_APC_PCO_MAX 3u /** * The maximum number of items that can be stored in sbp_satellite_apc_t::pcv - * (V4 API) or satellite_apc_t::pcv (legacy API) before the maximum SBP message - * size is exceeded + * before the maximum SBP message size is exceeded */ #define SBP_SATELLITE_APC_PCV_MAX 21u /** - * Encoded length of sbp_satellite_apc_t (V4 API) and - * satellite_apc_t (legacy API) + * Encoded length of sbp_satellite_apc_t (V4 API) */ #define SBP_SATELLITE_APC_ENCODED_LEN 32u -#define SBP_MSG_SSR_SATELLITE_APC_DEP 0x0604 /** * The maximum number of items that can be stored in - * sbp_msg_ssr_satellite_apc_dep_t::apc (V4 API) or - * msg_ssr_satellite_apc_dep_t::apc (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_ssr_satellite_apc_dep_t::apc before the maximum SBP message size is + * exceeded */ #define SBP_MSG_SSR_SATELLITE_APC_DEP_APC_MAX 7u /** - * Encoded length of sbp_msg_ssr_satellite_apc_dep_t (V4 API) and - * msg_ssr_satellite_apc_dep_t (legacy API) + * Encoded length of sbp_msg_ssr_satellite_apc_dep_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_satellite_apc_dep_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SSR_SATELLITE_APC_DEP_ENCODED_OVERHEAD 0u -#define SBP_MSG_SSR_SATELLITE_APC 0x0605 /** * The maximum number of items that can be stored in - * sbp_msg_ssr_satellite_apc_t::apc (V4 API) or msg_ssr_satellite_apc_t::apc - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_ssr_satellite_apc_t::apc before the maximum SBP message size is + * exceeded */ #define SBP_MSG_SSR_SATELLITE_APC_APC_MAX 7u /** - * Encoded length of sbp_msg_ssr_satellite_apc_t (V4 API) and - * msg_ssr_satellite_apc_t (legacy API) + * Encoded length of sbp_msg_ssr_satellite_apc_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_satellite_apc_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SSR_SATELLITE_APC_ENCODED_OVERHEAD 9u -#define SBP_MSG_SSR_ORBIT_CLOCK_DEP_A 0x05DC /** - * Encoded length of sbp_msg_ssr_orbit_clock_dep_a_t (V4 API) and - * msg_ssr_orbit_clock_dep_a_t (legacy API) + * Encoded length of sbp_msg_ssr_orbit_clock_dep_a_t (V4 API) */ #define SBP_MSG_SSR_ORBIT_CLOCK_DEP_A_ENCODED_LEN 47u /** - * Encoded length of sbp_stec_header_dep_a_t (V4 API) and - * stec_header_dep_a_t (legacy API) + * Encoded length of sbp_stec_header_dep_a_t (V4 API) */ #define SBP_STEC_HEADER_DEP_A_ENCODED_LEN 10u /** - * Encoded length of sbp_gridded_correction_header_dep_a_t (V4 API) and - * gridded_correction_header_dep_a_t (legacy API) + * Encoded length of sbp_gridded_correction_header_dep_a_t (V4 API) */ #define SBP_GRIDDED_CORRECTION_HEADER_DEP_A_ENCODED_LEN 13u /** - * Encoded length of sbp_grid_definition_header_dep_a_t (V4 API) and - * grid_definition_header_dep_a_t (legacy API) + * Encoded length of sbp_grid_definition_header_dep_a_t (V4 API) */ #define SBP_GRID_DEFINITION_HEADER_DEP_A_ENCODED_LEN 9u -#define SBP_MSG_SSR_STEC_CORRECTION_DEP_A 0x05EB /** * The maximum number of items that can be stored in - * sbp_msg_ssr_stec_correction_dep_a_t::stec_sat_list (V4 API) or - * msg_ssr_stec_correction_dep_a_t::stec_sat_list (legacy API) before the - * maximum SBP message size is exceeded + * sbp_msg_ssr_stec_correction_dep_a_t::stec_sat_list before the maximum SBP + * message size is exceeded */ #define SBP_MSG_SSR_STEC_CORRECTION_DEP_A_STEC_SAT_LIST_MAX 22u /** - * Encoded length of sbp_msg_ssr_stec_correction_dep_a_t (V4 API) and - * msg_ssr_stec_correction_dep_a_t (legacy API) + * Encoded length of sbp_msg_ssr_stec_correction_dep_a_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_stec_correction_dep_a_encoded_len to determine the actual size - * of an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * of an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SSR_STEC_CORRECTION_DEP_A_ENCODED_OVERHEAD 10u -#define SBP_MSG_SSR_GRIDDED_CORRECTION_NO_STD_DEP_A 0x05F0 /** * The maximum number of items that can be stored in - * sbp_msg_ssr_gridded_correction_no_std_dep_a_t::stec_residuals (V4 API) or - * msg_ssr_gridded_correction_no_std_dep_a_t::stec_residuals (legacy API) before - * the maximum SBP message size is exceeded + * sbp_msg_ssr_gridded_correction_no_std_dep_a_t::stec_residuals before the + * maximum SBP message size is exceeded */ #define SBP_MSG_SSR_GRIDDED_CORRECTION_NO_STD_DEP_A_STEC_RESIDUALS_MAX 59u /** - * Encoded length of sbp_msg_ssr_gridded_correction_no_std_dep_a_t (V4 API) and - * msg_ssr_gridded_correction_no_std_dep_a_t (legacy API) + * Encoded length of sbp_msg_ssr_gridded_correction_no_std_dep_a_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_gridded_correction_no_std_dep_a_encoded_len to determine the - * actual size of an instance of this message. Users of the legacy API are - * required to track the encoded message length when interacting with the legacy - * type. + * actual size of an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SSR_GRIDDED_CORRECTION_NO_STD_DEP_A_ENCODED_OVERHEAD 18u -#define SBP_MSG_SSR_GRIDDED_CORRECTION_DEP_A 0x05FA /** * The maximum number of items that can be stored in - * sbp_msg_ssr_gridded_correction_dep_a_t::stec_residuals (V4 API) or - * msg_ssr_gridded_correction_dep_a_t::stec_residuals (legacy API) before the - * maximum SBP message size is exceeded + * sbp_msg_ssr_gridded_correction_dep_a_t::stec_residuals before the maximum SBP + * message size is exceeded */ #define SBP_MSG_SSR_GRIDDED_CORRECTION_DEP_A_STEC_RESIDUALS_MAX 47u /** - * Encoded length of sbp_msg_ssr_gridded_correction_dep_a_t (V4 API) and - * msg_ssr_gridded_correction_dep_a_t (legacy API) + * Encoded length of sbp_msg_ssr_gridded_correction_dep_a_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_gridded_correction_dep_a_encoded_len to determine the actual - * size of an instance of this message. Users of the legacy API are required to - * track the encoded message length when interacting with the legacy type. + * size of an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_SSR_GRIDDED_CORRECTION_DEP_A_ENCODED_OVERHEAD 19u -#define SBP_MSG_SSR_GRID_DEFINITION_DEP_A 0x05F5 /** * The maximum number of items that can be stored in - * sbp_msg_ssr_grid_definition_dep_a_t::rle_list (V4 API) or - * msg_ssr_grid_definition_dep_a_t::rle_list (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_ssr_grid_definition_dep_a_t::rle_list before the maximum SBP message + * size is exceeded */ #define SBP_MSG_SSR_GRID_DEFINITION_DEP_A_RLE_LIST_MAX 246u /** - * Encoded length of sbp_msg_ssr_grid_definition_dep_a_t (V4 API) and - * msg_ssr_grid_definition_dep_a_t (legacy API) + * Encoded length of sbp_msg_ssr_grid_definition_dep_a_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_grid_definition_dep_a_encoded_len to determine the actual size - * of an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * of an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) @@ -489,29 +416,24 @@ #define SBP_MSG_SSR_GRID_DEFINITION_DEP_A_ENCODED_OVERHEAD 9u /** - * Encoded length of sbp_orbit_clock_bound_t (V4 API) and - * orbit_clock_bound_t (legacy API) + * Encoded length of sbp_orbit_clock_bound_t (V4 API) */ #define SBP_ORBIT_CLOCK_BOUND_ENCODED_LEN 9u -#define SBP_MSG_SSR_ORBIT_CLOCK_BOUNDS 0x05DE /** * The maximum number of items that can be stored in - * sbp_msg_ssr_orbit_clock_bounds_t::orbit_clock_bounds (V4 API) or - * msg_ssr_orbit_clock_bounds_t::orbit_clock_bounds (legacy API) before the - * maximum SBP message size is exceeded + * sbp_msg_ssr_orbit_clock_bounds_t::orbit_clock_bounds before the maximum SBP + * message size is exceeded */ #define SBP_MSG_SSR_ORBIT_CLOCK_BOUNDS_ORBIT_CLOCK_BOUNDS_MAX 26u /** - * Encoded length of sbp_msg_ssr_orbit_clock_bounds_t (V4 API) and - * msg_ssr_orbit_clock_bounds_t (legacy API) + * Encoded length of sbp_msg_ssr_orbit_clock_bounds_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_orbit_clock_bounds_encoded_len to determine the actual size of - * an instance of this message. Users of the legacy API are required to track - * the encoded message length when interacting with the legacy type. + * an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) @@ -519,29 +441,24 @@ #define SBP_MSG_SSR_ORBIT_CLOCK_BOUNDS_ENCODED_OVERHEAD 13u /** - * Encoded length of sbp_code_phase_biases_sat_sig_t (V4 API) and - * code_phase_biases_sat_sig_t (legacy API) + * Encoded length of sbp_code_phase_biases_sat_sig_t (V4 API) */ #define SBP_CODE_PHASE_BIASES_SAT_SIG_ENCODED_LEN 6u -#define SBP_MSG_SSR_CODE_PHASE_BIASES_BOUNDS 0x05EC /** * The maximum number of items that can be stored in - * sbp_msg_ssr_code_phase_biases_bounds_t::satellites_signals (V4 API) or - * msg_ssr_code_phase_biases_bounds_t::satellites_signals (legacy API) before - * the maximum SBP message size is exceeded + * sbp_msg_ssr_code_phase_biases_bounds_t::satellites_signals before the maximum + * SBP message size is exceeded */ #define SBP_MSG_SSR_CODE_PHASE_BIASES_BOUNDS_SATELLITES_SIGNALS_MAX 40u /** - * Encoded length of sbp_msg_ssr_code_phase_biases_bounds_t (V4 API) and - * msg_ssr_code_phase_biases_bounds_t (legacy API) + * Encoded length of sbp_msg_ssr_code_phase_biases_bounds_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_ssr_code_phase_biases_bounds_encoded_len to determine the actual - * size of an instance of this message. Users of the legacy API are required to - * track the encoded message length when interacting with the legacy type. + * size of an instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) @@ -549,15 +466,12 @@ #define SBP_MSG_SSR_CODE_PHASE_BIASES_BOUNDS_ENCODED_OVERHEAD 13u /** - * Encoded length of sbp_orbit_clock_bound_degradation_t (V4 API) and - * orbit_clock_bound_degradation_t (legacy API) + * Encoded length of sbp_orbit_clock_bound_degradation_t (V4 API) */ #define SBP_ORBIT_CLOCK_BOUND_DEGRADATION_ENCODED_LEN 8u -#define SBP_MSG_SSR_ORBIT_CLOCK_BOUNDS_DEGRADATION 0x05DF /** - * Encoded length of sbp_msg_ssr_orbit_clock_bounds_degradation_t (V4 API) and - * msg_ssr_orbit_clock_bounds_degradation_t (legacy API) + * Encoded length of sbp_msg_ssr_orbit_clock_bounds_degradation_t (V4 API) */ #define SBP_MSG_SSR_ORBIT_CLOCK_BOUNDS_DEGRADATION_ENCODED_LEN 28u diff --git a/c/include/libsbp/system_macros.h b/c/include/libsbp/system_macros.h index 780df5e619..9c38b450fa 100644 --- a/c/include/libsbp/system_macros.h +++ b/c/include/libsbp/system_macros.h @@ -18,7 +18,6 @@ #ifndef LIBSBP_SYSTEM_MACROS_H #define LIBSBP_SYSTEM_MACROS_H -#define SBP_MSG_STARTUP 0xFF00 #define SBP_STARTUP_CAUSE_OF_STARTUP_MASK (0xffu) #define SBP_STARTUP_CAUSE_OF_STARTUP_SHIFT (0u) #define SBP_STARTUP_CAUSE_OF_STARTUP_GET(flags) \ @@ -51,12 +50,10 @@ #define SBP_STARTUP_HOT_START (2) #define SBP_STARTUP_HOT_START (2) /** - * Encoded length of sbp_msg_startup_t (V4 API) and - * msg_startup_t (legacy API) + * Encoded length of sbp_msg_startup_t (V4 API) */ #define SBP_MSG_STARTUP_ENCODED_LEN 4u -#define SBP_MSG_DGNSS_STATUS 0xFF02 #define SBP_DGNSS_STATUS_DIFFERENTIAL_TYPE_MASK (0xfu) #define SBP_DGNSS_STATUS_DIFFERENTIAL_TYPE_SHIFT (0u) #define SBP_DGNSS_STATUS_DIFFERENTIAL_TYPE_GET(flags) \ @@ -76,27 +73,24 @@ #define SBP_DGNSS_STATUS_DIFFERENTIAL_TYPE_RTK (2) /** * The maximum number of items that can be stored in - * sbp_msg_dgnss_status_t::source (V4 API) or msg_dgnss_status_t::source (legacy - * API) before the maximum SBP message size is exceeded + * sbp_msg_dgnss_status_t::source before the maximum SBP message size is + * exceeded */ #define SBP_MSG_DGNSS_STATUS_SOURCE_MAX 251u /** - * Encoded length of sbp_msg_dgnss_status_t (V4 API) and - * msg_dgnss_status_t (legacy API) + * Encoded length of sbp_msg_dgnss_status_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_dgnss_status_encoded_len to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_DGNSS_STATUS_ENCODED_OVERHEAD 4u -#define SBP_MSG_HEARTBEAT 0xFFFF #define SBP_HEARTBEAT_EXTERNAL_ANTENNA_PRESENT_MASK (0x1u) #define SBP_HEARTBEAT_EXTERNAL_ANTENNA_PRESENT_SHIFT (31u) #define SBP_HEARTBEAT_EXTERNAL_ANTENNA_PRESENT_GET(flags) \ @@ -207,8 +201,7 @@ #define SBP_HEARTBEAT_SYSTEM_ERROR_FLAG_SYSTEM_HEALTHY (0) #define SBP_HEARTBEAT_SYSTEM_ERROR_FLAG_AN_ERROR_HAS_OCCURRED (1) /** - * Encoded length of sbp_msg_heartbeat_t (V4 API) and - * msg_heartbeat_t (legacy API) + * Encoded length of sbp_msg_heartbeat_t (V4 API) */ #define SBP_MSG_HEARTBEAT_ENCODED_LEN 4u @@ -251,12 +244,10 @@ #define SBP_SUBSYSTEMREPORT_GENERIC_DEGRADED (3) #define SBP_SUBSYSTEMREPORT_GENERIC_UNUSABLE (4) /** - * Encoded length of sbp_sub_system_report_t (V4 API) and - * sub_system_report_t (legacy API) + * Encoded length of sbp_sub_system_report_t (V4 API) */ #define SBP_SUB_SYSTEM_REPORT_ENCODED_LEN 4u -#define SBP_MSG_STATUS_REPORT 0xFFFE #define SBP_STATUS_REPORT_SYSTEM_MASK (0xffffu) #define SBP_STATUS_REPORT_SYSTEM_SHIFT (0u) #define SBP_STATUS_REPORT_SYSTEM_GET(flags) \ @@ -306,20 +297,18 @@ /** * The maximum number of items that can be stored in - * sbp_msg_status_report_t::status (V4 API) or msg_status_report_t::status - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_status_report_t::status before the maximum SBP message size is + * exceeded */ #define SBP_MSG_STATUS_REPORT_STATUS_MAX 60u /** - * Encoded length of sbp_msg_status_report_t (V4 API) and - * msg_status_report_t (legacy API) + * Encoded length of sbp_msg_status_report_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_status_report_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) @@ -327,12 +316,10 @@ #define SBP_MSG_STATUS_REPORT_ENCODED_OVERHEAD 12u /** - * Encoded length of sbp_status_journal_item_t (V4 API) and - * status_journal_item_t (legacy API) + * Encoded length of sbp_status_journal_item_t (V4 API) */ #define SBP_STATUS_JOURNAL_ITEM_ENCODED_LEN 8u -#define SBP_MSG_STATUS_JOURNAL 0xFFFD #define SBP_STATUS_JOURNAL_SYSTEM_MASK (0xffffu) #define SBP_STATUS_JOURNAL_SYSTEM_SHIFT (0u) #define SBP_STATUS_JOURNAL_SYSTEM_GET(flags) \ @@ -382,27 +369,24 @@ /** * The maximum number of items that can be stored in - * sbp_msg_status_journal_t::journal (V4 API) or msg_status_journal_t::journal - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_status_journal_t::journal before the maximum SBP message size is + * exceeded */ #define SBP_MSG_STATUS_JOURNAL_JOURNAL_MAX 30u /** - * Encoded length of sbp_msg_status_journal_t (V4 API) and - * msg_status_journal_t (legacy API) + * Encoded length of sbp_msg_status_journal_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_status_journal_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_STATUS_JOURNAL_ENCODED_OVERHEAD 9u -#define SBP_MSG_INS_STATUS 0xFF03 #define SBP_INS_STATUS_INS_TYPE_MASK (0x7u) #define SBP_INS_STATUS_INS_TYPE_SHIFT (29u) #define SBP_INS_STATUS_INS_TYPE_GET(flags) \ @@ -519,60 +503,50 @@ #define SBP_INS_STATUS_MODE_FASTSTART_VALIDATING (5) #define SBP_INS_STATUS_MODE_VALIDATING_UNSAFE_FAST_START_SEED (6) /** - * Encoded length of sbp_msg_ins_status_t (V4 API) and - * msg_ins_status_t (legacy API) + * Encoded length of sbp_msg_ins_status_t (V4 API) */ #define SBP_MSG_INS_STATUS_ENCODED_LEN 4u -#define SBP_MSG_CSAC_TELEMETRY 0xFF04 /** * The maximum number of items that can be stored in - * sbp_msg_csac_telemetry_t::telemetry (V4 API) or - * msg_csac_telemetry_t::telemetry (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_csac_telemetry_t::telemetry before the maximum SBP message size is + * exceeded */ #define SBP_MSG_CSAC_TELEMETRY_TELEMETRY_MAX 254u /** - * Encoded length of sbp_msg_csac_telemetry_t (V4 API) and - * msg_csac_telemetry_t (legacy API) + * Encoded length of sbp_msg_csac_telemetry_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_csac_telemetry_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_CSAC_TELEMETRY_ENCODED_OVERHEAD 1u -#define SBP_MSG_CSAC_TELEMETRY_LABELS 0xFF05 /** * The maximum number of items that can be stored in - * sbp_msg_csac_telemetry_labels_t::telemetry_labels (V4 API) or - * msg_csac_telemetry_labels_t::telemetry_labels (legacy API) before the maximum - * SBP message size is exceeded + * sbp_msg_csac_telemetry_labels_t::telemetry_labels before the maximum SBP + * message size is exceeded */ #define SBP_MSG_CSAC_TELEMETRY_LABELS_TELEMETRY_LABELS_MAX 254u /** - * Encoded length of sbp_msg_csac_telemetry_labels_t (V4 API) and - * msg_csac_telemetry_labels_t (legacy API) + * Encoded length of sbp_msg_csac_telemetry_labels_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_csac_telemetry_labels_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) */ #define SBP_MSG_CSAC_TELEMETRY_LABELS_ENCODED_OVERHEAD 1u -#define SBP_MSG_INS_UPDATES 0xFF06 #define SBP_INS_UPDATES_NUMBER_OF_ATTEMPTED_GNSS_POSITION_UPDATES_SINCE_LAST_MESSAGE_MASK \ (0xfu) #define SBP_INS_UPDATES_NUMBER_OF_ATTEMPTED_GNSS_POSITION_UPDATES_SINCE_LAST_MESSAGE_SHIFT \ @@ -850,19 +824,15 @@ } while (0) /** - * Encoded length of sbp_msg_ins_updates_t (V4 API) and - * msg_ins_updates_t (legacy API) + * Encoded length of sbp_msg_ins_updates_t (V4 API) */ #define SBP_MSG_INS_UPDATES_ENCODED_LEN 10u -#define SBP_MSG_GNSS_TIME_OFFSET 0xFF07 /** - * Encoded length of sbp_msg_gnss_time_offset_t (V4 API) and - * msg_gnss_time_offset_t (legacy API) + * Encoded length of sbp_msg_gnss_time_offset_t (V4 API) */ #define SBP_MSG_GNSS_TIME_OFFSET_ENCODED_LEN 9u -#define SBP_MSG_PPS_TIME 0xFF08 #define SBP_PPS_TIME_RESERVED_SET_TO_ZERO_MASK (0x3fu) #define SBP_PPS_TIME_RESERVED_SET_TO_ZERO_SHIFT (2u) #define SBP_PPS_TIME_RESERVED_SET_TO_ZERO_GET(flags) \ @@ -898,12 +868,10 @@ #define SBP_PPS_TIME_TIME_UNCERTAINTY__1_MICROSECONDS (3) #define SBP_PPS_TIME_TIME_UNCERTAINTY_1_MICROSECONDS (3) /** - * Encoded length of sbp_msg_pps_time_t (V4 API) and - * msg_pps_time_t (legacy API) + * Encoded length of sbp_msg_pps_time_t (V4 API) */ #define SBP_MSG_PPS_TIME_ENCODED_LEN 9u -#define SBP_MSG_SENSOR_AID_EVENT 0xFF09 #define SBP_SENSOR_AID_EVENT_TYPE_IDENTIFIER_MASK (0xffu) #define SBP_SENSOR_AID_EVENT_TYPE_IDENTIFIER_SHIFT (0u) #define SBP_SENSOR_AID_EVENT_TYPE_IDENTIFIER_GET(flags) \ @@ -927,12 +895,10 @@ #define SBP_SENSOR_AID_EVENT_TYPE_IDENTIFIER_TIME_DIFFERENCES_OF_CARRIER_PHASE \ (6) /** - * Encoded length of sbp_msg_sensor_aid_event_t (V4 API) and - * msg_sensor_aid_event_t (legacy API) + * Encoded length of sbp_msg_sensor_aid_event_t (V4 API) */ #define SBP_MSG_SENSOR_AID_EVENT_ENCODED_LEN 15u -#define SBP_MSG_GROUP_META 0xFF0A #define SBP_GROUP_META_SOLUTION_GROUP_TYPE_MASK (0x3u) #define SBP_GROUP_META_SOLUTION_GROUP_TYPE_SHIFT (0u) #define SBP_GROUP_META_SOLUTION_GROUP_TYPE_GET(flags) \ @@ -952,20 +918,18 @@ #define SBP_GROUP_META_SOLUTION_GROUP_TYPE_GNSSINS (2) /** * The maximum number of items that can be stored in - * sbp_msg_group_meta_t::group_msgs (V4 API) or msg_group_meta_t::group_msgs - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_group_meta_t::group_msgs before the maximum SBP message size is + * exceeded */ #define SBP_MSG_GROUP_META_GROUP_MSGS_MAX 126u /** - * Encoded length of sbp_msg_group_meta_t (V4 API) and - * msg_group_meta_t (legacy API) + * Encoded length of sbp_msg_group_meta_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_group_meta_encoded_len to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) diff --git a/c/include/libsbp/telemetry/TelemetrySV.h b/c/include/libsbp/telemetry/TelemetrySV.h index 4a5819d49f..d85fdcbd9e 100644 --- a/c/include/libsbp/telemetry/TelemetrySV.h +++ b/c/include/libsbp/telemetry/TelemetrySV.h @@ -84,7 +84,7 @@ typedef struct { /** * GNSS signal identifier (16 bit) */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; } sbp_telemetry_sv_t; /** diff --git a/c/include/libsbp/telemetry_macros.h b/c/include/libsbp/telemetry_macros.h index f628119d67..c987857272 100644 --- a/c/include/libsbp/telemetry_macros.h +++ b/c/include/libsbp/telemetry_macros.h @@ -171,12 +171,10 @@ #define SBP_TELEMETRYSV_EPHEMERIS_AVAILABLE_VALID_EPHEMERIS_AVAILABLE (0) #define SBP_TELEMETRYSV_EPHEMERIS_AVAILABLE_NO_VALID_EPHEMERIS_AVAILABLE (1) /** - * Encoded length of sbp_telemetry_sv_t (V4 API) and - * telemetry_sv_t (legacy API) + * Encoded length of sbp_telemetry_sv_t (V4 API) */ #define SBP_TELEMETRY_SV_ENCODED_LEN 12u -#define SBP_MSG_TEL_SV 0x0120 #define SBP_TEL_SV_FILTER_TYPE_MASK (0xffu) #define SBP_TEL_SV_FILTER_TYPE_SHIFT (0u) #define SBP_TEL_SV_FILTER_TYPE_GET(flags) \ @@ -194,20 +192,17 @@ #define SBP_TEL_SV_FILTER_TYPE_DIFFERENTIAL (1) /** * The maximum number of items that can be stored in sbp_msg_tel_sv_t::sv_tel - * (V4 API) or msg_tel_sv_t::sv_tel (legacy API) before the maximum SBP message - * size is exceeded + * before the maximum SBP message size is exceeded */ #define SBP_MSG_TEL_SV_SV_TEL_MAX 20u /** - * Encoded length of sbp_msg_tel_sv_t (V4 API) and - * msg_tel_sv_t (legacy API) + * Encoded length of sbp_msg_tel_sv_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_tel_sv_encoded_len to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) diff --git a/c/include/libsbp/tracking/MSG_TRACKING_IQ.h b/c/include/libsbp/tracking/MSG_TRACKING_IQ.h index 0ea9145923..23f45c13a1 100644 --- a/c/include/libsbp/tracking/MSG_TRACKING_IQ.h +++ b/c/include/libsbp/tracking/MSG_TRACKING_IQ.h @@ -54,7 +54,7 @@ typedef struct { /** * GNSS signal identifier */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; /** * Early, Prompt and Late correlations diff --git a/c/include/libsbp/tracking/MSG_TRACKING_IQ_DEP_B.h b/c/include/libsbp/tracking/MSG_TRACKING_IQ_DEP_B.h index 87d6507acd..f0f2254f57 100644 --- a/c/include/libsbp/tracking/MSG_TRACKING_IQ_DEP_B.h +++ b/c/include/libsbp/tracking/MSG_TRACKING_IQ_DEP_B.h @@ -53,7 +53,7 @@ typedef struct { /** * GNSS signal identifier */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; /** * Early, Prompt and Late correlations diff --git a/c/include/libsbp/tracking/MSG_TRACKING_STATE_DETAILED_DEP_A.h b/c/include/libsbp/tracking/MSG_TRACKING_STATE_DETAILED_DEP_A.h index e9872b3c85..097edf028f 100644 --- a/c/include/libsbp/tracking/MSG_TRACKING_STATE_DETAILED_DEP_A.h +++ b/c/include/libsbp/tracking/MSG_TRACKING_STATE_DETAILED_DEP_A.h @@ -57,7 +57,7 @@ typedef struct { * status is decoded or propagated. WN only valid when week number valid flag * is set. */ - sbp_v4_gps_time_t tot; + sbp_gps_time_t tot; /** * Pseudorange observation. Valid only when pseudorange valid flag is set. [2 @@ -91,7 +91,7 @@ typedef struct { /** * GNSS signal identifier. */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; /** * Carrier Doppler frequency. [Hz / 16] diff --git a/c/include/libsbp/tracking/MeasurementState.h b/c/include/libsbp/tracking/MeasurementState.h index 0bdbfcead8..cd8cce0756 100644 --- a/c/include/libsbp/tracking/MeasurementState.h +++ b/c/include/libsbp/tracking/MeasurementState.h @@ -50,7 +50,7 @@ typedef struct { * Measurement Engine GNSS signal being tracked (carries either Glonass FCN or * SLOT) */ - sbp_v4_gnss_signal_t mesid; + sbp_gnss_signal_t mesid; /** * Carrier-to-Noise density. Zero implies invalid cn0. [dB Hz / 4] diff --git a/c/include/libsbp/tracking/TrackingChannelState.h b/c/include/libsbp/tracking/TrackingChannelState.h index e3ceb4ade9..4f15e92777 100644 --- a/c/include/libsbp/tracking/TrackingChannelState.h +++ b/c/include/libsbp/tracking/TrackingChannelState.h @@ -48,7 +48,7 @@ typedef struct { /** * GNSS signal being tracked */ - sbp_v4_gnss_signal_t sid; + sbp_gnss_signal_t sid; /** * Frequency channel number (GLONASS only) diff --git a/c/include/libsbp/tracking_macros.h b/c/include/libsbp/tracking_macros.h index 3009594582..39eb15b96a 100644 --- a/c/include/libsbp/tracking_macros.h +++ b/c/include/libsbp/tracking_macros.h @@ -18,7 +18,6 @@ #ifndef LIBSBP_TRACKING_MACROS_H #define LIBSBP_TRACKING_MACROS_H -#define SBP_MSG_TRACKING_STATE_DETAILED_DEP_A 0x0021 #define SBP_TRACKING_STATE_DETAILED_DEP_A_SYNCHRONIZATION_STATUS_MASK (0x7u) #define SBP_TRACKING_STATE_DETAILED_DEP_A_SYNCHRONIZATION_STATUS_SHIFT (0u) #define SBP_TRACKING_STATE_DETAILED_DEP_A_SYNCHRONIZATION_STATUS_GET(flags) \ @@ -366,12 +365,10 @@ (0) #define SBP_TRACKING_STATE_DETAILED_DEP_A_TRACKING_CHANNEL_STATUS_RUNNING (1) /** - * Encoded length of sbp_msg_tracking_state_detailed_dep_a_t (V4 API) and - * msg_tracking_state_detailed_dep_a_t (legacy API) + * Encoded length of sbp_msg_tracking_state_detailed_dep_a_t (V4 API) */ #define SBP_MSG_TRACKING_STATE_DETAILED_DEP_A_ENCODED_LEN 57u -#define SBP_MSG_TRACKING_STATE_DETAILED_DEP 0x0011 #define SBP_TRACKING_STATE_DETAILED_DEP_SYNCHRONIZATION_STATUS_MASK (0x7u) #define SBP_TRACKING_STATE_DETAILED_DEP_SYNCHRONIZATION_STATUS_SHIFT (0u) #define SBP_TRACKING_STATE_DETAILED_DEP_SYNCHRONIZATION_STATUS_GET(flags) \ @@ -702,34 +699,29 @@ (0) #define SBP_TRACKING_STATE_DETAILED_DEP_TRACKING_CHANNEL_STATUS_RUNNING (1) /** - * Encoded length of sbp_msg_tracking_state_detailed_dep_t (V4 API) and - * msg_tracking_state_detailed_dep_t (legacy API) + * Encoded length of sbp_msg_tracking_state_detailed_dep_t (V4 API) */ #define SBP_MSG_TRACKING_STATE_DETAILED_DEP_ENCODED_LEN 55u /** - * Encoded length of sbp_tracking_channel_state_t (V4 API) and - * tracking_channel_state_t (legacy API) + * Encoded length of sbp_tracking_channel_state_t (V4 API) */ #define SBP_TRACKING_CHANNEL_STATE_ENCODED_LEN 4u -#define SBP_MSG_TRACKING_STATE 0x0041 /** * The maximum number of items that can be stored in - * sbp_msg_tracking_state_t::states (V4 API) or msg_tracking_state_t::states - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_tracking_state_t::states before the maximum SBP message size is + * exceeded */ #define SBP_MSG_TRACKING_STATE_STATES_MAX 63u /** - * Encoded length of sbp_msg_tracking_state_t (V4 API) and - * msg_tracking_state_t (legacy API) + * Encoded length of sbp_msg_tracking_state_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_tracking_state_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) @@ -737,29 +729,24 @@ #define SBP_MSG_TRACKING_STATE_ENCODED_OVERHEAD 0u /** - * Encoded length of sbp_measurement_state_t (V4 API) and - * measurement_state_t (legacy API) + * Encoded length of sbp_measurement_state_t (V4 API) */ #define SBP_MEASUREMENT_STATE_ENCODED_LEN 3u -#define SBP_MSG_MEASUREMENT_STATE 0x0061 /** * The maximum number of items that can be stored in - * sbp_msg_measurement_state_t::states (V4 API) or - * msg_measurement_state_t::states (legacy API) before the maximum SBP message - * size is exceeded + * sbp_msg_measurement_state_t::states before the maximum SBP message size is + * exceeded */ #define SBP_MSG_MEASUREMENT_STATE_STATES_MAX 85u /** - * Encoded length of sbp_msg_measurement_state_t (V4 API) and - * msg_measurement_state_t (legacy API) + * Encoded length of sbp_msg_measurement_state_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_measurement_state_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) @@ -767,56 +754,47 @@ #define SBP_MSG_MEASUREMENT_STATE_ENCODED_OVERHEAD 0u /** - * Encoded length of sbp_tracking_channel_correlation_t (V4 API) and - * tracking_channel_correlation_t (legacy API) + * Encoded length of sbp_tracking_channel_correlation_t (V4 API) */ #define SBP_TRACKING_CHANNEL_CORRELATION_ENCODED_LEN 4u -#define SBP_MSG_TRACKING_IQ 0x002D /** * The maximum number of items that can be stored in - * sbp_msg_tracking_iq_t::corrs (V4 API) or msg_tracking_iq_t::corrs (legacy - * API) before the maximum SBP message size is exceeded + * sbp_msg_tracking_iq_t::corrs before the maximum SBP message size is exceeded */ #define SBP_MSG_TRACKING_IQ_CORRS_MAX 3u /** - * Encoded length of sbp_msg_tracking_iq_t (V4 API) and - * msg_tracking_iq_t (legacy API) + * Encoded length of sbp_msg_tracking_iq_t (V4 API) */ #define SBP_MSG_TRACKING_IQ_ENCODED_LEN 15u /** - * Encoded length of sbp_tracking_channel_correlation_dep_t (V4 API) and - * tracking_channel_correlation_dep_t (legacy API) + * Encoded length of sbp_tracking_channel_correlation_dep_t (V4 API) */ #define SBP_TRACKING_CHANNEL_CORRELATION_DEP_ENCODED_LEN 8u -#define SBP_MSG_TRACKING_IQ_DEP_B 0x002C /** * The maximum number of items that can be stored in - * sbp_msg_tracking_iq_dep_b_t::corrs (V4 API) or msg_tracking_iq_dep_b_t::corrs - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_tracking_iq_dep_b_t::corrs before the maximum SBP message size is + * exceeded */ #define SBP_MSG_TRACKING_IQ_DEP_B_CORRS_MAX 3u /** - * Encoded length of sbp_msg_tracking_iq_dep_b_t (V4 API) and - * msg_tracking_iq_dep_b_t (legacy API) + * Encoded length of sbp_msg_tracking_iq_dep_b_t (V4 API) */ #define SBP_MSG_TRACKING_IQ_DEP_B_ENCODED_LEN 27u -#define SBP_MSG_TRACKING_IQ_DEP_A 0x001C /** * The maximum number of items that can be stored in - * sbp_msg_tracking_iq_dep_a_t::corrs (V4 API) or msg_tracking_iq_dep_a_t::corrs - * (legacy API) before the maximum SBP message size is exceeded + * sbp_msg_tracking_iq_dep_a_t::corrs before the maximum SBP message size is + * exceeded */ #define SBP_MSG_TRACKING_IQ_DEP_A_CORRS_MAX 3u /** - * Encoded length of sbp_msg_tracking_iq_dep_a_t (V4 API) and - * msg_tracking_iq_dep_a_t (legacy API) + * Encoded length of sbp_msg_tracking_iq_dep_a_t (V4 API) */ #define SBP_MSG_TRACKING_IQ_DEP_A_ENCODED_LEN 29u @@ -837,29 +815,24 @@ #define SBP_TRACKINGCHANNELSTATEDEPA_TRACKING_MODE_DISABLED (0) #define SBP_TRACKINGCHANNELSTATEDEPA_TRACKING_MODE_RUNNING (1) /** - * Encoded length of sbp_tracking_channel_state_dep_a_t (V4 API) and - * tracking_channel_state_dep_a_t (legacy API) + * Encoded length of sbp_tracking_channel_state_dep_a_t (V4 API) */ #define SBP_TRACKING_CHANNEL_STATE_DEP_A_ENCODED_LEN 6u -#define SBP_MSG_TRACKING_STATE_DEP_A 0x0016 /** * The maximum number of items that can be stored in - * sbp_msg_tracking_state_dep_a_t::states (V4 API) or - * msg_tracking_state_dep_a_t::states (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_tracking_state_dep_a_t::states before the maximum SBP message size is + * exceeded */ #define SBP_MSG_TRACKING_STATE_DEP_A_STATES_MAX 42u /** - * Encoded length of sbp_msg_tracking_state_dep_a_t (V4 API) and - * msg_tracking_state_dep_a_t (legacy API) + * Encoded length of sbp_msg_tracking_state_dep_a_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_tracking_state_dep_a_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) @@ -883,29 +856,24 @@ #define SBP_TRACKINGCHANNELSTATEDEPB_TRACKING_MODE_DISABLED (0) #define SBP_TRACKINGCHANNELSTATEDEPB_TRACKING_MODE_RUNNING (1) /** - * Encoded length of sbp_tracking_channel_state_dep_b_t (V4 API) and - * tracking_channel_state_dep_b_t (legacy API) + * Encoded length of sbp_tracking_channel_state_dep_b_t (V4 API) */ #define SBP_TRACKING_CHANNEL_STATE_DEP_B_ENCODED_LEN 9u -#define SBP_MSG_TRACKING_STATE_DEP_B 0x0013 /** * The maximum number of items that can be stored in - * sbp_msg_tracking_state_dep_b_t::states (V4 API) or - * msg_tracking_state_dep_b_t::states (legacy API) before the maximum SBP - * message size is exceeded + * sbp_msg_tracking_state_dep_b_t::states before the maximum SBP message size is + * exceeded */ #define SBP_MSG_TRACKING_STATE_DEP_B_STATES_MAX 28u /** - * Encoded length of sbp_msg_tracking_state_dep_b_t (V4 API) and - * msg_tracking_state_dep_b_t (legacy API) + * Encoded length of sbp_msg_tracking_state_dep_b_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_tracking_state_dep_b_encoded_len to determine the actual size of an - * instance of this message. Users of the legacy API are required to track the - * encoded message length when interacting with the legacy type. + * instance of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) diff --git a/c/include/libsbp/user_macros.h b/c/include/libsbp/user_macros.h index 9f0ace72a1..bdc18fc300 100644 --- a/c/include/libsbp/user_macros.h +++ b/c/include/libsbp/user_macros.h @@ -18,23 +18,19 @@ #ifndef LIBSBP_USER_MACROS_H #define LIBSBP_USER_MACROS_H -#define SBP_MSG_USER_DATA 0x0800 /** * The maximum number of items that can be stored in - * sbp_msg_user_data_t::contents (V4 API) or msg_user_data_t::contents (legacy - * API) before the maximum SBP message size is exceeded + * sbp_msg_user_data_t::contents before the maximum SBP message size is exceeded */ #define SBP_MSG_USER_DATA_CONTENTS_MAX 255u /** - * Encoded length of sbp_msg_user_data_t (V4 API) and - * msg_user_data_t (legacy API) + * Encoded length of sbp_msg_user_data_t (V4 API) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #sbp_msg_user_data_encoded_len to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) diff --git a/c/include/libsbp/v4/acquisition.h b/c/include/libsbp/v4/acquisition.h deleted file mode 100644 index e77e7fed06..0000000000 --- a/c/include/libsbp/v4/acquisition.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_ACQUISITION_MESSAGES_H -#define LIBSBP_ACQUISITION_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/acquisition.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_ACQUISITION_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/bootload.h b/c/include/libsbp/v4/bootload.h deleted file mode 100644 index 3feb3ffd76..0000000000 --- a/c/include/libsbp/v4/bootload.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_BOOTLOAD_MESSAGES_H -#define LIBSBP_BOOTLOAD_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/bootload.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_BOOTLOAD_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/ext_events.h b/c/include/libsbp/v4/ext_events.h deleted file mode 100644 index 6374cce9de..0000000000 --- a/c/include/libsbp/v4/ext_events.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_EXT_EVENTS_MESSAGES_H -#define LIBSBP_EXT_EVENTS_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/ext_events.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_EXT_EVENTS_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/file_io.h b/c/include/libsbp/v4/file_io.h deleted file mode 100644 index bb0011f90f..0000000000 --- a/c/include/libsbp/v4/file_io.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_FILE_IO_MESSAGES_H -#define LIBSBP_FILE_IO_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/file_io.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_FILE_IO_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/flash.h b/c/include/libsbp/v4/flash.h deleted file mode 100644 index d6fbb52bb9..0000000000 --- a/c/include/libsbp/v4/flash.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_FLASH_MESSAGES_H -#define LIBSBP_FLASH_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/flash.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_FLASH_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/gnss.h b/c/include/libsbp/v4/gnss.h deleted file mode 100644 index bd17d1a4e7..0000000000 --- a/c/include/libsbp/v4/gnss.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_GNSS_MESSAGES_H -#define LIBSBP_GNSS_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/gnss.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_GNSS_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/imu.h b/c/include/libsbp/v4/imu.h deleted file mode 100644 index 877b540e9e..0000000000 --- a/c/include/libsbp/v4/imu.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_IMU_MESSAGES_H -#define LIBSBP_IMU_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/imu.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_IMU_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/integrity.h b/c/include/libsbp/v4/integrity.h deleted file mode 100644 index e183fdb8fe..0000000000 --- a/c/include/libsbp/v4/integrity.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_INTEGRITY_MESSAGES_H -#define LIBSBP_INTEGRITY_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/integrity.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_INTEGRITY_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/linux.h b/c/include/libsbp/v4/linux.h deleted file mode 100644 index 91caefc031..0000000000 --- a/c/include/libsbp/v4/linux.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_LINUX_MESSAGES_H -#define LIBSBP_LINUX_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/linux.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_LINUX_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/logging.h b/c/include/libsbp/v4/logging.h deleted file mode 100644 index 97b48b1908..0000000000 --- a/c/include/libsbp/v4/logging.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_LOGGING_MESSAGES_H -#define LIBSBP_LOGGING_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/logging.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_LOGGING_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/mag.h b/c/include/libsbp/v4/mag.h deleted file mode 100644 index 9b66ef05e6..0000000000 --- a/c/include/libsbp/v4/mag.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_MAG_MESSAGES_H -#define LIBSBP_MAG_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/mag.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_MAG_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/navigation.h b/c/include/libsbp/v4/navigation.h deleted file mode 100644 index 6354edae1d..0000000000 --- a/c/include/libsbp/v4/navigation.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_NAVIGATION_MESSAGES_H -#define LIBSBP_NAVIGATION_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/navigation.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_NAVIGATION_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/ndb.h b/c/include/libsbp/v4/ndb.h deleted file mode 100644 index c00e0dbefb..0000000000 --- a/c/include/libsbp/v4/ndb.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_NDB_MESSAGES_H -#define LIBSBP_NDB_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/ndb.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_NDB_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/observation.h b/c/include/libsbp/v4/observation.h deleted file mode 100644 index 6d1a4e16ac..0000000000 --- a/c/include/libsbp/v4/observation.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_OBSERVATION_MESSAGES_H -#define LIBSBP_OBSERVATION_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/observation.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_OBSERVATION_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/orientation.h b/c/include/libsbp/v4/orientation.h deleted file mode 100644 index cb20b8ebcb..0000000000 --- a/c/include/libsbp/v4/orientation.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_ORIENTATION_MESSAGES_H -#define LIBSBP_ORIENTATION_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/orientation.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_ORIENTATION_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/piksi.h b/c/include/libsbp/v4/piksi.h deleted file mode 100644 index eff9001eb4..0000000000 --- a/c/include/libsbp/v4/piksi.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_PIKSI_MESSAGES_H -#define LIBSBP_PIKSI_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/piksi.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_PIKSI_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/profiling.h b/c/include/libsbp/v4/profiling.h deleted file mode 100644 index 3897b5990e..0000000000 --- a/c/include/libsbp/v4/profiling.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_PROFILING_MESSAGES_H -#define LIBSBP_PROFILING_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/profiling.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_PROFILING_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/sbas.h b/c/include/libsbp/v4/sbas.h deleted file mode 100644 index 3e09e8b727..0000000000 --- a/c/include/libsbp/v4/sbas.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_SBAS_MESSAGES_H -#define LIBSBP_SBAS_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/sbas.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_SBAS_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/settings.h b/c/include/libsbp/v4/settings.h deleted file mode 100644 index 7d2260f398..0000000000 --- a/c/include/libsbp/v4/settings.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_SETTINGS_MESSAGES_H -#define LIBSBP_SETTINGS_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/settings.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_SETTINGS_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/signing.h b/c/include/libsbp/v4/signing.h deleted file mode 100644 index b6aa6f9e6f..0000000000 --- a/c/include/libsbp/v4/signing.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_SIGNING_MESSAGES_H -#define LIBSBP_SIGNING_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/signing.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_SIGNING_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/solution_meta.h b/c/include/libsbp/v4/solution_meta.h deleted file mode 100644 index eb591e0e2d..0000000000 --- a/c/include/libsbp/v4/solution_meta.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_SOLUTION_META_MESSAGES_H -#define LIBSBP_SOLUTION_META_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/solution_meta.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_SOLUTION_META_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/ssr.h b/c/include/libsbp/v4/ssr.h deleted file mode 100644 index 52ae942706..0000000000 --- a/c/include/libsbp/v4/ssr.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_SSR_MESSAGES_H -#define LIBSBP_SSR_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/ssr.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_SSR_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/system.h b/c/include/libsbp/v4/system.h deleted file mode 100644 index ab4a2cb543..0000000000 --- a/c/include/libsbp/v4/system.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_SYSTEM_MESSAGES_H -#define LIBSBP_SYSTEM_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/system.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_SYSTEM_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/telemetry.h b/c/include/libsbp/v4/telemetry.h deleted file mode 100644 index 751dbc7f3a..0000000000 --- a/c/include/libsbp/v4/telemetry.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_TELEMETRY_MESSAGES_H -#define LIBSBP_TELEMETRY_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/telemetry.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_TELEMETRY_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/tracking.h b/c/include/libsbp/v4/tracking.h deleted file mode 100644 index 5bce333400..0000000000 --- a/c/include/libsbp/v4/tracking.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_TRACKING_MESSAGES_H -#define LIBSBP_TRACKING_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/tracking.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_TRACKING_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/user.h b/c/include/libsbp/v4/user.h deleted file mode 100644 index 4b1c6f4d5f..0000000000 --- a/c/include/libsbp/v4/user.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_USER_MESSAGES_H -#define LIBSBP_USER_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/user.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_USER_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/v4/vehicle.h b/c/include/libsbp/v4/vehicle.h deleted file mode 100644 index 71fe6ba287..0000000000 --- a/c/include/libsbp/v4/vehicle.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/ - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_VEHICLE_MESSAGES_H -#define LIBSBP_VEHICLE_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/vehicle.h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_VEHICLE_MESSAGES_H */ \ No newline at end of file diff --git a/c/include/libsbp/vehicle_macros.h b/c/include/libsbp/vehicle_macros.h index 0a77db95a6..b1da226d73 100644 --- a/c/include/libsbp/vehicle_macros.h +++ b/c/include/libsbp/vehicle_macros.h @@ -18,7 +18,6 @@ #ifndef LIBSBP_VEHICLE_MACROS_H #define LIBSBP_VEHICLE_MACROS_H -#define SBP_MSG_ODOMETRY 0x0903 #define SBP_ODOMETRY_VEHICLE_METADATA_MASK (0x3u) #define SBP_ODOMETRY_VEHICLE_METADATA_SHIFT (5u) #define SBP_ODOMETRY_VEHICLE_METADATA_GET(flags) \ @@ -70,12 +69,10 @@ #define SBP_ODOMETRY_TIME_SOURCE_GPS_SOLUTION (1) #define SBP_ODOMETRY_TIME_SOURCE_PROCESSOR_TIME (2) /** - * Encoded length of sbp_msg_odometry_t (V4 API) and - * msg_odometry_t (legacy API) + * Encoded length of sbp_msg_odometry_t (V4 API) */ #define SBP_MSG_ODOMETRY_ENCODED_LEN 9u -#define SBP_MSG_WHEELTICK 0x0904 #define SBP_WHEELTICK_VEHICLE_METADATA_MASK (0x3u) #define SBP_WHEELTICK_VEHICLE_METADATA_SHIFT (2u) #define SBP_WHEELTICK_VEHICLE_METADATA_GET(flags) \ @@ -112,8 +109,7 @@ #define SBP_WHEELTICK_SYNCHRONIZATION_TYPE_LOCAL_CPU_TIME_IN_NOMINAL_MICROSECONDS \ (2) /** - * Encoded length of sbp_msg_wheeltick_t (V4 API) and - * msg_wheeltick_t (legacy API) + * Encoded length of sbp_msg_wheeltick_t (V4 API) */ #define SBP_MSG_WHEELTICK_ENCODED_LEN 14u diff --git a/c/src/acquisition.c b/c/src/acquisition.c index 2f5c4e1b96..2d2b965d18 100644 --- a/c/src/acquisition.c +++ b/c/src/acquisition.c @@ -28,7 +28,7 @@ bool sbp_msg_acq_result_encode_internal(sbp_encode_ctx_t *ctx, if (!sbp_float_encode(ctx, &msg->cf)) { return false; } - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } return true; @@ -60,7 +60,7 @@ bool sbp_msg_acq_result_decode_internal(sbp_decode_ctx_t *ctx, if (!sbp_float_decode(ctx, &msg->cf)) { return false; } - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } return true; @@ -91,7 +91,7 @@ s8 sbp_msg_acq_result_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ACQ_RESULT, sender_id, + return sbp_internal_forward_payload(s, SbpMsgAcqResult, sender_id, payload_len, payload, write); } @@ -114,7 +114,7 @@ int sbp_msg_acq_result_cmp(const sbp_msg_acq_result_t *a, return ret; } - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); return ret; } @@ -194,7 +194,7 @@ s8 sbp_msg_acq_result_dep_c_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ACQ_RESULT_DEP_C, sender_id, + return sbp_internal_forward_payload(s, SbpMsgAcqResultDepC, sender_id, payload_len, payload, write); } @@ -297,7 +297,7 @@ s8 sbp_msg_acq_result_dep_b_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ACQ_RESULT_DEP_B, sender_id, + return sbp_internal_forward_payload(s, SbpMsgAcqResultDepB, sender_id, payload_len, payload, write); } @@ -400,7 +400,7 @@ s8 sbp_msg_acq_result_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ACQ_RESULT_DEP_A, sender_id, + return sbp_internal_forward_payload(s, SbpMsgAcqResultDepA, sender_id, payload_len, payload, write); } @@ -441,7 +441,7 @@ bool sbp_acq_sv_profile_encode_internal(sbp_encode_ctx_t *ctx, if (!sbp_u8_encode(ctx, &msg->int_time)) { return false; } - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u16_encode(ctx, &msg->bin_width)) { @@ -497,7 +497,7 @@ bool sbp_acq_sv_profile_decode_internal(sbp_decode_ctx_t *ctx, if (!sbp_u8_decode(ctx, &msg->int_time)) { return false; } - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u16_decode(ctx, &msg->bin_width)) { @@ -563,7 +563,7 @@ int sbp_acq_sv_profile_cmp(const sbp_acq_sv_profile_t *a, return ret; } - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); if (ret != 0) { return ret; } @@ -844,7 +844,7 @@ s8 sbp_msg_acq_sv_profile_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ACQ_SV_PROFILE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgAcqSvProfile, sender_id, payload_len, payload, write); } @@ -933,7 +933,7 @@ s8 sbp_msg_acq_sv_profile_dep_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ACQ_SV_PROFILE_DEP, sender_id, + return sbp_internal_forward_payload(s, SbpMsgAcqSvProfileDep, sender_id, payload_len, payload, write); } diff --git a/c/src/bootload.c b/c/src/bootload.c index 6339d0ba5f..808fb86f8f 100644 --- a/c/src/bootload.c +++ b/c/src/bootload.c @@ -73,7 +73,7 @@ s8 sbp_msg_bootloader_handshake_req_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_BOOTLOADER_HANDSHAKE_REQ, + return sbp_internal_forward_payload(s, SbpMsgBootloaderHandshakeReq, sender_id, payload_len, payload, write); } @@ -249,7 +249,7 @@ s8 sbp_msg_bootloader_handshake_resp_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_BOOTLOADER_HANDSHAKE_RESP, + return sbp_internal_forward_payload(s, SbpMsgBootloaderHandshakeResp, sender_id, payload_len, payload, write); } @@ -325,8 +325,8 @@ s8 sbp_msg_bootloader_jump_to_app_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_BOOTLOADER_JUMP_TO_APP, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgBootloaderJumpToApp, sender_id, + payload_len, payload, write); } int sbp_msg_bootloader_jump_to_app_cmp( @@ -394,7 +394,7 @@ s8 sbp_msg_nap_device_dna_req_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_NAP_DEVICE_DNA_REQ, sender_id, + return sbp_internal_forward_payload(s, SbpMsgNapDeviceDnaReq, sender_id, payload_len, payload, write); } @@ -468,7 +468,7 @@ s8 sbp_msg_nap_device_dna_resp_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_NAP_DEVICE_DNA_RESP, sender_id, + return sbp_internal_forward_payload(s, SbpMsgNapDeviceDnaResp, sender_id, payload_len, payload, write); } @@ -645,7 +645,7 @@ s8 sbp_msg_bootloader_handshake_dep_a_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_BOOTLOADER_HANDSHAKE_DEP_A, + return sbp_internal_forward_payload(s, SbpMsgBootloaderHandshakeDepA, sender_id, payload_len, payload, write); } diff --git a/c/src/ext_events.c b/c/src/ext_events.c index 3167fa6172..b35a5fa414 100644 --- a/c/src/ext_events.c +++ b/c/src/ext_events.c @@ -97,8 +97,8 @@ s8 sbp_msg_ext_event_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EXT_EVENT, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgExtEvent, sender_id, payload_len, + payload, write); } int sbp_msg_ext_event_cmp(const sbp_msg_ext_event_t *a, diff --git a/c/src/file_io.c b/c/src/file_io.c index d64592db67..b26857a129 100644 --- a/c/src/file_io.c +++ b/c/src/file_io.c @@ -194,7 +194,7 @@ s8 sbp_msg_fileio_read_req_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_FILEIO_READ_REQ, sender_id, + return sbp_internal_forward_payload(s, SbpMsgFileioReadReq, sender_id, payload_len, payload, write); } @@ -294,7 +294,7 @@ s8 sbp_msg_fileio_read_resp_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_FILEIO_READ_RESP, sender_id, + return sbp_internal_forward_payload(s, SbpMsgFileioReadResp, sender_id, payload_len, payload, write); } @@ -490,7 +490,7 @@ s8 sbp_msg_fileio_read_dir_req_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_FILEIO_READ_DIR_REQ, sender_id, + return sbp_internal_forward_payload(s, SbpMsgFileioReadDirReq, sender_id, payload_len, payload, write); } @@ -669,8 +669,8 @@ s8 sbp_msg_fileio_read_dir_resp_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_FILEIO_READ_DIR_RESP, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgFileioReadDirResp, sender_id, + payload_len, payload, write); } int sbp_msg_fileio_read_dir_resp_cmp(const sbp_msg_fileio_read_dir_resp_t *a, @@ -844,7 +844,7 @@ s8 sbp_msg_fileio_remove_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_FILEIO_REMOVE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgFileioRemove, sender_id, payload_len, payload, write); } @@ -1042,7 +1042,7 @@ s8 sbp_msg_fileio_write_req_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_FILEIO_WRITE_REQ, sender_id, + return sbp_internal_forward_payload(s, SbpMsgFileioWriteReq, sender_id, payload_len, payload, write); } @@ -1136,7 +1136,7 @@ s8 sbp_msg_fileio_write_resp_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_FILEIO_WRITE_RESP, sender_id, + return sbp_internal_forward_payload(s, SbpMsgFileioWriteResp, sender_id, payload_len, payload, write); } @@ -1206,7 +1206,7 @@ s8 sbp_msg_fileio_config_req_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_FILEIO_CONFIG_REQ, sender_id, + return sbp_internal_forward_payload(s, SbpMsgFileioConfigReq, sender_id, payload_len, payload, write); } @@ -1294,7 +1294,7 @@ s8 sbp_msg_fileio_config_resp_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_FILEIO_CONFIG_RESP, sender_id, + return sbp_internal_forward_payload(s, SbpMsgFileioConfigResp, sender_id, payload_len, payload, write); } diff --git a/c/src/flash.c b/c/src/flash.c index 7dfbcfe438..cdd458ebb4 100644 --- a/c/src/flash.c +++ b/c/src/flash.c @@ -103,7 +103,7 @@ s8 sbp_msg_flash_program_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_FLASH_PROGRAM, sender_id, + return sbp_internal_forward_payload(s, SbpMsgFlashProgram, sender_id, payload_len, payload, write); } @@ -200,7 +200,7 @@ s8 sbp_msg_flash_done_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_FLASH_DONE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgFlashDone, sender_id, payload_len, payload, write); } @@ -285,7 +285,7 @@ s8 sbp_msg_flash_read_req_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_FLASH_READ_REQ, sender_id, + return sbp_internal_forward_payload(s, SbpMsgFlashReadReq, sender_id, payload_len, payload, write); } @@ -385,7 +385,7 @@ s8 sbp_msg_flash_read_resp_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_FLASH_READ_RESP, sender_id, + return sbp_internal_forward_payload(s, SbpMsgFlashReadResp, sender_id, payload_len, payload, write); } @@ -474,7 +474,7 @@ s8 sbp_msg_flash_erase_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_FLASH_ERASE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgFlashErase, sender_id, payload_len, payload, write); } @@ -549,8 +549,8 @@ s8 sbp_msg_stm_flash_lock_sector_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_STM_FLASH_LOCK_SECTOR, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgStmFlashLockSector, sender_id, + payload_len, payload, write); } int sbp_msg_stm_flash_lock_sector_cmp( @@ -620,8 +620,8 @@ s8 sbp_msg_stm_flash_unlock_sector_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_STM_FLASH_UNLOCK_SECTOR, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgStmFlashUnlockSector, sender_id, + payload_len, payload, write); } int sbp_msg_stm_flash_unlock_sector_cmp( @@ -689,7 +689,7 @@ s8 sbp_msg_stm_unique_id_req_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_STM_UNIQUE_ID_REQ, sender_id, + return sbp_internal_forward_payload(s, SbpMsgStmUniqueIdReq, sender_id, payload_len, payload, write); } @@ -763,7 +763,7 @@ s8 sbp_msg_stm_unique_id_resp_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_STM_UNIQUE_ID_RESP, sender_id, + return sbp_internal_forward_payload(s, SbpMsgStmUniqueIdResp, sender_id, payload_len, payload, write); } @@ -842,8 +842,8 @@ s8 sbp_msg_m25_flash_write_status_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_M25_FLASH_WRITE_STATUS, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgM25FlashWriteStatus, sender_id, + payload_len, payload, write); } int sbp_msg_m25_flash_write_status_cmp( diff --git a/c/src/gnss.c b/c/src/gnss.c index 48eae61d36..e1a9684578 100644 --- a/c/src/gnss.c +++ b/c/src/gnss.c @@ -17,8 +17,8 @@ #include #include -bool sbp_v4_gnss_signal_encode_internal(sbp_encode_ctx_t *ctx, - const sbp_v4_gnss_signal_t *msg) { +bool sbp_gnss_signal_encode_internal(sbp_encode_ctx_t *ctx, + const sbp_gnss_signal_t *msg) { if (!sbp_u8_encode(ctx, &msg->sat)) { return false; } @@ -28,13 +28,13 @@ bool sbp_v4_gnss_signal_encode_internal(sbp_encode_ctx_t *ctx, return true; } -s8 sbp_v4_gnss_signal_encode(uint8_t *buf, uint8_t len, uint8_t *n_written, - const sbp_v4_gnss_signal_t *msg) { +s8 sbp_gnss_signal_encode(uint8_t *buf, uint8_t len, uint8_t *n_written, + const sbp_gnss_signal_t *msg) { sbp_encode_ctx_t ctx; ctx.buf = buf; ctx.buf_len = len; ctx.offset = 0; - if (!sbp_v4_gnss_signal_encode_internal(&ctx, msg)) { + if (!sbp_gnss_signal_encode_internal(&ctx, msg)) { return SBP_ENCODE_ERROR; } if (n_written != NULL) { @@ -43,8 +43,8 @@ s8 sbp_v4_gnss_signal_encode(uint8_t *buf, uint8_t len, uint8_t *n_written, return SBP_OK; } -bool sbp_v4_gnss_signal_decode_internal(sbp_decode_ctx_t *ctx, - sbp_v4_gnss_signal_t *msg) { +bool sbp_gnss_signal_decode_internal(sbp_decode_ctx_t *ctx, + sbp_gnss_signal_t *msg) { if (!sbp_u8_decode(ctx, &msg->sat)) { return false; } @@ -54,13 +54,13 @@ bool sbp_v4_gnss_signal_decode_internal(sbp_decode_ctx_t *ctx, return true; } -s8 sbp_v4_gnss_signal_decode(const uint8_t *buf, uint8_t len, uint8_t *n_read, - sbp_v4_gnss_signal_t *msg) { +s8 sbp_gnss_signal_decode(const uint8_t *buf, uint8_t len, uint8_t *n_read, + sbp_gnss_signal_t *msg) { sbp_decode_ctx_t ctx; ctx.buf = buf; ctx.buf_len = len; ctx.offset = 0; - if (!sbp_v4_gnss_signal_decode_internal(&ctx, msg)) { + if (!sbp_gnss_signal_decode_internal(&ctx, msg)) { return SBP_DECODE_ERROR; } if (n_read != NULL) { @@ -69,8 +69,8 @@ s8 sbp_v4_gnss_signal_decode(const uint8_t *buf, uint8_t len, uint8_t *n_read, return SBP_OK; } -int sbp_v4_gnss_signal_cmp(const sbp_v4_gnss_signal_t *a, - const sbp_v4_gnss_signal_t *b) { +int sbp_gnss_signal_cmp(const sbp_gnss_signal_t *a, + const sbp_gnss_signal_t *b) { int ret = 0; ret = sbp_u8_cmp(&a->sat, &b->sat); @@ -350,8 +350,8 @@ int sbp_gps_time_sec_cmp(const sbp_gps_time_sec_t *a, return ret; } -bool sbp_v4_gps_time_encode_internal(sbp_encode_ctx_t *ctx, - const sbp_v4_gps_time_t *msg) { +bool sbp_gps_time_encode_internal(sbp_encode_ctx_t *ctx, + const sbp_gps_time_t *msg) { if (!sbp_u32_encode(ctx, &msg->tow)) { return false; } @@ -364,13 +364,13 @@ bool sbp_v4_gps_time_encode_internal(sbp_encode_ctx_t *ctx, return true; } -s8 sbp_v4_gps_time_encode(uint8_t *buf, uint8_t len, uint8_t *n_written, - const sbp_v4_gps_time_t *msg) { +s8 sbp_gps_time_encode(uint8_t *buf, uint8_t len, uint8_t *n_written, + const sbp_gps_time_t *msg) { sbp_encode_ctx_t ctx; ctx.buf = buf; ctx.buf_len = len; ctx.offset = 0; - if (!sbp_v4_gps_time_encode_internal(&ctx, msg)) { + if (!sbp_gps_time_encode_internal(&ctx, msg)) { return SBP_ENCODE_ERROR; } if (n_written != NULL) { @@ -379,8 +379,7 @@ s8 sbp_v4_gps_time_encode(uint8_t *buf, uint8_t len, uint8_t *n_written, return SBP_OK; } -bool sbp_v4_gps_time_decode_internal(sbp_decode_ctx_t *ctx, - sbp_v4_gps_time_t *msg) { +bool sbp_gps_time_decode_internal(sbp_decode_ctx_t *ctx, sbp_gps_time_t *msg) { if (!sbp_u32_decode(ctx, &msg->tow)) { return false; } @@ -393,13 +392,13 @@ bool sbp_v4_gps_time_decode_internal(sbp_decode_ctx_t *ctx, return true; } -s8 sbp_v4_gps_time_decode(const uint8_t *buf, uint8_t len, uint8_t *n_read, - sbp_v4_gps_time_t *msg) { +s8 sbp_gps_time_decode(const uint8_t *buf, uint8_t len, uint8_t *n_read, + sbp_gps_time_t *msg) { sbp_decode_ctx_t ctx; ctx.buf = buf; ctx.buf_len = len; ctx.offset = 0; - if (!sbp_v4_gps_time_decode_internal(&ctx, msg)) { + if (!sbp_gps_time_decode_internal(&ctx, msg)) { return SBP_DECODE_ERROR; } if (n_read != NULL) { @@ -408,8 +407,7 @@ s8 sbp_v4_gps_time_decode(const uint8_t *buf, uint8_t len, uint8_t *n_read, return SBP_OK; } -int sbp_v4_gps_time_cmp(const sbp_v4_gps_time_t *a, - const sbp_v4_gps_time_t *b) { +int sbp_gps_time_cmp(const sbp_gps_time_t *a, const sbp_gps_time_t *b) { int ret = 0; ret = sbp_u32_cmp(&a->tow, &b->tow); diff --git a/c/src/imu.c b/c/src/imu.c index 4560f3bde0..95aeed2b82 100644 --- a/c/src/imu.c +++ b/c/src/imu.c @@ -113,8 +113,8 @@ s8 sbp_msg_imu_raw_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_IMU_RAW, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgImuRaw, sender_id, payload_len, + payload, write); } int sbp_msg_imu_raw_cmp(const sbp_msg_imu_raw_t *a, @@ -226,8 +226,8 @@ s8 sbp_msg_imu_aux_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_IMU_AUX, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgImuAux, sender_id, payload_len, + payload, write); } int sbp_msg_imu_aux_cmp(const sbp_msg_imu_aux_t *a, diff --git a/c/src/include/libsbp/internal/gnss.h b/c/src/include/libsbp/internal/gnss.h index dc5669640f..0b811ed5f0 100644 --- a/c/src/include/libsbp/internal/gnss.h +++ b/c/src/include/libsbp/internal/gnss.h @@ -34,8 +34,8 @@ extern "C" { * @param msg SBP type instance * @return true on success, false otherwise */ -bool sbp_v4_gnss_signal_encode_internal(sbp_encode_ctx_t *ctx, - const sbp_v4_gnss_signal_t *msg); +bool sbp_gnss_signal_encode_internal(sbp_encode_ctx_t *ctx, + const sbp_gnss_signal_t *msg); /** * Internal function to decode an SBP type from a buffer @@ -44,8 +44,8 @@ bool sbp_v4_gnss_signal_encode_internal(sbp_encode_ctx_t *ctx, * @param msg SBP type instance * @return true on success, false otherwise */ -bool sbp_v4_gnss_signal_decode_internal(sbp_decode_ctx_t *ctx, - sbp_v4_gnss_signal_t *msg); +bool sbp_gnss_signal_decode_internal(sbp_decode_ctx_t *ctx, + sbp_gnss_signal_t *msg); /** * Internal function to encode an SBP type to a buffer @@ -132,8 +132,8 @@ bool sbp_gps_time_sec_decode_internal(sbp_decode_ctx_t *ctx, * @param msg SBP type instance * @return true on success, false otherwise */ -bool sbp_v4_gps_time_encode_internal(sbp_encode_ctx_t *ctx, - const sbp_v4_gps_time_t *msg); +bool sbp_gps_time_encode_internal(sbp_encode_ctx_t *ctx, + const sbp_gps_time_t *msg); /** * Internal function to decode an SBP type from a buffer @@ -142,8 +142,7 @@ bool sbp_v4_gps_time_encode_internal(sbp_encode_ctx_t *ctx, * @param msg SBP type instance * @return true on success, false otherwise */ -bool sbp_v4_gps_time_decode_internal(sbp_decode_ctx_t *ctx, - sbp_v4_gps_time_t *msg); +bool sbp_gps_time_decode_internal(sbp_decode_ctx_t *ctx, sbp_gps_time_t *msg); /** * Internal function to encode an SBP type to a buffer diff --git a/c/src/integrity.c b/c/src/integrity.c index 34e539ba4c..9245edc89c 100644 --- a/c/src/integrity.c +++ b/c/src/integrity.c @@ -279,7 +279,7 @@ s8 sbp_msg_ssr_flag_high_level_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_FLAG_HIGH_LEVEL, sender_id, + return sbp_internal_forward_payload(s, SbpMsgSsrFlagHighLevel, sender_id, payload_len, payload, write); } @@ -471,7 +471,7 @@ s8 sbp_msg_ssr_flag_satellites_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_FLAG_SATELLITES, sender_id, + return sbp_internal_forward_payload(s, SbpMsgSsrFlagSatellites, sender_id, payload_len, payload, write); } @@ -606,7 +606,7 @@ s8 sbp_msg_ssr_flag_tropo_grid_points_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_FLAG_TROPO_GRID_POINTS, + return sbp_internal_forward_payload(s, SbpMsgSsrFlagTropoGridPoints, sender_id, payload_len, payload, write); } @@ -717,8 +717,8 @@ s8 sbp_msg_ssr_flag_iono_grid_points_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_FLAG_IONO_GRID_POINTS, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgSsrFlagIonoGridPoints, sender_id, + payload_len, payload, write); } int sbp_msg_ssr_flag_iono_grid_points_cmp( @@ -828,8 +828,8 @@ s8 sbp_msg_ssr_flag_iono_tile_sat_los_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_FLAG_IONO_TILE_SAT_LOS, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgSsrFlagIonoTileSatLos, sender_id, + payload_len, payload, write); } int sbp_msg_ssr_flag_iono_tile_sat_los_cmp( @@ -947,8 +947,7 @@ s8 sbp_msg_ssr_flag_iono_grid_point_sat_los_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, - SBP_MSG_SSR_FLAG_IONO_GRID_POINT_SAT_LOS, + return sbp_internal_forward_payload(s, SbpMsgSsrFlagIonoGridPointSatLos, sender_id, payload_len, payload, write); } @@ -1071,7 +1070,7 @@ s8 sbp_msg_acknowledge_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ACKNOWLEDGE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgAcknowledge, sender_id, payload_len, payload, write); } diff --git a/c/src/linux.c b/c/src/linux.c index 33aea91ace..762fea24fc 100644 --- a/c/src/linux.c +++ b/c/src/linux.c @@ -202,8 +202,8 @@ s8 sbp_msg_linux_cpu_state_dep_a_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_LINUX_CPU_STATE_DEP_A, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgLinuxCpuStateDepA, sender_id, + payload_len, payload, write); } int sbp_msg_linux_cpu_state_dep_a_cmp( @@ -425,8 +425,8 @@ s8 sbp_msg_linux_mem_state_dep_a_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_LINUX_MEM_STATE_DEP_A, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgLinuxMemStateDepA, sender_id, + payload_len, payload, write); } int sbp_msg_linux_mem_state_dep_a_cmp( @@ -551,8 +551,8 @@ s8 sbp_msg_linux_sys_state_dep_a_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_LINUX_SYS_STATE_DEP_A, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgLinuxSysStateDepA, sender_id, + payload_len, payload, write); } int sbp_msg_linux_sys_state_dep_a_cmp( @@ -779,7 +779,7 @@ s8 sbp_msg_linux_process_socket_counts_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_LINUX_PROCESS_SOCKET_COUNTS, + return sbp_internal_forward_payload(s, SbpMsgLinuxProcessSocketCounts, sender_id, payload_len, payload, write); } @@ -1025,7 +1025,7 @@ s8 sbp_msg_linux_process_socket_queues_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_LINUX_PROCESS_SOCKET_QUEUES, + return sbp_internal_forward_payload(s, SbpMsgLinuxProcessSocketQueues, sender_id, payload_len, payload, write); } @@ -1167,7 +1167,7 @@ s8 sbp_msg_linux_socket_usage_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_LINUX_SOCKET_USAGE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgLinuxSocketUsage, sender_id, payload_len, payload, write); } @@ -1381,8 +1381,8 @@ s8 sbp_msg_linux_process_fd_count_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_LINUX_PROCESS_FD_COUNT, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgLinuxProcessFdCount, sender_id, + payload_len, payload, write); } int sbp_msg_linux_process_fd_count_cmp( @@ -1576,8 +1576,8 @@ s8 sbp_msg_linux_process_fd_summary_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_LINUX_PROCESS_FD_SUMMARY, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgLinuxProcessFdSummary, sender_id, + payload_len, payload, write); } int sbp_msg_linux_process_fd_summary_cmp( @@ -1792,7 +1792,7 @@ s8 sbp_msg_linux_cpu_state_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_LINUX_CPU_STATE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgLinuxCpuState, sender_id, payload_len, payload, write); } @@ -2037,7 +2037,7 @@ s8 sbp_msg_linux_mem_state_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_LINUX_MEM_STATE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgLinuxMemState, sender_id, payload_len, payload, write); } @@ -2183,7 +2183,7 @@ s8 sbp_msg_linux_sys_state_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_LINUX_SYS_STATE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgLinuxSysState, sender_id, payload_len, payload, write); } diff --git a/c/src/logging.c b/c/src/logging.c index f34dda0c69..22e36ba3fb 100644 --- a/c/src/logging.c +++ b/c/src/logging.c @@ -152,7 +152,7 @@ s8 sbp_msg_log_send(sbp_state_t *s, u16 sender_id, const sbp_msg_log_t *msg, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_LOG, sender_id, payload_len, + return sbp_internal_forward_payload(s, SbpMsgLog, sender_id, payload_len, payload, write); } @@ -242,7 +242,7 @@ s8 sbp_msg_fwd_send(sbp_state_t *s, u16 sender_id, const sbp_msg_fwd_t *msg, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_FWD, sender_id, payload_len, + return sbp_internal_forward_payload(s, SbpMsgFwd, sender_id, payload_len, payload, write); } @@ -410,8 +410,8 @@ s8 sbp_msg_print_dep_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_PRINT_DEP, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgPrintDep, sender_id, payload_len, + payload, write); } int sbp_msg_print_dep_cmp(const sbp_msg_print_dep_t *a, diff --git a/c/src/mag.c b/c/src/mag.c index c92640959f..3e7bdf5e07 100644 --- a/c/src/mag.c +++ b/c/src/mag.c @@ -95,8 +95,8 @@ s8 sbp_msg_mag_raw_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_MAG_RAW, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgMagRaw, sender_id, payload_len, + payload, write); } int sbp_msg_mag_raw_cmp(const sbp_msg_mag_raw_t *a, diff --git a/c/src/navigation.c b/c/src/navigation.c index 641487066d..77f5cc00d4 100644 --- a/c/src/navigation.c +++ b/c/src/navigation.c @@ -89,8 +89,8 @@ s8 sbp_msg_gps_time_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_GPS_TIME, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgGpsTime, sender_id, payload_len, + payload, write); } int sbp_msg_gps_time_cmp(const sbp_msg_gps_time_t *a, @@ -190,7 +190,7 @@ s8 sbp_msg_gps_time_gnss_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_GPS_TIME_GNSS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgGpsTimeGnss, sender_id, payload_len, payload, write); } @@ -319,8 +319,8 @@ s8 sbp_msg_utc_time_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_UTC_TIME, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgUtcTime, sender_id, payload_len, + payload, write); } int sbp_msg_utc_time_cmp(const sbp_msg_utc_time_t *a, @@ -475,7 +475,7 @@ s8 sbp_msg_utc_time_gnss_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_UTC_TIME_GNSS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgUtcTimeGnss, sender_id, payload_len, payload, write); } @@ -616,7 +616,7 @@ s8 sbp_msg_dops_send(sbp_state_t *s, u16 sender_id, const sbp_msg_dops_t *msg, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_DOPS, sender_id, payload_len, + return sbp_internal_forward_payload(s, SbpMsgDops, sender_id, payload_len, payload, write); } @@ -747,8 +747,8 @@ s8 sbp_msg_pos_ecef_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_POS_ECEF, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgPosEcef, sender_id, payload_len, + payload, write); } int sbp_msg_pos_ecef_cmp(const sbp_msg_pos_ecef_t *a, @@ -911,7 +911,7 @@ s8 sbp_msg_pos_ecef_cov_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_POS_ECEF_COV, sender_id, + return sbp_internal_forward_payload(s, SbpMsgPosEcefCov, sender_id, payload_len, payload, write); } @@ -1074,8 +1074,8 @@ s8 sbp_msg_pos_llh_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_POS_LLH, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgPosLlh, sender_id, payload_len, + payload, write); } int sbp_msg_pos_llh_cmp(const sbp_msg_pos_llh_t *a, @@ -1243,7 +1243,7 @@ s8 sbp_msg_pos_llh_cov_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_POS_LLH_COV, sender_id, + return sbp_internal_forward_payload(s, SbpMsgPosLlhCov, sender_id, payload_len, payload, write); } @@ -1520,7 +1520,7 @@ s8 sbp_msg_pos_llh_acc_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_POS_LLH_ACC, sender_id, + return sbp_internal_forward_payload(s, SbpMsgPosLlhAcc, sender_id, payload_len, payload, write); } @@ -1685,7 +1685,7 @@ s8 sbp_msg_baseline_ecef_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_BASELINE_ECEF, sender_id, + return sbp_internal_forward_payload(s, SbpMsgBaselineEcef, sender_id, payload_len, payload, write); } @@ -1825,7 +1825,7 @@ s8 sbp_msg_baseline_ned_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_BASELINE_NED, sender_id, + return sbp_internal_forward_payload(s, SbpMsgBaselineNed, sender_id, payload_len, payload, write); } @@ -1962,8 +1962,8 @@ s8 sbp_msg_vel_ecef_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_VEL_ECEF, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgVelEcef, sender_id, payload_len, + payload, write); } int sbp_msg_vel_ecef_cmp(const sbp_msg_vel_ecef_t *a, @@ -2126,7 +2126,7 @@ s8 sbp_msg_vel_ecef_cov_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_VEL_ECEF_COV, sender_id, + return sbp_internal_forward_payload(s, SbpMsgVelEcefCov, sender_id, payload_len, payload, write); } @@ -2289,8 +2289,8 @@ s8 sbp_msg_vel_ned_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_VEL_NED, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgVelNed, sender_id, payload_len, + payload, write); } int sbp_msg_vel_ned_cmp(const sbp_msg_vel_ned_t *a, @@ -2458,7 +2458,7 @@ s8 sbp_msg_vel_ned_cov_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_VEL_NED_COV, sender_id, + return sbp_internal_forward_payload(s, SbpMsgVelNedCov, sender_id, payload_len, payload, write); } @@ -2617,7 +2617,7 @@ s8 sbp_msg_pos_ecef_gnss_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_POS_ECEF_GNSS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgPosEcefGnss, sender_id, payload_len, payload, write); } @@ -2783,7 +2783,7 @@ s8 sbp_msg_pos_ecef_cov_gnss_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_POS_ECEF_COV_GNSS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgPosEcefCovGnss, sender_id, payload_len, payload, write); } @@ -2948,7 +2948,7 @@ s8 sbp_msg_pos_llh_gnss_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_POS_LLH_GNSS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgPosLlhGnss, sender_id, payload_len, payload, write); } @@ -3119,7 +3119,7 @@ s8 sbp_msg_pos_llh_cov_gnss_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_POS_LLH_COV_GNSS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgPosLlhCovGnss, sender_id, payload_len, payload, write); } @@ -3278,7 +3278,7 @@ s8 sbp_msg_vel_ecef_gnss_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_VEL_ECEF_GNSS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgVelEcefGnss, sender_id, payload_len, payload, write); } @@ -3444,7 +3444,7 @@ s8 sbp_msg_vel_ecef_cov_gnss_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_VEL_ECEF_COV_GNSS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgVelEcefCovGnss, sender_id, payload_len, payload, write); } @@ -3609,7 +3609,7 @@ s8 sbp_msg_vel_ned_gnss_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_VEL_NED_GNSS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgVelNedGnss, sender_id, payload_len, payload, write); } @@ -3780,7 +3780,7 @@ s8 sbp_msg_vel_ned_cov_gnss_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_VEL_NED_COV_GNSS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgVelNedCovGnss, sender_id, payload_len, payload, write); } @@ -3967,8 +3967,8 @@ s8 sbp_msg_vel_body_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_VEL_BODY, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgVelBody, sender_id, payload_len, + payload, write); } int sbp_msg_vel_body_cmp(const sbp_msg_vel_body_t *a, @@ -4130,8 +4130,8 @@ s8 sbp_msg_vel_cog_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_VEL_COG, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgVelCog, sender_id, payload_len, + payload, write); } int sbp_msg_vel_cog_cmp(const sbp_msg_vel_cog_t *a, @@ -4240,7 +4240,7 @@ s8 sbp_msg_age_corrections_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_AGE_CORRECTIONS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgAgeCorrections, sender_id, payload_len, payload, write); } @@ -4332,7 +4332,7 @@ s8 sbp_msg_gps_time_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_GPS_TIME_DEP_A, sender_id, + return sbp_internal_forward_payload(s, SbpMsgGpsTimeDepA, sender_id, payload_len, payload, write); } @@ -4445,8 +4445,8 @@ s8 sbp_msg_dops_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_DOPS_DEP_A, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgDopsDepA, sender_id, payload_len, + payload, write); } int sbp_msg_dops_dep_a_cmp(const sbp_msg_dops_dep_a_t *a, @@ -4575,7 +4575,7 @@ s8 sbp_msg_pos_ecef_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_POS_ECEF_DEP_A, sender_id, + return sbp_internal_forward_payload(s, SbpMsgPosEcefDepA, sender_id, payload_len, payload, write); } @@ -4715,7 +4715,7 @@ s8 sbp_msg_pos_llh_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_POS_LLH_DEP_A, sender_id, + return sbp_internal_forward_payload(s, SbpMsgPosLlhDepA, sender_id, payload_len, payload, write); } @@ -4856,7 +4856,7 @@ s8 sbp_msg_baseline_ecef_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_BASELINE_ECEF_DEP_A, sender_id, + return sbp_internal_forward_payload(s, SbpMsgBaselineEcefDepA, sender_id, payload_len, payload, write); } @@ -4998,7 +4998,7 @@ s8 sbp_msg_baseline_ned_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_BASELINE_NED_DEP_A, sender_id, + return sbp_internal_forward_payload(s, SbpMsgBaselineNedDepA, sender_id, payload_len, payload, write); } @@ -5138,7 +5138,7 @@ s8 sbp_msg_vel_ecef_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_VEL_ECEF_DEP_A, sender_id, + return sbp_internal_forward_payload(s, SbpMsgVelEcefDepA, sender_id, payload_len, payload, write); } @@ -5278,7 +5278,7 @@ s8 sbp_msg_vel_ned_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_VEL_NED_DEP_A, sender_id, + return sbp_internal_forward_payload(s, SbpMsgVelNedDepA, sender_id, payload_len, payload, write); } @@ -5401,8 +5401,8 @@ s8 sbp_msg_baseline_heading_dep_a_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_BASELINE_HEADING_DEP_A, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgBaselineHeadingDepA, sender_id, + payload_len, payload, write); } int sbp_msg_baseline_heading_dep_a_cmp( @@ -5523,8 +5523,8 @@ s8 sbp_msg_protection_level_dep_a_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_PROTECTION_LEVEL_DEP_A, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgProtectionLevelDepA, sender_id, + payload_len, payload, write); } int sbp_msg_protection_level_dep_a_cmp( @@ -5744,7 +5744,7 @@ s8 sbp_msg_protection_level_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_PROTECTION_LEVEL, sender_id, + return sbp_internal_forward_payload(s, SbpMsgProtectionLevel, sender_id, payload_len, payload, write); } @@ -5961,7 +5961,7 @@ s8 sbp_msg_utc_leap_second_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_UTC_LEAP_SECOND, sender_id, + return sbp_internal_forward_payload(s, SbpMsgUtcLeapSecond, sender_id, payload_len, payload, write); } @@ -6193,8 +6193,8 @@ s8 sbp_msg_reference_frame_param_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_REFERENCE_FRAME_PARAM, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgReferenceFrameParam, sender_id, + payload_len, payload, write); } int sbp_msg_reference_frame_param_cmp( @@ -6497,7 +6497,7 @@ s8 sbp_msg_pose_relative_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_POSE_RELATIVE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgPoseRelative, sender_id, payload_len, payload, write); } diff --git a/c/src/ndb.c b/c/src/ndb.c index 29913d3fe0..d10a0cd7d3 100644 --- a/c/src/ndb.c +++ b/c/src/ndb.c @@ -34,10 +34,10 @@ bool sbp_msg_ndb_event_encode_internal(sbp_encode_ctx_t *ctx, if (!sbp_u8_encode(ctx, &msg->data_source)) { return false; } - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->object_sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->object_sid)) { return false; } - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->src_sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->src_sid)) { return false; } if (!sbp_u16_encode(ctx, &msg->original_sender)) { @@ -78,10 +78,10 @@ bool sbp_msg_ndb_event_decode_internal(sbp_decode_ctx_t *ctx, if (!sbp_u8_decode(ctx, &msg->data_source)) { return false; } - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->object_sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->object_sid)) { return false; } - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->src_sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->src_sid)) { return false; } if (!sbp_u16_decode(ctx, &msg->original_sender)) { @@ -115,8 +115,8 @@ s8 sbp_msg_ndb_event_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_NDB_EVENT, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgNdbEvent, sender_id, payload_len, + payload, write); } int sbp_msg_ndb_event_cmp(const sbp_msg_ndb_event_t *a, @@ -148,12 +148,12 @@ int sbp_msg_ndb_event_cmp(const sbp_msg_ndb_event_t *a, return ret; } - ret = sbp_v4_gnss_signal_cmp(&a->object_sid, &b->object_sid); + ret = sbp_gnss_signal_cmp(&a->object_sid, &b->object_sid); if (ret != 0) { return ret; } - ret = sbp_v4_gnss_signal_cmp(&a->src_sid, &b->src_sid); + ret = sbp_gnss_signal_cmp(&a->src_sid, &b->src_sid); if (ret != 0) { return ret; } diff --git a/c/src/observation.c b/c/src/observation.c index 0894fb73c5..666dcd5c9d 100644 --- a/c/src/observation.c +++ b/c/src/observation.c @@ -19,7 +19,7 @@ bool sbp_observation_header_encode_internal( sbp_encode_ctx_t *ctx, const sbp_observation_header_t *msg) { - if (!sbp_v4_gps_time_encode_internal(ctx, &msg->t)) { + if (!sbp_gps_time_encode_internal(ctx, &msg->t)) { return false; } if (!sbp_u8_encode(ctx, &msg->n_obs)) { @@ -45,7 +45,7 @@ s8 sbp_observation_header_encode(uint8_t *buf, uint8_t len, uint8_t *n_written, bool sbp_observation_header_decode_internal(sbp_decode_ctx_t *ctx, sbp_observation_header_t *msg) { - if (!sbp_v4_gps_time_decode_internal(ctx, &msg->t)) { + if (!sbp_gps_time_decode_internal(ctx, &msg->t)) { return false; } if (!sbp_u8_decode(ctx, &msg->n_obs)) { @@ -74,7 +74,7 @@ int sbp_observation_header_cmp(const sbp_observation_header_t *a, const sbp_observation_header_t *b) { int ret = 0; - ret = sbp_v4_gps_time_cmp(&a->t, &b->t); + ret = sbp_gps_time_cmp(&a->t, &b->t); if (ret != 0) { return ret; } @@ -166,7 +166,7 @@ bool sbp_packed_obs_content_encode_internal( if (!sbp_u8_encode(ctx, &msg->flags)) { return false; } - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } return true; @@ -207,7 +207,7 @@ bool sbp_packed_obs_content_decode_internal(sbp_decode_ctx_t *ctx, if (!sbp_u8_decode(ctx, &msg->flags)) { return false; } - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } return true; @@ -263,7 +263,7 @@ int sbp_packed_obs_content_cmp(const sbp_packed_obs_content_t *a, return ret; } - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); return ret; } @@ -281,7 +281,7 @@ bool sbp_packed_osr_content_encode_internal( if (!sbp_u8_encode(ctx, &msg->flags)) { return false; } - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u16_encode(ctx, &msg->iono_std)) { @@ -325,7 +325,7 @@ bool sbp_packed_osr_content_decode_internal(sbp_decode_ctx_t *ctx, if (!sbp_u8_decode(ctx, &msg->flags)) { return false; } - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u16_decode(ctx, &msg->iono_std)) { @@ -380,7 +380,7 @@ int sbp_packed_osr_content_cmp(const sbp_packed_osr_content_t *a, return ret; } - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); if (ret != 0) { return ret; } @@ -468,7 +468,7 @@ s8 sbp_msg_obs_send(sbp_state_t *s, u16 sender_id, const sbp_msg_obs_t *msg, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_OBS, sender_id, payload_len, + return sbp_internal_forward_payload(s, SbpMsgObs, sender_id, payload_len, payload, write); } @@ -561,7 +561,7 @@ s8 sbp_msg_base_pos_llh_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_BASE_POS_LLH, sender_id, + return sbp_internal_forward_payload(s, SbpMsgBasePosLlh, sender_id, payload_len, payload, write); } @@ -651,7 +651,7 @@ s8 sbp_msg_base_pos_ecef_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_BASE_POS_ECEF, sender_id, + return sbp_internal_forward_payload(s, SbpMsgBasePosEcef, sender_id, payload_len, payload, write); } @@ -675,7 +675,7 @@ int sbp_msg_base_pos_ecef_cmp(const sbp_msg_base_pos_ecef_t *a, bool sbp_ephemeris_common_content_encode_internal( sbp_encode_ctx_t *ctx, const sbp_ephemeris_common_content_t *msg) { - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } if (!sbp_gps_time_sec_encode_internal(ctx, &msg->toe)) { @@ -714,7 +714,7 @@ s8 sbp_ephemeris_common_content_encode( bool sbp_ephemeris_common_content_decode_internal( sbp_decode_ctx_t *ctx, sbp_ephemeris_common_content_t *msg) { - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } if (!sbp_gps_time_sec_decode_internal(ctx, &msg->toe)) { @@ -755,7 +755,7 @@ int sbp_ephemeris_common_content_cmp(const sbp_ephemeris_common_content_t *a, const sbp_ephemeris_common_content_t *b) { int ret = 0; - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); if (ret != 0) { return ret; } @@ -786,7 +786,7 @@ int sbp_ephemeris_common_content_cmp(const sbp_ephemeris_common_content_t *a, bool sbp_ephemeris_common_content_dep_b_encode_internal( sbp_encode_ctx_t *ctx, const sbp_ephemeris_common_content_dep_b_t *msg) { - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } if (!sbp_gps_time_sec_encode_internal(ctx, &msg->toe)) { @@ -825,7 +825,7 @@ s8 sbp_ephemeris_common_content_dep_b_encode( bool sbp_ephemeris_common_content_dep_b_decode_internal( sbp_decode_ctx_t *ctx, sbp_ephemeris_common_content_dep_b_t *msg) { - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } if (!sbp_gps_time_sec_decode_internal(ctx, &msg->toe)) { @@ -867,7 +867,7 @@ int sbp_ephemeris_common_content_dep_b_cmp( const sbp_ephemeris_common_content_dep_b_t *b) { int ret = 0; - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); if (ret != 0) { return ret; } @@ -1198,7 +1198,7 @@ s8 sbp_msg_ephemeris_gps_dep_e_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_GPS_DEP_E, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEphemerisGpsDepE, sender_id, payload_len, payload, write); } @@ -1510,7 +1510,7 @@ s8 sbp_msg_ephemeris_gps_dep_f_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_GPS_DEP_F, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEphemerisGpsDepF, sender_id, payload_len, payload, write); } @@ -1820,7 +1820,7 @@ s8 sbp_msg_ephemeris_gps_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_GPS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEphemerisGps, sender_id, payload_len, payload, write); } @@ -2131,7 +2131,7 @@ s8 sbp_msg_ephemeris_qzss_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_QZSS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEphemerisQzss, sender_id, payload_len, payload, write); } @@ -2447,7 +2447,7 @@ s8 sbp_msg_ephemeris_bds_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_BDS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEphemerisBds, sender_id, payload_len, payload, write); } @@ -2770,7 +2770,7 @@ s8 sbp_msg_ephemeris_gal_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_GAL_DEP_A, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEphemerisGalDepA, sender_id, payload_len, payload, write); } @@ -3097,7 +3097,7 @@ s8 sbp_msg_ephemeris_gal_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_GAL, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEphemerisGal, sender_id, payload_len, payload, write); } @@ -3329,8 +3329,8 @@ s8 sbp_msg_ephemeris_sbas_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_SBAS_DEP_A, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgEphemerisSbasDepA, sender_id, + payload_len, payload, write); } int sbp_msg_ephemeris_sbas_dep_a_cmp(const sbp_msg_ephemeris_sbas_dep_a_t *a, @@ -3481,7 +3481,7 @@ s8 sbp_msg_ephemeris_glo_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_GLO_DEP_A, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEphemerisGloDepA, sender_id, payload_len, payload, write); } @@ -3633,8 +3633,8 @@ s8 sbp_msg_ephemeris_sbas_dep_b_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_SBAS_DEP_B, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgEphemerisSbasDepB, sender_id, + payload_len, payload, write); } int sbp_msg_ephemeris_sbas_dep_b_cmp(const sbp_msg_ephemeris_sbas_dep_b_t *a, @@ -3784,7 +3784,7 @@ s8 sbp_msg_ephemeris_sbas_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_SBAS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEphemerisSbas, sender_id, payload_len, payload, write); } @@ -3936,7 +3936,7 @@ s8 sbp_msg_ephemeris_glo_dep_b_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_GLO_DEP_B, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEphemerisGloDepB, sender_id, payload_len, payload, write); } @@ -4100,7 +4100,7 @@ s8 sbp_msg_ephemeris_glo_dep_c_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_GLO_DEP_C, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEphemerisGloDepC, sender_id, payload_len, payload, write); } @@ -4280,7 +4280,7 @@ s8 sbp_msg_ephemeris_glo_dep_d_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_GLO_DEP_D, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEphemerisGloDepD, sender_id, payload_len, payload, write); } @@ -4463,7 +4463,7 @@ s8 sbp_msg_ephemeris_glo_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_GLO, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEphemerisGlo, sender_id, payload_len, payload, write); } @@ -4755,7 +4755,7 @@ s8 sbp_msg_ephemeris_dep_d_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_DEP_D, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEphemerisDepD, sender_id, payload_len, payload, write); } @@ -5114,7 +5114,7 @@ s8 sbp_msg_ephemeris_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_DEP_A, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEphemerisDepA, sender_id, payload_len, payload, write); } @@ -5464,7 +5464,7 @@ s8 sbp_msg_ephemeris_dep_b_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_DEP_B, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEphemerisDepB, sender_id, payload_len, payload, write); } @@ -5831,7 +5831,7 @@ s8 sbp_msg_ephemeris_dep_c_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_EPHEMERIS_DEP_C, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEphemerisDepC, sender_id, payload_len, payload, write); } @@ -6488,8 +6488,8 @@ s8 sbp_msg_obs_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_OBS_DEP_A, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgObsDepA, sender_id, payload_len, + payload, write); } int sbp_msg_obs_dep_a_cmp(const sbp_msg_obs_dep_a_t *a, @@ -6586,8 +6586,8 @@ s8 sbp_msg_obs_dep_b_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_OBS_DEP_B, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgObsDepB, sender_id, payload_len, + payload, write); } int sbp_msg_obs_dep_b_cmp(const sbp_msg_obs_dep_b_t *a, @@ -6684,8 +6684,8 @@ s8 sbp_msg_obs_dep_c_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_OBS_DEP_C, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgObsDepC, sender_id, payload_len, + payload, write); } int sbp_msg_obs_dep_c_cmp(const sbp_msg_obs_dep_c_t *a, @@ -6811,7 +6811,7 @@ s8 sbp_msg_iono_send(sbp_state_t *s, u16 sender_id, const sbp_msg_iono_t *msg, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_IONO, sender_id, payload_len, + return sbp_internal_forward_payload(s, SbpMsgIono, sender_id, payload_len, payload, write); } @@ -6926,8 +6926,8 @@ s8 sbp_msg_sv_configuration_gps_dep_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SV_CONFIGURATION_GPS_DEP, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgSvConfigurationGpsDep, sender_id, + payload_len, payload, write); } int sbp_msg_sv_configuration_gps_dep_cmp( @@ -7213,8 +7213,8 @@ s8 sbp_msg_gnss_capb_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_GNSS_CAPB, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgGnssCapb, sender_id, payload_len, + payload, write); } int sbp_msg_gnss_capb_cmp(const sbp_msg_gnss_capb_t *a, @@ -7318,7 +7318,7 @@ s8 sbp_msg_group_delay_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_GROUP_DELAY_DEP_A, sender_id, + return sbp_internal_forward_payload(s, SbpMsgGroupDelayDepA, sender_id, payload_len, payload, write); } @@ -7443,7 +7443,7 @@ s8 sbp_msg_group_delay_dep_b_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_GROUP_DELAY_DEP_B, sender_id, + return sbp_internal_forward_payload(s, SbpMsgGroupDelayDepB, sender_id, payload_len, payload, write); } @@ -7485,7 +7485,7 @@ bool sbp_msg_group_delay_encode_internal(sbp_encode_ctx_t *ctx, if (!sbp_gps_time_sec_encode_internal(ctx, &msg->t_op)) { return false; } - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u8_encode(ctx, &msg->valid)) { @@ -7523,7 +7523,7 @@ bool sbp_msg_group_delay_decode_internal(sbp_decode_ctx_t *ctx, if (!sbp_gps_time_sec_decode_internal(ctx, &msg->t_op)) { return false; } - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u8_decode(ctx, &msg->valid)) { @@ -7566,7 +7566,7 @@ s8 sbp_msg_group_delay_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_GROUP_DELAY, sender_id, + return sbp_internal_forward_payload(s, SbpMsgGroupDelay, sender_id, payload_len, payload, write); } @@ -7579,7 +7579,7 @@ int sbp_msg_group_delay_cmp(const sbp_msg_group_delay_t *a, return ret; } - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); if (ret != 0) { return ret; } @@ -7605,7 +7605,7 @@ int sbp_msg_group_delay_cmp(const sbp_msg_group_delay_t *a, bool sbp_almanac_common_content_encode_internal( sbp_encode_ctx_t *ctx, const sbp_almanac_common_content_t *msg) { - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } if (!sbp_gps_time_sec_encode_internal(ctx, &msg->toa)) { @@ -7644,7 +7644,7 @@ s8 sbp_almanac_common_content_encode(uint8_t *buf, uint8_t len, bool sbp_almanac_common_content_decode_internal( sbp_decode_ctx_t *ctx, sbp_almanac_common_content_t *msg) { - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } if (!sbp_gps_time_sec_decode_internal(ctx, &msg->toa)) { @@ -7685,7 +7685,7 @@ int sbp_almanac_common_content_cmp(const sbp_almanac_common_content_t *a, const sbp_almanac_common_content_t *b) { int ret = 0; - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); if (ret != 0) { return ret; } @@ -7937,7 +7937,7 @@ s8 sbp_msg_almanac_gps_dep_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ALMANAC_GPS_DEP, sender_id, + return sbp_internal_forward_payload(s, SbpMsgAlmanacGpsDep, sender_id, payload_len, payload, write); } @@ -8104,7 +8104,7 @@ s8 sbp_msg_almanac_gps_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ALMANAC_GPS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgAlmanacGps, sender_id, payload_len, payload, write); } @@ -8260,7 +8260,7 @@ s8 sbp_msg_almanac_glo_dep_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ALMANAC_GLO_DEP, sender_id, + return sbp_internal_forward_payload(s, SbpMsgAlmanacGloDep, sender_id, payload_len, payload, write); } @@ -8405,7 +8405,7 @@ s8 sbp_msg_almanac_glo_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ALMANAC_GLO, sender_id, + return sbp_internal_forward_payload(s, SbpMsgAlmanacGlo, sender_id, payload_len, payload, write); } @@ -8532,7 +8532,7 @@ s8 sbp_msg_glo_biases_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_GLO_BIASES, sender_id, + return sbp_internal_forward_payload(s, SbpMsgGloBiases, sender_id, payload_len, payload, write); } @@ -8566,7 +8566,7 @@ int sbp_msg_glo_biases_cmp(const sbp_msg_glo_biases_t *a, bool sbp_sv_az_el_encode_internal(sbp_encode_ctx_t *ctx, const sbp_sv_az_el_t *msg) { - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u8_encode(ctx, &msg->az)) { @@ -8594,7 +8594,7 @@ s8 sbp_sv_az_el_encode(uint8_t *buf, uint8_t len, uint8_t *n_written, } bool sbp_sv_az_el_decode_internal(sbp_decode_ctx_t *ctx, sbp_sv_az_el_t *msg) { - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u8_decode(ctx, &msg->az)) { @@ -8624,7 +8624,7 @@ s8 sbp_sv_az_el_decode(const uint8_t *buf, uint8_t len, uint8_t *n_read, int sbp_sv_az_el_cmp(const sbp_sv_az_el_t *a, const sbp_sv_az_el_t *b) { int ret = 0; - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); if (ret != 0) { return ret; } @@ -8701,8 +8701,8 @@ s8 sbp_msg_sv_az_el_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SV_AZ_EL, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgSvAzEl, sender_id, payload_len, + payload, write); } int sbp_msg_sv_az_el_cmp(const sbp_msg_sv_az_el_t *a, @@ -8791,7 +8791,7 @@ s8 sbp_msg_osr_send(sbp_state_t *s, u16 sender_id, const sbp_msg_osr_t *msg, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_OSR, sender_id, payload_len, + return sbp_internal_forward_payload(s, SbpMsgOsr, sender_id, payload_len, payload, write); } diff --git a/c/src/orientation.c b/c/src/orientation.c index 93054c53a0..f74a3bd178 100644 --- a/c/src/orientation.c +++ b/c/src/orientation.c @@ -93,7 +93,7 @@ s8 sbp_msg_baseline_heading_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_BASELINE_HEADING, sender_id, + return sbp_internal_forward_payload(s, SbpMsgBaselineHeading, sender_id, payload_len, payload, write); } @@ -230,7 +230,7 @@ s8 sbp_msg_orient_quat_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ORIENT_QUAT, sender_id, + return sbp_internal_forward_payload(s, SbpMsgOrientQuat, sender_id, payload_len, payload, write); } @@ -385,7 +385,7 @@ s8 sbp_msg_orient_euler_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ORIENT_EULER, sender_id, + return sbp_internal_forward_payload(s, SbpMsgOrientEuler, sender_id, payload_len, payload, write); } @@ -512,7 +512,7 @@ s8 sbp_msg_angular_rate_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ANGULAR_RATE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgAngularRate, sender_id, payload_len, payload, write); } diff --git a/c/src/piksi.c b/c/src/piksi.c index 325f32a003..ae9541f6e1 100644 --- a/c/src/piksi.c +++ b/c/src/piksi.c @@ -69,8 +69,8 @@ s8 sbp_msg_almanac_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ALMANAC, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgAlmanac, sender_id, payload_len, + payload, write); } int sbp_msg_almanac_cmp(const sbp_msg_almanac_t *a, @@ -133,8 +133,8 @@ s8 sbp_msg_set_time_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SET_TIME, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgSetTime, sender_id, payload_len, + payload, write); } int sbp_msg_set_time_cmp(const sbp_msg_set_time_t *a, @@ -199,7 +199,7 @@ s8 sbp_msg_reset_send(sbp_state_t *s, u16 sender_id, const sbp_msg_reset_t *msg, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_RESET, sender_id, payload_len, + return sbp_internal_forward_payload(s, SbpMsgReset, sender_id, payload_len, payload, write); } @@ -264,8 +264,8 @@ s8 sbp_msg_reset_dep_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_RESET_DEP, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgResetDep, sender_id, payload_len, + payload, write); } int sbp_msg_reset_dep_cmp(const sbp_msg_reset_dep_t *a, @@ -330,7 +330,7 @@ s8 sbp_msg_cw_results_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_CW_RESULTS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgCwResults, sender_id, payload_len, payload, write); } @@ -394,8 +394,8 @@ s8 sbp_msg_cw_start_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_CW_START, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgCwStart, sender_id, payload_len, + payload, write); } int sbp_msg_cw_start_cmp(const sbp_msg_cw_start_t *a, @@ -462,7 +462,7 @@ s8 sbp_msg_reset_filters_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_RESET_FILTERS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgResetFilters, sender_id, payload_len, payload, write); } @@ -528,7 +528,7 @@ s8 sbp_msg_init_base_dep_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_INIT_BASE_DEP, sender_id, + return sbp_internal_forward_payload(s, SbpMsgInitBaseDep, sender_id, payload_len, payload, write); } @@ -612,7 +612,7 @@ s8 sbp_msg_thread_state_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_THREAD_STATE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgThreadState, sender_id, payload_len, payload, write); } @@ -998,7 +998,7 @@ s8 sbp_msg_uart_state_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_UART_STATE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgUartState, sender_id, payload_len, payload, write); } @@ -1105,7 +1105,7 @@ s8 sbp_msg_uart_state_depa_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_UART_STATE_DEPA, sender_id, + return sbp_internal_forward_payload(s, SbpMsgUartStateDepa, sender_id, payload_len, payload, write); } @@ -1188,8 +1188,8 @@ s8 sbp_msg_iar_state_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_IAR_STATE, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgIarState, sender_id, payload_len, + payload, write); } int sbp_msg_iar_state_cmp(const sbp_msg_iar_state_t *a, @@ -1205,7 +1205,7 @@ bool sbp_msg_mask_satellite_encode_internal( if (!sbp_u8_encode(ctx, &msg->mask)) { return false; } - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } return true; @@ -1231,7 +1231,7 @@ bool sbp_msg_mask_satellite_decode_internal(sbp_decode_ctx_t *ctx, if (!sbp_u8_decode(ctx, &msg->mask)) { return false; } - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } return true; @@ -1263,7 +1263,7 @@ s8 sbp_msg_mask_satellite_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_MASK_SATELLITE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgMaskSatellite, sender_id, payload_len, payload, write); } @@ -1276,7 +1276,7 @@ int sbp_msg_mask_satellite_cmp(const sbp_msg_mask_satellite_t *a, return ret; } - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); return ret; } @@ -1344,7 +1344,7 @@ s8 sbp_msg_mask_satellite_dep_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_MASK_SATELLITE_DEP, sender_id, + return sbp_internal_forward_payload(s, SbpMsgMaskSatelliteDep, sender_id, payload_len, payload, write); } @@ -1442,7 +1442,7 @@ s8 sbp_msg_device_monitor_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_DEVICE_MONITOR, sender_id, + return sbp_internal_forward_payload(s, SbpMsgDeviceMonitor, sender_id, payload_len, payload, write); } @@ -1633,7 +1633,7 @@ s8 sbp_msg_command_req_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_COMMAND_REQ, sender_id, + return sbp_internal_forward_payload(s, SbpMsgCommandReq, sender_id, payload_len, payload, write); } @@ -1712,7 +1712,7 @@ s8 sbp_msg_command_resp_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_COMMAND_RESP, sender_id, + return sbp_internal_forward_payload(s, SbpMsgCommandResp, sender_id, payload_len, payload, write); } @@ -1890,7 +1890,7 @@ s8 sbp_msg_command_output_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_COMMAND_OUTPUT, sender_id, + return sbp_internal_forward_payload(s, SbpMsgCommandOutput, sender_id, payload_len, payload, write); } @@ -1963,7 +1963,7 @@ s8 sbp_msg_network_state_req_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_NETWORK_STATE_REQ, sender_id, + return sbp_internal_forward_payload(s, SbpMsgNetworkStateReq, sender_id, payload_len, payload, write); } @@ -2087,7 +2087,7 @@ s8 sbp_msg_network_state_resp_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_NETWORK_STATE_RESP, sender_id, + return sbp_internal_forward_payload(s, SbpMsgNetworkStateResp, sender_id, payload_len, payload, write); } @@ -2323,8 +2323,8 @@ s8 sbp_msg_network_bandwidth_usage_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_NETWORK_BANDWIDTH_USAGE, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgNetworkBandwidthUsage, sender_id, + payload_len, payload, write); } int sbp_msg_network_bandwidth_usage_cmp( @@ -2424,7 +2424,7 @@ s8 sbp_msg_cell_modem_status_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_CELL_MODEM_STATUS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgCellModemStatus, sender_id, payload_len, payload, write); } @@ -2556,7 +2556,7 @@ s8 sbp_msg_specan_dep_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SPECAN_DEP, sender_id, + return sbp_internal_forward_payload(s, SbpMsgSpecanDep, sender_id, payload_len, payload, write); } @@ -2612,7 +2612,7 @@ bool sbp_msg_specan_encode_internal(sbp_encode_ctx_t *ctx, if (!sbp_u16_encode(ctx, &msg->channel_tag)) { return false; } - if (!sbp_v4_gps_time_encode_internal(ctx, &msg->t)) { + if (!sbp_gps_time_encode_internal(ctx, &msg->t)) { return false; } if (!sbp_float_encode(ctx, &msg->freq_ref)) { @@ -2655,7 +2655,7 @@ bool sbp_msg_specan_decode_internal(sbp_decode_ctx_t *ctx, if (!sbp_u16_decode(ctx, &msg->channel_tag)) { return false; } - if (!sbp_v4_gps_time_decode_internal(ctx, &msg->t)) { + if (!sbp_gps_time_decode_internal(ctx, &msg->t)) { return false; } if (!sbp_float_decode(ctx, &msg->freq_ref)) { @@ -2706,7 +2706,7 @@ s8 sbp_msg_specan_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SPECAN, sender_id, payload_len, + return sbp_internal_forward_payload(s, SbpMsgSpecan, sender_id, payload_len, payload, write); } @@ -2718,7 +2718,7 @@ int sbp_msg_specan_cmp(const sbp_msg_specan_t *a, const sbp_msg_specan_t *b) { return ret; } - ret = sbp_v4_gps_time_cmp(&a->t, &b->t); + ret = sbp_gps_time_cmp(&a->t, &b->t); if (ret != 0) { return ret; } @@ -2827,7 +2827,7 @@ s8 sbp_msg_front_end_gain_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_FRONT_END_GAIN, sender_id, + return sbp_internal_forward_payload(s, SbpMsgFrontEndGain, sender_id, payload_len, payload, write); } diff --git a/c/src/profiling.c b/c/src/profiling.c index 89e07fbd89..814f46ae26 100644 --- a/c/src/profiling.c +++ b/c/src/profiling.c @@ -224,7 +224,7 @@ s8 sbp_msg_measurement_point_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_MEASUREMENT_POINT, sender_id, + return sbp_internal_forward_payload(s, SbpMsgMeasurementPoint, sender_id, payload_len, payload, write); } diff --git a/c/src/sbas.c b/c/src/sbas.c index f74aa18f18..99887fe968 100644 --- a/c/src/sbas.c +++ b/c/src/sbas.c @@ -19,7 +19,7 @@ bool sbp_msg_sbas_raw_encode_internal(sbp_encode_ctx_t *ctx, const sbp_msg_sbas_raw_t *msg) { - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u32_encode(ctx, &msg->tow)) { @@ -53,7 +53,7 @@ s8 sbp_msg_sbas_raw_encode(uint8_t *buf, uint8_t len, uint8_t *n_written, bool sbp_msg_sbas_raw_decode_internal(sbp_decode_ctx_t *ctx, sbp_msg_sbas_raw_t *msg) { - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u32_decode(ctx, &msg->tow)) { @@ -93,15 +93,15 @@ s8 sbp_msg_sbas_raw_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SBAS_RAW, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgSbasRaw, sender_id, payload_len, + payload, write); } int sbp_msg_sbas_raw_cmp(const sbp_msg_sbas_raw_t *a, const sbp_msg_sbas_raw_t *b) { int ret = 0; - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); if (ret != 0) { return ret; } diff --git a/c/src/sbp.c b/c/src/sbp.c index a724d3fbd0..a90f532909 100644 --- a/c/src/sbp.c +++ b/c/src/sbp.c @@ -14,17 +14,6 @@ #include #include -// TODO(version 6) -// Remove this undef/define -// Obviously we don't normally want to silence this message, but we also need to provide -// an implementation for these deprecated functions somewhere. When the legacy API is -// removed in version 6 these few lines can be removed as well -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include - #define SBP_PREAMBLE 0x55 /** \addtogroup io Input / Output @@ -189,13 +178,11 @@ * registered for that message type. */ static s8 sbp_register_callback_generic(sbp_state_t *s, sbp_msg_type_t msg_type, - sbp_callback_t cb, sbp_cb_type cb_type, + sbp_callback_t cb, void *context, sbp_msg_callbacks_node_t *node) { /* Check our callback function pointer isn't NULL. */ - if ((cb_type == SBP_MSG_CALLBACK && cb.msg == 0) || - (cb_type == SBP_FRAME_CALLBACK && cb.frame == 0) || - (cb_type == SBP_DECODED_CALLBACK && cb.decoded == 0)) { + if (cb == NULL) { return SBP_NULL_ERROR; } @@ -208,32 +195,15 @@ static s8 sbp_register_callback_generic(sbp_state_t *s, sbp_msg_type_t msg_type, if (n == node) { return SBP_CALLBACK_ERROR; } - if ((n->msg_type == msg_type) && (n->context == context) && - (n->cb_type == cb_type)) { - if ((cb_type == SBP_MSG_CALLBACK) && (n->cb.msg == cb.msg)) { - return SBP_CALLBACK_ERROR; - } - if ((cb_type == SBP_FRAME_CALLBACK) && (n->cb.frame == cb.frame)) { - return SBP_CALLBACK_ERROR; - } - if ((cb_type == SBP_DECODED_CALLBACK) && - (n->cb.decoded == cb.decoded)) { - return SBP_CALLBACK_ERROR; - } + if ((n->msg_type == msg_type) && (n->context == context) && n->cb == cb) { + return SBP_CALLBACK_ERROR; } } /* Fill in our new sbp_msg_callback_node_t. */ node->msg_type = msg_type; node->context = context; - node->cb_type = cb_type; - if (cb_type == SBP_MSG_CALLBACK) { - node->cb.msg = cb.msg; - } else if (cb_type == SBP_FRAME_CALLBACK) { - node->cb.frame = cb.frame; - } else if (cb_type == SBP_DECODED_CALLBACK) { - node->cb.decoded = cb.decoded; - } + node->cb = cb; /* The next pointer is set to NULL, i.e. this * will be the new end of the linked list. */ @@ -382,48 +352,25 @@ static void sbp_u16_to_u8_array(const u16 v, u8 *array_start) } static s8 process_frame(sbp_state_t *s, u16 sender_id, sbp_msg_type_t msg_type, - u8 payload_len, u8 payload[], - u16 frame_len, u8 frame[], - u8 cb_mask) { + u8 payload_len, u8 payload[]) { s8 ret = SBP_OK_CALLBACK_UNDEFINED; sbp_msg_callbacks_node_t *node; sbp_msg_t unpacked_msg; bool need_unpack = true; bool unpacked_successfully = false; for (node = s->sbp_msg_callbacks_head; node; node = node->next) { - if ((SBP_CALLBACK_FLAG(node->cb_type) & cb_mask) && - ((node->msg_type == msg_type) || (node->msg_type == SbpMsgAll))) { - switch (node->cb_type) { - case SBP_FRAME_CALLBACK: - { - node->cb.frame(sender_id, (u16)msg_type, payload_len, payload, frame_len, - frame, node->context); - ret = SBP_OK_CALLBACK_EXECUTED; - } break; - case SBP_MSG_CALLBACK: - { - node->cb.msg(sender_id, payload_len, payload, node->context); - ret = SBP_OK_CALLBACK_EXECUTED; - } break; - case SBP_DECODED_CALLBACK: { - if (need_unpack) { - need_unpack = false; - if (sbp_message_decode(payload, payload_len, NULL, msg_type, &unpacked_msg) == SBP_OK) { - unpacked_successfully = true; - } - else { ret = SBP_DECODE_ERROR; } - } - if (unpacked_successfully) { - node->cb.decoded(sender_id, msg_type, &unpacked_msg, node->context); - ret = SBP_OK_CALLBACK_EXECUTED; - } - } break; - case SBP_CALLBACK_TYPE_COUNT: - default: - { - // NOP - }; + if ((node->msg_type == msg_type) || node->msg_type == SbpMsgAll) { + if (need_unpack) { + need_unpack = false; + if (sbp_message_decode(payload, payload_len, NULL, msg_type, &unpacked_msg) == SBP_OK) { + unpacked_successfully = true; } + else { ret = SBP_DECODE_ERROR; } + } + if (unpacked_successfully) { + node->cb(sender_id, msg_type, &unpacked_msg, node->context); + ret = SBP_OK_CALLBACK_EXECUTED; + } } } return ret; @@ -572,8 +519,7 @@ s8 sbp_process(sbp_state_t *s, s32 (*read)(u8 *buff, u32 n, void *context)) if (valid_crc) { /* Message complete, process frame callbacks and payload callbacks. */ ret = process_frame(s, s->sender_id, s->msg_type, - s->msg_len, SBP_FRAME_MSG_PAYLOAD(s->frame_buff), - s->frame_len, s->frame_buff, SBP_CALLBACK_ALL_MASK); + s->msg_len, SBP_FRAME_MSG_PAYLOAD(s->frame_buff)); return ret; } return SBP_CRC_ERROR; @@ -676,21 +622,15 @@ s8 sbp_internal_forward_payload(sbp_state_t *s, sbp_msg_type_t msg_type, *****************************************************************************/ s8 sbp_callback_register(sbp_state_t *s, sbp_msg_type_t msg_type, - sbp_decoded_callback_t cb, void *context, + sbp_callback_t cb, void *context, sbp_msg_callbacks_node_t *node) { - sbp_callback_t callback; - callback.decoded = cb; - return sbp_register_callback_generic(s, msg_type, callback, - SBP_DECODED_CALLBACK, context, node); + return sbp_register_callback_generic(s, msg_type, cb, context, node); } s8 sbp_all_message_callback_register(sbp_state_t *s, - sbp_decoded_callback_t cb, void *context, + sbp_callback_t cb, void *context, sbp_msg_callbacks_node_t *node) { - sbp_callback_t callback; - callback.decoded = cb; - return sbp_register_callback_generic(s, SbpMsgAll, callback, - SBP_DECODED_CALLBACK, context, node); + return sbp_register_callback_generic(s, SbpMsgAll, cb, context, node); } s8 sbp_message_send(sbp_state_t *s, sbp_msg_type_t msg_type, u16 sender_id, const sbp_msg_t *msg, sbp_write_fn_t write) { @@ -704,99 +644,16 @@ s8 sbp_message_send(sbp_state_t *s, sbp_msg_type_t msg_type, u16 sender_id, cons s8 sbp_message_process(sbp_state_t *s, u16 sender_id, sbp_msg_type_t msg_type, const sbp_msg_t *msg) { sbp_msg_callbacks_node_t *node; - uint8_t payload[SBP_MAX_PAYLOAD_LEN]; - uint8_t payload_len; - bool need_pack = true; - bool packed_successfully = false; s8 ret = SBP_OK_CALLBACK_UNDEFINED; for (node = s->sbp_msg_callbacks_head; node; node = node->next) { - if (((node->msg_type == msg_type) || (node->msg_type == SbpMsgAll))) { - switch (node->cb_type) { - case SBP_FRAME_CALLBACK: - case SBP_MSG_CALLBACK: - { - if (need_pack) { - need_pack = false; - if (sbp_message_encode(payload, sizeof(payload), &payload_len, msg_type, msg) == SBP_OK) { - packed_successfully = true; - } - else { ret = SBP_ENCODE_ERROR; } - } - if (packed_successfully) { - ret = SBP_OK_CALLBACK_EXECUTED; - if (node->cb_type == SBP_FRAME_CALLBACK) { - node->cb.frame(sender_id, (u16)msg_type, payload_len, payload, 0, 0, node->context); - } else { - node->cb.msg(sender_id, payload_len, payload, node->context); - } - } - } - break; - case SBP_DECODED_CALLBACK: { - node->cb.decoded(sender_id, msg_type, msg, node->context); - ret = SBP_OK_CALLBACK_EXECUTED; - } break; - case SBP_CALLBACK_TYPE_COUNT: - default: - break; - } + if ((node->msg_type == msg_type) || (node->msg_type == SbpMsgAll)) { + node->cb(sender_id, msg_type, msg, node->context); + ret = SBP_OK_CALLBACK_EXECUTED; } } return ret; } - -/****************************************************************************** - * - * Legacy API - * - *****************************************************************************/ -s8 sbp_payload_callback_register(sbp_state_t* s, u16 msg_type, sbp_msg_callback_t cb, void* context, - sbp_msg_callbacks_node_t *node) -{ - sbp_callback_t callback; - callback.msg = cb; - return sbp_register_callback_generic(s, (sbp_msg_type_t) msg_type, callback, - SBP_MSG_CALLBACK, context, node); -} - -s8 sbp_frame_callback_register(sbp_state_t* s, u16 msg_type, - sbp_frame_callback_t cb, void* context, - sbp_msg_callbacks_node_t *node) -{ - sbp_callback_t callback; - callback.frame = cb; - return sbp_register_callback_generic(s, (sbp_msg_type_t) msg_type, callback, - SBP_FRAME_CALLBACK, context, node); -} - -s8 sbp_all_payload_callback_register(sbp_state_t *s, sbp_frame_callback_t cb, - void *context, sbp_msg_callbacks_node_t *node) -{ - sbp_callback_t callback; - callback.frame = cb; - return sbp_register_callback_generic(s, SBP_MSG_ALL, callback, - SBP_FRAME_CALLBACK, context, node); -} - -s8 sbp_frame_process(sbp_state_t *s, u16 sender_id, u16 msg_type, - u8 payload_len, u8 payload[], u16 frame_len, u8 frame[], u8 cb_mask) -{ - return process_frame(s, sender_id, (sbp_msg_type_t)msg_type, payload_len, payload, frame_len, frame, cb_mask); -} - -s8 sbp_payload_process(sbp_state_t *s, u16 sender_id, u16 msg_type, u8 msg_len, - u8 payload[]) { - return process_frame(s, sender_id, (sbp_msg_type_t) msg_type, msg_len, payload, - 0, 0, SBP_CALLBACK_FLAG(SBP_MSG_CALLBACK) | SBP_CALLBACK_FLAG(SBP_DECODED_CALLBACK)); -} - -s8 sbp_payload_send(sbp_state_t *s, u16 msg_type, u16 sender_id, u8 len, u8 *payload, - sbp_write_fn_t write) -{ - return sbp_internal_forward_payload(s, (sbp_msg_type_t)msg_type, sender_id, len, payload, write); -} - /** \} */ /** \} */ diff --git a/c/src/settings.c b/c/src/settings.c index a594f72e92..2daa719c45 100644 --- a/c/src/settings.c +++ b/c/src/settings.c @@ -71,7 +71,7 @@ s8 sbp_msg_settings_save_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SETTINGS_SAVE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgSettingsSave, sender_id, payload_len, payload, write); } @@ -230,7 +230,7 @@ s8 sbp_msg_settings_write_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SETTINGS_WRITE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgSettingsWrite, sender_id, payload_len, payload, write); } @@ -399,7 +399,7 @@ s8 sbp_msg_settings_write_resp_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SETTINGS_WRITE_RESP, sender_id, + return sbp_internal_forward_payload(s, SbpMsgSettingsWriteResp, sender_id, payload_len, payload, write); } @@ -566,7 +566,7 @@ s8 sbp_msg_settings_read_req_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SETTINGS_READ_REQ, sender_id, + return sbp_internal_forward_payload(s, SbpMsgSettingsReadReq, sender_id, payload_len, payload, write); } @@ -729,7 +729,7 @@ s8 sbp_msg_settings_read_resp_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SETTINGS_READ_RESP, sender_id, + return sbp_internal_forward_payload(s, SbpMsgSettingsReadResp, sender_id, payload_len, payload, write); } @@ -799,7 +799,7 @@ s8 sbp_msg_settings_read_by_index_req_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SETTINGS_READ_BY_INDEX_REQ, + return sbp_internal_forward_payload(s, SbpMsgSettingsReadByIndexReq, sender_id, payload_len, payload, write); } @@ -972,7 +972,7 @@ s8 sbp_msg_settings_read_by_index_resp_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SETTINGS_READ_BY_INDEX_RESP, + return sbp_internal_forward_payload(s, SbpMsgSettingsReadByIndexResp, sender_id, payload_len, payload, write); } @@ -1046,7 +1046,7 @@ s8 sbp_msg_settings_read_by_index_done_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SETTINGS_READ_BY_INDEX_DONE, + return sbp_internal_forward_payload(s, SbpMsgSettingsReadByIndexDone, sender_id, payload_len, payload, write); } @@ -1209,7 +1209,7 @@ s8 sbp_msg_settings_register_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SETTINGS_REGISTER, sender_id, + return sbp_internal_forward_payload(s, SbpMsgSettingsRegister, sender_id, payload_len, payload, write); } @@ -1378,8 +1378,8 @@ s8 sbp_msg_settings_register_resp_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SETTINGS_REGISTER_RESP, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgSettingsRegisterResp, sender_id, + payload_len, payload, write); } int sbp_msg_settings_register_resp_cmp( diff --git a/c/src/signing.c b/c/src/signing.c index d9f5720a96..5a08f1c2b6 100644 --- a/c/src/signing.c +++ b/c/src/signing.c @@ -298,7 +298,7 @@ s8 sbp_msg_ecdsa_certificate_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ECDSA_CERTIFICATE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEcdsaCertificate, sender_id, payload_len, payload, write); } @@ -437,7 +437,7 @@ s8 sbp_msg_certificate_chain_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_CERTIFICATE_CHAIN, sender_id, + return sbp_internal_forward_payload(s, SbpMsgCertificateChain, sender_id, payload_len, payload, write); } @@ -592,8 +592,8 @@ s8 sbp_msg_certificate_chain_dep_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_CERTIFICATE_CHAIN_DEP, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgCertificateChainDep, sender_id, + payload_len, payload, write); } int sbp_msg_certificate_chain_dep_cmp( @@ -750,7 +750,7 @@ s8 sbp_msg_ecdsa_signature_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ECDSA_SIGNATURE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgEcdsaSignature, sender_id, payload_len, payload, write); } @@ -914,8 +914,8 @@ s8 sbp_msg_ecdsa_signature_dep_b_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ECDSA_SIGNATURE_DEP_B, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgEcdsaSignatureDepB, sender_id, + payload_len, payload, write); } int sbp_msg_ecdsa_signature_dep_b_cmp( @@ -1084,8 +1084,8 @@ s8 sbp_msg_ecdsa_signature_dep_a_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ECDSA_SIGNATURE_DEP_A, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgEcdsaSignatureDepA, sender_id, + payload_len, payload, write); } int sbp_msg_ecdsa_signature_dep_a_cmp( @@ -1226,8 +1226,8 @@ s8 sbp_msg_ed25519_certificate_dep_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ED25519_CERTIFICATE_DEP, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgEd25519CertificateDep, sender_id, + payload_len, payload, write); } int sbp_msg_ed25519_certificate_dep_cmp( @@ -1352,8 +1352,8 @@ s8 sbp_msg_ed25519_signature_dep_a_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ED25519_SIGNATURE_DEP_A, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgEd25519SignatureDepA, sender_id, + payload_len, payload, write); } int sbp_msg_ed25519_signature_dep_a_cmp( @@ -1495,8 +1495,8 @@ s8 sbp_msg_ed25519_signature_dep_b_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ED25519_SIGNATURE_DEP_B, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgEd25519SignatureDepB, sender_id, + payload_len, payload, write); } int sbp_msg_ed25519_signature_dep_b_cmp( diff --git a/c/src/solution_meta.c b/c/src/solution_meta.c index 6465426e3c..599be876f4 100644 --- a/c/src/solution_meta.c +++ b/c/src/solution_meta.c @@ -198,7 +198,7 @@ s8 sbp_msg_soln_meta_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SOLN_META_DEP_A, sender_id, + return sbp_internal_forward_payload(s, SbpMsgSolnMetaDepA, sender_id, payload_len, payload, write); } @@ -361,8 +361,8 @@ s8 sbp_msg_soln_meta_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SOLN_META, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgSolnMeta, sender_id, payload_len, + payload, write); } int sbp_msg_soln_meta_cmp(const sbp_msg_soln_meta_t *a, diff --git a/c/src/ssr.c b/c/src/ssr.c index 4064f3ae20..fbaa4781a6 100644 --- a/c/src/ssr.c +++ b/c/src/ssr.c @@ -819,7 +819,7 @@ bool sbp_msg_ssr_orbit_clock_encode_internal( if (!sbp_gps_time_sec_encode_internal(ctx, &msg->time)) { return false; } - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u8_encode(ctx, &msg->update_interval)) { @@ -881,7 +881,7 @@ bool sbp_msg_ssr_orbit_clock_decode_internal(sbp_decode_ctx_t *ctx, if (!sbp_gps_time_sec_decode_internal(ctx, &msg->time)) { return false; } - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u8_decode(ctx, &msg->update_interval)) { @@ -949,7 +949,7 @@ s8 sbp_msg_ssr_orbit_clock_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_ORBIT_CLOCK, sender_id, + return sbp_internal_forward_payload(s, SbpMsgSsrOrbitClock, sender_id, payload_len, payload, write); } @@ -962,7 +962,7 @@ int sbp_msg_ssr_orbit_clock_cmp(const sbp_msg_ssr_orbit_clock_t *a, return ret; } - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); if (ret != 0) { return ret; } @@ -1031,7 +1031,7 @@ bool sbp_msg_ssr_code_biases_encode_internal( if (!sbp_gps_time_sec_encode_internal(ctx, &msg->time)) { return false; } - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u8_encode(ctx, &msg->update_interval)) { @@ -1068,7 +1068,7 @@ bool sbp_msg_ssr_code_biases_decode_internal(sbp_decode_ctx_t *ctx, if (!sbp_gps_time_sec_decode_internal(ctx, &msg->time)) { return false; } - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u8_decode(ctx, &msg->update_interval)) { @@ -1117,7 +1117,7 @@ s8 sbp_msg_ssr_code_biases_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_CODE_BIASES, sender_id, + return sbp_internal_forward_payload(s, SbpMsgSsrCodeBiases, sender_id, payload_len, payload, write); } @@ -1130,7 +1130,7 @@ int sbp_msg_ssr_code_biases_cmp(const sbp_msg_ssr_code_biases_t *a, return ret; } - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); if (ret != 0) { return ret; } @@ -1163,7 +1163,7 @@ bool sbp_msg_ssr_phase_biases_encode_internal( if (!sbp_gps_time_sec_encode_internal(ctx, &msg->time)) { return false; } - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u8_encode(ctx, &msg->update_interval)) { @@ -1213,7 +1213,7 @@ bool sbp_msg_ssr_phase_biases_decode_internal(sbp_decode_ctx_t *ctx, if (!sbp_gps_time_sec_decode_internal(ctx, &msg->time)) { return false; } - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u8_decode(ctx, &msg->update_interval)) { @@ -1274,7 +1274,7 @@ s8 sbp_msg_ssr_phase_biases_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_PHASE_BIASES, sender_id, + return sbp_internal_forward_payload(s, SbpMsgSsrPhaseBiases, sender_id, payload_len, payload, write); } @@ -1287,7 +1287,7 @@ int sbp_msg_ssr_phase_biases_cmp(const sbp_msg_ssr_phase_biases_t *a, return ret; } - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); if (ret != 0) { return ret; } @@ -1408,8 +1408,8 @@ s8 sbp_msg_ssr_stec_correction_dep_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_STEC_CORRECTION_DEP, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgSsrStecCorrectionDep, sender_id, + payload_len, payload, write); } int sbp_msg_ssr_stec_correction_dep_cmp( @@ -1630,7 +1630,7 @@ s8 sbp_msg_ssr_stec_correction_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_STEC_CORRECTION, sender_id, + return sbp_internal_forward_payload(s, SbpMsgSsrStecCorrection, sender_id, payload_len, payload, write); } @@ -1763,8 +1763,8 @@ s8 sbp_msg_ssr_gridded_correction_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_GRIDDED_CORRECTION, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgSsrGriddedCorrection, sender_id, + payload_len, payload, write); } int sbp_msg_ssr_gridded_correction_cmp( @@ -2046,7 +2046,7 @@ s8 sbp_msg_ssr_gridded_correction_bounds_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_GRIDDED_CORRECTION_BOUNDS, + return sbp_internal_forward_payload(s, SbpMsgSsrGriddedCorrectionBounds, sender_id, payload_len, payload, write); } @@ -2236,8 +2236,8 @@ s8 sbp_msg_ssr_tile_definition_dep_a_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_TILE_DEFINITION_DEP_A, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgSsrTileDefinitionDepA, sender_id, + payload_len, payload, write); } int sbp_msg_ssr_tile_definition_dep_a_cmp( @@ -2401,8 +2401,8 @@ s8 sbp_msg_ssr_tile_definition_dep_b_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_TILE_DEFINITION_DEP_B, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgSsrTileDefinitionDepB, sender_id, + payload_len, payload, write); } int sbp_msg_ssr_tile_definition_dep_b_cmp( @@ -2589,7 +2589,7 @@ s8 sbp_msg_ssr_tile_definition_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_TILE_DEFINITION, sender_id, + return sbp_internal_forward_payload(s, SbpMsgSsrTileDefinition, sender_id, payload_len, payload, write); } @@ -2663,7 +2663,7 @@ int sbp_msg_ssr_tile_definition_cmp(const sbp_msg_ssr_tile_definition_t *a, bool sbp_satellite_apc_encode_internal(sbp_encode_ctx_t *ctx, const sbp_satellite_apc_t *msg) { - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u8_encode(ctx, &msg->sat_info)) { @@ -2702,7 +2702,7 @@ s8 sbp_satellite_apc_encode(uint8_t *buf, uint8_t len, uint8_t *n_written, bool sbp_satellite_apc_decode_internal(sbp_decode_ctx_t *ctx, sbp_satellite_apc_t *msg) { - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u8_decode(ctx, &msg->sat_info)) { @@ -2743,7 +2743,7 @@ int sbp_satellite_apc_cmp(const sbp_satellite_apc_t *a, const sbp_satellite_apc_t *b) { int ret = 0; - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); if (ret != 0) { return ret; } @@ -2844,8 +2844,8 @@ s8 sbp_msg_ssr_satellite_apc_dep_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_SATELLITE_APC_DEP, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgSsrSatelliteApcDep, sender_id, + payload_len, payload, write); } int sbp_msg_ssr_satellite_apc_dep_cmp( @@ -2957,7 +2957,7 @@ s8 sbp_msg_ssr_satellite_apc_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_SATELLITE_APC, sender_id, + return sbp_internal_forward_payload(s, SbpMsgSsrSatelliteApc, sender_id, payload_len, payload, write); } @@ -3003,7 +3003,7 @@ bool sbp_msg_ssr_orbit_clock_dep_a_encode_internal( if (!sbp_gps_time_sec_encode_internal(ctx, &msg->time)) { return false; } - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u8_encode(ctx, &msg->update_interval)) { @@ -3066,7 +3066,7 @@ bool sbp_msg_ssr_orbit_clock_dep_a_decode_internal( if (!sbp_gps_time_sec_decode_internal(ctx, &msg->time)) { return false; } - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u8_decode(ctx, &msg->update_interval)) { @@ -3134,8 +3134,8 @@ s8 sbp_msg_ssr_orbit_clock_dep_a_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_ORBIT_CLOCK_DEP_A, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgSsrOrbitClockDepA, sender_id, + payload_len, payload, write); } int sbp_msg_ssr_orbit_clock_dep_a_cmp( @@ -3148,7 +3148,7 @@ int sbp_msg_ssr_orbit_clock_dep_a_cmp( return ret; } - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); if (ret != 0) { return ret; } @@ -3607,8 +3607,8 @@ s8 sbp_msg_ssr_stec_correction_dep_a_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_STEC_CORRECTION_DEP_A, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgSsrStecCorrectionDepA, sender_id, + payload_len, payload, write); } int sbp_msg_ssr_stec_correction_dep_a_cmp( @@ -3726,9 +3726,8 @@ s8 sbp_msg_ssr_gridded_correction_no_std_dep_a_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload( - s, SBP_MSG_SSR_GRIDDED_CORRECTION_NO_STD_DEP_A, sender_id, payload_len, - payload, write); + return sbp_internal_forward_payload(s, SbpMsgSsrGriddedCorrectionNoStdDepA, + sender_id, payload_len, payload, write); } int sbp_msg_ssr_gridded_correction_no_std_dep_a_cmp( @@ -3853,7 +3852,7 @@ s8 sbp_msg_ssr_gridded_correction_dep_a_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_GRIDDED_CORRECTION_DEP_A, + return sbp_internal_forward_payload(s, SbpMsgSsrGriddedCorrectionDepA, sender_id, payload_len, payload, write); } @@ -3964,8 +3963,8 @@ s8 sbp_msg_ssr_grid_definition_dep_a_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_GRID_DEFINITION_DEP_A, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgSsrGridDefinitionDepA, sender_id, + payload_len, payload, write); } int sbp_msg_ssr_grid_definition_dep_a_cmp( @@ -4226,8 +4225,8 @@ s8 sbp_msg_ssr_orbit_clock_bounds_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_ORBIT_CLOCK_BOUNDS, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgSsrOrbitClockBounds, sender_id, + payload_len, payload, write); } int sbp_msg_ssr_orbit_clock_bounds_cmp( @@ -4475,7 +4474,7 @@ s8 sbp_msg_ssr_code_phase_biases_bounds_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SSR_CODE_PHASE_BIASES_BOUNDS, + return sbp_internal_forward_payload(s, SbpMsgSsrCodePhaseBiasesBounds, sender_id, payload_len, payload, write); } @@ -4738,9 +4737,8 @@ s8 sbp_msg_ssr_orbit_clock_bounds_degradation_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload( - s, SBP_MSG_SSR_ORBIT_CLOCK_BOUNDS_DEGRADATION, sender_id, payload_len, - payload, write); + return sbp_internal_forward_payload(s, SbpMsgSsrOrbitClockBoundsDegradation, + sender_id, payload_len, payload, write); } int sbp_msg_ssr_orbit_clock_bounds_degradation_cmp( diff --git a/c/src/system.c b/c/src/system.c index 4882e05487..d274e45588 100644 --- a/c/src/system.c +++ b/c/src/system.c @@ -83,8 +83,8 @@ s8 sbp_msg_startup_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_STARTUP, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgStartup, sender_id, payload_len, + payload, write); } int sbp_msg_startup_cmp(const sbp_msg_startup_t *a, @@ -276,7 +276,7 @@ s8 sbp_msg_dgnss_status_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_DGNSS_STATUS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgDgnssStatus, sender_id, payload_len, payload, write); } @@ -359,7 +359,7 @@ s8 sbp_msg_heartbeat_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_HEARTBEAT, sender_id, + return sbp_internal_forward_payload(s, SbpMsgHeartbeat, sender_id, payload_len, payload, write); } @@ -536,7 +536,7 @@ s8 sbp_msg_status_report_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_STATUS_REPORT, sender_id, + return sbp_internal_forward_payload(s, SbpMsgStatusReport, sender_id, payload_len, payload, write); } @@ -734,7 +734,7 @@ s8 sbp_msg_status_journal_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_STATUS_JOURNAL, sender_id, + return sbp_internal_forward_payload(s, SbpMsgStatusJournal, sender_id, payload_len, payload, write); } @@ -831,7 +831,7 @@ s8 sbp_msg_ins_status_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_INS_STATUS, sender_id, + return sbp_internal_forward_payload(s, SbpMsgInsStatus, sender_id, payload_len, payload, write); } @@ -1008,7 +1008,7 @@ s8 sbp_msg_csac_telemetry_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_CSAC_TELEMETRY, sender_id, + return sbp_internal_forward_payload(s, SbpMsgCsacTelemetry, sender_id, payload_len, payload, write); } @@ -1202,8 +1202,8 @@ s8 sbp_msg_csac_telemetry_labels_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_CSAC_TELEMETRY_LABELS, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgCsacTelemetryLabels, sender_id, + payload_len, payload, write); } int sbp_msg_csac_telemetry_labels_cmp( @@ -1312,7 +1312,7 @@ s8 sbp_msg_ins_updates_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_INS_UPDATES, sender_id, + return sbp_internal_forward_payload(s, SbpMsgInsUpdates, sender_id, payload_len, payload, write); } @@ -1430,7 +1430,7 @@ s8 sbp_msg_gnss_time_offset_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_GNSS_TIME_OFFSET, sender_id, + return sbp_internal_forward_payload(s, SbpMsgGnssTimeOffset, sender_id, payload_len, payload, write); } @@ -1517,8 +1517,8 @@ s8 sbp_msg_pps_time_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_PPS_TIME, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgPpsTime, sender_id, payload_len, + payload, write); } int sbp_msg_pps_time_cmp(const sbp_msg_pps_time_t *a, @@ -1634,7 +1634,7 @@ s8 sbp_msg_sensor_aid_event_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_SENSOR_AID_EVENT, sender_id, + return sbp_internal_forward_payload(s, SbpMsgSensorAidEvent, sender_id, payload_len, payload, write); } @@ -1764,7 +1764,7 @@ s8 sbp_msg_group_meta_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_GROUP_META, sender_id, + return sbp_internal_forward_payload(s, SbpMsgGroupMeta, sender_id, payload_len, payload, write); } diff --git a/c/src/telemetry.c b/c/src/telemetry.c index e0a52b0ec0..d54d15c8e5 100644 --- a/c/src/telemetry.c +++ b/c/src/telemetry.c @@ -43,7 +43,7 @@ bool sbp_telemetry_sv_encode_internal(sbp_encode_ctx_t *ctx, if (!sbp_u8_encode(ctx, &msg->correction_flags)) { return false; } - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } return true; @@ -90,7 +90,7 @@ bool sbp_telemetry_sv_decode_internal(sbp_decode_ctx_t *ctx, if (!sbp_u8_decode(ctx, &msg->correction_flags)) { return false; } - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } return true; @@ -155,7 +155,7 @@ int sbp_telemetry_sv_cmp(const sbp_telemetry_sv_t *a, return ret; } - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); return ret; } @@ -246,7 +246,7 @@ s8 sbp_msg_tel_sv_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_TEL_SV, sender_id, payload_len, + return sbp_internal_forward_payload(s, SbpMsgTelSv, sender_id, payload_len, payload, write); } diff --git a/c/src/tracking.c b/c/src/tracking.c index f76958ad42..15f9b182e2 100644 --- a/c/src/tracking.c +++ b/c/src/tracking.c @@ -22,7 +22,7 @@ bool sbp_msg_tracking_state_detailed_dep_a_encode_internal( if (!sbp_u64_encode(ctx, &msg->recv_time)) { return false; } - if (!sbp_v4_gps_time_encode_internal(ctx, &msg->tot)) { + if (!sbp_gps_time_encode_internal(ctx, &msg->tot)) { return false; } if (!sbp_u32_encode(ctx, &msg->P)) { @@ -40,7 +40,7 @@ bool sbp_msg_tracking_state_detailed_dep_a_encode_internal( if (!sbp_u16_encode(ctx, &msg->lock)) { return false; } - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } if (!sbp_s32_encode(ctx, &msg->doppler)) { @@ -106,7 +106,7 @@ bool sbp_msg_tracking_state_detailed_dep_a_decode_internal( if (!sbp_u64_decode(ctx, &msg->recv_time)) { return false; } - if (!sbp_v4_gps_time_decode_internal(ctx, &msg->tot)) { + if (!sbp_gps_time_decode_internal(ctx, &msg->tot)) { return false; } if (!sbp_u32_decode(ctx, &msg->P)) { @@ -124,7 +124,7 @@ bool sbp_msg_tracking_state_detailed_dep_a_decode_internal( if (!sbp_u16_decode(ctx, &msg->lock)) { return false; } - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } if (!sbp_s32_decode(ctx, &msg->doppler)) { @@ -195,7 +195,7 @@ s8 sbp_msg_tracking_state_detailed_dep_a_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_TRACKING_STATE_DETAILED_DEP_A, + return sbp_internal_forward_payload(s, SbpMsgTrackingStateDetailedDepA, sender_id, payload_len, payload, write); } @@ -209,7 +209,7 @@ int sbp_msg_tracking_state_detailed_dep_a_cmp( return ret; } - ret = sbp_v4_gps_time_cmp(&a->tot, &b->tot); + ret = sbp_gps_time_cmp(&a->tot, &b->tot); if (ret != 0) { return ret; } @@ -239,7 +239,7 @@ int sbp_msg_tracking_state_detailed_dep_a_cmp( return ret; } - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); if (ret != 0) { return ret; } @@ -486,7 +486,7 @@ s8 sbp_msg_tracking_state_detailed_dep_send( if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_TRACKING_STATE_DETAILED_DEP, + return sbp_internal_forward_payload(s, SbpMsgTrackingStateDetailedDep, sender_id, payload_len, payload, write); } @@ -601,7 +601,7 @@ int sbp_msg_tracking_state_detailed_dep_cmp( bool sbp_tracking_channel_state_encode_internal( sbp_encode_ctx_t *ctx, const sbp_tracking_channel_state_t *msg) { - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u8_encode(ctx, &msg->fcn)) { @@ -631,7 +631,7 @@ s8 sbp_tracking_channel_state_encode(uint8_t *buf, uint8_t len, bool sbp_tracking_channel_state_decode_internal( sbp_decode_ctx_t *ctx, sbp_tracking_channel_state_t *msg) { - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } if (!sbp_u8_decode(ctx, &msg->fcn)) { @@ -663,7 +663,7 @@ int sbp_tracking_channel_state_cmp(const sbp_tracking_channel_state_t *a, const sbp_tracking_channel_state_t *b) { int ret = 0; - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); if (ret != 0) { return ret; } @@ -744,7 +744,7 @@ s8 sbp_msg_tracking_state_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_TRACKING_STATE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgTrackingState, sender_id, payload_len, payload, write); } @@ -767,7 +767,7 @@ int sbp_msg_tracking_state_cmp(const sbp_msg_tracking_state_t *a, bool sbp_measurement_state_encode_internal(sbp_encode_ctx_t *ctx, const sbp_measurement_state_t *msg) { - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->mesid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->mesid)) { return false; } if (!sbp_u8_encode(ctx, &msg->cn0)) { @@ -793,7 +793,7 @@ s8 sbp_measurement_state_encode(uint8_t *buf, uint8_t len, uint8_t *n_written, bool sbp_measurement_state_decode_internal(sbp_decode_ctx_t *ctx, sbp_measurement_state_t *msg) { - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->mesid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->mesid)) { return false; } if (!sbp_u8_decode(ctx, &msg->cn0)) { @@ -821,7 +821,7 @@ int sbp_measurement_state_cmp(const sbp_measurement_state_t *a, const sbp_measurement_state_t *b) { int ret = 0; - ret = sbp_v4_gnss_signal_cmp(&a->mesid, &b->mesid); + ret = sbp_gnss_signal_cmp(&a->mesid, &b->mesid); if (ret != 0) { return ret; } @@ -897,7 +897,7 @@ s8 sbp_msg_measurement_state_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_MEASUREMENT_STATE, sender_id, + return sbp_internal_forward_payload(s, SbpMsgMeasurementState, sender_id, payload_len, payload, write); } @@ -991,7 +991,7 @@ bool sbp_msg_tracking_iq_encode_internal(sbp_encode_ctx_t *ctx, if (!sbp_u8_encode(ctx, &msg->channel)) { return false; } - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } for (size_t i = 0; i < SBP_MSG_TRACKING_IQ_CORRS_MAX; i++) { @@ -1023,7 +1023,7 @@ bool sbp_msg_tracking_iq_decode_internal(sbp_decode_ctx_t *ctx, if (!sbp_u8_decode(ctx, &msg->channel)) { return false; } - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } for (uint8_t i = 0; i < SBP_MSG_TRACKING_IQ_CORRS_MAX; i++) { @@ -1060,7 +1060,7 @@ s8 sbp_msg_tracking_iq_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_TRACKING_IQ, sender_id, + return sbp_internal_forward_payload(s, SbpMsgTrackingIq, sender_id, payload_len, payload, write); } @@ -1073,7 +1073,7 @@ int sbp_msg_tracking_iq_cmp(const sbp_msg_tracking_iq_t *a, return ret; } - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); if (ret != 0) { return ret; } @@ -1160,7 +1160,7 @@ bool sbp_msg_tracking_iq_dep_b_encode_internal( if (!sbp_u8_encode(ctx, &msg->channel)) { return false; } - if (!sbp_v4_gnss_signal_encode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_encode_internal(ctx, &msg->sid)) { return false; } for (size_t i = 0; i < SBP_MSG_TRACKING_IQ_DEP_B_CORRS_MAX; i++) { @@ -1193,7 +1193,7 @@ bool sbp_msg_tracking_iq_dep_b_decode_internal( if (!sbp_u8_decode(ctx, &msg->channel)) { return false; } - if (!sbp_v4_gnss_signal_decode_internal(ctx, &msg->sid)) { + if (!sbp_gnss_signal_decode_internal(ctx, &msg->sid)) { return false; } for (uint8_t i = 0; i < SBP_MSG_TRACKING_IQ_DEP_B_CORRS_MAX; i++) { @@ -1231,7 +1231,7 @@ s8 sbp_msg_tracking_iq_dep_b_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_TRACKING_IQ_DEP_B, sender_id, + return sbp_internal_forward_payload(s, SbpMsgTrackingIqDepB, sender_id, payload_len, payload, write); } @@ -1244,7 +1244,7 @@ int sbp_msg_tracking_iq_dep_b_cmp(const sbp_msg_tracking_iq_dep_b_t *a, return ret; } - ret = sbp_v4_gnss_signal_cmp(&a->sid, &b->sid); + ret = sbp_gnss_signal_cmp(&a->sid, &b->sid); if (ret != 0) { return ret; } @@ -1334,7 +1334,7 @@ s8 sbp_msg_tracking_iq_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_TRACKING_IQ_DEP_A, sender_id, + return sbp_internal_forward_payload(s, SbpMsgTrackingIqDepA, sender_id, payload_len, payload, write); } @@ -1510,8 +1510,8 @@ s8 sbp_msg_tracking_state_dep_a_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_TRACKING_STATE_DEP_A, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgTrackingStateDepA, sender_id, + payload_len, payload, write); } int sbp_msg_tracking_state_dep_a_cmp(const sbp_msg_tracking_state_dep_a_t *a, @@ -1680,8 +1680,8 @@ s8 sbp_msg_tracking_state_dep_b_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_TRACKING_STATE_DEP_B, - sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgTrackingStateDepB, sender_id, + payload_len, payload, write); } int sbp_msg_tracking_state_dep_b_cmp(const sbp_msg_tracking_state_dep_b_t *a, diff --git a/c/src/user.c b/c/src/user.c index f438f0e92d..a66373f752 100644 --- a/c/src/user.c +++ b/c/src/user.c @@ -82,8 +82,8 @@ s8 sbp_msg_user_data_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_USER_DATA, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgUserData, sender_id, payload_len, + payload, write); } int sbp_msg_user_data_cmp(const sbp_msg_user_data_t *a, diff --git a/c/src/vehicle.c b/c/src/vehicle.c index 4af299b2b1..c975a00958 100644 --- a/c/src/vehicle.c +++ b/c/src/vehicle.c @@ -83,8 +83,8 @@ s8 sbp_msg_odometry_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_ODOMETRY, sender_id, - payload_len, payload, write); + return sbp_internal_forward_payload(s, SbpMsgOdometry, sender_id, payload_len, + payload, write); } int sbp_msg_odometry_cmp(const sbp_msg_odometry_t *a, @@ -179,7 +179,7 @@ s8 sbp_msg_wheeltick_send(sbp_state_t *s, u16 sender_id, if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, SBP_MSG_WHEELTICK, sender_id, + return sbp_internal_forward_payload(s, SbpMsgWheeltick, sender_id, payload_len, payload, write); } diff --git a/c/test/CMakeLists.txt b/c/test/CMakeLists.txt index 6a6aebc82f..9a507e9614 100644 --- a/c/test/CMakeLists.txt +++ b/c/test/CMakeLists.txt @@ -6,8 +6,6 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(TEST_LIBS ${TEST_LIBS} rt) endif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") -FILE(GLOB generated_legacy_c_sources legacy/auto*.c) - FILE(GLOB generated_c_sources auto*.c) set(TEST_INCLUDES ${PROJECT_SOURCE_DIR}/include/libsbp) @@ -25,33 +23,6 @@ if(APPLE) list(APPEND TEST_INCLUDES "-L/usr/local/lib") endif() -if (NOT CMAKE_C_COMPILER_ID STREQUAL "MSVC") - swift_add_test(test-libsbp-legacy - UNIT_TEST - SRCS - check_main_legacy.c - check_edc.c - check_sbp.c - check_bitfield_macros.c - ${generated_legacy_c_sources} - INCLUDE - ${TEST_INCLUDES} - LINK - ${TEST_LIBS} - ) - swift_set_compile_options(test-libsbp-legacy - REMOVE - -Wconversion - -Wpointer-arith - -Wformat - -Wformat-security - -Wformat-y2k - ADD - -Wformat=0 - -Wno-deprecated-declarations - ) -endif() - swift_add_test(test-libsbp UNIT_TEST SRCS @@ -66,7 +37,7 @@ swift_add_test(test-libsbp ${TEST_LIBS} ) swift_set_compile_options(test-libsbp - REMOVE + REMOVE -Wpointer-arith -Wformat -Wformat-security @@ -78,6 +49,3 @@ swift_set_compile_options(test-libsbp add_subdirectory(cpp) add_subdirectory(string) -if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - add_subdirectory(legacy/cpp) -endif() diff --git a/c/test/check_main.c b/c/test/check_main.c index cc8ec63e00..c392aa1269 100644 --- a/c/test/check_main.c +++ b/c/test/check_main.c @@ -14,6 +14,7 @@ #include #include + #include "check_suites.h" int main(void) { diff --git a/c/test/check_main_legacy.c b/c/test/check_main_legacy.c index 8dae8e9830..c392aa1269 100644 --- a/c/test/check_main_legacy.c +++ b/c/test/check_main_legacy.c @@ -14,7 +14,8 @@ #include #include -#include "check_suites_legacy.h" + +#include "check_suites.h" int main(void) { int number_failed; @@ -25,373 +26,262 @@ int main(void) { srunner_add_suite(sr, bitfield_macros_suite()); // auto-generated tests: - srunner_add_suite(sr, legacy_auto_check_sbp_acquisition_MsgAcqResult_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_acquisition_MsgAcqResultDepA_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_acquisition_MsgAcqResultDepB_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_acquisition_MsgAcqResultDepC_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_acquisition_MsgAcqSvProfile_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_acquisition_MsgAcqSvProfileDep_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeReq_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeResp_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_bootload_MsgBootloaderJumptoApp_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_bootload_MsgNapDeviceDnaReq_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_bootload_MsgNapDeviceDnaResp_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_ext_events_MsgExtEvent_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_file_io_MsgFileioConfigReq_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_file_io_MsgFileioConfigResp_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_file_io_MsgFileioReadDirReq_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_file_io_MsgFileioReadDirResp_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_file_io_MsgFileioReadReq_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_file_io_MsgFileioReadResp_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_file_io_MsgFileioRemove_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_file_io_MsgFileioWriteResp_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_flash_MsgFlashDone_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_flash_MsgFlashErase_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_flash_MsgFlashProgram_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_flash_MsgFlashReadReq_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_flash_MsgFlashReadResp_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_flash_MsgM25FlashWriteStatus_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_flash_MsgStmFlashLockSector_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_flash_MsgStmFlashUnlockSector_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_flash_MsgStmUniqueIdReq_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_flash_MsgStmUniqueIdResp_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_imu_MsgImuAux_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_imu_MsgImuRaw_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_integrity_MsgAcknowledge_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_integrity_MsgSsrFlagHighLevel_suite()); - srunner_add_suite( - sr, - legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPointSatLos_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPoints_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_integrity_MsgSsrFlagIonoTileSatLos_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_integrity_MsgSsrFlagSatellites_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_integrity_MsgSsrFlagTropoGridPoints_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_linux_MsgLinuxCpuState_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_linux_MsgLinuxCpuStateDepA_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_linux_MsgLinuxMemState_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_linux_MsgLinuxMemStateDepA_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_linux_MsgLinuxProcessFdCount_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_linux_MsgLinuxProcessFdSummary_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_linux_MsgLinuxProcessSocketCounts_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_linux_MsgLinuxProcessSocketQueues_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_linux_MsgLinuxSocketUsage_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_linux_MsgLinuxSysState_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_linux_MsgLinuxSysStateDepA_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_logging_MsgFwd_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_logging_MsgLog_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_logging_MsgPrintDep_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_mag_MsgMagRaw_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_navigation_MsgAgeCorrections_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_navigation_MsgBaselineECEF_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_navigation_MsgBaselineHeadingDepA_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_navigation_MsgBaselineNED_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgDops_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgDopsDepA_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgGPSTime_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_navigation_MsgGPSTimeDepA_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgPosECEF_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgPosECEFCov_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_navigation_MsgPosECEFCovGNSS_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_navigation_MsgPosECEFDepA_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_navigation_MsgPosECEFGNSS_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgPosLLH_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgPosLLHCov_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgPosLLHDepA_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgPosLlhAcc_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_navigation_MsgPosLlhCovGnss_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgPosLlhGnss_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_navigation_MsgPoseRelative_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_navigation_MsgProtectionLevel_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_navigation_MsgProtectionLevelDepA_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_navigation_MsgReferenceFrameParam_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_navigation_MsgUTCLeapSecond_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgUTCTime_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_navigation_MsgUTCTimeGNSS_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgVelBody_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgVelCog_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgVelECEF_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgVelECEFCov_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_navigation_MsgVelECEFDepA_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_navigation_MsgVelEcefCovGnss_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_navigation_MsgVelEcefGnss_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgVelNED_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgVelNEDCOV_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgVelNEDDepA_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_navigation_MsgVelNedCovGnss_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_navigation_MsgVelNedGnss_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_ndb_MsgNdbEvent_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_observation_MsgAlmanacGLO_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_observation_MsgAlmanacGLODep_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_observation_MsgAlmanacGPS_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_observation_MsgAlmanacGPSDep_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_observation_MsgBasePosEcef_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_observation_MsgBasePosLLH_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_observation_MsgEphemerisBds_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_observation_MsgEphemerisDepA_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_observation_MsgEphemerisDepC_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_observation_MsgEphemerisDepD_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_observation_MsgEphemerisGLO_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_observation_MsgEphemerisGLODepA_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_observation_MsgEphemerisGLODepB_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_observation_MsgEphemerisGLODepC_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_observation_MsgEphemerisGLODepD_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_observation_MsgEphemerisGPS_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_observation_MsgEphemerisGPSDepE_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_observation_MsgEphemerisGPSDepF_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_observation_MsgEphemerisGal_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_observation_MsgEphemerisGalDepA_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_observation_MsgEphemerisSbas_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_observation_MsgEphemerisSbasDepA_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_observation_MsgEphemerisSbasDepB_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_observation_MsgGloBiases_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_observation_MsgGnssCapb_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_observation_MsgGroupDelay_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_observation_MsgGroupDelayDepA_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_observation_MsgGroupDelayDepB_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_observation_MsgIono_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_observation_MsgObs_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_observation_MsgObsDepB_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_observation_MsgObsDepC_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_observation_MsgOsr_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_observation_MsgSvAzEl_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_observation_MsgSvConfigurationGpsDep_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_observation_msgEphemerisDepB_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_observation_msgEphemerisQzss_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_observation_msgObsDepA_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_orientation_MsgAngularRate_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_orientation_MsgBaselineHeading_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_orientation_MsgOrientEuler_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_orientation_MsgOrientQuat_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgAlmanac_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgCellModemStatus_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgCommandOutput_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgCommandReq_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgCommandResp_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgCwResults_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgCwStart_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgDeviceMonitor_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgFrontEndGain_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgIarState_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgInitBaseDep_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgMaskSatellite_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_piksi_MsgMaskSatelliteDep_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_piksi_MsgNetworkBandwidthUsage_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgNetworkStateReq_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_piksi_MsgNetworkStateResp_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgReset_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgResetDep_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgResetFilters_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgSetTime_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgSpecan_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgSpecanDep_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgThreadState_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgUartState_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_piksi_MsgUartStateDepA_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_profiling_MsgMeasurementPoint_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_sbas_MsgSbasRaw_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_settings_MsgSettingsReadByIndexDone_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_settings_MsgSettingsReadByIndexReq_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_settings_MsgSettingsReadReq_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_settings_MsgSettingsReadResp_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_settings_MsgSettingsRegister_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_settings_MsgSettingsRegisterResp_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_settings_MsgSettingsSave_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_settings_MsgSettingsWrite_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_settings_MsgSettingsWriteResp_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_signing_MsgCertificateChain_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_signing_MsgCertificateChainDep_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_signing_MsgEcdsaCertificate_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_signing_MsgEcdsaSignature_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepA_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepB_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_signing_MsgEd25519CertificateDep_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_signing_MsgEd25519SignatureDepA_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_signing_MsgEd25519SignatureDepB_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_solution_meta_MsgSolnMeta_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_solution_meta_MsgSolnMetaDepA_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_ssr_MsgSsrCodeBiases_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_ssr_MsgSsrGridDefinitionDepA_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrection_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionNoStdDepA_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_ssr_MsgSsrOrbitClock_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBounds_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBoundsDegradation_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_ssr_MsgSsrOrbitClockDepA_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_ssr_MsgSsrPhaseBiases_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_ssr_MsgSsrSatelliteApc_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_ssr_MsgSsrSatelliteApcDepA_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_ssr_MsgSsrStecCorrection_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDep_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDepA_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_ssr_MsgSsrTileDefinition_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepA_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepB_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_system_MsgCsacTelemetry_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_system_MsgCsacTelemetryLabels_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_system_MsgDgnssStatus_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_system_MsgGnssTimeOffset_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_system_MsgGroupMeta_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_system_MsgHeartbeat_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_system_MsgInsStatus_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_system_MsgInsUpdates_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_system_MsgPpsTime_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_system_MsgSensorAidEvent_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_system_MsgStartup_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_system_MsgStatusJournal_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_system_MsgStatusReport_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_telemetry_MsgTelSv_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_tracking_MsgMeasurementState_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_tracking_MsgTrackingIq_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_tracking_MsgTrackingIqDepA_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_tracking_MsgTrackingIqDepB_suite()); - srunner_add_suite(sr, - legacy_auto_check_sbp_tracking_MsgTrackingState_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_tracking_MsgTrackingStateDepB_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDepA_suite()); - srunner_add_suite( - sr, legacy_auto_check_sbp_tracking_MsgtrackingStateDepA_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_user_MsgUserData_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_vehicle_MsgOdometry_suite()); - srunner_add_suite(sr, legacy_auto_check_sbp_vehicle_MsgWheeltick_suite()); + srunner_add_suite(sr, auto_check_sbp_acquisition_MsgAcqResult_suite()); + srunner_add_suite(sr, auto_check_sbp_acquisition_MsgAcqResultDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_acquisition_MsgAcqResultDepB_suite()); + srunner_add_suite(sr, auto_check_sbp_acquisition_MsgAcqResultDepC_suite()); + srunner_add_suite(sr, auto_check_sbp_acquisition_MsgAcqSvProfile_suite()); + srunner_add_suite(sr, auto_check_sbp_acquisition_MsgAcqSvProfileDep_suite()); + srunner_add_suite(sr, + auto_check_sbp_bootload_MsgBootloaderHandshakeReq_suite()); + srunner_add_suite(sr, + auto_check_sbp_bootload_MsgBootloaderHandshakeResp_suite()); + srunner_add_suite(sr, auto_check_sbp_bootload_MsgBootloaderJumptoApp_suite()); + srunner_add_suite(sr, auto_check_sbp_bootload_MsgNapDeviceDnaReq_suite()); + srunner_add_suite(sr, auto_check_sbp_bootload_MsgNapDeviceDnaResp_suite()); + srunner_add_suite(sr, auto_check_sbp_ext_events_MsgExtEvent_suite()); + srunner_add_suite(sr, auto_check_sbp_file_io_MsgFileioConfigReq_suite()); + srunner_add_suite(sr, auto_check_sbp_file_io_MsgFileioConfigResp_suite()); + srunner_add_suite(sr, auto_check_sbp_file_io_MsgFileioReadDirReq_suite()); + srunner_add_suite(sr, auto_check_sbp_file_io_MsgFileioReadDirResp_suite()); + srunner_add_suite(sr, auto_check_sbp_file_io_MsgFileioReadReq_suite()); + srunner_add_suite(sr, auto_check_sbp_file_io_MsgFileioReadResp_suite()); + srunner_add_suite(sr, auto_check_sbp_file_io_MsgFileioRemove_suite()); + srunner_add_suite(sr, auto_check_sbp_file_io_MsgFileioWriteResp_suite()); + srunner_add_suite(sr, auto_check_sbp_flash_MsgFlashDone_suite()); + srunner_add_suite(sr, auto_check_sbp_flash_MsgFlashErase_suite()); + srunner_add_suite(sr, auto_check_sbp_flash_MsgFlashProgram_suite()); + srunner_add_suite(sr, auto_check_sbp_flash_MsgFlashReadReq_suite()); + srunner_add_suite(sr, auto_check_sbp_flash_MsgFlashReadResp_suite()); + srunner_add_suite(sr, auto_check_sbp_flash_MsgM25FlashWriteStatus_suite()); + srunner_add_suite(sr, auto_check_sbp_flash_MsgStmFlashLockSector_suite()); + srunner_add_suite(sr, auto_check_sbp_flash_MsgStmFlashUnlockSector_suite()); + srunner_add_suite(sr, auto_check_sbp_flash_MsgStmUniqueIdReq_suite()); + srunner_add_suite(sr, auto_check_sbp_flash_MsgStmUniqueIdResp_suite()); + srunner_add_suite(sr, auto_check_sbp_imu_MsgImuAux_suite()); + srunner_add_suite(sr, auto_check_sbp_imu_MsgImuRaw_suite()); + srunner_add_suite(sr, auto_check_sbp_integrity_MsgAcknowledge_suite()); + srunner_add_suite(sr, auto_check_sbp_integrity_MsgSsrFlagHighLevel_suite()); + srunner_add_suite( + sr, auto_check_sbp_integrity_MsgSsrFlagIonoGridPointSatLos_suite()); + srunner_add_suite(sr, + auto_check_sbp_integrity_MsgSsrFlagIonoGridPoints_suite()); + srunner_add_suite(sr, + auto_check_sbp_integrity_MsgSsrFlagIonoTileSatLos_suite()); + srunner_add_suite(sr, auto_check_sbp_integrity_MsgSsrFlagSatellites_suite()); + srunner_add_suite(sr, + auto_check_sbp_integrity_MsgSsrFlagTropoGridPoints_suite()); + srunner_add_suite(sr, auto_check_sbp_linux_MsgLinuxCpuState_suite()); + srunner_add_suite(sr, auto_check_sbp_linux_MsgLinuxCpuStateDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_linux_MsgLinuxMemState_suite()); + srunner_add_suite(sr, auto_check_sbp_linux_MsgLinuxMemStateDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_linux_MsgLinuxProcessFdCount_suite()); + srunner_add_suite(sr, auto_check_sbp_linux_MsgLinuxProcessFdSummary_suite()); + srunner_add_suite(sr, + auto_check_sbp_linux_MsgLinuxProcessSocketCounts_suite()); + srunner_add_suite(sr, + auto_check_sbp_linux_MsgLinuxProcessSocketQueues_suite()); + srunner_add_suite(sr, auto_check_sbp_linux_MsgLinuxSocketUsage_suite()); + srunner_add_suite(sr, auto_check_sbp_linux_MsgLinuxSysState_suite()); + srunner_add_suite(sr, auto_check_sbp_linux_MsgLinuxSysStateDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_logging_MsgFwd_suite()); + srunner_add_suite(sr, auto_check_sbp_logging_MsgLog_suite()); + srunner_add_suite(sr, auto_check_sbp_logging_MsgPrintDep_suite()); + srunner_add_suite(sr, auto_check_sbp_mag_MsgMagRaw_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgAgeCorrections_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgBaselineECEF_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgBaselineECEFDepA_suite()); + srunner_add_suite(sr, + auto_check_sbp_navigation_MsgBaselineHeadingDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgBaselineNED_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgBaselineNEDDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgDops_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgDopsDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgGPSTime_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgGPSTimeDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgGPSTimeGNSS_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgPosECEF_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgPosECEFCov_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgPosECEFCovGNSS_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgPosECEFDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgPosECEFGNSS_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgPosLLH_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgPosLLHCov_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgPosLLHDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgPosLlhAcc_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgPosLlhCovGnss_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgPosLlhGnss_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgPoseRelative_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgProtectionLevel_suite()); + srunner_add_suite(sr, + auto_check_sbp_navigation_MsgProtectionLevelDepA_suite()); + srunner_add_suite(sr, + auto_check_sbp_navigation_MsgReferenceFrameParam_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgUTCLeapSecond_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgUTCTime_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgUTCTimeGNSS_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgVelBody_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgVelCog_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgVelECEF_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgVelECEFCov_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgVelECEFDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgVelEcefCovGnss_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgVelEcefGnss_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgVelNED_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgVelNEDCOV_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgVelNEDDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgVelNedCovGnss_suite()); + srunner_add_suite(sr, auto_check_sbp_navigation_MsgVelNedGnss_suite()); + srunner_add_suite(sr, auto_check_sbp_ndb_MsgNdbEvent_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgAlmanacGLO_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgAlmanacGLODep_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgAlmanacGPS_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgAlmanacGPSDep_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgBasePosEcef_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgBasePosLLH_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgEphemerisBds_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgEphemerisDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgEphemerisDepC_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgEphemerisDepD_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgEphemerisGLO_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgEphemerisGLODepA_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgEphemerisGLODepB_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgEphemerisGLODepC_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgEphemerisGLODepD_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgEphemerisGPS_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgEphemerisGPSDepE_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgEphemerisGPSDepF_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgEphemerisGal_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgEphemerisGalDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgEphemerisSbas_suite()); + srunner_add_suite(sr, + auto_check_sbp_observation_MsgEphemerisSbasDepA_suite()); + srunner_add_suite(sr, + auto_check_sbp_observation_MsgEphemerisSbasDepB_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgGloBiases_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgGnssCapb_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgGroupDelay_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgGroupDelayDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgGroupDelayDepB_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgIono_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgObs_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgObsDepB_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgObsDepC_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgOsr_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_MsgSvAzEl_suite()); + srunner_add_suite( + sr, auto_check_sbp_observation_MsgSvConfigurationGpsDep_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_msgEphemerisDepB_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_msgEphemerisQzss_suite()); + srunner_add_suite(sr, auto_check_sbp_observation_msgObsDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_orientation_MsgAngularRate_suite()); + srunner_add_suite(sr, auto_check_sbp_orientation_MsgBaselineHeading_suite()); + srunner_add_suite(sr, auto_check_sbp_orientation_MsgOrientEuler_suite()); + srunner_add_suite(sr, auto_check_sbp_orientation_MsgOrientQuat_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgAlmanac_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgCellModemStatus_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgCommandOutput_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgCommandReq_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgCommandResp_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgCwResults_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgCwStart_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgDeviceMonitor_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgFrontEndGain_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgIarState_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgInitBaseDep_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgMaskSatellite_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgMaskSatelliteDep_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgNetworkBandwidthUsage_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgNetworkStateReq_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgNetworkStateResp_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgReset_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgResetDep_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgResetFilters_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgSetTime_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgSpecan_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgSpecanDep_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgThreadState_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgUartState_suite()); + srunner_add_suite(sr, auto_check_sbp_piksi_MsgUartStateDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_profiling_MsgMeasurementPoint_suite()); + srunner_add_suite(sr, auto_check_sbp_sbas_MsgSbasRaw_suite()); + srunner_add_suite(sr, + auto_check_sbp_settings_MsgSettingsReadByIndexDone_suite()); + srunner_add_suite(sr, + auto_check_sbp_settings_MsgSettingsReadByIndexReq_suite()); + srunner_add_suite(sr, + auto_check_sbp_settings_MsgSettingsReadByIndexResp_suite()); + srunner_add_suite(sr, auto_check_sbp_settings_MsgSettingsReadReq_suite()); + srunner_add_suite(sr, auto_check_sbp_settings_MsgSettingsReadResp_suite()); + srunner_add_suite(sr, auto_check_sbp_settings_MsgSettingsRegister_suite()); + srunner_add_suite(sr, + auto_check_sbp_settings_MsgSettingsRegisterResp_suite()); + srunner_add_suite(sr, auto_check_sbp_settings_MsgSettingsSave_suite()); + srunner_add_suite(sr, auto_check_sbp_settings_MsgSettingsWrite_suite()); + srunner_add_suite(sr, auto_check_sbp_settings_MsgSettingsWriteResp_suite()); + srunner_add_suite(sr, auto_check_sbp_signing_MsgCertificateChain_suite()); + srunner_add_suite(sr, auto_check_sbp_signing_MsgCertificateChainDep_suite()); + srunner_add_suite(sr, auto_check_sbp_signing_MsgEcdsaCertificate_suite()); + srunner_add_suite(sr, auto_check_sbp_signing_MsgEcdsaSignature_suite()); + srunner_add_suite(sr, auto_check_sbp_signing_MsgEcdsaSignatureDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_signing_MsgEcdsaSignatureDepB_suite()); + srunner_add_suite(sr, + auto_check_sbp_signing_MsgEd25519CertificateDep_suite()); + srunner_add_suite(sr, auto_check_sbp_signing_MsgEd25519SignatureDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_signing_MsgEd25519SignatureDepB_suite()); + srunner_add_suite(sr, auto_check_sbp_solution_meta_MsgSolnMeta_suite()); + srunner_add_suite(sr, auto_check_sbp_solution_meta_MsgSolnMetaDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_ssr_MsgSsrCodeBiases_suite()); + srunner_add_suite(sr, auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds_suite()); + srunner_add_suite(sr, auto_check_sbp_ssr_MsgSsrGridDefinitionDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_ssr_MsgSsrGriddedCorrection_suite()); + srunner_add_suite(sr, + auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds_suite()); + srunner_add_suite(sr, auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA_suite()); + srunner_add_suite( + sr, auto_check_sbp_ssr_MsgSsrGriddedCorrectionNoStdDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_ssr_MsgSsrOrbitClock_suite()); + srunner_add_suite(sr, auto_check_sbp_ssr_MsgSsrOrbitClockBounds_suite()); + srunner_add_suite( + sr, auto_check_sbp_ssr_MsgSsrOrbitClockBoundsDegradation_suite()); + srunner_add_suite(sr, auto_check_sbp_ssr_MsgSsrOrbitClockDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_ssr_MsgSsrPhaseBiases_suite()); + srunner_add_suite(sr, auto_check_sbp_ssr_MsgSsrSatelliteApc_suite()); + srunner_add_suite(sr, auto_check_sbp_ssr_MsgSsrSatelliteApcDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_ssr_MsgSsrStecCorrection_suite()); + srunner_add_suite(sr, auto_check_sbp_ssr_MsgSsrStecCorrectionDep_suite()); + srunner_add_suite(sr, auto_check_sbp_ssr_MsgSsrStecCorrectionDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_ssr_MsgSsrTileDefinition_suite()); + srunner_add_suite(sr, auto_check_sbp_ssr_MsgSsrTileDefinitionDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_ssr_MsgSsrTileDefinitionDepB_suite()); + srunner_add_suite(sr, auto_check_sbp_system_MsgCsacTelemetry_suite()); + srunner_add_suite(sr, auto_check_sbp_system_MsgCsacTelemetryLabels_suite()); + srunner_add_suite(sr, auto_check_sbp_system_MsgDgnssStatus_suite()); + srunner_add_suite(sr, auto_check_sbp_system_MsgGnssTimeOffset_suite()); + srunner_add_suite(sr, auto_check_sbp_system_MsgGroupMeta_suite()); + srunner_add_suite(sr, auto_check_sbp_system_MsgHeartbeat_suite()); + srunner_add_suite(sr, auto_check_sbp_system_MsgInsStatus_suite()); + srunner_add_suite(sr, auto_check_sbp_system_MsgInsUpdates_suite()); + srunner_add_suite(sr, auto_check_sbp_system_MsgPpsTime_suite()); + srunner_add_suite(sr, auto_check_sbp_system_MsgSensorAidEvent_suite()); + srunner_add_suite(sr, auto_check_sbp_system_MsgStartup_suite()); + srunner_add_suite(sr, auto_check_sbp_system_MsgStatusJournal_suite()); + srunner_add_suite(sr, auto_check_sbp_system_MsgStatusReport_suite()); + srunner_add_suite(sr, auto_check_sbp_telemetry_MsgTelSv_suite()); + srunner_add_suite(sr, auto_check_sbp_tracking_MsgMeasurementState_suite()); + srunner_add_suite(sr, auto_check_sbp_tracking_MsgTrackingIq_suite()); + srunner_add_suite(sr, auto_check_sbp_tracking_MsgTrackingIqDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_tracking_MsgTrackingIqDepB_suite()); + srunner_add_suite(sr, auto_check_sbp_tracking_MsgTrackingState_suite()); + srunner_add_suite(sr, auto_check_sbp_tracking_MsgTrackingStateDepB_suite()); + srunner_add_suite( + sr, auto_check_sbp_tracking_MsgTrackingStateDetailedDep_suite()); + srunner_add_suite( + sr, auto_check_sbp_tracking_MsgTrackingStateDetailedDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_tracking_MsgtrackingStateDepA_suite()); + srunner_add_suite(sr, auto_check_sbp_user_MsgUserData_suite()); + srunner_add_suite(sr, auto_check_sbp_vehicle_MsgOdometry_suite()); + srunner_add_suite(sr, auto_check_sbp_vehicle_MsgWheeltick_suite()); srunner_set_fork_status(sr, CK_NOFORK); srunner_run_all(sr, CK_NORMAL); diff --git a/c/test/check_sbp.c b/c/test/check_sbp.c index 96cf708daa..92c4c76295 100644 --- a/c/test/check_sbp.c +++ b/c/test/check_sbp.c @@ -14,15 +14,6 @@ #include #include -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include - int DUMMY_MEMORY_FOR_CALLBACKS = (int)0xdeadbeef; int DUMMY_MEMORY_FOR_IO = (int)0xdead0000; @@ -80,99 +71,49 @@ void printy_callback(u16 sender_id, u8 len, u8 msg[], void* context) { u32 n_callbacks_logged; u16 last_sender_id; u8 last_len; -u8 last_msg[256]; +sbp_msg_type_t last_msg_type; +sbp_msg_t last_msg; void* last_context; -u32 n_frame_callbacks_logged; -u16 last_frame_sender_id; -u16 last_frame_msg_type; -u8 last_frame_payload_len; -u16 last_frame_len; -u8 last_frame[256 + 8]; -void* last_frame_context; - void logging_reset(void) { n_callbacks_logged = 0; - n_frame_callbacks_logged = 0; last_context = 0; last_sender_id = 0; last_len = 0; - last_frame_context = 0; - last_frame_sender_id = 0; - last_frame_len = 0; - last_frame_sender_id = 0; - last_frame_msg_type = 0; - memset(last_msg, 0, sizeof(last_msg)); - memset(last_frame, 0, sizeof(last_frame)); + last_msg_type = 0; + memset(&last_msg, 0, sizeof(last_msg)); } -void logging_callback(u16 sender_id, u8 len, u8 msg[], void* context) { +void logging_callback(u16 sender_id, sbp_msg_type_t msg_type, + const sbp_msg_t* msg, void* context) { n_callbacks_logged++; last_sender_id = sender_id; - last_len = len; last_context = context; - memcpy(last_msg, msg, len); - - /*printy_callback(sender_id, len, msg);*/ -} - -void frame_logging_callback(u16 sender_id, u16 msg_type, u8 payload_len, - u8 payload[], u16 frame_len, u8 frame[], - void* context) { - (void)payload; - n_frame_callbacks_logged++; - last_frame_sender_id = sender_id; - last_frame_msg_type = msg_type; - last_frame_payload_len = payload_len; - last_frame_context = context; - last_frame_len = frame_len; - memcpy(last_frame, frame, frame_len); + last_msg_type = msg_type; + memcpy(&last_msg, msg, sizeof(*msg)); /*printy_callback(sender_id, len, msg);*/ } -void test_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - /* Do nothing. */ - (void)sender_id; - (void)len; - (void)msg; - (void)context; -} -void test_callback2(u16 sender_id, u8 len, u8 msg[], void* context) { - /* Do nothing. */ - (void)sender_id; - (void)len; - (void)msg; - (void)context; -} - -void test_frame_callback(u16 sender_id, u16 msg_type, u8 payload_len, - u8 payload[], u16 frame_len, u8 frame[], - void* context) { +void test_callback(u16 sender_id, sbp_msg_type_t msg_type, const sbp_msg_t* msg, + void* context) { /* Do nothing. */ (void)sender_id; (void)msg_type; - (void)payload_len; - (void)payload; - (void)frame_len; - (void)frame; + (void)msg; (void)context; } - -void test_frame_callback2(u16 sender_id, u16 msg_type, u8 payload_len, - u8 payload[], u16 frame_len, u8 frame[], - void* context) { +void test_callback2(u16 sender_id, sbp_msg_type_t msg_type, + const sbp_msg_t* msg, void* context) { /* Do nothing. */ (void)sender_id; (void)msg_type; - (void)payload_len; - (void)payload; - (void)frame_len; - (void)frame; + (void)msg; (void)context; } -sbp_msg_callbacks_node_t* sbp_find_callback(sbp_state_t* s, u16 msg_type) { +sbp_msg_callbacks_node_t* sbp_find_callback(sbp_state_t* s, + sbp_msg_type_t msg_type) { /* If our list is empty, return NULL. */ if (!s->sbp_msg_callbacks_head) return 0; @@ -200,14 +141,16 @@ START_TEST(test_sbp_process) { static sbp_msg_callbacks_node_t n; static sbp_msg_callbacks_node_t n2; - sbp_payload_callback_register(&s, 0x2269, &logging_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); + sbp_callback_register(&s, SbpMsgLog, &logging_callback, + &DUMMY_MEMORY_FOR_CALLBACKS, &n); - u8 test_data[] = {0x01, 0x02, 0x03, 0x04}; + sbp_msg_t test_msg; + memset(&test_msg, 0, sizeof(test_msg)); + test_msg.log.level = 3; + sbp_msg_log_text_printf(&test_msg.log, false, NULL, "Hello, World!"); dummy_reset(); - sbp_payload_send(&s, 0x2269, 0x42, sizeof(test_data), test_data, - &dummy_write); + sbp_message_send(&s, SbpMsgLog, 0x42, &test_msg, &dummy_write); while (dummy_rd < dummy_wr) { ck_assert_msg(sbp_process(&s, &dummy_read) >= SBP_OK, @@ -217,22 +160,24 @@ START_TEST(test_sbp_process) { ck_assert_msg(n_callbacks_logged == 1, "one callback should have been logged"); ck_assert_msg(last_sender_id == 0x42, "sender_id decoded incorrectly"); - ck_assert_msg(last_len == sizeof(test_data), "len decoded incorrectly"); - ck_assert_msg(memcmp(last_msg, test_data, sizeof(test_data)) == 0, + ck_assert_msg(last_msg_type == SbpMsgLog, "len decoded incorrectly"); + ck_assert_msg(sbp_message_cmp(SbpMsgLog, &last_msg, &test_msg) == 0, "test data decoded incorrectly"); ck_assert_msg(last_context == &DUMMY_MEMORY_FOR_CALLBACKS, "context pointer incorrectly passed"); - sbp_payload_callback_register(&s, 0x2270, &logging_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - ck_assert_msg(sbp_find_callback(&s, 0x2270) != 0, + sbp_callback_register(&s, SbpMsgUserData, &logging_callback, + &DUMMY_MEMORY_FOR_CALLBACKS, &n2); + ck_assert_msg(sbp_find_callback(&s, SbpMsgUserData) != 0, "second callback not found"); sbp_remove_callback(&s, &n2); - ck_assert_msg(sbp_find_callback(&s, 0x2270) == 0, "callback not removed"); + ck_assert_msg(sbp_find_callback(&s, SbpMsgUserData) == 0, + "callback not removed"); logging_reset(); - sbp_payload_send(&s, 0x2269, 0x4243, 0, 0, &dummy_write); + + sbp_message_send(&s, SbpMsgLog, 0x4243, &test_msg, &dummy_write); ck_assert_msg(last_io_context == &DUMMY_MEMORY_FOR_IO, "io context pointer incorrectly passed"); @@ -250,10 +195,18 @@ START_TEST(test_sbp_process) { ck_assert_msg(n_callbacks_logged == 1, "one callback should have been logged (2)"); ck_assert_msg(last_sender_id == 0x4243, "sender_id decoded incorrectly (2)"); - ck_assert_msg(last_len == 0, "len decoded incorrectly (2)"); + ck_assert_msg(last_msg_type == SbpMsgLog, "len decoded incorrectly (2)"); logging_reset(); - sbp_payload_send(&s, 0x22, 0x4243, 0, 0, &dummy_write); + sbp_clear_callbacks(&s); + + sbp_msg_t test_msg2; + memset(&test_msg2, 0, sizeof(test_msg2)); + + test_msg2.fwd.source = 1; + test_msg2.fwd.protocol = 2; + test_msg2.fwd.n_fwd_payload = 0; + sbp_message_send(&s, SbpMsgFwd, 0x4243, &test_msg2, &dummy_write); s8 ret = 0; while (dummy_rd < dummy_wr) { @@ -267,16 +220,23 @@ START_TEST(test_sbp_process) { ck_assert_msg(n_callbacks_logged == 0, "no callbacks should have been logged"); - u8 awesome_message[] = {0x55, 0x33, 0x22, 0x77, 0x66, - 0x02, 0x22, 0x33, 0x8A, 0x33}; + u8 awesome_message[] = { + 0x55, 0x01, 0x04, 0x25, 0x09, 0x08, 0x03, 0x61, + 0x77, 0x65, 0x73, 0x6F, 0x6D, 0x65, 0xEC, 0x3C, + }; logging_reset(); dummy_reset(); dummy_rd = 0; dummy_wr = sizeof(awesome_message); memcpy(dummy_buff, awesome_message, sizeof(awesome_message)); + sbp_msg_t decoded_awesome_message; + memset(&decoded_awesome_message, 0, sizeof(decoded_awesome_message)); + decoded_awesome_message.log.level = 3; + sbp_msg_log_text_printf(&decoded_awesome_message.log, false, NULL, "awesome"); + static sbp_msg_callbacks_node_t m; - sbp_payload_callback_register(&s, 0x2233, &logging_callback, 0, &m); + sbp_callback_register(&s, SbpMsgLog, &logging_callback, 0, &m); while (dummy_rd < dummy_wr) { ck_assert_msg(sbp_process(&s, &dummy_read) >= SBP_OK, @@ -285,12 +245,13 @@ START_TEST(test_sbp_process) { ck_assert_msg(n_callbacks_logged == 1, "one callback should have been logged (3)"); - ck_assert_msg(last_sender_id == 0x6677, "sender_id decoded incorrectly (3)"); - ck_assert_msg(last_len == 2, "len decoded incorrectly (3)"); - ck_assert_msg(memcmp(last_msg, &awesome_message[6], 2) == 0, - "test data decoded incorrectly (3)"); + ck_assert_msg(last_sender_id == 2341, "sender_id decoded incorrectly (3)"); + ck_assert_msg(last_msg_type == SbpMsgLog, "len decoded incorrectly (3)"); + ck_assert_msg( + sbp_message_cmp(SbpMsgLog, &last_msg, &decoded_awesome_message) == 0, + "test data decoded incorrectly (3)"); - awesome_message[4] = 0xAA; + awesome_message[15] = 0xAA; logging_reset(); dummy_reset(); dummy_rd = 0; @@ -311,8 +272,10 @@ START_TEST(test_sbp_process) { /* Test sbp_process with a one-byte-at-a-time read process */ - u8 awesome_message2[] = {0x55, 0x33, 0x22, 0x77, 0x66, - 0x02, 0x22, 0x33, 0x8A, 0x33}; + u8 awesome_message2[] = { + 0x55, 0x01, 0x04, 0x25, 0x09, 0x08, 0x03, 0x61, + 0x77, 0x65, 0x73, 0x6F, 0x6D, 0x65, 0xEC, 0x3C, + }; logging_reset(); dummy_reset(); sbp_clear_callbacks(&s); @@ -321,7 +284,7 @@ START_TEST(test_sbp_process) { memcpy(dummy_buff, awesome_message2, sizeof(awesome_message2)); static sbp_msg_callbacks_node_t p; - sbp_payload_callback_register(&s, 0x2233, &logging_callback, 0, &p); + sbp_callback_register(&s, SbpMsgLog, &logging_callback, 0, &p); while (dummy_rd < dummy_wr) { ck_assert_msg(sbp_process(&s, &dummy_read_single_byte) >= SBP_OK, @@ -330,15 +293,18 @@ START_TEST(test_sbp_process) { ck_assert_msg(n_callbacks_logged == 1, "one callback should have been logged (3)"); - ck_assert_msg(last_sender_id == 0x6677, "sender_id decoded incorrectly (3)"); - ck_assert_msg(last_len == 2, "len decoded incorrectly (3)"); - ck_assert_msg(memcmp(last_msg, &awesome_message2[6], 2) == 0, - "test data decoded incorrectly (3)"); + ck_assert_msg(last_sender_id == 2341, "sender_id decoded incorrectly (3)"); + ck_assert_msg(last_msg_type == SbpMsgLog, "len decoded incorrectly (3)"); + ck_assert_msg( + sbp_message_cmp(SbpMsgLog, &decoded_awesome_message, &last_msg) == 0, + "test data decoded incorrectly (3)"); /* Test sbp_process with a one-byte-at-a-time read that starts with garbage */ - u8 crappy_then_awesome_message[] = {0x99, 0x88, 0x77, 0x66, 0x55, 0x33, 0x22, - 0x77, 0x66, 0x02, 0x22, 0x33, 0x8A, 0x33}; + u8 crappy_then_awesome_message[] = { + 0x99, 0x88, 0x77, 0x66, 0x55, 0x01, 0x04, 0x25, 0x09, 0x08, + 0x03, 0x61, 0x77, 0x65, 0x73, 0x6F, 0x6D, 0x65, 0xEC, 0x3C, + }; logging_reset(); dummy_reset(); sbp_clear_callbacks(&s); @@ -348,7 +314,7 @@ START_TEST(test_sbp_process) { sizeof(crappy_then_awesome_message)); static sbp_msg_callbacks_node_t q; - sbp_payload_callback_register(&s, 0x2233, &logging_callback, 0, &q); + sbp_callback_register(&s, SbpMsgLog, &logging_callback, 0, &q); while (dummy_rd < dummy_wr) { ck_assert_msg(sbp_process(&s, &dummy_read_single_byte) >= SBP_OK, @@ -357,150 +323,11 @@ START_TEST(test_sbp_process) { ck_assert_msg(n_callbacks_logged == 1, "one callback should have been logged (3)"); - ck_assert_msg(last_sender_id == 0x6677, "sender_id decoded incorrectly (3)"); - ck_assert_msg(last_len == 2, "len decoded incorrectly (3)"); - ck_assert_msg(memcmp(last_msg, &crappy_then_awesome_message[10], 2) == 0, - "test data decoded incorrectly (3)"); -} -END_TEST - -START_TEST(test_sbp_frame) { - /* TODO: Tests with different read function behaviour. */ - - sbp_state_t s; - sbp_state_init(&s); - sbp_state_set_io_context(&s, &DUMMY_MEMORY_FOR_IO); - - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - sbp_register_frame_callback(&s, 0x2269, &frame_logging_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - - u8 test_data[] = {0x01, 0x02, 0x03, 0x04}; - u8 test_frame[] = {0x55, 0x69, 0x22, 0x42, 0x00, 0x04, - 0x01, 0x02, 0x03, 0x04, 0x3D, 0xF7}; - - dummy_reset(); - sbp_payload_send(&s, 0x2269, 0x42, sizeof(test_data), test_data, - &dummy_write); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&s, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(n_frame_callbacks_logged == 1, - "one frame callback should have been logged"); - ck_assert_msg(last_frame_sender_id == 0x42, "sender_id decoded incorrectly"); - ck_assert_msg(last_frame_payload_len == sizeof(test_data), - "len decoded incorrectly"); - ck_assert_msg(last_frame_len == sizeof(test_data) + 8, - "frame len decoded incorrectly"); - ck_assert_msg(last_frame_msg_type == 0x2269, "msg_type decoded incorrectly"); - char test[1024]; - char* ptr = test; - for (int i = 0; i < last_frame_len; i++) { - ptr += sprintf(ptr, "%02X", last_frame[i]); - } - ck_assert_msg(memcmp(last_frame, test_frame, sizeof(test_frame) - 1) == 0, - "decoded incorrectly %s", test); - ck_assert_msg(last_frame_context == &DUMMY_MEMORY_FOR_CALLBACKS, - "context pointer incorrectly passed"); - - sbp_register_frame_callback(&s, 0x2270, &frame_logging_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - ck_assert_msg(sbp_find_callback(&s, 0x2270) != 0, - "second callback not found"); - - sbp_remove_callback(&s, &n2); - ck_assert_msg(sbp_find_callback(&s, 0x2270) == 0, "callback not removed"); - - /* Test sbp_process with both a frame callback and a not frame callback */ - - static sbp_msg_callbacks_node_t n3; - static sbp_msg_callbacks_node_t n4; - - logging_reset(); - dummy_reset(); - sbp_clear_callbacks(&s); - - sbp_payload_callback_register(&s, 0x2269, &logging_callback, 0, &n3); - sbp_register_frame_callback(&s, 0x2269, &frame_logging_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n4); - sbp_payload_send(&s, 0x2269, 0x42, sizeof(test_data), test_data, - &dummy_write); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&s, &dummy_read_single_byte) >= SBP_OK, - "sbp_process threw an error! (3)"); - } - - ck_assert_msg(n_callbacks_logged == 1, - "one regular callback should have been logged (3)"); - ck_assert_msg(n_frame_callbacks_logged == 1, - "one frame callback should have been logged (3)"); - - /* now remove frame callback and make sure that the regular callback is still - * there */ - sbp_remove_callback(&s, &n4); - dummy_reset(); - sbp_payload_send(&s, 0x2269, 0x42, sizeof(test_data), test_data, - &dummy_write); - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&s, &dummy_read_single_byte) >= SBP_OK, - "sbp_process threw an error! (3)"); - } - - ck_assert_msg(n_callbacks_logged == 2, - "two regular callback should have been logged (3)"); - - /* now test that no frame callback with bad msg and direct writing to buffer - */ - u8 awesome_message[] = {0x55, 0x33, 0x22, 0x77, 0x66, - 0x02, 0x22, 0x33, 0x8A, 0x33}; - logging_reset(); - dummy_reset(); - dummy_rd = 0; - dummy_wr = sizeof(awesome_message); - memcpy(dummy_buff, awesome_message, sizeof(awesome_message)); - - static sbp_msg_callbacks_node_t m; - sbp_register_frame_callback(&s, 0x2233, &frame_logging_callback, 0, &m); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&s, &dummy_read) >= SBP_OK, - "sbp_process threw an error! (3)"); - } - - ck_assert_msg(n_frame_callbacks_logged == 1, - "one callback should have been logged (3)"); - ck_assert_msg(last_frame_sender_id == 0x6677, - "sender_id decoded incorrectly (3)"); - ck_assert_msg(last_frame_payload_len == 2, "len decoded incorrectly (3)"); + ck_assert_msg(last_sender_id == 2341, "sender_id decoded incorrectly (3)"); + ck_assert_msg(last_msg_type == SbpMsgLog, "len decoded incorrectly (3)"); ck_assert_msg( - memcmp(last_frame, awesome_message, sizeof(awesome_message)) == 0, - "test data decoded incorrectly (3) %x", - last_frame[sizeof(awesome_message) - 1]); - - awesome_message[4] = 0xAA; - logging_reset(); - dummy_reset(); - dummy_rd = 0; - dummy_wr = sizeof(awesome_message); - memcpy(dummy_buff, awesome_message, sizeof(awesome_message)); - - s8 ret = 0; - while (dummy_rd < dummy_wr) { - ret |= sbp_process(&s, &dummy_read); - } - - ck_assert_msg(ret == SBP_CRC_ERROR, - "sbp_process should have returned SBP_CRC_ERROR " - "for malformed message"); - - ck_assert_msg(n_frame_callbacks_logged == 0, - "no frame callbacks should have been logged (2)"); + sbp_message_cmp(SbpMsgLog, &last_msg, &decoded_awesome_message) == 0, + "test data decoded incorrectly (3)"); } END_TEST @@ -513,29 +340,39 @@ START_TEST(test_sbp_all_payload) { static sbp_msg_callbacks_node_t n; - sbp_all_payload_callback_register(&s, &frame_logging_callback, + sbp_all_message_callback_register(&s, &logging_callback, &DUMMY_MEMORY_FOR_CALLBACKS, &n); - u8 msg_1[] = {0x01, 0x02, 0x03, 0x04}; - u8 msg_2[] = {0x05, 0x06, 0x07}; + sbp_msg_t msg_1; + memset(&msg_1, 0, sizeof(msg_1)); + msg_1.log.level = 3; + sbp_msg_log_text_printf(&msg_1.log, false, NULL, "Hello, World"); + + sbp_msg_t msg_2; + memset(&msg_2, 0, sizeof(msg_2)); + msg_2.user_data.n_contents = 5; + msg_2.user_data.contents[0] = 0x99; + msg_2.user_data.contents[1] = 0x88; + msg_2.user_data.contents[2] = 0x77; + msg_2.user_data.contents[3] = 0x66; + msg_2.user_data.contents[4] = 0x55; dummy_reset(); logging_reset(); - sbp_payload_send(&s, 0x2269, 0x42, sizeof(msg_1), msg_1, &dummy_write); - sbp_payload_send(&s, 0x2270, 0x43, sizeof(msg_2), msg_2, &dummy_write); + sbp_message_send(&s, SbpMsgLog, 0x42, &msg_1, &dummy_write); + sbp_message_send(&s, SbpMsgUserData, 0x43, &msg_2, &dummy_write); while (dummy_rd < dummy_wr) { ck_assert_msg(sbp_process(&s, &dummy_read) >= SBP_OK, "sbp_process threw an error!"); } - ck_assert_msg(n_frame_callbacks_logged == 2, + ck_assert_msg(n_callbacks_logged == 2, "two frame callback should have been logged, %u were", - n_frame_callbacks_logged); - ck_assert_msg(last_frame_sender_id == 0x43, "sender_id decoded incorrectly"); - ck_assert_msg(last_frame_payload_len == sizeof(msg_2), - "len decoded incorrectly"); - ck_assert_msg(last_frame_len == sizeof(msg_2) + 8, + n_callbacks_logged); + ck_assert_msg(last_sender_id == 0x43, "sender_id decoded incorrectly"); + ck_assert_msg(last_msg_type == SbpMsgUserData, "len decoded incorrectly"); + ck_assert_msg(sbp_message_cmp(SbpMsgUserData, &msg_2, &last_msg) == 0, "frame len decoded incorrectly"); } END_TEST @@ -547,22 +384,21 @@ START_TEST(test_sbp_big_msg) { sbp_state_init(&s); sbp_state_set_io_context(&s, &DUMMY_MEMORY_FOR_IO); - static sbp_msg_callbacks_node_t n; static sbp_msg_callbacks_node_t n2; - sbp_register_frame_callback(&s, 0x2269, &frame_logging_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_payload_callback_register(&s, 0x2269, &logging_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); + sbp_callback_register(&s, SbpMsgUserData, &logging_callback, + &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - u8 big_msg[SBP_MAX_PAYLOAD_LEN]; - for (int i = 0; i < (int)sizeof(big_msg); i++) { - big_msg[i] = (u8)i; + sbp_msg_t big_msg; + memset(&big_msg, 0, sizeof(big_msg)); + big_msg.user_data.n_contents = SBP_MSG_USER_DATA_CONTENTS_MAX; + for (u8 i = 0; i < SBP_MSG_USER_DATA_CONTENTS_MAX; i++) { + big_msg.user_data.contents[i] = i; } dummy_reset(); logging_reset(); - sbp_payload_send(&s, 0x2269, 0x42, sizeof(big_msg), big_msg, &dummy_write); + sbp_message_send(&s, SbpMsgUserData, 0x42, &big_msg, &dummy_write); s8 ret = SBP_OK; while (dummy_rd < dummy_wr) { @@ -571,65 +407,13 @@ START_TEST(test_sbp_big_msg) { ret); } - ck_assert_msg(n_frame_callbacks_logged == 1, - "one frame callback should have been logged, %u were", - n_frame_callbacks_logged); ck_assert_msg(n_callbacks_logged == 1, - "one callbackx should have been logged, %u were", - n_frame_callbacks_logged); - ck_assert_msg(last_frame_sender_id == 0x42, "sender_id decoded incorrectly"); - ck_assert_msg(last_frame_payload_len == sizeof(big_msg), - "len decoded incorrectly"); - ck_assert_msg(last_frame_len == SBP_MAX_FRAME_LEN, + "one frame callback should have been logged, %u were", + n_callbacks_logged); + ck_assert_msg(last_sender_id == 0x42, "sender_id decoded incorrectly"); + ck_assert_msg(last_msg_type == SbpMsgUserData, "len decoded incorrectly"); + ck_assert_msg(sbp_message_cmp(SbpMsgUserData, &last_msg, &big_msg) == 0, "frame len decoded incorrectly"); - ck_assert_msg( - memcmp(SBP_FRAME_MSG_PAYLOAD(last_frame), big_msg, sizeof(big_msg)) == 0, - "frame data decoded incorrectly (3)"); - /* check that CRC wasn't chopped off */ - ck_assert_msg((last_frame[262] == 0x35 && last_frame[261] == 0xA6), - "CRC was incorrect. Should be 0x%x%x and was 0x%x%x", 0x35, - 0xA6, last_frame[262], last_frame[261]); -} -END_TEST - -START_TEST(test_sbp_payload_send) { - /* TODO: Tests with different write function behaviour. */ - - sbp_state_t s; - sbp_state_init(&s); - - u8 smsg[] = {0x22, 0x33}; - - ck_assert_msg( - sbp_payload_send(&s, 0x2233, 0x4455, 0, smsg, 0) == SBP_NULL_ERROR, - "sbp_payload_send should return an error if write is NULL"); - - dummy_reset(); - ck_assert_msg(sbp_payload_send(&s, 0x2233, 0x4455, 1, 0, &dummy_write) == - SBP_NULL_ERROR, - "sbp_payload_send should return an error if payload is NULL " - "and len != 0"); - - dummy_reset(); - ck_assert_msg( - sbp_payload_send(&s, 0x2233, 0x4455, 0, 0, &dummy_write) == SBP_OK, - "sbp_payload_send should return OK if payload is NULL and len == 0"); - - u8 zero_len_message[] = {0x55, 0x33, 0x22, 0x55, 0x44, 0x00, 0x2C, 0x4C}; - - ck_assert_msg( - memcmp(dummy_buff, zero_len_message, sizeof(zero_len_message)) == 0, - "sbp_payload_send encode error for len = 0"); - - dummy_reset(); - sbp_payload_send(&s, 0x2233, 0x6677, sizeof(smsg), smsg, &dummy_write); - - u8 awesome_message[] = {0x55, 0x33, 0x22, 0x77, 0x66, - 0x02, 0x22, 0x33, 0x8A, 0x33}; - - ck_assert_msg( - memcmp(dummy_buff, awesome_message, sizeof(awesome_message)) == 0, - "sbp_payload_send encode error for test message"); } END_TEST @@ -641,110 +425,12 @@ START_TEST(test_callbacks) { sbp_clear_callbacks(&s); ck_assert_msg( - sbp_find_callback(&s, 0x1234) == 0, - "sbp_find_callback should return NULL if no callbacks registered"); - - ck_assert_msg( - sbp_payload_callback_register(&s, 0x2233, &test_callback, 0, 0) == - SBP_NULL_ERROR, - "sbp_payload_callback_register should return an error if node is NULL"); - - /* Add a first callback. */ - - static sbp_msg_callbacks_node_t n; - - int NUMBER = 42; - - ck_assert_msg( - sbp_payload_callback_register(&s, 0x2233, 0, 0, &n) == SBP_NULL_ERROR, - "sbp_payload_callback_register should return an error if cb is NULL"); - - ck_assert_msg(sbp_payload_callback_register(&s, 0x2233, &test_callback, - &NUMBER, &n) == SBP_OK, - "sbp_payload_callback_register should return success if " - "everything is groovy"); - - ck_assert_msg(sbp_payload_callback_register(&s, 0x2233, &test_callback, 0, - &n) == SBP_CALLBACK_ERROR, - "sbp_payload_callback_register should return " - "SBP_CALLBACK_ERROR if a callback " - "of the same type is already registered"); - - ck_assert_msg( - sbp_find_callback(&s, 0x1234) == 0, - "sbp_find_callback should return NULL if callback not registered"); - - ck_assert_msg( - sbp_find_callback(&s, 0x2233) == &n, - "sbp_find_callback didn't return the correct callback node pointer"); - - ck_assert_msg(sbp_find_callback(&s, 0x2233)->context == &NUMBER, - "sbp_find_callback didn't return the correct context pointer"); - - /* Add a second callback. */ - - static sbp_msg_callbacks_node_t m; - - int NUMBER2 = 84; - - ck_assert_msg(sbp_payload_callback_register(&s, 0x1234, &test_callback2, - &NUMBER2, &m) == SBP_OK, - "sbp_payload_callback_register should return success if " - "everything is groovy (2)"); - - ck_assert_msg(sbp_find_callback(&s, 0x2233) == &n, - "sbp_find_callback didn't return the correct callback function " - "pointer (2)"); - - ck_assert_msg(sbp_find_callback(&s, 0x2233)->context == &NUMBER, - "sbp_find_callback didn't return the correct context pointer"); - - ck_assert_msg(sbp_find_callback(&s, 0x1234) == &m, - "sbp_find_callback didn't return the correct callback function " - "pointer (3)"); - - ck_assert_msg(sbp_find_callback(&s, 0x1234)->context == &NUMBER2, - "sbp_find_callback didn't return the correct context pointer"); - - ck_assert_msg(sbp_payload_callback_register(&s, 0x1234, &test_callback, 0, - &n) == SBP_CALLBACK_ERROR, - "sbp_payload_callback_register should return " - "SBP_CALLBACK_ERROR if a callback " - "of the same type is already registered (2)"); - - ck_assert_msg( - sbp_find_callback(&s, 0x7788) == 0, - "sbp_find_callback should return NULL if callback not registered (2)"); - - /* Clear all the registered callbacks and check they can no longer be found. - */ - sbp_clear_callbacks(&s); - - ck_assert_msg( - sbp_find_callback(&s, 0x1234) == 0, - "sbp_find_callback should return NULL if no callbacks registered (2)"); - - ck_assert_msg( - sbp_find_callback(&s, 0x2233) == 0, - "sbp_find_callback should return NULL if no callbacks registered (3)"); -} -END_TEST - -START_TEST(test_frame_callbacks) { - sbp_state_t s; - sbp_state_init(&s); - - /* Start with no callbacks registered. */ - sbp_clear_callbacks(&s); - - ck_assert_msg( - sbp_find_callback(&s, 0x1234) == 0, + sbp_find_callback(&s, SbpMsgUserData) == 0, "sbp_find_callback should return NULL if no callbacks registered"); - ck_assert_msg( - sbp_register_frame_callback(&s, 0x2233, &test_frame_callback, 0, 0) == - SBP_NULL_ERROR, - "sbp_register_frame_callback should return an error if node is NULL"); + ck_assert_msg(sbp_callback_register(&s, SbpMsgLog, &test_callback, 0, 0) == + SBP_NULL_ERROR, + "sbp_callback_register should return an error if node is NULL"); /* Add a first callback. */ @@ -753,29 +439,29 @@ START_TEST(test_frame_callbacks) { int NUMBER = 42; ck_assert_msg( - sbp_register_frame_callback(&s, 0x2233, 0, 0, &n) == SBP_NULL_ERROR, - "sbp_payload_callback_register should return an error if cb is NULL"); + sbp_callback_register(&s, SbpMsgLog, 0, 0, &n) == SBP_NULL_ERROR, + "sbp_callback_register should return an error if cb is NULL"); - ck_assert_msg(sbp_register_frame_callback(&s, 0x2233, &test_frame_callback, - &NUMBER, &n) == SBP_OK, - "sbp_payload_callback_register should return success if " + ck_assert_msg(sbp_callback_register(&s, SbpMsgLog, &test_callback, &NUMBER, + &n) == SBP_OK, + "sbp_callback_register should return success if " "everything is groovy"); - ck_assert_msg(sbp_register_frame_callback(&s, 0x2233, &test_frame_callback, 0, - &n) == SBP_CALLBACK_ERROR, - "sbp_payload_callback_register should return " + ck_assert_msg(sbp_callback_register(&s, SbpMsgLog, &test_callback, 0, &n) == + SBP_CALLBACK_ERROR, + "sbp_callback_register should return " "SBP_CALLBACK_ERROR if a callback " "of the same type is already registered"); ck_assert_msg( - sbp_find_callback(&s, 0x1234) == 0, + sbp_find_callback(&s, SbpMsgUserData) == 0, "sbp_find_callback should return NULL if callback not registered"); ck_assert_msg( - sbp_find_callback(&s, 0x2233) == &n, + sbp_find_callback(&s, SbpMsgLog) == &n, "sbp_find_callback didn't return the correct callback node pointer"); - ck_assert_msg(sbp_find_callback(&s, 0x2233)->context == &NUMBER, + ck_assert_msg(sbp_find_callback(&s, SbpMsgLog)->context == &NUMBER, "sbp_find_callback didn't return the correct context pointer"); /* Add a second callback. */ @@ -784,94 +470,56 @@ START_TEST(test_frame_callbacks) { int NUMBER2 = 84; - ck_assert_msg(sbp_register_frame_callback(&s, 0x1234, &test_frame_callback2, - &NUMBER2, &m) == SBP_OK, - "sbp_payload_callback_register should return success if " + ck_assert_msg(sbp_callback_register(&s, SbpMsgUserData, &test_callback2, + &NUMBER2, &m) == SBP_OK, + "sbp_callback_register should return success if " "everything is groovy (2)"); - ck_assert_msg(sbp_find_callback(&s, 0x2233) == &n, + ck_assert_msg(sbp_find_callback(&s, SbpMsgLog) == &n, "sbp_find_callback didn't return the correct callback function " "pointer (2)"); - ck_assert_msg(sbp_find_callback(&s, 0x2233)->context == &NUMBER, + ck_assert_msg(sbp_find_callback(&s, SbpMsgLog)->context == &NUMBER, "sbp_find_callback didn't return the correct context pointer"); - ck_assert_msg(sbp_find_callback(&s, 0x1234) == &m, + ck_assert_msg(sbp_find_callback(&s, SbpMsgUserData) == &m, "sbp_find_callback didn't return the correct callback function " "pointer (3)"); - ck_assert_msg(sbp_find_callback(&s, 0x1234)->context == &NUMBER2, + ck_assert_msg(sbp_find_callback(&s, SbpMsgUserData)->context == &NUMBER2, "sbp_find_callback didn't return the correct context pointer"); - ck_assert_msg(sbp_register_frame_callback(&s, 0x1234, &test_frame_callback, 0, - &n) == SBP_CALLBACK_ERROR, - "sbp_payload_callback_register should return " + ck_assert_msg(sbp_callback_register(&s, SbpMsgUserData, &test_callback, 0, + &n) == SBP_CALLBACK_ERROR, + "sbp_callback_register should return " "SBP_CALLBACK_ERROR if a callback " "of the same type is already registered (2)"); ck_assert_msg( - sbp_find_callback(&s, 0x7788) == 0, + sbp_find_callback(&s, SbpMsgFwd) == 0, "sbp_find_callback should return NULL if callback not registered (2)"); /* Clear all the registered callbacks and check they can no longer be found. */ - sbp_clear_callbacks(&s); ck_assert_msg( - sbp_find_callback(&s, 0x1234) == 0, + sbp_find_callback(&s, SbpMsgUserData) == 0, "sbp_find_callback should return NULL if no callbacks registered (2)"); ck_assert_msg( - sbp_find_callback(&s, 0x2233) == 0, + sbp_find_callback(&s, SbpMsgLog) == 0, "sbp_find_callback should return NULL if no callbacks registered (3)"); } END_TEST -START_TEST(test_msg_buff_backwards_compatibility) { - /* TODO: Tests with different read function behaviour. */ - - sbp_state_t s; - sbp_state_init(&s); - sbp_state_set_io_context(&s, &DUMMY_MEMORY_FOR_IO); - - static sbp_msg_callbacks_node_t n; - - sbp_payload_callback_register(&s, 0x2269, &test_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - - u8 test_data[] = {0x01, 0x02, 0x03, 0x04}; - - dummy_reset(); - sbp_payload_send(&s, 0x2269, 0x42, sizeof(test_data), test_data, - &dummy_write); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&s, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - ck_assert_msg(s.msg_buff[0] == 0x01, - "msg_buff backwards compatibility broken!"); - ck_assert_msg(s.msg_buff[1] == 0x02, - "msg_buff backwards compatibility broken!"); - ck_assert_msg(s.msg_buff[2] == 0x03, - "msg_buff backwards compatibility broken!"); - ck_assert_msg(s.msg_buff[3] == 0x04, - "msg_buff backwards compatibility broken!"); -} -END_TEST - Suite* sbp_suite(void) { Suite* s = suite_create("SBP"); TCase* tc_core = tcase_create("Core"); - tcase_add_test(tc_core, test_msg_buff_backwards_compatibility); tcase_add_test(tc_core, test_callbacks); - tcase_add_test(tc_core, test_sbp_payload_send); tcase_add_test(tc_core, test_sbp_process); - tcase_add_test(tc_core, test_sbp_frame); - tcase_add_test(tc_core, test_frame_callbacks); tcase_add_test(tc_core, test_sbp_all_payload); tcase_add_test(tc_core, test_sbp_big_msg); diff --git a/c/test/check_suites_legacy.h b/c/test/check_suites_legacy.h index ef78f9cfdd..e712b6f95d 100644 --- a/c/test/check_suites_legacy.h +++ b/c/test/check_suites_legacy.h @@ -18,238 +18,237 @@ Suite* edc_suite(void); Suite* sbp_suite(void); Suite* bitfield_macros_suite(void); -Suite* legacy_auto_check_sbp_acquisition_MsgAcqResult_suite(void); -Suite* legacy_auto_check_sbp_acquisition_MsgAcqResultDepA_suite(void); -Suite* legacy_auto_check_sbp_acquisition_MsgAcqResultDepB_suite(void); -Suite* legacy_auto_check_sbp_acquisition_MsgAcqResultDepC_suite(void); -Suite* legacy_auto_check_sbp_acquisition_MsgAcqSvProfile_suite(void); -Suite* legacy_auto_check_sbp_acquisition_MsgAcqSvProfileDep_suite(void); -Suite* legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeReq_suite(void); -Suite* legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeResp_suite(void); -Suite* legacy_auto_check_sbp_bootload_MsgBootloaderJumptoApp_suite(void); -Suite* legacy_auto_check_sbp_bootload_MsgNapDeviceDnaReq_suite(void); -Suite* legacy_auto_check_sbp_bootload_MsgNapDeviceDnaResp_suite(void); -Suite* legacy_auto_check_sbp_ext_events_MsgExtEvent_suite(void); -Suite* legacy_auto_check_sbp_file_io_MsgFileioConfigReq_suite(void); -Suite* legacy_auto_check_sbp_file_io_MsgFileioConfigResp_suite(void); -Suite* legacy_auto_check_sbp_file_io_MsgFileioReadDirReq_suite(void); -Suite* legacy_auto_check_sbp_file_io_MsgFileioReadDirResp_suite(void); -Suite* legacy_auto_check_sbp_file_io_MsgFileioReadReq_suite(void); -Suite* legacy_auto_check_sbp_file_io_MsgFileioReadResp_suite(void); -Suite* legacy_auto_check_sbp_file_io_MsgFileioRemove_suite(void); -Suite* legacy_auto_check_sbp_file_io_MsgFileioWriteResp_suite(void); -Suite* legacy_auto_check_sbp_flash_MsgFlashDone_suite(void); -Suite* legacy_auto_check_sbp_flash_MsgFlashErase_suite(void); -Suite* legacy_auto_check_sbp_flash_MsgFlashProgram_suite(void); -Suite* legacy_auto_check_sbp_flash_MsgFlashReadReq_suite(void); -Suite* legacy_auto_check_sbp_flash_MsgFlashReadResp_suite(void); -Suite* legacy_auto_check_sbp_flash_MsgM25FlashWriteStatus_suite(void); -Suite* legacy_auto_check_sbp_flash_MsgStmFlashLockSector_suite(void); -Suite* legacy_auto_check_sbp_flash_MsgStmFlashUnlockSector_suite(void); -Suite* legacy_auto_check_sbp_flash_MsgStmUniqueIdReq_suite(void); -Suite* legacy_auto_check_sbp_flash_MsgStmUniqueIdResp_suite(void); -Suite* legacy_auto_check_sbp_imu_MsgImuAux_suite(void); -Suite* legacy_auto_check_sbp_imu_MsgImuRaw_suite(void); -Suite* legacy_auto_check_sbp_integrity_MsgAcknowledge_suite(void); -Suite* legacy_auto_check_sbp_integrity_MsgSsrFlagHighLevel_suite(void); -Suite* legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPointSatLos_suite( - void); -Suite* legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPoints_suite(void); -Suite* legacy_auto_check_sbp_integrity_MsgSsrFlagIonoTileSatLos_suite(void); -Suite* legacy_auto_check_sbp_integrity_MsgSsrFlagSatellites_suite(void); -Suite* legacy_auto_check_sbp_integrity_MsgSsrFlagTropoGridPoints_suite(void); -Suite* legacy_auto_check_sbp_linux_MsgLinuxCpuState_suite(void); -Suite* legacy_auto_check_sbp_linux_MsgLinuxCpuStateDepA_suite(void); -Suite* legacy_auto_check_sbp_linux_MsgLinuxMemState_suite(void); -Suite* legacy_auto_check_sbp_linux_MsgLinuxMemStateDepA_suite(void); -Suite* legacy_auto_check_sbp_linux_MsgLinuxProcessFdCount_suite(void); -Suite* legacy_auto_check_sbp_linux_MsgLinuxProcessFdSummary_suite(void); -Suite* legacy_auto_check_sbp_linux_MsgLinuxProcessSocketCounts_suite(void); -Suite* legacy_auto_check_sbp_linux_MsgLinuxProcessSocketQueues_suite(void); -Suite* legacy_auto_check_sbp_linux_MsgLinuxSocketUsage_suite(void); -Suite* legacy_auto_check_sbp_linux_MsgLinuxSysState_suite(void); -Suite* legacy_auto_check_sbp_linux_MsgLinuxSysStateDepA_suite(void); -Suite* legacy_auto_check_sbp_logging_MsgFwd_suite(void); -Suite* legacy_auto_check_sbp_logging_MsgLog_suite(void); -Suite* legacy_auto_check_sbp_logging_MsgPrintDep_suite(void); -Suite* legacy_auto_check_sbp_mag_MsgMagRaw_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgAgeCorrections_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgBaselineECEF_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgBaselineHeadingDepA_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgBaselineNED_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgDops_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgDopsDepA_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgGPSTime_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgGPSTimeDepA_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgPosECEF_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgPosECEFCov_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgPosECEFCovGNSS_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgPosECEFDepA_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgPosECEFGNSS_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgPosLLH_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgPosLLHCov_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgPosLLHDepA_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgPosLlhAcc_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgPosLlhCovGnss_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgPosLlhGnss_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgPoseRelative_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgProtectionLevel_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgProtectionLevelDepA_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgReferenceFrameParam_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgUTCLeapSecond_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgUTCTime_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgUTCTimeGNSS_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgVelBody_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgVelCog_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgVelECEF_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgVelECEFCov_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgVelECEFDepA_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgVelEcefCovGnss_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgVelEcefGnss_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgVelNED_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgVelNEDCOV_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgVelNEDDepA_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgVelNedCovGnss_suite(void); -Suite* legacy_auto_check_sbp_navigation_MsgVelNedGnss_suite(void); -Suite* legacy_auto_check_sbp_ndb_MsgNdbEvent_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgAlmanacGLO_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgAlmanacGLODep_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgAlmanacGPS_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgAlmanacGPSDep_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgBasePosEcef_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgBasePosLLH_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgEphemerisBds_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgEphemerisDepA_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgEphemerisDepC_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgEphemerisDepD_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgEphemerisGLO_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgEphemerisGLODepA_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgEphemerisGLODepB_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgEphemerisGLODepC_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgEphemerisGLODepD_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgEphemerisGPS_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgEphemerisGPSDepE_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgEphemerisGPSDepF_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgEphemerisGal_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgEphemerisGalDepA_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgEphemerisSbas_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgEphemerisSbasDepA_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgEphemerisSbasDepB_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgGloBiases_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgGnssCapb_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgGroupDelay_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgGroupDelayDepA_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgGroupDelayDepB_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgIono_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgObs_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgObsDepB_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgObsDepC_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgOsr_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgSvAzEl_suite(void); -Suite* legacy_auto_check_sbp_observation_MsgSvConfigurationGpsDep_suite(void); -Suite* legacy_auto_check_sbp_observation_msgEphemerisDepB_suite(void); -Suite* legacy_auto_check_sbp_observation_msgEphemerisQzss_suite(void); -Suite* legacy_auto_check_sbp_observation_msgObsDepA_suite(void); -Suite* legacy_auto_check_sbp_orientation_MsgAngularRate_suite(void); -Suite* legacy_auto_check_sbp_orientation_MsgBaselineHeading_suite(void); -Suite* legacy_auto_check_sbp_orientation_MsgOrientEuler_suite(void); -Suite* legacy_auto_check_sbp_orientation_MsgOrientQuat_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgAlmanac_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgCellModemStatus_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgCommandOutput_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgCommandReq_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgCommandResp_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgCwResults_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgCwStart_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgDeviceMonitor_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgFrontEndGain_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgIarState_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgInitBaseDep_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgMaskSatellite_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgMaskSatelliteDep_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgNetworkBandwidthUsage_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgNetworkStateReq_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgNetworkStateResp_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgReset_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgResetDep_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgResetFilters_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgSetTime_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgSpecan_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgSpecanDep_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgThreadState_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgUartState_suite(void); -Suite* legacy_auto_check_sbp_piksi_MsgUartStateDepA_suite(void); -Suite* legacy_auto_check_sbp_profiling_MsgMeasurementPoint_suite(void); -Suite* legacy_auto_check_sbp_sbas_MsgSbasRaw_suite(void); -Suite* legacy_auto_check_sbp_settings_MsgSettingsReadByIndexDone_suite(void); -Suite* legacy_auto_check_sbp_settings_MsgSettingsReadByIndexReq_suite(void); -Suite* legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp_suite(void); -Suite* legacy_auto_check_sbp_settings_MsgSettingsReadReq_suite(void); -Suite* legacy_auto_check_sbp_settings_MsgSettingsReadResp_suite(void); -Suite* legacy_auto_check_sbp_settings_MsgSettingsRegister_suite(void); -Suite* legacy_auto_check_sbp_settings_MsgSettingsRegisterResp_suite(void); -Suite* legacy_auto_check_sbp_settings_MsgSettingsSave_suite(void); -Suite* legacy_auto_check_sbp_settings_MsgSettingsWrite_suite(void); -Suite* legacy_auto_check_sbp_settings_MsgSettingsWriteResp_suite(void); -Suite* legacy_auto_check_sbp_signing_MsgCertificateChain_suite(void); -Suite* legacy_auto_check_sbp_signing_MsgCertificateChainDep_suite(void); -Suite* legacy_auto_check_sbp_signing_MsgEcdsaCertificate_suite(void); -Suite* legacy_auto_check_sbp_signing_MsgEcdsaSignature_suite(void); -Suite* legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepA_suite(void); -Suite* legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepB_suite(void); -Suite* legacy_auto_check_sbp_signing_MsgEd25519CertificateDep_suite(void); -Suite* legacy_auto_check_sbp_signing_MsgEd25519SignatureDepA_suite(void); -Suite* legacy_auto_check_sbp_signing_MsgEd25519SignatureDepB_suite(void); -Suite* legacy_auto_check_sbp_solution_meta_MsgSolnMeta_suite(void); -Suite* legacy_auto_check_sbp_solution_meta_MsgSolnMetaDepA_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrCodeBiases_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrGridDefinitionDepA_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrection_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionNoStdDepA_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrOrbitClock_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBounds_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBoundsDegradation_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrOrbitClockDepA_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrPhaseBiases_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrSatelliteApc_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrSatelliteApcDepA_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrStecCorrection_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDep_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDepA_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrTileDefinition_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepA_suite(void); -Suite* legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepB_suite(void); -Suite* legacy_auto_check_sbp_system_MsgCsacTelemetry_suite(void); -Suite* legacy_auto_check_sbp_system_MsgCsacTelemetryLabels_suite(void); -Suite* legacy_auto_check_sbp_system_MsgDgnssStatus_suite(void); -Suite* legacy_auto_check_sbp_system_MsgGnssTimeOffset_suite(void); -Suite* legacy_auto_check_sbp_system_MsgGroupMeta_suite(void); -Suite* legacy_auto_check_sbp_system_MsgHeartbeat_suite(void); -Suite* legacy_auto_check_sbp_system_MsgInsStatus_suite(void); -Suite* legacy_auto_check_sbp_system_MsgInsUpdates_suite(void); -Suite* legacy_auto_check_sbp_system_MsgPpsTime_suite(void); -Suite* legacy_auto_check_sbp_system_MsgSensorAidEvent_suite(void); -Suite* legacy_auto_check_sbp_system_MsgStartup_suite(void); -Suite* legacy_auto_check_sbp_system_MsgStatusJournal_suite(void); -Suite* legacy_auto_check_sbp_system_MsgStatusReport_suite(void); -Suite* legacy_auto_check_sbp_telemetry_MsgTelSv_suite(void); -Suite* legacy_auto_check_sbp_tracking_MsgMeasurementState_suite(void); -Suite* legacy_auto_check_sbp_tracking_MsgTrackingIq_suite(void); -Suite* legacy_auto_check_sbp_tracking_MsgTrackingIqDepA_suite(void); -Suite* legacy_auto_check_sbp_tracking_MsgTrackingIqDepB_suite(void); -Suite* legacy_auto_check_sbp_tracking_MsgTrackingState_suite(void); -Suite* legacy_auto_check_sbp_tracking_MsgTrackingStateDepB_suite(void); -Suite* legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep_suite(void); -Suite* legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDepA_suite(void); -Suite* legacy_auto_check_sbp_tracking_MsgtrackingStateDepA_suite(void); -Suite* legacy_auto_check_sbp_user_MsgUserData_suite(void); -Suite* legacy_auto_check_sbp_vehicle_MsgOdometry_suite(void); -Suite* legacy_auto_check_sbp_vehicle_MsgWheeltick_suite(void); +Suite* auto_check_sbp_acquisition_MsgAcqResult_suite(void); +Suite* auto_check_sbp_acquisition_MsgAcqResultDepA_suite(void); +Suite* auto_check_sbp_acquisition_MsgAcqResultDepB_suite(void); +Suite* auto_check_sbp_acquisition_MsgAcqResultDepC_suite(void); +Suite* auto_check_sbp_acquisition_MsgAcqSvProfile_suite(void); +Suite* auto_check_sbp_acquisition_MsgAcqSvProfileDep_suite(void); +Suite* auto_check_sbp_bootload_MsgBootloaderHandshakeReq_suite(void); +Suite* auto_check_sbp_bootload_MsgBootloaderHandshakeResp_suite(void); +Suite* auto_check_sbp_bootload_MsgBootloaderJumptoApp_suite(void); +Suite* auto_check_sbp_bootload_MsgNapDeviceDnaReq_suite(void); +Suite* auto_check_sbp_bootload_MsgNapDeviceDnaResp_suite(void); +Suite* auto_check_sbp_ext_events_MsgExtEvent_suite(void); +Suite* auto_check_sbp_file_io_MsgFileioConfigReq_suite(void); +Suite* auto_check_sbp_file_io_MsgFileioConfigResp_suite(void); +Suite* auto_check_sbp_file_io_MsgFileioReadDirReq_suite(void); +Suite* auto_check_sbp_file_io_MsgFileioReadDirResp_suite(void); +Suite* auto_check_sbp_file_io_MsgFileioReadReq_suite(void); +Suite* auto_check_sbp_file_io_MsgFileioReadResp_suite(void); +Suite* auto_check_sbp_file_io_MsgFileioRemove_suite(void); +Suite* auto_check_sbp_file_io_MsgFileioWriteResp_suite(void); +Suite* auto_check_sbp_flash_MsgFlashDone_suite(void); +Suite* auto_check_sbp_flash_MsgFlashErase_suite(void); +Suite* auto_check_sbp_flash_MsgFlashProgram_suite(void); +Suite* auto_check_sbp_flash_MsgFlashReadReq_suite(void); +Suite* auto_check_sbp_flash_MsgFlashReadResp_suite(void); +Suite* auto_check_sbp_flash_MsgM25FlashWriteStatus_suite(void); +Suite* auto_check_sbp_flash_MsgStmFlashLockSector_suite(void); +Suite* auto_check_sbp_flash_MsgStmFlashUnlockSector_suite(void); +Suite* auto_check_sbp_flash_MsgStmUniqueIdReq_suite(void); +Suite* auto_check_sbp_flash_MsgStmUniqueIdResp_suite(void); +Suite* auto_check_sbp_imu_MsgImuAux_suite(void); +Suite* auto_check_sbp_imu_MsgImuRaw_suite(void); +Suite* auto_check_sbp_integrity_MsgAcknowledge_suite(void); +Suite* auto_check_sbp_integrity_MsgSsrFlagHighLevel_suite(void); +Suite* auto_check_sbp_integrity_MsgSsrFlagIonoGridPointSatLos_suite(void); +Suite* auto_check_sbp_integrity_MsgSsrFlagIonoGridPoints_suite(void); +Suite* auto_check_sbp_integrity_MsgSsrFlagIonoTileSatLos_suite(void); +Suite* auto_check_sbp_integrity_MsgSsrFlagSatellites_suite(void); +Suite* auto_check_sbp_integrity_MsgSsrFlagTropoGridPoints_suite(void); +Suite* auto_check_sbp_linux_MsgLinuxCpuState_suite(void); +Suite* auto_check_sbp_linux_MsgLinuxCpuStateDepA_suite(void); +Suite* auto_check_sbp_linux_MsgLinuxMemState_suite(void); +Suite* auto_check_sbp_linux_MsgLinuxMemStateDepA_suite(void); +Suite* auto_check_sbp_linux_MsgLinuxProcessFdCount_suite(void); +Suite* auto_check_sbp_linux_MsgLinuxProcessFdSummary_suite(void); +Suite* auto_check_sbp_linux_MsgLinuxProcessSocketCounts_suite(void); +Suite* auto_check_sbp_linux_MsgLinuxProcessSocketQueues_suite(void); +Suite* auto_check_sbp_linux_MsgLinuxSocketUsage_suite(void); +Suite* auto_check_sbp_linux_MsgLinuxSysState_suite(void); +Suite* auto_check_sbp_linux_MsgLinuxSysStateDepA_suite(void); +Suite* auto_check_sbp_logging_MsgFwd_suite(void); +Suite* auto_check_sbp_logging_MsgLog_suite(void); +Suite* auto_check_sbp_logging_MsgPrintDep_suite(void); +Suite* auto_check_sbp_mag_MsgMagRaw_suite(void); +Suite* auto_check_sbp_navigation_MsgAgeCorrections_suite(void); +Suite* auto_check_sbp_navigation_MsgBaselineECEF_suite(void); +Suite* auto_check_sbp_navigation_MsgBaselineECEFDepA_suite(void); +Suite* auto_check_sbp_navigation_MsgBaselineHeadingDepA_suite(void); +Suite* auto_check_sbp_navigation_MsgBaselineNED_suite(void); +Suite* auto_check_sbp_navigation_MsgBaselineNEDDepA_suite(void); +Suite* auto_check_sbp_navigation_MsgDops_suite(void); +Suite* auto_check_sbp_navigation_MsgDopsDepA_suite(void); +Suite* auto_check_sbp_navigation_MsgGPSTime_suite(void); +Suite* auto_check_sbp_navigation_MsgGPSTimeDepA_suite(void); +Suite* auto_check_sbp_navigation_MsgGPSTimeGNSS_suite(void); +Suite* auto_check_sbp_navigation_MsgPosECEF_suite(void); +Suite* auto_check_sbp_navigation_MsgPosECEFCov_suite(void); +Suite* auto_check_sbp_navigation_MsgPosECEFCovGNSS_suite(void); +Suite* auto_check_sbp_navigation_MsgPosECEFDepA_suite(void); +Suite* auto_check_sbp_navigation_MsgPosECEFGNSS_suite(void); +Suite* auto_check_sbp_navigation_MsgPosLLH_suite(void); +Suite* auto_check_sbp_navigation_MsgPosLLHCov_suite(void); +Suite* auto_check_sbp_navigation_MsgPosLLHDepA_suite(void); +Suite* auto_check_sbp_navigation_MsgPosLlhAcc_suite(void); +Suite* auto_check_sbp_navigation_MsgPosLlhCovGnss_suite(void); +Suite* auto_check_sbp_navigation_MsgPosLlhGnss_suite(void); +Suite* auto_check_sbp_navigation_MsgPoseRelative_suite(void); +Suite* auto_check_sbp_navigation_MsgProtectionLevel_suite(void); +Suite* auto_check_sbp_navigation_MsgProtectionLevelDepA_suite(void); +Suite* auto_check_sbp_navigation_MsgReferenceFrameParam_suite(void); +Suite* auto_check_sbp_navigation_MsgUTCLeapSecond_suite(void); +Suite* auto_check_sbp_navigation_MsgUTCTime_suite(void); +Suite* auto_check_sbp_navigation_MsgUTCTimeGNSS_suite(void); +Suite* auto_check_sbp_navigation_MsgVelBody_suite(void); +Suite* auto_check_sbp_navigation_MsgVelCog_suite(void); +Suite* auto_check_sbp_navigation_MsgVelECEF_suite(void); +Suite* auto_check_sbp_navigation_MsgVelECEFCov_suite(void); +Suite* auto_check_sbp_navigation_MsgVelECEFDepA_suite(void); +Suite* auto_check_sbp_navigation_MsgVelEcefCovGnss_suite(void); +Suite* auto_check_sbp_navigation_MsgVelEcefGnss_suite(void); +Suite* auto_check_sbp_navigation_MsgVelNED_suite(void); +Suite* auto_check_sbp_navigation_MsgVelNEDCOV_suite(void); +Suite* auto_check_sbp_navigation_MsgVelNEDDepA_suite(void); +Suite* auto_check_sbp_navigation_MsgVelNedCovGnss_suite(void); +Suite* auto_check_sbp_navigation_MsgVelNedGnss_suite(void); +Suite* auto_check_sbp_ndb_MsgNdbEvent_suite(void); +Suite* auto_check_sbp_observation_MsgAlmanacGLO_suite(void); +Suite* auto_check_sbp_observation_MsgAlmanacGLODep_suite(void); +Suite* auto_check_sbp_observation_MsgAlmanacGPS_suite(void); +Suite* auto_check_sbp_observation_MsgAlmanacGPSDep_suite(void); +Suite* auto_check_sbp_observation_MsgBasePosEcef_suite(void); +Suite* auto_check_sbp_observation_MsgBasePosLLH_suite(void); +Suite* auto_check_sbp_observation_MsgEphemerisBds_suite(void); +Suite* auto_check_sbp_observation_MsgEphemerisDepA_suite(void); +Suite* auto_check_sbp_observation_MsgEphemerisDepC_suite(void); +Suite* auto_check_sbp_observation_MsgEphemerisDepD_suite(void); +Suite* auto_check_sbp_observation_MsgEphemerisGLO_suite(void); +Suite* auto_check_sbp_observation_MsgEphemerisGLODepA_suite(void); +Suite* auto_check_sbp_observation_MsgEphemerisGLODepB_suite(void); +Suite* auto_check_sbp_observation_MsgEphemerisGLODepC_suite(void); +Suite* auto_check_sbp_observation_MsgEphemerisGLODepD_suite(void); +Suite* auto_check_sbp_observation_MsgEphemerisGPS_suite(void); +Suite* auto_check_sbp_observation_MsgEphemerisGPSDepE_suite(void); +Suite* auto_check_sbp_observation_MsgEphemerisGPSDepF_suite(void); +Suite* auto_check_sbp_observation_MsgEphemerisGal_suite(void); +Suite* auto_check_sbp_observation_MsgEphemerisGalDepA_suite(void); +Suite* auto_check_sbp_observation_MsgEphemerisSbas_suite(void); +Suite* auto_check_sbp_observation_MsgEphemerisSbasDepA_suite(void); +Suite* auto_check_sbp_observation_MsgEphemerisSbasDepB_suite(void); +Suite* auto_check_sbp_observation_MsgGloBiases_suite(void); +Suite* auto_check_sbp_observation_MsgGnssCapb_suite(void); +Suite* auto_check_sbp_observation_MsgGroupDelay_suite(void); +Suite* auto_check_sbp_observation_MsgGroupDelayDepA_suite(void); +Suite* auto_check_sbp_observation_MsgGroupDelayDepB_suite(void); +Suite* auto_check_sbp_observation_MsgIono_suite(void); +Suite* auto_check_sbp_observation_MsgObs_suite(void); +Suite* auto_check_sbp_observation_MsgObsDepB_suite(void); +Suite* auto_check_sbp_observation_MsgObsDepC_suite(void); +Suite* auto_check_sbp_observation_MsgOsr_suite(void); +Suite* auto_check_sbp_observation_MsgSvAzEl_suite(void); +Suite* auto_check_sbp_observation_MsgSvConfigurationGpsDep_suite(void); +Suite* auto_check_sbp_observation_msgEphemerisDepB_suite(void); +Suite* auto_check_sbp_observation_msgEphemerisQzss_suite(void); +Suite* auto_check_sbp_observation_msgObsDepA_suite(void); +Suite* auto_check_sbp_orientation_MsgAngularRate_suite(void); +Suite* auto_check_sbp_orientation_MsgBaselineHeading_suite(void); +Suite* auto_check_sbp_orientation_MsgOrientEuler_suite(void); +Suite* auto_check_sbp_orientation_MsgOrientQuat_suite(void); +Suite* auto_check_sbp_piksi_MsgAlmanac_suite(void); +Suite* auto_check_sbp_piksi_MsgCellModemStatus_suite(void); +Suite* auto_check_sbp_piksi_MsgCommandOutput_suite(void); +Suite* auto_check_sbp_piksi_MsgCommandReq_suite(void); +Suite* auto_check_sbp_piksi_MsgCommandResp_suite(void); +Suite* auto_check_sbp_piksi_MsgCwResults_suite(void); +Suite* auto_check_sbp_piksi_MsgCwStart_suite(void); +Suite* auto_check_sbp_piksi_MsgDeviceMonitor_suite(void); +Suite* auto_check_sbp_piksi_MsgFrontEndGain_suite(void); +Suite* auto_check_sbp_piksi_MsgIarState_suite(void); +Suite* auto_check_sbp_piksi_MsgInitBaseDep_suite(void); +Suite* auto_check_sbp_piksi_MsgMaskSatellite_suite(void); +Suite* auto_check_sbp_piksi_MsgMaskSatelliteDep_suite(void); +Suite* auto_check_sbp_piksi_MsgNetworkBandwidthUsage_suite(void); +Suite* auto_check_sbp_piksi_MsgNetworkStateReq_suite(void); +Suite* auto_check_sbp_piksi_MsgNetworkStateResp_suite(void); +Suite* auto_check_sbp_piksi_MsgReset_suite(void); +Suite* auto_check_sbp_piksi_MsgResetDep_suite(void); +Suite* auto_check_sbp_piksi_MsgResetFilters_suite(void); +Suite* auto_check_sbp_piksi_MsgSetTime_suite(void); +Suite* auto_check_sbp_piksi_MsgSpecan_suite(void); +Suite* auto_check_sbp_piksi_MsgSpecanDep_suite(void); +Suite* auto_check_sbp_piksi_MsgThreadState_suite(void); +Suite* auto_check_sbp_piksi_MsgUartState_suite(void); +Suite* auto_check_sbp_piksi_MsgUartStateDepA_suite(void); +Suite* auto_check_sbp_profiling_MsgMeasurementPoint_suite(void); +Suite* auto_check_sbp_sbas_MsgSbasRaw_suite(void); +Suite* auto_check_sbp_settings_MsgSettingsReadByIndexDone_suite(void); +Suite* auto_check_sbp_settings_MsgSettingsReadByIndexReq_suite(void); +Suite* auto_check_sbp_settings_MsgSettingsReadByIndexResp_suite(void); +Suite* auto_check_sbp_settings_MsgSettingsReadReq_suite(void); +Suite* auto_check_sbp_settings_MsgSettingsReadResp_suite(void); +Suite* auto_check_sbp_settings_MsgSettingsRegister_suite(void); +Suite* auto_check_sbp_settings_MsgSettingsRegisterResp_suite(void); +Suite* auto_check_sbp_settings_MsgSettingsSave_suite(void); +Suite* auto_check_sbp_settings_MsgSettingsWrite_suite(void); +Suite* auto_check_sbp_settings_MsgSettingsWriteResp_suite(void); +Suite* auto_check_sbp_signing_MsgCertificateChain_suite(void); +Suite* auto_check_sbp_signing_MsgCertificateChainDep_suite(void); +Suite* auto_check_sbp_signing_MsgEcdsaCertificate_suite(void); +Suite* auto_check_sbp_signing_MsgEcdsaSignature_suite(void); +Suite* auto_check_sbp_signing_MsgEcdsaSignatureDepA_suite(void); +Suite* auto_check_sbp_signing_MsgEcdsaSignatureDepB_suite(void); +Suite* auto_check_sbp_signing_MsgEd25519CertificateDep_suite(void); +Suite* auto_check_sbp_signing_MsgEd25519SignatureDepA_suite(void); +Suite* auto_check_sbp_signing_MsgEd25519SignatureDepB_suite(void); +Suite* auto_check_sbp_solution_meta_MsgSolnMeta_suite(void); +Suite* auto_check_sbp_solution_meta_MsgSolnMetaDepA_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrCodeBiases_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrGridDefinitionDepA_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrGriddedCorrection_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrGriddedCorrectionNoStdDepA_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrOrbitClock_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrOrbitClockBounds_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrOrbitClockBoundsDegradation_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrOrbitClockDepA_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrPhaseBiases_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrSatelliteApc_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrSatelliteApcDepA_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrStecCorrection_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrStecCorrectionDep_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrStecCorrectionDepA_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrTileDefinition_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrTileDefinitionDepA_suite(void); +Suite* auto_check_sbp_ssr_MsgSsrTileDefinitionDepB_suite(void); +Suite* auto_check_sbp_system_MsgCsacTelemetry_suite(void); +Suite* auto_check_sbp_system_MsgCsacTelemetryLabels_suite(void); +Suite* auto_check_sbp_system_MsgDgnssStatus_suite(void); +Suite* auto_check_sbp_system_MsgGnssTimeOffset_suite(void); +Suite* auto_check_sbp_system_MsgGroupMeta_suite(void); +Suite* auto_check_sbp_system_MsgHeartbeat_suite(void); +Suite* auto_check_sbp_system_MsgInsStatus_suite(void); +Suite* auto_check_sbp_system_MsgInsUpdates_suite(void); +Suite* auto_check_sbp_system_MsgPpsTime_suite(void); +Suite* auto_check_sbp_system_MsgSensorAidEvent_suite(void); +Suite* auto_check_sbp_system_MsgStartup_suite(void); +Suite* auto_check_sbp_system_MsgStatusJournal_suite(void); +Suite* auto_check_sbp_system_MsgStatusReport_suite(void); +Suite* auto_check_sbp_telemetry_MsgTelSv_suite(void); +Suite* auto_check_sbp_tracking_MsgMeasurementState_suite(void); +Suite* auto_check_sbp_tracking_MsgTrackingIq_suite(void); +Suite* auto_check_sbp_tracking_MsgTrackingIqDepA_suite(void); +Suite* auto_check_sbp_tracking_MsgTrackingIqDepB_suite(void); +Suite* auto_check_sbp_tracking_MsgTrackingState_suite(void); +Suite* auto_check_sbp_tracking_MsgTrackingStateDepB_suite(void); +Suite* auto_check_sbp_tracking_MsgTrackingStateDetailedDep_suite(void); +Suite* auto_check_sbp_tracking_MsgTrackingStateDetailedDepA_suite(void); +Suite* auto_check_sbp_tracking_MsgtrackingStateDepA_suite(void); +Suite* auto_check_sbp_user_MsgUserData_suite(void); +Suite* auto_check_sbp_vehicle_MsgOdometry_suite(void); +Suite* auto_check_sbp_vehicle_MsgWheeltick_suite(void); #endif /* CHECK_SUITES_H */ \ No newline at end of file diff --git a/c/test/cpp/auto_check_sbp_gnss_gnss_structs.cc b/c/test/cpp/auto_check_sbp_gnss_gnss_structs.cc index cfc213bd96..c0914377be 100644 --- a/c/test/cpp/auto_check_sbp_gnss_gnss_structs.cc +++ b/c/test/cpp/auto_check_sbp_gnss_gnss_structs.cc @@ -35,7 +35,7 @@ class Test_Struct_auto_check_sbp_gnss_gnss_structs0 : public ::testing::Test { } struct TestStructInfo { - sbp_v4_gnss_signal_t test_struct; + sbp_gnss_signal_t test_struct; const uint8_t *encoded_data; uint32_t encoded_len; }; @@ -49,7 +49,7 @@ class Test_Struct_auto_check_sbp_gnss_gnss_structs0 : public ::testing::Test { } private: - sbp_v4_gnss_signal_t test_struct_{}; + sbp_gnss_signal_t test_struct_{}; uint8_t encoded_data_[2] = { 162, 244, @@ -58,15 +58,15 @@ class Test_Struct_auto_check_sbp_gnss_gnss_structs0 : public ::testing::Test { TEST_F(Test_Struct_auto_check_sbp_gnss_gnss_structs0, EncodedLen) { auto info = get_test_struct_info(); - EXPECT_EQ(sbp_v4_gnss_signal_encoded_len(&info.test_struct), 2); + EXPECT_EQ(sbp_gnss_signal_encoded_len(&info.test_struct), 2); } TEST_F(Test_Struct_auto_check_sbp_gnss_gnss_structs0, FreeEncode) { auto info = get_test_struct_info(); uint8_t nwritten = 0; uint8_t buf[2]; - EXPECT_EQ(sbp_v4_gnss_signal_encode(&buf[0], sizeof(buf), &nwritten, - &info.test_struct), + EXPECT_EQ(sbp_gnss_signal_encode(&buf[0], sizeof(buf), &nwritten, + &info.test_struct), SBP_OK); EXPECT_EQ(nwritten, 2); EXPECT_EQ(memcmp(&buf[0], info.encoded_data, nwritten), 0); @@ -76,9 +76,9 @@ TEST_F(Test_Struct_auto_check_sbp_gnss_gnss_structs0, FreeEncodeWithoutNwritten) { auto info = get_test_struct_info(); uint8_t buf[2]; - EXPECT_EQ(sbp_v4_gnss_signal_encode(&buf[0], sizeof(buf), nullptr, - &info.test_struct), - SBP_OK); + EXPECT_EQ( + sbp_gnss_signal_encode(&buf[0], sizeof(buf), nullptr, &info.test_struct), + SBP_OK); EXPECT_EQ(memcmp(&buf[0], info.encoded_data, 2), 0); } @@ -86,7 +86,7 @@ TEST_F(Test_Struct_auto_check_sbp_gnss_gnss_structs0, FreeEncodeUnderflow) { auto info = get_test_struct_info(); uint8_t buf[2]; for (uint8_t i = 0; i < 2; i++) { - EXPECT_EQ(sbp_v4_gnss_signal_encode(&buf[0], i, nullptr, &info.test_struct), + EXPECT_EQ(sbp_gnss_signal_encode(&buf[0], i, nullptr, &info.test_struct), SBP_ENCODE_ERROR); } } @@ -94,27 +94,25 @@ TEST_F(Test_Struct_auto_check_sbp_gnss_gnss_structs0, FreeEncodeUnderflow) { TEST_F(Test_Struct_auto_check_sbp_gnss_gnss_structs0, FreeDecode) { auto info = get_test_struct_info(); uint8_t nread = 0; - sbp_v4_gnss_signal_t t{}; - EXPECT_EQ(sbp_v4_gnss_signal_decode(info.encoded_data, 2, &nread, &t), - SBP_OK); + sbp_gnss_signal_t t{}; + EXPECT_EQ(sbp_gnss_signal_decode(info.encoded_data, 2, &nread, &t), SBP_OK); EXPECT_EQ(nread, info.encoded_len); - EXPECT_EQ(sbp_v4_gnss_signal_cmp(&t, &info.test_struct), 0); + EXPECT_EQ(sbp_gnss_signal_cmp(&t, &info.test_struct), 0); } TEST_F(Test_Struct_auto_check_sbp_gnss_gnss_structs0, FreeDecodeWithoutNread) { auto info = get_test_struct_info(); - sbp_v4_gnss_signal_t t{}; - EXPECT_EQ(sbp_v4_gnss_signal_decode(info.encoded_data, 2, nullptr, &t), - SBP_OK); - EXPECT_EQ(sbp_v4_gnss_signal_cmp(&t, &info.test_struct), 0); + sbp_gnss_signal_t t{}; + EXPECT_EQ(sbp_gnss_signal_decode(info.encoded_data, 2, nullptr, &t), SBP_OK); + EXPECT_EQ(sbp_gnss_signal_cmp(&t, &info.test_struct), 0); } TEST_F(Test_Struct_auto_check_sbp_gnss_gnss_structs0, FreeDecodeUnderflow) { auto info = get_test_struct_info(); - sbp_v4_gnss_signal_t t{}; + sbp_gnss_signal_t t{}; for (uint8_t i = 0; i < 2; i++) { - EXPECT_EQ(sbp_v4_gnss_signal_decode(info.encoded_data, i, nullptr, &t), + EXPECT_EQ(sbp_gnss_signal_decode(info.encoded_data, i, nullptr, &t), SBP_DECODE_ERROR); } } @@ -491,7 +489,7 @@ class Test_Struct_auto_check_sbp_gnss_gnss_structs5 : public ::testing::Test { } struct TestStructInfo { - sbp_v4_gps_time_t test_struct; + sbp_gps_time_t test_struct; const uint8_t *encoded_data; uint32_t encoded_len; }; @@ -505,7 +503,7 @@ class Test_Struct_auto_check_sbp_gnss_gnss_structs5 : public ::testing::Test { } private: - sbp_v4_gps_time_t test_struct_{}; + sbp_gps_time_t test_struct_{}; uint8_t encoded_data_[10] = { 31, 13, 189, 5, 30, 178, 29, 28, 31, 184, }; @@ -513,16 +511,16 @@ class Test_Struct_auto_check_sbp_gnss_gnss_structs5 : public ::testing::Test { TEST_F(Test_Struct_auto_check_sbp_gnss_gnss_structs5, EncodedLen) { auto info = get_test_struct_info(); - EXPECT_EQ(sbp_v4_gps_time_encoded_len(&info.test_struct), 10); + EXPECT_EQ(sbp_gps_time_encoded_len(&info.test_struct), 10); } TEST_F(Test_Struct_auto_check_sbp_gnss_gnss_structs5, FreeEncode) { auto info = get_test_struct_info(); uint8_t nwritten = 0; uint8_t buf[10]; - EXPECT_EQ(sbp_v4_gps_time_encode(&buf[0], sizeof(buf), &nwritten, - &info.test_struct), - SBP_OK); + EXPECT_EQ( + sbp_gps_time_encode(&buf[0], sizeof(buf), &nwritten, &info.test_struct), + SBP_OK); EXPECT_EQ(nwritten, 10); EXPECT_EQ(memcmp(&buf[0], info.encoded_data, nwritten), 0); } @@ -532,7 +530,7 @@ TEST_F(Test_Struct_auto_check_sbp_gnss_gnss_structs5, auto info = get_test_struct_info(); uint8_t buf[10]; EXPECT_EQ( - sbp_v4_gps_time_encode(&buf[0], sizeof(buf), nullptr, &info.test_struct), + sbp_gps_time_encode(&buf[0], sizeof(buf), nullptr, &info.test_struct), SBP_OK); EXPECT_EQ(memcmp(&buf[0], info.encoded_data, 10), 0); } @@ -541,7 +539,7 @@ TEST_F(Test_Struct_auto_check_sbp_gnss_gnss_structs5, FreeEncodeUnderflow) { auto info = get_test_struct_info(); uint8_t buf[10]; for (uint8_t i = 0; i < 10; i++) { - EXPECT_EQ(sbp_v4_gps_time_encode(&buf[0], i, nullptr, &info.test_struct), + EXPECT_EQ(sbp_gps_time_encode(&buf[0], i, nullptr, &info.test_struct), SBP_ENCODE_ERROR); } } @@ -549,25 +547,25 @@ TEST_F(Test_Struct_auto_check_sbp_gnss_gnss_structs5, FreeEncodeUnderflow) { TEST_F(Test_Struct_auto_check_sbp_gnss_gnss_structs5, FreeDecode) { auto info = get_test_struct_info(); uint8_t nread = 0; - sbp_v4_gps_time_t t{}; - EXPECT_EQ(sbp_v4_gps_time_decode(info.encoded_data, 10, &nread, &t), SBP_OK); + sbp_gps_time_t t{}; + EXPECT_EQ(sbp_gps_time_decode(info.encoded_data, 10, &nread, &t), SBP_OK); EXPECT_EQ(nread, info.encoded_len); - EXPECT_EQ(sbp_v4_gps_time_cmp(&t, &info.test_struct), 0); + EXPECT_EQ(sbp_gps_time_cmp(&t, &info.test_struct), 0); } TEST_F(Test_Struct_auto_check_sbp_gnss_gnss_structs5, FreeDecodeWithoutNread) { auto info = get_test_struct_info(); - sbp_v4_gps_time_t t{}; - EXPECT_EQ(sbp_v4_gps_time_decode(info.encoded_data, 10, nullptr, &t), SBP_OK); - EXPECT_EQ(sbp_v4_gps_time_cmp(&t, &info.test_struct), 0); + sbp_gps_time_t t{}; + EXPECT_EQ(sbp_gps_time_decode(info.encoded_data, 10, nullptr, &t), SBP_OK); + EXPECT_EQ(sbp_gps_time_cmp(&t, &info.test_struct), 0); } TEST_F(Test_Struct_auto_check_sbp_gnss_gnss_structs5, FreeDecodeUnderflow) { auto info = get_test_struct_info(); - sbp_v4_gps_time_t t{}; + sbp_gps_time_t t{}; for (uint8_t i = 0; i < 10; i++) { - EXPECT_EQ(sbp_v4_gps_time_decode(info.encoded_data, i, nullptr, &t), + EXPECT_EQ(sbp_gps_time_decode(info.encoded_data, i, nullptr, &t), SBP_DECODE_ERROR); } } diff --git a/c/test/legacy/auto_check_sbp_acquisition_MsgAcqResult.c b/c/test/legacy/auto_check_sbp_acquisition_MsgAcqResult.c deleted file mode 100644 index 4e6da32bbf..0000000000 --- a/c/test/legacy/auto_check_sbp_acquisition_MsgAcqResult.c +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/acquisition/test_MsgAcqResult.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_acquisition_MsgAcqResult) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x2f, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x2f, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 47, 0, 195, 4, 14, 0, 0, 104, 65, 102, - 102, 144, 66, 205, 196, 0, 70, 8, 0, 207, 189, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_result_t *test_msg = (msg_acq_result_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cf = 8241.2001953125; - test_msg->cn0 = 14.5; - test_msg->cp = 72.19999694824219; - test_msg->sid.code = 0; - test_msg->sid.sat = 8; - sbp_payload_send(&sbp_state, 0x2f, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x2f, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_result_t *check_msg = (msg_acq_result_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cf * 100 - 8241.20019531 * 100) < 0.05, - "incorrect value for cf, expected 8241.20019531, is %f", - check_msg->cf); - ck_assert_msg((check_msg->cn0 * 100 - 14.5 * 100) < 0.05, - "incorrect value for cn0, expected 14.5, is %f", - check_msg->cn0); - ck_assert_msg((check_msg->cp * 100 - 72.1999969482 * 100) < 0.05, - "incorrect value for cp, expected 72.1999969482, is %f", - check_msg->cp); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.sat == 8, - "incorrect value for sid.sat, expected 8, is %d", - check_msg->sid.sat); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_acquisition_MsgAcqResult_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_acquisition_MsgAcqResult"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_acquisition_MsgAcqResult"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_acquisition_MsgAcqResult); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_acquisition_MsgAcqResultDepA.c b/c/test/legacy/auto_check_sbp_acquisition_MsgAcqResultDepA.c deleted file mode 100644 index e72eb8e4ad..0000000000 --- a/c/test/legacy/auto_check_sbp_acquisition_MsgAcqResultDepA.c +++ /dev/null @@ -1,739 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/acquisition/test_MsgAcqResultDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x15, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x15, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 21, 0, 195, 4, 13, 0, 0, 104, 65, 0, - 192, 53, 68, 198, 199, 0, 70, 8, 2, 68, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_result_dep_a_t* test_msg = - (msg_acq_result_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cf = 8241.943359375; - test_msg->cp = 727.0; - test_msg->prn = 8; - test_msg->snr = 14.5; - sbp_payload_send(&sbp_state, 0x15, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x15, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_result_dep_a_t* check_msg = - (msg_acq_result_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cf * 100 - 8241.94335938 * 100) < 0.05, - "incorrect value for cf, expected 8241.94335938, is %f", - check_msg->cf); - ck_assert_msg((check_msg->cp * 100 - 727.0 * 100) < 0.05, - "incorrect value for cp, expected 727.0, is %f", - check_msg->cp); - ck_assert_msg(check_msg->prn == 8, - "incorrect value for prn, expected 8, is %d", check_msg->prn); - ck_assert_msg((check_msg->snr * 100 - 14.5 * 100) < 0.05, - "incorrect value for snr, expected 14.5, is %f", - check_msg->snr); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x15, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x15, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 21, 0, 195, 4, 13, 205, 204, 116, 65, 0, - 192, 179, 67, 33, 81, 59, 68, 9, 219, 27, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_result_dep_a_t* test_msg = - (msg_acq_result_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cf = 749.2676391601562; - test_msg->cp = 359.5; - test_msg->prn = 9; - test_msg->snr = 15.300000190734863; - sbp_payload_send(&sbp_state, 0x15, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x15, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_result_dep_a_t* check_msg = - (msg_acq_result_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cf * 100 - 749.26763916 * 100) < 0.05, - "incorrect value for cf, expected 749.26763916, is %f", - check_msg->cf); - ck_assert_msg((check_msg->cp * 100 - 359.5 * 100) < 0.05, - "incorrect value for cp, expected 359.5, is %f", - check_msg->cp); - ck_assert_msg(check_msg->prn == 9, - "incorrect value for prn, expected 9, is %d", check_msg->prn); - ck_assert_msg((check_msg->snr * 100 - 15.3000001907 * 100) < 0.05, - "incorrect value for snr, expected 15.3000001907, is %f", - check_msg->snr); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x15, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x15, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 21, 0, 195, 4, 13, 205, 204, 144, 65, 0, - 0, 34, 66, 57, 237, 202, 197, 11, 150, 35, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_result_dep_a_t* test_msg = - (msg_acq_result_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cf = -6493.65283203125; - test_msg->cp = 40.5; - test_msg->prn = 11; - test_msg->snr = 18.100000381469727; - sbp_payload_send(&sbp_state, 0x15, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x15, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_result_dep_a_t* check_msg = - (msg_acq_result_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cf * 100 - -6493.65283203 * 100) < 0.05, - "incorrect value for cf, expected -6493.65283203, is %f", - check_msg->cf); - ck_assert_msg((check_msg->cp * 100 - 40.5 * 100) < 0.05, - "incorrect value for cp, expected 40.5, is %f", - check_msg->cp); - ck_assert_msg(check_msg->prn == 11, - "incorrect value for prn, expected 11, is %d", - check_msg->prn); - ck_assert_msg((check_msg->snr * 100 - 18.1000003815 * 100) < 0.05, - "incorrect value for snr, expected 18.1000003815, is %f", - check_msg->snr); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x15, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x15, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 21, 0, 195, 4, 13, 205, 204, 116, 65, 0, - 32, 9, 68, 129, 193, 121, 196, 12, 146, 118, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_result_dep_a_t* test_msg = - (msg_acq_result_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cf = -999.0234985351562; - test_msg->cp = 548.5; - test_msg->prn = 12; - test_msg->snr = 15.300000190734863; - sbp_payload_send(&sbp_state, 0x15, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x15, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_result_dep_a_t* check_msg = - (msg_acq_result_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cf * 100 - -999.023498535 * 100) < 0.05, - "incorrect value for cf, expected -999.023498535, is %f", - check_msg->cf); - ck_assert_msg((check_msg->cp * 100 - 548.5 * 100) < 0.05, - "incorrect value for cp, expected 548.5, is %f", - check_msg->cp); - ck_assert_msg(check_msg->prn == 12, - "incorrect value for prn, expected 12, is %d", - check_msg->prn); - ck_assert_msg((check_msg->snr * 100 - 15.3000001907 * 100) < 0.05, - "incorrect value for snr, expected 15.3000001907, is %f", - check_msg->snr); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x15, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x15, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 21, 0, 195, 4, 13, 205, 204, 116, 65, 0, - 32, 67, 68, 228, 74, 148, 69, 14, 23, 75, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_result_dep_a_t* test_msg = - (msg_acq_result_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cf = 4745.361328125; - test_msg->cp = 780.5; - test_msg->prn = 14; - test_msg->snr = 15.300000190734863; - sbp_payload_send(&sbp_state, 0x15, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x15, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_result_dep_a_t* check_msg = - (msg_acq_result_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cf * 100 - 4745.36132812 * 100) < 0.05, - "incorrect value for cf, expected 4745.36132812, is %f", - check_msg->cf); - ck_assert_msg((check_msg->cp * 100 - 780.5 * 100) < 0.05, - "incorrect value for cp, expected 780.5, is %f", - check_msg->cp); - ck_assert_msg(check_msg->prn == 14, - "incorrect value for prn, expected 14, is %d", - check_msg->prn); - ck_assert_msg((check_msg->snr * 100 - 15.3000001907 * 100) < 0.05, - "incorrect value for snr, expected 15.3000001907, is %f", - check_msg->snr); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x15, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x15, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 21, 0, 195, 4, 13, 228, 56, 35, 67, 0, - 32, 18, 68, 129, 193, 249, 195, 0, 204, 207, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_result_dep_a_t* test_msg = - (msg_acq_result_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cf = -499.5117492675781; - test_msg->cp = 584.5; - test_msg->prn = 0; - test_msg->snr = 163.22222900390625; - sbp_payload_send(&sbp_state, 0x15, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x15, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_result_dep_a_t* check_msg = - (msg_acq_result_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cf * 100 - -499.511749268 * 100) < 0.05, - "incorrect value for cf, expected -499.511749268, is %f", - check_msg->cf); - ck_assert_msg((check_msg->cp * 100 - 584.5 * 100) < 0.05, - "incorrect value for cp, expected 584.5, is %f", - check_msg->cp); - ck_assert_msg(check_msg->prn == 0, - "incorrect value for prn, expected 0, is %d", check_msg->prn); - ck_assert_msg((check_msg->snr * 100 - 163.222229004 * 100) < 0.05, - "incorrect value for snr, expected 163.222229004, is %f", - check_msg->snr); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_acquisition_MsgAcqResultDepA_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_acquisition_MsgAcqResultDepA"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_acquisition_MsgAcqResultDepB.c b/c/test/legacy/auto_check_sbp_acquisition_MsgAcqResultDepB.c deleted file mode 100644 index d69d66d953..0000000000 --- a/c/test/legacy/auto_check_sbp_acquisition_MsgAcqResultDepB.c +++ /dev/null @@ -1,680 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/acquisition/test_MsgAcqResultDepB.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x14, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x14, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 20, 0, 246, 215, 16, 137, 167, 18, 66, 0, 0, - 161, 67, 240, 24, 156, 69, 9, 0, 0, 0, 80, 195, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_result_dep_b_t* test_msg = - (msg_acq_result_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cf = 4995.1171875; - test_msg->cp = 322.0; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 9; - test_msg->snr = 36.66360855102539; - sbp_payload_send(&sbp_state, 0x14, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x14, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_result_dep_b_t* check_msg = - (msg_acq_result_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cf * 100 - 4995.1171875 * 100) < 0.05, - "incorrect value for cf, expected 4995.1171875, is %f", - check_msg->cf); - ck_assert_msg((check_msg->cp * 100 - 322.0 * 100) < 0.05, - "incorrect value for cp, expected 322.0, is %f", - check_msg->cp); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 9, - "incorrect value for sid.sat, expected 9, is %d", - check_msg->sid.sat); - ck_assert_msg((check_msg->snr * 100 - 36.663608551 * 100) < 0.05, - "incorrect value for snr, expected 36.663608551, is %f", - check_msg->snr); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x14, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x14, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 20, 0, 246, 215, 16, 206, 172, 16, 66, 0, 192, - 82, 68, 198, 199, 0, 198, 3, 0, 0, 0, 149, 143, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_result_dep_b_t* test_msg = - (msg_acq_result_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cf = -8241.943359375; - test_msg->cp = 843.0; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 3; - test_msg->snr = 36.16875457763672; - sbp_payload_send(&sbp_state, 0x14, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x14, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_result_dep_b_t* check_msg = - (msg_acq_result_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cf * 100 - -8241.94335938 * 100) < 0.05, - "incorrect value for cf, expected -8241.94335938, is %f", - check_msg->cf); - ck_assert_msg((check_msg->cp * 100 - 843.0 * 100) < 0.05, - "incorrect value for cp, expected 843.0, is %f", - check_msg->cp); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 3, - "incorrect value for sid.sat, expected 3, is %d", - check_msg->sid.sat); - ck_assert_msg((check_msg->snr * 100 - 36.1687545776 * 100) < 0.05, - "incorrect value for snr, expected 36.1687545776, is %f", - check_msg->snr); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x14, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x14, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 20, 0, 246, 215, 16, 228, 27, 15, 66, 0, 128, - 70, 68, 228, 74, 148, 69, 18, 0, 0, 0, 179, 155, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_result_dep_b_t* test_msg = - (msg_acq_result_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cf = 4745.361328125; - test_msg->cp = 794.0; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 18; - test_msg->snr = 35.77723693847656; - sbp_payload_send(&sbp_state, 0x14, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x14, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_result_dep_b_t* check_msg = - (msg_acq_result_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cf * 100 - 4745.36132812 * 100) < 0.05, - "incorrect value for cf, expected 4745.36132812, is %f", - check_msg->cf); - ck_assert_msg((check_msg->cp * 100 - 794.0 * 100) < 0.05, - "incorrect value for cp, expected 794.0, is %f", - check_msg->cp); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 18, - "incorrect value for sid.sat, expected 18, is %d", - check_msg->sid.sat); - ck_assert_msg((check_msg->snr * 100 - 35.7772369385 * 100) < 0.05, - "incorrect value for snr, expected 35.7772369385, is %f", - check_msg->snr); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x14, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x14, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 20, 0, 246, 215, 16, 46, 199, 14, 66, 0, 64, - 129, 67, 240, 24, 28, 69, 17, 0, 0, 0, 18, 181, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_result_dep_b_t* test_msg = - (msg_acq_result_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cf = 2497.55859375; - test_msg->cp = 258.5; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 17; - test_msg->snr = 35.69451141357422; - sbp_payload_send(&sbp_state, 0x14, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x14, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_result_dep_b_t* check_msg = - (msg_acq_result_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cf * 100 - 2497.55859375 * 100) < 0.05, - "incorrect value for cf, expected 2497.55859375, is %f", - check_msg->cf); - ck_assert_msg((check_msg->cp * 100 - 258.5 * 100) < 0.05, - "incorrect value for cp, expected 258.5, is %f", - check_msg->cp); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 17, - "incorrect value for sid.sat, expected 17, is %d", - check_msg->sid.sat); - ck_assert_msg((check_msg->snr * 100 - 35.6945114136 * 100) < 0.05, - "incorrect value for snr, expected 35.6945114136, is %f", - check_msg->snr); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x14, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x14, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 20, 0, 246, 215, 16, 194, 24, 14, 66, 0, 128, - 2, 68, 129, 193, 249, 195, 5, 0, 0, 0, 35, 203, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_result_dep_b_t* test_msg = - (msg_acq_result_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cf = -499.5117492675781; - test_msg->cp = 522.0; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 5; - test_msg->snr = 35.52417755126953; - sbp_payload_send(&sbp_state, 0x14, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x14, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_result_dep_b_t* check_msg = - (msg_acq_result_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cf * 100 - -499.511749268 * 100) < 0.05, - "incorrect value for cf, expected -499.511749268, is %f", - check_msg->cf); - ck_assert_msg((check_msg->cp * 100 - 522.0 * 100) < 0.05, - "incorrect value for cp, expected 522.0, is %f", - check_msg->cp); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 5, - "incorrect value for sid.sat, expected 5, is %d", - check_msg->sid.sat); - ck_assert_msg((check_msg->snr * 100 - 35.5241775513 * 100) < 0.05, - "incorrect value for snr, expected 35.5241775513, is %f", - check_msg->snr); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_acquisition_MsgAcqResultDepB_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_acquisition_MsgAcqResultDepB"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_acquisition_MsgAcqResultDepC.c b/c/test/legacy/auto_check_sbp_acquisition_MsgAcqResultDepC.c deleted file mode 100644 index 6b3a5d008d..0000000000 --- a/c/test/legacy/auto_check_sbp_acquisition_MsgAcqResultDepC.c +++ /dev/null @@ -1,680 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/acquisition/test_MsgAcqResultDepC.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x1f, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x1f, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 31, 0, 40, 12, 16, 72, 9, 34, 66, 155, 152, - 228, 67, 28, 34, 221, 68, 10, 0, 0, 0, 9, 189, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_result_dep_c_t* test_msg = - (msg_acq_result_dep_c_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cf = 1769.06591796875; - test_msg->cn0 = 40.509063720703125; - test_msg->cp = 457.1922302246094; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 10; - sbp_payload_send(&sbp_state, 0x1f, 3112, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 3112, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 3112, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x1f, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_result_dep_c_t* check_msg = - (msg_acq_result_dep_c_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cf * 100 - 1769.06591797 * 100) < 0.05, - "incorrect value for cf, expected 1769.06591797, is %f", - check_msg->cf); - ck_assert_msg((check_msg->cn0 * 100 - 40.5090637207 * 100) < 0.05, - "incorrect value for cn0, expected 40.5090637207, is %f", - check_msg->cn0); - ck_assert_msg((check_msg->cp * 100 - 457.192230225 * 100) < 0.05, - "incorrect value for cp, expected 457.192230225, is %f", - check_msg->cp); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 10, - "incorrect value for sid.sat, expected 10, is %d", - check_msg->sid.sat); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x1f, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x1f, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 31, 0, 40, 12, 16, 132, 250, 45, 66, 207, 93, - 88, 68, 68, 185, 252, 195, 6, 0, 0, 0, 136, 185, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_result_dep_c_t* test_msg = - (msg_acq_result_dep_c_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cf = -505.4473876953125; - test_msg->cn0 = 43.49464416503906; - test_msg->cp = 865.4657592773438; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 6; - sbp_payload_send(&sbp_state, 0x1f, 3112, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 3112, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 3112, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x1f, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_result_dep_c_t* check_msg = - (msg_acq_result_dep_c_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cf * 100 - -505.447387695 * 100) < 0.05, - "incorrect value for cf, expected -505.447387695, is %f", - check_msg->cf); - ck_assert_msg((check_msg->cn0 * 100 - 43.494644165 * 100) < 0.05, - "incorrect value for cn0, expected 43.494644165, is %f", - check_msg->cn0); - ck_assert_msg((check_msg->cp * 100 - 865.465759277 * 100) < 0.05, - "incorrect value for cp, expected 865.465759277, is %f", - check_msg->cp); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 6, - "incorrect value for sid.sat, expected 6, is %d", - check_msg->sid.sat); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x1f, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x1f, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 31, 0, 40, 12, 16, 163, 223, 24, 66, 64, 91, - 102, 67, 202, 243, 157, 196, 13, 0, 0, 0, 150, 161, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_result_dep_c_t* test_msg = - (msg_acq_result_dep_c_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cf = -1263.618408203125; - test_msg->cn0 = 38.2183952331543; - test_msg->cp = 230.3564453125; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 13; - sbp_payload_send(&sbp_state, 0x1f, 3112, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 3112, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 3112, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x1f, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_result_dep_c_t* check_msg = - (msg_acq_result_dep_c_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cf * 100 - -1263.6184082 * 100) < 0.05, - "incorrect value for cf, expected -1263.6184082, is %f", - check_msg->cf); - ck_assert_msg((check_msg->cn0 * 100 - 38.2183952332 * 100) < 0.05, - "incorrect value for cn0, expected 38.2183952332, is %f", - check_msg->cn0); - ck_assert_msg((check_msg->cp * 100 - 230.356445312 * 100) < 0.05, - "incorrect value for cp, expected 230.356445312, is %f", - check_msg->cp); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 13, - "incorrect value for sid.sat, expected 13, is %d", - check_msg->sid.sat); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x1f, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x1f, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 31, 0, 40, 12, 16, 129, 65, 21, 66, 224, 214, - 124, 67, 243, 138, 61, 69, 1, 0, 0, 0, 109, 209, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_result_dep_c_t* test_msg = - (msg_acq_result_dep_c_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cf = 3032.684326171875; - test_msg->cn0 = 37.313968658447266; - test_msg->cp = 252.83935546875; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 1; - sbp_payload_send(&sbp_state, 0x1f, 3112, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 3112, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 3112, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x1f, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_result_dep_c_t* check_msg = - (msg_acq_result_dep_c_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cf * 100 - 3032.68432617 * 100) < 0.05, - "incorrect value for cf, expected 3032.68432617, is %f", - check_msg->cf); - ck_assert_msg((check_msg->cn0 * 100 - 37.3139686584 * 100) < 0.05, - "incorrect value for cn0, expected 37.3139686584, is %f", - check_msg->cn0); - ck_assert_msg((check_msg->cp * 100 - 252.839355469 * 100) < 0.05, - "incorrect value for cp, expected 252.839355469, is %f", - check_msg->cp); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 1, - "incorrect value for sid.sat, expected 1, is %d", - check_msg->sid.sat); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x1f, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x1f, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 31, 0, 40, 12, 16, 126, 35, 62, 66, 226, 37, - 102, 68, 202, 243, 29, 69, 27, 0, 0, 0, 91, 67, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_result_dep_c_t* test_msg = - (msg_acq_result_dep_c_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cf = 2527.23681640625; - test_msg->cn0 = 47.53466033935547; - test_msg->cp = 920.5919189453125; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 27; - sbp_payload_send(&sbp_state, 0x1f, 3112, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 3112, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 3112, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x1f, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_result_dep_c_t* check_msg = - (msg_acq_result_dep_c_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cf * 100 - 2527.23681641 * 100) < 0.05, - "incorrect value for cf, expected 2527.23681641, is %f", - check_msg->cf); - ck_assert_msg((check_msg->cn0 * 100 - 47.5346603394 * 100) < 0.05, - "incorrect value for cn0, expected 47.5346603394, is %f", - check_msg->cn0); - ck_assert_msg((check_msg->cp * 100 - 920.591918945 * 100) < 0.05, - "incorrect value for cp, expected 920.591918945, is %f", - check_msg->cp); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 27, - "incorrect value for sid.sat, expected 27, is %d", - check_msg->sid.sat); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_acquisition_MsgAcqResultDepC_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_acquisition_MsgAcqResultDepC"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_acquisition_MsgAcqSvProfile.c b/c/test/legacy/auto_check_sbp_acquisition_MsgAcqSvProfile.c deleted file mode 100644 index 59912bd3ac..0000000000 --- a/c/test/legacy/auto_check_sbp_acquisition_MsgAcqSvProfile.c +++ /dev/null @@ -1,428 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/acquisition/test_MsgAcqSvProfile.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_acquisition_MsgAcqSvProfile) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x2e, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x2e, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 46, 0, 195, 4, 99, 7, 13, 38, 0, 97, 22, 0, 174, - 0, 52, 0, 0, 0, 49, 0, 0, 0, 61, 0, 0, 0, 147, - 0, 0, 0, 47, 0, 0, 0, 140, 0, 0, 0, 166, 210, 59, - 0, 253, 23, 1, 121, 0, 190, 0, 0, 0, 175, 0, 0, 0, - 175, 0, 0, 0, 142, 0, 0, 0, 237, 0, 0, 0, 12, 0, - 0, 0, 126, 88, 21, 0, 153, 24, 0, 8, 0, 130, 0, 0, - 0, 172, 0, 0, 0, 91, 0, 0, 0, 191, 0, 0, 0, 84, - 0, 0, 0, 82, 0, 0, 0, 168, 177, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_sv_profile_t *test_msg = (msg_acq_sv_profile_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->acq_sv_profile) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acq_sv_profile[0]); - } - test_msg->acq_sv_profile[0].bin_width = 174; - test_msg->acq_sv_profile[0].cf = 47; - test_msg->acq_sv_profile[0].cf_max = 147; - test_msg->acq_sv_profile[0].cf_min = 61; - test_msg->acq_sv_profile[0].cn0 = 38; - test_msg->acq_sv_profile[0].cp = 140; - test_msg->acq_sv_profile[0].int_time = 97; - test_msg->acq_sv_profile[0].job_type = 7; - test_msg->acq_sv_profile[0].sid.code = 0; - test_msg->acq_sv_profile[0].sid.sat = 22; - test_msg->acq_sv_profile[0].status = 13; - test_msg->acq_sv_profile[0].time_spent = 49; - test_msg->acq_sv_profile[0].timestamp = 52; - if (sizeof(test_msg->acq_sv_profile) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acq_sv_profile[0]); - } - test_msg->acq_sv_profile[1].bin_width = 121; - test_msg->acq_sv_profile[1].cf = 237; - test_msg->acq_sv_profile[1].cf_max = 142; - test_msg->acq_sv_profile[1].cf_min = 175; - test_msg->acq_sv_profile[1].cn0 = 59; - test_msg->acq_sv_profile[1].cp = 12; - test_msg->acq_sv_profile[1].int_time = 253; - test_msg->acq_sv_profile[1].job_type = 166; - test_msg->acq_sv_profile[1].sid.code = 1; - test_msg->acq_sv_profile[1].sid.sat = 23; - test_msg->acq_sv_profile[1].status = 210; - test_msg->acq_sv_profile[1].time_spent = 175; - test_msg->acq_sv_profile[1].timestamp = 190; - if (sizeof(test_msg->acq_sv_profile) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acq_sv_profile[0]); - } - test_msg->acq_sv_profile[2].bin_width = 8; - test_msg->acq_sv_profile[2].cf = 84; - test_msg->acq_sv_profile[2].cf_max = 191; - test_msg->acq_sv_profile[2].cf_min = 91; - test_msg->acq_sv_profile[2].cn0 = 21; - test_msg->acq_sv_profile[2].cp = 82; - test_msg->acq_sv_profile[2].int_time = 153; - test_msg->acq_sv_profile[2].job_type = 126; - test_msg->acq_sv_profile[2].sid.code = 0; - test_msg->acq_sv_profile[2].sid.sat = 24; - test_msg->acq_sv_profile[2].status = 88; - test_msg->acq_sv_profile[2].time_spent = 172; - test_msg->acq_sv_profile[2].timestamp = 130; - sbp_payload_send(&sbp_state, 0x2e, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x2e, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_sv_profile_t *check_msg = - (msg_acq_sv_profile_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - check_msg->acq_sv_profile[0].bin_width == 174, - "incorrect value for acq_sv_profile[0].bin_width, expected 174, is %d", - check_msg->acq_sv_profile[0].bin_width); - ck_assert_msg( - check_msg->acq_sv_profile[0].cf == 47, - "incorrect value for acq_sv_profile[0].cf, expected 47, is %d", - check_msg->acq_sv_profile[0].cf); - ck_assert_msg( - check_msg->acq_sv_profile[0].cf_max == 147, - "incorrect value for acq_sv_profile[0].cf_max, expected 147, is %d", - check_msg->acq_sv_profile[0].cf_max); - ck_assert_msg( - check_msg->acq_sv_profile[0].cf_min == 61, - "incorrect value for acq_sv_profile[0].cf_min, expected 61, is %d", - check_msg->acq_sv_profile[0].cf_min); - ck_assert_msg( - check_msg->acq_sv_profile[0].cn0 == 38, - "incorrect value for acq_sv_profile[0].cn0, expected 38, is %d", - check_msg->acq_sv_profile[0].cn0); - ck_assert_msg( - check_msg->acq_sv_profile[0].cp == 140, - "incorrect value for acq_sv_profile[0].cp, expected 140, is %d", - check_msg->acq_sv_profile[0].cp); - ck_assert_msg( - check_msg->acq_sv_profile[0].int_time == 97, - "incorrect value for acq_sv_profile[0].int_time, expected 97, is %d", - check_msg->acq_sv_profile[0].int_time); - ck_assert_msg( - check_msg->acq_sv_profile[0].job_type == 7, - "incorrect value for acq_sv_profile[0].job_type, expected 7, is %d", - check_msg->acq_sv_profile[0].job_type); - ck_assert_msg( - check_msg->acq_sv_profile[0].sid.code == 0, - "incorrect value for acq_sv_profile[0].sid.code, expected 0, is %d", - check_msg->acq_sv_profile[0].sid.code); - ck_assert_msg( - check_msg->acq_sv_profile[0].sid.sat == 22, - "incorrect value for acq_sv_profile[0].sid.sat, expected 22, is %d", - check_msg->acq_sv_profile[0].sid.sat); - ck_assert_msg( - check_msg->acq_sv_profile[0].status == 13, - "incorrect value for acq_sv_profile[0].status, expected 13, is %d", - check_msg->acq_sv_profile[0].status); - ck_assert_msg( - check_msg->acq_sv_profile[0].time_spent == 49, - "incorrect value for acq_sv_profile[0].time_spent, expected 49, is %d", - check_msg->acq_sv_profile[0].time_spent); - ck_assert_msg( - check_msg->acq_sv_profile[0].timestamp == 52, - "incorrect value for acq_sv_profile[0].timestamp, expected 52, is %d", - check_msg->acq_sv_profile[0].timestamp); - ck_assert_msg( - check_msg->acq_sv_profile[1].bin_width == 121, - "incorrect value for acq_sv_profile[1].bin_width, expected 121, is %d", - check_msg->acq_sv_profile[1].bin_width); - ck_assert_msg( - check_msg->acq_sv_profile[1].cf == 237, - "incorrect value for acq_sv_profile[1].cf, expected 237, is %d", - check_msg->acq_sv_profile[1].cf); - ck_assert_msg( - check_msg->acq_sv_profile[1].cf_max == 142, - "incorrect value for acq_sv_profile[1].cf_max, expected 142, is %d", - check_msg->acq_sv_profile[1].cf_max); - ck_assert_msg( - check_msg->acq_sv_profile[1].cf_min == 175, - "incorrect value for acq_sv_profile[1].cf_min, expected 175, is %d", - check_msg->acq_sv_profile[1].cf_min); - ck_assert_msg( - check_msg->acq_sv_profile[1].cn0 == 59, - "incorrect value for acq_sv_profile[1].cn0, expected 59, is %d", - check_msg->acq_sv_profile[1].cn0); - ck_assert_msg( - check_msg->acq_sv_profile[1].cp == 12, - "incorrect value for acq_sv_profile[1].cp, expected 12, is %d", - check_msg->acq_sv_profile[1].cp); - ck_assert_msg( - check_msg->acq_sv_profile[1].int_time == 253, - "incorrect value for acq_sv_profile[1].int_time, expected 253, is %d", - check_msg->acq_sv_profile[1].int_time); - ck_assert_msg( - check_msg->acq_sv_profile[1].job_type == 166, - "incorrect value for acq_sv_profile[1].job_type, expected 166, is %d", - check_msg->acq_sv_profile[1].job_type); - ck_assert_msg( - check_msg->acq_sv_profile[1].sid.code == 1, - "incorrect value for acq_sv_profile[1].sid.code, expected 1, is %d", - check_msg->acq_sv_profile[1].sid.code); - ck_assert_msg( - check_msg->acq_sv_profile[1].sid.sat == 23, - "incorrect value for acq_sv_profile[1].sid.sat, expected 23, is %d", - check_msg->acq_sv_profile[1].sid.sat); - ck_assert_msg( - check_msg->acq_sv_profile[1].status == 210, - "incorrect value for acq_sv_profile[1].status, expected 210, is %d", - check_msg->acq_sv_profile[1].status); - ck_assert_msg( - check_msg->acq_sv_profile[1].time_spent == 175, - "incorrect value for acq_sv_profile[1].time_spent, expected 175, is %d", - check_msg->acq_sv_profile[1].time_spent); - ck_assert_msg( - check_msg->acq_sv_profile[1].timestamp == 190, - "incorrect value for acq_sv_profile[1].timestamp, expected 190, is %d", - check_msg->acq_sv_profile[1].timestamp); - ck_assert_msg( - check_msg->acq_sv_profile[2].bin_width == 8, - "incorrect value for acq_sv_profile[2].bin_width, expected 8, is %d", - check_msg->acq_sv_profile[2].bin_width); - ck_assert_msg( - check_msg->acq_sv_profile[2].cf == 84, - "incorrect value for acq_sv_profile[2].cf, expected 84, is %d", - check_msg->acq_sv_profile[2].cf); - ck_assert_msg( - check_msg->acq_sv_profile[2].cf_max == 191, - "incorrect value for acq_sv_profile[2].cf_max, expected 191, is %d", - check_msg->acq_sv_profile[2].cf_max); - ck_assert_msg( - check_msg->acq_sv_profile[2].cf_min == 91, - "incorrect value for acq_sv_profile[2].cf_min, expected 91, is %d", - check_msg->acq_sv_profile[2].cf_min); - ck_assert_msg( - check_msg->acq_sv_profile[2].cn0 == 21, - "incorrect value for acq_sv_profile[2].cn0, expected 21, is %d", - check_msg->acq_sv_profile[2].cn0); - ck_assert_msg( - check_msg->acq_sv_profile[2].cp == 82, - "incorrect value for acq_sv_profile[2].cp, expected 82, is %d", - check_msg->acq_sv_profile[2].cp); - ck_assert_msg( - check_msg->acq_sv_profile[2].int_time == 153, - "incorrect value for acq_sv_profile[2].int_time, expected 153, is %d", - check_msg->acq_sv_profile[2].int_time); - ck_assert_msg( - check_msg->acq_sv_profile[2].job_type == 126, - "incorrect value for acq_sv_profile[2].job_type, expected 126, is %d", - check_msg->acq_sv_profile[2].job_type); - ck_assert_msg( - check_msg->acq_sv_profile[2].sid.code == 0, - "incorrect value for acq_sv_profile[2].sid.code, expected 0, is %d", - check_msg->acq_sv_profile[2].sid.code); - ck_assert_msg( - check_msg->acq_sv_profile[2].sid.sat == 24, - "incorrect value for acq_sv_profile[2].sid.sat, expected 24, is %d", - check_msg->acq_sv_profile[2].sid.sat); - ck_assert_msg( - check_msg->acq_sv_profile[2].status == 88, - "incorrect value for acq_sv_profile[2].status, expected 88, is %d", - check_msg->acq_sv_profile[2].status); - ck_assert_msg( - check_msg->acq_sv_profile[2].time_spent == 172, - "incorrect value for acq_sv_profile[2].time_spent, expected 172, is %d", - check_msg->acq_sv_profile[2].time_spent); - ck_assert_msg( - check_msg->acq_sv_profile[2].timestamp == 130, - "incorrect value for acq_sv_profile[2].timestamp, expected 130, is %d", - check_msg->acq_sv_profile[2].timestamp); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_acquisition_MsgAcqSvProfile_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_acquisition_MsgAcqSvProfile"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_acquisition_MsgAcqSvProfile"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_acquisition_MsgAcqSvProfile); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_acquisition_MsgAcqSvProfileDep.c b/c/test/legacy/auto_check_sbp_acquisition_MsgAcqSvProfileDep.c deleted file mode 100644 index 2826e8f821..0000000000 --- a/c/test/legacy/auto_check_sbp_acquisition_MsgAcqSvProfileDep.c +++ /dev/null @@ -1,444 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/acquisition/test_MsgAcqSvProfileDep.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_acquisition_MsgAcqSvProfileDep) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x1e, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x1e, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 30, 0, 195, 4, 105, 67, 103, 151, 0, 12, 22, 0, 0, 0, - 187, 0, 91, 0, 0, 0, 75, 0, 0, 0, 132, 0, 0, 0, 36, - 0, 0, 0, 60, 0, 0, 0, 241, 0, 0, 0, 238, 38, 111, 0, - 179, 23, 0, 1, 0, 176, 0, 166, 0, 0, 0, 234, 0, 0, 0, - 155, 0, 0, 0, 24, 0, 0, 0, 212, 0, 0, 0, 247, 0, 0, - 0, 142, 213, 68, 0, 53, 24, 0, 0, 0, 52, 0, 49, 0, 0, - 0, 245, 0, 0, 0, 76, 0, 0, 0, 248, 0, 0, 0, 212, 0, - 0, 0, 101, 0, 0, 0, 67, 132, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acq_sv_profile_dep_t *test_msg = - (msg_acq_sv_profile_dep_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->acq_sv_profile) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acq_sv_profile[0]); - } - test_msg->acq_sv_profile[0].bin_width = 187; - test_msg->acq_sv_profile[0].cf = 60; - test_msg->acq_sv_profile[0].cf_max = 36; - test_msg->acq_sv_profile[0].cf_min = 132; - test_msg->acq_sv_profile[0].cn0 = 151; - test_msg->acq_sv_profile[0].cp = 241; - test_msg->acq_sv_profile[0].int_time = 12; - test_msg->acq_sv_profile[0].job_type = 67; - test_msg->acq_sv_profile[0].sid.code = 0; - test_msg->acq_sv_profile[0].sid.reserved = 0; - test_msg->acq_sv_profile[0].sid.sat = 22; - test_msg->acq_sv_profile[0].status = 103; - test_msg->acq_sv_profile[0].time_spent = 75; - test_msg->acq_sv_profile[0].timestamp = 91; - if (sizeof(test_msg->acq_sv_profile) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acq_sv_profile[0]); - } - test_msg->acq_sv_profile[1].bin_width = 176; - test_msg->acq_sv_profile[1].cf = 212; - test_msg->acq_sv_profile[1].cf_max = 24; - test_msg->acq_sv_profile[1].cf_min = 155; - test_msg->acq_sv_profile[1].cn0 = 111; - test_msg->acq_sv_profile[1].cp = 247; - test_msg->acq_sv_profile[1].int_time = 179; - test_msg->acq_sv_profile[1].job_type = 238; - test_msg->acq_sv_profile[1].sid.code = 1; - test_msg->acq_sv_profile[1].sid.reserved = 0; - test_msg->acq_sv_profile[1].sid.sat = 23; - test_msg->acq_sv_profile[1].status = 38; - test_msg->acq_sv_profile[1].time_spent = 234; - test_msg->acq_sv_profile[1].timestamp = 166; - if (sizeof(test_msg->acq_sv_profile) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acq_sv_profile[0]); - } - test_msg->acq_sv_profile[2].bin_width = 52; - test_msg->acq_sv_profile[2].cf = 212; - test_msg->acq_sv_profile[2].cf_max = 248; - test_msg->acq_sv_profile[2].cf_min = 76; - test_msg->acq_sv_profile[2].cn0 = 68; - test_msg->acq_sv_profile[2].cp = 101; - test_msg->acq_sv_profile[2].int_time = 53; - test_msg->acq_sv_profile[2].job_type = 142; - test_msg->acq_sv_profile[2].sid.code = 0; - test_msg->acq_sv_profile[2].sid.reserved = 0; - test_msg->acq_sv_profile[2].sid.sat = 24; - test_msg->acq_sv_profile[2].status = 213; - test_msg->acq_sv_profile[2].time_spent = 245; - test_msg->acq_sv_profile[2].timestamp = 49; - sbp_payload_send(&sbp_state, 0x1e, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x1e, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acq_sv_profile_dep_t *check_msg = - (msg_acq_sv_profile_dep_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - check_msg->acq_sv_profile[0].bin_width == 187, - "incorrect value for acq_sv_profile[0].bin_width, expected 187, is %d", - check_msg->acq_sv_profile[0].bin_width); - ck_assert_msg( - check_msg->acq_sv_profile[0].cf == 60, - "incorrect value for acq_sv_profile[0].cf, expected 60, is %d", - check_msg->acq_sv_profile[0].cf); - ck_assert_msg( - check_msg->acq_sv_profile[0].cf_max == 36, - "incorrect value for acq_sv_profile[0].cf_max, expected 36, is %d", - check_msg->acq_sv_profile[0].cf_max); - ck_assert_msg( - check_msg->acq_sv_profile[0].cf_min == 132, - "incorrect value for acq_sv_profile[0].cf_min, expected 132, is %d", - check_msg->acq_sv_profile[0].cf_min); - ck_assert_msg( - check_msg->acq_sv_profile[0].cn0 == 151, - "incorrect value for acq_sv_profile[0].cn0, expected 151, is %d", - check_msg->acq_sv_profile[0].cn0); - ck_assert_msg( - check_msg->acq_sv_profile[0].cp == 241, - "incorrect value for acq_sv_profile[0].cp, expected 241, is %d", - check_msg->acq_sv_profile[0].cp); - ck_assert_msg( - check_msg->acq_sv_profile[0].int_time == 12, - "incorrect value for acq_sv_profile[0].int_time, expected 12, is %d", - check_msg->acq_sv_profile[0].int_time); - ck_assert_msg( - check_msg->acq_sv_profile[0].job_type == 67, - "incorrect value for acq_sv_profile[0].job_type, expected 67, is %d", - check_msg->acq_sv_profile[0].job_type); - ck_assert_msg( - check_msg->acq_sv_profile[0].sid.code == 0, - "incorrect value for acq_sv_profile[0].sid.code, expected 0, is %d", - check_msg->acq_sv_profile[0].sid.code); - ck_assert_msg( - check_msg->acq_sv_profile[0].sid.reserved == 0, - "incorrect value for acq_sv_profile[0].sid.reserved, expected 0, is %d", - check_msg->acq_sv_profile[0].sid.reserved); - ck_assert_msg( - check_msg->acq_sv_profile[0].sid.sat == 22, - "incorrect value for acq_sv_profile[0].sid.sat, expected 22, is %d", - check_msg->acq_sv_profile[0].sid.sat); - ck_assert_msg( - check_msg->acq_sv_profile[0].status == 103, - "incorrect value for acq_sv_profile[0].status, expected 103, is %d", - check_msg->acq_sv_profile[0].status); - ck_assert_msg( - check_msg->acq_sv_profile[0].time_spent == 75, - "incorrect value for acq_sv_profile[0].time_spent, expected 75, is %d", - check_msg->acq_sv_profile[0].time_spent); - ck_assert_msg( - check_msg->acq_sv_profile[0].timestamp == 91, - "incorrect value for acq_sv_profile[0].timestamp, expected 91, is %d", - check_msg->acq_sv_profile[0].timestamp); - ck_assert_msg( - check_msg->acq_sv_profile[1].bin_width == 176, - "incorrect value for acq_sv_profile[1].bin_width, expected 176, is %d", - check_msg->acq_sv_profile[1].bin_width); - ck_assert_msg( - check_msg->acq_sv_profile[1].cf == 212, - "incorrect value for acq_sv_profile[1].cf, expected 212, is %d", - check_msg->acq_sv_profile[1].cf); - ck_assert_msg( - check_msg->acq_sv_profile[1].cf_max == 24, - "incorrect value for acq_sv_profile[1].cf_max, expected 24, is %d", - check_msg->acq_sv_profile[1].cf_max); - ck_assert_msg( - check_msg->acq_sv_profile[1].cf_min == 155, - "incorrect value for acq_sv_profile[1].cf_min, expected 155, is %d", - check_msg->acq_sv_profile[1].cf_min); - ck_assert_msg( - check_msg->acq_sv_profile[1].cn0 == 111, - "incorrect value for acq_sv_profile[1].cn0, expected 111, is %d", - check_msg->acq_sv_profile[1].cn0); - ck_assert_msg( - check_msg->acq_sv_profile[1].cp == 247, - "incorrect value for acq_sv_profile[1].cp, expected 247, is %d", - check_msg->acq_sv_profile[1].cp); - ck_assert_msg( - check_msg->acq_sv_profile[1].int_time == 179, - "incorrect value for acq_sv_profile[1].int_time, expected 179, is %d", - check_msg->acq_sv_profile[1].int_time); - ck_assert_msg( - check_msg->acq_sv_profile[1].job_type == 238, - "incorrect value for acq_sv_profile[1].job_type, expected 238, is %d", - check_msg->acq_sv_profile[1].job_type); - ck_assert_msg( - check_msg->acq_sv_profile[1].sid.code == 1, - "incorrect value for acq_sv_profile[1].sid.code, expected 1, is %d", - check_msg->acq_sv_profile[1].sid.code); - ck_assert_msg( - check_msg->acq_sv_profile[1].sid.reserved == 0, - "incorrect value for acq_sv_profile[1].sid.reserved, expected 0, is %d", - check_msg->acq_sv_profile[1].sid.reserved); - ck_assert_msg( - check_msg->acq_sv_profile[1].sid.sat == 23, - "incorrect value for acq_sv_profile[1].sid.sat, expected 23, is %d", - check_msg->acq_sv_profile[1].sid.sat); - ck_assert_msg( - check_msg->acq_sv_profile[1].status == 38, - "incorrect value for acq_sv_profile[1].status, expected 38, is %d", - check_msg->acq_sv_profile[1].status); - ck_assert_msg( - check_msg->acq_sv_profile[1].time_spent == 234, - "incorrect value for acq_sv_profile[1].time_spent, expected 234, is %d", - check_msg->acq_sv_profile[1].time_spent); - ck_assert_msg( - check_msg->acq_sv_profile[1].timestamp == 166, - "incorrect value for acq_sv_profile[1].timestamp, expected 166, is %d", - check_msg->acq_sv_profile[1].timestamp); - ck_assert_msg( - check_msg->acq_sv_profile[2].bin_width == 52, - "incorrect value for acq_sv_profile[2].bin_width, expected 52, is %d", - check_msg->acq_sv_profile[2].bin_width); - ck_assert_msg( - check_msg->acq_sv_profile[2].cf == 212, - "incorrect value for acq_sv_profile[2].cf, expected 212, is %d", - check_msg->acq_sv_profile[2].cf); - ck_assert_msg( - check_msg->acq_sv_profile[2].cf_max == 248, - "incorrect value for acq_sv_profile[2].cf_max, expected 248, is %d", - check_msg->acq_sv_profile[2].cf_max); - ck_assert_msg( - check_msg->acq_sv_profile[2].cf_min == 76, - "incorrect value for acq_sv_profile[2].cf_min, expected 76, is %d", - check_msg->acq_sv_profile[2].cf_min); - ck_assert_msg( - check_msg->acq_sv_profile[2].cn0 == 68, - "incorrect value for acq_sv_profile[2].cn0, expected 68, is %d", - check_msg->acq_sv_profile[2].cn0); - ck_assert_msg( - check_msg->acq_sv_profile[2].cp == 101, - "incorrect value for acq_sv_profile[2].cp, expected 101, is %d", - check_msg->acq_sv_profile[2].cp); - ck_assert_msg( - check_msg->acq_sv_profile[2].int_time == 53, - "incorrect value for acq_sv_profile[2].int_time, expected 53, is %d", - check_msg->acq_sv_profile[2].int_time); - ck_assert_msg( - check_msg->acq_sv_profile[2].job_type == 142, - "incorrect value for acq_sv_profile[2].job_type, expected 142, is %d", - check_msg->acq_sv_profile[2].job_type); - ck_assert_msg( - check_msg->acq_sv_profile[2].sid.code == 0, - "incorrect value for acq_sv_profile[2].sid.code, expected 0, is %d", - check_msg->acq_sv_profile[2].sid.code); - ck_assert_msg( - check_msg->acq_sv_profile[2].sid.reserved == 0, - "incorrect value for acq_sv_profile[2].sid.reserved, expected 0, is %d", - check_msg->acq_sv_profile[2].sid.reserved); - ck_assert_msg( - check_msg->acq_sv_profile[2].sid.sat == 24, - "incorrect value for acq_sv_profile[2].sid.sat, expected 24, is %d", - check_msg->acq_sv_profile[2].sid.sat); - ck_assert_msg( - check_msg->acq_sv_profile[2].status == 213, - "incorrect value for acq_sv_profile[2].status, expected 213, is %d", - check_msg->acq_sv_profile[2].status); - ck_assert_msg( - check_msg->acq_sv_profile[2].time_spent == 245, - "incorrect value for acq_sv_profile[2].time_spent, expected 245, is %d", - check_msg->acq_sv_profile[2].time_spent); - ck_assert_msg( - check_msg->acq_sv_profile[2].timestamp == 49, - "incorrect value for acq_sv_profile[2].timestamp, expected 49, is %d", - check_msg->acq_sv_profile[2].timestamp); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_acquisition_MsgAcqSvProfileDep_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_acquisition_MsgAcqSvProfileDep"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_acquisition_MsgAcqSvProfileDep"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_acquisition_MsgAcqSvProfileDep); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_bootload_MsgBootloaderHandshakeReq.c b/c/test/legacy/auto_check_sbp_bootload_MsgBootloaderHandshakeReq.c deleted file mode 100644 index 25875df82e..0000000000 --- a/c/test/legacy/auto_check_sbp_bootload_MsgBootloaderHandshakeReq.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/bootload/test_MsgBootloaderHandshakeReq.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeReq) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xb3, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xb3, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 179, 0, 136, 247, 0, 65, 216, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - sbp_payload_send(&sbp_state, 0xb3, 63368, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 63368, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 63368, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xb3, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - } -} -END_TEST - -Suite *legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeReq_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeReq"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_bootload_" - "MsgBootloaderHandshakeReq"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeReq); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_bootload_MsgBootloaderHandshakeResp.c b/c/test/legacy/auto_check_sbp_bootload_MsgBootloaderHandshakeResp.c deleted file mode 100644 index 330e95bcbc..0000000000 --- a/c/test/legacy/auto_check_sbp_bootload_MsgBootloaderHandshakeResp.c +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/bootload/test_MsgBootloaderHandshakeResp.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeResp) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xb4, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xb4, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 180, 0, 0, 0, 9, 0, 0, 0, 0, 118, 49, 46, 50, 10, 201, 1, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_bootloader_handshake_resp_t* test_msg = - (msg_bootloader_handshake_resp_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - { - const char assign_string[] = {(char)118, (char)49, (char)46, (char)50, - (char)10}; - memcpy(test_msg->version, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->version) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0xb4, 0, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 0, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 0, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xb4, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_bootloader_handshake_resp_t* check_msg = - (msg_bootloader_handshake_resp_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - { - const char check_string[] = {(char)118, (char)49, (char)46, (char)50, - (char)10}; - ck_assert_msg( - memcmp(check_msg->version, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->version, expected string '%s', is " - "'%s'", - check_string, check_msg->version); - } - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xb0, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xb0, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 176, 0, 195, 4, 4, 118, 49, 46, 50, 1, 206, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_bootloader_handshake_dep_a_t* test_msg = - (msg_bootloader_handshake_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->handshake) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->handshake[0]); - } - test_msg->handshake[0] = 118; - if (sizeof(test_msg->handshake) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->handshake[0]); - } - test_msg->handshake[1] = 49; - if (sizeof(test_msg->handshake) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->handshake[0]); - } - test_msg->handshake[2] = 46; - if (sizeof(test_msg->handshake) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->handshake[0]); - } - test_msg->handshake[3] = 50; - sbp_payload_send(&sbp_state, 0xb0, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xb0, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_bootloader_handshake_dep_a_t* check_msg = - (msg_bootloader_handshake_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->handshake[0] == 118, - "incorrect value for handshake[0], expected 118, is %d", - check_msg->handshake[0]); - ck_assert_msg(check_msg->handshake[1] == 49, - "incorrect value for handshake[1], expected 49, is %d", - check_msg->handshake[1]); - ck_assert_msg(check_msg->handshake[2] == 46, - "incorrect value for handshake[2], expected 46, is %d", - check_msg->handshake[2]); - ck_assert_msg(check_msg->handshake[3] == 50, - "incorrect value for handshake[3], expected 50, is %d", - check_msg->handshake[3]); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeResp_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeResp"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_bootload_" - "MsgBootloaderHandshakeResp"); - tcase_add_test( - tc_acq, test_legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeResp); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_bootload_MsgBootloaderJumptoApp.c b/c/test/legacy/auto_check_sbp_bootload_MsgBootloaderJumptoApp.c deleted file mode 100644 index 0181df7548..0000000000 --- a/c/test/legacy/auto_check_sbp_bootload_MsgBootloaderJumptoApp.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/bootload/test_MsgBootloaderJumptoApp.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_bootload_MsgBootloaderJumptoApp) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xb1, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xb1, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 177, 0, 205, 18, 1, 216, 105, 96, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_bootloader_jump_to_app_t *test_msg = - (msg_bootloader_jump_to_app_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->jump = 216; - sbp_payload_send(&sbp_state, 0xb1, 4813, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 4813, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 4813, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xb1, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_bootloader_jump_to_app_t *check_msg = - (msg_bootloader_jump_to_app_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->jump == 216, - "incorrect value for jump, expected 216, is %d", - check_msg->jump); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_bootload_MsgBootloaderJumptoApp_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_bootload_MsgBootloaderJumptoApp"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_bootload_MsgBootloaderJumptoApp"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_bootload_MsgBootloaderJumptoApp); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_bootload_MsgNapDeviceDnaReq.c b/c/test/legacy/auto_check_sbp_bootload_MsgNapDeviceDnaReq.c deleted file mode 100644 index 5a74641925..0000000000 --- a/c/test/legacy/auto_check_sbp_bootload_MsgNapDeviceDnaReq.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/bootload/test_MsgNapDeviceDnaReq.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_bootload_MsgNapDeviceDnaReq) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xde, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xde, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 222, 0, 128, 50, 0, 231, 160, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - sbp_payload_send(&sbp_state, 0xde, 12928, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 12928, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 12928, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xde, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - } -} -END_TEST - -Suite *legacy_auto_check_sbp_bootload_MsgNapDeviceDnaReq_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_bootload_MsgNapDeviceDnaReq"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_bootload_MsgNapDeviceDnaReq"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_bootload_MsgNapDeviceDnaReq); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_bootload_MsgNapDeviceDnaResp.c b/c/test/legacy/auto_check_sbp_bootload_MsgNapDeviceDnaResp.c deleted file mode 100644 index cf99c902e2..0000000000 --- a/c/test/legacy/auto_check_sbp_bootload_MsgNapDeviceDnaResp.c +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/bootload/test_MsgNapDeviceDnaResp.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_bootload_MsgNapDeviceDnaResp) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xdd, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xdd, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 221, 0, 169, 56, 8, 2, 187, 1, 130, 173, 244, 67, 122, 70, 91, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_nap_device_dna_resp_t *test_msg = - (msg_nap_device_dna_resp_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->dna) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->dna[0]); - } - test_msg->dna[0] = 2; - if (sizeof(test_msg->dna) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->dna[0]); - } - test_msg->dna[1] = 187; - if (sizeof(test_msg->dna) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->dna[0]); - } - test_msg->dna[2] = 1; - if (sizeof(test_msg->dna) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->dna[0]); - } - test_msg->dna[3] = 130; - if (sizeof(test_msg->dna) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->dna[0]); - } - test_msg->dna[4] = 173; - if (sizeof(test_msg->dna) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->dna[0]); - } - test_msg->dna[5] = 244; - if (sizeof(test_msg->dna) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->dna[0]); - } - test_msg->dna[6] = 67; - if (sizeof(test_msg->dna) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->dna[0]); - } - test_msg->dna[7] = 122; - sbp_payload_send(&sbp_state, 0xdd, 14505, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 14505, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 14505, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xdd, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_nap_device_dna_resp_t *check_msg = - (msg_nap_device_dna_resp_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->dna[0] == 2, - "incorrect value for dna[0], expected 2, is %d", - check_msg->dna[0]); - ck_assert_msg(check_msg->dna[1] == 187, - "incorrect value for dna[1], expected 187, is %d", - check_msg->dna[1]); - ck_assert_msg(check_msg->dna[2] == 1, - "incorrect value for dna[2], expected 1, is %d", - check_msg->dna[2]); - ck_assert_msg(check_msg->dna[3] == 130, - "incorrect value for dna[3], expected 130, is %d", - check_msg->dna[3]); - ck_assert_msg(check_msg->dna[4] == 173, - "incorrect value for dna[4], expected 173, is %d", - check_msg->dna[4]); - ck_assert_msg(check_msg->dna[5] == 244, - "incorrect value for dna[5], expected 244, is %d", - check_msg->dna[5]); - ck_assert_msg(check_msg->dna[6] == 67, - "incorrect value for dna[6], expected 67, is %d", - check_msg->dna[6]); - ck_assert_msg(check_msg->dna[7] == 122, - "incorrect value for dna[7], expected 122, is %d", - check_msg->dna[7]); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_bootload_MsgNapDeviceDnaResp_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_bootload_MsgNapDeviceDnaResp"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_bootload_MsgNapDeviceDnaResp"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_bootload_MsgNapDeviceDnaResp); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ext_events_MsgExtEvent.c b/c/test/legacy/auto_check_sbp_ext_events_MsgExtEvent.c deleted file mode 100644 index edaacbee3c..0000000000 --- a/c/test/legacy/auto_check_sbp_ext_events_MsgExtEvent.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ext_events/test_MsgExtEvent.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ext_events_MsgExtEvent) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x101, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x101, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 1, 1, 245, 6, 12, 48, 7, 199, 216, - 49, 15, 202, 65, 15, 0, 3, 0, 62, 204, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ext_event_t *test_msg = (msg_ext_event_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 3; - test_msg->ns_residual = 999882; - test_msg->pin = 0; - test_msg->tow = 254924999; - test_msg->wn = 1840; - sbp_payload_send(&sbp_state, 0x101, 1781, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1781, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1781, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x101, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ext_event_t *check_msg = (msg_ext_event_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 3, - "incorrect value for flags, expected 3, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 999882, - "incorrect value for ns_residual, expected 999882, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->pin == 0, - "incorrect value for pin, expected 0, is %d", check_msg->pin); - ck_assert_msg(check_msg->tow == 254924999, - "incorrect value for tow, expected 254924999, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1840, - "incorrect value for wn, expected 1840, is %d", - check_msg->wn); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ext_events_MsgExtEvent_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_ext_events_MsgExtEvent"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ext_events_MsgExtEvent"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_ext_events_MsgExtEvent); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_file_io_MsgFileioConfigReq.c b/c/test/legacy/auto_check_sbp_file_io_MsgFileioConfigReq.c deleted file mode 100644 index 560b646483..0000000000 --- a/c/test/legacy/auto_check_sbp_file_io_MsgFileioConfigReq.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/file_io/test_MsgFileioConfigReq.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_file_io_MsgFileioConfigReq) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x1001, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x1001, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 1, 16, 195, 4, 4, 107, 218, 69, 90, 185, 27, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_fileio_config_req_t *test_msg = - (msg_fileio_config_req_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->sequence = 1514527339; - sbp_payload_send(&sbp_state, 0x1001, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x1001, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_fileio_config_req_t *check_msg = - (msg_fileio_config_req_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->sequence == 1514527339, - "incorrect value for sequence, expected 1514527339, is %d", - check_msg->sequence); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_file_io_MsgFileioConfigReq_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_file_io_MsgFileioConfigReq"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_file_io_MsgFileioConfigReq"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_file_io_MsgFileioConfigReq); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_file_io_MsgFileioConfigResp.c b/c/test/legacy/auto_check_sbp_file_io_MsgFileioConfigResp.c deleted file mode 100644 index 68816e0041..0000000000 --- a/c/test/legacy/auto_check_sbp_file_io_MsgFileioConfigResp.c +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/file_io/test_MsgFileioConfigResp.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_file_io_MsgFileioConfigResp) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x1002, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x1002, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 16, 195, 4, 16, 170, 76, 52, 91, 149, 186, - 44, 3, 216, 151, 255, 61, 12, 97, 66, 144, 239, 115, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_fileio_config_resp_t *test_msg = - (msg_fileio_config_resp_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->batch_size = 1040160728; - test_msg->fileio_version = 2420269324; - test_msg->sequence = 1530154154; - test_msg->window_size = 53262997; - sbp_payload_send(&sbp_state, 0x1002, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x1002, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_fileio_config_resp_t *check_msg = - (msg_fileio_config_resp_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->batch_size == 1040160728, - "incorrect value for batch_size, expected 1040160728, is %d", - check_msg->batch_size); - ck_assert_msg( - check_msg->fileio_version == 2420269324, - "incorrect value for fileio_version, expected 2420269324, is %d", - check_msg->fileio_version); - ck_assert_msg(check_msg->sequence == 1530154154, - "incorrect value for sequence, expected 1530154154, is %d", - check_msg->sequence); - ck_assert_msg(check_msg->window_size == 53262997, - "incorrect value for window_size, expected 53262997, is %d", - check_msg->window_size); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_file_io_MsgFileioConfigResp_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_file_io_MsgFileioConfigResp"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_file_io_MsgFileioConfigResp"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_file_io_MsgFileioConfigResp); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_file_io_MsgFileioReadDirReq.c b/c/test/legacy/auto_check_sbp_file_io_MsgFileioReadDirReq.c deleted file mode 100644 index b633df8fcb..0000000000 --- a/c/test/legacy/auto_check_sbp_file_io_MsgFileioReadDirReq.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/file_io/test_MsgFileioReadDirReq.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_file_io_MsgFileioReadDirReq) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xa9, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xa9, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 169, 0, 195, 4, 26, 130, 231, 255, 90, 196, 134, - 47, 134, 47, 115, 111, 109, 101, 47, 114, 97, 110, 100, - 111, 109, 47, 112, 97, 116, 104, 0, 26, 186, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_fileio_read_dir_req_t *test_msg = - (msg_fileio_read_dir_req_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)47, (char)115, (char)111, (char)109, (char)101, (char)47, - (char)114, (char)97, (char)110, (char)100, (char)111, (char)109, - (char)47, (char)112, (char)97, (char)116, (char)104, (char)0}; - memcpy(test_msg->dirname, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->dirname) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->offset = 2251261636; - test_msg->sequence = 1526720386; - sbp_payload_send(&sbp_state, 0xa9, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xa9, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_fileio_read_dir_req_t *check_msg = - (msg_fileio_read_dir_req_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)47, (char)115, (char)111, (char)109, (char)101, (char)47, - (char)114, (char)97, (char)110, (char)100, (char)111, (char)109, - (char)47, (char)112, (char)97, (char)116, (char)104, (char)0}; - ck_assert_msg( - memcmp(check_msg->dirname, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->dirname, expected string '%s', is " - "'%s'", - check_string, check_msg->dirname); - } - ck_assert_msg(check_msg->offset == 2251261636, - "incorrect value for offset, expected 2251261636, is %d", - check_msg->offset); - ck_assert_msg(check_msg->sequence == 1526720386, - "incorrect value for sequence, expected 1526720386, is %d", - check_msg->sequence); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_file_io_MsgFileioReadDirReq_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_file_io_MsgFileioReadDirReq"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_file_io_MsgFileioReadDirReq"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_file_io_MsgFileioReadDirReq); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_file_io_MsgFileioReadDirResp.c b/c/test/legacy/auto_check_sbp_file_io_MsgFileioReadDirResp.c deleted file mode 100644 index 8e67553e7f..0000000000 --- a/c/test/legacy/auto_check_sbp_file_io_MsgFileioReadDirResp.c +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/file_io/test_MsgFileioReadDirResp.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_file_io_MsgFileioReadDirResp) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xaa, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xaa, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 170, 0, 195, 4, 45, 78, 253, 224, 235, 102, 105, 108, 101, - 49, 0, 97, 110, 111, 116, 104, 101, 114, 32, 102, 105, 108, 101, - 0, 100, 101, 102, 105, 110, 105, 116, 101, 108, 121, 32, 110, 111, - 116, 32, 97, 32, 102, 105, 108, 101, 0, 186, 137, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_fileio_read_dir_resp_t *test_msg = - (msg_fileio_read_dir_resp_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)102, (char)105, (char)108, (char)101, (char)49, (char)0, - (char)97, (char)110, (char)111, (char)116, (char)104, (char)101, - (char)114, (char)32, (char)102, (char)105, (char)108, (char)101, - (char)0, (char)100, (char)101, (char)102, (char)105, (char)110, - (char)105, (char)116, (char)101, (char)108, (char)121, (char)32, - (char)110, (char)111, (char)116, (char)32, (char)97, (char)32, - (char)102, (char)105, (char)108, (char)101, (char)0}; - memcpy(test_msg->contents, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->contents) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->sequence = 3957390670; - sbp_payload_send(&sbp_state, 0xaa, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xaa, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_fileio_read_dir_resp_t *check_msg = - (msg_fileio_read_dir_resp_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)102, (char)105, (char)108, (char)101, (char)49, (char)0, - (char)97, (char)110, (char)111, (char)116, (char)104, (char)101, - (char)114, (char)32, (char)102, (char)105, (char)108, (char)101, - (char)0, (char)100, (char)101, (char)102, (char)105, (char)110, - (char)105, (char)116, (char)101, (char)108, (char)121, (char)32, - (char)110, (char)111, (char)116, (char)32, (char)97, (char)32, - (char)102, (char)105, (char)108, (char)101, (char)0}; - ck_assert_msg( - memcmp(check_msg->contents, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->contents, expected string '%s', is " - "'%s'", - check_string, check_msg->contents); - } - ck_assert_msg(check_msg->sequence == 3957390670, - "incorrect value for sequence, expected 3957390670, is %d", - check_msg->sequence); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_file_io_MsgFileioReadDirResp_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_file_io_MsgFileioReadDirResp"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_file_io_MsgFileioReadDirResp"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_file_io_MsgFileioReadDirResp); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_file_io_MsgFileioReadReq.c b/c/test/legacy/auto_check_sbp_file_io_MsgFileioReadReq.c deleted file mode 100644 index 395d06e5ed..0000000000 --- a/c/test/legacy/auto_check_sbp_file_io_MsgFileioReadReq.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/file_io/test_MsgFileioReadReq.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_file_io_MsgFileioReadReq) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xa8, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xa8, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 168, 0, 195, 4, 28, 34, 156, 130, 40, 98, 178, - 190, 23, 53, 47, 112, 97, 116, 104, 47, 116, 111, 47, - 115, 111, 109, 101, 47, 102, 105, 108, 101, 0, 86, 100, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_fileio_read_req_t *test_msg = (msg_fileio_read_req_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->chunk_size = 53; - { - const char assign_string[] = {(char)47, (char)112, (char)97, (char)116, - (char)104, (char)47, (char)116, (char)111, - (char)47, (char)115, (char)111, (char)109, - (char)101, (char)47, (char)102, (char)105, - (char)108, (char)101, (char)0}; - memcpy(test_msg->filename, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->filename) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->offset = 398373474; - test_msg->sequence = 679648290; - sbp_payload_send(&sbp_state, 0xa8, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xa8, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_fileio_read_req_t *check_msg = - (msg_fileio_read_req_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->chunk_size == 53, - "incorrect value for chunk_size, expected 53, is %d", - check_msg->chunk_size); - { - const char check_string[] = {(char)47, (char)112, (char)97, (char)116, - (char)104, (char)47, (char)116, (char)111, - (char)47, (char)115, (char)111, (char)109, - (char)101, (char)47, (char)102, (char)105, - (char)108, (char)101, (char)0}; - ck_assert_msg( - memcmp(check_msg->filename, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->filename, expected string '%s', is " - "'%s'", - check_string, check_msg->filename); - } - ck_assert_msg(check_msg->offset == 398373474, - "incorrect value for offset, expected 398373474, is %d", - check_msg->offset); - ck_assert_msg(check_msg->sequence == 679648290, - "incorrect value for sequence, expected 679648290, is %d", - check_msg->sequence); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_file_io_MsgFileioReadReq_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_file_io_MsgFileioReadReq"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_file_io_MsgFileioReadReq"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_file_io_MsgFileioReadReq); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_file_io_MsgFileioReadResp.c b/c/test/legacy/auto_check_sbp_file_io_MsgFileioReadResp.c deleted file mode 100644 index c5d3e4b597..0000000000 --- a/c/test/legacy/auto_check_sbp_file_io_MsgFileioReadResp.c +++ /dev/null @@ -1,2244 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/file_io/test_MsgFileioReadResp.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_file_io_MsgFileioReadResp) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xa3, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xa3, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 163, 0, 195, 4, 255, 67, 183, 115, 15, 73, 231, 227, 179, - 18, 76, 68, 229, 216, 21, 98, 183, 69, 190, 5, 252, 176, 55, - 32, 78, 8, 52, 127, 50, 71, 106, 61, 79, 191, 106, 46, 79, - 118, 248, 118, 207, 206, 210, 91, 73, 251, 81, 131, 205, 193, 146, - 206, 185, 140, 249, 163, 231, 65, 67, 94, 250, 109, 152, 95, 123, - 77, 224, 124, 238, 205, 65, 103, 35, 104, 209, 5, 191, 47, 249, - 176, 166, 213, 46, 192, 86, 32, 103, 146, 252, 4, 16, 54, 161, - 60, 6, 13, 191, 116, 182, 42, 191, 213, 20, 217, 8, 142, 187, - 238, 120, 184, 250, 31, 151, 37, 51, 177, 130, 190, 155, 71, 68, - 56, 238, 92, 130, 37, 137, 146, 246, 114, 116, 138, 165, 217, 79, - 10, 189, 128, 189, 2, 240, 92, 28, 126, 105, 236, 228, 194, 0, - 51, 61, 74, 41, 10, 239, 133, 106, 190, 30, 27, 3, 240, 205, - 253, 113, 25, 28, 187, 81, 101, 216, 121, 41, 179, 120, 152, 18, - 116, 53, 212, 100, 2, 114, 198, 200, 10, 147, 25, 33, 115, 208, - 113, 60, 179, 183, 0, 41, 217, 206, 255, 211, 225, 142, 191, 133, - 81, 15, 248, 193, 66, 191, 244, 221, 248, 199, 241, 112, 51, 1, - 180, 180, 125, 97, 145, 25, 72, 210, 215, 208, 15, 126, 56, 38, - 65, 4, 64, 19, 74, 223, 111, 109, 52, 43, 167, 186, 202, 111, - 11, 91, 21, 236, 234, 196, 36, 171, 147, 10, 240, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_fileio_read_resp_t *test_msg = - (msg_fileio_read_resp_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[0] = 73; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[1] = 231; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[2] = 227; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[3] = 179; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[4] = 18; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[5] = 76; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[6] = 68; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[7] = 229; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[8] = 216; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[9] = 21; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[10] = 98; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[11] = 183; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[12] = 69; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[13] = 190; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[14] = 5; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[15] = 252; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[16] = 176; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[17] = 55; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[18] = 32; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[19] = 78; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[20] = 8; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[21] = 52; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[22] = 127; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[23] = 50; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[24] = 71; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[25] = 106; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[26] = 61; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[27] = 79; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[28] = 191; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[29] = 106; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[30] = 46; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[31] = 79; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[32] = 118; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[33] = 248; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[34] = 118; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[35] = 207; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[36] = 206; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[37] = 210; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[38] = 91; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[39] = 73; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[40] = 251; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[41] = 81; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[42] = 131; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[43] = 205; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[44] = 193; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[45] = 146; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[46] = 206; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[47] = 185; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[48] = 140; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[49] = 249; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[50] = 163; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[51] = 231; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[52] = 65; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[53] = 67; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[54] = 94; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[55] = 250; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[56] = 109; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[57] = 152; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[58] = 95; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[59] = 123; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[60] = 77; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[61] = 224; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[62] = 124; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[63] = 238; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[64] = 205; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[65] = 65; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[66] = 103; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[67] = 35; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[68] = 104; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[69] = 209; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[70] = 5; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[71] = 191; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[72] = 47; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[73] = 249; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[74] = 176; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[75] = 166; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[76] = 213; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[77] = 46; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[78] = 192; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[79] = 86; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[80] = 32; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[81] = 103; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[82] = 146; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[83] = 252; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[84] = 4; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[85] = 16; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[86] = 54; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[87] = 161; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[88] = 60; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[89] = 6; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[90] = 13; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[91] = 191; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[92] = 116; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[93] = 182; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[94] = 42; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[95] = 191; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[96] = 213; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[97] = 20; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[98] = 217; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[99] = 8; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[100] = 142; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[101] = 187; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[102] = 238; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[103] = 120; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[104] = 184; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[105] = 250; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[106] = 31; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[107] = 151; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[108] = 37; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[109] = 51; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[110] = 177; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[111] = 130; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[112] = 190; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[113] = 155; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[114] = 71; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[115] = 68; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[116] = 56; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[117] = 238; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[118] = 92; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[119] = 130; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[120] = 37; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[121] = 137; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[122] = 146; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[123] = 246; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[124] = 114; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[125] = 116; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[126] = 138; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[127] = 165; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[128] = 217; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[129] = 79; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[130] = 10; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[131] = 189; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[132] = 128; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[133] = 189; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[134] = 2; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[135] = 240; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[136] = 92; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[137] = 28; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[138] = 126; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[139] = 105; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[140] = 236; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[141] = 228; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[142] = 194; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[143] = 0; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[144] = 51; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[145] = 61; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[146] = 74; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[147] = 41; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[148] = 10; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[149] = 239; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[150] = 133; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[151] = 106; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[152] = 190; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[153] = 30; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[154] = 27; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[155] = 3; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[156] = 240; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[157] = 205; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[158] = 253; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[159] = 113; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[160] = 25; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[161] = 28; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[162] = 187; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[163] = 81; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[164] = 101; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[165] = 216; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[166] = 121; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[167] = 41; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[168] = 179; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[169] = 120; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[170] = 152; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[171] = 18; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[172] = 116; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[173] = 53; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[174] = 212; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[175] = 100; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[176] = 2; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[177] = 114; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[178] = 198; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[179] = 200; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[180] = 10; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[181] = 147; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[182] = 25; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[183] = 33; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[184] = 115; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[185] = 208; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[186] = 113; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[187] = 60; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[188] = 179; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[189] = 183; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[190] = 0; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[191] = 41; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[192] = 217; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[193] = 206; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[194] = 255; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[195] = 211; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[196] = 225; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[197] = 142; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[198] = 191; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[199] = 133; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[200] = 81; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[201] = 15; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[202] = 248; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[203] = 193; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[204] = 66; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[205] = 191; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[206] = 244; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[207] = 221; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[208] = 248; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[209] = 199; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[210] = 241; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[211] = 112; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[212] = 51; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[213] = 1; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[214] = 180; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[215] = 180; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[216] = 125; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[217] = 97; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[218] = 145; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[219] = 25; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[220] = 72; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[221] = 210; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[222] = 215; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[223] = 208; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[224] = 15; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[225] = 126; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[226] = 56; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[227] = 38; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[228] = 65; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[229] = 4; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[230] = 64; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[231] = 19; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[232] = 74; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[233] = 223; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[234] = 111; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[235] = 109; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[236] = 52; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[237] = 43; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[238] = 167; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[239] = 186; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[240] = 202; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[241] = 111; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[242] = 11; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[243] = 91; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[244] = 21; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[245] = 236; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[246] = 234; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[247] = 196; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[248] = 36; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[249] = 171; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[250] = 147; - test_msg->sequence = 259241795; - sbp_payload_send(&sbp_state, 0xa3, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xa3, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_fileio_read_resp_t *check_msg = - (msg_fileio_read_resp_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->contents[0] == 73, - "incorrect value for contents[0], expected 73, is %d", - check_msg->contents[0]); - ck_assert_msg(check_msg->contents[1] == 231, - "incorrect value for contents[1], expected 231, is %d", - check_msg->contents[1]); - ck_assert_msg(check_msg->contents[2] == 227, - "incorrect value for contents[2], expected 227, is %d", - check_msg->contents[2]); - ck_assert_msg(check_msg->contents[3] == 179, - "incorrect value for contents[3], expected 179, is %d", - check_msg->contents[3]); - ck_assert_msg(check_msg->contents[4] == 18, - "incorrect value for contents[4], expected 18, is %d", - check_msg->contents[4]); - ck_assert_msg(check_msg->contents[5] == 76, - "incorrect value for contents[5], expected 76, is %d", - check_msg->contents[5]); - ck_assert_msg(check_msg->contents[6] == 68, - "incorrect value for contents[6], expected 68, is %d", - check_msg->contents[6]); - ck_assert_msg(check_msg->contents[7] == 229, - "incorrect value for contents[7], expected 229, is %d", - check_msg->contents[7]); - ck_assert_msg(check_msg->contents[8] == 216, - "incorrect value for contents[8], expected 216, is %d", - check_msg->contents[8]); - ck_assert_msg(check_msg->contents[9] == 21, - "incorrect value for contents[9], expected 21, is %d", - check_msg->contents[9]); - ck_assert_msg(check_msg->contents[10] == 98, - "incorrect value for contents[10], expected 98, is %d", - check_msg->contents[10]); - ck_assert_msg(check_msg->contents[11] == 183, - "incorrect value for contents[11], expected 183, is %d", - check_msg->contents[11]); - ck_assert_msg(check_msg->contents[12] == 69, - "incorrect value for contents[12], expected 69, is %d", - check_msg->contents[12]); - ck_assert_msg(check_msg->contents[13] == 190, - "incorrect value for contents[13], expected 190, is %d", - check_msg->contents[13]); - ck_assert_msg(check_msg->contents[14] == 5, - "incorrect value for contents[14], expected 5, is %d", - check_msg->contents[14]); - ck_assert_msg(check_msg->contents[15] == 252, - "incorrect value for contents[15], expected 252, is %d", - check_msg->contents[15]); - ck_assert_msg(check_msg->contents[16] == 176, - "incorrect value for contents[16], expected 176, is %d", - check_msg->contents[16]); - ck_assert_msg(check_msg->contents[17] == 55, - "incorrect value for contents[17], expected 55, is %d", - check_msg->contents[17]); - ck_assert_msg(check_msg->contents[18] == 32, - "incorrect value for contents[18], expected 32, is %d", - check_msg->contents[18]); - ck_assert_msg(check_msg->contents[19] == 78, - "incorrect value for contents[19], expected 78, is %d", - check_msg->contents[19]); - ck_assert_msg(check_msg->contents[20] == 8, - "incorrect value for contents[20], expected 8, is %d", - check_msg->contents[20]); - ck_assert_msg(check_msg->contents[21] == 52, - "incorrect value for contents[21], expected 52, is %d", - check_msg->contents[21]); - ck_assert_msg(check_msg->contents[22] == 127, - "incorrect value for contents[22], expected 127, is %d", - check_msg->contents[22]); - ck_assert_msg(check_msg->contents[23] == 50, - "incorrect value for contents[23], expected 50, is %d", - check_msg->contents[23]); - ck_assert_msg(check_msg->contents[24] == 71, - "incorrect value for contents[24], expected 71, is %d", - check_msg->contents[24]); - ck_assert_msg(check_msg->contents[25] == 106, - "incorrect value for contents[25], expected 106, is %d", - check_msg->contents[25]); - ck_assert_msg(check_msg->contents[26] == 61, - "incorrect value for contents[26], expected 61, is %d", - check_msg->contents[26]); - ck_assert_msg(check_msg->contents[27] == 79, - "incorrect value for contents[27], expected 79, is %d", - check_msg->contents[27]); - ck_assert_msg(check_msg->contents[28] == 191, - "incorrect value for contents[28], expected 191, is %d", - check_msg->contents[28]); - ck_assert_msg(check_msg->contents[29] == 106, - "incorrect value for contents[29], expected 106, is %d", - check_msg->contents[29]); - ck_assert_msg(check_msg->contents[30] == 46, - "incorrect value for contents[30], expected 46, is %d", - check_msg->contents[30]); - ck_assert_msg(check_msg->contents[31] == 79, - "incorrect value for contents[31], expected 79, is %d", - check_msg->contents[31]); - ck_assert_msg(check_msg->contents[32] == 118, - "incorrect value for contents[32], expected 118, is %d", - check_msg->contents[32]); - ck_assert_msg(check_msg->contents[33] == 248, - "incorrect value for contents[33], expected 248, is %d", - check_msg->contents[33]); - ck_assert_msg(check_msg->contents[34] == 118, - "incorrect value for contents[34], expected 118, is %d", - check_msg->contents[34]); - ck_assert_msg(check_msg->contents[35] == 207, - "incorrect value for contents[35], expected 207, is %d", - check_msg->contents[35]); - ck_assert_msg(check_msg->contents[36] == 206, - "incorrect value for contents[36], expected 206, is %d", - check_msg->contents[36]); - ck_assert_msg(check_msg->contents[37] == 210, - "incorrect value for contents[37], expected 210, is %d", - check_msg->contents[37]); - ck_assert_msg(check_msg->contents[38] == 91, - "incorrect value for contents[38], expected 91, is %d", - check_msg->contents[38]); - ck_assert_msg(check_msg->contents[39] == 73, - "incorrect value for contents[39], expected 73, is %d", - check_msg->contents[39]); - ck_assert_msg(check_msg->contents[40] == 251, - "incorrect value for contents[40], expected 251, is %d", - check_msg->contents[40]); - ck_assert_msg(check_msg->contents[41] == 81, - "incorrect value for contents[41], expected 81, is %d", - check_msg->contents[41]); - ck_assert_msg(check_msg->contents[42] == 131, - "incorrect value for contents[42], expected 131, is %d", - check_msg->contents[42]); - ck_assert_msg(check_msg->contents[43] == 205, - "incorrect value for contents[43], expected 205, is %d", - check_msg->contents[43]); - ck_assert_msg(check_msg->contents[44] == 193, - "incorrect value for contents[44], expected 193, is %d", - check_msg->contents[44]); - ck_assert_msg(check_msg->contents[45] == 146, - "incorrect value for contents[45], expected 146, is %d", - check_msg->contents[45]); - ck_assert_msg(check_msg->contents[46] == 206, - "incorrect value for contents[46], expected 206, is %d", - check_msg->contents[46]); - ck_assert_msg(check_msg->contents[47] == 185, - "incorrect value for contents[47], expected 185, is %d", - check_msg->contents[47]); - ck_assert_msg(check_msg->contents[48] == 140, - "incorrect value for contents[48], expected 140, is %d", - check_msg->contents[48]); - ck_assert_msg(check_msg->contents[49] == 249, - "incorrect value for contents[49], expected 249, is %d", - check_msg->contents[49]); - ck_assert_msg(check_msg->contents[50] == 163, - "incorrect value for contents[50], expected 163, is %d", - check_msg->contents[50]); - ck_assert_msg(check_msg->contents[51] == 231, - "incorrect value for contents[51], expected 231, is %d", - check_msg->contents[51]); - ck_assert_msg(check_msg->contents[52] == 65, - "incorrect value for contents[52], expected 65, is %d", - check_msg->contents[52]); - ck_assert_msg(check_msg->contents[53] == 67, - "incorrect value for contents[53], expected 67, is %d", - check_msg->contents[53]); - ck_assert_msg(check_msg->contents[54] == 94, - "incorrect value for contents[54], expected 94, is %d", - check_msg->contents[54]); - ck_assert_msg(check_msg->contents[55] == 250, - "incorrect value for contents[55], expected 250, is %d", - check_msg->contents[55]); - ck_assert_msg(check_msg->contents[56] == 109, - "incorrect value for contents[56], expected 109, is %d", - check_msg->contents[56]); - ck_assert_msg(check_msg->contents[57] == 152, - "incorrect value for contents[57], expected 152, is %d", - check_msg->contents[57]); - ck_assert_msg(check_msg->contents[58] == 95, - "incorrect value for contents[58], expected 95, is %d", - check_msg->contents[58]); - ck_assert_msg(check_msg->contents[59] == 123, - "incorrect value for contents[59], expected 123, is %d", - check_msg->contents[59]); - ck_assert_msg(check_msg->contents[60] == 77, - "incorrect value for contents[60], expected 77, is %d", - check_msg->contents[60]); - ck_assert_msg(check_msg->contents[61] == 224, - "incorrect value for contents[61], expected 224, is %d", - check_msg->contents[61]); - ck_assert_msg(check_msg->contents[62] == 124, - "incorrect value for contents[62], expected 124, is %d", - check_msg->contents[62]); - ck_assert_msg(check_msg->contents[63] == 238, - "incorrect value for contents[63], expected 238, is %d", - check_msg->contents[63]); - ck_assert_msg(check_msg->contents[64] == 205, - "incorrect value for contents[64], expected 205, is %d", - check_msg->contents[64]); - ck_assert_msg(check_msg->contents[65] == 65, - "incorrect value for contents[65], expected 65, is %d", - check_msg->contents[65]); - ck_assert_msg(check_msg->contents[66] == 103, - "incorrect value for contents[66], expected 103, is %d", - check_msg->contents[66]); - ck_assert_msg(check_msg->contents[67] == 35, - "incorrect value for contents[67], expected 35, is %d", - check_msg->contents[67]); - ck_assert_msg(check_msg->contents[68] == 104, - "incorrect value for contents[68], expected 104, is %d", - check_msg->contents[68]); - ck_assert_msg(check_msg->contents[69] == 209, - "incorrect value for contents[69], expected 209, is %d", - check_msg->contents[69]); - ck_assert_msg(check_msg->contents[70] == 5, - "incorrect value for contents[70], expected 5, is %d", - check_msg->contents[70]); - ck_assert_msg(check_msg->contents[71] == 191, - "incorrect value for contents[71], expected 191, is %d", - check_msg->contents[71]); - ck_assert_msg(check_msg->contents[72] == 47, - "incorrect value for contents[72], expected 47, is %d", - check_msg->contents[72]); - ck_assert_msg(check_msg->contents[73] == 249, - "incorrect value for contents[73], expected 249, is %d", - check_msg->contents[73]); - ck_assert_msg(check_msg->contents[74] == 176, - "incorrect value for contents[74], expected 176, is %d", - check_msg->contents[74]); - ck_assert_msg(check_msg->contents[75] == 166, - "incorrect value for contents[75], expected 166, is %d", - check_msg->contents[75]); - ck_assert_msg(check_msg->contents[76] == 213, - "incorrect value for contents[76], expected 213, is %d", - check_msg->contents[76]); - ck_assert_msg(check_msg->contents[77] == 46, - "incorrect value for contents[77], expected 46, is %d", - check_msg->contents[77]); - ck_assert_msg(check_msg->contents[78] == 192, - "incorrect value for contents[78], expected 192, is %d", - check_msg->contents[78]); - ck_assert_msg(check_msg->contents[79] == 86, - "incorrect value for contents[79], expected 86, is %d", - check_msg->contents[79]); - ck_assert_msg(check_msg->contents[80] == 32, - "incorrect value for contents[80], expected 32, is %d", - check_msg->contents[80]); - ck_assert_msg(check_msg->contents[81] == 103, - "incorrect value for contents[81], expected 103, is %d", - check_msg->contents[81]); - ck_assert_msg(check_msg->contents[82] == 146, - "incorrect value for contents[82], expected 146, is %d", - check_msg->contents[82]); - ck_assert_msg(check_msg->contents[83] == 252, - "incorrect value for contents[83], expected 252, is %d", - check_msg->contents[83]); - ck_assert_msg(check_msg->contents[84] == 4, - "incorrect value for contents[84], expected 4, is %d", - check_msg->contents[84]); - ck_assert_msg(check_msg->contents[85] == 16, - "incorrect value for contents[85], expected 16, is %d", - check_msg->contents[85]); - ck_assert_msg(check_msg->contents[86] == 54, - "incorrect value for contents[86], expected 54, is %d", - check_msg->contents[86]); - ck_assert_msg(check_msg->contents[87] == 161, - "incorrect value for contents[87], expected 161, is %d", - check_msg->contents[87]); - ck_assert_msg(check_msg->contents[88] == 60, - "incorrect value for contents[88], expected 60, is %d", - check_msg->contents[88]); - ck_assert_msg(check_msg->contents[89] == 6, - "incorrect value for contents[89], expected 6, is %d", - check_msg->contents[89]); - ck_assert_msg(check_msg->contents[90] == 13, - "incorrect value for contents[90], expected 13, is %d", - check_msg->contents[90]); - ck_assert_msg(check_msg->contents[91] == 191, - "incorrect value for contents[91], expected 191, is %d", - check_msg->contents[91]); - ck_assert_msg(check_msg->contents[92] == 116, - "incorrect value for contents[92], expected 116, is %d", - check_msg->contents[92]); - ck_assert_msg(check_msg->contents[93] == 182, - "incorrect value for contents[93], expected 182, is %d", - check_msg->contents[93]); - ck_assert_msg(check_msg->contents[94] == 42, - "incorrect value for contents[94], expected 42, is %d", - check_msg->contents[94]); - ck_assert_msg(check_msg->contents[95] == 191, - "incorrect value for contents[95], expected 191, is %d", - check_msg->contents[95]); - ck_assert_msg(check_msg->contents[96] == 213, - "incorrect value for contents[96], expected 213, is %d", - check_msg->contents[96]); - ck_assert_msg(check_msg->contents[97] == 20, - "incorrect value for contents[97], expected 20, is %d", - check_msg->contents[97]); - ck_assert_msg(check_msg->contents[98] == 217, - "incorrect value for contents[98], expected 217, is %d", - check_msg->contents[98]); - ck_assert_msg(check_msg->contents[99] == 8, - "incorrect value for contents[99], expected 8, is %d", - check_msg->contents[99]); - ck_assert_msg(check_msg->contents[100] == 142, - "incorrect value for contents[100], expected 142, is %d", - check_msg->contents[100]); - ck_assert_msg(check_msg->contents[101] == 187, - "incorrect value for contents[101], expected 187, is %d", - check_msg->contents[101]); - ck_assert_msg(check_msg->contents[102] == 238, - "incorrect value for contents[102], expected 238, is %d", - check_msg->contents[102]); - ck_assert_msg(check_msg->contents[103] == 120, - "incorrect value for contents[103], expected 120, is %d", - check_msg->contents[103]); - ck_assert_msg(check_msg->contents[104] == 184, - "incorrect value for contents[104], expected 184, is %d", - check_msg->contents[104]); - ck_assert_msg(check_msg->contents[105] == 250, - "incorrect value for contents[105], expected 250, is %d", - check_msg->contents[105]); - ck_assert_msg(check_msg->contents[106] == 31, - "incorrect value for contents[106], expected 31, is %d", - check_msg->contents[106]); - ck_assert_msg(check_msg->contents[107] == 151, - "incorrect value for contents[107], expected 151, is %d", - check_msg->contents[107]); - ck_assert_msg(check_msg->contents[108] == 37, - "incorrect value for contents[108], expected 37, is %d", - check_msg->contents[108]); - ck_assert_msg(check_msg->contents[109] == 51, - "incorrect value for contents[109], expected 51, is %d", - check_msg->contents[109]); - ck_assert_msg(check_msg->contents[110] == 177, - "incorrect value for contents[110], expected 177, is %d", - check_msg->contents[110]); - ck_assert_msg(check_msg->contents[111] == 130, - "incorrect value for contents[111], expected 130, is %d", - check_msg->contents[111]); - ck_assert_msg(check_msg->contents[112] == 190, - "incorrect value for contents[112], expected 190, is %d", - check_msg->contents[112]); - ck_assert_msg(check_msg->contents[113] == 155, - "incorrect value for contents[113], expected 155, is %d", - check_msg->contents[113]); - ck_assert_msg(check_msg->contents[114] == 71, - "incorrect value for contents[114], expected 71, is %d", - check_msg->contents[114]); - ck_assert_msg(check_msg->contents[115] == 68, - "incorrect value for contents[115], expected 68, is %d", - check_msg->contents[115]); - ck_assert_msg(check_msg->contents[116] == 56, - "incorrect value for contents[116], expected 56, is %d", - check_msg->contents[116]); - ck_assert_msg(check_msg->contents[117] == 238, - "incorrect value for contents[117], expected 238, is %d", - check_msg->contents[117]); - ck_assert_msg(check_msg->contents[118] == 92, - "incorrect value for contents[118], expected 92, is %d", - check_msg->contents[118]); - ck_assert_msg(check_msg->contents[119] == 130, - "incorrect value for contents[119], expected 130, is %d", - check_msg->contents[119]); - ck_assert_msg(check_msg->contents[120] == 37, - "incorrect value for contents[120], expected 37, is %d", - check_msg->contents[120]); - ck_assert_msg(check_msg->contents[121] == 137, - "incorrect value for contents[121], expected 137, is %d", - check_msg->contents[121]); - ck_assert_msg(check_msg->contents[122] == 146, - "incorrect value for contents[122], expected 146, is %d", - check_msg->contents[122]); - ck_assert_msg(check_msg->contents[123] == 246, - "incorrect value for contents[123], expected 246, is %d", - check_msg->contents[123]); - ck_assert_msg(check_msg->contents[124] == 114, - "incorrect value for contents[124], expected 114, is %d", - check_msg->contents[124]); - ck_assert_msg(check_msg->contents[125] == 116, - "incorrect value for contents[125], expected 116, is %d", - check_msg->contents[125]); - ck_assert_msg(check_msg->contents[126] == 138, - "incorrect value for contents[126], expected 138, is %d", - check_msg->contents[126]); - ck_assert_msg(check_msg->contents[127] == 165, - "incorrect value for contents[127], expected 165, is %d", - check_msg->contents[127]); - ck_assert_msg(check_msg->contents[128] == 217, - "incorrect value for contents[128], expected 217, is %d", - check_msg->contents[128]); - ck_assert_msg(check_msg->contents[129] == 79, - "incorrect value for contents[129], expected 79, is %d", - check_msg->contents[129]); - ck_assert_msg(check_msg->contents[130] == 10, - "incorrect value for contents[130], expected 10, is %d", - check_msg->contents[130]); - ck_assert_msg(check_msg->contents[131] == 189, - "incorrect value for contents[131], expected 189, is %d", - check_msg->contents[131]); - ck_assert_msg(check_msg->contents[132] == 128, - "incorrect value for contents[132], expected 128, is %d", - check_msg->contents[132]); - ck_assert_msg(check_msg->contents[133] == 189, - "incorrect value for contents[133], expected 189, is %d", - check_msg->contents[133]); - ck_assert_msg(check_msg->contents[134] == 2, - "incorrect value for contents[134], expected 2, is %d", - check_msg->contents[134]); - ck_assert_msg(check_msg->contents[135] == 240, - "incorrect value for contents[135], expected 240, is %d", - check_msg->contents[135]); - ck_assert_msg(check_msg->contents[136] == 92, - "incorrect value for contents[136], expected 92, is %d", - check_msg->contents[136]); - ck_assert_msg(check_msg->contents[137] == 28, - "incorrect value for contents[137], expected 28, is %d", - check_msg->contents[137]); - ck_assert_msg(check_msg->contents[138] == 126, - "incorrect value for contents[138], expected 126, is %d", - check_msg->contents[138]); - ck_assert_msg(check_msg->contents[139] == 105, - "incorrect value for contents[139], expected 105, is %d", - check_msg->contents[139]); - ck_assert_msg(check_msg->contents[140] == 236, - "incorrect value for contents[140], expected 236, is %d", - check_msg->contents[140]); - ck_assert_msg(check_msg->contents[141] == 228, - "incorrect value for contents[141], expected 228, is %d", - check_msg->contents[141]); - ck_assert_msg(check_msg->contents[142] == 194, - "incorrect value for contents[142], expected 194, is %d", - check_msg->contents[142]); - ck_assert_msg(check_msg->contents[143] == 0, - "incorrect value for contents[143], expected 0, is %d", - check_msg->contents[143]); - ck_assert_msg(check_msg->contents[144] == 51, - "incorrect value for contents[144], expected 51, is %d", - check_msg->contents[144]); - ck_assert_msg(check_msg->contents[145] == 61, - "incorrect value for contents[145], expected 61, is %d", - check_msg->contents[145]); - ck_assert_msg(check_msg->contents[146] == 74, - "incorrect value for contents[146], expected 74, is %d", - check_msg->contents[146]); - ck_assert_msg(check_msg->contents[147] == 41, - "incorrect value for contents[147], expected 41, is %d", - check_msg->contents[147]); - ck_assert_msg(check_msg->contents[148] == 10, - "incorrect value for contents[148], expected 10, is %d", - check_msg->contents[148]); - ck_assert_msg(check_msg->contents[149] == 239, - "incorrect value for contents[149], expected 239, is %d", - check_msg->contents[149]); - ck_assert_msg(check_msg->contents[150] == 133, - "incorrect value for contents[150], expected 133, is %d", - check_msg->contents[150]); - ck_assert_msg(check_msg->contents[151] == 106, - "incorrect value for contents[151], expected 106, is %d", - check_msg->contents[151]); - ck_assert_msg(check_msg->contents[152] == 190, - "incorrect value for contents[152], expected 190, is %d", - check_msg->contents[152]); - ck_assert_msg(check_msg->contents[153] == 30, - "incorrect value for contents[153], expected 30, is %d", - check_msg->contents[153]); - ck_assert_msg(check_msg->contents[154] == 27, - "incorrect value for contents[154], expected 27, is %d", - check_msg->contents[154]); - ck_assert_msg(check_msg->contents[155] == 3, - "incorrect value for contents[155], expected 3, is %d", - check_msg->contents[155]); - ck_assert_msg(check_msg->contents[156] == 240, - "incorrect value for contents[156], expected 240, is %d", - check_msg->contents[156]); - ck_assert_msg(check_msg->contents[157] == 205, - "incorrect value for contents[157], expected 205, is %d", - check_msg->contents[157]); - ck_assert_msg(check_msg->contents[158] == 253, - "incorrect value for contents[158], expected 253, is %d", - check_msg->contents[158]); - ck_assert_msg(check_msg->contents[159] == 113, - "incorrect value for contents[159], expected 113, is %d", - check_msg->contents[159]); - ck_assert_msg(check_msg->contents[160] == 25, - "incorrect value for contents[160], expected 25, is %d", - check_msg->contents[160]); - ck_assert_msg(check_msg->contents[161] == 28, - "incorrect value for contents[161], expected 28, is %d", - check_msg->contents[161]); - ck_assert_msg(check_msg->contents[162] == 187, - "incorrect value for contents[162], expected 187, is %d", - check_msg->contents[162]); - ck_assert_msg(check_msg->contents[163] == 81, - "incorrect value for contents[163], expected 81, is %d", - check_msg->contents[163]); - ck_assert_msg(check_msg->contents[164] == 101, - "incorrect value for contents[164], expected 101, is %d", - check_msg->contents[164]); - ck_assert_msg(check_msg->contents[165] == 216, - "incorrect value for contents[165], expected 216, is %d", - check_msg->contents[165]); - ck_assert_msg(check_msg->contents[166] == 121, - "incorrect value for contents[166], expected 121, is %d", - check_msg->contents[166]); - ck_assert_msg(check_msg->contents[167] == 41, - "incorrect value for contents[167], expected 41, is %d", - check_msg->contents[167]); - ck_assert_msg(check_msg->contents[168] == 179, - "incorrect value for contents[168], expected 179, is %d", - check_msg->contents[168]); - ck_assert_msg(check_msg->contents[169] == 120, - "incorrect value for contents[169], expected 120, is %d", - check_msg->contents[169]); - ck_assert_msg(check_msg->contents[170] == 152, - "incorrect value for contents[170], expected 152, is %d", - check_msg->contents[170]); - ck_assert_msg(check_msg->contents[171] == 18, - "incorrect value for contents[171], expected 18, is %d", - check_msg->contents[171]); - ck_assert_msg(check_msg->contents[172] == 116, - "incorrect value for contents[172], expected 116, is %d", - check_msg->contents[172]); - ck_assert_msg(check_msg->contents[173] == 53, - "incorrect value for contents[173], expected 53, is %d", - check_msg->contents[173]); - ck_assert_msg(check_msg->contents[174] == 212, - "incorrect value for contents[174], expected 212, is %d", - check_msg->contents[174]); - ck_assert_msg(check_msg->contents[175] == 100, - "incorrect value for contents[175], expected 100, is %d", - check_msg->contents[175]); - ck_assert_msg(check_msg->contents[176] == 2, - "incorrect value for contents[176], expected 2, is %d", - check_msg->contents[176]); - ck_assert_msg(check_msg->contents[177] == 114, - "incorrect value for contents[177], expected 114, is %d", - check_msg->contents[177]); - ck_assert_msg(check_msg->contents[178] == 198, - "incorrect value for contents[178], expected 198, is %d", - check_msg->contents[178]); - ck_assert_msg(check_msg->contents[179] == 200, - "incorrect value for contents[179], expected 200, is %d", - check_msg->contents[179]); - ck_assert_msg(check_msg->contents[180] == 10, - "incorrect value for contents[180], expected 10, is %d", - check_msg->contents[180]); - ck_assert_msg(check_msg->contents[181] == 147, - "incorrect value for contents[181], expected 147, is %d", - check_msg->contents[181]); - ck_assert_msg(check_msg->contents[182] == 25, - "incorrect value for contents[182], expected 25, is %d", - check_msg->contents[182]); - ck_assert_msg(check_msg->contents[183] == 33, - "incorrect value for contents[183], expected 33, is %d", - check_msg->contents[183]); - ck_assert_msg(check_msg->contents[184] == 115, - "incorrect value for contents[184], expected 115, is %d", - check_msg->contents[184]); - ck_assert_msg(check_msg->contents[185] == 208, - "incorrect value for contents[185], expected 208, is %d", - check_msg->contents[185]); - ck_assert_msg(check_msg->contents[186] == 113, - "incorrect value for contents[186], expected 113, is %d", - check_msg->contents[186]); - ck_assert_msg(check_msg->contents[187] == 60, - "incorrect value for contents[187], expected 60, is %d", - check_msg->contents[187]); - ck_assert_msg(check_msg->contents[188] == 179, - "incorrect value for contents[188], expected 179, is %d", - check_msg->contents[188]); - ck_assert_msg(check_msg->contents[189] == 183, - "incorrect value for contents[189], expected 183, is %d", - check_msg->contents[189]); - ck_assert_msg(check_msg->contents[190] == 0, - "incorrect value for contents[190], expected 0, is %d", - check_msg->contents[190]); - ck_assert_msg(check_msg->contents[191] == 41, - "incorrect value for contents[191], expected 41, is %d", - check_msg->contents[191]); - ck_assert_msg(check_msg->contents[192] == 217, - "incorrect value for contents[192], expected 217, is %d", - check_msg->contents[192]); - ck_assert_msg(check_msg->contents[193] == 206, - "incorrect value for contents[193], expected 206, is %d", - check_msg->contents[193]); - ck_assert_msg(check_msg->contents[194] == 255, - "incorrect value for contents[194], expected 255, is %d", - check_msg->contents[194]); - ck_assert_msg(check_msg->contents[195] == 211, - "incorrect value for contents[195], expected 211, is %d", - check_msg->contents[195]); - ck_assert_msg(check_msg->contents[196] == 225, - "incorrect value for contents[196], expected 225, is %d", - check_msg->contents[196]); - ck_assert_msg(check_msg->contents[197] == 142, - "incorrect value for contents[197], expected 142, is %d", - check_msg->contents[197]); - ck_assert_msg(check_msg->contents[198] == 191, - "incorrect value for contents[198], expected 191, is %d", - check_msg->contents[198]); - ck_assert_msg(check_msg->contents[199] == 133, - "incorrect value for contents[199], expected 133, is %d", - check_msg->contents[199]); - ck_assert_msg(check_msg->contents[200] == 81, - "incorrect value for contents[200], expected 81, is %d", - check_msg->contents[200]); - ck_assert_msg(check_msg->contents[201] == 15, - "incorrect value for contents[201], expected 15, is %d", - check_msg->contents[201]); - ck_assert_msg(check_msg->contents[202] == 248, - "incorrect value for contents[202], expected 248, is %d", - check_msg->contents[202]); - ck_assert_msg(check_msg->contents[203] == 193, - "incorrect value for contents[203], expected 193, is %d", - check_msg->contents[203]); - ck_assert_msg(check_msg->contents[204] == 66, - "incorrect value for contents[204], expected 66, is %d", - check_msg->contents[204]); - ck_assert_msg(check_msg->contents[205] == 191, - "incorrect value for contents[205], expected 191, is %d", - check_msg->contents[205]); - ck_assert_msg(check_msg->contents[206] == 244, - "incorrect value for contents[206], expected 244, is %d", - check_msg->contents[206]); - ck_assert_msg(check_msg->contents[207] == 221, - "incorrect value for contents[207], expected 221, is %d", - check_msg->contents[207]); - ck_assert_msg(check_msg->contents[208] == 248, - "incorrect value for contents[208], expected 248, is %d", - check_msg->contents[208]); - ck_assert_msg(check_msg->contents[209] == 199, - "incorrect value for contents[209], expected 199, is %d", - check_msg->contents[209]); - ck_assert_msg(check_msg->contents[210] == 241, - "incorrect value for contents[210], expected 241, is %d", - check_msg->contents[210]); - ck_assert_msg(check_msg->contents[211] == 112, - "incorrect value for contents[211], expected 112, is %d", - check_msg->contents[211]); - ck_assert_msg(check_msg->contents[212] == 51, - "incorrect value for contents[212], expected 51, is %d", - check_msg->contents[212]); - ck_assert_msg(check_msg->contents[213] == 1, - "incorrect value for contents[213], expected 1, is %d", - check_msg->contents[213]); - ck_assert_msg(check_msg->contents[214] == 180, - "incorrect value for contents[214], expected 180, is %d", - check_msg->contents[214]); - ck_assert_msg(check_msg->contents[215] == 180, - "incorrect value for contents[215], expected 180, is %d", - check_msg->contents[215]); - ck_assert_msg(check_msg->contents[216] == 125, - "incorrect value for contents[216], expected 125, is %d", - check_msg->contents[216]); - ck_assert_msg(check_msg->contents[217] == 97, - "incorrect value for contents[217], expected 97, is %d", - check_msg->contents[217]); - ck_assert_msg(check_msg->contents[218] == 145, - "incorrect value for contents[218], expected 145, is %d", - check_msg->contents[218]); - ck_assert_msg(check_msg->contents[219] == 25, - "incorrect value for contents[219], expected 25, is %d", - check_msg->contents[219]); - ck_assert_msg(check_msg->contents[220] == 72, - "incorrect value for contents[220], expected 72, is %d", - check_msg->contents[220]); - ck_assert_msg(check_msg->contents[221] == 210, - "incorrect value for contents[221], expected 210, is %d", - check_msg->contents[221]); - ck_assert_msg(check_msg->contents[222] == 215, - "incorrect value for contents[222], expected 215, is %d", - check_msg->contents[222]); - ck_assert_msg(check_msg->contents[223] == 208, - "incorrect value for contents[223], expected 208, is %d", - check_msg->contents[223]); - ck_assert_msg(check_msg->contents[224] == 15, - "incorrect value for contents[224], expected 15, is %d", - check_msg->contents[224]); - ck_assert_msg(check_msg->contents[225] == 126, - "incorrect value for contents[225], expected 126, is %d", - check_msg->contents[225]); - ck_assert_msg(check_msg->contents[226] == 56, - "incorrect value for contents[226], expected 56, is %d", - check_msg->contents[226]); - ck_assert_msg(check_msg->contents[227] == 38, - "incorrect value for contents[227], expected 38, is %d", - check_msg->contents[227]); - ck_assert_msg(check_msg->contents[228] == 65, - "incorrect value for contents[228], expected 65, is %d", - check_msg->contents[228]); - ck_assert_msg(check_msg->contents[229] == 4, - "incorrect value for contents[229], expected 4, is %d", - check_msg->contents[229]); - ck_assert_msg(check_msg->contents[230] == 64, - "incorrect value for contents[230], expected 64, is %d", - check_msg->contents[230]); - ck_assert_msg(check_msg->contents[231] == 19, - "incorrect value for contents[231], expected 19, is %d", - check_msg->contents[231]); - ck_assert_msg(check_msg->contents[232] == 74, - "incorrect value for contents[232], expected 74, is %d", - check_msg->contents[232]); - ck_assert_msg(check_msg->contents[233] == 223, - "incorrect value for contents[233], expected 223, is %d", - check_msg->contents[233]); - ck_assert_msg(check_msg->contents[234] == 111, - "incorrect value for contents[234], expected 111, is %d", - check_msg->contents[234]); - ck_assert_msg(check_msg->contents[235] == 109, - "incorrect value for contents[235], expected 109, is %d", - check_msg->contents[235]); - ck_assert_msg(check_msg->contents[236] == 52, - "incorrect value for contents[236], expected 52, is %d", - check_msg->contents[236]); - ck_assert_msg(check_msg->contents[237] == 43, - "incorrect value for contents[237], expected 43, is %d", - check_msg->contents[237]); - ck_assert_msg(check_msg->contents[238] == 167, - "incorrect value for contents[238], expected 167, is %d", - check_msg->contents[238]); - ck_assert_msg(check_msg->contents[239] == 186, - "incorrect value for contents[239], expected 186, is %d", - check_msg->contents[239]); - ck_assert_msg(check_msg->contents[240] == 202, - "incorrect value for contents[240], expected 202, is %d", - check_msg->contents[240]); - ck_assert_msg(check_msg->contents[241] == 111, - "incorrect value for contents[241], expected 111, is %d", - check_msg->contents[241]); - ck_assert_msg(check_msg->contents[242] == 11, - "incorrect value for contents[242], expected 11, is %d", - check_msg->contents[242]); - ck_assert_msg(check_msg->contents[243] == 91, - "incorrect value for contents[243], expected 91, is %d", - check_msg->contents[243]); - ck_assert_msg(check_msg->contents[244] == 21, - "incorrect value for contents[244], expected 21, is %d", - check_msg->contents[244]); - ck_assert_msg(check_msg->contents[245] == 236, - "incorrect value for contents[245], expected 236, is %d", - check_msg->contents[245]); - ck_assert_msg(check_msg->contents[246] == 234, - "incorrect value for contents[246], expected 234, is %d", - check_msg->contents[246]); - ck_assert_msg(check_msg->contents[247] == 196, - "incorrect value for contents[247], expected 196, is %d", - check_msg->contents[247]); - ck_assert_msg(check_msg->contents[248] == 36, - "incorrect value for contents[248], expected 36, is %d", - check_msg->contents[248]); - ck_assert_msg(check_msg->contents[249] == 171, - "incorrect value for contents[249], expected 171, is %d", - check_msg->contents[249]); - ck_assert_msg(check_msg->contents[250] == 147, - "incorrect value for contents[250], expected 147, is %d", - check_msg->contents[250]); - ck_assert_msg(check_msg->sequence == 259241795, - "incorrect value for sequence, expected 259241795, is %d", - check_msg->sequence); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_file_io_MsgFileioReadResp_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_file_io_MsgFileioReadResp"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_file_io_MsgFileioReadResp"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_file_io_MsgFileioReadResp); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_file_io_MsgFileioRemove.c b/c/test/legacy/auto_check_sbp_file_io_MsgFileioRemove.c deleted file mode 100644 index 15c3241b8f..0000000000 --- a/c/test/legacy/auto_check_sbp_file_io_MsgFileioRemove.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/file_io/test_MsgFileioRemove.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_file_io_MsgFileioRemove) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xac, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xac, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 172, 0, 195, 4, 14, 47, 112, 97, 116, 104, - 47, 116, 111, 47, 102, 105, 108, 101, 0, 46, 243, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_fileio_remove_t *test_msg = (msg_fileio_remove_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = {(char)47, (char)112, (char)97, (char)116, - (char)104, (char)47, (char)116, (char)111, - (char)47, (char)102, (char)105, (char)108, - (char)101, (char)0}; - memcpy(test_msg->filename, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->filename) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0xac, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xac, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_fileio_remove_t *check_msg = - (msg_fileio_remove_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = {(char)47, (char)112, (char)97, (char)116, - (char)104, (char)47, (char)116, (char)111, - (char)47, (char)102, (char)105, (char)108, - (char)101, (char)0}; - ck_assert_msg( - memcmp(check_msg->filename, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->filename, expected string '%s', is " - "'%s'", - check_string, check_msg->filename); - } - } -} -END_TEST - -Suite *legacy_auto_check_sbp_file_io_MsgFileioRemove_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_file_io_MsgFileioRemove"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_file_io_MsgFileioRemove"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_file_io_MsgFileioRemove); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_file_io_MsgFileioWriteResp.c b/c/test/legacy/auto_check_sbp_file_io_MsgFileioWriteResp.c deleted file mode 100644 index b4c91a74c8..0000000000 --- a/c/test/legacy/auto_check_sbp_file_io_MsgFileioWriteResp.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/file_io/test_MsgFileioWriteResp.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_file_io_MsgFileioWriteResp) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xab, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xab, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 171, 0, 66, 0, 4, 202, 0, 0, 0, 243, 243, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_fileio_write_resp_t *test_msg = - (msg_fileio_write_resp_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->sequence = 202; - sbp_payload_send(&sbp_state, 0xab, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xab, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_fileio_write_resp_t *check_msg = - (msg_fileio_write_resp_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->sequence == 202, - "incorrect value for sequence, expected 202, is %d", - check_msg->sequence); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_file_io_MsgFileioWriteResp_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_file_io_MsgFileioWriteResp"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_file_io_MsgFileioWriteResp"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_file_io_MsgFileioWriteResp); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_flash_MsgFlashDone.c b/c/test/legacy/auto_check_sbp_flash_MsgFlashDone.c deleted file mode 100644 index 29bd5dee46..0000000000 --- a/c/test/legacy/auto_check_sbp_flash_MsgFlashDone.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgFlashDone.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_flash_MsgFlashDone) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xe0, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xe0, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 224, 0, 195, 4, 1, 82, 6, 54, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_flash_done_t *test_msg = (msg_flash_done_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->response = 82; - sbp_payload_send(&sbp_state, 0xe0, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xe0, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_flash_done_t *check_msg = (msg_flash_done_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->response == 82, - "incorrect value for response, expected 82, is %d", - check_msg->response); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_flash_MsgFlashDone_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_flash_MsgFlashDone"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_flash_MsgFlashDone"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_flash_MsgFlashDone); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_flash_MsgFlashErase.c b/c/test/legacy/auto_check_sbp_flash_MsgFlashErase.c deleted file mode 100644 index cf050a9d14..0000000000 --- a/c/test/legacy/auto_check_sbp_flash_MsgFlashErase.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgFlashErase.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_flash_MsgFlashErase) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xe2, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xe2, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 226, 0, 195, 4, 5, 74, 238, 177, 118, 132, 0, 251, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_flash_erase_t *test_msg = (msg_flash_erase_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->sector_num = 2222371310; - test_msg->target = 74; - sbp_payload_send(&sbp_state, 0xe2, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xe2, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_flash_erase_t *check_msg = (msg_flash_erase_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->sector_num == 2222371310, - "incorrect value for sector_num, expected 2222371310, is %d", - check_msg->sector_num); - ck_assert_msg(check_msg->target == 74, - "incorrect value for target, expected 74, is %d", - check_msg->target); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_flash_MsgFlashErase_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_flash_MsgFlashErase"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_flash_MsgFlashErase"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_flash_MsgFlashErase); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_flash_MsgFlashProgram.c b/c/test/legacy/auto_check_sbp_flash_MsgFlashProgram.c deleted file mode 100644 index 981a5267e9..0000000000 --- a/c/test/legacy/auto_check_sbp_flash_MsgFlashProgram.c +++ /dev/null @@ -1,2262 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgFlashProgram.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_flash_MsgFlashProgram) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xe6, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xe6, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 230, 0, 195, 4, 255, 212, 87, 52, 244, 250, 176, 222, 235, - 106, 144, 29, 141, 255, 3, 16, 192, 237, 172, 254, 213, 4, 220, - 98, 34, 222, 230, 214, 6, 217, 172, 122, 46, 13, 38, 240, 236, - 60, 121, 47, 252, 163, 141, 222, 29, 168, 214, 118, 55, 201, 233, - 21, 214, 57, 245, 246, 19, 3, 121, 49, 231, 37, 186, 58, 238, - 98, 39, 70, 232, 133, 25, 10, 134, 129, 69, 228, 134, 9, 88, - 183, 133, 171, 255, 166, 100, 152, 231, 92, 9, 196, 106, 246, 29, - 145, 156, 151, 32, 67, 188, 63, 233, 142, 174, 139, 154, 127, 35, - 60, 56, 187, 121, 103, 135, 152, 182, 88, 160, 255, 227, 240, 54, - 100, 91, 31, 141, 102, 130, 254, 54, 227, 229, 62, 53, 225, 143, - 88, 139, 126, 235, 235, 35, 54, 134, 163, 92, 57, 87, 130, 178, - 22, 158, 18, 237, 209, 187, 226, 1, 46, 64, 226, 235, 213, 186, - 159, 221, 186, 25, 115, 84, 131, 167, 201, 104, 1, 200, 13, 50, - 71, 73, 193, 201, 250, 172, 193, 13, 20, 238, 130, 243, 68, 4, - 72, 46, 194, 113, 255, 238, 15, 230, 64, 178, 127, 217, 92, 160, - 201, 118, 163, 144, 58, 28, 174, 65, 73, 45, 123, 118, 83, 107, - 239, 168, 32, 212, 191, 81, 93, 186, 223, 32, 19, 58, 137, 72, - 217, 151, 251, 83, 20, 113, 37, 151, 34, 37, 71, 95, 105, 235, - 144, 164, 83, 197, 254, 183, 223, 91, 19, 45, 227, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_flash_program_t *test_msg = (msg_flash_program_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->addr_len = 250; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->addr_start[0]); - } - test_msg->addr_start[0] = 87; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->addr_start[0]); - } - test_msg->addr_start[1] = 52; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->addr_start[0]); - } - test_msg->addr_start[2] = 244; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[0] = 176; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[1] = 222; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[2] = 235; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[3] = 106; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[4] = 144; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[5] = 29; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[6] = 141; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[7] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[8] = 3; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[9] = 16; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[10] = 192; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[11] = 237; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[12] = 172; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[13] = 254; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[14] = 213; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[15] = 4; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[16] = 220; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[17] = 98; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[18] = 34; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[19] = 222; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[20] = 230; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[21] = 214; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[22] = 6; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[23] = 217; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[24] = 172; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[25] = 122; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[26] = 46; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[27] = 13; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[28] = 38; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[29] = 240; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[30] = 236; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[31] = 60; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[32] = 121; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[33] = 47; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[34] = 252; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[35] = 163; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[36] = 141; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[37] = 222; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[38] = 29; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[39] = 168; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[40] = 214; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[41] = 118; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[42] = 55; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[43] = 201; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[44] = 233; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[45] = 21; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[46] = 214; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[47] = 57; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[48] = 245; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[49] = 246; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[50] = 19; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[51] = 3; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[52] = 121; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[53] = 49; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[54] = 231; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[55] = 37; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[56] = 186; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[57] = 58; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[58] = 238; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[59] = 98; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[60] = 39; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[61] = 70; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[62] = 232; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[63] = 133; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[64] = 25; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[65] = 10; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[66] = 134; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[67] = 129; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[68] = 69; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[69] = 228; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[70] = 134; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[71] = 9; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[72] = 88; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[73] = 183; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[74] = 133; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[75] = 171; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[76] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[77] = 166; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[78] = 100; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[79] = 152; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[80] = 231; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[81] = 92; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[82] = 9; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[83] = 196; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[84] = 106; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[85] = 246; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[86] = 29; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[87] = 145; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[88] = 156; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[89] = 151; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[90] = 32; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[91] = 67; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[92] = 188; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[93] = 63; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[94] = 233; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[95] = 142; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[96] = 174; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[97] = 139; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[98] = 154; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[99] = 127; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[100] = 35; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[101] = 60; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[102] = 56; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[103] = 187; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[104] = 121; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[105] = 103; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[106] = 135; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[107] = 152; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[108] = 182; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[109] = 88; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[110] = 160; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[111] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[112] = 227; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[113] = 240; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[114] = 54; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[115] = 100; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[116] = 91; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[117] = 31; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[118] = 141; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[119] = 102; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[120] = 130; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[121] = 254; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[122] = 54; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[123] = 227; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[124] = 229; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[125] = 62; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[126] = 53; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[127] = 225; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[128] = 143; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[129] = 88; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[130] = 139; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[131] = 126; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[132] = 235; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[133] = 235; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[134] = 35; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[135] = 54; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[136] = 134; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[137] = 163; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[138] = 92; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[139] = 57; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[140] = 87; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[141] = 130; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[142] = 178; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[143] = 22; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[144] = 158; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[145] = 18; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[146] = 237; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[147] = 209; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[148] = 187; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[149] = 226; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[150] = 1; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[151] = 46; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[152] = 64; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[153] = 226; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[154] = 235; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[155] = 213; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[156] = 186; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[157] = 159; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[158] = 221; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[159] = 186; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[160] = 25; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[161] = 115; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[162] = 84; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[163] = 131; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[164] = 167; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[165] = 201; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[166] = 104; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[167] = 1; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[168] = 200; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[169] = 13; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[170] = 50; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[171] = 71; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[172] = 73; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[173] = 193; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[174] = 201; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[175] = 250; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[176] = 172; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[177] = 193; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[178] = 13; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[179] = 20; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[180] = 238; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[181] = 130; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[182] = 243; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[183] = 68; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[184] = 4; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[185] = 72; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[186] = 46; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[187] = 194; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[188] = 113; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[189] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[190] = 238; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[191] = 15; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[192] = 230; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[193] = 64; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[194] = 178; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[195] = 127; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[196] = 217; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[197] = 92; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[198] = 160; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[199] = 201; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[200] = 118; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[201] = 163; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[202] = 144; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[203] = 58; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[204] = 28; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[205] = 174; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[206] = 65; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[207] = 73; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[208] = 45; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[209] = 123; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[210] = 118; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[211] = 83; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[212] = 107; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[213] = 239; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[214] = 168; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[215] = 32; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[216] = 212; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[217] = 191; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[218] = 81; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[219] = 93; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[220] = 186; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[221] = 223; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[222] = 32; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[223] = 19; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[224] = 58; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[225] = 137; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[226] = 72; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[227] = 217; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[228] = 151; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[229] = 251; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[230] = 83; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[231] = 20; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[232] = 113; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[233] = 37; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[234] = 151; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[235] = 34; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[236] = 37; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[237] = 71; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[238] = 95; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[239] = 105; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[240] = 235; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[241] = 144; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[242] = 164; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[243] = 83; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[244] = 197; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[245] = 254; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[246] = 183; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[247] = 223; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[248] = 91; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[249] = 19; - test_msg->target = 212; - sbp_payload_send(&sbp_state, 0xe6, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xe6, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_flash_program_t *check_msg = - (msg_flash_program_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->addr_len == 250, - "incorrect value for addr_len, expected 250, is %d", - check_msg->addr_len); - ck_assert_msg(check_msg->addr_start[0] == 87, - "incorrect value for addr_start[0], expected 87, is %d", - check_msg->addr_start[0]); - ck_assert_msg(check_msg->addr_start[1] == 52, - "incorrect value for addr_start[1], expected 52, is %d", - check_msg->addr_start[1]); - ck_assert_msg(check_msg->addr_start[2] == 244, - "incorrect value for addr_start[2], expected 244, is %d", - check_msg->addr_start[2]); - ck_assert_msg(check_msg->data[0] == 176, - "incorrect value for data[0], expected 176, is %d", - check_msg->data[0]); - ck_assert_msg(check_msg->data[1] == 222, - "incorrect value for data[1], expected 222, is %d", - check_msg->data[1]); - ck_assert_msg(check_msg->data[2] == 235, - "incorrect value for data[2], expected 235, is %d", - check_msg->data[2]); - ck_assert_msg(check_msg->data[3] == 106, - "incorrect value for data[3], expected 106, is %d", - check_msg->data[3]); - ck_assert_msg(check_msg->data[4] == 144, - "incorrect value for data[4], expected 144, is %d", - check_msg->data[4]); - ck_assert_msg(check_msg->data[5] == 29, - "incorrect value for data[5], expected 29, is %d", - check_msg->data[5]); - ck_assert_msg(check_msg->data[6] == 141, - "incorrect value for data[6], expected 141, is %d", - check_msg->data[6]); - ck_assert_msg(check_msg->data[7] == 255, - "incorrect value for data[7], expected 255, is %d", - check_msg->data[7]); - ck_assert_msg(check_msg->data[8] == 3, - "incorrect value for data[8], expected 3, is %d", - check_msg->data[8]); - ck_assert_msg(check_msg->data[9] == 16, - "incorrect value for data[9], expected 16, is %d", - check_msg->data[9]); - ck_assert_msg(check_msg->data[10] == 192, - "incorrect value for data[10], expected 192, is %d", - check_msg->data[10]); - ck_assert_msg(check_msg->data[11] == 237, - "incorrect value for data[11], expected 237, is %d", - check_msg->data[11]); - ck_assert_msg(check_msg->data[12] == 172, - "incorrect value for data[12], expected 172, is %d", - check_msg->data[12]); - ck_assert_msg(check_msg->data[13] == 254, - "incorrect value for data[13], expected 254, is %d", - check_msg->data[13]); - ck_assert_msg(check_msg->data[14] == 213, - "incorrect value for data[14], expected 213, is %d", - check_msg->data[14]); - ck_assert_msg(check_msg->data[15] == 4, - "incorrect value for data[15], expected 4, is %d", - check_msg->data[15]); - ck_assert_msg(check_msg->data[16] == 220, - "incorrect value for data[16], expected 220, is %d", - check_msg->data[16]); - ck_assert_msg(check_msg->data[17] == 98, - "incorrect value for data[17], expected 98, is %d", - check_msg->data[17]); - ck_assert_msg(check_msg->data[18] == 34, - "incorrect value for data[18], expected 34, is %d", - check_msg->data[18]); - ck_assert_msg(check_msg->data[19] == 222, - "incorrect value for data[19], expected 222, is %d", - check_msg->data[19]); - ck_assert_msg(check_msg->data[20] == 230, - "incorrect value for data[20], expected 230, is %d", - check_msg->data[20]); - ck_assert_msg(check_msg->data[21] == 214, - "incorrect value for data[21], expected 214, is %d", - check_msg->data[21]); - ck_assert_msg(check_msg->data[22] == 6, - "incorrect value for data[22], expected 6, is %d", - check_msg->data[22]); - ck_assert_msg(check_msg->data[23] == 217, - "incorrect value for data[23], expected 217, is %d", - check_msg->data[23]); - ck_assert_msg(check_msg->data[24] == 172, - "incorrect value for data[24], expected 172, is %d", - check_msg->data[24]); - ck_assert_msg(check_msg->data[25] == 122, - "incorrect value for data[25], expected 122, is %d", - check_msg->data[25]); - ck_assert_msg(check_msg->data[26] == 46, - "incorrect value for data[26], expected 46, is %d", - check_msg->data[26]); - ck_assert_msg(check_msg->data[27] == 13, - "incorrect value for data[27], expected 13, is %d", - check_msg->data[27]); - ck_assert_msg(check_msg->data[28] == 38, - "incorrect value for data[28], expected 38, is %d", - check_msg->data[28]); - ck_assert_msg(check_msg->data[29] == 240, - "incorrect value for data[29], expected 240, is %d", - check_msg->data[29]); - ck_assert_msg(check_msg->data[30] == 236, - "incorrect value for data[30], expected 236, is %d", - check_msg->data[30]); - ck_assert_msg(check_msg->data[31] == 60, - "incorrect value for data[31], expected 60, is %d", - check_msg->data[31]); - ck_assert_msg(check_msg->data[32] == 121, - "incorrect value for data[32], expected 121, is %d", - check_msg->data[32]); - ck_assert_msg(check_msg->data[33] == 47, - "incorrect value for data[33], expected 47, is %d", - check_msg->data[33]); - ck_assert_msg(check_msg->data[34] == 252, - "incorrect value for data[34], expected 252, is %d", - check_msg->data[34]); - ck_assert_msg(check_msg->data[35] == 163, - "incorrect value for data[35], expected 163, is %d", - check_msg->data[35]); - ck_assert_msg(check_msg->data[36] == 141, - "incorrect value for data[36], expected 141, is %d", - check_msg->data[36]); - ck_assert_msg(check_msg->data[37] == 222, - "incorrect value for data[37], expected 222, is %d", - check_msg->data[37]); - ck_assert_msg(check_msg->data[38] == 29, - "incorrect value for data[38], expected 29, is %d", - check_msg->data[38]); - ck_assert_msg(check_msg->data[39] == 168, - "incorrect value for data[39], expected 168, is %d", - check_msg->data[39]); - ck_assert_msg(check_msg->data[40] == 214, - "incorrect value for data[40], expected 214, is %d", - check_msg->data[40]); - ck_assert_msg(check_msg->data[41] == 118, - "incorrect value for data[41], expected 118, is %d", - check_msg->data[41]); - ck_assert_msg(check_msg->data[42] == 55, - "incorrect value for data[42], expected 55, is %d", - check_msg->data[42]); - ck_assert_msg(check_msg->data[43] == 201, - "incorrect value for data[43], expected 201, is %d", - check_msg->data[43]); - ck_assert_msg(check_msg->data[44] == 233, - "incorrect value for data[44], expected 233, is %d", - check_msg->data[44]); - ck_assert_msg(check_msg->data[45] == 21, - "incorrect value for data[45], expected 21, is %d", - check_msg->data[45]); - ck_assert_msg(check_msg->data[46] == 214, - "incorrect value for data[46], expected 214, is %d", - check_msg->data[46]); - ck_assert_msg(check_msg->data[47] == 57, - "incorrect value for data[47], expected 57, is %d", - check_msg->data[47]); - ck_assert_msg(check_msg->data[48] == 245, - "incorrect value for data[48], expected 245, is %d", - check_msg->data[48]); - ck_assert_msg(check_msg->data[49] == 246, - "incorrect value for data[49], expected 246, is %d", - check_msg->data[49]); - ck_assert_msg(check_msg->data[50] == 19, - "incorrect value for data[50], expected 19, is %d", - check_msg->data[50]); - ck_assert_msg(check_msg->data[51] == 3, - "incorrect value for data[51], expected 3, is %d", - check_msg->data[51]); - ck_assert_msg(check_msg->data[52] == 121, - "incorrect value for data[52], expected 121, is %d", - check_msg->data[52]); - ck_assert_msg(check_msg->data[53] == 49, - "incorrect value for data[53], expected 49, is %d", - check_msg->data[53]); - ck_assert_msg(check_msg->data[54] == 231, - "incorrect value for data[54], expected 231, is %d", - check_msg->data[54]); - ck_assert_msg(check_msg->data[55] == 37, - "incorrect value for data[55], expected 37, is %d", - check_msg->data[55]); - ck_assert_msg(check_msg->data[56] == 186, - "incorrect value for data[56], expected 186, is %d", - check_msg->data[56]); - ck_assert_msg(check_msg->data[57] == 58, - "incorrect value for data[57], expected 58, is %d", - check_msg->data[57]); - ck_assert_msg(check_msg->data[58] == 238, - "incorrect value for data[58], expected 238, is %d", - check_msg->data[58]); - ck_assert_msg(check_msg->data[59] == 98, - "incorrect value for data[59], expected 98, is %d", - check_msg->data[59]); - ck_assert_msg(check_msg->data[60] == 39, - "incorrect value for data[60], expected 39, is %d", - check_msg->data[60]); - ck_assert_msg(check_msg->data[61] == 70, - "incorrect value for data[61], expected 70, is %d", - check_msg->data[61]); - ck_assert_msg(check_msg->data[62] == 232, - "incorrect value for data[62], expected 232, is %d", - check_msg->data[62]); - ck_assert_msg(check_msg->data[63] == 133, - "incorrect value for data[63], expected 133, is %d", - check_msg->data[63]); - ck_assert_msg(check_msg->data[64] == 25, - "incorrect value for data[64], expected 25, is %d", - check_msg->data[64]); - ck_assert_msg(check_msg->data[65] == 10, - "incorrect value for data[65], expected 10, is %d", - check_msg->data[65]); - ck_assert_msg(check_msg->data[66] == 134, - "incorrect value for data[66], expected 134, is %d", - check_msg->data[66]); - ck_assert_msg(check_msg->data[67] == 129, - "incorrect value for data[67], expected 129, is %d", - check_msg->data[67]); - ck_assert_msg(check_msg->data[68] == 69, - "incorrect value for data[68], expected 69, is %d", - check_msg->data[68]); - ck_assert_msg(check_msg->data[69] == 228, - "incorrect value for data[69], expected 228, is %d", - check_msg->data[69]); - ck_assert_msg(check_msg->data[70] == 134, - "incorrect value for data[70], expected 134, is %d", - check_msg->data[70]); - ck_assert_msg(check_msg->data[71] == 9, - "incorrect value for data[71], expected 9, is %d", - check_msg->data[71]); - ck_assert_msg(check_msg->data[72] == 88, - "incorrect value for data[72], expected 88, is %d", - check_msg->data[72]); - ck_assert_msg(check_msg->data[73] == 183, - "incorrect value for data[73], expected 183, is %d", - check_msg->data[73]); - ck_assert_msg(check_msg->data[74] == 133, - "incorrect value for data[74], expected 133, is %d", - check_msg->data[74]); - ck_assert_msg(check_msg->data[75] == 171, - "incorrect value for data[75], expected 171, is %d", - check_msg->data[75]); - ck_assert_msg(check_msg->data[76] == 255, - "incorrect value for data[76], expected 255, is %d", - check_msg->data[76]); - ck_assert_msg(check_msg->data[77] == 166, - "incorrect value for data[77], expected 166, is %d", - check_msg->data[77]); - ck_assert_msg(check_msg->data[78] == 100, - "incorrect value for data[78], expected 100, is %d", - check_msg->data[78]); - ck_assert_msg(check_msg->data[79] == 152, - "incorrect value for data[79], expected 152, is %d", - check_msg->data[79]); - ck_assert_msg(check_msg->data[80] == 231, - "incorrect value for data[80], expected 231, is %d", - check_msg->data[80]); - ck_assert_msg(check_msg->data[81] == 92, - "incorrect value for data[81], expected 92, is %d", - check_msg->data[81]); - ck_assert_msg(check_msg->data[82] == 9, - "incorrect value for data[82], expected 9, is %d", - check_msg->data[82]); - ck_assert_msg(check_msg->data[83] == 196, - "incorrect value for data[83], expected 196, is %d", - check_msg->data[83]); - ck_assert_msg(check_msg->data[84] == 106, - "incorrect value for data[84], expected 106, is %d", - check_msg->data[84]); - ck_assert_msg(check_msg->data[85] == 246, - "incorrect value for data[85], expected 246, is %d", - check_msg->data[85]); - ck_assert_msg(check_msg->data[86] == 29, - "incorrect value for data[86], expected 29, is %d", - check_msg->data[86]); - ck_assert_msg(check_msg->data[87] == 145, - "incorrect value for data[87], expected 145, is %d", - check_msg->data[87]); - ck_assert_msg(check_msg->data[88] == 156, - "incorrect value for data[88], expected 156, is %d", - check_msg->data[88]); - ck_assert_msg(check_msg->data[89] == 151, - "incorrect value for data[89], expected 151, is %d", - check_msg->data[89]); - ck_assert_msg(check_msg->data[90] == 32, - "incorrect value for data[90], expected 32, is %d", - check_msg->data[90]); - ck_assert_msg(check_msg->data[91] == 67, - "incorrect value for data[91], expected 67, is %d", - check_msg->data[91]); - ck_assert_msg(check_msg->data[92] == 188, - "incorrect value for data[92], expected 188, is %d", - check_msg->data[92]); - ck_assert_msg(check_msg->data[93] == 63, - "incorrect value for data[93], expected 63, is %d", - check_msg->data[93]); - ck_assert_msg(check_msg->data[94] == 233, - "incorrect value for data[94], expected 233, is %d", - check_msg->data[94]); - ck_assert_msg(check_msg->data[95] == 142, - "incorrect value for data[95], expected 142, is %d", - check_msg->data[95]); - ck_assert_msg(check_msg->data[96] == 174, - "incorrect value for data[96], expected 174, is %d", - check_msg->data[96]); - ck_assert_msg(check_msg->data[97] == 139, - "incorrect value for data[97], expected 139, is %d", - check_msg->data[97]); - ck_assert_msg(check_msg->data[98] == 154, - "incorrect value for data[98], expected 154, is %d", - check_msg->data[98]); - ck_assert_msg(check_msg->data[99] == 127, - "incorrect value for data[99], expected 127, is %d", - check_msg->data[99]); - ck_assert_msg(check_msg->data[100] == 35, - "incorrect value for data[100], expected 35, is %d", - check_msg->data[100]); - ck_assert_msg(check_msg->data[101] == 60, - "incorrect value for data[101], expected 60, is %d", - check_msg->data[101]); - ck_assert_msg(check_msg->data[102] == 56, - "incorrect value for data[102], expected 56, is %d", - check_msg->data[102]); - ck_assert_msg(check_msg->data[103] == 187, - "incorrect value for data[103], expected 187, is %d", - check_msg->data[103]); - ck_assert_msg(check_msg->data[104] == 121, - "incorrect value for data[104], expected 121, is %d", - check_msg->data[104]); - ck_assert_msg(check_msg->data[105] == 103, - "incorrect value for data[105], expected 103, is %d", - check_msg->data[105]); - ck_assert_msg(check_msg->data[106] == 135, - "incorrect value for data[106], expected 135, is %d", - check_msg->data[106]); - ck_assert_msg(check_msg->data[107] == 152, - "incorrect value for data[107], expected 152, is %d", - check_msg->data[107]); - ck_assert_msg(check_msg->data[108] == 182, - "incorrect value for data[108], expected 182, is %d", - check_msg->data[108]); - ck_assert_msg(check_msg->data[109] == 88, - "incorrect value for data[109], expected 88, is %d", - check_msg->data[109]); - ck_assert_msg(check_msg->data[110] == 160, - "incorrect value for data[110], expected 160, is %d", - check_msg->data[110]); - ck_assert_msg(check_msg->data[111] == 255, - "incorrect value for data[111], expected 255, is %d", - check_msg->data[111]); - ck_assert_msg(check_msg->data[112] == 227, - "incorrect value for data[112], expected 227, is %d", - check_msg->data[112]); - ck_assert_msg(check_msg->data[113] == 240, - "incorrect value for data[113], expected 240, is %d", - check_msg->data[113]); - ck_assert_msg(check_msg->data[114] == 54, - "incorrect value for data[114], expected 54, is %d", - check_msg->data[114]); - ck_assert_msg(check_msg->data[115] == 100, - "incorrect value for data[115], expected 100, is %d", - check_msg->data[115]); - ck_assert_msg(check_msg->data[116] == 91, - "incorrect value for data[116], expected 91, is %d", - check_msg->data[116]); - ck_assert_msg(check_msg->data[117] == 31, - "incorrect value for data[117], expected 31, is %d", - check_msg->data[117]); - ck_assert_msg(check_msg->data[118] == 141, - "incorrect value for data[118], expected 141, is %d", - check_msg->data[118]); - ck_assert_msg(check_msg->data[119] == 102, - "incorrect value for data[119], expected 102, is %d", - check_msg->data[119]); - ck_assert_msg(check_msg->data[120] == 130, - "incorrect value for data[120], expected 130, is %d", - check_msg->data[120]); - ck_assert_msg(check_msg->data[121] == 254, - "incorrect value for data[121], expected 254, is %d", - check_msg->data[121]); - ck_assert_msg(check_msg->data[122] == 54, - "incorrect value for data[122], expected 54, is %d", - check_msg->data[122]); - ck_assert_msg(check_msg->data[123] == 227, - "incorrect value for data[123], expected 227, is %d", - check_msg->data[123]); - ck_assert_msg(check_msg->data[124] == 229, - "incorrect value for data[124], expected 229, is %d", - check_msg->data[124]); - ck_assert_msg(check_msg->data[125] == 62, - "incorrect value for data[125], expected 62, is %d", - check_msg->data[125]); - ck_assert_msg(check_msg->data[126] == 53, - "incorrect value for data[126], expected 53, is %d", - check_msg->data[126]); - ck_assert_msg(check_msg->data[127] == 225, - "incorrect value for data[127], expected 225, is %d", - check_msg->data[127]); - ck_assert_msg(check_msg->data[128] == 143, - "incorrect value for data[128], expected 143, is %d", - check_msg->data[128]); - ck_assert_msg(check_msg->data[129] == 88, - "incorrect value for data[129], expected 88, is %d", - check_msg->data[129]); - ck_assert_msg(check_msg->data[130] == 139, - "incorrect value for data[130], expected 139, is %d", - check_msg->data[130]); - ck_assert_msg(check_msg->data[131] == 126, - "incorrect value for data[131], expected 126, is %d", - check_msg->data[131]); - ck_assert_msg(check_msg->data[132] == 235, - "incorrect value for data[132], expected 235, is %d", - check_msg->data[132]); - ck_assert_msg(check_msg->data[133] == 235, - "incorrect value for data[133], expected 235, is %d", - check_msg->data[133]); - ck_assert_msg(check_msg->data[134] == 35, - "incorrect value for data[134], expected 35, is %d", - check_msg->data[134]); - ck_assert_msg(check_msg->data[135] == 54, - "incorrect value for data[135], expected 54, is %d", - check_msg->data[135]); - ck_assert_msg(check_msg->data[136] == 134, - "incorrect value for data[136], expected 134, is %d", - check_msg->data[136]); - ck_assert_msg(check_msg->data[137] == 163, - "incorrect value for data[137], expected 163, is %d", - check_msg->data[137]); - ck_assert_msg(check_msg->data[138] == 92, - "incorrect value for data[138], expected 92, is %d", - check_msg->data[138]); - ck_assert_msg(check_msg->data[139] == 57, - "incorrect value for data[139], expected 57, is %d", - check_msg->data[139]); - ck_assert_msg(check_msg->data[140] == 87, - "incorrect value for data[140], expected 87, is %d", - check_msg->data[140]); - ck_assert_msg(check_msg->data[141] == 130, - "incorrect value for data[141], expected 130, is %d", - check_msg->data[141]); - ck_assert_msg(check_msg->data[142] == 178, - "incorrect value for data[142], expected 178, is %d", - check_msg->data[142]); - ck_assert_msg(check_msg->data[143] == 22, - "incorrect value for data[143], expected 22, is %d", - check_msg->data[143]); - ck_assert_msg(check_msg->data[144] == 158, - "incorrect value for data[144], expected 158, is %d", - check_msg->data[144]); - ck_assert_msg(check_msg->data[145] == 18, - "incorrect value for data[145], expected 18, is %d", - check_msg->data[145]); - ck_assert_msg(check_msg->data[146] == 237, - "incorrect value for data[146], expected 237, is %d", - check_msg->data[146]); - ck_assert_msg(check_msg->data[147] == 209, - "incorrect value for data[147], expected 209, is %d", - check_msg->data[147]); - ck_assert_msg(check_msg->data[148] == 187, - "incorrect value for data[148], expected 187, is %d", - check_msg->data[148]); - ck_assert_msg(check_msg->data[149] == 226, - "incorrect value for data[149], expected 226, is %d", - check_msg->data[149]); - ck_assert_msg(check_msg->data[150] == 1, - "incorrect value for data[150], expected 1, is %d", - check_msg->data[150]); - ck_assert_msg(check_msg->data[151] == 46, - "incorrect value for data[151], expected 46, is %d", - check_msg->data[151]); - ck_assert_msg(check_msg->data[152] == 64, - "incorrect value for data[152], expected 64, is %d", - check_msg->data[152]); - ck_assert_msg(check_msg->data[153] == 226, - "incorrect value for data[153], expected 226, is %d", - check_msg->data[153]); - ck_assert_msg(check_msg->data[154] == 235, - "incorrect value for data[154], expected 235, is %d", - check_msg->data[154]); - ck_assert_msg(check_msg->data[155] == 213, - "incorrect value for data[155], expected 213, is %d", - check_msg->data[155]); - ck_assert_msg(check_msg->data[156] == 186, - "incorrect value for data[156], expected 186, is %d", - check_msg->data[156]); - ck_assert_msg(check_msg->data[157] == 159, - "incorrect value for data[157], expected 159, is %d", - check_msg->data[157]); - ck_assert_msg(check_msg->data[158] == 221, - "incorrect value for data[158], expected 221, is %d", - check_msg->data[158]); - ck_assert_msg(check_msg->data[159] == 186, - "incorrect value for data[159], expected 186, is %d", - check_msg->data[159]); - ck_assert_msg(check_msg->data[160] == 25, - "incorrect value for data[160], expected 25, is %d", - check_msg->data[160]); - ck_assert_msg(check_msg->data[161] == 115, - "incorrect value for data[161], expected 115, is %d", - check_msg->data[161]); - ck_assert_msg(check_msg->data[162] == 84, - "incorrect value for data[162], expected 84, is %d", - check_msg->data[162]); - ck_assert_msg(check_msg->data[163] == 131, - "incorrect value for data[163], expected 131, is %d", - check_msg->data[163]); - ck_assert_msg(check_msg->data[164] == 167, - "incorrect value for data[164], expected 167, is %d", - check_msg->data[164]); - ck_assert_msg(check_msg->data[165] == 201, - "incorrect value for data[165], expected 201, is %d", - check_msg->data[165]); - ck_assert_msg(check_msg->data[166] == 104, - "incorrect value for data[166], expected 104, is %d", - check_msg->data[166]); - ck_assert_msg(check_msg->data[167] == 1, - "incorrect value for data[167], expected 1, is %d", - check_msg->data[167]); - ck_assert_msg(check_msg->data[168] == 200, - "incorrect value for data[168], expected 200, is %d", - check_msg->data[168]); - ck_assert_msg(check_msg->data[169] == 13, - "incorrect value for data[169], expected 13, is %d", - check_msg->data[169]); - ck_assert_msg(check_msg->data[170] == 50, - "incorrect value for data[170], expected 50, is %d", - check_msg->data[170]); - ck_assert_msg(check_msg->data[171] == 71, - "incorrect value for data[171], expected 71, is %d", - check_msg->data[171]); - ck_assert_msg(check_msg->data[172] == 73, - "incorrect value for data[172], expected 73, is %d", - check_msg->data[172]); - ck_assert_msg(check_msg->data[173] == 193, - "incorrect value for data[173], expected 193, is %d", - check_msg->data[173]); - ck_assert_msg(check_msg->data[174] == 201, - "incorrect value for data[174], expected 201, is %d", - check_msg->data[174]); - ck_assert_msg(check_msg->data[175] == 250, - "incorrect value for data[175], expected 250, is %d", - check_msg->data[175]); - ck_assert_msg(check_msg->data[176] == 172, - "incorrect value for data[176], expected 172, is %d", - check_msg->data[176]); - ck_assert_msg(check_msg->data[177] == 193, - "incorrect value for data[177], expected 193, is %d", - check_msg->data[177]); - ck_assert_msg(check_msg->data[178] == 13, - "incorrect value for data[178], expected 13, is %d", - check_msg->data[178]); - ck_assert_msg(check_msg->data[179] == 20, - "incorrect value for data[179], expected 20, is %d", - check_msg->data[179]); - ck_assert_msg(check_msg->data[180] == 238, - "incorrect value for data[180], expected 238, is %d", - check_msg->data[180]); - ck_assert_msg(check_msg->data[181] == 130, - "incorrect value for data[181], expected 130, is %d", - check_msg->data[181]); - ck_assert_msg(check_msg->data[182] == 243, - "incorrect value for data[182], expected 243, is %d", - check_msg->data[182]); - ck_assert_msg(check_msg->data[183] == 68, - "incorrect value for data[183], expected 68, is %d", - check_msg->data[183]); - ck_assert_msg(check_msg->data[184] == 4, - "incorrect value for data[184], expected 4, is %d", - check_msg->data[184]); - ck_assert_msg(check_msg->data[185] == 72, - "incorrect value for data[185], expected 72, is %d", - check_msg->data[185]); - ck_assert_msg(check_msg->data[186] == 46, - "incorrect value for data[186], expected 46, is %d", - check_msg->data[186]); - ck_assert_msg(check_msg->data[187] == 194, - "incorrect value for data[187], expected 194, is %d", - check_msg->data[187]); - ck_assert_msg(check_msg->data[188] == 113, - "incorrect value for data[188], expected 113, is %d", - check_msg->data[188]); - ck_assert_msg(check_msg->data[189] == 255, - "incorrect value for data[189], expected 255, is %d", - check_msg->data[189]); - ck_assert_msg(check_msg->data[190] == 238, - "incorrect value for data[190], expected 238, is %d", - check_msg->data[190]); - ck_assert_msg(check_msg->data[191] == 15, - "incorrect value for data[191], expected 15, is %d", - check_msg->data[191]); - ck_assert_msg(check_msg->data[192] == 230, - "incorrect value for data[192], expected 230, is %d", - check_msg->data[192]); - ck_assert_msg(check_msg->data[193] == 64, - "incorrect value for data[193], expected 64, is %d", - check_msg->data[193]); - ck_assert_msg(check_msg->data[194] == 178, - "incorrect value for data[194], expected 178, is %d", - check_msg->data[194]); - ck_assert_msg(check_msg->data[195] == 127, - "incorrect value for data[195], expected 127, is %d", - check_msg->data[195]); - ck_assert_msg(check_msg->data[196] == 217, - "incorrect value for data[196], expected 217, is %d", - check_msg->data[196]); - ck_assert_msg(check_msg->data[197] == 92, - "incorrect value for data[197], expected 92, is %d", - check_msg->data[197]); - ck_assert_msg(check_msg->data[198] == 160, - "incorrect value for data[198], expected 160, is %d", - check_msg->data[198]); - ck_assert_msg(check_msg->data[199] == 201, - "incorrect value for data[199], expected 201, is %d", - check_msg->data[199]); - ck_assert_msg(check_msg->data[200] == 118, - "incorrect value for data[200], expected 118, is %d", - check_msg->data[200]); - ck_assert_msg(check_msg->data[201] == 163, - "incorrect value for data[201], expected 163, is %d", - check_msg->data[201]); - ck_assert_msg(check_msg->data[202] == 144, - "incorrect value for data[202], expected 144, is %d", - check_msg->data[202]); - ck_assert_msg(check_msg->data[203] == 58, - "incorrect value for data[203], expected 58, is %d", - check_msg->data[203]); - ck_assert_msg(check_msg->data[204] == 28, - "incorrect value for data[204], expected 28, is %d", - check_msg->data[204]); - ck_assert_msg(check_msg->data[205] == 174, - "incorrect value for data[205], expected 174, is %d", - check_msg->data[205]); - ck_assert_msg(check_msg->data[206] == 65, - "incorrect value for data[206], expected 65, is %d", - check_msg->data[206]); - ck_assert_msg(check_msg->data[207] == 73, - "incorrect value for data[207], expected 73, is %d", - check_msg->data[207]); - ck_assert_msg(check_msg->data[208] == 45, - "incorrect value for data[208], expected 45, is %d", - check_msg->data[208]); - ck_assert_msg(check_msg->data[209] == 123, - "incorrect value for data[209], expected 123, is %d", - check_msg->data[209]); - ck_assert_msg(check_msg->data[210] == 118, - "incorrect value for data[210], expected 118, is %d", - check_msg->data[210]); - ck_assert_msg(check_msg->data[211] == 83, - "incorrect value for data[211], expected 83, is %d", - check_msg->data[211]); - ck_assert_msg(check_msg->data[212] == 107, - "incorrect value for data[212], expected 107, is %d", - check_msg->data[212]); - ck_assert_msg(check_msg->data[213] == 239, - "incorrect value for data[213], expected 239, is %d", - check_msg->data[213]); - ck_assert_msg(check_msg->data[214] == 168, - "incorrect value for data[214], expected 168, is %d", - check_msg->data[214]); - ck_assert_msg(check_msg->data[215] == 32, - "incorrect value for data[215], expected 32, is %d", - check_msg->data[215]); - ck_assert_msg(check_msg->data[216] == 212, - "incorrect value for data[216], expected 212, is %d", - check_msg->data[216]); - ck_assert_msg(check_msg->data[217] == 191, - "incorrect value for data[217], expected 191, is %d", - check_msg->data[217]); - ck_assert_msg(check_msg->data[218] == 81, - "incorrect value for data[218], expected 81, is %d", - check_msg->data[218]); - ck_assert_msg(check_msg->data[219] == 93, - "incorrect value for data[219], expected 93, is %d", - check_msg->data[219]); - ck_assert_msg(check_msg->data[220] == 186, - "incorrect value for data[220], expected 186, is %d", - check_msg->data[220]); - ck_assert_msg(check_msg->data[221] == 223, - "incorrect value for data[221], expected 223, is %d", - check_msg->data[221]); - ck_assert_msg(check_msg->data[222] == 32, - "incorrect value for data[222], expected 32, is %d", - check_msg->data[222]); - ck_assert_msg(check_msg->data[223] == 19, - "incorrect value for data[223], expected 19, is %d", - check_msg->data[223]); - ck_assert_msg(check_msg->data[224] == 58, - "incorrect value for data[224], expected 58, is %d", - check_msg->data[224]); - ck_assert_msg(check_msg->data[225] == 137, - "incorrect value for data[225], expected 137, is %d", - check_msg->data[225]); - ck_assert_msg(check_msg->data[226] == 72, - "incorrect value for data[226], expected 72, is %d", - check_msg->data[226]); - ck_assert_msg(check_msg->data[227] == 217, - "incorrect value for data[227], expected 217, is %d", - check_msg->data[227]); - ck_assert_msg(check_msg->data[228] == 151, - "incorrect value for data[228], expected 151, is %d", - check_msg->data[228]); - ck_assert_msg(check_msg->data[229] == 251, - "incorrect value for data[229], expected 251, is %d", - check_msg->data[229]); - ck_assert_msg(check_msg->data[230] == 83, - "incorrect value for data[230], expected 83, is %d", - check_msg->data[230]); - ck_assert_msg(check_msg->data[231] == 20, - "incorrect value for data[231], expected 20, is %d", - check_msg->data[231]); - ck_assert_msg(check_msg->data[232] == 113, - "incorrect value for data[232], expected 113, is %d", - check_msg->data[232]); - ck_assert_msg(check_msg->data[233] == 37, - "incorrect value for data[233], expected 37, is %d", - check_msg->data[233]); - ck_assert_msg(check_msg->data[234] == 151, - "incorrect value for data[234], expected 151, is %d", - check_msg->data[234]); - ck_assert_msg(check_msg->data[235] == 34, - "incorrect value for data[235], expected 34, is %d", - check_msg->data[235]); - ck_assert_msg(check_msg->data[236] == 37, - "incorrect value for data[236], expected 37, is %d", - check_msg->data[236]); - ck_assert_msg(check_msg->data[237] == 71, - "incorrect value for data[237], expected 71, is %d", - check_msg->data[237]); - ck_assert_msg(check_msg->data[238] == 95, - "incorrect value for data[238], expected 95, is %d", - check_msg->data[238]); - ck_assert_msg(check_msg->data[239] == 105, - "incorrect value for data[239], expected 105, is %d", - check_msg->data[239]); - ck_assert_msg(check_msg->data[240] == 235, - "incorrect value for data[240], expected 235, is %d", - check_msg->data[240]); - ck_assert_msg(check_msg->data[241] == 144, - "incorrect value for data[241], expected 144, is %d", - check_msg->data[241]); - ck_assert_msg(check_msg->data[242] == 164, - "incorrect value for data[242], expected 164, is %d", - check_msg->data[242]); - ck_assert_msg(check_msg->data[243] == 83, - "incorrect value for data[243], expected 83, is %d", - check_msg->data[243]); - ck_assert_msg(check_msg->data[244] == 197, - "incorrect value for data[244], expected 197, is %d", - check_msg->data[244]); - ck_assert_msg(check_msg->data[245] == 254, - "incorrect value for data[245], expected 254, is %d", - check_msg->data[245]); - ck_assert_msg(check_msg->data[246] == 183, - "incorrect value for data[246], expected 183, is %d", - check_msg->data[246]); - ck_assert_msg(check_msg->data[247] == 223, - "incorrect value for data[247], expected 223, is %d", - check_msg->data[247]); - ck_assert_msg(check_msg->data[248] == 91, - "incorrect value for data[248], expected 91, is %d", - check_msg->data[248]); - ck_assert_msg(check_msg->data[249] == 19, - "incorrect value for data[249], expected 19, is %d", - check_msg->data[249]); - ck_assert_msg(check_msg->target == 212, - "incorrect value for target, expected 212, is %d", - check_msg->target); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_flash_MsgFlashProgram_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_flash_MsgFlashProgram"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_flash_MsgFlashProgram"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_flash_MsgFlashProgram); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_flash_MsgFlashReadReq.c b/c/test/legacy/auto_check_sbp_flash_MsgFlashReadReq.c deleted file mode 100644 index bf9da1dc62..0000000000 --- a/c/test/legacy/auto_check_sbp_flash_MsgFlashReadReq.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgFlashReadReq.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_flash_MsgFlashReadReq) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xe7, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xe7, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 231, 0, 195, 4, 5, 241, 28, 75, 244, 71, 210, 57, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_flash_read_req_t *test_msg = (msg_flash_read_req_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->addr_len = 71; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->addr_start[0]); - } - test_msg->addr_start[0] = 28; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->addr_start[0]); - } - test_msg->addr_start[1] = 75; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->addr_start[0]); - } - test_msg->addr_start[2] = 244; - test_msg->target = 241; - sbp_payload_send(&sbp_state, 0xe7, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xe7, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_flash_read_req_t *check_msg = - (msg_flash_read_req_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->addr_len == 71, - "incorrect value for addr_len, expected 71, is %d", - check_msg->addr_len); - ck_assert_msg(check_msg->addr_start[0] == 28, - "incorrect value for addr_start[0], expected 28, is %d", - check_msg->addr_start[0]); - ck_assert_msg(check_msg->addr_start[1] == 75, - "incorrect value for addr_start[1], expected 75, is %d", - check_msg->addr_start[1]); - ck_assert_msg(check_msg->addr_start[2] == 244, - "incorrect value for addr_start[2], expected 244, is %d", - check_msg->addr_start[2]); - ck_assert_msg(check_msg->target == 241, - "incorrect value for target, expected 241, is %d", - check_msg->target); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_flash_MsgFlashReadReq_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_flash_MsgFlashReadReq"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_flash_MsgFlashReadReq"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_flash_MsgFlashReadReq); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_flash_MsgFlashReadResp.c b/c/test/legacy/auto_check_sbp_flash_MsgFlashReadResp.c deleted file mode 100644 index 23b8d88159..0000000000 --- a/c/test/legacy/auto_check_sbp_flash_MsgFlashReadResp.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgFlashReadResp.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_flash_MsgFlashReadResp) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xe1, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xe1, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 225, 0, 195, 4, 5, 136, 155, 52, 172, 124, 149, 135, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_flash_read_resp_t *test_msg = (msg_flash_read_resp_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->addr_len = 124; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->addr_start[0]); - } - test_msg->addr_start[0] = 155; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->addr_start[0]); - } - test_msg->addr_start[1] = 52; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->addr_start[0]); - } - test_msg->addr_start[2] = 172; - test_msg->target = 136; - sbp_payload_send(&sbp_state, 0xe1, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xe1, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_flash_read_resp_t *check_msg = - (msg_flash_read_resp_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->addr_len == 124, - "incorrect value for addr_len, expected 124, is %d", - check_msg->addr_len); - ck_assert_msg(check_msg->addr_start[0] == 155, - "incorrect value for addr_start[0], expected 155, is %d", - check_msg->addr_start[0]); - ck_assert_msg(check_msg->addr_start[1] == 52, - "incorrect value for addr_start[1], expected 52, is %d", - check_msg->addr_start[1]); - ck_assert_msg(check_msg->addr_start[2] == 172, - "incorrect value for addr_start[2], expected 172, is %d", - check_msg->addr_start[2]); - ck_assert_msg(check_msg->target == 136, - "incorrect value for target, expected 136, is %d", - check_msg->target); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_flash_MsgFlashReadResp_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_flash_MsgFlashReadResp"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_flash_MsgFlashReadResp"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_flash_MsgFlashReadResp); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_flash_MsgM25FlashWriteStatus.c b/c/test/legacy/auto_check_sbp_flash_MsgM25FlashWriteStatus.c deleted file mode 100644 index 4512ad19b5..0000000000 --- a/c/test/legacy/auto_check_sbp_flash_MsgM25FlashWriteStatus.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgM25FlashWriteStatus.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_flash_MsgM25FlashWriteStatus) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xf3, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xf3, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 243, 0, 195, 4, 1, 5, 112, 200, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_m25_flash_write_status_t *test_msg = - (msg_m25_flash_write_status_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[0] = 5; - sbp_payload_send(&sbp_state, 0xf3, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xf3, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_m25_flash_write_status_t *check_msg = - (msg_m25_flash_write_status_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->status[0] == 5, - "incorrect value for status[0], expected 5, is %d", - check_msg->status[0]); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_flash_MsgM25FlashWriteStatus_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_flash_MsgM25FlashWriteStatus"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_flash_MsgM25FlashWriteStatus"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_flash_MsgM25FlashWriteStatus); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_flash_MsgStmFlashLockSector.c b/c/test/legacy/auto_check_sbp_flash_MsgStmFlashLockSector.c deleted file mode 100644 index 8e0b278558..0000000000 --- a/c/test/legacy/auto_check_sbp_flash_MsgStmFlashLockSector.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgStmFlashLockSector.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_flash_MsgStmFlashLockSector) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xe3, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xe3, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 227, 0, 195, 4, 4, 161, 247, 197, 67, 229, 32, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_stm_flash_lock_sector_t *test_msg = - (msg_stm_flash_lock_sector_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->sector = 1137047457; - sbp_payload_send(&sbp_state, 0xe3, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xe3, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_stm_flash_lock_sector_t *check_msg = - (msg_stm_flash_lock_sector_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->sector == 1137047457, - "incorrect value for sector, expected 1137047457, is %d", - check_msg->sector); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_flash_MsgStmFlashLockSector_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_flash_MsgStmFlashLockSector"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_flash_MsgStmFlashLockSector"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_flash_MsgStmFlashLockSector); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_flash_MsgStmFlashUnlockSector.c b/c/test/legacy/auto_check_sbp_flash_MsgStmFlashUnlockSector.c deleted file mode 100644 index 51dcff56a2..0000000000 --- a/c/test/legacy/auto_check_sbp_flash_MsgStmFlashUnlockSector.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgStmFlashUnlockSector.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_flash_MsgStmFlashUnlockSector) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xe4, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xe4, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 228, 0, 195, 4, 4, 31, 16, 231, 49, 53, 217, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_stm_flash_unlock_sector_t *test_msg = - (msg_stm_flash_unlock_sector_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->sector = 837226527; - sbp_payload_send(&sbp_state, 0xe4, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xe4, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_stm_flash_unlock_sector_t *check_msg = - (msg_stm_flash_unlock_sector_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->sector == 837226527, - "incorrect value for sector, expected 837226527, is %d", - check_msg->sector); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_flash_MsgStmFlashUnlockSector_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_flash_MsgStmFlashUnlockSector"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_flash_MsgStmFlashUnlockSector"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_flash_MsgStmFlashUnlockSector); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_flash_MsgStmUniqueIdReq.c b/c/test/legacy/auto_check_sbp_flash_MsgStmUniqueIdReq.c deleted file mode 100644 index b39d76f1ab..0000000000 --- a/c/test/legacy/auto_check_sbp_flash_MsgStmUniqueIdReq.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgStmUniqueIdReq.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_flash_MsgStmUniqueIdReq) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xe8, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xe8, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 232, 0, 195, 4, 0, 66, 138, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - sbp_payload_send(&sbp_state, 0xe8, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xe8, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - } -} -END_TEST - -Suite *legacy_auto_check_sbp_flash_MsgStmUniqueIdReq_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_flash_MsgStmUniqueIdReq"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_flash_MsgStmUniqueIdReq"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_flash_MsgStmUniqueIdReq); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_flash_MsgStmUniqueIdResp.c b/c/test/legacy/auto_check_sbp_flash_MsgStmUniqueIdResp.c deleted file mode 100644 index 09fb49471c..0000000000 --- a/c/test/legacy/auto_check_sbp_flash_MsgStmUniqueIdResp.c +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgStmUniqueIdResp.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_flash_MsgStmUniqueIdResp) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xe5, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xe5, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 229, 0, 195, 4, 12, 196, 16, 15, 163, - 85, 221, 119, 102, 32, 194, 56, 144, 221, 196, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_stm_unique_id_resp_t *test_msg = - (msg_stm_unique_id_resp_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stm_id[0]); - } - test_msg->stm_id[0] = 196; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stm_id[0]); - } - test_msg->stm_id[1] = 16; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stm_id[0]); - } - test_msg->stm_id[2] = 15; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stm_id[0]); - } - test_msg->stm_id[3] = 163; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stm_id[0]); - } - test_msg->stm_id[4] = 85; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stm_id[0]); - } - test_msg->stm_id[5] = 221; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stm_id[0]); - } - test_msg->stm_id[6] = 119; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stm_id[0]); - } - test_msg->stm_id[7] = 102; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stm_id[0]); - } - test_msg->stm_id[8] = 32; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stm_id[0]); - } - test_msg->stm_id[9] = 194; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stm_id[0]); - } - test_msg->stm_id[10] = 56; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stm_id[0]); - } - test_msg->stm_id[11] = 144; - sbp_payload_send(&sbp_state, 0xe5, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xe5, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_stm_unique_id_resp_t *check_msg = - (msg_stm_unique_id_resp_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->stm_id[0] == 196, - "incorrect value for stm_id[0], expected 196, is %d", - check_msg->stm_id[0]); - ck_assert_msg(check_msg->stm_id[1] == 16, - "incorrect value for stm_id[1], expected 16, is %d", - check_msg->stm_id[1]); - ck_assert_msg(check_msg->stm_id[2] == 15, - "incorrect value for stm_id[2], expected 15, is %d", - check_msg->stm_id[2]); - ck_assert_msg(check_msg->stm_id[3] == 163, - "incorrect value for stm_id[3], expected 163, is %d", - check_msg->stm_id[3]); - ck_assert_msg(check_msg->stm_id[4] == 85, - "incorrect value for stm_id[4], expected 85, is %d", - check_msg->stm_id[4]); - ck_assert_msg(check_msg->stm_id[5] == 221, - "incorrect value for stm_id[5], expected 221, is %d", - check_msg->stm_id[5]); - ck_assert_msg(check_msg->stm_id[6] == 119, - "incorrect value for stm_id[6], expected 119, is %d", - check_msg->stm_id[6]); - ck_assert_msg(check_msg->stm_id[7] == 102, - "incorrect value for stm_id[7], expected 102, is %d", - check_msg->stm_id[7]); - ck_assert_msg(check_msg->stm_id[8] == 32, - "incorrect value for stm_id[8], expected 32, is %d", - check_msg->stm_id[8]); - ck_assert_msg(check_msg->stm_id[9] == 194, - "incorrect value for stm_id[9], expected 194, is %d", - check_msg->stm_id[9]); - ck_assert_msg(check_msg->stm_id[10] == 56, - "incorrect value for stm_id[10], expected 56, is %d", - check_msg->stm_id[10]); - ck_assert_msg(check_msg->stm_id[11] == 144, - "incorrect value for stm_id[11], expected 144, is %d", - check_msg->stm_id[11]); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_flash_MsgStmUniqueIdResp_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_flash_MsgStmUniqueIdResp"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_flash_MsgStmUniqueIdResp"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_flash_MsgStmUniqueIdResp); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_imu_MsgImuAux.c b/c/test/legacy/auto_check_sbp_imu_MsgImuAux.c deleted file mode 100644 index 46470686df..0000000000 --- a/c/test/legacy/auto_check_sbp_imu_MsgImuAux.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/imu/test_MsgImuAux.yaml by generate.py. Do not -// modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_imu_MsgImuAux) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x901, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x901, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 1, 9, 52, 18, 4, 1, 244, 10, 66, 200, 252, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_imu_aux_t *test_msg = (msg_imu_aux_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->imu_conf = 66; - test_msg->imu_type = 1; - test_msg->temp = 2804; - sbp_payload_send(&sbp_state, 0x901, 4660, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 4660, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 4660, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x901, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_imu_aux_t *check_msg = (msg_imu_aux_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->imu_conf == 66, - "incorrect value for imu_conf, expected 66, is %d", - check_msg->imu_conf); - ck_assert_msg(check_msg->imu_type == 1, - "incorrect value for imu_type, expected 1, is %d", - check_msg->imu_type); - ck_assert_msg(check_msg->temp == 2804, - "incorrect value for temp, expected 2804, is %d", - check_msg->temp); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_imu_MsgImuAux_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_imu_MsgImuAux"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_imu_MsgImuAux"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_imu_MsgImuAux); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_imu_MsgImuRaw.c b/c/test/legacy/auto_check_sbp_imu_MsgImuRaw.c deleted file mode 100644 index e430958496..0000000000 --- a/c/test/legacy/auto_check_sbp_imu_MsgImuRaw.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/imu/test_MsgImuRaw.yaml by generate.py. Do not -// modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_imu_MsgImuRaw) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x900, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x900, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 9, 52, 18, 17, 26, 1, 0, 192, 206, 96, 0, - 223, 255, 44, 16, 60, 0, 208, 254, 238, 255, 70, 135, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_imu_raw_t *test_msg = (msg_imu_raw_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->acc_x = 96; - test_msg->acc_y = -33; - test_msg->acc_z = 4140; - test_msg->gyr_x = 60; - test_msg->gyr_y = -304; - test_msg->gyr_z = -18; - test_msg->tow = 3221225754; - test_msg->tow_f = 206; - sbp_payload_send(&sbp_state, 0x900, 4660, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 4660, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 4660, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x900, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_imu_raw_t *check_msg = (msg_imu_raw_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->acc_x == 96, - "incorrect value for acc_x, expected 96, is %d", - check_msg->acc_x); - ck_assert_msg(check_msg->acc_y == -33, - "incorrect value for acc_y, expected -33, is %d", - check_msg->acc_y); - ck_assert_msg(check_msg->acc_z == 4140, - "incorrect value for acc_z, expected 4140, is %d", - check_msg->acc_z); - ck_assert_msg(check_msg->gyr_x == 60, - "incorrect value for gyr_x, expected 60, is %d", - check_msg->gyr_x); - ck_assert_msg(check_msg->gyr_y == -304, - "incorrect value for gyr_y, expected -304, is %d", - check_msg->gyr_y); - ck_assert_msg(check_msg->gyr_z == -18, - "incorrect value for gyr_z, expected -18, is %d", - check_msg->gyr_z); - ck_assert_msg(check_msg->tow == 3221225754, - "incorrect value for tow, expected 3221225754, is %d", - check_msg->tow); - ck_assert_msg(check_msg->tow_f == 206, - "incorrect value for tow_f, expected 206, is %d", - check_msg->tow_f); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_imu_MsgImuRaw_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_imu_MsgImuRaw"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_imu_MsgImuRaw"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_imu_MsgImuRaw); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_integrity_MsgAcknowledge.c b/c/test/legacy/auto_check_sbp_integrity_MsgAcknowledge.c deleted file mode 100644 index 0853446337..0000000000 --- a/c/test/legacy/auto_check_sbp_integrity_MsgAcknowledge.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/integrity/test_MsgAcknowledge.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_integrity_MsgAcknowledge) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xBD2, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xBD2, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 210, 11, 42, 0, 11, 30, 64, 226, 1, 0, 0, 1, 0, 1, 0, 2, 86, 178, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_acknowledge_t *test_msg = (msg_acknowledge_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->area_id = 123456; - test_msg->correction_mask_on_demand = 1; - test_msg->correction_mask_stream = 1; - test_msg->request_id = 30; - test_msg->response_code = 0; - test_msg->solution_id = 2; - sbp_payload_send(&sbp_state, 0xBD2, 42, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 42, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 42, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xBD2, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_acknowledge_t *check_msg = (msg_acknowledge_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->area_id == 123456, - "incorrect value for area_id, expected 123456, is %d", - check_msg->area_id); - ck_assert_msg( - check_msg->correction_mask_on_demand == 1, - "incorrect value for correction_mask_on_demand, expected 1, is %d", - check_msg->correction_mask_on_demand); - ck_assert_msg( - check_msg->correction_mask_stream == 1, - "incorrect value for correction_mask_stream, expected 1, is %d", - check_msg->correction_mask_stream); - ck_assert_msg(check_msg->request_id == 30, - "incorrect value for request_id, expected 30, is %d", - check_msg->request_id); - ck_assert_msg(check_msg->response_code == 0, - "incorrect value for response_code, expected 0, is %d", - check_msg->response_code); - ck_assert_msg(check_msg->solution_id == 2, - "incorrect value for solution_id, expected 2, is %d", - check_msg->solution_id); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_integrity_MsgAcknowledge_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_integrity_MsgAcknowledge"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_integrity_MsgAcknowledge"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_integrity_MsgAcknowledge); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagHighLevel.c b/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagHighLevel.c deleted file mode 100644 index 4d966d41ff..0000000000 --- a/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagHighLevel.c +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/integrity/test_MsgSsrFlagHighLevel.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_integrity_MsgSsrFlagHighLevel) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 3001, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 3001, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 185, 11, 66, 0, 31, 180, 0, 0, 0, 3, 0, 104, - 1, 0, 0, 6, 0, 10, 20, 0, 30, 0, 40, 1, 2, - 3, 0, 0, 0, 0, 0, 0, 4, 5, 6, 7, 102, 67, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_flag_high_level_t *test_msg = - (msg_ssr_flag_high_level_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->chain_id = 40; - test_msg->corr_time.tow = 360; - test_msg->corr_time.wn = 6; - test_msg->obs_time.tow = 180; - test_msg->obs_time.wn = 3; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[0] = 0; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[1] = 0; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[2] = 0; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[3] = 0; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[4] = 0; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[5] = 0; - test_msg->ssr_sol_id = 10; - test_msg->tile_id = 30; - test_msg->tile_set_id = 20; - test_msg->use_bds_sat = 3; - test_msg->use_gal_sat = 2; - test_msg->use_gps_sat = 1; - test_msg->use_iono_grid_point_sat_los = 7; - test_msg->use_iono_grid_points = 5; - test_msg->use_iono_tile_sat_los = 6; - test_msg->use_tropo_grid_points = 4; - sbp_payload_send(&sbp_state, 3001, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 3001, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_flag_high_level_t *check_msg = - (msg_ssr_flag_high_level_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->chain_id == 40, - "incorrect value for chain_id, expected 40, is %d", - check_msg->chain_id); - ck_assert_msg(check_msg->corr_time.tow == 360, - "incorrect value for corr_time.tow, expected 360, is %d", - check_msg->corr_time.tow); - ck_assert_msg(check_msg->corr_time.wn == 6, - "incorrect value for corr_time.wn, expected 6, is %d", - check_msg->corr_time.wn); - ck_assert_msg(check_msg->obs_time.tow == 180, - "incorrect value for obs_time.tow, expected 180, is %d", - check_msg->obs_time.tow); - ck_assert_msg(check_msg->obs_time.wn == 3, - "incorrect value for obs_time.wn, expected 3, is %d", - check_msg->obs_time.wn); - ck_assert_msg(check_msg->reserved[0] == 0, - "incorrect value for reserved[0], expected 0, is %d", - check_msg->reserved[0]); - ck_assert_msg(check_msg->reserved[1] == 0, - "incorrect value for reserved[1], expected 0, is %d", - check_msg->reserved[1]); - ck_assert_msg(check_msg->reserved[2] == 0, - "incorrect value for reserved[2], expected 0, is %d", - check_msg->reserved[2]); - ck_assert_msg(check_msg->reserved[3] == 0, - "incorrect value for reserved[3], expected 0, is %d", - check_msg->reserved[3]); - ck_assert_msg(check_msg->reserved[4] == 0, - "incorrect value for reserved[4], expected 0, is %d", - check_msg->reserved[4]); - ck_assert_msg(check_msg->reserved[5] == 0, - "incorrect value for reserved[5], expected 0, is %d", - check_msg->reserved[5]); - ck_assert_msg(check_msg->ssr_sol_id == 10, - "incorrect value for ssr_sol_id, expected 10, is %d", - check_msg->ssr_sol_id); - ck_assert_msg(check_msg->tile_id == 30, - "incorrect value for tile_id, expected 30, is %d", - check_msg->tile_id); - ck_assert_msg(check_msg->tile_set_id == 20, - "incorrect value for tile_set_id, expected 20, is %d", - check_msg->tile_set_id); - ck_assert_msg(check_msg->use_bds_sat == 3, - "incorrect value for use_bds_sat, expected 3, is %d", - check_msg->use_bds_sat); - ck_assert_msg(check_msg->use_gal_sat == 2, - "incorrect value for use_gal_sat, expected 2, is %d", - check_msg->use_gal_sat); - ck_assert_msg(check_msg->use_gps_sat == 1, - "incorrect value for use_gps_sat, expected 1, is %d", - check_msg->use_gps_sat); - ck_assert_msg( - check_msg->use_iono_grid_point_sat_los == 7, - "incorrect value for use_iono_grid_point_sat_los, expected 7, is %d", - check_msg->use_iono_grid_point_sat_los); - ck_assert_msg(check_msg->use_iono_grid_points == 5, - "incorrect value for use_iono_grid_points, expected 5, is %d", - check_msg->use_iono_grid_points); - ck_assert_msg( - check_msg->use_iono_tile_sat_los == 6, - "incorrect value for use_iono_tile_sat_los, expected 6, is %d", - check_msg->use_iono_tile_sat_los); - ck_assert_msg( - check_msg->use_tropo_grid_points == 4, - "incorrect value for use_tropo_grid_points, expected 4, is %d", - check_msg->use_tropo_grid_points); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_integrity_MsgSsrFlagHighLevel_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_integrity_MsgSsrFlagHighLevel"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_integrity_MsgSsrFlagHighLevel"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_integrity_MsgSsrFlagHighLevel); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagIonoGridPointSatLos.c b/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagIonoGridPointSatLos.c deleted file mode 100644 index 0d38a5dd47..0000000000 --- a/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagIonoGridPointSatLos.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/integrity/test_MsgSsrFlagIonoGridPointSatLos.yaml -// by generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPointSatLos) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 3025, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 3025, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 209, 11, 66, 0, 21, 180, 0, 0, 0, 3, 0, 1, 2, 3, - 4, 0, 5, 0, 6, 30, 0, 2, 10, 11, 15, 14, 98, 148, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_flag_iono_grid_point_sat_los_t *test_msg = - (msg_ssr_flag_iono_grid_point_sat_los_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->faulty_los) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->faulty_los[0]); - } - test_msg->faulty_los[0].constellation = 11; - test_msg->faulty_los[0].satId = 10; - if (sizeof(test_msg->faulty_los) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->faulty_los[0]); - } - test_msg->faulty_los[1].constellation = 14; - test_msg->faulty_los[1].satId = 15; - test_msg->grid_point_id = 30; - test_msg->header.chain_id = 6; - test_msg->header.num_msgs = 1; - test_msg->header.obs_time.tow = 180; - test_msg->header.obs_time.wn = 3; - test_msg->header.seq_num = 2; - test_msg->header.ssr_sol_id = 3; - test_msg->header.tile_id = 5; - test_msg->header.tile_set_id = 4; - test_msg->n_faulty_los = 2; - sbp_payload_send(&sbp_state, 3025, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 3025, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_flag_iono_grid_point_sat_los_t *check_msg = - (msg_ssr_flag_iono_grid_point_sat_los_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - check_msg->faulty_los[0].constellation == 11, - "incorrect value for faulty_los[0].constellation, expected 11, is %d", - check_msg->faulty_los[0].constellation); - ck_assert_msg(check_msg->faulty_los[0].satId == 10, - "incorrect value for faulty_los[0].satId, expected 10, is %d", - check_msg->faulty_los[0].satId); - ck_assert_msg( - check_msg->faulty_los[1].constellation == 14, - "incorrect value for faulty_los[1].constellation, expected 14, is %d", - check_msg->faulty_los[1].constellation); - ck_assert_msg(check_msg->faulty_los[1].satId == 15, - "incorrect value for faulty_los[1].satId, expected 15, is %d", - check_msg->faulty_los[1].satId); - ck_assert_msg(check_msg->grid_point_id == 30, - "incorrect value for grid_point_id, expected 30, is %d", - check_msg->grid_point_id); - ck_assert_msg(check_msg->header.chain_id == 6, - "incorrect value for header.chain_id, expected 6, is %d", - check_msg->header.chain_id); - ck_assert_msg(check_msg->header.num_msgs == 1, - "incorrect value for header.num_msgs, expected 1, is %d", - check_msg->header.num_msgs); - ck_assert_msg( - check_msg->header.obs_time.tow == 180, - "incorrect value for header.obs_time.tow, expected 180, is %d", - check_msg->header.obs_time.tow); - ck_assert_msg(check_msg->header.obs_time.wn == 3, - "incorrect value for header.obs_time.wn, expected 3, is %d", - check_msg->header.obs_time.wn); - ck_assert_msg(check_msg->header.seq_num == 2, - "incorrect value for header.seq_num, expected 2, is %d", - check_msg->header.seq_num); - ck_assert_msg(check_msg->header.ssr_sol_id == 3, - "incorrect value for header.ssr_sol_id, expected 3, is %d", - check_msg->header.ssr_sol_id); - ck_assert_msg(check_msg->header.tile_id == 5, - "incorrect value for header.tile_id, expected 5, is %d", - check_msg->header.tile_id); - ck_assert_msg(check_msg->header.tile_set_id == 4, - "incorrect value for header.tile_set_id, expected 4, is %d", - check_msg->header.tile_set_id); - ck_assert_msg(check_msg->n_faulty_los == 2, - "incorrect value for n_faulty_los, expected 2, is %d", - check_msg->n_faulty_los); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPointSatLos_suite( - void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPointSatLos"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_integrity_" - "MsgSsrFlagIonoGridPointSatLos"); - tcase_add_test( - tc_acq, - test_legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPointSatLos); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagIonoGridPoints.c b/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagIonoGridPoints.c deleted file mode 100644 index 5ada35637b..0000000000 --- a/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagIonoGridPoints.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/integrity/test_MsgSsrFlagIonoGridPoints.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPoints) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 3015, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 3015, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 199, 11, 66, 0, 21, 180, 0, 0, 0, 3, 0, 1, 2, 3, - 4, 0, 5, 0, 6, 3, 10, 0, 11, 0, 12, 0, 53, 7, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_flag_iono_grid_points_t *test_msg = - (msg_ssr_flag_iono_grid_points_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->faulty_points) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->faulty_points[0]); - } - test_msg->faulty_points[0] = 10; - if (sizeof(test_msg->faulty_points) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->faulty_points[0]); - } - test_msg->faulty_points[1] = 11; - if (sizeof(test_msg->faulty_points) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->faulty_points[0]); - } - test_msg->faulty_points[2] = 12; - test_msg->header.chain_id = 6; - test_msg->header.num_msgs = 1; - test_msg->header.obs_time.tow = 180; - test_msg->header.obs_time.wn = 3; - test_msg->header.seq_num = 2; - test_msg->header.ssr_sol_id = 3; - test_msg->header.tile_id = 5; - test_msg->header.tile_set_id = 4; - test_msg->n_faulty_points = 3; - sbp_payload_send(&sbp_state, 3015, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 3015, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_flag_iono_grid_points_t *check_msg = - (msg_ssr_flag_iono_grid_points_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->faulty_points[0] == 10, - "incorrect value for faulty_points[0], expected 10, is %d", - check_msg->faulty_points[0]); - ck_assert_msg(check_msg->faulty_points[1] == 11, - "incorrect value for faulty_points[1], expected 11, is %d", - check_msg->faulty_points[1]); - ck_assert_msg(check_msg->faulty_points[2] == 12, - "incorrect value for faulty_points[2], expected 12, is %d", - check_msg->faulty_points[2]); - ck_assert_msg(check_msg->header.chain_id == 6, - "incorrect value for header.chain_id, expected 6, is %d", - check_msg->header.chain_id); - ck_assert_msg(check_msg->header.num_msgs == 1, - "incorrect value for header.num_msgs, expected 1, is %d", - check_msg->header.num_msgs); - ck_assert_msg( - check_msg->header.obs_time.tow == 180, - "incorrect value for header.obs_time.tow, expected 180, is %d", - check_msg->header.obs_time.tow); - ck_assert_msg(check_msg->header.obs_time.wn == 3, - "incorrect value for header.obs_time.wn, expected 3, is %d", - check_msg->header.obs_time.wn); - ck_assert_msg(check_msg->header.seq_num == 2, - "incorrect value for header.seq_num, expected 2, is %d", - check_msg->header.seq_num); - ck_assert_msg(check_msg->header.ssr_sol_id == 3, - "incorrect value for header.ssr_sol_id, expected 3, is %d", - check_msg->header.ssr_sol_id); - ck_assert_msg(check_msg->header.tile_id == 5, - "incorrect value for header.tile_id, expected 5, is %d", - check_msg->header.tile_id); - ck_assert_msg(check_msg->header.tile_set_id == 4, - "incorrect value for header.tile_set_id, expected 4, is %d", - check_msg->header.tile_set_id); - ck_assert_msg(check_msg->n_faulty_points == 3, - "incorrect value for n_faulty_points, expected 3, is %d", - check_msg->n_faulty_points); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPoints_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPoints"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_integrity_" - "MsgSsrFlagIonoGridPoints"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPoints); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagIonoTileSatLos.c b/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagIonoTileSatLos.c deleted file mode 100644 index 48967145f6..0000000000 --- a/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagIonoTileSatLos.c +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/integrity/test_MsgSsrFlagIonoTileSatLos.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_integrity_MsgSsrFlagIonoTileSatLos) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 3021, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 3021, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 205, 11, 66, 0, 19, 180, 0, 0, 0, 3, 0, 1, 2, - 3, 4, 0, 5, 0, 6, 2, 10, 11, 15, 14, 239, 235, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_flag_iono_tile_sat_los_t *test_msg = - (msg_ssr_flag_iono_tile_sat_los_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->faulty_los) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->faulty_los[0]); - } - test_msg->faulty_los[0].constellation = 11; - test_msg->faulty_los[0].satId = 10; - if (sizeof(test_msg->faulty_los) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->faulty_los[0]); - } - test_msg->faulty_los[1].constellation = 14; - test_msg->faulty_los[1].satId = 15; - test_msg->header.chain_id = 6; - test_msg->header.num_msgs = 1; - test_msg->header.obs_time.tow = 180; - test_msg->header.obs_time.wn = 3; - test_msg->header.seq_num = 2; - test_msg->header.ssr_sol_id = 3; - test_msg->header.tile_id = 5; - test_msg->header.tile_set_id = 4; - test_msg->n_faulty_los = 2; - sbp_payload_send(&sbp_state, 3021, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 3021, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_flag_iono_tile_sat_los_t *check_msg = - (msg_ssr_flag_iono_tile_sat_los_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - check_msg->faulty_los[0].constellation == 11, - "incorrect value for faulty_los[0].constellation, expected 11, is %d", - check_msg->faulty_los[0].constellation); - ck_assert_msg(check_msg->faulty_los[0].satId == 10, - "incorrect value for faulty_los[0].satId, expected 10, is %d", - check_msg->faulty_los[0].satId); - ck_assert_msg( - check_msg->faulty_los[1].constellation == 14, - "incorrect value for faulty_los[1].constellation, expected 14, is %d", - check_msg->faulty_los[1].constellation); - ck_assert_msg(check_msg->faulty_los[1].satId == 15, - "incorrect value for faulty_los[1].satId, expected 15, is %d", - check_msg->faulty_los[1].satId); - ck_assert_msg(check_msg->header.chain_id == 6, - "incorrect value for header.chain_id, expected 6, is %d", - check_msg->header.chain_id); - ck_assert_msg(check_msg->header.num_msgs == 1, - "incorrect value for header.num_msgs, expected 1, is %d", - check_msg->header.num_msgs); - ck_assert_msg( - check_msg->header.obs_time.tow == 180, - "incorrect value for header.obs_time.tow, expected 180, is %d", - check_msg->header.obs_time.tow); - ck_assert_msg(check_msg->header.obs_time.wn == 3, - "incorrect value for header.obs_time.wn, expected 3, is %d", - check_msg->header.obs_time.wn); - ck_assert_msg(check_msg->header.seq_num == 2, - "incorrect value for header.seq_num, expected 2, is %d", - check_msg->header.seq_num); - ck_assert_msg(check_msg->header.ssr_sol_id == 3, - "incorrect value for header.ssr_sol_id, expected 3, is %d", - check_msg->header.ssr_sol_id); - ck_assert_msg(check_msg->header.tile_id == 5, - "incorrect value for header.tile_id, expected 5, is %d", - check_msg->header.tile_id); - ck_assert_msg(check_msg->header.tile_set_id == 4, - "incorrect value for header.tile_set_id, expected 4, is %d", - check_msg->header.tile_set_id); - ck_assert_msg(check_msg->n_faulty_los == 2, - "incorrect value for n_faulty_los, expected 2, is %d", - check_msg->n_faulty_los); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_integrity_MsgSsrFlagIonoTileSatLos_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_integrity_MsgSsrFlagIonoTileSatLos"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_integrity_" - "MsgSsrFlagIonoTileSatLos"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_integrity_MsgSsrFlagIonoTileSatLos); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagSatellites.c b/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagSatellites.c deleted file mode 100644 index 40818e1046..0000000000 --- a/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagSatellites.c +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/integrity/test_MsgSsrFlagSatellites.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_integrity_MsgSsrFlagSatellites) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 3005, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 3005, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 189, 11, 66, 0, 15, 180, 0, 0, 0, 3, 0, - 1, 2, 3, 4, 5, 3, 10, 11, 12, 110, 165, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_flag_satellites_t *test_msg = - (msg_ssr_flag_satellites_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->chain_id = 4; - test_msg->const_id = 5; - if (sizeof(test_msg->faulty_sats) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->faulty_sats[0]); - } - test_msg->faulty_sats[0] = 10; - if (sizeof(test_msg->faulty_sats) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->faulty_sats[0]); - } - test_msg->faulty_sats[1] = 11; - if (sizeof(test_msg->faulty_sats) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->faulty_sats[0]); - } - test_msg->faulty_sats[2] = 12; - test_msg->n_faulty_sats = 3; - test_msg->num_msgs = 1; - test_msg->obs_time.tow = 180; - test_msg->obs_time.wn = 3; - test_msg->seq_num = 2; - test_msg->ssr_sol_id = 3; - sbp_payload_send(&sbp_state, 3005, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 3005, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_flag_satellites_t *check_msg = - (msg_ssr_flag_satellites_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->chain_id == 4, - "incorrect value for chain_id, expected 4, is %d", - check_msg->chain_id); - ck_assert_msg(check_msg->const_id == 5, - "incorrect value for const_id, expected 5, is %d", - check_msg->const_id); - ck_assert_msg(check_msg->faulty_sats[0] == 10, - "incorrect value for faulty_sats[0], expected 10, is %d", - check_msg->faulty_sats[0]); - ck_assert_msg(check_msg->faulty_sats[1] == 11, - "incorrect value for faulty_sats[1], expected 11, is %d", - check_msg->faulty_sats[1]); - ck_assert_msg(check_msg->faulty_sats[2] == 12, - "incorrect value for faulty_sats[2], expected 12, is %d", - check_msg->faulty_sats[2]); - ck_assert_msg(check_msg->n_faulty_sats == 3, - "incorrect value for n_faulty_sats, expected 3, is %d", - check_msg->n_faulty_sats); - ck_assert_msg(check_msg->num_msgs == 1, - "incorrect value for num_msgs, expected 1, is %d", - check_msg->num_msgs); - ck_assert_msg(check_msg->obs_time.tow == 180, - "incorrect value for obs_time.tow, expected 180, is %d", - check_msg->obs_time.tow); - ck_assert_msg(check_msg->obs_time.wn == 3, - "incorrect value for obs_time.wn, expected 3, is %d", - check_msg->obs_time.wn); - ck_assert_msg(check_msg->seq_num == 2, - "incorrect value for seq_num, expected 2, is %d", - check_msg->seq_num); - ck_assert_msg(check_msg->ssr_sol_id == 3, - "incorrect value for ssr_sol_id, expected 3, is %d", - check_msg->ssr_sol_id); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_integrity_MsgSsrFlagSatellites_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_integrity_MsgSsrFlagSatellites"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_integrity_MsgSsrFlagSatellites"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_integrity_MsgSsrFlagSatellites); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagTropoGridPoints.c b/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagTropoGridPoints.c deleted file mode 100644 index 42bb9db6d4..0000000000 --- a/c/test/legacy/auto_check_sbp_integrity_MsgSsrFlagTropoGridPoints.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/integrity/test_MsgSsrFlagTropoGridPoints.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_integrity_MsgSsrFlagTropoGridPoints) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 3011, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 3011, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 195, 11, 66, 0, 21, 180, 0, 0, 0, 3, 0, 1, 2, 3, - 4, 0, 5, 0, 6, 3, 10, 0, 11, 0, 12, 0, 243, 150, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_flag_tropo_grid_points_t *test_msg = - (msg_ssr_flag_tropo_grid_points_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->faulty_points) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->faulty_points[0]); - } - test_msg->faulty_points[0] = 10; - if (sizeof(test_msg->faulty_points) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->faulty_points[0]); - } - test_msg->faulty_points[1] = 11; - if (sizeof(test_msg->faulty_points) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->faulty_points[0]); - } - test_msg->faulty_points[2] = 12; - test_msg->header.chain_id = 6; - test_msg->header.num_msgs = 1; - test_msg->header.obs_time.tow = 180; - test_msg->header.obs_time.wn = 3; - test_msg->header.seq_num = 2; - test_msg->header.ssr_sol_id = 3; - test_msg->header.tile_id = 5; - test_msg->header.tile_set_id = 4; - test_msg->n_faulty_points = 3; - sbp_payload_send(&sbp_state, 3011, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 3011, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_flag_tropo_grid_points_t *check_msg = - (msg_ssr_flag_tropo_grid_points_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->faulty_points[0] == 10, - "incorrect value for faulty_points[0], expected 10, is %d", - check_msg->faulty_points[0]); - ck_assert_msg(check_msg->faulty_points[1] == 11, - "incorrect value for faulty_points[1], expected 11, is %d", - check_msg->faulty_points[1]); - ck_assert_msg(check_msg->faulty_points[2] == 12, - "incorrect value for faulty_points[2], expected 12, is %d", - check_msg->faulty_points[2]); - ck_assert_msg(check_msg->header.chain_id == 6, - "incorrect value for header.chain_id, expected 6, is %d", - check_msg->header.chain_id); - ck_assert_msg(check_msg->header.num_msgs == 1, - "incorrect value for header.num_msgs, expected 1, is %d", - check_msg->header.num_msgs); - ck_assert_msg( - check_msg->header.obs_time.tow == 180, - "incorrect value for header.obs_time.tow, expected 180, is %d", - check_msg->header.obs_time.tow); - ck_assert_msg(check_msg->header.obs_time.wn == 3, - "incorrect value for header.obs_time.wn, expected 3, is %d", - check_msg->header.obs_time.wn); - ck_assert_msg(check_msg->header.seq_num == 2, - "incorrect value for header.seq_num, expected 2, is %d", - check_msg->header.seq_num); - ck_assert_msg(check_msg->header.ssr_sol_id == 3, - "incorrect value for header.ssr_sol_id, expected 3, is %d", - check_msg->header.ssr_sol_id); - ck_assert_msg(check_msg->header.tile_id == 5, - "incorrect value for header.tile_id, expected 5, is %d", - check_msg->header.tile_id); - ck_assert_msg(check_msg->header.tile_set_id == 4, - "incorrect value for header.tile_set_id, expected 4, is %d", - check_msg->header.tile_set_id); - ck_assert_msg(check_msg->n_faulty_points == 3, - "incorrect value for n_faulty_points, expected 3, is %d", - check_msg->n_faulty_points); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_integrity_MsgSsrFlagTropoGridPoints_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_integrity_MsgSsrFlagTropoGridPoints"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_integrity_" - "MsgSsrFlagTropoGridPoints"); - tcase_add_test( - tc_acq, test_legacy_auto_check_sbp_integrity_MsgSsrFlagTropoGridPoints); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_linux_MsgLinuxCpuState.c b/c/test/legacy/auto_check_sbp_linux_MsgLinuxCpuState.c deleted file mode 100644 index 619ec82728..0000000000 --- a/c/test/legacy/auto_check_sbp_linux_MsgLinuxCpuState.c +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxCpuState.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_linux_MsgLinuxCpuState) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x7f08, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x7f08, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 8, 127, 148, 133, 70, 101, 122, 195, 98, 215, 35, 94, - 235, 20, 112, 114, 111, 99, 101, 115, 115, 45, 110, 97, 109, - 101, 0, 0, 0, 47, 112, 97, 116, 104, 47, 116, 111, 47, - 112, 114, 111, 99, 101, 115, 115, 45, 110, 97, 109, 101, 32, - 97, 114, 103, 48, 32, 97, 114, 103, 49, 32, 97, 114, 103, - 50, 32, 97, 114, 103, 51, 32, 97, 114, 103, 52, 68, 229, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_linux_cpu_state_t *test_msg = (msg_linux_cpu_state_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - memcpy(test_msg->cmdline, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->cmdline) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->flags = 20; - test_msg->index = 101; - test_msg->pcpu = 98; - test_msg->pid = 50042; - test_msg->time = 3948815319; - { - const char assign_string[] = {(char)112, (char)114, (char)111, (char)99, - (char)101, (char)115, (char)115, (char)45, - (char)110, (char)97, (char)109, (char)101, - (char)0, (char)0, (char)0}; - memcpy(test_msg->tname, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->tname) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0x7f08, 34196, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 34196, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 34196, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x7f08, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_linux_cpu_state_t *check_msg = - (msg_linux_cpu_state_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - ck_assert_msg( - memcmp(check_msg->cmdline, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->cmdline, expected string '%s', is " - "'%s'", - check_string, check_msg->cmdline); - } - ck_assert_msg(check_msg->flags == 20, - "incorrect value for flags, expected 20, is %d", - check_msg->flags); - ck_assert_msg(check_msg->index == 101, - "incorrect value for index, expected 101, is %d", - check_msg->index); - ck_assert_msg(check_msg->pcpu == 98, - "incorrect value for pcpu, expected 98, is %d", - check_msg->pcpu); - ck_assert_msg(check_msg->pid == 50042, - "incorrect value for pid, expected 50042, is %d", - check_msg->pid); - ck_assert_msg(check_msg->time == 3948815319, - "incorrect value for time, expected 3948815319, is %d", - check_msg->time); - { - const char check_string[] = {(char)112, (char)114, (char)111, (char)99, - (char)101, (char)115, (char)115, (char)45, - (char)110, (char)97, (char)109, (char)101, - (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->tname, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->tname, expected string '%s', is '%s'", - check_string, check_msg->tname); - } - } -} -END_TEST - -Suite *legacy_auto_check_sbp_linux_MsgLinuxCpuState_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_linux_MsgLinuxCpuState"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_linux_MsgLinuxCpuState"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_linux_MsgLinuxCpuState); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_linux_MsgLinuxCpuStateDepA.c b/c/test/legacy/auto_check_sbp_linux_MsgLinuxCpuStateDepA.c deleted file mode 100644 index 7c1b7d2825..0000000000 --- a/c/test/legacy/auto_check_sbp_linux_MsgLinuxCpuStateDepA.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxCpuStateDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_linux_MsgLinuxCpuStateDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x7f00, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x7f00, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 127, 12, 91, 65, 51, 240, 250, 178, 112, 114, 111, - 99, 101, 115, 115, 45, 110, 97, 109, 101, 0, 0, 0, 47, - 112, 97, 116, 104, 47, 116, 111, 47, 112, 114, 111, 99, 101, - 115, 115, 45, 110, 97, 109, 101, 32, 97, 114, 103, 48, 32, - 97, 114, 103, 49, 32, 97, 114, 103, 50, 32, 97, 114, 103, - 51, 32, 97, 114, 103, 52, 80, 48, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_linux_cpu_state_dep_a_t *test_msg = - (msg_linux_cpu_state_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - memcpy(test_msg->cmdline, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->cmdline) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->index = 51; - test_msg->pcpu = 178; - test_msg->pid = 64240; - { - const char assign_string[] = {(char)112, (char)114, (char)111, (char)99, - (char)101, (char)115, (char)115, (char)45, - (char)110, (char)97, (char)109, (char)101, - (char)0, (char)0, (char)0}; - memcpy(test_msg->tname, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->tname) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0x7f00, 23308, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 23308, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 23308, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x7f00, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_linux_cpu_state_dep_a_t *check_msg = - (msg_linux_cpu_state_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - ck_assert_msg( - memcmp(check_msg->cmdline, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->cmdline, expected string '%s', is " - "'%s'", - check_string, check_msg->cmdline); - } - ck_assert_msg(check_msg->index == 51, - "incorrect value for index, expected 51, is %d", - check_msg->index); - ck_assert_msg(check_msg->pcpu == 178, - "incorrect value for pcpu, expected 178, is %d", - check_msg->pcpu); - ck_assert_msg(check_msg->pid == 64240, - "incorrect value for pid, expected 64240, is %d", - check_msg->pid); - { - const char check_string[] = {(char)112, (char)114, (char)111, (char)99, - (char)101, (char)115, (char)115, (char)45, - (char)110, (char)97, (char)109, (char)101, - (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->tname, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->tname, expected string '%s', is '%s'", - check_string, check_msg->tname); - } - } -} -END_TEST - -Suite *legacy_auto_check_sbp_linux_MsgLinuxCpuStateDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_linux_MsgLinuxCpuStateDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_linux_MsgLinuxCpuStateDepA"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_linux_MsgLinuxCpuStateDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_linux_MsgLinuxMemState.c b/c/test/legacy/auto_check_sbp_linux_MsgLinuxMemState.c deleted file mode 100644 index b28327ccad..0000000000 --- a/c/test/legacy/auto_check_sbp_linux_MsgLinuxMemState.c +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxMemState.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_linux_MsgLinuxMemState) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x7f09, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x7f09, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 9, 127, 95, 253, 70, 154, 191, 223, 19, 247, 53, 26, - 187, 76, 112, 114, 111, 99, 101, 115, 115, 45, 110, 97, 109, - 101, 0, 0, 0, 47, 112, 97, 116, 104, 47, 116, 111, 47, - 112, 114, 111, 99, 101, 115, 115, 45, 110, 97, 109, 101, 32, - 97, 114, 103, 48, 32, 97, 114, 103, 49, 32, 97, 114, 103, - 50, 32, 97, 114, 103, 51, 32, 97, 114, 103, 52, 3, 181, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_linux_mem_state_t *test_msg = (msg_linux_mem_state_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - memcpy(test_msg->cmdline, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->cmdline) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->flags = 76; - test_msg->index = 154; - test_msg->pid = 57279; - test_msg->pmem = 19; - test_msg->time = 3139057143; - { - const char assign_string[] = {(char)112, (char)114, (char)111, (char)99, - (char)101, (char)115, (char)115, (char)45, - (char)110, (char)97, (char)109, (char)101, - (char)0, (char)0, (char)0}; - memcpy(test_msg->tname, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->tname) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0x7f09, 64863, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 64863, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 64863, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x7f09, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_linux_mem_state_t *check_msg = - (msg_linux_mem_state_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - ck_assert_msg( - memcmp(check_msg->cmdline, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->cmdline, expected string '%s', is " - "'%s'", - check_string, check_msg->cmdline); - } - ck_assert_msg(check_msg->flags == 76, - "incorrect value for flags, expected 76, is %d", - check_msg->flags); - ck_assert_msg(check_msg->index == 154, - "incorrect value for index, expected 154, is %d", - check_msg->index); - ck_assert_msg(check_msg->pid == 57279, - "incorrect value for pid, expected 57279, is %d", - check_msg->pid); - ck_assert_msg(check_msg->pmem == 19, - "incorrect value for pmem, expected 19, is %d", - check_msg->pmem); - ck_assert_msg(check_msg->time == 3139057143, - "incorrect value for time, expected 3139057143, is %d", - check_msg->time); - { - const char check_string[] = {(char)112, (char)114, (char)111, (char)99, - (char)101, (char)115, (char)115, (char)45, - (char)110, (char)97, (char)109, (char)101, - (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->tname, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->tname, expected string '%s', is '%s'", - check_string, check_msg->tname); - } - } -} -END_TEST - -Suite *legacy_auto_check_sbp_linux_MsgLinuxMemState_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_linux_MsgLinuxMemState"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_linux_MsgLinuxMemState"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_linux_MsgLinuxMemState); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_linux_MsgLinuxMemStateDepA.c b/c/test/legacy/auto_check_sbp_linux_MsgLinuxMemStateDepA.c deleted file mode 100644 index 387e2bed97..0000000000 --- a/c/test/legacy/auto_check_sbp_linux_MsgLinuxMemStateDepA.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxMemStateDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_linux_MsgLinuxMemStateDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x7f01, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x7f01, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 1, 127, 185, 109, 65, 247, 93, 48, 193, 112, 114, 111, - 99, 101, 115, 115, 45, 110, 97, 109, 101, 0, 0, 0, 47, - 112, 97, 116, 104, 47, 116, 111, 47, 112, 114, 111, 99, 101, - 115, 115, 45, 110, 97, 109, 101, 32, 97, 114, 103, 48, 32, - 97, 114, 103, 49, 32, 97, 114, 103, 50, 32, 97, 114, 103, - 51, 32, 97, 114, 103, 52, 17, 137, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_linux_mem_state_dep_a_t *test_msg = - (msg_linux_mem_state_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - memcpy(test_msg->cmdline, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->cmdline) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->index = 247; - test_msg->pid = 12381; - test_msg->pmem = 193; - { - const char assign_string[] = {(char)112, (char)114, (char)111, (char)99, - (char)101, (char)115, (char)115, (char)45, - (char)110, (char)97, (char)109, (char)101, - (char)0, (char)0, (char)0}; - memcpy(test_msg->tname, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->tname) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0x7f01, 28089, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 28089, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 28089, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x7f01, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_linux_mem_state_dep_a_t *check_msg = - (msg_linux_mem_state_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - ck_assert_msg( - memcmp(check_msg->cmdline, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->cmdline, expected string '%s', is " - "'%s'", - check_string, check_msg->cmdline); - } - ck_assert_msg(check_msg->index == 247, - "incorrect value for index, expected 247, is %d", - check_msg->index); - ck_assert_msg(check_msg->pid == 12381, - "incorrect value for pid, expected 12381, is %d", - check_msg->pid); - ck_assert_msg(check_msg->pmem == 193, - "incorrect value for pmem, expected 193, is %d", - check_msg->pmem); - { - const char check_string[] = {(char)112, (char)114, (char)111, (char)99, - (char)101, (char)115, (char)115, (char)45, - (char)110, (char)97, (char)109, (char)101, - (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->tname, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->tname, expected string '%s', is '%s'", - check_string, check_msg->tname); - } - } -} -END_TEST - -Suite *legacy_auto_check_sbp_linux_MsgLinuxMemStateDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_linux_MsgLinuxMemStateDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_linux_MsgLinuxMemStateDepA"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_linux_MsgLinuxMemStateDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_linux_MsgLinuxProcessFdCount.c b/c/test/legacy/auto_check_sbp_linux_MsgLinuxProcessFdCount.c deleted file mode 100644 index 66af42079e..0000000000 --- a/c/test/legacy/auto_check_sbp_linux_MsgLinuxProcessFdCount.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxProcessFdCount.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_linux_MsgLinuxProcessFdCount) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x7f06, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x7f06, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 6, 127, 30, 195, 51, 164, 189, 165, 5, 139, 47, - 112, 97, 116, 104, 47, 116, 111, 47, 112, 114, 111, 99, - 101, 115, 115, 45, 110, 97, 109, 101, 32, 97, 114, 103, - 48, 32, 97, 114, 103, 49, 32, 97, 114, 103, 50, 32, - 97, 114, 103, 51, 32, 97, 114, 103, 52, 2, 94, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_linux_process_fd_count_t *test_msg = - (msg_linux_process_fd_count_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - memcpy(test_msg->cmdline, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->cmdline) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->fd_count = 35589; - test_msg->index = 164; - test_msg->pid = 42429; - sbp_payload_send(&sbp_state, 0x7f06, 49950, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 49950, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 49950, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x7f06, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_linux_process_fd_count_t *check_msg = - (msg_linux_process_fd_count_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - ck_assert_msg( - memcmp(check_msg->cmdline, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->cmdline, expected string '%s', is " - "'%s'", - check_string, check_msg->cmdline); - } - ck_assert_msg(check_msg->fd_count == 35589, - "incorrect value for fd_count, expected 35589, is %d", - check_msg->fd_count); - ck_assert_msg(check_msg->index == 164, - "incorrect value for index, expected 164, is %d", - check_msg->index); - ck_assert_msg(check_msg->pid == 42429, - "incorrect value for pid, expected 42429, is %d", - check_msg->pid); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_linux_MsgLinuxProcessFdCount_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_linux_MsgLinuxProcessFdCount"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_linux_MsgLinuxProcessFdCount"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_linux_MsgLinuxProcessFdCount); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_linux_MsgLinuxProcessFdSummary.c b/c/test/legacy/auto_check_sbp_linux_MsgLinuxProcessFdSummary.c deleted file mode 100644 index e17d0d9fd1..0000000000 --- a/c/test/legacy/auto_check_sbp_linux_MsgLinuxProcessFdSummary.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxProcessFdSummary.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_linux_MsgLinuxProcessFdSummary) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x7f07, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x7f07, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 7, 127, 103, 248, 29, 19, 131, 200, 77, 102, 100, 49, - 0, 102, 100, 50, 0, 102, 100, 51, 0, 102, 100, 52, 0, - 102, 100, 53, 0, 102, 100, 54, 0, 0, 129, 80, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_linux_process_fd_summary_t *test_msg = - (msg_linux_process_fd_summary_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)102, (char)100, (char)49, (char)0, (char)102, - (char)100, (char)50, (char)0, (char)102, (char)100, - (char)51, (char)0, (char)102, (char)100, (char)52, - (char)0, (char)102, (char)100, (char)53, (char)0, - (char)102, (char)100, (char)54, (char)0, (char)0}; - memcpy(test_msg->most_opened, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->most_opened) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->sys_fd_count = 1304986387; - sbp_payload_send(&sbp_state, 0x7f07, 63591, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 63591, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 63591, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x7f07, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_linux_process_fd_summary_t *check_msg = - (msg_linux_process_fd_summary_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)102, (char)100, (char)49, (char)0, (char)102, - (char)100, (char)50, (char)0, (char)102, (char)100, - (char)51, (char)0, (char)102, (char)100, (char)52, - (char)0, (char)102, (char)100, (char)53, (char)0, - (char)102, (char)100, (char)54, (char)0, (char)0}; - ck_assert_msg(memcmp(check_msg->most_opened, check_string, - sizeof(check_string)) == 0, - "incorrect value for check_msg->most_opened, expected " - "string '%s', is '%s'", - check_string, check_msg->most_opened); - } - ck_assert_msg( - check_msg->sys_fd_count == 1304986387, - "incorrect value for sys_fd_count, expected 1304986387, is %d", - check_msg->sys_fd_count); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_linux_MsgLinuxProcessFdSummary_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_linux_MsgLinuxProcessFdSummary"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_linux_MsgLinuxProcessFdSummary"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_linux_MsgLinuxProcessFdSummary); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_linux_MsgLinuxProcessSocketCounts.c b/c/test/legacy/auto_check_sbp_linux_MsgLinuxProcessSocketCounts.c deleted file mode 100644 index fdff02a585..0000000000 --- a/c/test/legacy/auto_check_sbp_linux_MsgLinuxProcessSocketCounts.c +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxProcessSocketCounts.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_linux_MsgLinuxProcessSocketCounts) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x7f03, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x7f03, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 3, 127, 108, 9, 55, 51, 137, 111, 79, 118, 3, 140, - 114, 115, 47, 112, 97, 116, 104, 47, 116, 111, 47, 112, 114, - 111, 99, 101, 115, 115, 45, 110, 97, 109, 101, 32, 97, 114, - 103, 48, 32, 97, 114, 103, 49, 32, 97, 114, 103, 50, 32, - 97, 114, 103, 51, 32, 97, 114, 103, 52, 180, 131, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_linux_process_socket_counts_t *test_msg = - (msg_linux_process_socket_counts_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - memcpy(test_msg->cmdline, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->cmdline) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->index = 51; - test_msg->pid = 28553; - test_msg->socket_count = 30287; - test_msg->socket_states = 29554; - test_msg->socket_types = 35843; - sbp_payload_send(&sbp_state, 0x7f03, 2412, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 2412, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 2412, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x7f03, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_linux_process_socket_counts_t *check_msg = - (msg_linux_process_socket_counts_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - ck_assert_msg( - memcmp(check_msg->cmdline, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->cmdline, expected string '%s', is " - "'%s'", - check_string, check_msg->cmdline); - } - ck_assert_msg(check_msg->index == 51, - "incorrect value for index, expected 51, is %d", - check_msg->index); - ck_assert_msg(check_msg->pid == 28553, - "incorrect value for pid, expected 28553, is %d", - check_msg->pid); - ck_assert_msg(check_msg->socket_count == 30287, - "incorrect value for socket_count, expected 30287, is %d", - check_msg->socket_count); - ck_assert_msg(check_msg->socket_states == 29554, - "incorrect value for socket_states, expected 29554, is %d", - check_msg->socket_states); - ck_assert_msg(check_msg->socket_types == 35843, - "incorrect value for socket_types, expected 35843, is %d", - check_msg->socket_types); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_linux_MsgLinuxProcessSocketCounts_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_linux_MsgLinuxProcessSocketCounts"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_linux_" - "MsgLinuxProcessSocketCounts"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_linux_MsgLinuxProcessSocketCounts); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_linux_MsgLinuxProcessSocketQueues.c b/c/test/legacy/auto_check_sbp_linux_MsgLinuxProcessSocketQueues.c deleted file mode 100644 index e8e4aef14f..0000000000 --- a/c/test/legacy/auto_check_sbp_linux_MsgLinuxProcessSocketQueues.c +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxProcessSocketQueues.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_linux_MsgLinuxProcessSocketQueues) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x7f04, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x7f04, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 127, 187, 232, 121, 181, 135, 75, 249, 211, 35, 252, - 80, 109, 15, 223, 97, 100, 100, 114, 101, 115, 115, 32, 111, - 102, 32, 108, 97, 114, 103, 101, 115, 116, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 47, 112, 97, 116, 104, 47, 116, 111, 47, 112, - 114, 111, 99, 101, 115, 115, 45, 110, 97, 109, 101, 32, 97, - 114, 103, 48, 32, 97, 114, 103, 49, 32, 97, 114, 103, 50, - 32, 97, 114, 103, 51, 32, 97, 114, 103, 52, 2, 247, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_linux_process_socket_queues_t *test_msg = - (msg_linux_process_socket_queues_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)97, (char)100, (char)100, (char)114, (char)101, (char)115, - (char)115, (char)32, (char)111, (char)102, (char)32, (char)108, - (char)97, (char)114, (char)103, (char)101, (char)115, (char)116, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->address_of_largest, assign_string, - sizeof(assign_string)); - if (sizeof(test_msg->address_of_largest) == 0) { - test_msg_len += sizeof(assign_string); - } - } - { - const char assign_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - memcpy(test_msg->cmdline, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->cmdline) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->index = 181; - test_msg->pid = 19335; - test_msg->recv_queued = 54265; - test_msg->send_queued = 64547; - test_msg->socket_states = 57103; - test_msg->socket_types = 27984; - sbp_payload_send(&sbp_state, 0x7f04, 59579, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 59579, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 59579, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x7f04, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_linux_process_socket_queues_t *check_msg = - (msg_linux_process_socket_queues_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)97, (char)100, (char)100, (char)114, (char)101, (char)115, - (char)115, (char)32, (char)111, (char)102, (char)32, (char)108, - (char)97, (char)114, (char)103, (char)101, (char)115, (char)116, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg(memcmp(check_msg->address_of_largest, check_string, - sizeof(check_string)) == 0, - "incorrect value for check_msg->address_of_largest, " - "expected string '%s', is '%s'", - check_string, check_msg->address_of_largest); - } - { - const char check_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - ck_assert_msg( - memcmp(check_msg->cmdline, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->cmdline, expected string '%s', is " - "'%s'", - check_string, check_msg->cmdline); - } - ck_assert_msg(check_msg->index == 181, - "incorrect value for index, expected 181, is %d", - check_msg->index); - ck_assert_msg(check_msg->pid == 19335, - "incorrect value for pid, expected 19335, is %d", - check_msg->pid); - ck_assert_msg(check_msg->recv_queued == 54265, - "incorrect value for recv_queued, expected 54265, is %d", - check_msg->recv_queued); - ck_assert_msg(check_msg->send_queued == 64547, - "incorrect value for send_queued, expected 64547, is %d", - check_msg->send_queued); - ck_assert_msg(check_msg->socket_states == 57103, - "incorrect value for socket_states, expected 57103, is %d", - check_msg->socket_states); - ck_assert_msg(check_msg->socket_types == 27984, - "incorrect value for socket_types, expected 27984, is %d", - check_msg->socket_types); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_linux_MsgLinuxProcessSocketQueues_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_linux_MsgLinuxProcessSocketQueues"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_linux_" - "MsgLinuxProcessSocketQueues"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_linux_MsgLinuxProcessSocketQueues); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_linux_MsgLinuxSocketUsage.c b/c/test/legacy/auto_check_sbp_linux_MsgLinuxSocketUsage.c deleted file mode 100644 index 04b2f2ae89..0000000000 --- a/c/test/legacy/auto_check_sbp_linux_MsgLinuxSocketUsage.c +++ /dev/null @@ -1,517 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxSocketUsage.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_linux_MsgLinuxSocketUsage) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x7f05, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x7f05, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 5, 127, 114, 138, 72, 13, 196, 69, 173, 67, 222, 186, 181, - 246, 154, 251, 17, 224, 179, 26, 169, 177, 90, 149, 213, 214, 6, - 126, 64, 120, 185, 84, 131, 200, 111, 32, 141, 217, 209, 52, 14, - 190, 147, 159, 246, 141, 122, 212, 119, 131, 30, 120, 47, 25, 109, - 154, 65, 132, 164, 39, 30, 30, 175, 8, 44, 28, 111, 236, 240, - 176, 74, 159, 129, 154, 153, 162, 229, 130, 154, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_linux_socket_usage_t *test_msg = - (msg_linux_socket_usage_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->avg_queue_depth = 2907030541; - test_msg->max_queue_depth = 3048922691; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_state_counts[0]); - } - test_msg->socket_state_counts[0] = 39670; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_state_counts[0]); - } - test_msg->socket_state_counts[1] = 4603; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_state_counts[0]); - } - test_msg->socket_state_counts[2] = 46048; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_state_counts[0]); - } - test_msg->socket_state_counts[3] = 43290; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_state_counts[0]); - } - test_msg->socket_state_counts[4] = 23217; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_state_counts[0]); - } - test_msg->socket_state_counts[5] = 54677; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_state_counts[0]); - } - test_msg->socket_state_counts[6] = 1750; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_state_counts[0]); - } - test_msg->socket_state_counts[7] = 16510; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_state_counts[0]); - } - test_msg->socket_state_counts[8] = 47480; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_state_counts[0]); - } - test_msg->socket_state_counts[9] = 33620; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_state_counts[0]); - } - test_msg->socket_state_counts[10] = 28616; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_state_counts[0]); - } - test_msg->socket_state_counts[11] = 36128; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_state_counts[0]); - } - test_msg->socket_state_counts[12] = 53721; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_state_counts[0]); - } - test_msg->socket_state_counts[13] = 3636; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_state_counts[0]); - } - test_msg->socket_state_counts[14] = 37822; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_state_counts[0]); - } - test_msg->socket_state_counts[15] = 63135; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_type_counts[0]); - } - test_msg->socket_type_counts[0] = 31373; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_type_counts[0]); - } - test_msg->socket_type_counts[1] = 30676; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_type_counts[0]); - } - test_msg->socket_type_counts[2] = 7811; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_type_counts[0]); - } - test_msg->socket_type_counts[3] = 12152; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_type_counts[0]); - } - test_msg->socket_type_counts[4] = 27929; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_type_counts[0]); - } - test_msg->socket_type_counts[5] = 16794; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_type_counts[0]); - } - test_msg->socket_type_counts[6] = 42116; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_type_counts[0]); - } - test_msg->socket_type_counts[7] = 7719; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_type_counts[0]); - } - test_msg->socket_type_counts[8] = 44830; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_type_counts[0]); - } - test_msg->socket_type_counts[9] = 11272; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_type_counts[0]); - } - test_msg->socket_type_counts[10] = 28444; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_type_counts[0]); - } - test_msg->socket_type_counts[11] = 61676; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_type_counts[0]); - } - test_msg->socket_type_counts[12] = 19120; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_type_counts[0]); - } - test_msg->socket_type_counts[13] = 33183; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_type_counts[0]); - } - test_msg->socket_type_counts[14] = 39322; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->socket_type_counts[0]); - } - test_msg->socket_type_counts[15] = 58786; - sbp_payload_send(&sbp_state, 0x7f05, 35442, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35442, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35442, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x7f05, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_linux_socket_usage_t *check_msg = - (msg_linux_socket_usage_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - check_msg->avg_queue_depth == 2907030541, - "incorrect value for avg_queue_depth, expected 2907030541, is %d", - check_msg->avg_queue_depth); - ck_assert_msg( - check_msg->max_queue_depth == 3048922691, - "incorrect value for max_queue_depth, expected 3048922691, is %d", - check_msg->max_queue_depth); - ck_assert_msg( - check_msg->socket_state_counts[0] == 39670, - "incorrect value for socket_state_counts[0], expected 39670, is %d", - check_msg->socket_state_counts[0]); - ck_assert_msg( - check_msg->socket_state_counts[1] == 4603, - "incorrect value for socket_state_counts[1], expected 4603, is %d", - check_msg->socket_state_counts[1]); - ck_assert_msg( - check_msg->socket_state_counts[2] == 46048, - "incorrect value for socket_state_counts[2], expected 46048, is %d", - check_msg->socket_state_counts[2]); - ck_assert_msg( - check_msg->socket_state_counts[3] == 43290, - "incorrect value for socket_state_counts[3], expected 43290, is %d", - check_msg->socket_state_counts[3]); - ck_assert_msg( - check_msg->socket_state_counts[4] == 23217, - "incorrect value for socket_state_counts[4], expected 23217, is %d", - check_msg->socket_state_counts[4]); - ck_assert_msg( - check_msg->socket_state_counts[5] == 54677, - "incorrect value for socket_state_counts[5], expected 54677, is %d", - check_msg->socket_state_counts[5]); - ck_assert_msg( - check_msg->socket_state_counts[6] == 1750, - "incorrect value for socket_state_counts[6], expected 1750, is %d", - check_msg->socket_state_counts[6]); - ck_assert_msg( - check_msg->socket_state_counts[7] == 16510, - "incorrect value for socket_state_counts[7], expected 16510, is %d", - check_msg->socket_state_counts[7]); - ck_assert_msg( - check_msg->socket_state_counts[8] == 47480, - "incorrect value for socket_state_counts[8], expected 47480, is %d", - check_msg->socket_state_counts[8]); - ck_assert_msg( - check_msg->socket_state_counts[9] == 33620, - "incorrect value for socket_state_counts[9], expected 33620, is %d", - check_msg->socket_state_counts[9]); - ck_assert_msg( - check_msg->socket_state_counts[10] == 28616, - "incorrect value for socket_state_counts[10], expected 28616, is %d", - check_msg->socket_state_counts[10]); - ck_assert_msg( - check_msg->socket_state_counts[11] == 36128, - "incorrect value for socket_state_counts[11], expected 36128, is %d", - check_msg->socket_state_counts[11]); - ck_assert_msg( - check_msg->socket_state_counts[12] == 53721, - "incorrect value for socket_state_counts[12], expected 53721, is %d", - check_msg->socket_state_counts[12]); - ck_assert_msg( - check_msg->socket_state_counts[13] == 3636, - "incorrect value for socket_state_counts[13], expected 3636, is %d", - check_msg->socket_state_counts[13]); - ck_assert_msg( - check_msg->socket_state_counts[14] == 37822, - "incorrect value for socket_state_counts[14], expected 37822, is %d", - check_msg->socket_state_counts[14]); - ck_assert_msg( - check_msg->socket_state_counts[15] == 63135, - "incorrect value for socket_state_counts[15], expected 63135, is %d", - check_msg->socket_state_counts[15]); - ck_assert_msg( - check_msg->socket_type_counts[0] == 31373, - "incorrect value for socket_type_counts[0], expected 31373, is %d", - check_msg->socket_type_counts[0]); - ck_assert_msg( - check_msg->socket_type_counts[1] == 30676, - "incorrect value for socket_type_counts[1], expected 30676, is %d", - check_msg->socket_type_counts[1]); - ck_assert_msg( - check_msg->socket_type_counts[2] == 7811, - "incorrect value for socket_type_counts[2], expected 7811, is %d", - check_msg->socket_type_counts[2]); - ck_assert_msg( - check_msg->socket_type_counts[3] == 12152, - "incorrect value for socket_type_counts[3], expected 12152, is %d", - check_msg->socket_type_counts[3]); - ck_assert_msg( - check_msg->socket_type_counts[4] == 27929, - "incorrect value for socket_type_counts[4], expected 27929, is %d", - check_msg->socket_type_counts[4]); - ck_assert_msg( - check_msg->socket_type_counts[5] == 16794, - "incorrect value for socket_type_counts[5], expected 16794, is %d", - check_msg->socket_type_counts[5]); - ck_assert_msg( - check_msg->socket_type_counts[6] == 42116, - "incorrect value for socket_type_counts[6], expected 42116, is %d", - check_msg->socket_type_counts[6]); - ck_assert_msg( - check_msg->socket_type_counts[7] == 7719, - "incorrect value for socket_type_counts[7], expected 7719, is %d", - check_msg->socket_type_counts[7]); - ck_assert_msg( - check_msg->socket_type_counts[8] == 44830, - "incorrect value for socket_type_counts[8], expected 44830, is %d", - check_msg->socket_type_counts[8]); - ck_assert_msg( - check_msg->socket_type_counts[9] == 11272, - "incorrect value for socket_type_counts[9], expected 11272, is %d", - check_msg->socket_type_counts[9]); - ck_assert_msg( - check_msg->socket_type_counts[10] == 28444, - "incorrect value for socket_type_counts[10], expected 28444, is %d", - check_msg->socket_type_counts[10]); - ck_assert_msg( - check_msg->socket_type_counts[11] == 61676, - "incorrect value for socket_type_counts[11], expected 61676, is %d", - check_msg->socket_type_counts[11]); - ck_assert_msg( - check_msg->socket_type_counts[12] == 19120, - "incorrect value for socket_type_counts[12], expected 19120, is %d", - check_msg->socket_type_counts[12]); - ck_assert_msg( - check_msg->socket_type_counts[13] == 33183, - "incorrect value for socket_type_counts[13], expected 33183, is %d", - check_msg->socket_type_counts[13]); - ck_assert_msg( - check_msg->socket_type_counts[14] == 39322, - "incorrect value for socket_type_counts[14], expected 39322, is %d", - check_msg->socket_type_counts[14]); - ck_assert_msg( - check_msg->socket_type_counts[15] == 58786, - "incorrect value for socket_type_counts[15], expected 58786, is %d", - check_msg->socket_type_counts[15]); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_linux_MsgLinuxSocketUsage_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_linux_MsgLinuxSocketUsage"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_linux_MsgLinuxSocketUsage"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_linux_MsgLinuxSocketUsage); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_linux_MsgLinuxSysState.c b/c/test/legacy/auto_check_sbp_linux_MsgLinuxSysState.c deleted file mode 100644 index b0c6f05cdc..0000000000 --- a/c/test/legacy/auto_check_sbp_linux_MsgLinuxSysState.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxSysState.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_linux_MsgLinuxSysState) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x7f0a, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x7f0a, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 10, 127, 85, 167, 15, 20, 207, 125, 215, 196, 71, - 161, 229, 250, 186, 108, 30, 106, 5, 9, 229, 242, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_linux_sys_state_t *test_msg = (msg_linux_sys_state_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 9; - test_msg->mem_total = 53012; - test_msg->pcpu = 125; - test_msg->pid_count = 47866; - test_msg->pmem = 215; - test_msg->procs_starting = 18372; - test_msg->procs_stopping = 58785; - test_msg->time = 90840684; - sbp_payload_send(&sbp_state, 0x7f0a, 42837, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 42837, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 42837, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x7f0a, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_linux_sys_state_t *check_msg = - (msg_linux_sys_state_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 9, - "incorrect value for flags, expected 9, is %d", - check_msg->flags); - ck_assert_msg(check_msg->mem_total == 53012, - "incorrect value for mem_total, expected 53012, is %d", - check_msg->mem_total); - ck_assert_msg(check_msg->pcpu == 125, - "incorrect value for pcpu, expected 125, is %d", - check_msg->pcpu); - ck_assert_msg(check_msg->pid_count == 47866, - "incorrect value for pid_count, expected 47866, is %d", - check_msg->pid_count); - ck_assert_msg(check_msg->pmem == 215, - "incorrect value for pmem, expected 215, is %d", - check_msg->pmem); - ck_assert_msg(check_msg->procs_starting == 18372, - "incorrect value for procs_starting, expected 18372, is %d", - check_msg->procs_starting); - ck_assert_msg(check_msg->procs_stopping == 58785, - "incorrect value for procs_stopping, expected 58785, is %d", - check_msg->procs_stopping); - ck_assert_msg(check_msg->time == 90840684, - "incorrect value for time, expected 90840684, is %d", - check_msg->time); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_linux_MsgLinuxSysState_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_linux_MsgLinuxSysState"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_linux_MsgLinuxSysState"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_linux_MsgLinuxSysState); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_linux_MsgLinuxSysStateDepA.c b/c/test/legacy/auto_check_sbp_linux_MsgLinuxSysStateDepA.c deleted file mode 100644 index 06bd03a89e..0000000000 --- a/c/test/legacy/auto_check_sbp_linux_MsgLinuxSysStateDepA.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxSysStateDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_linux_MsgLinuxSysStateDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x7f02, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x7f02, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 127, 84, 56, 10, 188, 163, 211, - 194, 115, 71, 101, 103, 124, 201, 223, 223, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_linux_sys_state_dep_a_t *test_msg = - (msg_linux_sys_state_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->mem_total = 41916; - test_msg->pcpu = 211; - test_msg->pid_count = 51580; - test_msg->pmem = 194; - test_msg->procs_starting = 18291; - test_msg->procs_stopping = 26469; - sbp_payload_send(&sbp_state, 0x7f02, 14420, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 14420, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 14420, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x7f02, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_linux_sys_state_dep_a_t *check_msg = - (msg_linux_sys_state_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->mem_total == 41916, - "incorrect value for mem_total, expected 41916, is %d", - check_msg->mem_total); - ck_assert_msg(check_msg->pcpu == 211, - "incorrect value for pcpu, expected 211, is %d", - check_msg->pcpu); - ck_assert_msg(check_msg->pid_count == 51580, - "incorrect value for pid_count, expected 51580, is %d", - check_msg->pid_count); - ck_assert_msg(check_msg->pmem == 194, - "incorrect value for pmem, expected 194, is %d", - check_msg->pmem); - ck_assert_msg(check_msg->procs_starting == 18291, - "incorrect value for procs_starting, expected 18291, is %d", - check_msg->procs_starting); - ck_assert_msg(check_msg->procs_stopping == 26469, - "incorrect value for procs_stopping, expected 26469, is %d", - check_msg->procs_stopping); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_linux_MsgLinuxSysStateDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_linux_MsgLinuxSysStateDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_linux_MsgLinuxSysStateDepA"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_linux_MsgLinuxSysStateDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_logging_MsgFwd.c b/c/test/legacy/auto_check_sbp_logging_MsgFwd.c deleted file mode 100644 index 49280da42a..0000000000 --- a/c/test/legacy/auto_check_sbp_logging_MsgFwd.c +++ /dev/null @@ -1,348 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/logging/test_MsgFwd.yaml by generate.py. Do not -// modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_logging_MsgFwd) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x402, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x402, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 4, 66, 0, 18, 0, 0, 86, 81, 68, 47, 81, - 103, 65, 69, 65, 65, 65, 65, 65, 69, 97, 103, 125, 95, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_fwd_t *test_msg = (msg_fwd_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fwd_payload[0]); - } - test_msg->fwd_payload[0] = 86; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fwd_payload[0]); - } - test_msg->fwd_payload[1] = 81; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fwd_payload[0]); - } - test_msg->fwd_payload[2] = 68; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fwd_payload[0]); - } - test_msg->fwd_payload[3] = 47; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fwd_payload[0]); - } - test_msg->fwd_payload[4] = 81; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fwd_payload[0]); - } - test_msg->fwd_payload[5] = 103; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fwd_payload[0]); - } - test_msg->fwd_payload[6] = 65; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fwd_payload[0]); - } - test_msg->fwd_payload[7] = 69; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fwd_payload[0]); - } - test_msg->fwd_payload[8] = 65; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fwd_payload[0]); - } - test_msg->fwd_payload[9] = 65; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fwd_payload[0]); - } - test_msg->fwd_payload[10] = 65; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fwd_payload[0]); - } - test_msg->fwd_payload[11] = 65; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fwd_payload[0]); - } - test_msg->fwd_payload[12] = 65; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fwd_payload[0]); - } - test_msg->fwd_payload[13] = 69; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fwd_payload[0]); - } - test_msg->fwd_payload[14] = 97; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fwd_payload[0]); - } - test_msg->fwd_payload[15] = 103; - test_msg->protocol = 0; - test_msg->source = 0; - sbp_payload_send(&sbp_state, 0x402, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x402, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_fwd_t *check_msg = (msg_fwd_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->fwd_payload[0] == 86, - "incorrect value for fwd_payload[0], expected 86, is %d", - check_msg->fwd_payload[0]); - ck_assert_msg(check_msg->fwd_payload[1] == 81, - "incorrect value for fwd_payload[1], expected 81, is %d", - check_msg->fwd_payload[1]); - ck_assert_msg(check_msg->fwd_payload[2] == 68, - "incorrect value for fwd_payload[2], expected 68, is %d", - check_msg->fwd_payload[2]); - ck_assert_msg(check_msg->fwd_payload[3] == 47, - "incorrect value for fwd_payload[3], expected 47, is %d", - check_msg->fwd_payload[3]); - ck_assert_msg(check_msg->fwd_payload[4] == 81, - "incorrect value for fwd_payload[4], expected 81, is %d", - check_msg->fwd_payload[4]); - ck_assert_msg(check_msg->fwd_payload[5] == 103, - "incorrect value for fwd_payload[5], expected 103, is %d", - check_msg->fwd_payload[5]); - ck_assert_msg(check_msg->fwd_payload[6] == 65, - "incorrect value for fwd_payload[6], expected 65, is %d", - check_msg->fwd_payload[6]); - ck_assert_msg(check_msg->fwd_payload[7] == 69, - "incorrect value for fwd_payload[7], expected 69, is %d", - check_msg->fwd_payload[7]); - ck_assert_msg(check_msg->fwd_payload[8] == 65, - "incorrect value for fwd_payload[8], expected 65, is %d", - check_msg->fwd_payload[8]); - ck_assert_msg(check_msg->fwd_payload[9] == 65, - "incorrect value for fwd_payload[9], expected 65, is %d", - check_msg->fwd_payload[9]); - ck_assert_msg(check_msg->fwd_payload[10] == 65, - "incorrect value for fwd_payload[10], expected 65, is %d", - check_msg->fwd_payload[10]); - ck_assert_msg(check_msg->fwd_payload[11] == 65, - "incorrect value for fwd_payload[11], expected 65, is %d", - check_msg->fwd_payload[11]); - ck_assert_msg(check_msg->fwd_payload[12] == 65, - "incorrect value for fwd_payload[12], expected 65, is %d", - check_msg->fwd_payload[12]); - ck_assert_msg(check_msg->fwd_payload[13] == 69, - "incorrect value for fwd_payload[13], expected 69, is %d", - check_msg->fwd_payload[13]); - ck_assert_msg(check_msg->fwd_payload[14] == 97, - "incorrect value for fwd_payload[14], expected 97, is %d", - check_msg->fwd_payload[14]); - ck_assert_msg(check_msg->fwd_payload[15] == 103, - "incorrect value for fwd_payload[15], expected 103, is %d", - check_msg->fwd_payload[15]); - ck_assert_msg(check_msg->protocol == 0, - "incorrect value for protocol, expected 0, is %d", - check_msg->protocol); - ck_assert_msg(check_msg->source == 0, - "incorrect value for source, expected 0, is %d", - check_msg->source); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_logging_MsgFwd_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_logging_MsgFwd"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_logging_MsgFwd"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_logging_MsgFwd); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_logging_MsgLog.c b/c/test/legacy/auto_check_sbp_logging_MsgLog.c deleted file mode 100644 index 4c93bd383e..0000000000 --- a/c/test/legacy/auto_check_sbp_logging_MsgLog.c +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/logging/test_MsgLog.yaml by generate.py. Do not -// modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_logging_MsgLog) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x0401, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x0401, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 1, 4, 10, 9, 44, 6, 70, 105, 108, 116, 101, 114, - 101, 100, 32, 97, 108, 108, 32, 111, 98, 115, 32, 102, 114, - 111, 109, 32, 50, 51, 49, 52, 32, 97, 116, 32, 116, 111, - 119, 32, 56, 51, 46, 53, 51, 57, 48, 49, 57, 177, 163, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_log_t *test_msg = (msg_log_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->level = 6; - { - const char assign_string[] = { - (char)70, (char)105, (char)108, (char)116, (char)101, (char)114, - (char)101, (char)100, (char)32, (char)97, (char)108, (char)108, - (char)32, (char)111, (char)98, (char)115, (char)32, (char)102, - (char)114, (char)111, (char)109, (char)32, (char)50, (char)51, - (char)49, (char)52, (char)32, (char)97, (char)116, (char)32, - (char)116, (char)111, (char)119, (char)32, (char)56, (char)51, - (char)46, (char)53, (char)51, (char)57, (char)48, (char)49, - (char)57}; - memcpy(test_msg->text, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->text) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0x0401, 2314, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 2314, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 2314, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x0401, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_log_t *check_msg = (msg_log_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->level == 6, - "incorrect value for level, expected 6, is %d", - check_msg->level); - { - const char check_string[] = { - (char)70, (char)105, (char)108, (char)116, (char)101, (char)114, - (char)101, (char)100, (char)32, (char)97, (char)108, (char)108, - (char)32, (char)111, (char)98, (char)115, (char)32, (char)102, - (char)114, (char)111, (char)109, (char)32, (char)50, (char)51, - (char)49, (char)52, (char)32, (char)97, (char)116, (char)32, - (char)116, (char)111, (char)119, (char)32, (char)56, (char)51, - (char)46, (char)53, (char)51, (char)57, (char)48, (char)49, - (char)57}; - ck_assert_msg( - memcmp(check_msg->text, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->text, expected string '%s', is '%s'", - check_string, check_msg->text); - } - } -} -END_TEST - -Suite *legacy_auto_check_sbp_logging_MsgLog_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_logging_MsgLog"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_logging_MsgLog"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_logging_MsgLog); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_logging_MsgPrintDep.c b/c/test/legacy/auto_check_sbp_logging_MsgPrintDep.c deleted file mode 100644 index f8931b4755..0000000000 --- a/c/test/legacy/auto_check_sbp_logging_MsgPrintDep.c +++ /dev/null @@ -1,808 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/logging/test_MsgPrintDep.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_logging_MsgPrintDep) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x10, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x10, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 16, 0, 34, 34, 43, 73, 78, 70, 79, 58, 32, 97, - 99, 113, 58, 32, 80, 82, 78, 32, 49, 53, 32, 102, 111, - 117, 110, 100, 32, 64, 32, 45, 50, 52, 57, 55, 32, 72, - 122, 44, 32, 50, 48, 32, 83, 78, 82, 10, 116, 103, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_print_dep_t* test_msg = (msg_print_dep_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)97, (char)99, (char)113, (char)58, (char)32, (char)80, - (char)82, (char)78, (char)32, (char)49, (char)53, (char)32, - (char)102, (char)111, (char)117, (char)110, (char)100, (char)32, - (char)64, (char)32, (char)45, (char)50, (char)52, (char)57, - (char)55, (char)32, (char)72, (char)122, (char)44, (char)32, - (char)50, (char)48, (char)32, (char)83, (char)78, (char)82, - (char)10}; - memcpy(test_msg->text, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->text) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0x10, 8738, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 8738, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 8738, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x10, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_print_dep_t* check_msg = (msg_print_dep_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)97, (char)99, (char)113, (char)58, (char)32, (char)80, - (char)82, (char)78, (char)32, (char)49, (char)53, (char)32, - (char)102, (char)111, (char)117, (char)110, (char)100, (char)32, - (char)64, (char)32, (char)45, (char)50, (char)52, (char)57, - (char)55, (char)32, (char)72, (char)122, (char)44, (char)32, - (char)50, (char)48, (char)32, (char)83, (char)78, (char)82, - (char)10}; - ck_assert_msg( - memcmp(check_msg->text, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->text, expected string '%s', is '%s'", - check_string, check_msg->text); - } - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x10, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x10, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 16, 0, 34, 34, 42, 73, 78, 70, 79, 58, 32, 97, - 99, 113, 58, 32, 80, 82, 78, 32, 51, 49, 32, 102, 111, - 117, 110, 100, 32, 64, 32, 52, 50, 52, 53, 32, 72, 122, - 44, 32, 50, 49, 32, 83, 78, 82, 10, 140, 43, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_print_dep_t* test_msg = (msg_print_dep_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)97, (char)99, (char)113, (char)58, (char)32, (char)80, - (char)82, (char)78, (char)32, (char)51, (char)49, (char)32, - (char)102, (char)111, (char)117, (char)110, (char)100, (char)32, - (char)64, (char)32, (char)52, (char)50, (char)52, (char)53, - (char)32, (char)72, (char)122, (char)44, (char)32, (char)50, - (char)49, (char)32, (char)83, (char)78, (char)82, (char)10}; - memcpy(test_msg->text, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->text) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0x10, 8738, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 8738, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 8738, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x10, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_print_dep_t* check_msg = (msg_print_dep_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)97, (char)99, (char)113, (char)58, (char)32, (char)80, - (char)82, (char)78, (char)32, (char)51, (char)49, (char)32, - (char)102, (char)111, (char)117, (char)110, (char)100, (char)32, - (char)64, (char)32, (char)52, (char)50, (char)52, (char)53, - (char)32, (char)72, (char)122, (char)44, (char)32, (char)50, - (char)49, (char)32, (char)83, (char)78, (char)82, (char)10}; - ck_assert_msg( - memcmp(check_msg->text, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->text, expected string '%s', is '%s'", - check_string, check_msg->text); - } - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x10, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x10, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 16, 0, 34, 34, 35, 73, 78, 70, 79, 58, 32, 68, 105, 115, - 97, 98, 108, 105, 110, 103, 32, 99, 104, 97, 110, 110, 101, 108, 32, - 48, 32, 40, 80, 82, 78, 32, 49, 49, 41, 10, 23, 143, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_print_dep_t* test_msg = (msg_print_dep_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)68, (char)105, (char)115, (char)97, (char)98, (char)108, - (char)105, (char)110, (char)103, (char)32, (char)99, (char)104, - (char)97, (char)110, (char)110, (char)101, (char)108, (char)32, - (char)48, (char)32, (char)40, (char)80, (char)82, (char)78, - (char)32, (char)49, (char)49, (char)41, (char)10}; - memcpy(test_msg->text, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->text) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0x10, 8738, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 8738, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 8738, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x10, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_print_dep_t* check_msg = (msg_print_dep_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)68, (char)105, (char)115, (char)97, (char)98, (char)108, - (char)105, (char)110, (char)103, (char)32, (char)99, (char)104, - (char)97, (char)110, (char)110, (char)101, (char)108, (char)32, - (char)48, (char)32, (char)40, (char)80, (char)82, (char)78, - (char)32, (char)49, (char)49, (char)41, (char)10}; - ck_assert_msg( - memcmp(check_msg->text, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->text, expected string '%s', is '%s'", - check_string, check_msg->text); - } - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x10, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x10, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 16, 0, 34, 34, 41, 73, 78, 70, 79, 58, 32, 97, - 99, 113, 58, 32, 80, 82, 78, 32, 50, 32, 102, 111, 117, - 110, 100, 32, 64, 32, 51, 57, 57, 54, 32, 72, 122, 44, - 32, 50, 48, 32, 83, 78, 82, 10, 239, 48, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_print_dep_t* test_msg = (msg_print_dep_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)97, (char)99, (char)113, (char)58, (char)32, (char)80, - (char)82, (char)78, (char)32, (char)50, (char)32, (char)102, - (char)111, (char)117, (char)110, (char)100, (char)32, (char)64, - (char)32, (char)51, (char)57, (char)57, (char)54, (char)32, - (char)72, (char)122, (char)44, (char)32, (char)50, (char)48, - (char)32, (char)83, (char)78, (char)82, (char)10}; - memcpy(test_msg->text, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->text) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0x10, 8738, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 8738, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 8738, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x10, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_print_dep_t* check_msg = (msg_print_dep_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)97, (char)99, (char)113, (char)58, (char)32, (char)80, - (char)82, (char)78, (char)32, (char)50, (char)32, (char)102, - (char)111, (char)117, (char)110, (char)100, (char)32, (char)64, - (char)32, (char)51, (char)57, (char)57, (char)54, (char)32, - (char)72, (char)122, (char)44, (char)32, (char)50, (char)48, - (char)32, (char)83, (char)78, (char)82, (char)10}; - ck_assert_msg( - memcmp(check_msg->text, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->text, expected string '%s', is '%s'", - check_string, check_msg->text); - } - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x10, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x10, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 16, 0, 34, 34, 42, 73, 78, 70, 79, 58, 32, 97, - 99, 113, 58, 32, 80, 82, 78, 32, 52, 32, 102, 111, 117, - 110, 100, 32, 64, 32, 45, 55, 52, 57, 50, 32, 72, 122, - 44, 32, 50, 48, 32, 83, 78, 82, 10, 47, 248, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_print_dep_t* test_msg = (msg_print_dep_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)97, (char)99, (char)113, (char)58, (char)32, (char)80, - (char)82, (char)78, (char)32, (char)52, (char)32, (char)102, - (char)111, (char)117, (char)110, (char)100, (char)32, (char)64, - (char)32, (char)45, (char)55, (char)52, (char)57, (char)50, - (char)32, (char)72, (char)122, (char)44, (char)32, (char)50, - (char)48, (char)32, (char)83, (char)78, (char)82, (char)10}; - memcpy(test_msg->text, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->text) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0x10, 8738, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 8738, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 8738, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x10, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_print_dep_t* check_msg = (msg_print_dep_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)97, (char)99, (char)113, (char)58, (char)32, (char)80, - (char)82, (char)78, (char)32, (char)52, (char)32, (char)102, - (char)111, (char)117, (char)110, (char)100, (char)32, (char)64, - (char)32, (char)45, (char)55, (char)52, (char)57, (char)50, - (char)32, (char)72, (char)122, (char)44, (char)32, (char)50, - (char)48, (char)32, (char)83, (char)78, (char)82, (char)10}; - ck_assert_msg( - memcmp(check_msg->text, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->text, expected string '%s', is '%s'", - check_string, check_msg->text); - } - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x10, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x10, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 16, 0, 34, 34, 35, 73, 78, 70, 79, 58, 32, 68, 105, 115, - 97, 98, 108, 105, 110, 103, 32, 99, 104, 97, 110, 110, 101, 108, 32, - 49, 32, 40, 80, 82, 78, 32, 49, 53, 41, 10, 158, 139, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_print_dep_t* test_msg = (msg_print_dep_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)68, (char)105, (char)115, (char)97, (char)98, (char)108, - (char)105, (char)110, (char)103, (char)32, (char)99, (char)104, - (char)97, (char)110, (char)110, (char)101, (char)108, (char)32, - (char)49, (char)32, (char)40, (char)80, (char)82, (char)78, - (char)32, (char)49, (char)53, (char)41, (char)10}; - memcpy(test_msg->text, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->text) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0x10, 8738, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 8738, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 8738, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x10, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_print_dep_t* check_msg = (msg_print_dep_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)68, (char)105, (char)115, (char)97, (char)98, (char)108, - (char)105, (char)110, (char)103, (char)32, (char)99, (char)104, - (char)97, (char)110, (char)110, (char)101, (char)108, (char)32, - (char)49, (char)32, (char)40, (char)80, (char)82, (char)78, - (char)32, (char)49, (char)53, (char)41, (char)10}; - ck_assert_msg( - memcmp(check_msg->text, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->text, expected string '%s', is '%s'", - check_string, check_msg->text); - } - } -} -END_TEST - -Suite* legacy_auto_check_sbp_logging_MsgPrintDep_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_logging_MsgPrintDep"); - TCase* tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_logging_MsgPrintDep"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_logging_MsgPrintDep); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_mag_MsgMagRaw.c b/c/test/legacy/auto_check_sbp_mag_MsgMagRaw.c deleted file mode 100644 index afacf86bbd..0000000000 --- a/c/test/legacy/auto_check_sbp_mag_MsgMagRaw.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/mag/test_MsgMagRaw.yaml by generate.py. Do not -// modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_mag_MsgMagRaw) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x902, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x902, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 9, 195, 4, 11, 173, 227, 158, 198, - 206, 98, 3, 230, 2, 110, 229, 159, 23, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_mag_raw_t *test_msg = (msg_mag_raw_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->mag_x = 866; - test_msg->mag_y = 742; - test_msg->mag_z = -6802; - test_msg->tow = 3332301741; - test_msg->tow_f = 206; - sbp_payload_send(&sbp_state, 0x902, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x902, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_mag_raw_t *check_msg = (msg_mag_raw_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->mag_x == 866, - "incorrect value for mag_x, expected 866, is %d", - check_msg->mag_x); - ck_assert_msg(check_msg->mag_y == 742, - "incorrect value for mag_y, expected 742, is %d", - check_msg->mag_y); - ck_assert_msg(check_msg->mag_z == -6802, - "incorrect value for mag_z, expected -6802, is %d", - check_msg->mag_z); - ck_assert_msg(check_msg->tow == 3332301741, - "incorrect value for tow, expected 3332301741, is %d", - check_msg->tow); - ck_assert_msg(check_msg->tow_f == 206, - "incorrect value for tow_f, expected 206, is %d", - check_msg->tow_f); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_mag_MsgMagRaw_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_mag_MsgMagRaw"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_mag_MsgMagRaw"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_mag_MsgMagRaw); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgAgeCorrections.c b/c/test/legacy/auto_check_sbp_navigation_MsgAgeCorrections.c deleted file mode 100644 index 8899762c2e..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgAgeCorrections.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgAgeCorrections.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgAgeCorrections) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x210, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x210, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 16, 2, 66, 0, 6, 100, 0, 0, 0, 30, 0, 233, 202, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_age_corrections_t *test_msg = (msg_age_corrections_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->age = 30; - test_msg->tow = 100; - sbp_payload_send(&sbp_state, 0x210, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x210, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_age_corrections_t *check_msg = - (msg_age_corrections_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->age == 30, - "incorrect value for age, expected 30, is %d", - check_msg->age); - ck_assert_msg(check_msg->tow == 100, - "incorrect value for tow, expected 100, is %d", - check_msg->tow); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgAgeCorrections_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgAgeCorrections"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgAgeCorrections"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_navigation_MsgAgeCorrections); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgBaselineECEF.c b/c/test/legacy/auto_check_sbp_navigation_MsgBaselineECEF.c deleted file mode 100644 index 91e550ea16..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgBaselineECEF.c +++ /dev/null @@ -1,694 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgBaselineECEF.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgBaselineECEF) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20b, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20b, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 11, 2, 211, 136, 20, 40, 244, 122, 19, 150, 98, 238, 255, - 190, 64, 20, 0, 246, 163, 9, 0, 0, 0, 14, 0, 219, 191, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ecef_t* test_msg = (msg_baseline_ecef_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 14; - test_msg->tow = 326825000; - test_msg->x = -1154410; - test_msg->y = 1327294; - test_msg->z = 631798; - sbp_payload_send(&sbp_state, 0x20b, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20b, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ecef_t* check_msg = - (msg_baseline_ecef_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 14, - "incorrect value for n_sats, expected 14, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326825000, - "incorrect value for tow, expected 326825000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -1154410, - "incorrect value for x, expected -1154410, is %d", - check_msg->x); - ck_assert_msg(check_msg->y == 1327294, - "incorrect value for y, expected 1327294, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 631798, - "incorrect value for z, expected 631798, is %d", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20b, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20b, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 11, 2, 211, 136, 20, 16, 248, 122, 19, 72, 99, 238, 255, - 191, 65, 20, 0, 138, 162, 9, 0, 0, 0, 15, 0, 240, 78, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ecef_t* test_msg = (msg_baseline_ecef_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 15; - test_msg->tow = 326826000; - test_msg->x = -1154232; - test_msg->y = 1327551; - test_msg->z = 631434; - sbp_payload_send(&sbp_state, 0x20b, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20b, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ecef_t* check_msg = - (msg_baseline_ecef_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326826000, - "incorrect value for tow, expected 326826000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -1154232, - "incorrect value for x, expected -1154232, is %d", - check_msg->x); - ck_assert_msg(check_msg->y == 1327551, - "incorrect value for y, expected 1327551, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 631434, - "incorrect value for z, expected 631434, is %d", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20b, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20b, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 11, 2, 211, 136, 20, 248, 251, 122, 19, 41, 99, 238, 255, - 181, 65, 20, 0, 148, 161, 9, 0, 0, 0, 15, 0, 4, 132, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ecef_t* test_msg = (msg_baseline_ecef_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 15; - test_msg->tow = 326827000; - test_msg->x = -1154263; - test_msg->y = 1327541; - test_msg->z = 631188; - sbp_payload_send(&sbp_state, 0x20b, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20b, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ecef_t* check_msg = - (msg_baseline_ecef_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326827000, - "incorrect value for tow, expected 326827000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -1154263, - "incorrect value for x, expected -1154263, is %d", - check_msg->x); - ck_assert_msg(check_msg->y == 1327541, - "incorrect value for y, expected 1327541, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 631188, - "incorrect value for z, expected 631188, is %d", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20b, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20b, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 11, 2, 211, 136, 20, 224, 255, 122, 19, 188, 97, 238, 255, - 81, 64, 20, 0, 65, 160, 9, 0, 0, 0, 15, 0, 67, 94, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ecef_t* test_msg = (msg_baseline_ecef_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 15; - test_msg->tow = 326828000; - test_msg->x = -1154628; - test_msg->y = 1327185; - test_msg->z = 630849; - sbp_payload_send(&sbp_state, 0x20b, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20b, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ecef_t* check_msg = - (msg_baseline_ecef_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326828000, - "incorrect value for tow, expected 326828000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -1154628, - "incorrect value for x, expected -1154628, is %d", - check_msg->x); - ck_assert_msg(check_msg->y == 1327185, - "incorrect value for y, expected 1327185, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 630849, - "incorrect value for z, expected 630849, is %d", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20b, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20b, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 11, 2, 211, 136, 20, 200, 3, 123, 19, 189, 96, 238, 255, - 93, 63, 20, 0, 98, 159, 9, 0, 0, 0, 15, 0, 106, 94, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ecef_t* test_msg = (msg_baseline_ecef_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 15; - test_msg->tow = 326829000; - test_msg->x = -1154883; - test_msg->y = 1326941; - test_msg->z = 630626; - sbp_payload_send(&sbp_state, 0x20b, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20b, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ecef_t* check_msg = - (msg_baseline_ecef_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326829000, - "incorrect value for tow, expected 326829000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -1154883, - "incorrect value for x, expected -1154883, is %d", - check_msg->x); - ck_assert_msg(check_msg->y == 1326941, - "incorrect value for y, expected 1326941, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 630626, - "incorrect value for z, expected 630626, is %d", - check_msg->z); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_navigation_MsgBaselineECEF_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgBaselineECEF"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgBaselineECEF"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgBaselineECEF); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgBaselineECEFDepA.c b/c/test/legacy/auto_check_sbp_navigation_MsgBaselineECEFDepA.c deleted file mode 100644 index cce704f1e1..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgBaselineECEFDepA.c +++ /dev/null @@ -1,1372 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgBaselineECEFDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x202, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x202, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 2, 246, 215, 20, 20, 46, 39, 0, 21, 48, 255, 255, - 52, 117, 255, 255, 216, 211, 254, 255, 0, 0, 9, 1, 50, 137, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ecef_dep_a_t* test_msg = - (msg_baseline_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 1; - test_msg->n_sats = 9; - test_msg->tow = 2567700; - test_msg->x = -53227; - test_msg->y = -35532; - test_msg->z = -76840; - sbp_payload_send(&sbp_state, 0x202, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x202, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ecef_dep_a_t* check_msg = - (msg_baseline_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567700, - "incorrect value for tow, expected 2567700, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -53227, - "incorrect value for x, expected -53227, is %d", - check_msg->x); - ck_assert_msg(check_msg->y == -35532, - "incorrect value for y, expected -35532, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == -76840, - "incorrect value for z, expected -76840, is %d", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x202, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x202, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 2, 246, 215, 20, 120, 46, 39, 0, 58, 49, 255, 255, - 49, 116, 255, 255, 134, 211, 254, 255, 0, 0, 9, 1, 227, 155, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ecef_dep_a_t* test_msg = - (msg_baseline_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 1; - test_msg->n_sats = 9; - test_msg->tow = 2567800; - test_msg->x = -52934; - test_msg->y = -35791; - test_msg->z = -76922; - sbp_payload_send(&sbp_state, 0x202, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x202, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ecef_dep_a_t* check_msg = - (msg_baseline_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567800, - "incorrect value for tow, expected 2567800, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -52934, - "incorrect value for x, expected -52934, is %d", - check_msg->x); - ck_assert_msg(check_msg->y == -35791, - "incorrect value for y, expected -35791, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == -76922, - "incorrect value for z, expected -76922, is %d", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x202, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x202, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 2, 246, 215, 20, 220, 46, 39, 0, 97, 50, 255, 255, - 47, 115, 255, 255, 52, 211, 254, 255, 0, 0, 9, 1, 61, 126, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ecef_dep_a_t* test_msg = - (msg_baseline_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 1; - test_msg->n_sats = 9; - test_msg->tow = 2567900; - test_msg->x = -52639; - test_msg->y = -36049; - test_msg->z = -77004; - sbp_payload_send(&sbp_state, 0x202, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x202, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ecef_dep_a_t* check_msg = - (msg_baseline_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567900, - "incorrect value for tow, expected 2567900, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -52639, - "incorrect value for x, expected -52639, is %d", - check_msg->x); - ck_assert_msg(check_msg->y == -36049, - "incorrect value for y, expected -36049, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == -77004, - "incorrect value for z, expected -77004, is %d", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x202, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x202, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 2, 246, 215, 20, 64, 47, 39, 0, 136, 51, 255, 255, - 45, 114, 255, 255, 228, 210, 254, 255, 0, 0, 9, 1, 200, 79, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ecef_dep_a_t* test_msg = - (msg_baseline_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 1; - test_msg->n_sats = 9; - test_msg->tow = 2568000; - test_msg->x = -52344; - test_msg->y = -36307; - test_msg->z = -77084; - sbp_payload_send(&sbp_state, 0x202, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x202, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ecef_dep_a_t* check_msg = - (msg_baseline_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2568000, - "incorrect value for tow, expected 2568000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -52344, - "incorrect value for x, expected -52344, is %d", - check_msg->x); - ck_assert_msg(check_msg->y == -36307, - "incorrect value for y, expected -36307, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == -77084, - "incorrect value for z, expected -77084, is %d", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x202, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x202, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 2, 246, 215, 20, 164, 47, 39, 0, 176, 52, 255, 255, - 44, 113, 255, 255, 149, 210, 254, 255, 0, 0, 9, 1, 104, 24, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ecef_dep_a_t* test_msg = - (msg_baseline_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 1; - test_msg->n_sats = 9; - test_msg->tow = 2568100; - test_msg->x = -52048; - test_msg->y = -36564; - test_msg->z = -77163; - sbp_payload_send(&sbp_state, 0x202, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x202, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ecef_dep_a_t* check_msg = - (msg_baseline_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2568100, - "incorrect value for tow, expected 2568100, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -52048, - "incorrect value for x, expected -52048, is %d", - check_msg->x); - ck_assert_msg(check_msg->y == -36564, - "incorrect value for y, expected -36564, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == -77163, - "incorrect value for z, expected -77163, is %d", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x202, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x202, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 2, 195, 4, 20, 156, 21, 69, 24, 169, 231, 255, 255, - 102, 208, 255, 255, 251, 28, 0, 0, 0, 0, 6, 0, 146, 168, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ecef_dep_a_t* test_msg = - (msg_baseline_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 6; - test_msg->tow = 407180700; - test_msg->x = -6231; - test_msg->y = -12186; - test_msg->z = 7419; - sbp_payload_send(&sbp_state, 0x202, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x202, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ecef_dep_a_t* check_msg = - (msg_baseline_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 6, - "incorrect value for n_sats, expected 6, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407180700, - "incorrect value for tow, expected 407180700, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -6231, - "incorrect value for x, expected -6231, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -12186, - "incorrect value for y, expected -12186, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 7419, - "incorrect value for z, expected 7419, is %d", check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x202, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x202, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 2, 195, 4, 20, 0, 22, 69, 24, 169, 231, 255, 255, - 103, 208, 255, 255, 252, 28, 0, 0, 0, 0, 6, 0, 34, 116, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ecef_dep_a_t* test_msg = - (msg_baseline_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 6; - test_msg->tow = 407180800; - test_msg->x = -6231; - test_msg->y = -12185; - test_msg->z = 7420; - sbp_payload_send(&sbp_state, 0x202, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x202, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ecef_dep_a_t* check_msg = - (msg_baseline_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 6, - "incorrect value for n_sats, expected 6, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407180800, - "incorrect value for tow, expected 407180800, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -6231, - "incorrect value for x, expected -6231, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -12185, - "incorrect value for y, expected -12185, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 7420, - "incorrect value for z, expected 7420, is %d", check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x202, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x202, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 2, 195, 4, 20, 100, 22, 69, 24, 30, 224, 255, 255, - 192, 183, 255, 255, 239, 53, 0, 0, 0, 0, 6, 0, 225, 15, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ecef_dep_a_t* test_msg = - (msg_baseline_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 6; - test_msg->tow = 407180900; - test_msg->x = -8162; - test_msg->y = -18496; - test_msg->z = 13807; - sbp_payload_send(&sbp_state, 0x202, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x202, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ecef_dep_a_t* check_msg = - (msg_baseline_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 6, - "incorrect value for n_sats, expected 6, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407180900, - "incorrect value for tow, expected 407180900, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -8162, - "incorrect value for x, expected -8162, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -18496, - "incorrect value for y, expected -18496, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 13807, - "incorrect value for z, expected 13807, is %d", check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x202, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x202, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 2, 195, 4, 20, 200, 22, 69, 24, 28, 224, 255, 255, - 191, 183, 255, 255, 242, 53, 0, 0, 0, 0, 6, 0, 35, 100, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ecef_dep_a_t* test_msg = - (msg_baseline_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 6; - test_msg->tow = 407181000; - test_msg->x = -8164; - test_msg->y = -18497; - test_msg->z = 13810; - sbp_payload_send(&sbp_state, 0x202, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x202, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ecef_dep_a_t* check_msg = - (msg_baseline_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 6, - "incorrect value for n_sats, expected 6, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407181000, - "incorrect value for tow, expected 407181000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -8164, - "incorrect value for x, expected -8164, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -18497, - "incorrect value for y, expected -18497, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 13810, - "incorrect value for z, expected 13810, is %d", check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x202, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x202, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 2, 195, 4, 20, 44, 23, 69, 24, 24, 227, 255, 255, - 25, 195, 255, 255, 153, 59, 0, 0, 0, 0, 6, 0, 66, 66, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ecef_dep_a_t* test_msg = - (msg_baseline_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 6; - test_msg->tow = 407181100; - test_msg->x = -7400; - test_msg->y = -15591; - test_msg->z = 15257; - sbp_payload_send(&sbp_state, 0x202, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x202, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ecef_dep_a_t* check_msg = - (msg_baseline_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 6, - "incorrect value for n_sats, expected 6, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407181100, - "incorrect value for tow, expected 407181100, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -7400, - "incorrect value for x, expected -7400, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -15591, - "incorrect value for y, expected -15591, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 15257, - "incorrect value for z, expected 15257, is %d", check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x202, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x202, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 2, 195, 4, 20, 144, 23, 69, 24, 23, 227, 255, 255, - 25, 195, 255, 255, 153, 59, 0, 0, 0, 0, 6, 0, 35, 135, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ecef_dep_a_t* test_msg = - (msg_baseline_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 6; - test_msg->tow = 407181200; - test_msg->x = -7401; - test_msg->y = -15591; - test_msg->z = 15257; - sbp_payload_send(&sbp_state, 0x202, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x202, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ecef_dep_a_t* check_msg = - (msg_baseline_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 6, - "incorrect value for n_sats, expected 6, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407181200, - "incorrect value for tow, expected 407181200, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -7401, - "incorrect value for x, expected -7401, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -15591, - "incorrect value for y, expected -15591, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 15257, - "incorrect value for z, expected 15257, is %d", check_msg->z); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgBaselineHeadingDepA.c b/c/test/legacy/auto_check_sbp_navigation_MsgBaselineHeadingDepA.c deleted file mode 100644 index d8ac9c0ac1..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgBaselineHeadingDepA.c +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgBaselineHeadingDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgBaselineHeadingDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x207, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x207, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 7, 2, 124, 206, 10, 82, 109, 88, - 176, 68, 14, 82, 203, 186, 58, 173, 182, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_heading_dep_a_t *test_msg = - (msg_baseline_heading_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 58; - test_msg->heading = 3411152452; - test_msg->n_sats = 186; - test_msg->tow = 2958585170; - sbp_payload_send(&sbp_state, 0x207, 52860, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 52860, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 52860, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x207, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_heading_dep_a_t *check_msg = - (msg_baseline_heading_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 58, - "incorrect value for flags, expected 58, is %d", - check_msg->flags); - ck_assert_msg(check_msg->heading == 3411152452, - "incorrect value for heading, expected 3411152452, is %d", - check_msg->heading); - ck_assert_msg(check_msg->n_sats == 186, - "incorrect value for n_sats, expected 186, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2958585170, - "incorrect value for tow, expected 2958585170, is %d", - check_msg->tow); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgBaselineHeadingDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgBaselineHeadingDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_" - "MsgBaselineHeadingDepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_navigation_MsgBaselineHeadingDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgBaselineNED.c b/c/test/legacy/auto_check_sbp_navigation_MsgBaselineNED.c deleted file mode 100644 index 70cd5c2ff2..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgBaselineNED.c +++ /dev/null @@ -1,704 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgBaselineNED.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgBaselineNED) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20c, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20c, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 12, 2, 211, 136, 22, 40, 244, 122, 19, 201, 115, 12, 0, 179, - 88, 230, 255, 153, 125, 0, 0, 0, 0, 0, 0, 14, 0, 226, 70, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ned_t* test_msg = (msg_baseline_ned_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = 32153; - test_msg->e = -1681229; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 816073; - test_msg->n_sats = 14; - test_msg->tow = 326825000; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x20c, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20c, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ned_t* check_msg = (msg_baseline_ned_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == 32153, - "incorrect value for d, expected 32153, is %d", check_msg->d); - ck_assert_msg(check_msg->e == -1681229, - "incorrect value for e, expected -1681229, is %d", - check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == 816073, - "incorrect value for n, expected 816073, is %d", - check_msg->n); - ck_assert_msg(check_msg->n_sats == 14, - "incorrect value for n_sats, expected 14, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326825000, - "incorrect value for tow, expected 326825000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20c, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20c, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 12, 2, 211, 136, 22, 16, 248, 122, 19, 98, 115, 12, 0, 194, - 88, 230, 255, 110, 127, 0, 0, 0, 0, 0, 0, 15, 0, 69, 93, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ned_t* test_msg = (msg_baseline_ned_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = 32622; - test_msg->e = -1681214; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 815970; - test_msg->n_sats = 15; - test_msg->tow = 326826000; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x20c, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20c, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ned_t* check_msg = (msg_baseline_ned_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == 32622, - "incorrect value for d, expected 32622, is %d", check_msg->d); - ck_assert_msg(check_msg->e == -1681214, - "incorrect value for e, expected -1681214, is %d", - check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == 815970, - "incorrect value for n, expected 815970, is %d", - check_msg->n); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326826000, - "incorrect value for tow, expected 326826000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20c, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20c, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 12, 2, 211, 136, 22, 248, 251, 122, 19, 143, 114, 12, 0, 173, - 88, 230, 255, 238, 127, 0, 0, 0, 0, 0, 0, 15, 0, 210, 169, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ned_t* test_msg = (msg_baseline_ned_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = 32750; - test_msg->e = -1681235; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 815759; - test_msg->n_sats = 15; - test_msg->tow = 326827000; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x20c, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20c, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ned_t* check_msg = (msg_baseline_ned_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == 32750, - "incorrect value for d, expected 32750, is %d", check_msg->d); - ck_assert_msg(check_msg->e == -1681235, - "incorrect value for e, expected -1681235, is %d", - check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == 815759, - "incorrect value for n, expected 815759, is %d", - check_msg->n); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326827000, - "incorrect value for tow, expected 326827000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20c, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20c, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 12, 2, 211, 136, 22, 224, 255, 122, 19, 86, 112, 12, 0, 51, - 88, 230, 255, 47, 127, 0, 0, 0, 0, 0, 0, 15, 0, 135, 107, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ned_t* test_msg = (msg_baseline_ned_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = 32559; - test_msg->e = -1681357; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 815190; - test_msg->n_sats = 15; - test_msg->tow = 326828000; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x20c, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20c, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ned_t* check_msg = (msg_baseline_ned_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == 32559, - "incorrect value for d, expected 32559, is %d", check_msg->d); - ck_assert_msg(check_msg->e == -1681357, - "incorrect value for e, expected -1681357, is %d", - check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == 815190, - "incorrect value for n, expected 815190, is %d", - check_msg->n); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326828000, - "incorrect value for tow, expected 326828000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20c, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20c, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 12, 2, 211, 136, 22, 200, 3, 123, 19, 214, 110, 12, 0, 220, - 87, 230, 255, 165, 126, 0, 0, 0, 0, 0, 0, 15, 0, 190, 80, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ned_t* test_msg = (msg_baseline_ned_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = 32421; - test_msg->e = -1681444; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 814806; - test_msg->n_sats = 15; - test_msg->tow = 326829000; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x20c, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20c, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ned_t* check_msg = (msg_baseline_ned_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == 32421, - "incorrect value for d, expected 32421, is %d", check_msg->d); - ck_assert_msg(check_msg->e == -1681444, - "incorrect value for e, expected -1681444, is %d", - check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == 814806, - "incorrect value for n, expected 814806, is %d", - check_msg->n); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326829000, - "incorrect value for tow, expected 326829000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_navigation_MsgBaselineNED_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgBaselineNED"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgBaselineNED"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgBaselineNED); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgBaselineNEDDepA.c b/c/test/legacy/auto_check_sbp_navigation_MsgBaselineNEDDepA.c deleted file mode 100644 index ee3b3533e6..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgBaselineNEDDepA.c +++ /dev/null @@ -1,1411 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgBaselineNEDDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x203, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x203, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 3, 2, 246, 215, 22, 20, 46, 39, 0, 243, 134, 254, 255, 234, - 153, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 93, 193, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ned_dep_a_t* test_msg = - (msg_baseline_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = -26134; - test_msg->flags = 1; - test_msg->h_accuracy = 0; - test_msg->n = -96525; - test_msg->n_sats = 9; - test_msg->tow = 2567700; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x203, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x203, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ned_dep_a_t* check_msg = - (msg_baseline_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == 0, "incorrect value for d, expected 0, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == -26134, - "incorrect value for e, expected -26134, is %d", - check_msg->e); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -96525, - "incorrect value for n, expected -96525, is %d", - check_msg->n); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567700, - "incorrect value for tow, expected 2567700, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x203, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x203, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 3, 2, 246, 215, 22, 120, 46, 39, 0, 139, 134, 254, 255, 109, - 155, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 38, 39, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ned_dep_a_t* test_msg = - (msg_baseline_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = -25747; - test_msg->flags = 1; - test_msg->h_accuracy = 0; - test_msg->n = -96629; - test_msg->n_sats = 9; - test_msg->tow = 2567800; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x203, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x203, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ned_dep_a_t* check_msg = - (msg_baseline_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == 0, "incorrect value for d, expected 0, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == -25747, - "incorrect value for e, expected -25747, is %d", - check_msg->e); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -96629, - "incorrect value for n, expected -96629, is %d", - check_msg->n); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567800, - "incorrect value for tow, expected 2567800, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x203, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x203, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 3, 2, 246, 215, 22, 220, 46, 39, 0, 37, 134, 254, 255, 240, - 156, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 58, 133, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ned_dep_a_t* test_msg = - (msg_baseline_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = -25360; - test_msg->flags = 1; - test_msg->h_accuracy = 0; - test_msg->n = -96731; - test_msg->n_sats = 9; - test_msg->tow = 2567900; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x203, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x203, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ned_dep_a_t* check_msg = - (msg_baseline_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == 0, "incorrect value for d, expected 0, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == -25360, - "incorrect value for e, expected -25360, is %d", - check_msg->e); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -96731, - "incorrect value for n, expected -96731, is %d", - check_msg->n); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567900, - "incorrect value for tow, expected 2567900, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x203, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x203, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 3, 2, 246, 215, 22, 64, 47, 39, 0, 193, 133, 254, 255, 115, - 158, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 56, 214, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ned_dep_a_t* test_msg = - (msg_baseline_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = -24973; - test_msg->flags = 1; - test_msg->h_accuracy = 0; - test_msg->n = -96831; - test_msg->n_sats = 9; - test_msg->tow = 2568000; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x203, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x203, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ned_dep_a_t* check_msg = - (msg_baseline_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == 0, "incorrect value for d, expected 0, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == -24973, - "incorrect value for e, expected -24973, is %d", - check_msg->e); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -96831, - "incorrect value for n, expected -96831, is %d", - check_msg->n); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2568000, - "incorrect value for tow, expected 2568000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x203, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x203, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 3, 2, 246, 215, 22, 164, 47, 39, 0, 93, 133, 254, 255, 246, - 159, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 234, 244, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ned_dep_a_t* test_msg = - (msg_baseline_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = -24586; - test_msg->flags = 1; - test_msg->h_accuracy = 0; - test_msg->n = -96931; - test_msg->n_sats = 9; - test_msg->tow = 2568100; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x203, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x203, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ned_dep_a_t* check_msg = - (msg_baseline_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == 0, "incorrect value for d, expected 0, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == -24586, - "incorrect value for e, expected -24586, is %d", - check_msg->e); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -96931, - "incorrect value for n, expected -96931, is %d", - check_msg->n); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2568100, - "incorrect value for tow, expected 2568100, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x203, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x203, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 3, 2, 195, 4, 22, 156, 21, 69, 24, 130, 246, 255, 255, 241, - 4, 0, 0, 35, 196, 255, 255, 0, 0, 0, 0, 6, 0, 250, 21, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ned_dep_a_t* test_msg = - (msg_baseline_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = -15325; - test_msg->e = 1265; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -2430; - test_msg->n_sats = 6; - test_msg->tow = 407180700; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x203, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x203, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ned_dep_a_t* check_msg = - (msg_baseline_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == -15325, - "incorrect value for d, expected -15325, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == 1265, - "incorrect value for e, expected 1265, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -2430, - "incorrect value for n, expected -2430, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 6, - "incorrect value for n_sats, expected 6, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407180700, - "incorrect value for tow, expected 407180700, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x203, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x203, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 3, 2, 195, 4, 22, 0, 22, 69, 24, 130, 246, 255, 255, 241, - 4, 0, 0, 35, 196, 255, 255, 0, 0, 0, 0, 6, 0, 240, 133, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ned_dep_a_t* test_msg = - (msg_baseline_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = -15325; - test_msg->e = 1265; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -2430; - test_msg->n_sats = 6; - test_msg->tow = 407180800; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x203, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x203, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ned_dep_a_t* check_msg = - (msg_baseline_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == -15325, - "incorrect value for d, expected -15325, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == 1265, - "incorrect value for e, expected 1265, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -2430, - "incorrect value for n, expected -2430, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 6, - "incorrect value for n_sats, expected 6, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407180800, - "incorrect value for tow, expected 407180800, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x203, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x203, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 3, 2, 195, 4, 22, 100, 22, 69, 24, 32, 251, 255, 255, 199, - 11, 0, 0, 57, 161, 255, 255, 0, 0, 0, 0, 6, 0, 12, 181, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ned_dep_a_t* test_msg = - (msg_baseline_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = -24263; - test_msg->e = 3015; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -1248; - test_msg->n_sats = 6; - test_msg->tow = 407180900; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x203, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x203, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ned_dep_a_t* check_msg = - (msg_baseline_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == -24263, - "incorrect value for d, expected -24263, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == 3015, - "incorrect value for e, expected 3015, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -1248, - "incorrect value for n, expected -1248, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 6, - "incorrect value for n_sats, expected 6, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407180900, - "incorrect value for tow, expected 407180900, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x203, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x203, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 3, 2, 195, 4, 22, 200, 22, 69, 24, 33, 251, 255, 255, 199, - 11, 0, 0, 54, 161, 255, 255, 0, 0, 0, 0, 6, 0, 86, 58, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ned_dep_a_t* test_msg = - (msg_baseline_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = -24266; - test_msg->e = 3015; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -1247; - test_msg->n_sats = 6; - test_msg->tow = 407181000; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x203, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x203, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ned_dep_a_t* check_msg = - (msg_baseline_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == -24266, - "incorrect value for d, expected -24266, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == 3015, - "incorrect value for e, expected 3015, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -1247, - "incorrect value for n, expected -1247, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 6, - "incorrect value for n_sats, expected 6, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407181000, - "incorrect value for tow, expected 407181000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x203, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x203, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 3, 2, 195, 4, 22, 44, 23, 69, 24, 110, 6, 0, 0, 55, - 8, 0, 0, 160, 166, 255, 255, 0, 0, 0, 0, 6, 0, 51, 249, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ned_dep_a_t* test_msg = - (msg_baseline_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = -22880; - test_msg->e = 2103; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 1646; - test_msg->n_sats = 6; - test_msg->tow = 407181100; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x203, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x203, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ned_dep_a_t* check_msg = - (msg_baseline_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == -22880, - "incorrect value for d, expected -22880, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == 2103, - "incorrect value for e, expected 2103, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == 1646, - "incorrect value for n, expected 1646, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 6, - "incorrect value for n_sats, expected 6, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407181100, - "incorrect value for tow, expected 407181100, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x203, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x203, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 3, 2, 195, 4, 22, 144, 23, 69, 24, 110, 6, 0, 0, 54, - 8, 0, 0, 160, 166, 255, 255, 0, 0, 0, 0, 6, 0, 206, 22, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_ned_dep_a_t* test_msg = - (msg_baseline_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = -22880; - test_msg->e = 2102; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 1646; - test_msg->n_sats = 6; - test_msg->tow = 407181200; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x203, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x203, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_ned_dep_a_t* check_msg = - (msg_baseline_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == -22880, - "incorrect value for d, expected -22880, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == 2102, - "incorrect value for e, expected 2102, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == 1646, - "incorrect value for n, expected 1646, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 6, - "incorrect value for n_sats, expected 6, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407181200, - "incorrect value for tow, expected 407181200, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgDops.c b/c/test/legacy/auto_check_sbp_navigation_MsgDops.c deleted file mode 100644 index 401dd3e4ca..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgDops.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgDops.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgDops) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x208, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x208, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 8, 2, 66, 0, 15, 100, 0, 0, 0, 2, 0, - 6, 0, 5, 0, 5, 0, 5, 0, 0, 244, 4, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_dops_t *test_msg = (msg_dops_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->gdop = 2; - test_msg->hdop = 5; - test_msg->pdop = 6; - test_msg->tdop = 5; - test_msg->tow = 100; - test_msg->vdop = 5; - sbp_payload_send(&sbp_state, 0x208, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x208, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_dops_t *check_msg = (msg_dops_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->gdop == 2, - "incorrect value for gdop, expected 2, is %d", - check_msg->gdop); - ck_assert_msg(check_msg->hdop == 5, - "incorrect value for hdop, expected 5, is %d", - check_msg->hdop); - ck_assert_msg(check_msg->pdop == 6, - "incorrect value for pdop, expected 6, is %d", - check_msg->pdop); - ck_assert_msg(check_msg->tdop == 5, - "incorrect value for tdop, expected 5, is %d", - check_msg->tdop); - ck_assert_msg(check_msg->tow == 100, - "incorrect value for tow, expected 100, is %d", - check_msg->tow); - ck_assert_msg(check_msg->vdop == 5, - "incorrect value for vdop, expected 5, is %d", - check_msg->vdop); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgDops_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_navigation_MsgDops"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_navigation_MsgDops"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgDops); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgDopsDepA.c b/c/test/legacy/auto_check_sbp_navigation_MsgDopsDepA.c deleted file mode 100644 index 572d2f4c95..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgDopsDepA.c +++ /dev/null @@ -1,1099 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgDopsDepA.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgDopsDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x206, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x206, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 6, 2, 246, 215, 14, 8, 48, 39, 0, 180, - 0, 190, 0, 170, 0, 160, 0, 150, 0, 121, 170, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_dops_dep_a_t* test_msg = (msg_dops_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->gdop = 180; - test_msg->hdop = 160; - test_msg->pdop = 190; - test_msg->tdop = 170; - test_msg->tow = 2568200; - test_msg->vdop = 150; - sbp_payload_send(&sbp_state, 0x206, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x206, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_dops_dep_a_t* check_msg = (msg_dops_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->gdop == 180, - "incorrect value for gdop, expected 180, is %d", - check_msg->gdop); - ck_assert_msg(check_msg->hdop == 160, - "incorrect value for hdop, expected 160, is %d", - check_msg->hdop); - ck_assert_msg(check_msg->pdop == 190, - "incorrect value for pdop, expected 190, is %d", - check_msg->pdop); - ck_assert_msg(check_msg->tdop == 170, - "incorrect value for tdop, expected 170, is %d", - check_msg->tdop); - ck_assert_msg(check_msg->tow == 2568200, - "incorrect value for tow, expected 2568200, is %d", - check_msg->tow); - ck_assert_msg(check_msg->vdop == 150, - "incorrect value for vdop, expected 150, is %d", - check_msg->vdop); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x206, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x206, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 6, 2, 246, 215, 14, 240, 51, 39, 0, 180, - 0, 190, 0, 170, 0, 160, 0, 150, 0, 78, 169, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_dops_dep_a_t* test_msg = (msg_dops_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->gdop = 180; - test_msg->hdop = 160; - test_msg->pdop = 190; - test_msg->tdop = 170; - test_msg->tow = 2569200; - test_msg->vdop = 150; - sbp_payload_send(&sbp_state, 0x206, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x206, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_dops_dep_a_t* check_msg = (msg_dops_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->gdop == 180, - "incorrect value for gdop, expected 180, is %d", - check_msg->gdop); - ck_assert_msg(check_msg->hdop == 160, - "incorrect value for hdop, expected 160, is %d", - check_msg->hdop); - ck_assert_msg(check_msg->pdop == 190, - "incorrect value for pdop, expected 190, is %d", - check_msg->pdop); - ck_assert_msg(check_msg->tdop == 170, - "incorrect value for tdop, expected 170, is %d", - check_msg->tdop); - ck_assert_msg(check_msg->tow == 2569200, - "incorrect value for tow, expected 2569200, is %d", - check_msg->tow); - ck_assert_msg(check_msg->vdop == 150, - "incorrect value for vdop, expected 150, is %d", - check_msg->vdop); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x206, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x206, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 6, 2, 246, 215, 14, 216, 55, 39, 0, 180, - 0, 190, 0, 170, 0, 160, 0, 150, 0, 71, 218, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_dops_dep_a_t* test_msg = (msg_dops_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->gdop = 180; - test_msg->hdop = 160; - test_msg->pdop = 190; - test_msg->tdop = 170; - test_msg->tow = 2570200; - test_msg->vdop = 150; - sbp_payload_send(&sbp_state, 0x206, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x206, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_dops_dep_a_t* check_msg = (msg_dops_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->gdop == 180, - "incorrect value for gdop, expected 180, is %d", - check_msg->gdop); - ck_assert_msg(check_msg->hdop == 160, - "incorrect value for hdop, expected 160, is %d", - check_msg->hdop); - ck_assert_msg(check_msg->pdop == 190, - "incorrect value for pdop, expected 190, is %d", - check_msg->pdop); - ck_assert_msg(check_msg->tdop == 170, - "incorrect value for tdop, expected 170, is %d", - check_msg->tdop); - ck_assert_msg(check_msg->tow == 2570200, - "incorrect value for tow, expected 2570200, is %d", - check_msg->tow); - ck_assert_msg(check_msg->vdop == 150, - "incorrect value for vdop, expected 150, is %d", - check_msg->vdop); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x206, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x206, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 6, 2, 195, 4, 14, 212, 157, 67, 24, 247, - 0, 215, 0, 123, 0, 17, 1, 44, 0, 206, 21, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_dops_dep_a_t* test_msg = (msg_dops_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->gdop = 247; - test_msg->hdop = 273; - test_msg->pdop = 215; - test_msg->tdop = 123; - test_msg->tow = 407084500; - test_msg->vdop = 44; - sbp_payload_send(&sbp_state, 0x206, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x206, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_dops_dep_a_t* check_msg = (msg_dops_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->gdop == 247, - "incorrect value for gdop, expected 247, is %d", - check_msg->gdop); - ck_assert_msg(check_msg->hdop == 273, - "incorrect value for hdop, expected 273, is %d", - check_msg->hdop); - ck_assert_msg(check_msg->pdop == 215, - "incorrect value for pdop, expected 215, is %d", - check_msg->pdop); - ck_assert_msg(check_msg->tdop == 123, - "incorrect value for tdop, expected 123, is %d", - check_msg->tdop); - ck_assert_msg(check_msg->tow == 407084500, - "incorrect value for tow, expected 407084500, is %d", - check_msg->tow); - ck_assert_msg(check_msg->vdop == 44, - "incorrect value for vdop, expected 44, is %d", - check_msg->vdop); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x206, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x206, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 6, 2, 195, 4, 14, 0, 0, 0, 0, 255, - 255, 255, 255, 0, 0, 0, 0, 0, 0, 146, 12, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_dops_dep_a_t* test_msg = (msg_dops_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->gdop = 65535; - test_msg->hdop = 0; - test_msg->pdop = 65535; - test_msg->tdop = 0; - test_msg->tow = 0; - test_msg->vdop = 0; - sbp_payload_send(&sbp_state, 0x206, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x206, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_dops_dep_a_t* check_msg = (msg_dops_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->gdop == 65535, - "incorrect value for gdop, expected 65535, is %d", - check_msg->gdop); - ck_assert_msg(check_msg->hdop == 0, - "incorrect value for hdop, expected 0, is %d", - check_msg->hdop); - ck_assert_msg(check_msg->pdop == 65535, - "incorrect value for pdop, expected 65535, is %d", - check_msg->pdop); - ck_assert_msg(check_msg->tdop == 0, - "incorrect value for tdop, expected 0, is %d", - check_msg->tdop); - ck_assert_msg(check_msg->tow == 0, - "incorrect value for tow, expected 0, is %d", check_msg->tow); - ck_assert_msg(check_msg->vdop == 0, - "incorrect value for vdop, expected 0, is %d", - check_msg->vdop); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x206, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x206, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 6, 2, 195, 4, 14, 128, 165, 68, 24, 92, - 1, 56, 1, 155, 0, 125, 2, 113, 0, 129, 93, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_dops_dep_a_t* test_msg = (msg_dops_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->gdop = 348; - test_msg->hdop = 637; - test_msg->pdop = 312; - test_msg->tdop = 155; - test_msg->tow = 407152000; - test_msg->vdop = 113; - sbp_payload_send(&sbp_state, 0x206, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x206, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_dops_dep_a_t* check_msg = (msg_dops_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->gdop == 348, - "incorrect value for gdop, expected 348, is %d", - check_msg->gdop); - ck_assert_msg(check_msg->hdop == 637, - "incorrect value for hdop, expected 637, is %d", - check_msg->hdop); - ck_assert_msg(check_msg->pdop == 312, - "incorrect value for pdop, expected 312, is %d", - check_msg->pdop); - ck_assert_msg(check_msg->tdop == 155, - "incorrect value for tdop, expected 155, is %d", - check_msg->tdop); - ck_assert_msg(check_msg->tow == 407152000, - "incorrect value for tow, expected 407152000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->vdop == 113, - "incorrect value for vdop, expected 113, is %d", - check_msg->vdop); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x206, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x206, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 6, 2, 195, 4, 14, 104, 169, 68, 24, 92, - 1, 55, 1, 155, 0, 125, 2, 113, 0, 209, 128, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_dops_dep_a_t* test_msg = (msg_dops_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->gdop = 348; - test_msg->hdop = 637; - test_msg->pdop = 311; - test_msg->tdop = 155; - test_msg->tow = 407153000; - test_msg->vdop = 113; - sbp_payload_send(&sbp_state, 0x206, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x206, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_dops_dep_a_t* check_msg = (msg_dops_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->gdop == 348, - "incorrect value for gdop, expected 348, is %d", - check_msg->gdop); - ck_assert_msg(check_msg->hdop == 637, - "incorrect value for hdop, expected 637, is %d", - check_msg->hdop); - ck_assert_msg(check_msg->pdop == 311, - "incorrect value for pdop, expected 311, is %d", - check_msg->pdop); - ck_assert_msg(check_msg->tdop == 155, - "incorrect value for tdop, expected 155, is %d", - check_msg->tdop); - ck_assert_msg(check_msg->tow == 407153000, - "incorrect value for tow, expected 407153000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->vdop == 113, - "incorrect value for vdop, expected 113, is %d", - check_msg->vdop); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x206, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x206, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 6, 2, 195, 4, 14, 80, 173, 68, 24, 92, - 1, 55, 1, 155, 0, 125, 2, 112, 0, 30, 6, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_dops_dep_a_t* test_msg = (msg_dops_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->gdop = 348; - test_msg->hdop = 637; - test_msg->pdop = 311; - test_msg->tdop = 155; - test_msg->tow = 407154000; - test_msg->vdop = 112; - sbp_payload_send(&sbp_state, 0x206, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x206, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_dops_dep_a_t* check_msg = (msg_dops_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->gdop == 348, - "incorrect value for gdop, expected 348, is %d", - check_msg->gdop); - ck_assert_msg(check_msg->hdop == 637, - "incorrect value for hdop, expected 637, is %d", - check_msg->hdop); - ck_assert_msg(check_msg->pdop == 311, - "incorrect value for pdop, expected 311, is %d", - check_msg->pdop); - ck_assert_msg(check_msg->tdop == 155, - "incorrect value for tdop, expected 155, is %d", - check_msg->tdop); - ck_assert_msg(check_msg->tow == 407154000, - "incorrect value for tow, expected 407154000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->vdop == 112, - "incorrect value for vdop, expected 112, is %d", - check_msg->vdop); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x206, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x206, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 6, 2, 195, 4, 14, 56, 177, 68, 24, 92, - 1, 55, 1, 155, 0, 125, 2, 112, 0, 70, 67, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_dops_dep_a_t* test_msg = (msg_dops_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->gdop = 348; - test_msg->hdop = 637; - test_msg->pdop = 311; - test_msg->tdop = 155; - test_msg->tow = 407155000; - test_msg->vdop = 112; - sbp_payload_send(&sbp_state, 0x206, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x206, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_dops_dep_a_t* check_msg = (msg_dops_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->gdop == 348, - "incorrect value for gdop, expected 348, is %d", - check_msg->gdop); - ck_assert_msg(check_msg->hdop == 637, - "incorrect value for hdop, expected 637, is %d", - check_msg->hdop); - ck_assert_msg(check_msg->pdop == 311, - "incorrect value for pdop, expected 311, is %d", - check_msg->pdop); - ck_assert_msg(check_msg->tdop == 155, - "incorrect value for tdop, expected 155, is %d", - check_msg->tdop); - ck_assert_msg(check_msg->tow == 407155000, - "incorrect value for tow, expected 407155000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->vdop == 112, - "incorrect value for vdop, expected 112, is %d", - check_msg->vdop); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_navigation_MsgDopsDepA_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_navigation_MsgDopsDepA"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgDopsDepA"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgDopsDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgGPSTime.c b/c/test/legacy/auto_check_sbp_navigation_MsgGPSTime.c deleted file mode 100644 index 5e5aa4425a..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgGPSTime.c +++ /dev/null @@ -1,628 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgGPSTime.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgGPSTime) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x102, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x102, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 1, 211, 136, 11, 128, 7, 40, 244, - 122, 19, 244, 139, 2, 0, 0, 34, 152, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_t* test_msg = (msg_gps_time_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 166900; - test_msg->tow = 326825000; - test_msg->wn = 1920; - sbp_payload_send(&sbp_state, 0x102, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x102, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_t* check_msg = (msg_gps_time_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 166900, - "incorrect value for ns_residual, expected 166900, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 326825000, - "incorrect value for tow, expected 326825000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1920, - "incorrect value for wn, expected 1920, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x102, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x102, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 1, 211, 136, 11, 128, 7, 28, 246, - 122, 19, 126, 234, 3, 0, 0, 65, 3, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_t* test_msg = (msg_gps_time_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 256638; - test_msg->tow = 326825500; - test_msg->wn = 1920; - sbp_payload_send(&sbp_state, 0x102, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x102, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_t* check_msg = (msg_gps_time_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 256638, - "incorrect value for ns_residual, expected 256638, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 326825500, - "incorrect value for tow, expected 326825500, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1920, - "incorrect value for wn, expected 1920, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x102, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x102, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 1, 211, 136, 11, 128, 7, 16, 248, - 122, 19, 129, 12, 4, 0, 0, 12, 84, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_t* test_msg = (msg_gps_time_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 265345; - test_msg->tow = 326826000; - test_msg->wn = 1920; - sbp_payload_send(&sbp_state, 0x102, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x102, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_t* check_msg = (msg_gps_time_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 265345, - "incorrect value for ns_residual, expected 265345, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 326826000, - "incorrect value for tow, expected 326826000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1920, - "incorrect value for wn, expected 1920, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x102, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x102, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 1, 211, 136, 11, 128, 7, 4, 250, - 122, 19, 137, 204, 4, 0, 0, 50, 165, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_t* test_msg = (msg_gps_time_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 314505; - test_msg->tow = 326826500; - test_msg->wn = 1920; - sbp_payload_send(&sbp_state, 0x102, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x102, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_t* check_msg = (msg_gps_time_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 314505, - "incorrect value for ns_residual, expected 314505, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 326826500, - "incorrect value for tow, expected 326826500, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1920, - "incorrect value for wn, expected 1920, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x102, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x102, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 1, 211, 136, 11, 128, 7, 248, 251, - 122, 19, 181, 137, 5, 0, 0, 180, 33, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_t* test_msg = (msg_gps_time_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 362933; - test_msg->tow = 326827000; - test_msg->wn = 1920; - sbp_payload_send(&sbp_state, 0x102, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x102, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_t* check_msg = (msg_gps_time_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 362933, - "incorrect value for ns_residual, expected 362933, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 326827000, - "incorrect value for tow, expected 326827000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1920, - "incorrect value for wn, expected 1920, is %d", - check_msg->wn); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_navigation_MsgGPSTime_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_navigation_MsgGPSTime"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgGPSTime"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgGPSTime); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgGPSTimeDepA.c b/c/test/legacy/auto_check_sbp_navigation_MsgGPSTimeDepA.c deleted file mode 100644 index 876050c3c5..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgGPSTimeDepA.c +++ /dev/null @@ -1,1234 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgGPSTimeDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x100, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x100, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 1, 246, 215, 11, 251, 6, 120, 46, 39, 0, 0, 0, 0, 0, 0, 133, 36, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_dep_a_t* test_msg = (msg_gps_time_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 0; - test_msg->tow = 2567800; - test_msg->wn = 1787; - sbp_payload_send(&sbp_state, 0x100, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x100, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_dep_a_t* check_msg = - (msg_gps_time_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 0, - "incorrect value for ns_residual, expected 0, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 2567800, - "incorrect value for tow, expected 2567800, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1787, - "incorrect value for wn, expected 1787, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x100, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x100, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 1, 246, 215, 11, 251, 6, 220, 46, 39, 0, 0, 0, 0, 0, 0, 36, 160, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_dep_a_t* test_msg = (msg_gps_time_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 0; - test_msg->tow = 2567900; - test_msg->wn = 1787; - sbp_payload_send(&sbp_state, 0x100, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x100, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_dep_a_t* check_msg = - (msg_gps_time_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 0, - "incorrect value for ns_residual, expected 0, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 2567900, - "incorrect value for tow, expected 2567900, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1787, - "incorrect value for wn, expected 1787, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x100, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x100, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 1, 246, 215, 11, 251, 6, 64, 47, 39, 0, 0, 0, 0, 0, 0, 171, 190, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_dep_a_t* test_msg = (msg_gps_time_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 0; - test_msg->tow = 2568000; - test_msg->wn = 1787; - sbp_payload_send(&sbp_state, 0x100, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x100, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_dep_a_t* check_msg = - (msg_gps_time_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 0, - "incorrect value for ns_residual, expected 0, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 2568000, - "incorrect value for tow, expected 2568000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1787, - "incorrect value for wn, expected 1787, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x100, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x100, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 1, 246, 215, 11, 251, 6, 164, 47, 39, 0, 0, 0, 0, 0, 0, 211, 101, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_dep_a_t* test_msg = (msg_gps_time_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 0; - test_msg->tow = 2568100; - test_msg->wn = 1787; - sbp_payload_send(&sbp_state, 0x100, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x100, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_dep_a_t* check_msg = - (msg_gps_time_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 0, - "incorrect value for ns_residual, expected 0, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 2568100, - "incorrect value for tow, expected 2568100, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1787, - "incorrect value for wn, expected 1787, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x100, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x100, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 1, 246, 215, 11, 251, 6, 8, 48, 39, 0, 0, 0, 0, 0, 0, 251, 44, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_dep_a_t* test_msg = (msg_gps_time_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 0; - test_msg->tow = 2568200; - test_msg->wn = 1787; - sbp_payload_send(&sbp_state, 0x100, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x100, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_dep_a_t* check_msg = - (msg_gps_time_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 0, - "incorrect value for ns_residual, expected 0, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 2568200, - "incorrect value for tow, expected 2568200, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1787, - "incorrect value for wn, expected 1787, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x100, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x100, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 1, 195, 4, 11, 46, 7, 212, 157, - 67, 24, 111, 147, 252, 255, 0, 215, 190, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_dep_a_t* test_msg = (msg_gps_time_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = -224401; - test_msg->tow = 407084500; - test_msg->wn = 1838; - sbp_payload_send(&sbp_state, 0x100, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x100, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_dep_a_t* check_msg = - (msg_gps_time_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == -224401, - "incorrect value for ns_residual, expected -224401, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 407084500, - "incorrect value for tow, expected 407084500, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1838, - "incorrect value for wn, expected 1838, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x100, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x100, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 1, 195, 4, 11, 46, 7, 56, 158, - 67, 24, 109, 103, 3, 0, 0, 134, 89, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_dep_a_t* test_msg = (msg_gps_time_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 223085; - test_msg->tow = 407084600; - test_msg->wn = 1838; - sbp_payload_send(&sbp_state, 0x100, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x100, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_dep_a_t* check_msg = - (msg_gps_time_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 223085, - "incorrect value for ns_residual, expected 223085, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 407084600, - "incorrect value for tow, expected 407084600, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1838, - "incorrect value for wn, expected 1838, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x100, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x100, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 1, 195, 4, 11, 46, 7, 156, 158, - 67, 24, 233, 152, 252, 255, 0, 206, 241, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_dep_a_t* test_msg = (msg_gps_time_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = -222999; - test_msg->tow = 407084700; - test_msg->wn = 1838; - sbp_payload_send(&sbp_state, 0x100, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x100, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_dep_a_t* check_msg = - (msg_gps_time_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == -222999, - "incorrect value for ns_residual, expected -222999, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 407084700, - "incorrect value for tow, expected 407084700, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1838, - "incorrect value for wn, expected 1838, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x100, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x100, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 1, 195, 4, 11, 46, 7, 0, 159, 67, 24, 240, 154, 3, 0, 0, 147, 98, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_dep_a_t* test_msg = (msg_gps_time_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 236272; - test_msg->tow = 407084800; - test_msg->wn = 1838; - sbp_payload_send(&sbp_state, 0x100, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x100, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_dep_a_t* check_msg = - (msg_gps_time_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 236272, - "incorrect value for ns_residual, expected 236272, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 407084800, - "incorrect value for tow, expected 407084800, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1838, - "incorrect value for wn, expected 1838, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x100, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x100, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 1, 195, 4, 11, 46, 7, 100, 159, - 67, 24, 144, 101, 252, 255, 0, 186, 152, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_dep_a_t* test_msg = (msg_gps_time_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = -236144; - test_msg->tow = 407084900; - test_msg->wn = 1838; - sbp_payload_send(&sbp_state, 0x100, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x100, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_dep_a_t* check_msg = - (msg_gps_time_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == -236144, - "incorrect value for ns_residual, expected -236144, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 407084900, - "incorrect value for tow, expected 407084900, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1838, - "incorrect value for wn, expected 1838, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x100, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x100, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 1, 195, 4, 11, 46, 7, 46, 162, - 68, 24, 205, 230, 250, 255, 0, 11, 225, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_dep_a_t* test_msg = (msg_gps_time_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = -334131; - test_msg->tow = 407151150; - test_msg->wn = 1838; - sbp_payload_send(&sbp_state, 0x100, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x100, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_dep_a_t* check_msg = - (msg_gps_time_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == -334131, - "incorrect value for ns_residual, expected -334131, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 407151150, - "incorrect value for tow, expected 407151150, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1838, - "incorrect value for wn, expected 1838, is %d", - check_msg->wn); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_navigation_MsgGPSTimeDepA_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgGPSTimeDepA"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgGPSTimeGNSS.c b/c/test/legacy/auto_check_sbp_navigation_MsgGPSTimeGNSS.c deleted file mode 100644 index 64bf367e9f..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgGPSTimeGNSS.c +++ /dev/null @@ -1,634 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgGPSTimeGNSS.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x104, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x104, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 1, 211, 136, 11, 128, 7, 40, 244, - 122, 19, 244, 139, 2, 0, 0, 153, 88, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_gnss_t* test_msg = (msg_gps_time_gnss_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 166900; - test_msg->tow = 326825000; - test_msg->wn = 1920; - sbp_payload_send(&sbp_state, 0x104, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x104, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_gnss_t* check_msg = - (msg_gps_time_gnss_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 166900, - "incorrect value for ns_residual, expected 166900, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 326825000, - "incorrect value for tow, expected 326825000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1920, - "incorrect value for wn, expected 1920, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x104, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x104, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 1, 211, 136, 11, 128, 7, 28, 246, - 122, 19, 126, 234, 3, 0, 0, 250, 195, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_gnss_t* test_msg = (msg_gps_time_gnss_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 256638; - test_msg->tow = 326825500; - test_msg->wn = 1920; - sbp_payload_send(&sbp_state, 0x104, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x104, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_gnss_t* check_msg = - (msg_gps_time_gnss_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 256638, - "incorrect value for ns_residual, expected 256638, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 326825500, - "incorrect value for tow, expected 326825500, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1920, - "incorrect value for wn, expected 1920, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x104, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x104, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 1, 211, 136, 11, 128, 7, 16, 248, - 122, 19, 129, 12, 4, 0, 0, 183, 148, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_gnss_t* test_msg = (msg_gps_time_gnss_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 265345; - test_msg->tow = 326826000; - test_msg->wn = 1920; - sbp_payload_send(&sbp_state, 0x104, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x104, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_gnss_t* check_msg = - (msg_gps_time_gnss_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 265345, - "incorrect value for ns_residual, expected 265345, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 326826000, - "incorrect value for tow, expected 326826000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1920, - "incorrect value for wn, expected 1920, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x104, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x104, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 1, 211, 136, 11, 128, 7, 4, 250, - 122, 19, 137, 204, 4, 0, 0, 137, 101, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_gnss_t* test_msg = (msg_gps_time_gnss_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 314505; - test_msg->tow = 326826500; - test_msg->wn = 1920; - sbp_payload_send(&sbp_state, 0x104, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x104, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_gnss_t* check_msg = - (msg_gps_time_gnss_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 314505, - "incorrect value for ns_residual, expected 314505, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 326826500, - "incorrect value for tow, expected 326826500, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1920, - "incorrect value for wn, expected 1920, is %d", - check_msg->wn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x104, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x104, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 1, 211, 136, 11, 128, 7, 248, 251, - 122, 19, 181, 137, 5, 0, 0, 15, 225, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gps_time_gnss_t* test_msg = (msg_gps_time_gnss_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 362933; - test_msg->tow = 326827000; - test_msg->wn = 1920; - sbp_payload_send(&sbp_state, 0x104, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x104, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gps_time_gnss_t* check_msg = - (msg_gps_time_gnss_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->ns_residual == 362933, - "incorrect value for ns_residual, expected 362933, is %d", - check_msg->ns_residual); - ck_assert_msg(check_msg->tow == 326827000, - "incorrect value for tow, expected 326827000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 1920, - "incorrect value for wn, expected 1920, is %d", - check_msg->wn); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgPosECEF.c b/c/test/legacy/auto_check_sbp_navigation_MsgPosECEF.c deleted file mode 100644 index 4397fe8bbe..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgPosECEF.c +++ /dev/null @@ -1,580 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosECEF.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgPosECEF) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x209, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x209, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 9, 2, 211, 136, 32, 16, 248, 122, 19, 73, 29, 46, 132, - 182, 122, 68, 193, 219, 192, 29, 176, 121, 119, 80, 193, 83, 11, - 210, 90, 79, 75, 77, 65, 0, 0, 15, 2, 84, 6, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_t* test_msg = (msg_pos_ecef_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 2; - test_msg->n_sats = 15; - test_msg->tow = 326826000; - test_msg->x = -2684269.0326572997; - test_msg->y = -4316646.751816; - test_msg->z = 3839646.7095350414; - sbp_payload_send(&sbp_state, 0x209, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x209, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_t* check_msg = (msg_pos_ecef_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 2, - "incorrect value for flags, expected 2, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326826000, - "incorrect value for tow, expected 326826000, is %d", - check_msg->tow); - ck_assert_msg((check_msg->x * 100 - -2684269.03266 * 100) < 0.05, - "incorrect value for x, expected -2684269.03266, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4316646.75182 * 100) < 0.05, - "incorrect value for y, expected -4316646.75182, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3839646.70954 * 100) < 0.05, - "incorrect value for z, expected 3839646.70954, is %f", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x209, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x209, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 9, 2, 211, 136, 32, 248, 251, 122, 19, 103, 106, 57, 136, - 182, 122, 68, 193, 176, 242, 200, 176, 121, 119, 80, 193, 244, 135, - 97, 59, 79, 75, 77, 65, 0, 0, 15, 2, 147, 216, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_t* test_msg = (msg_pos_ecef_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 2; - test_msg->n_sats = 15; - test_msg->tow = 326827000; - test_msg->x = -2684269.064252186; - test_msg->y = -4316646.762264892; - test_msg->z = 3839646.463913912; - sbp_payload_send(&sbp_state, 0x209, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x209, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_t* check_msg = (msg_pos_ecef_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 2, - "incorrect value for flags, expected 2, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326827000, - "incorrect value for tow, expected 326827000, is %d", - check_msg->tow); - ck_assert_msg((check_msg->x * 100 - -2684269.06425 * 100) < 0.05, - "incorrect value for x, expected -2684269.06425, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4316646.76226 * 100) < 0.05, - "incorrect value for y, expected -4316646.76226, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3839646.46391 * 100) < 0.05, - "incorrect value for z, expected 3839646.46391, is %f", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x209, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x209, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 9, 2, 211, 136, 32, 224, 255, 122, 19, 101, 179, 242, 182, - 182, 122, 68, 193, 130, 196, 145, 199, 121, 119, 80, 193, 212, 10, - 253, 15, 79, 75, 77, 65, 0, 0, 15, 2, 40, 201, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_t* test_msg = (msg_pos_ecef_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 2; - test_msg->n_sats = 15; - test_msg->tow = 326828000; - test_msg->x = -2684269.4292816394; - test_msg->y = -4316647.118271949; - test_msg->z = 3839646.124909738; - sbp_payload_send(&sbp_state, 0x209, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x209, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_t* check_msg = (msg_pos_ecef_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 2, - "incorrect value for flags, expected 2, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326828000, - "incorrect value for tow, expected 326828000, is %d", - check_msg->tow); - ck_assert_msg((check_msg->x * 100 - -2684269.42928 * 100) < 0.05, - "incorrect value for x, expected -2684269.42928, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4316647.11827 * 100) < 0.05, - "incorrect value for y, expected -4316647.11827, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3839646.12491 * 100) < 0.05, - "incorrect value for z, expected 3839646.12491, is %f", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x209, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x209, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 9, 2, 211, 136, 32, 200, 3, 123, 19, 146, 214, 132, 215, - 182, 122, 68, 193, 213, 68, 49, 215, 121, 119, 80, 193, 71, 34, - 110, 243, 78, 75, 77, 65, 0, 0, 15, 2, 187, 86, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_t* test_msg = (msg_pos_ecef_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 2; - test_msg->n_sats = 15; - test_msg->tow = 326829000; - test_msg->x = -2684269.683741399; - test_msg->y = -4316647.3623821335; - test_msg->z = 3839645.90179852; - sbp_payload_send(&sbp_state, 0x209, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x209, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_t* check_msg = (msg_pos_ecef_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 2, - "incorrect value for flags, expected 2, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326829000, - "incorrect value for tow, expected 326829000, is %d", - check_msg->tow); - ck_assert_msg((check_msg->x * 100 - -2684269.68374 * 100) < 0.05, - "incorrect value for x, expected -2684269.68374, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4316647.36238 * 100) < 0.05, - "incorrect value for y, expected -4316647.36238, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3839645.9018 * 100) < 0.05, - "incorrect value for z, expected 3839645.9018, is %f", - check_msg->z); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_navigation_MsgPosECEF_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_navigation_MsgPosECEF"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgPosECEF"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgPosECEF); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgPosECEFCov.c b/c/test/legacy/auto_check_sbp_navigation_MsgPosECEFCov.c deleted file mode 100644 index 57d6abd77c..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgPosECEFCov.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosECEFCov.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgPosECEFCov) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x214, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x214, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 20, 2, 66, 0, 54, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 24, 64, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, - 16, 64, 0, 0, 0, 65, 0, 0, 224, 64, 0, 0, 0, 64, 0, 0, - 192, 64, 0, 0, 0, 65, 0, 0, 160, 64, 4, 5, 249, 167, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_cov_t *test_msg = (msg_pos_ecef_cov_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cov_x_x = 8.0; - test_msg->cov_x_y = 7.0; - test_msg->cov_x_z = 2.0; - test_msg->cov_y_y = 6.0; - test_msg->cov_y_z = 8.0; - test_msg->cov_z_z = 5.0; - test_msg->flags = 5; - test_msg->n_sats = 4; - test_msg->tow = 7; - test_msg->x = 6.0; - test_msg->y = 1.0; - test_msg->z = 4.0; - sbp_payload_send(&sbp_state, 0x214, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x214, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_cov_t *check_msg = - (msg_pos_ecef_cov_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cov_x_x * 100 - 8.0 * 100) < 0.05, - "incorrect value for cov_x_x, expected 8.0, is %f", - check_msg->cov_x_x); - ck_assert_msg((check_msg->cov_x_y * 100 - 7.0 * 100) < 0.05, - "incorrect value for cov_x_y, expected 7.0, is %f", - check_msg->cov_x_y); - ck_assert_msg((check_msg->cov_x_z * 100 - 2.0 * 100) < 0.05, - "incorrect value for cov_x_z, expected 2.0, is %f", - check_msg->cov_x_z); - ck_assert_msg((check_msg->cov_y_y * 100 - 6.0 * 100) < 0.05, - "incorrect value for cov_y_y, expected 6.0, is %f", - check_msg->cov_y_y); - ck_assert_msg((check_msg->cov_y_z * 100 - 8.0 * 100) < 0.05, - "incorrect value for cov_y_z, expected 8.0, is %f", - check_msg->cov_y_z); - ck_assert_msg((check_msg->cov_z_z * 100 - 5.0 * 100) < 0.05, - "incorrect value for cov_z_z, expected 5.0, is %f", - check_msg->cov_z_z); - ck_assert_msg(check_msg->flags == 5, - "incorrect value for flags, expected 5, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 4, - "incorrect value for n_sats, expected 4, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 7, - "incorrect value for tow, expected 7, is %d", check_msg->tow); - ck_assert_msg((check_msg->x * 100 - 6.0 * 100) < 0.05, - "incorrect value for x, expected 6.0, is %f", check_msg->x); - ck_assert_msg((check_msg->y * 100 - 1.0 * 100) < 0.05, - "incorrect value for y, expected 1.0, is %f", check_msg->y); - ck_assert_msg((check_msg->z * 100 - 4.0 * 100) < 0.05, - "incorrect value for z, expected 4.0, is %f", check_msg->z); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgPosECEFCov_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgPosECEFCov"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgPosECEFCov"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgPosECEFCov); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgPosECEFCovGNSS.c b/c/test/legacy/auto_check_sbp_navigation_MsgPosECEFCovGNSS.c deleted file mode 100644 index 4be4acd23f..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgPosECEFCovGNSS.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosECEFCovGNSS.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgPosECEFCovGNSS) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x234, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x234, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 52, 2, 0, 16, 54, 24, 229, 233, 29, 52, 254, 158, - 218, 42, 142, 68, 193, 69, 162, 89, 91, 34, 68, 80, 193, - 131, 21, 176, 129, 239, 174, 77, 65, 158, 232, 30, 60, 218, - 221, 20, 60, 129, 136, 198, 187, 205, 120, 166, 60, 5, 166, - 35, 188, 122, 177, 115, 60, 18, 4, 159, 102, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_cov_gnss_t *test_msg = - (msg_pos_ecef_cov_gnss_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cov_x_x = 0.009699014946818352; - test_msg->cov_x_y = 0.009086096659302711; - test_msg->cov_x_z = -0.006058753002434969; - test_msg->cov_y_y = 0.020321274176239967; - test_msg->cov_y_z = -0.009988312609493732; - test_msg->cov_z_z = 0.01487385667860508; - test_msg->flags = 4; - test_msg->n_sats = 18; - test_msg->tow = 501867800; - test_msg->x = -2694229.7079770807; - test_msg->y = -4264073.427345817; - test_msg->z = 3890655.013186158; - sbp_payload_send(&sbp_state, 0x234, 4096, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 4096, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 4096, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x234, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_cov_gnss_t *check_msg = - (msg_pos_ecef_cov_gnss_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->cov_x_x * 100 - 0.00969901494682 * 100) < 0.05, - "incorrect value for cov_x_x, expected 0.00969901494682, is %f", - check_msg->cov_x_x); - ck_assert_msg( - (check_msg->cov_x_y * 100 - 0.0090860966593 * 100) < 0.05, - "incorrect value for cov_x_y, expected 0.0090860966593, is %f", - check_msg->cov_x_y); - ck_assert_msg( - (check_msg->cov_x_z * 100 - -0.00605875300243 * 100) < 0.05, - "incorrect value for cov_x_z, expected -0.00605875300243, is %f", - check_msg->cov_x_z); - ck_assert_msg( - (check_msg->cov_y_y * 100 - 0.0203212741762 * 100) < 0.05, - "incorrect value for cov_y_y, expected 0.0203212741762, is %f", - check_msg->cov_y_y); - ck_assert_msg( - (check_msg->cov_y_z * 100 - -0.00998831260949 * 100) < 0.05, - "incorrect value for cov_y_z, expected -0.00998831260949, is %f", - check_msg->cov_y_z); - ck_assert_msg( - (check_msg->cov_z_z * 100 - 0.0148738566786 * 100) < 0.05, - "incorrect value for cov_z_z, expected 0.0148738566786, is %f", - check_msg->cov_z_z); - ck_assert_msg(check_msg->flags == 4, - "incorrect value for flags, expected 4, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 18, - "incorrect value for n_sats, expected 18, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 501867800, - "incorrect value for tow, expected 501867800, is %d", - check_msg->tow); - ck_assert_msg((check_msg->x * 100 - -2694229.70798 * 100) < 0.05, - "incorrect value for x, expected -2694229.70798, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4264073.42735 * 100) < 0.05, - "incorrect value for y, expected -4264073.42735, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3890655.01319 * 100) < 0.05, - "incorrect value for z, expected 3890655.01319, is %f", - check_msg->z); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgPosECEFCovGNSS_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgPosECEFCovGNSS"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgPosECEFCovGNSS"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_navigation_MsgPosECEFCovGNSS); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgPosECEFDepA.c b/c/test/legacy/auto_check_sbp_navigation_MsgPosECEFDepA.c deleted file mode 100644 index 36946feaa3..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgPosECEFDepA.c +++ /dev/null @@ -1,1383 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosECEFDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x200, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x200, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 2, 246, 215, 32, 20, 46, 39, 0, 195, 122, 175, 75, - 33, 154, 68, 193, 164, 14, 230, 176, 231, 95, 80, 193, 78, 220, - 22, 253, 254, 105, 77, 65, 0, 0, 9, 0, 13, 86, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_dep_a_t* test_msg = (msg_pos_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 9; - test_msg->tow = 2567700; - test_msg->x = -2700354.5912927105; - test_msg->y = -4292510.764041577; - test_msg->z = 3855357.977260149; - sbp_payload_send(&sbp_state, 0x200, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x200, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_dep_a_t* check_msg = - (msg_pos_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567700, - "incorrect value for tow, expected 2567700, is %d", - check_msg->tow); - ck_assert_msg((check_msg->x * 100 - -2700354.59129 * 100) < 0.05, - "incorrect value for x, expected -2700354.59129, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4292510.76404 * 100) < 0.05, - "incorrect value for y, expected -4292510.76404, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3855357.97726 * 100) < 0.05, - "incorrect value for z, expected 3855357.97726, is %f", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x200, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x200, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 2, 246, 215, 32, 20, 46, 39, 0, 212, 196, 12, 42, - 34, 154, 68, 193, 9, 113, 112, 123, 231, 95, 80, 193, 54, 97, - 38, 192, 254, 105, 77, 65, 0, 0, 9, 1, 75, 143, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_dep_a_t* test_msg = (msg_pos_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 1; - test_msg->n_sats = 9; - test_msg->tow = 2567700; - test_msg->x = -2700356.3285146747; - test_msg->y = -4292509.928737887; - test_msg->z = 3855357.5011712564; - sbp_payload_send(&sbp_state, 0x200, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x200, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_dep_a_t* check_msg = - (msg_pos_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567700, - "incorrect value for tow, expected 2567700, is %d", - check_msg->tow); - ck_assert_msg((check_msg->x * 100 - -2700356.32851 * 100) < 0.05, - "incorrect value for x, expected -2700356.32851, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4292509.92874 * 100) < 0.05, - "incorrect value for y, expected -4292509.92874, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3855357.50117 * 100) < 0.05, - "incorrect value for z, expected 3855357.50117, is %f", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x200, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x200, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 2, 246, 215, 32, 120, 46, 39, 0, 112, 97, 39, 190, - 34, 154, 68, 193, 230, 43, 119, 115, 231, 95, 80, 193, 50, 199, - 76, 66, 254, 105, 77, 65, 0, 0, 9, 0, 204, 113, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_dep_a_t* test_msg = (msg_pos_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 9; - test_msg->tow = 2567800; - test_msg->x = -2700357.485576801; - test_msg->y = -4292509.80414865; - test_msg->z = 3855356.517968082; - sbp_payload_send(&sbp_state, 0x200, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x200, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_dep_a_t* check_msg = - (msg_pos_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567800, - "incorrect value for tow, expected 2567800, is %d", - check_msg->tow); - ck_assert_msg((check_msg->x * 100 - -2700357.48558 * 100) < 0.05, - "incorrect value for x, expected -2700357.48558, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4292509.80415 * 100) < 0.05, - "incorrect value for y, expected -4292509.80415, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3855356.51797 * 100) < 0.05, - "incorrect value for z, expected 3855356.51797, is %f", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x200, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x200, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 2, 246, 215, 32, 120, 46, 39, 0, 194, 82, 121, 4, - 34, 154, 68, 193, 223, 186, 1, 140, 231, 95, 80, 193, 176, 152, - 147, 181, 254, 105, 77, 65, 0, 0, 9, 1, 97, 71, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_dep_a_t* test_msg = (msg_pos_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 1; - test_msg->n_sats = 9; - test_msg->tow = 2567800; - test_msg->x = -2700356.0349524925; - test_msg->y = -4292510.187605589; - test_msg->z = 3855357.4185667858; - sbp_payload_send(&sbp_state, 0x200, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x200, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_dep_a_t* check_msg = - (msg_pos_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567800, - "incorrect value for tow, expected 2567800, is %d", - check_msg->tow); - ck_assert_msg((check_msg->x * 100 - -2700356.03495 * 100) < 0.05, - "incorrect value for x, expected -2700356.03495, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4292510.18761 * 100) < 0.05, - "incorrect value for y, expected -4292510.18761, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3855357.41857 * 100) < 0.05, - "incorrect value for z, expected 3855357.41857, is %f", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x200, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x200, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 2, 246, 215, 32, 220, 46, 39, 0, 216, 41, 227, 254, - 33, 154, 68, 193, 9, 151, 154, 124, 231, 95, 80, 193, 1, 183, - 214, 139, 255, 105, 77, 65, 0, 0, 9, 0, 7, 98, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_dep_a_t* test_msg = (msg_pos_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 9; - test_msg->tow = 2567900; - test_msg->x = -2700355.9913074784; - test_msg->y = -4292509.946935424; - test_msg->z = 3855359.0924900775; - sbp_payload_send(&sbp_state, 0x200, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x200, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_dep_a_t* check_msg = - (msg_pos_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567900, - "incorrect value for tow, expected 2567900, is %d", - check_msg->tow); - ck_assert_msg((check_msg->x * 100 - -2700355.99131 * 100) < 0.05, - "incorrect value for x, expected -2700355.99131, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4292509.94694 * 100) < 0.05, - "incorrect value for y, expected -4292509.94694, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3855359.09249 * 100) < 0.05, - "incorrect value for z, expected 3855359.09249, is %f", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x200, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x200, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 2, 195, 4, 32, 212, 157, 67, 24, 153, 222, 105, 1, - 252, 161, 68, 193, 254, 247, 52, 112, 74, 67, 80, 193, 164, 207, - 47, 146, 44, 163, 77, 65, 0, 0, 8, 0, 145, 4, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_dep_a_t* test_msg = (msg_pos_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084500; - test_msg->x = -2704376.0110433814; - test_msg->y = -4263209.753232954; - test_msg->z = 3884633.142084079; - sbp_payload_send(&sbp_state, 0x200, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x200, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_dep_a_t* check_msg = - (msg_pos_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084500, - "incorrect value for tow, expected 407084500, is %d", - check_msg->tow); - ck_assert_msg((check_msg->x * 100 - -2704376.01104 * 100) < 0.05, - "incorrect value for x, expected -2704376.01104, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4263209.75323 * 100) < 0.05, - "incorrect value for y, expected -4263209.75323, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3884633.14208 * 100) < 0.05, - "incorrect value for z, expected 3884633.14208, is %f", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x200, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x200, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 2, 195, 4, 32, 56, 158, 67, 24, 215, 184, 223, 246, - 251, 161, 68, 193, 36, 126, 17, 39, 74, 67, 80, 193, 19, 179, - 70, 80, 44, 163, 77, 65, 0, 0, 8, 0, 245, 66, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_dep_a_t* test_msg = (msg_pos_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084600; - test_msg->x = -2704375.9287024545; - test_msg->y = -4263208.610442672; - test_msg->z = 3884632.627157578; - sbp_payload_send(&sbp_state, 0x200, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x200, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_dep_a_t* check_msg = - (msg_pos_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084600, - "incorrect value for tow, expected 407084600, is %d", - check_msg->tow); - ck_assert_msg((check_msg->x * 100 - -2704375.9287 * 100) < 0.05, - "incorrect value for x, expected -2704375.9287, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4263208.61044 * 100) < 0.05, - "incorrect value for y, expected -4263208.61044, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3884632.62716 * 100) < 0.05, - "incorrect value for z, expected 3884632.62716, is %f", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x200, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x200, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 2, 195, 4, 32, 156, 158, 67, 24, 73, 74, 214, 148, - 251, 161, 68, 193, 213, 151, 184, 215, 73, 67, 80, 193, 110, 99, - 38, 164, 43, 163, 77, 65, 0, 0, 8, 0, 5, 223, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_dep_a_t* test_msg = (msg_pos_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084700; - test_msg->x = -2704375.162789617; - test_msg->y = -4263207.370641668; - test_msg->z = 3884631.282421521; - sbp_payload_send(&sbp_state, 0x200, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x200, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_dep_a_t* check_msg = - (msg_pos_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084700, - "incorrect value for tow, expected 407084700, is %d", - check_msg->tow); - ck_assert_msg((check_msg->x * 100 - -2704375.16279 * 100) < 0.05, - "incorrect value for x, expected -2704375.16279, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4263207.37064 * 100) < 0.05, - "incorrect value for y, expected -4263207.37064, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3884631.28242 * 100) < 0.05, - "incorrect value for z, expected 3884631.28242, is %f", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x200, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x200, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 2, 195, 4, 32, 0, 159, 67, 24, 177, 111, 112, 45, - 252, 161, 68, 193, 213, 168, 198, 253, 73, 67, 80, 193, 245, 12, - 228, 12, 44, 163, 77, 65, 0, 0, 8, 0, 143, 212, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_dep_a_t* test_msg = (msg_pos_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084800; - test_msg->x = -2704376.3549937834; - test_msg->y = -4263207.965250214; - test_msg->z = 3884632.1007095524; - sbp_payload_send(&sbp_state, 0x200, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x200, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_dep_a_t* check_msg = - (msg_pos_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084800, - "incorrect value for tow, expected 407084800, is %d", - check_msg->tow); - ck_assert_msg((check_msg->x * 100 - -2704376.35499 * 100) < 0.05, - "incorrect value for x, expected -2704376.35499, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4263207.96525 * 100) < 0.05, - "incorrect value for y, expected -4263207.96525, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3884632.10071 * 100) < 0.05, - "incorrect value for z, expected 3884632.10071, is %f", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x200, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x200, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 2, 195, 4, 32, 100, 159, 67, 24, 67, 231, 72, 165, - 251, 161, 68, 193, 150, 210, 36, 212, 73, 67, 80, 193, 234, 33, - 25, 189, 43, 163, 77, 65, 0, 0, 8, 0, 70, 221, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_dep_a_t* test_msg = (msg_pos_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084900; - test_msg->x = -2704375.291287334; - test_msg->y = -4263207.314747473; - test_msg->z = 3884631.4773294823; - sbp_payload_send(&sbp_state, 0x200, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x200, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_dep_a_t* check_msg = - (msg_pos_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084900, - "incorrect value for tow, expected 407084900, is %d", - check_msg->tow); - ck_assert_msg((check_msg->x * 100 - -2704375.29129 * 100) < 0.05, - "incorrect value for x, expected -2704375.29129, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4263207.31475 * 100) < 0.05, - "incorrect value for y, expected -4263207.31475, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3884631.47733 * 100) < 0.05, - "incorrect value for z, expected 3884631.47733, is %f", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x200, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x200, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 2, 195, 4, 32, 46, 162, 68, 24, 224, 72, 131, 215, - 251, 161, 68, 193, 180, 123, 222, 94, 74, 67, 80, 193, 191, 3, - 131, 193, 45, 163, 77, 65, 0, 0, 5, 0, 17, 221, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_dep_a_t* test_msg = (msg_pos_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 5; - test_msg->tow = 407151150; - test_msg->x = -2704375.68369399; - test_msg->y = -4263209.482329298; - test_msg->z = 3884635.5118107493; - sbp_payload_send(&sbp_state, 0x200, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x200, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_dep_a_t* check_msg = - (msg_pos_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 5, - "incorrect value for n_sats, expected 5, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407151150, - "incorrect value for tow, expected 407151150, is %d", - check_msg->tow); - ck_assert_msg((check_msg->x * 100 - -2704375.68369 * 100) < 0.05, - "incorrect value for x, expected -2704375.68369, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4263209.48233 * 100) < 0.05, - "incorrect value for y, expected -4263209.48233, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3884635.51181 * 100) < 0.05, - "incorrect value for z, expected 3884635.51181, is %f", - check_msg->z); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_navigation_MsgPosECEFDepA_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgPosECEFDepA"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgPosECEFDepA"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgPosECEFGNSS.c b/c/test/legacy/auto_check_sbp_navigation_MsgPosECEFGNSS.c deleted file mode 100644 index 2b3017a50e..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgPosECEFGNSS.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosECEFGNSS.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgPosECEFGNSS) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x229, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x229, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 41, 2, 0, 16, 32, 24, 229, 233, 29, 52, 254, 158, 218, - 42, 142, 68, 193, 69, 162, 89, 91, 34, 68, 80, 193, 131, 21, - 176, 129, 239, 174, 77, 65, 182, 0, 18, 4, 135, 2, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_ecef_gnss_t *test_msg = (msg_pos_ecef_gnss_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 182; - test_msg->flags = 4; - test_msg->n_sats = 18; - test_msg->tow = 501867800; - test_msg->x = -2694229.7079770807; - test_msg->y = -4264073.427345817; - test_msg->z = 3890655.013186158; - sbp_payload_send(&sbp_state, 0x229, 4096, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 4096, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 4096, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x229, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_ecef_gnss_t *check_msg = - (msg_pos_ecef_gnss_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 182, - "incorrect value for accuracy, expected 182, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 4, - "incorrect value for flags, expected 4, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 18, - "incorrect value for n_sats, expected 18, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 501867800, - "incorrect value for tow, expected 501867800, is %d", - check_msg->tow); - ck_assert_msg((check_msg->x * 100 - -2694229.70798 * 100) < 0.05, - "incorrect value for x, expected -2694229.70798, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4264073.42735 * 100) < 0.05, - "incorrect value for y, expected -4264073.42735, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3890655.01319 * 100) < 0.05, - "incorrect value for z, expected 3890655.01319, is %f", - check_msg->z); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgPosECEFGNSS_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgPosECEFGNSS"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgPosECEFGNSS"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgPosECEFGNSS); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgPosLLH.c b/c/test/legacy/auto_check_sbp_navigation_MsgPosLLH.c deleted file mode 100644 index 892a6d4c86..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgPosLLH.c +++ /dev/null @@ -1,713 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosLLH.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgPosLLH) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20a, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20a, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 10, 2, 211, 136, 34, 40, 244, 122, 19, 201, 106, 155, 186, - 42, 160, 66, 64, 168, 109, 26, 225, 0, 120, 94, 192, 130, 102, - 237, 230, 43, 54, 60, 64, 0, 0, 0, 0, 14, 2, 175, 162, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_t* test_msg = (msg_pos_llh_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 2; - test_msg->h_accuracy = 0; - test_msg->height = 28.21160739227208; - test_msg->lat = 37.25130398358085; - test_msg->lon = -121.87505366879361; - test_msg->n_sats = 14; - test_msg->tow = 326825000; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x20a, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20a, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_t* check_msg = (msg_pos_llh_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 2, - "incorrect value for flags, expected 2, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg((check_msg->height * 100 - 28.2116073923 * 100) < 0.05, - "incorrect value for height, expected 28.2116073923, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.2513039836 * 100) < 0.05, - "incorrect value for lat, expected 37.2513039836, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -121.875053669 * 100) < 0.05, - "incorrect value for lon, expected -121.875053669, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 14, - "incorrect value for n_sats, expected 14, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326825000, - "incorrect value for tow, expected 326825000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20a, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20a, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 10, 2, 211, 136, 34, 16, 248, 122, 19, 52, 177, 251, 178, - 42, 160, 66, 64, 237, 22, 97, 224, 0, 120, 94, 192, 107, 188, - 109, 90, 247, 189, 59, 64, 0, 0, 0, 0, 15, 2, 38, 177, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_t* test_msg = (msg_pos_llh_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 2; - test_msg->h_accuracy = 0; - test_msg->height = 27.742055560866373; - test_msg->lat = 37.251303074738104; - test_msg->lon = -121.87505349618341; - test_msg->n_sats = 15; - test_msg->tow = 326826000; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x20a, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20a, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_t* check_msg = (msg_pos_llh_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 2, - "incorrect value for flags, expected 2, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg((check_msg->height * 100 - 27.7420555609 * 100) < 0.05, - "incorrect value for height, expected 27.7420555609, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.2513030747 * 100) < 0.05, - "incorrect value for lat, expected 37.2513030747, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -121.875053496 * 100) < 0.05, - "incorrect value for lon, expected -121.875053496, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326826000, - "incorrect value for tow, expected 326826000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20a, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20a, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 10, 2, 211, 136, 34, 248, 251, 122, 19, 135, 66, 9, 163, - 42, 160, 66, 64, 146, 8, 99, 225, 0, 120, 94, 192, 45, 181, - 143, 219, 28, 157, 59, 64, 0, 0, 0, 0, 15, 2, 51, 40, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_t* test_msg = (msg_pos_llh_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 2; - test_msg->h_accuracy = 0; - test_msg->height = 27.613721582970516; - test_msg->lat = 37.25130117370741; - test_msg->lon = -121.87505373641241; - test_msg->n_sats = 15; - test_msg->tow = 326827000; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x20a, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20a, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_t* check_msg = (msg_pos_llh_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 2, - "incorrect value for flags, expected 2, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg((check_msg->height * 100 - 27.613721583 * 100) < 0.05, - "incorrect value for height, expected 27.613721583, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.2513011737 * 100) < 0.05, - "incorrect value for lat, expected 37.2513011737, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -121.875053736 * 100) < 0.05, - "incorrect value for lon, expected -121.875053736, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326827000, - "incorrect value for tow, expected 326827000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20a, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20a, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 10, 2, 211, 136, 34, 224, 255, 122, 19, 18, 44, 253, 119, - 42, 160, 66, 64, 48, 109, 39, 231, 0, 120, 94, 192, 185, 76, - 48, 17, 119, 205, 59, 64, 0, 0, 0, 0, 15, 2, 12, 194, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_t* test_msg = (msg_pos_llh_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 2; - test_msg->h_accuracy = 0; - test_msg->height = 27.80259807042305; - test_msg->lat = 37.251296042079176; - test_msg->lon = -121.87505511141057; - test_msg->n_sats = 15; - test_msg->tow = 326828000; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x20a, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20a, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_t* check_msg = (msg_pos_llh_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 2, - "incorrect value for flags, expected 2, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg((check_msg->height * 100 - 27.8025980704 * 100) < 0.05, - "incorrect value for height, expected 27.8025980704, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.2512960421 * 100) < 0.05, - "incorrect value for lat, expected 37.2512960421, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -121.875055111 * 100) < 0.05, - "incorrect value for lon, expected -121.875055111, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326828000, - "incorrect value for tow, expected 326828000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20a, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20a, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 10, 2, 211, 136, 34, 200, 3, 123, 19, 225, 237, 238, 90, - 42, 160, 66, 64, 59, 143, 70, 235, 0, 120, 94, 192, 101, 106, - 249, 224, 131, 240, 59, 64, 0, 0, 0, 0, 15, 2, 34, 103, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_t* test_msg = (msg_pos_llh_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 2; - test_msg->h_accuracy = 0; - test_msg->height = 27.939512310879213; - test_msg->lat = 37.251292578377395; - test_msg->lon = -121.87505609407974; - test_msg->n_sats = 15; - test_msg->tow = 326829000; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x20a, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20a, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_t* check_msg = (msg_pos_llh_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 2, - "incorrect value for flags, expected 2, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg((check_msg->height * 100 - 27.9395123109 * 100) < 0.05, - "incorrect value for height, expected 27.9395123109, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.2512925784 * 100) < 0.05, - "incorrect value for lat, expected 37.2512925784, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -121.875056094 * 100) < 0.05, - "incorrect value for lon, expected -121.875056094, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326829000, - "incorrect value for tow, expected 326829000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_navigation_MsgPosLLH_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_navigation_MsgPosLLH"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgPosLLH"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgPosLLH); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgPosLLHCov.c b/c/test/legacy/auto_check_sbp_navigation_MsgPosLLHCov.c deleted file mode 100644 index b66b0578d0..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgPosLLHCov.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosLLHCov.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgPosLLHCov) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x211, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x211, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 17, 2, 66, 0, 54, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 28, 64, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 224, 64, 0, 0, 160, 64, 0, 0, 0, 65, 0, 0, - 192, 64, 0, 0, 128, 63, 0, 0, 0, 64, 5, 5, 151, 98, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_cov_t *test_msg = (msg_pos_llh_cov_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cov_d_d = 2.0; - test_msg->cov_e_d = 1.0; - test_msg->cov_e_e = 6.0; - test_msg->cov_n_d = 8.0; - test_msg->cov_n_e = 5.0; - test_msg->cov_n_n = 7.0; - test_msg->flags = 5; - test_msg->height = 0.0; - test_msg->lat = 0.0; - test_msg->lon = 7.0; - test_msg->n_sats = 5; - test_msg->tow = 7; - sbp_payload_send(&sbp_state, 0x211, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x211, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_cov_t *check_msg = (msg_pos_llh_cov_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cov_d_d * 100 - 2.0 * 100) < 0.05, - "incorrect value for cov_d_d, expected 2.0, is %f", - check_msg->cov_d_d); - ck_assert_msg((check_msg->cov_e_d * 100 - 1.0 * 100) < 0.05, - "incorrect value for cov_e_d, expected 1.0, is %f", - check_msg->cov_e_d); - ck_assert_msg((check_msg->cov_e_e * 100 - 6.0 * 100) < 0.05, - "incorrect value for cov_e_e, expected 6.0, is %f", - check_msg->cov_e_e); - ck_assert_msg((check_msg->cov_n_d * 100 - 8.0 * 100) < 0.05, - "incorrect value for cov_n_d, expected 8.0, is %f", - check_msg->cov_n_d); - ck_assert_msg((check_msg->cov_n_e * 100 - 5.0 * 100) < 0.05, - "incorrect value for cov_n_e, expected 5.0, is %f", - check_msg->cov_n_e); - ck_assert_msg((check_msg->cov_n_n * 100 - 7.0 * 100) < 0.05, - "incorrect value for cov_n_n, expected 7.0, is %f", - check_msg->cov_n_n); - ck_assert_msg(check_msg->flags == 5, - "incorrect value for flags, expected 5, is %d", - check_msg->flags); - ck_assert_msg((check_msg->height * 100 - 0.0 * 100) < 0.05, - "incorrect value for height, expected 0.0, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 0.0 * 100) < 0.05, - "incorrect value for lat, expected 0.0, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - 7.0 * 100) < 0.05, - "incorrect value for lon, expected 7.0, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 5, - "incorrect value for n_sats, expected 5, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 7, - "incorrect value for tow, expected 7, is %d", check_msg->tow); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgPosLLHCov_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgPosLLHCov"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgPosLLHCov"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgPosLLHCov); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgPosLLHDepA.c b/c/test/legacy/auto_check_sbp_navigation_MsgPosLLHDepA.c deleted file mode 100644 index a7e26eb1b6..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgPosLLHDepA.c +++ /dev/null @@ -1,1427 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosLLHDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x201, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x201, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 1, 2, 246, 215, 34, 20, 46, 39, 0, 250, 29, 226, 186, - 235, 182, 66, 64, 19, 203, 51, 196, 24, 139, 94, 192, 31, 157, - 160, 232, 122, 115, 81, 64, 0, 0, 0, 0, 9, 0, 236, 139, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_dep_a_t* test_msg = (msg_pos_llh_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 69.80437675175607; - test_msg->lat = 37.42906890908121; - test_msg->lon = -122.17338662202773; - test_msg->n_sats = 9; - test_msg->tow = 2567700; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x201, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x201, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_dep_a_t* check_msg = - (msg_pos_llh_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg((check_msg->height * 100 - 69.8043767518 * 100) < 0.05, - "incorrect value for height, expected 69.8043767518, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.4290689091 * 100) < 0.05, - "incorrect value for lat, expected 37.4290689091, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -122.173386622 * 100) < 0.05, - "incorrect value for lon, expected -122.173386622, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567700, - "incorrect value for tow, expected 2567700, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x201, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x201, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 1, 2, 246, 215, 34, 20, 46, 39, 0, 161, 51, 75, 148, - 235, 182, 66, 64, 36, 41, 246, 30, 25, 139, 94, 192, 254, 218, - 49, 127, 10, 108, 81, 64, 0, 0, 0, 0, 9, 1, 25, 117, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_dep_a_t* test_msg = (msg_pos_llh_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 1; - test_msg->h_accuracy = 0; - test_msg->height = 69.68814067715354; - test_msg->lat = 37.42906430885274; - test_msg->lon = -122.17340826071865; - test_msg->n_sats = 9; - test_msg->tow = 2567700; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x201, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x201, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_dep_a_t* check_msg = - (msg_pos_llh_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg((check_msg->height * 100 - 69.6881406772 * 100) < 0.05, - "incorrect value for height, expected 69.6881406772, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.4290643089 * 100) < 0.05, - "incorrect value for lat, expected 37.4290643089, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -122.173408261 * 100) < 0.05, - "incorrect value for lon, expected -122.173408261, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567700, - "incorrect value for tow, expected 2567700, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x201, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x201, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 1, 2, 246, 215, 34, 120, 46, 39, 0, 56, 214, 210, 65, - 235, 182, 66, 64, 13, 46, 132, 80, 25, 139, 94, 192, 22, 143, - 46, 234, 191, 95, 81, 64, 0, 0, 0, 0, 9, 0, 174, 105, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_dep_a_t* test_msg = (msg_pos_llh_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 69.49608854815264; - test_msg->lat = 37.42905447764173; - test_msg->lon = -122.17342007549469; - test_msg->n_sats = 9; - test_msg->tow = 2567800; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x201, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x201, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_dep_a_t* check_msg = - (msg_pos_llh_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg((check_msg->height * 100 - 69.4960885482 * 100) < 0.05, - "incorrect value for height, expected 69.4960885482, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.4290544776 * 100) < 0.05, - "incorrect value for lat, expected 37.4290544776, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -122.173420075 * 100) < 0.05, - "incorrect value for lon, expected -122.173420075, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567800, - "incorrect value for tow, expected 2567800, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x201, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x201, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 1, 2, 246, 215, 34, 120, 46, 39, 0, 251, 117, 115, 140, - 235, 182, 66, 64, 152, 134, 167, 12, 25, 139, 94, 192, 160, 22, - 137, 253, 4, 108, 81, 64, 0, 0, 0, 0, 9, 1, 122, 127, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_dep_a_t* test_msg = (msg_pos_llh_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 1; - test_msg->h_accuracy = 0; - test_msg->height = 69.68780458819901; - test_msg->lat = 37.429063373925565; - test_msg->lon = -122.17340389594972; - test_msg->n_sats = 9; - test_msg->tow = 2567800; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x201, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x201, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_dep_a_t* check_msg = - (msg_pos_llh_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg((check_msg->height * 100 - 69.6878045882 * 100) < 0.05, - "incorrect value for height, expected 69.6878045882, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.4290633739 * 100) < 0.05, - "incorrect value for lat, expected 37.4290633739, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -122.173403896 * 100) < 0.05, - "incorrect value for lon, expected -122.173403896, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567800, - "incorrect value for tow, expected 2567800, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x201, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x201, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 1, 2, 246, 215, 34, 220, 46, 39, 0, 51, 124, 88, 251, - 235, 182, 66, 64, 153, 5, 250, 16, 25, 139, 94, 192, 146, 60, - 187, 219, 152, 161, 81, 64, 0, 0, 0, 0, 9, 0, 194, 158, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_dep_a_t* test_msg = (msg_pos_llh_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 70.5249547317965; - test_msg->lat = 37.42907659359516; - test_msg->lon = -122.17340492645452; - test_msg->n_sats = 9; - test_msg->tow = 2567900; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x201, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x201, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_dep_a_t* check_msg = - (msg_pos_llh_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg((check_msg->height * 100 - 70.5249547318 * 100) < 0.05, - "incorrect value for height, expected 70.5249547318, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.4290765936 * 100) < 0.05, - "incorrect value for lat, expected 37.4290765936, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -122.173404926 * 100) < 0.05, - "incorrect value for lon, expected -122.173404926, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567900, - "incorrect value for tow, expected 2567900, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x201, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x201, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 1, 2, 195, 4, 34, 212, 157, 67, 24, 8, 23, 228, 8, - 151, 225, 66, 64, 156, 174, 42, 194, 230, 152, 94, 192, 153, 23, - 72, 47, 196, 40, 16, 64, 0, 0, 0, 0, 8, 0, 237, 169, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_dep_a_t* test_msg = (msg_pos_llh_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 4.039810885214956; - test_msg->lat = 37.76242171418386; - test_msg->lon = -122.38908437889262; - test_msg->n_sats = 8; - test_msg->tow = 407084500; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x201, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x201, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_dep_a_t* check_msg = - (msg_pos_llh_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg((check_msg->height * 100 - 4.03981088521 * 100) < 0.05, - "incorrect value for height, expected 4.03981088521, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.7624217142 * 100) < 0.05, - "incorrect value for lat, expected 37.7624217142, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -122.389084379 * 100) < 0.05, - "incorrect value for lon, expected -122.389084379, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084500, - "incorrect value for tow, expected 407084500, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x201, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x201, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 1, 2, 195, 4, 34, 56, 158, 67, 24, 220, 109, 212, 24, - 151, 225, 66, 64, 159, 231, 254, 219, 230, 152, 94, 192, 128, 151, - 67, 19, 233, 105, 7, 64, 0, 0, 0, 0, 8, 0, 152, 11, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_dep_a_t* test_msg = (msg_pos_llh_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 2.926714087009657; - test_msg->lat = 37.76242361423985; - test_msg->lon = -122.38909053700489; - test_msg->n_sats = 8; - test_msg->tow = 407084600; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x201, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x201, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_dep_a_t* check_msg = - (msg_pos_llh_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg((check_msg->height * 100 - 2.92671408701 * 100) < 0.05, - "incorrect value for height, expected 2.92671408701, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.7624236142 * 100) < 0.05, - "incorrect value for lat, expected 37.7624236142, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -122.389090537 * 100) < 0.05, - "incorrect value for lon, expected -122.389090537, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084600, - "incorrect value for tow, expected 407084600, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x201, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x201, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 1, 2, 195, 4, 34, 156, 158, 67, 24, 13, 91, 237, 11, - 151, 225, 66, 64, 75, 113, 210, 220, 230, 152, 94, 192, 37, 6, - 145, 188, 89, 112, 238, 63, 0, 0, 0, 0, 8, 0, 221, 155, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_dep_a_t* test_msg = (msg_pos_llh_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 0.9512146647395566; - test_msg->lat = 37.762422076126406; - test_msg->lon = -122.3890907340148; - test_msg->n_sats = 8; - test_msg->tow = 407084700; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x201, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x201, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_dep_a_t* check_msg = - (msg_pos_llh_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg((check_msg->height * 100 - 0.95121466474 * 100) < 0.05, - "incorrect value for height, expected 0.95121466474, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.7624220761 * 100) < 0.05, - "incorrect value for lat, expected 37.7624220761, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -122.389090734 * 100) < 0.05, - "incorrect value for lon, expected -122.389090734, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084700, - "incorrect value for tow, expected 407084700, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x201, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x201, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 1, 2, 195, 4, 34, 0, 159, 67, 24, 51, 183, 5, 8, - 151, 225, 66, 64, 13, 226, 148, 253, 230, 152, 94, 192, 187, 27, - 11, 32, 69, 213, 2, 64, 0, 0, 0, 0, 8, 0, 82, 94, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_dep_a_t* test_msg = (msg_pos_llh_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 2.354135752047538; - test_msg->lat = 37.762421610632735; - test_msg->lon = -122.38909854449612; - test_msg->n_sats = 8; - test_msg->tow = 407084800; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x201, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x201, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_dep_a_t* check_msg = - (msg_pos_llh_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg((check_msg->height * 100 - 2.35413575205 * 100) < 0.05, - "incorrect value for height, expected 2.35413575205, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.7624216106 * 100) < 0.05, - "incorrect value for lat, expected 37.7624216106, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -122.389098544 * 100) < 0.05, - "incorrect value for lon, expected -122.389098544, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084800, - "incorrect value for tow, expected 407084800, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x201, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x201, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 1, 2, 195, 4, 34, 100, 159, 67, 24, 22, 77, 146, 22, - 151, 225, 66, 64, 64, 134, 105, 227, 230, 152, 94, 192, 37, 99, - 114, 72, 31, 103, 241, 63, 0, 0, 0, 0, 8, 0, 70, 60, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_dep_a_t* test_msg = (msg_pos_llh_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 1.0876763181642641; - test_msg->lat = 37.76242334502801; - test_msg->lon = -122.38909230523223; - test_msg->n_sats = 8; - test_msg->tow = 407084900; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x201, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x201, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_dep_a_t* check_msg = - (msg_pos_llh_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg((check_msg->height * 100 - 1.08767631816 * 100) < 0.05, - "incorrect value for height, expected 1.08767631816, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.762423345 * 100) < 0.05, - "incorrect value for lat, expected 37.762423345, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -122.389092305 * 100) < 0.05, - "incorrect value for lon, expected -122.389092305, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084900, - "incorrect value for tow, expected 407084900, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x201, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x201, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 1, 2, 195, 4, 34, 46, 162, 68, 24, 124, 245, 46, 169, - 151, 225, 66, 64, 135, 149, 234, 187, 230, 152, 94, 192, 194, 201, - 115, 145, 166, 175, 20, 64, 0, 0, 0, 0, 5, 0, 212, 121, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_dep_a_t* test_msg = (msg_pos_llh_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 5.171533844654222; - test_msg->lat = 37.76244082253376; - test_msg->lon = -122.38908288868525; - test_msg->n_sats = 5; - test_msg->tow = 407151150; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x201, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x201, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_dep_a_t* check_msg = - (msg_pos_llh_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg((check_msg->height * 100 - 5.17153384465 * 100) < 0.05, - "incorrect value for height, expected 5.17153384465, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.7624408225 * 100) < 0.05, - "incorrect value for lat, expected 37.7624408225, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -122.389082889 * 100) < 0.05, - "incorrect value for lon, expected -122.389082889, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 5, - "incorrect value for n_sats, expected 5, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407151150, - "incorrect value for tow, expected 407151150, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_navigation_MsgPosLLHDepA_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgPosLLHDepA"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgPosLLHDepA"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgPosLlhAcc.c b/c/test/legacy/auto_check_sbp_navigation_MsgPosLlhAcc.c deleted file mode 100644 index cfa076d032..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgPosLlhAcc.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosLlhAcc.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgPosLlhAcc) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x218, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x218, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 24, 2, 2, 28, 67, 39, 120, 110, 18, 51, 51, 51, - 51, 51, 139, 189, 64, 154, 153, 153, 153, 25, 151, 192, 64, - 51, 51, 51, 51, 51, 161, 176, 64, 51, 51, 51, 51, 51, - 101, 179, 64, 51, 163, 22, 69, 154, 25, 173, 69, 102, 134, - 243, 68, 154, 201, 196, 69, 205, 224, 0, 70, 51, 35, 72, - 69, 51, 99, 31, 69, 95, 27, 72, 220, 177, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_acc_t *test_msg = (msg_pos_llh_acc_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->at_accuracy = 6297.2001953125; - test_msg->confidence_and_geoid = 95; - test_msg->ct_accuracy = 1948.199951171875; - test_msg->flags = 72; - test_msg->h_accuracy = 2410.199951171875; - test_msg->h_ellipse.orientation = 2550.199951171875; - test_msg->h_ellipse.semi_major = 8248.2001953125; - test_msg->h_ellipse.semi_minor = 3202.199951171875; - test_msg->height = 4257.2; - test_msg->lat = 7563.2; - test_msg->lon = 8494.2; - test_msg->n_sats = 27; - test_msg->orthometric_height = 4965.2; - test_msg->tow = 309229607; - test_msg->v_accuracy = 5539.2001953125; - sbp_payload_send(&sbp_state, 0x218, 7170, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 7170, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 7170, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x218, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_acc_t *check_msg = (msg_pos_llh_acc_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->at_accuracy * 100 - 6297.20019531 * 100) < 0.05, - "incorrect value for at_accuracy, expected 6297.20019531, is %f", - check_msg->at_accuracy); - ck_assert_msg( - check_msg->confidence_and_geoid == 95, - "incorrect value for confidence_and_geoid, expected 95, is %d", - check_msg->confidence_and_geoid); - ck_assert_msg( - (check_msg->ct_accuracy * 100 - 1948.19995117 * 100) < 0.05, - "incorrect value for ct_accuracy, expected 1948.19995117, is %f", - check_msg->ct_accuracy); - ck_assert_msg(check_msg->flags == 72, - "incorrect value for flags, expected 72, is %d", - check_msg->flags); - ck_assert_msg( - (check_msg->h_accuracy * 100 - 2410.19995117 * 100) < 0.05, - "incorrect value for h_accuracy, expected 2410.19995117, is %f", - check_msg->h_accuracy); - ck_assert_msg( - (check_msg->h_ellipse.orientation * 100 - 2550.19995117 * 100) < 0.05, - "incorrect value for h_ellipse.orientation, expected 2550.19995117, is " - "%f", - check_msg->h_ellipse.orientation); - ck_assert_msg( - (check_msg->h_ellipse.semi_major * 100 - 8248.20019531 * 100) < 0.05, - "incorrect value for h_ellipse.semi_major, expected 8248.20019531, is " - "%f", - check_msg->h_ellipse.semi_major); - ck_assert_msg( - (check_msg->h_ellipse.semi_minor * 100 - 3202.19995117 * 100) < 0.05, - "incorrect value for h_ellipse.semi_minor, expected 3202.19995117, is " - "%f", - check_msg->h_ellipse.semi_minor); - ck_assert_msg((check_msg->height * 100 - 4257.2 * 100) < 0.05, - "incorrect value for height, expected 4257.2, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 7563.2 * 100) < 0.05, - "incorrect value for lat, expected 7563.2, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - 8494.2 * 100) < 0.05, - "incorrect value for lon, expected 8494.2, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 27, - "incorrect value for n_sats, expected 27, is %d", - check_msg->n_sats); - ck_assert_msg( - (check_msg->orthometric_height * 100 - 4965.2 * 100) < 0.05, - "incorrect value for orthometric_height, expected 4965.2, is %f", - check_msg->orthometric_height); - ck_assert_msg(check_msg->tow == 309229607, - "incorrect value for tow, expected 309229607, is %d", - check_msg->tow); - ck_assert_msg( - (check_msg->v_accuracy * 100 - 5539.20019531 * 100) < 0.05, - "incorrect value for v_accuracy, expected 5539.20019531, is %f", - check_msg->v_accuracy); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgPosLlhAcc_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgPosLlhAcc"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgPosLlhAcc"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgPosLlhAcc); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgPosLlhCovGnss.c b/c/test/legacy/auto_check_sbp_navigation_MsgPosLlhCovGnss.c deleted file mode 100644 index 9ff477e267..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgPosLlhCovGnss.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosLlhCovGnss.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgPosLlhCovGnss) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x231, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x231, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 49, 2, 0, 16, 54, 24, 229, 233, 29, 73, 123, 28, - 207, 101, 234, 66, 64, 100, 168, 19, 20, 86, 146, 94, 192, - 214, 198, 35, 120, 209, 100, 49, 192, 12, 102, 245, 59, 6, - 181, 192, 185, 168, 79, 243, 58, 96, 60, 148, 59, 253, 58, - 93, 186, 159, 174, 6, 61, 18, 4, 10, 196, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_cov_gnss_t *test_msg = - (msg_pos_llh_cov_gnss_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cov_d_d = 0.03288137540221214; - test_msg->cov_e_d = -0.0008439270895905793; - test_msg->cov_e_e = 0.004523798823356628; - test_msg->cov_n_d = 0.0018563168123364449; - test_msg->cov_n_e = -0.00036755966721102595; - test_msg->cov_n_n = 0.007488971576094627; - test_msg->flags = 4; - test_msg->height = -17.39382124780135; - test_msg->lat = 37.83123196497633; - test_msg->lon = -122.28650381011681; - test_msg->n_sats = 18; - test_msg->tow = 501867800; - sbp_payload_send(&sbp_state, 0x231, 4096, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 4096, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 4096, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x231, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_cov_gnss_t *check_msg = - (msg_pos_llh_cov_gnss_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->cov_d_d * 100 - 0.0328813754022 * 100) < 0.05, - "incorrect value for cov_d_d, expected 0.0328813754022, is %f", - check_msg->cov_d_d); - ck_assert_msg( - (check_msg->cov_e_d * 100 - -0.000843927089591 * 100) < 0.05, - "incorrect value for cov_e_d, expected -0.000843927089591, is %f", - check_msg->cov_e_d); - ck_assert_msg( - (check_msg->cov_e_e * 100 - 0.00452379882336 * 100) < 0.05, - "incorrect value for cov_e_e, expected 0.00452379882336, is %f", - check_msg->cov_e_e); - ck_assert_msg( - (check_msg->cov_n_d * 100 - 0.00185631681234 * 100) < 0.05, - "incorrect value for cov_n_d, expected 0.00185631681234, is %f", - check_msg->cov_n_d); - ck_assert_msg( - (check_msg->cov_n_e * 100 - -0.000367559667211 * 100) < 0.05, - "incorrect value for cov_n_e, expected -0.000367559667211, is %f", - check_msg->cov_n_e); - ck_assert_msg( - (check_msg->cov_n_n * 100 - 0.00748897157609 * 100) < 0.05, - "incorrect value for cov_n_n, expected 0.00748897157609, is %f", - check_msg->cov_n_n); - ck_assert_msg(check_msg->flags == 4, - "incorrect value for flags, expected 4, is %d", - check_msg->flags); - ck_assert_msg((check_msg->height * 100 - -17.3938212478 * 100) < 0.05, - "incorrect value for height, expected -17.3938212478, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.831231965 * 100) < 0.05, - "incorrect value for lat, expected 37.831231965, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -122.28650381 * 100) < 0.05, - "incorrect value for lon, expected -122.28650381, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 18, - "incorrect value for n_sats, expected 18, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 501867800, - "incorrect value for tow, expected 501867800, is %d", - check_msg->tow); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgPosLlhCovGnss_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgPosLlhCovGnss"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgPosLlhCovGnss"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_navigation_MsgPosLlhCovGnss); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgPosLlhGnss.c b/c/test/legacy/auto_check_sbp_navigation_MsgPosLlhGnss.c deleted file mode 100644 index 06fa563e69..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgPosLlhGnss.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosLlhGnss.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgPosLlhGnss) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x22a, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x22a, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 42, 2, 0, 16, 34, 24, 229, 233, 29, 73, 123, 28, 207, - 101, 234, 66, 64, 100, 168, 19, 20, 86, 146, 94, 192, 214, 198, - 35, 120, 209, 100, 49, 192, 87, 0, 181, 0, 18, 4, 105, 55, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pos_llh_gnss_t *test_msg = (msg_pos_llh_gnss_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 4; - test_msg->h_accuracy = 87; - test_msg->height = -17.39382124780135; - test_msg->lat = 37.83123196497633; - test_msg->lon = -122.28650381011681; - test_msg->n_sats = 18; - test_msg->tow = 501867800; - test_msg->v_accuracy = 181; - sbp_payload_send(&sbp_state, 0x22a, 4096, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 4096, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 4096, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x22a, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pos_llh_gnss_t *check_msg = - (msg_pos_llh_gnss_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 4, - "incorrect value for flags, expected 4, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 87, - "incorrect value for h_accuracy, expected 87, is %d", - check_msg->h_accuracy); - ck_assert_msg((check_msg->height * 100 - -17.3938212478 * 100) < 0.05, - "incorrect value for height, expected -17.3938212478, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.831231965 * 100) < 0.05, - "incorrect value for lat, expected 37.831231965, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -122.28650381 * 100) < 0.05, - "incorrect value for lon, expected -122.28650381, is %f", - check_msg->lon); - ck_assert_msg(check_msg->n_sats == 18, - "incorrect value for n_sats, expected 18, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 501867800, - "incorrect value for tow, expected 501867800, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 181, - "incorrect value for v_accuracy, expected 181, is %d", - check_msg->v_accuracy); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgPosLlhGnss_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgPosLlhGnss"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgPosLlhGnss"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgPosLlhGnss); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgPoseRelative.c b/c/test/legacy/auto_check_sbp_navigation_MsgPoseRelative.c deleted file mode 100644 index 4a3f7ef469..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgPoseRelative.c +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPoseRelative.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgPoseRelative) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x245, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x245, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 69, 2, 66, 0, 90, 86, 4, 0, 0, 0, 86, 4, 0, - 0, 172, 8, 0, 0, 76, 4, 0, 0, 38, 2, 0, 0, 100, - 0, 0, 0, 100, 3, 200, 204, 252, 168, 157, 255, 115, 53, 186, - 144, 190, 48, 34, 37, 0, 0, 128, 63, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 128, - 63, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 64, 5, 171, 187, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pose_relative_t *test_msg = (msg_pose_relative_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cov_c_x_x = 2.0; - test_msg->cov_c_x_y = 0.0; - test_msg->cov_c_x_z = 0.0; - test_msg->cov_c_y_y = 2.0; - test_msg->cov_c_y_z = 0.0; - test_msg->cov_c_z_z = 2.0; - test_msg->cov_r_x_x = 1.0; - test_msg->cov_r_x_y = 0.0; - test_msg->cov_r_x_z = 0.0; - test_msg->cov_r_y_y = 1.0; - test_msg->cov_r_y_z = 0.0; - test_msg->cov_r_z_z = 1.0; - test_msg->flags = 5; - test_msg->sensor_id = 0; - test_msg->timestamp_1 = 1110; - test_msg->timestamp_2 = 2220; - test_msg->tow = 1110; - if (sizeof(test_msg->trans) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->trans[0]); - } - test_msg->trans[0] = 1100; - if (sizeof(test_msg->trans) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->trans[0]); - } - test_msg->trans[1] = 550; - if (sizeof(test_msg->trans) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->trans[0]); - } - test_msg->trans[2] = 100; - test_msg->w = -859307164; - test_msg->x = -6444804; - test_msg->y = -1866844813; - test_msg->z = 622997694; - sbp_payload_send(&sbp_state, 0x245, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x245, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pose_relative_t *check_msg = - (msg_pose_relative_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cov_c_x_x * 100 - 2.0 * 100) < 0.05, - "incorrect value for cov_c_x_x, expected 2.0, is %f", - check_msg->cov_c_x_x); - ck_assert_msg((check_msg->cov_c_x_y * 100 - 0.0 * 100) < 0.05, - "incorrect value for cov_c_x_y, expected 0.0, is %f", - check_msg->cov_c_x_y); - ck_assert_msg((check_msg->cov_c_x_z * 100 - 0.0 * 100) < 0.05, - "incorrect value for cov_c_x_z, expected 0.0, is %f", - check_msg->cov_c_x_z); - ck_assert_msg((check_msg->cov_c_y_y * 100 - 2.0 * 100) < 0.05, - "incorrect value for cov_c_y_y, expected 2.0, is %f", - check_msg->cov_c_y_y); - ck_assert_msg((check_msg->cov_c_y_z * 100 - 0.0 * 100) < 0.05, - "incorrect value for cov_c_y_z, expected 0.0, is %f", - check_msg->cov_c_y_z); - ck_assert_msg((check_msg->cov_c_z_z * 100 - 2.0 * 100) < 0.05, - "incorrect value for cov_c_z_z, expected 2.0, is %f", - check_msg->cov_c_z_z); - ck_assert_msg((check_msg->cov_r_x_x * 100 - 1.0 * 100) < 0.05, - "incorrect value for cov_r_x_x, expected 1.0, is %f", - check_msg->cov_r_x_x); - ck_assert_msg((check_msg->cov_r_x_y * 100 - 0.0 * 100) < 0.05, - "incorrect value for cov_r_x_y, expected 0.0, is %f", - check_msg->cov_r_x_y); - ck_assert_msg((check_msg->cov_r_x_z * 100 - 0.0 * 100) < 0.05, - "incorrect value for cov_r_x_z, expected 0.0, is %f", - check_msg->cov_r_x_z); - ck_assert_msg((check_msg->cov_r_y_y * 100 - 1.0 * 100) < 0.05, - "incorrect value for cov_r_y_y, expected 1.0, is %f", - check_msg->cov_r_y_y); - ck_assert_msg((check_msg->cov_r_y_z * 100 - 0.0 * 100) < 0.05, - "incorrect value for cov_r_y_z, expected 0.0, is %f", - check_msg->cov_r_y_z); - ck_assert_msg((check_msg->cov_r_z_z * 100 - 1.0 * 100) < 0.05, - "incorrect value for cov_r_z_z, expected 1.0, is %f", - check_msg->cov_r_z_z); - ck_assert_msg(check_msg->flags == 5, - "incorrect value for flags, expected 5, is %d", - check_msg->flags); - ck_assert_msg(check_msg->sensor_id == 0, - "incorrect value for sensor_id, expected 0, is %d", - check_msg->sensor_id); - ck_assert_msg(check_msg->timestamp_1 == 1110, - "incorrect value for timestamp_1, expected 1110, is %d", - check_msg->timestamp_1); - ck_assert_msg(check_msg->timestamp_2 == 2220, - "incorrect value for timestamp_2, expected 2220, is %d", - check_msg->timestamp_2); - ck_assert_msg(check_msg->tow == 1110, - "incorrect value for tow, expected 1110, is %d", - check_msg->tow); - ck_assert_msg(check_msg->trans[0] == 1100, - "incorrect value for trans[0], expected 1100, is %d", - check_msg->trans[0]); - ck_assert_msg(check_msg->trans[1] == 550, - "incorrect value for trans[1], expected 550, is %d", - check_msg->trans[1]); - ck_assert_msg(check_msg->trans[2] == 100, - "incorrect value for trans[2], expected 100, is %d", - check_msg->trans[2]); - ck_assert_msg(check_msg->w == -859307164, - "incorrect value for w, expected -859307164, is %d", - check_msg->w); - ck_assert_msg(check_msg->x == -6444804, - "incorrect value for x, expected -6444804, is %d", - check_msg->x); - ck_assert_msg(check_msg->y == -1866844813, - "incorrect value for y, expected -1866844813, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 622997694, - "incorrect value for z, expected 622997694, is %d", - check_msg->z); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgPoseRelative_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgPoseRelative"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgPoseRelative"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgPoseRelative); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgProtectionLevel.c b/c/test/legacy/auto_check_sbp_navigation_MsgProtectionLevel.c deleted file mode 100644 index 3913afb32d..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgProtectionLevel.c +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgProtectionLevel.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgProtectionLevel) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x217, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x217, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 23, 2, 45, 3, 76, 110, 84, 4, 242, 46, 51, 53, 160, - 89, 84, 167, 41, 57, 21, 217, 244, 61, 161, 83, 104, 140, 137, - 90, 246, 51, 51, 51, 51, 51, 170, 180, 64, 154, 153, 153, 153, - 25, 88, 195, 64, 51, 51, 51, 51, 51, 195, 121, 64, 231, 251, - 38, 221, 208, 183, 167, 80, 223, 26, 97, 164, 45, 46, 186, 60, - 235, 227, 183, 160, 187, 93, 116, 224, 105, 40, 32, 33, 133, 188, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_protection_level_t *test_msg = - (msg_protection_level_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->atpl = 10663; - test_msg->ctpl = 5433; - test_msg->flags = 555755625; - test_msg->heading = -529244741; - test_msg->height = 412.2; - test_msg->hopl = 26707; - test_msg->hpl = 41013; - test_msg->hvpl = 62681; - test_msg->lat = 5290.2; - test_msg->lon = 9904.2; - test_msg->pitch = -1598561301; - test_msg->popl = 35212; - test_msg->roll = 1018834477; - test_msg->ropl = 63066; - test_msg->tow = 4060370030; - test_msg->v_x = -584647705; - test_msg->v_y = 1353168848; - test_msg->v_z = -1537140001; - test_msg->vpl = 21593; - test_msg->vvpl = 41277; - test_msg->wn = 13102; - sbp_payload_send(&sbp_state, 0x217, 813, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 813, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 813, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x217, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_protection_level_t *check_msg = - (msg_protection_level_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->atpl == 10663, - "incorrect value for atpl, expected 10663, is %d", - check_msg->atpl); - ck_assert_msg(check_msg->ctpl == 5433, - "incorrect value for ctpl, expected 5433, is %d", - check_msg->ctpl); - ck_assert_msg(check_msg->flags == 555755625, - "incorrect value for flags, expected 555755625, is %d", - check_msg->flags); - ck_assert_msg(check_msg->heading == -529244741, - "incorrect value for heading, expected -529244741, is %d", - check_msg->heading); - ck_assert_msg((check_msg->height * 100 - 412.2 * 100) < 0.05, - "incorrect value for height, expected 412.2, is %f", - check_msg->height); - ck_assert_msg(check_msg->hopl == 26707, - "incorrect value for hopl, expected 26707, is %d", - check_msg->hopl); - ck_assert_msg(check_msg->hpl == 41013, - "incorrect value for hpl, expected 41013, is %d", - check_msg->hpl); - ck_assert_msg(check_msg->hvpl == 62681, - "incorrect value for hvpl, expected 62681, is %d", - check_msg->hvpl); - ck_assert_msg((check_msg->lat * 100 - 5290.2 * 100) < 0.05, - "incorrect value for lat, expected 5290.2, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - 9904.2 * 100) < 0.05, - "incorrect value for lon, expected 9904.2, is %f", - check_msg->lon); - ck_assert_msg(check_msg->pitch == -1598561301, - "incorrect value for pitch, expected -1598561301, is %d", - check_msg->pitch); - ck_assert_msg(check_msg->popl == 35212, - "incorrect value for popl, expected 35212, is %d", - check_msg->popl); - ck_assert_msg(check_msg->roll == 1018834477, - "incorrect value for roll, expected 1018834477, is %d", - check_msg->roll); - ck_assert_msg(check_msg->ropl == 63066, - "incorrect value for ropl, expected 63066, is %d", - check_msg->ropl); - ck_assert_msg(check_msg->tow == 4060370030, - "incorrect value for tow, expected 4060370030, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_x == -584647705, - "incorrect value for v_x, expected -584647705, is %d", - check_msg->v_x); - ck_assert_msg(check_msg->v_y == 1353168848, - "incorrect value for v_y, expected 1353168848, is %d", - check_msg->v_y); - ck_assert_msg(check_msg->v_z == -1537140001, - "incorrect value for v_z, expected -1537140001, is %d", - check_msg->v_z); - ck_assert_msg(check_msg->vpl == 21593, - "incorrect value for vpl, expected 21593, is %d", - check_msg->vpl); - ck_assert_msg(check_msg->vvpl == 41277, - "incorrect value for vvpl, expected 41277, is %d", - check_msg->vvpl); - ck_assert_msg(check_msg->wn == 13102, - "incorrect value for wn, expected 13102, is %d", - check_msg->wn); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgProtectionLevel_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgProtectionLevel"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgProtectionLevel"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_navigation_MsgProtectionLevel); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgProtectionLevelDepA.c b/c/test/legacy/auto_check_sbp_navigation_MsgProtectionLevelDepA.c deleted file mode 100644 index f7c4d57c4d..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgProtectionLevelDepA.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgProtectionLevelDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgProtectionLevelDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x216, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x216, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 22, 2, 148, 22, 33, 52, 126, 69, 185, 47, 85, 4, 139, - 51, 51, 51, 51, 51, 244, 190, 64, 102, 102, 102, 102, 102, 204, - 168, 64, 154, 153, 153, 153, 25, 39, 192, 64, 248, 81, 104, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_protection_level_dep_a_t *test_msg = - (msg_protection_level_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 248; - test_msg->height = 8270.2; - test_msg->hpl = 35588; - test_msg->lat = 7924.2; - test_msg->lon = 3174.2; - test_msg->tow = 3108339252; - test_msg->vpl = 21807; - sbp_payload_send(&sbp_state, 0x216, 5780, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 5780, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 5780, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x216, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_protection_level_dep_a_t *check_msg = - (msg_protection_level_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 248, - "incorrect value for flags, expected 248, is %d", - check_msg->flags); - ck_assert_msg((check_msg->height * 100 - 8270.2 * 100) < 0.05, - "incorrect value for height, expected 8270.2, is %f", - check_msg->height); - ck_assert_msg(check_msg->hpl == 35588, - "incorrect value for hpl, expected 35588, is %d", - check_msg->hpl); - ck_assert_msg((check_msg->lat * 100 - 7924.2 * 100) < 0.05, - "incorrect value for lat, expected 7924.2, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - 3174.2 * 100) < 0.05, - "incorrect value for lon, expected 3174.2, is %f", - check_msg->lon); - ck_assert_msg(check_msg->tow == 3108339252, - "incorrect value for tow, expected 3108339252, is %d", - check_msg->tow); - ck_assert_msg(check_msg->vpl == 21807, - "incorrect value for vpl, expected 21807, is %d", - check_msg->vpl); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgProtectionLevelDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgProtectionLevelDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_" - "MsgProtectionLevelDepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_navigation_MsgProtectionLevelDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgReferenceFrameParam.c b/c/test/legacy/auto_check_sbp_navigation_MsgReferenceFrameParam.c deleted file mode 100644 index b5c2647e60..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgReferenceFrameParam.c +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgReferenceFrameParam.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgReferenceFrameParam) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 580, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 580, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 68, 2, 66, 0, 124, 1, 102, 111, 111, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 98, 97, 114, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 4, 5, 0, 6, 0, 7, 0, 0, 0, 8, 0, 0, 0, 9, - 0, 0, 0, 10, 0, 0, 0, 11, 0, 0, 0, 12, 0, 0, 0, 13, 0, - 0, 0, 14, 0, 0, 0, 15, 0, 0, 0, 16, 0, 0, 0, 17, 0, 0, - 0, 18, 0, 0, 0, 19, 0, 0, 0, 20, 0, 6, 161, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_reference_frame_param_t *test_msg = - (msg_reference_frame_param_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->delta_X0 = 7; - test_msg->delta_Y0 = 8; - test_msg->delta_Z0 = 9; - test_msg->dot_delta_X0 = 14; - test_msg->dot_delta_Y0 = 15; - test_msg->dot_delta_Z0 = 16; - test_msg->dot_scale = 20; - test_msg->dot_theta_01 = 17; - test_msg->dot_theta_02 = 18; - test_msg->dot_theta_03 = 19; - test_msg->re_t0 = 6; - test_msg->scale = 13; - test_msg->sin = 4; - { - const char assign_string[] = { - (char)102, (char)111, (char)111, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->sn, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->sn) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->ssr_iod = 1; - test_msg->theta_01 = 10; - test_msg->theta_02 = 11; - test_msg->theta_03 = 12; - { - const char assign_string[] = { - (char)98, (char)97, (char)114, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->tn, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->tn) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->utn = 5; - sbp_payload_send(&sbp_state, 580, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 580, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_reference_frame_param_t *check_msg = - (msg_reference_frame_param_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->delta_X0 == 7, - "incorrect value for delta_X0, expected 7, is %d", - check_msg->delta_X0); - ck_assert_msg(check_msg->delta_Y0 == 8, - "incorrect value for delta_Y0, expected 8, is %d", - check_msg->delta_Y0); - ck_assert_msg(check_msg->delta_Z0 == 9, - "incorrect value for delta_Z0, expected 9, is %d", - check_msg->delta_Z0); - ck_assert_msg(check_msg->dot_delta_X0 == 14, - "incorrect value for dot_delta_X0, expected 14, is %d", - check_msg->dot_delta_X0); - ck_assert_msg(check_msg->dot_delta_Y0 == 15, - "incorrect value for dot_delta_Y0, expected 15, is %d", - check_msg->dot_delta_Y0); - ck_assert_msg(check_msg->dot_delta_Z0 == 16, - "incorrect value for dot_delta_Z0, expected 16, is %d", - check_msg->dot_delta_Z0); - ck_assert_msg(check_msg->dot_scale == 20, - "incorrect value for dot_scale, expected 20, is %d", - check_msg->dot_scale); - ck_assert_msg(check_msg->dot_theta_01 == 17, - "incorrect value for dot_theta_01, expected 17, is %d", - check_msg->dot_theta_01); - ck_assert_msg(check_msg->dot_theta_02 == 18, - "incorrect value for dot_theta_02, expected 18, is %d", - check_msg->dot_theta_02); - ck_assert_msg(check_msg->dot_theta_03 == 19, - "incorrect value for dot_theta_03, expected 19, is %d", - check_msg->dot_theta_03); - ck_assert_msg(check_msg->re_t0 == 6, - "incorrect value for re_t0, expected 6, is %d", - check_msg->re_t0); - ck_assert_msg(check_msg->scale == 13, - "incorrect value for scale, expected 13, is %d", - check_msg->scale); - ck_assert_msg(check_msg->sin == 4, - "incorrect value for sin, expected 4, is %d", check_msg->sin); - { - const char check_string[] = { - (char)102, (char)111, (char)111, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->sn, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->sn, expected string '%s', is '%s'", - check_string, check_msg->sn); - } - ck_assert_msg(check_msg->ssr_iod == 1, - "incorrect value for ssr_iod, expected 1, is %d", - check_msg->ssr_iod); - ck_assert_msg(check_msg->theta_01 == 10, - "incorrect value for theta_01, expected 10, is %d", - check_msg->theta_01); - ck_assert_msg(check_msg->theta_02 == 11, - "incorrect value for theta_02, expected 11, is %d", - check_msg->theta_02); - ck_assert_msg(check_msg->theta_03 == 12, - "incorrect value for theta_03, expected 12, is %d", - check_msg->theta_03); - { - const char check_string[] = { - (char)98, (char)97, (char)114, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->tn, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->tn, expected string '%s', is '%s'", - check_string, check_msg->tn); - } - ck_assert_msg(check_msg->utn == 5, - "incorrect value for utn, expected 5, is %d", check_msg->utn); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgReferenceFrameParam_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgReferenceFrameParam"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_" - "MsgReferenceFrameParam"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_navigation_MsgReferenceFrameParam); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgUTCLeapSecond.c b/c/test/legacy/auto_check_sbp_navigation_MsgUTCLeapSecond.c deleted file mode 100644 index 18581a373d..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgUTCLeapSecond.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgUTCLeapSecond.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgUTCLeapSecond) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 570, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 570, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 58, 2, 66, 0, 14, 1, 0, 2, 0, 3, 4, 5, 0, 6, 0, 7, 0, 8, 9, 50, 232, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_utc_leap_second_t *test_msg = (msg_utc_leap_second_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->count_after = 9; - test_msg->count_before = 4; - test_msg->ref_dn = 8; - test_msg->ref_wn = 7; - test_msg->reserved_0 = 1; - test_msg->reserved_1 = 2; - test_msg->reserved_2 = 3; - test_msg->reserved_3 = 5; - test_msg->reserved_4 = 6; - sbp_payload_send(&sbp_state, 570, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 570, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_utc_leap_second_t *check_msg = - (msg_utc_leap_second_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->count_after == 9, - "incorrect value for count_after, expected 9, is %d", - check_msg->count_after); - ck_assert_msg(check_msg->count_before == 4, - "incorrect value for count_before, expected 4, is %d", - check_msg->count_before); - ck_assert_msg(check_msg->ref_dn == 8, - "incorrect value for ref_dn, expected 8, is %d", - check_msg->ref_dn); - ck_assert_msg(check_msg->ref_wn == 7, - "incorrect value for ref_wn, expected 7, is %d", - check_msg->ref_wn); - ck_assert_msg(check_msg->reserved_0 == 1, - "incorrect value for reserved_0, expected 1, is %d", - check_msg->reserved_0); - ck_assert_msg(check_msg->reserved_1 == 2, - "incorrect value for reserved_1, expected 2, is %d", - check_msg->reserved_1); - ck_assert_msg(check_msg->reserved_2 == 3, - "incorrect value for reserved_2, expected 3, is %d", - check_msg->reserved_2); - ck_assert_msg(check_msg->reserved_3 == 5, - "incorrect value for reserved_3, expected 5, is %d", - check_msg->reserved_3); - ck_assert_msg(check_msg->reserved_4 == 6, - "incorrect value for reserved_4, expected 6, is %d", - check_msg->reserved_4); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgUTCLeapSecond_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgUTCLeapSecond"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgUTCLeapSecond"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_navigation_MsgUTCLeapSecond); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgUTCTime.c b/c/test/legacy/auto_check_sbp_navigation_MsgUTCTime.c deleted file mode 100644 index 9b5c575402..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgUTCTime.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgUTCTime.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgUTCTime) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x103, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x103, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 3, 1, 21, 3, 16, 1, 24, 229, 233, 29, 229, - 7, 4, 9, 19, 24, 9, 0, 8, 175, 47, 199, 253, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_utc_time_t *test_msg = (msg_utc_time_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->day = 9; - test_msg->flags = 1; - test_msg->hours = 19; - test_msg->minutes = 24; - test_msg->month = 4; - test_msg->ns = 800000000; - test_msg->seconds = 9; - test_msg->tow = 501867800; - test_msg->year = 2021; - sbp_payload_send(&sbp_state, 0x103, 789, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 789, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 789, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x103, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_utc_time_t *check_msg = (msg_utc_time_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->day == 9, - "incorrect value for day, expected 9, is %d", check_msg->day); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->hours == 19, - "incorrect value for hours, expected 19, is %d", - check_msg->hours); - ck_assert_msg(check_msg->minutes == 24, - "incorrect value for minutes, expected 24, is %d", - check_msg->minutes); - ck_assert_msg(check_msg->month == 4, - "incorrect value for month, expected 4, is %d", - check_msg->month); - ck_assert_msg(check_msg->ns == 800000000, - "incorrect value for ns, expected 800000000, is %d", - check_msg->ns); - ck_assert_msg(check_msg->seconds == 9, - "incorrect value for seconds, expected 9, is %d", - check_msg->seconds); - ck_assert_msg(check_msg->tow == 501867800, - "incorrect value for tow, expected 501867800, is %d", - check_msg->tow); - ck_assert_msg(check_msg->year == 2021, - "incorrect value for year, expected 2021, is %d", - check_msg->year); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgUTCTime_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_navigation_MsgUTCTime"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgUTCTime"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgUTCTime); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgUTCTimeGNSS.c b/c/test/legacy/auto_check_sbp_navigation_MsgUTCTimeGNSS.c deleted file mode 100644 index 938a3b758a..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgUTCTimeGNSS.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgUTCTimeGNSS.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgUTCTimeGNSS) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x105, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x105, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 5, 1, 21, 3, 16, 1, 24, 229, 233, 29, 229, - 7, 4, 9, 19, 24, 9, 0, 8, 175, 47, 177, 33, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_utc_time_gnss_t *test_msg = (msg_utc_time_gnss_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->day = 9; - test_msg->flags = 1; - test_msg->hours = 19; - test_msg->minutes = 24; - test_msg->month = 4; - test_msg->ns = 800000000; - test_msg->seconds = 9; - test_msg->tow = 501867800; - test_msg->year = 2021; - sbp_payload_send(&sbp_state, 0x105, 789, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 789, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 789, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x105, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_utc_time_gnss_t *check_msg = - (msg_utc_time_gnss_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->day == 9, - "incorrect value for day, expected 9, is %d", check_msg->day); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->hours == 19, - "incorrect value for hours, expected 19, is %d", - check_msg->hours); - ck_assert_msg(check_msg->minutes == 24, - "incorrect value for minutes, expected 24, is %d", - check_msg->minutes); - ck_assert_msg(check_msg->month == 4, - "incorrect value for month, expected 4, is %d", - check_msg->month); - ck_assert_msg(check_msg->ns == 800000000, - "incorrect value for ns, expected 800000000, is %d", - check_msg->ns); - ck_assert_msg(check_msg->seconds == 9, - "incorrect value for seconds, expected 9, is %d", - check_msg->seconds); - ck_assert_msg(check_msg->tow == 501867800, - "incorrect value for tow, expected 501867800, is %d", - check_msg->tow); - ck_assert_msg(check_msg->year == 2021, - "incorrect value for year, expected 2021, is %d", - check_msg->year); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgUTCTimeGNSS_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgUTCTimeGNSS"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgUTCTimeGNSS"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgUTCTimeGNSS); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgVelBody.c b/c/test/legacy/auto_check_sbp_navigation_MsgVelBody.c deleted file mode 100644 index 51c68582ed..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgVelBody.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelBody.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgVelBody) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x213, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x213, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 19, 2, 66, 0, 42, 1, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 64, 0, 0, 224, 64, - 0, 0, 224, 64, 0, 0, 64, 64, 0, 0, 0, 64, 3, 8, 120, 144, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_body_t *test_msg = (msg_vel_body_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cov_x_x = 0.0; - test_msg->cov_x_y = 5.0; - test_msg->cov_x_z = 7.0; - test_msg->cov_y_y = 7.0; - test_msg->cov_y_z = 3.0; - test_msg->cov_z_z = 2.0; - test_msg->flags = 8; - test_msg->n_sats = 3; - test_msg->tow = 1; - test_msg->x = 4; - test_msg->y = 2; - test_msg->z = 1; - sbp_payload_send(&sbp_state, 0x213, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x213, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_body_t *check_msg = (msg_vel_body_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cov_x_x * 100 - 0.0 * 100) < 0.05, - "incorrect value for cov_x_x, expected 0.0, is %f", - check_msg->cov_x_x); - ck_assert_msg((check_msg->cov_x_y * 100 - 5.0 * 100) < 0.05, - "incorrect value for cov_x_y, expected 5.0, is %f", - check_msg->cov_x_y); - ck_assert_msg((check_msg->cov_x_z * 100 - 7.0 * 100) < 0.05, - "incorrect value for cov_x_z, expected 7.0, is %f", - check_msg->cov_x_z); - ck_assert_msg((check_msg->cov_y_y * 100 - 7.0 * 100) < 0.05, - "incorrect value for cov_y_y, expected 7.0, is %f", - check_msg->cov_y_y); - ck_assert_msg((check_msg->cov_y_z * 100 - 3.0 * 100) < 0.05, - "incorrect value for cov_y_z, expected 3.0, is %f", - check_msg->cov_y_z); - ck_assert_msg((check_msg->cov_z_z * 100 - 2.0 * 100) < 0.05, - "incorrect value for cov_z_z, expected 2.0, is %f", - check_msg->cov_z_z); - ck_assert_msg(check_msg->flags == 8, - "incorrect value for flags, expected 8, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 3, - "incorrect value for n_sats, expected 3, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 1, - "incorrect value for tow, expected 1, is %d", check_msg->tow); - ck_assert_msg(check_msg->x == 4, "incorrect value for x, expected 4, is %d", - check_msg->x); - ck_assert_msg(check_msg->y == 2, "incorrect value for y, expected 2, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 1, "incorrect value for z, expected 1, is %d", - check_msg->z); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgVelBody_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_navigation_MsgVelBody"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgVelBody"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgVelBody); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgVelCog.c b/c/test/legacy/auto_check_sbp_navigation_MsgVelCog.c deleted file mode 100644 index f110d1fe67..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgVelCog.c +++ /dev/null @@ -1,476 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelCog.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgVelCog) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x21C, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x21C, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 28, 2, 211, 136, 30, 48, 246, 122, 19, 232, 3, 0, - 0, 208, 7, 0, 0, 184, 11, 0, 0, 160, 15, 0, 0, - 136, 19, 0, 0, 112, 23, 0, 0, 62, 0, 212, 193, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_cog_t* test_msg = (msg_vel_cog_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cog = 1000; - test_msg->cog_accuracy = 4000; - test_msg->flags = 62; - test_msg->sog = 2000; - test_msg->sog_accuracy = 5000; - test_msg->tow = 326825520; - test_msg->v_up = 3000; - test_msg->v_up_accuracy = 6000; - sbp_payload_send(&sbp_state, 0x21C, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x21C, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_cog_t* check_msg = (msg_vel_cog_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cog == 1000, - "incorrect value for cog, expected 1000, is %d", - check_msg->cog); - ck_assert_msg(check_msg->cog_accuracy == 4000, - "incorrect value for cog_accuracy, expected 4000, is %d", - check_msg->cog_accuracy); - ck_assert_msg(check_msg->flags == 62, - "incorrect value for flags, expected 62, is %d", - check_msg->flags); - ck_assert_msg(check_msg->sog == 2000, - "incorrect value for sog, expected 2000, is %d", - check_msg->sog); - ck_assert_msg(check_msg->sog_accuracy == 5000, - "incorrect value for sog_accuracy, expected 5000, is %d", - check_msg->sog_accuracy); - ck_assert_msg(check_msg->tow == 326825520, - "incorrect value for tow, expected 326825520, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_up == 3000, - "incorrect value for v_up, expected 3000, is %d", - check_msg->v_up); - ck_assert_msg(check_msg->v_up_accuracy == 6000, - "incorrect value for v_up_accuracy, expected 6000, is %d", - check_msg->v_up_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x21C, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x21C, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 28, 2, 211, 136, 30, 48, 246, 122, 19, 123, 0, 0, - 0, 200, 1, 0, 0, 24, 252, 255, 255, 0, 149, 186, 10, - 100, 0, 0, 0, 100, 0, 0, 0, 0, 0, 90, 114, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_cog_t* test_msg = (msg_vel_cog_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cog = 123; - test_msg->cog_accuracy = 180000000; - test_msg->flags = 0; - test_msg->sog = 456; - test_msg->sog_accuracy = 100; - test_msg->tow = 326825520; - test_msg->v_up = -1000; - test_msg->v_up_accuracy = 100; - sbp_payload_send(&sbp_state, 0x21C, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x21C, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_cog_t* check_msg = (msg_vel_cog_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cog == 123, - "incorrect value for cog, expected 123, is %d", - check_msg->cog); - ck_assert_msg(check_msg->cog_accuracy == 180000000, - "incorrect value for cog_accuracy, expected 180000000, is %d", - check_msg->cog_accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->sog == 456, - "incorrect value for sog, expected 456, is %d", - check_msg->sog); - ck_assert_msg(check_msg->sog_accuracy == 100, - "incorrect value for sog_accuracy, expected 100, is %d", - check_msg->sog_accuracy); - ck_assert_msg(check_msg->tow == 326825520, - "incorrect value for tow, expected 326825520, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_up == -1000, - "incorrect value for v_up, expected -1000, is %d", - check_msg->v_up); - ck_assert_msg(check_msg->v_up_accuracy == 100, - "incorrect value for v_up_accuracy, expected 100, is %d", - check_msg->v_up_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x21C, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x21C, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 28, 2, 211, 136, 30, 48, 246, 122, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 210, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_cog_t* test_msg = (msg_vel_cog_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cog = 0; - test_msg->cog_accuracy = 0; - test_msg->flags = 0; - test_msg->sog = 0; - test_msg->sog_accuracy = 0; - test_msg->tow = 326825520; - test_msg->v_up = 0; - test_msg->v_up_accuracy = 0; - sbp_payload_send(&sbp_state, 0x21C, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x21C, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_cog_t* check_msg = (msg_vel_cog_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cog == 0, - "incorrect value for cog, expected 0, is %d", check_msg->cog); - ck_assert_msg(check_msg->cog_accuracy == 0, - "incorrect value for cog_accuracy, expected 0, is %d", - check_msg->cog_accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->sog == 0, - "incorrect value for sog, expected 0, is %d", check_msg->sog); - ck_assert_msg(check_msg->sog_accuracy == 0, - "incorrect value for sog_accuracy, expected 0, is %d", - check_msg->sog_accuracy); - ck_assert_msg(check_msg->tow == 326825520, - "incorrect value for tow, expected 326825520, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_up == 0, - "incorrect value for v_up, expected 0, is %d", - check_msg->v_up); - ck_assert_msg(check_msg->v_up_accuracy == 0, - "incorrect value for v_up_accuracy, expected 0, is %d", - check_msg->v_up_accuracy); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_navigation_MsgVelCog_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_navigation_MsgVelCog"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgVelCog"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgVelCog); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgVelECEF.c b/c/test/legacy/auto_check_sbp_navigation_MsgVelECEF.c deleted file mode 100644 index ea76b925ad..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgVelECEF.c +++ /dev/null @@ -1,673 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelECEF.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgVelECEF) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20d, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20d, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 13, 2, 211, 136, 20, 40, 244, 122, 19, 248, 255, 255, 255, - 251, 255, 255, 255, 10, 0, 0, 0, 0, 0, 14, 0, 181, 99, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_t* test_msg = (msg_vel_ecef_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 14; - test_msg->tow = 326825000; - test_msg->x = -8; - test_msg->y = -5; - test_msg->z = 10; - sbp_payload_send(&sbp_state, 0x20d, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20d, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_t* check_msg = (msg_vel_ecef_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 14, - "incorrect value for n_sats, expected 14, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326825000, - "incorrect value for tow, expected 326825000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -8, - "incorrect value for x, expected -8, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -5, - "incorrect value for y, expected -5, is %d", check_msg->y); - ck_assert_msg(check_msg->z == 10, - "incorrect value for z, expected 10, is %d", check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20d, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20d, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 13, 2, 211, 136, 20, 28, 246, 122, 19, 244, 255, 255, 255, - 238, 255, 255, 255, 11, 0, 0, 0, 0, 0, 15, 0, 215, 120, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_t* test_msg = (msg_vel_ecef_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 15; - test_msg->tow = 326825500; - test_msg->x = -12; - test_msg->y = -18; - test_msg->z = 11; - sbp_payload_send(&sbp_state, 0x20d, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20d, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_t* check_msg = (msg_vel_ecef_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326825500, - "incorrect value for tow, expected 326825500, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -12, - "incorrect value for x, expected -12, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -18, - "incorrect value for y, expected -18, is %d", check_msg->y); - ck_assert_msg(check_msg->z == 11, - "incorrect value for z, expected 11, is %d", check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20d, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20d, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 13, 2, 211, 136, 20, 16, 248, 122, 19, 248, 255, 255, 255, - 250, 255, 255, 255, 7, 0, 0, 0, 0, 0, 15, 0, 248, 221, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_t* test_msg = (msg_vel_ecef_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 15; - test_msg->tow = 326826000; - test_msg->x = -8; - test_msg->y = -6; - test_msg->z = 7; - sbp_payload_send(&sbp_state, 0x20d, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20d, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_t* check_msg = (msg_vel_ecef_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326826000, - "incorrect value for tow, expected 326826000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -8, - "incorrect value for x, expected -8, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -6, - "incorrect value for y, expected -6, is %d", check_msg->y); - ck_assert_msg(check_msg->z == 7, "incorrect value for z, expected 7, is %d", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20d, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20d, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 13, 2, 211, 136, 20, 4, 250, 122, 19, 249, 255, 255, 255, - 239, 255, 255, 255, 16, 0, 0, 0, 0, 0, 15, 0, 1, 167, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_t* test_msg = (msg_vel_ecef_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 15; - test_msg->tow = 326826500; - test_msg->x = -7; - test_msg->y = -17; - test_msg->z = 16; - sbp_payload_send(&sbp_state, 0x20d, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20d, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_t* check_msg = (msg_vel_ecef_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326826500, - "incorrect value for tow, expected 326826500, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -7, - "incorrect value for x, expected -7, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -17, - "incorrect value for y, expected -17, is %d", check_msg->y); - ck_assert_msg(check_msg->z == 16, - "incorrect value for z, expected 16, is %d", check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20d, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20d, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 13, 2, 211, 136, 20, 248, 251, 122, 19, 247, 255, 255, 255, - 243, 255, 255, 255, 14, 0, 0, 0, 0, 0, 15, 0, 191, 43, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_t* test_msg = (msg_vel_ecef_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 15; - test_msg->tow = 326827000; - test_msg->x = -9; - test_msg->y = -13; - test_msg->z = 14; - sbp_payload_send(&sbp_state, 0x20d, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20d, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_t* check_msg = (msg_vel_ecef_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326827000, - "incorrect value for tow, expected 326827000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -9, - "incorrect value for x, expected -9, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -13, - "incorrect value for y, expected -13, is %d", check_msg->y); - ck_assert_msg(check_msg->z == 14, - "incorrect value for z, expected 14, is %d", check_msg->z); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_navigation_MsgVelECEF_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_navigation_MsgVelECEF"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgVelECEF"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgVelECEF); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgVelECEFCov.c b/c/test/legacy/auto_check_sbp_navigation_MsgVelECEFCov.c deleted file mode 100644 index 7b34aa24c4..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgVelECEFCov.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelECEFCov.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgVelECEFCov) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x215, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x215, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 21, 2, 66, 0, 42, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 6, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 0, 0, 64, - 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 64, 64, 3, 4, 91, 254, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_cov_t *test_msg = (msg_vel_ecef_cov_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cov_x_x = 2.0; - test_msg->cov_x_y = 2.0; - test_msg->cov_x_z = 2.0; - test_msg->cov_y_y = 2.0; - test_msg->cov_y_z = 1.0; - test_msg->cov_z_z = 3.0; - test_msg->flags = 4; - test_msg->n_sats = 3; - test_msg->tow = 2; - test_msg->x = 0; - test_msg->y = 0; - test_msg->z = 6; - sbp_payload_send(&sbp_state, 0x215, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x215, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_cov_t *check_msg = - (msg_vel_ecef_cov_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cov_x_x * 100 - 2.0 * 100) < 0.05, - "incorrect value for cov_x_x, expected 2.0, is %f", - check_msg->cov_x_x); - ck_assert_msg((check_msg->cov_x_y * 100 - 2.0 * 100) < 0.05, - "incorrect value for cov_x_y, expected 2.0, is %f", - check_msg->cov_x_y); - ck_assert_msg((check_msg->cov_x_z * 100 - 2.0 * 100) < 0.05, - "incorrect value for cov_x_z, expected 2.0, is %f", - check_msg->cov_x_z); - ck_assert_msg((check_msg->cov_y_y * 100 - 2.0 * 100) < 0.05, - "incorrect value for cov_y_y, expected 2.0, is %f", - check_msg->cov_y_y); - ck_assert_msg((check_msg->cov_y_z * 100 - 1.0 * 100) < 0.05, - "incorrect value for cov_y_z, expected 1.0, is %f", - check_msg->cov_y_z); - ck_assert_msg((check_msg->cov_z_z * 100 - 3.0 * 100) < 0.05, - "incorrect value for cov_z_z, expected 3.0, is %f", - check_msg->cov_z_z); - ck_assert_msg(check_msg->flags == 4, - "incorrect value for flags, expected 4, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 3, - "incorrect value for n_sats, expected 3, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2, - "incorrect value for tow, expected 2, is %d", check_msg->tow); - ck_assert_msg(check_msg->x == 0, "incorrect value for x, expected 0, is %d", - check_msg->x); - ck_assert_msg(check_msg->y == 0, "incorrect value for y, expected 0, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 6, "incorrect value for z, expected 6, is %d", - check_msg->z); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgVelECEFCov_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgVelECEFCov"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgVelECEFCov"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgVelECEFCov); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgVelECEFDepA.c b/c/test/legacy/auto_check_sbp_navigation_MsgVelECEFDepA.c deleted file mode 100644 index 29084e8e8e..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgVelECEFDepA.c +++ /dev/null @@ -1,1339 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelECEFDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x204, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x204, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 2, 246, 215, 20, 20, 46, 39, 0, 218, 11, 0, 0, - 134, 245, 255, 255, 163, 252, 255, 255, 0, 0, 9, 0, 80, 236, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_dep_a_t* test_msg = (msg_vel_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 9; - test_msg->tow = 2567700; - test_msg->x = 3034; - test_msg->y = -2682; - test_msg->z = -861; - sbp_payload_send(&sbp_state, 0x204, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x204, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_dep_a_t* check_msg = - (msg_vel_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567700, - "incorrect value for tow, expected 2567700, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == 3034, - "incorrect value for x, expected 3034, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -2682, - "incorrect value for y, expected -2682, is %d", check_msg->y); - ck_assert_msg(check_msg->z == -861, - "incorrect value for z, expected -861, is %d", check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x204, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x204, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 2, 246, 215, 20, 120, 46, 39, 0, 68, 11, 0, 0, - 24, 246, 255, 255, 220, 252, 255, 255, 0, 0, 9, 0, 248, 138, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_dep_a_t* test_msg = (msg_vel_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 9; - test_msg->tow = 2567800; - test_msg->x = 2884; - test_msg->y = -2536; - test_msg->z = -804; - sbp_payload_send(&sbp_state, 0x204, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x204, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_dep_a_t* check_msg = - (msg_vel_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567800, - "incorrect value for tow, expected 2567800, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == 2884, - "incorrect value for x, expected 2884, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -2536, - "incorrect value for y, expected -2536, is %d", check_msg->y); - ck_assert_msg(check_msg->z == -804, - "incorrect value for z, expected -804, is %d", check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x204, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x204, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 2, 246, 215, 20, 220, 46, 39, 0, 21, 11, 0, 0, - 77, 246, 255, 255, 247, 252, 255, 255, 0, 0, 9, 0, 25, 174, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_dep_a_t* test_msg = (msg_vel_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 9; - test_msg->tow = 2567900; - test_msg->x = 2837; - test_msg->y = -2483; - test_msg->z = -777; - sbp_payload_send(&sbp_state, 0x204, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x204, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_dep_a_t* check_msg = - (msg_vel_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567900, - "incorrect value for tow, expected 2567900, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == 2837, - "incorrect value for x, expected 2837, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -2483, - "incorrect value for y, expected -2483, is %d", check_msg->y); - ck_assert_msg(check_msg->z == -777, - "incorrect value for z, expected -777, is %d", check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x204, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x204, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 2, 246, 215, 20, 64, 47, 39, 0, 121, 11, 0, 0, - 2, 246, 255, 255, 234, 252, 255, 255, 0, 0, 9, 0, 195, 228, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_dep_a_t* test_msg = (msg_vel_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 9; - test_msg->tow = 2568000; - test_msg->x = 2937; - test_msg->y = -2558; - test_msg->z = -790; - sbp_payload_send(&sbp_state, 0x204, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x204, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_dep_a_t* check_msg = - (msg_vel_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2568000, - "incorrect value for tow, expected 2568000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == 2937, - "incorrect value for x, expected 2937, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -2558, - "incorrect value for y, expected -2558, is %d", check_msg->y); - ck_assert_msg(check_msg->z == -790, - "incorrect value for z, expected -790, is %d", check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x204, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x204, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 2, 246, 215, 20, 164, 47, 39, 0, 31, 11, 0, 0, - 93, 246, 255, 255, 16, 253, 255, 255, 0, 0, 9, 0, 219, 164, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_dep_a_t* test_msg = (msg_vel_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 9; - test_msg->tow = 2568100; - test_msg->x = 2847; - test_msg->y = -2467; - test_msg->z = -752; - sbp_payload_send(&sbp_state, 0x204, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x204, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_dep_a_t* check_msg = - (msg_vel_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2568100, - "incorrect value for tow, expected 2568100, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == 2847, - "incorrect value for x, expected 2847, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -2467, - "incorrect value for y, expected -2467, is %d", check_msg->y); - ck_assert_msg(check_msg->z == -752, - "incorrect value for z, expected -752, is %d", check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x204, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x204, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 2, 195, 4, 20, 212, 157, 67, 24, 24, 0, 0, 0, - 245, 255, 255, 255, 219, 255, 255, 255, 0, 0, 8, 0, 68, 255, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_dep_a_t* test_msg = (msg_vel_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084500; - test_msg->x = 24; - test_msg->y = -11; - test_msg->z = -37; - sbp_payload_send(&sbp_state, 0x204, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x204, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_dep_a_t* check_msg = - (msg_vel_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084500, - "incorrect value for tow, expected 407084500, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == 24, - "incorrect value for x, expected 24, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -11, - "incorrect value for y, expected -11, is %d", check_msg->y); - ck_assert_msg(check_msg->z == -37, - "incorrect value for z, expected -37, is %d", check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x204, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x204, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 2, 195, 4, 20, 56, 158, 67, 24, 4, 0, 0, 0, - 234, 255, 255, 255, 18, 0, 0, 0, 0, 0, 8, 0, 214, 136, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_dep_a_t* test_msg = (msg_vel_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084600; - test_msg->x = 4; - test_msg->y = -22; - test_msg->z = 18; - sbp_payload_send(&sbp_state, 0x204, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x204, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_dep_a_t* check_msg = - (msg_vel_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084600, - "incorrect value for tow, expected 407084600, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == 4, "incorrect value for x, expected 4, is %d", - check_msg->x); - ck_assert_msg(check_msg->y == -22, - "incorrect value for y, expected -22, is %d", check_msg->y); - ck_assert_msg(check_msg->z == 18, - "incorrect value for z, expected 18, is %d", check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x204, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x204, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 2, 195, 4, 20, 156, 158, 67, 24, 230, 255, 255, 255, - 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 8, 0, 122, 159, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_dep_a_t* test_msg = (msg_vel_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084700; - test_msg->x = -26; - test_msg->y = 4; - test_msg->z = 1; - sbp_payload_send(&sbp_state, 0x204, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x204, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_dep_a_t* check_msg = - (msg_vel_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084700, - "incorrect value for tow, expected 407084700, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -26, - "incorrect value for x, expected -26, is %d", check_msg->x); - ck_assert_msg(check_msg->y == 4, "incorrect value for y, expected 4, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 1, "incorrect value for z, expected 1, is %d", - check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x204, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x204, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 2, 195, 4, 20, 0, 159, 67, 24, 247, 255, 255, 255, - 237, 255, 255, 255, 28, 0, 0, 0, 0, 0, 8, 0, 232, 146, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_dep_a_t* test_msg = (msg_vel_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084800; - test_msg->x = -9; - test_msg->y = -19; - test_msg->z = 28; - sbp_payload_send(&sbp_state, 0x204, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x204, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_dep_a_t* check_msg = - (msg_vel_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084800, - "incorrect value for tow, expected 407084800, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -9, - "incorrect value for x, expected -9, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -19, - "incorrect value for y, expected -19, is %d", check_msg->y); - ck_assert_msg(check_msg->z == 28, - "incorrect value for z, expected 28, is %d", check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x204, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x204, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 2, 195, 4, 20, 100, 159, 67, 24, 255, 255, 255, 255, - 2, 0, 0, 0, 245, 255, 255, 255, 0, 0, 8, 0, 171, 238, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_dep_a_t* test_msg = (msg_vel_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084900; - test_msg->x = -1; - test_msg->y = 2; - test_msg->z = -11; - sbp_payload_send(&sbp_state, 0x204, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x204, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_dep_a_t* check_msg = - (msg_vel_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084900, - "incorrect value for tow, expected 407084900, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -1, - "incorrect value for x, expected -1, is %d", check_msg->x); - ck_assert_msg(check_msg->y == 2, "incorrect value for y, expected 2, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == -11, - "incorrect value for z, expected -11, is %d", check_msg->z); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x204, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x204, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 2, 195, 4, 20, 46, 162, 68, 24, 207, 255, 255, 255, - 185, 255, 255, 255, 65, 0, 0, 0, 0, 0, 5, 0, 82, 154, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_dep_a_t* test_msg = (msg_vel_ecef_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 5; - test_msg->tow = 407151150; - test_msg->x = -49; - test_msg->y = -71; - test_msg->z = 65; - sbp_payload_send(&sbp_state, 0x204, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x204, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_dep_a_t* check_msg = - (msg_vel_ecef_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 0, - "incorrect value for accuracy, expected 0, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 5, - "incorrect value for n_sats, expected 5, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407151150, - "incorrect value for tow, expected 407151150, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -49, - "incorrect value for x, expected -49, is %d", check_msg->x); - ck_assert_msg(check_msg->y == -71, - "incorrect value for y, expected -71, is %d", check_msg->y); - ck_assert_msg(check_msg->z == 65, - "incorrect value for z, expected 65, is %d", check_msg->z); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_navigation_MsgVelECEFDepA_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgVelECEFDepA"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgVelECEFDepA"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgVelEcefCovGnss.c b/c/test/legacy/auto_check_sbp_navigation_MsgVelEcefCovGnss.c deleted file mode 100644 index 7643874d4b..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgVelEcefCovGnss.c +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelEcefCovGnss.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgVelEcefCovGnss) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x235, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x235, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 53, 2, 0, 16, 42, 224, 229, 233, 29, 253, 255, 255, - 255, 1, 0, 0, 0, 4, 0, 0, 0, 46, 224, 32, 59, - 32, 214, 14, 59, 150, 147, 220, 186, 19, 63, 138, 59, 26, - 150, 35, 187, 11, 193, 119, 59, 21, 2, 22, 230, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_cov_gnss_t *test_msg = - (msg_vel_ecef_cov_gnss_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cov_x_x = 0.0024547684006392956; - test_msg->cov_x_y = 0.0021795108914375305; - test_msg->cov_x_z = -0.0016828652005642653; - test_msg->cov_y_y = 0.004218944814056158; - test_msg->cov_y_z = -0.0024961293675005436; - test_msg->cov_z_z = 0.0037804271560162306; - test_msg->flags = 2; - test_msg->n_sats = 21; - test_msg->tow = 501868000; - test_msg->x = -3; - test_msg->y = 1; - test_msg->z = 4; - sbp_payload_send(&sbp_state, 0x235, 4096, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 4096, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 4096, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x235, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_cov_gnss_t *check_msg = - (msg_vel_ecef_cov_gnss_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->cov_x_x * 100 - 0.00245476840064 * 100) < 0.05, - "incorrect value for cov_x_x, expected 0.00245476840064, is %f", - check_msg->cov_x_x); - ck_assert_msg( - (check_msg->cov_x_y * 100 - 0.00217951089144 * 100) < 0.05, - "incorrect value for cov_x_y, expected 0.00217951089144, is %f", - check_msg->cov_x_y); - ck_assert_msg( - (check_msg->cov_x_z * 100 - -0.00168286520056 * 100) < 0.05, - "incorrect value for cov_x_z, expected -0.00168286520056, is %f", - check_msg->cov_x_z); - ck_assert_msg( - (check_msg->cov_y_y * 100 - 0.00421894481406 * 100) < 0.05, - "incorrect value for cov_y_y, expected 0.00421894481406, is %f", - check_msg->cov_y_y); - ck_assert_msg( - (check_msg->cov_y_z * 100 - -0.0024961293675 * 100) < 0.05, - "incorrect value for cov_y_z, expected -0.0024961293675, is %f", - check_msg->cov_y_z); - ck_assert_msg( - (check_msg->cov_z_z * 100 - 0.00378042715602 * 100) < 0.05, - "incorrect value for cov_z_z, expected 0.00378042715602, is %f", - check_msg->cov_z_z); - ck_assert_msg(check_msg->flags == 2, - "incorrect value for flags, expected 2, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 21, - "incorrect value for n_sats, expected 21, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 501868000, - "incorrect value for tow, expected 501868000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -3, - "incorrect value for x, expected -3, is %d", check_msg->x); - ck_assert_msg(check_msg->y == 1, "incorrect value for y, expected 1, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 4, "incorrect value for z, expected 4, is %d", - check_msg->z); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgVelEcefCovGnss_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgVelEcefCovGnss"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgVelEcefCovGnss"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_navigation_MsgVelEcefCovGnss); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgVelEcefGnss.c b/c/test/legacy/auto_check_sbp_navigation_MsgVelEcefGnss.c deleted file mode 100644 index fb932ca054..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgVelEcefGnss.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelEcefGnss.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgVelEcefGnss) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x22d, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x22d, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 45, 2, 0, 16, 20, 224, 229, 233, 29, 253, 255, 255, 255, - 1, 0, 0, 0, 4, 0, 0, 0, 89, 0, 21, 2, 205, 16, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ecef_gnss_t *test_msg = (msg_vel_ecef_gnss_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->accuracy = 89; - test_msg->flags = 2; - test_msg->n_sats = 21; - test_msg->tow = 501868000; - test_msg->x = -3; - test_msg->y = 1; - test_msg->z = 4; - sbp_payload_send(&sbp_state, 0x22d, 4096, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 4096, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 4096, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x22d, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ecef_gnss_t *check_msg = - (msg_vel_ecef_gnss_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->accuracy == 89, - "incorrect value for accuracy, expected 89, is %d", - check_msg->accuracy); - ck_assert_msg(check_msg->flags == 2, - "incorrect value for flags, expected 2, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_sats == 21, - "incorrect value for n_sats, expected 21, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 501868000, - "incorrect value for tow, expected 501868000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->x == -3, - "incorrect value for x, expected -3, is %d", check_msg->x); - ck_assert_msg(check_msg->y == 1, "incorrect value for y, expected 1, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 4, "incorrect value for z, expected 4, is %d", - check_msg->z); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgVelEcefGnss_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgVelEcefGnss"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgVelEcefGnss"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgVelEcefGnss); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgVelNED.c b/c/test/legacy/auto_check_sbp_navigation_MsgVelNED.c deleted file mode 100644 index bdb0b403d5..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgVelNED.c +++ /dev/null @@ -1,694 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelNED.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgVelNED) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20e, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20e, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 14, 2, 211, 136, 22, 40, 244, 122, 19, 3, 0, 0, 0, 252, - 255, 255, 255, 243, 255, 255, 255, 0, 0, 0, 0, 14, 0, 86, 209, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_t* test_msg = (msg_vel_ned_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = -13; - test_msg->e = -4; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 3; - test_msg->n_sats = 14; - test_msg->tow = 326825000; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x20e, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20e, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_t* check_msg = (msg_vel_ned_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == -13, - "incorrect value for d, expected -13, is %d", check_msg->d); - ck_assert_msg(check_msg->e == -4, - "incorrect value for e, expected -4, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == 3, "incorrect value for n, expected 3, is %d", - check_msg->n); - ck_assert_msg(check_msg->n_sats == 14, - "incorrect value for n_sats, expected 14, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326825000, - "incorrect value for tow, expected 326825000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20e, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20e, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 14, 2, 211, 136, 22, 28, 246, 122, 19, - 252, 255, 255, 255, 255, 255, 255, 255, 232, 255, - 255, 255, 0, 0, 0, 0, 15, 0, 16, 228, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_t* test_msg = (msg_vel_ned_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = -24; - test_msg->e = -1; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -4; - test_msg->n_sats = 15; - test_msg->tow = 326825500; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x20e, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20e, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_t* check_msg = (msg_vel_ned_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == -24, - "incorrect value for d, expected -24, is %d", check_msg->d); - ck_assert_msg(check_msg->e == -1, - "incorrect value for e, expected -1, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -4, - "incorrect value for n, expected -4, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326825500, - "incorrect value for tow, expected 326825500, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20e, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20e, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 14, 2, 211, 136, 22, 16, 248, 122, 19, 0, 0, 0, 0, 253, - 255, 255, 255, 244, 255, 255, 255, 0, 0, 0, 0, 15, 0, 11, 164, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_t* test_msg = (msg_vel_ned_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = -12; - test_msg->e = -3; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 0; - test_msg->n_sats = 15; - test_msg->tow = 326826000; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x20e, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20e, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_t* check_msg = (msg_vel_ned_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == -12, - "incorrect value for d, expected -12, is %d", check_msg->d); - ck_assert_msg(check_msg->e == -3, - "incorrect value for e, expected -3, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == 0, "incorrect value for n, expected 0, is %d", - check_msg->n); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326826000, - "incorrect value for tow, expected 326826000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20e, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20e, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 14, 2, 211, 136, 22, 4, 250, 122, 19, 2, 0, 0, 0, 3, - 0, 0, 0, 232, 255, 255, 255, 0, 0, 0, 0, 15, 0, 152, 208, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_t* test_msg = (msg_vel_ned_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = -24; - test_msg->e = 3; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 2; - test_msg->n_sats = 15; - test_msg->tow = 326826500; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x20e, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20e, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_t* check_msg = (msg_vel_ned_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == -24, - "incorrect value for d, expected -24, is %d", check_msg->d); - ck_assert_msg(check_msg->e == 3, "incorrect value for e, expected 3, is %d", - check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == 2, "incorrect value for n, expected 2, is %d", - check_msg->n); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326826500, - "incorrect value for tow, expected 326826500, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20e, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20e, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 14, 2, 211, 136, 22, 248, 251, 122, 19, 1, 0, 0, 0, 0, - 0, 0, 0, 235, 255, 255, 255, 0, 0, 0, 0, 15, 0, 182, 120, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_t* test_msg = (msg_vel_ned_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = -21; - test_msg->e = 0; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 1; - test_msg->n_sats = 15; - test_msg->tow = 326827000; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x20e, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20e, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_t* check_msg = (msg_vel_ned_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == -21, - "incorrect value for d, expected -21, is %d", check_msg->d); - ck_assert_msg(check_msg->e == 0, "incorrect value for e, expected 0, is %d", - check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == 1, "incorrect value for n, expected 1, is %d", - check_msg->n); - ck_assert_msg(check_msg->n_sats == 15, - "incorrect value for n_sats, expected 15, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 326827000, - "incorrect value for tow, expected 326827000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_navigation_MsgVelNED_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_navigation_MsgVelNED"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgVelNED"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgVelNED); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgVelNEDCOV.c b/c/test/legacy/auto_check_sbp_navigation_MsgVelNEDCOV.c deleted file mode 100644 index f7d0101e06..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgVelNEDCOV.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelNEDCOV.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgVelNEDCOV) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x212, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x212, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 18, 2, 66, 0, 42, 100, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, - 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 10, 0, 88, 205, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_cov_t *test_msg = (msg_vel_ned_cov_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cov_d_d = 1.0; - test_msg->cov_e_d = 1.0; - test_msg->cov_e_e = 1.0; - test_msg->cov_n_d = 1.0; - test_msg->cov_n_e = 1.0; - test_msg->cov_n_n = 1.0; - test_msg->d = 1; - test_msg->e = 1; - test_msg->flags = 0; - test_msg->n = 1; - test_msg->n_sats = 10; - test_msg->tow = 100; - sbp_payload_send(&sbp_state, 0x212, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x212, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_cov_t *check_msg = (msg_vel_ned_cov_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->cov_d_d * 100 - 1.0 * 100) < 0.05, - "incorrect value for cov_d_d, expected 1.0, is %f", - check_msg->cov_d_d); - ck_assert_msg((check_msg->cov_e_d * 100 - 1.0 * 100) < 0.05, - "incorrect value for cov_e_d, expected 1.0, is %f", - check_msg->cov_e_d); - ck_assert_msg((check_msg->cov_e_e * 100 - 1.0 * 100) < 0.05, - "incorrect value for cov_e_e, expected 1.0, is %f", - check_msg->cov_e_e); - ck_assert_msg((check_msg->cov_n_d * 100 - 1.0 * 100) < 0.05, - "incorrect value for cov_n_d, expected 1.0, is %f", - check_msg->cov_n_d); - ck_assert_msg((check_msg->cov_n_e * 100 - 1.0 * 100) < 0.05, - "incorrect value for cov_n_e, expected 1.0, is %f", - check_msg->cov_n_e); - ck_assert_msg((check_msg->cov_n_n * 100 - 1.0 * 100) < 0.05, - "incorrect value for cov_n_n, expected 1.0, is %f", - check_msg->cov_n_n); - ck_assert_msg(check_msg->d == 1, "incorrect value for d, expected 1, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == 1, "incorrect value for e, expected 1, is %d", - check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n == 1, "incorrect value for n, expected 1, is %d", - check_msg->n); - ck_assert_msg(check_msg->n_sats == 10, - "incorrect value for n_sats, expected 10, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 100, - "incorrect value for tow, expected 100, is %d", - check_msg->tow); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgVelNEDCOV_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgVelNEDCOV"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgVelNEDCOV"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgVelNEDCOV); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgVelNEDDepA.c b/c/test/legacy/auto_check_sbp_navigation_MsgVelNEDDepA.c deleted file mode 100644 index 528949fb04..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgVelNEDDepA.c +++ /dev/null @@ -1,1383 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelNEDDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x205, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x205, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 5, 2, 246, 215, 22, 20, 46, 39, 0, 198, 251, 255, 255, 156, - 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 161, 92, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_dep_a_t* test_msg = (msg_vel_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = 3996; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -1082; - test_msg->n_sats = 9; - test_msg->tow = 2567700; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x205, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x205, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_dep_a_t* check_msg = - (msg_vel_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == 0, "incorrect value for d, expected 0, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == 3996, - "incorrect value for e, expected 3996, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -1082, - "incorrect value for n, expected -1082, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567700, - "incorrect value for tow, expected 2567700, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x205, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x205, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 5, 2, 246, 215, 22, 120, 46, 39, 0, 14, 252, 255, 255, 207, - 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 125, 160, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_dep_a_t* test_msg = (msg_vel_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = 3791; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -1010; - test_msg->n_sats = 9; - test_msg->tow = 2567800; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x205, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x205, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_dep_a_t* check_msg = - (msg_vel_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == 0, "incorrect value for d, expected 0, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == 3791, - "incorrect value for e, expected 3791, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -1010, - "incorrect value for n, expected -1010, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567800, - "incorrect value for tow, expected 2567800, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x205, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x205, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 5, 2, 246, 215, 22, 220, 46, 39, 0, 48, 252, 255, 255, 140, - 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 179, 135, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_dep_a_t* test_msg = (msg_vel_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = 3724; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -976; - test_msg->n_sats = 9; - test_msg->tow = 2567900; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x205, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x205, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_dep_a_t* check_msg = - (msg_vel_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == 0, "incorrect value for d, expected 0, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == 3724, - "incorrect value for e, expected 3724, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -976, - "incorrect value for n, expected -976, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2567900, - "incorrect value for tow, expected 2567900, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x205, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x205, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 5, 2, 246, 215, 22, 64, 47, 39, 0, 32, 252, 255, 255, 8, - 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 51, 177, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_dep_a_t* test_msg = (msg_vel_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = 3848; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -992; - test_msg->n_sats = 9; - test_msg->tow = 2568000; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x205, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x205, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_dep_a_t* check_msg = - (msg_vel_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == 0, "incorrect value for d, expected 0, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == 3848, - "incorrect value for e, expected 3848, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -992, - "incorrect value for n, expected -992, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2568000, - "incorrect value for tow, expected 2568000, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x205, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x205, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 5, 2, 246, 215, 22, 164, 47, 39, 0, 80, 252, 255, 255, 140, - 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 23, 0, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_dep_a_t* test_msg = (msg_vel_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = 3724; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -944; - test_msg->n_sats = 9; - test_msg->tow = 2568100; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x205, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x205, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_dep_a_t* check_msg = - (msg_vel_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == 0, "incorrect value for d, expected 0, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == 3724, - "incorrect value for e, expected 3724, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -944, - "incorrect value for n, expected -944, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 9, - "incorrect value for n_sats, expected 9, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 2568100, - "incorrect value for tow, expected 2568100, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x205, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x205, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 5, 2, 195, 4, 22, 212, 157, 67, 24, 229, 255, 255, 255, 26, - 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 8, 0, 132, 25, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_dep_a_t* test_msg = (msg_vel_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = 25; - test_msg->e = 26; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -27; - test_msg->n_sats = 8; - test_msg->tow = 407084500; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x205, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x205, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_dep_a_t* check_msg = - (msg_vel_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == 25, - "incorrect value for d, expected 25, is %d", check_msg->d); - ck_assert_msg(check_msg->e == 26, - "incorrect value for e, expected 26, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -27, - "incorrect value for n, expected -27, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084500, - "incorrect value for tow, expected 407084500, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x205, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x205, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 5, 2, 195, 4, 22, 56, 158, 67, 24, 4, 0, 0, 0, 15, - 0, 0, 0, 232, 255, 255, 255, 0, 0, 0, 0, 8, 0, 42, 14, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_dep_a_t* test_msg = (msg_vel_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = -24; - test_msg->e = 15; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 4; - test_msg->n_sats = 8; - test_msg->tow = 407084600; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x205, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x205, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_dep_a_t* check_msg = - (msg_vel_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == -24, - "incorrect value for d, expected -24, is %d", check_msg->d); - ck_assert_msg(check_msg->e == 15, - "incorrect value for e, expected 15, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == 4, "incorrect value for n, expected 4, is %d", - check_msg->n); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084600, - "incorrect value for tow, expected 407084600, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x205, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x205, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 5, 2, 195, 4, 22, 156, 158, 67, 24, 251, 255, 255, 255, 232, - 255, 255, 255, 247, 255, 255, 255, 0, 0, 0, 0, 8, 0, 218, 148, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_dep_a_t* test_msg = (msg_vel_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = -9; - test_msg->e = -24; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -5; - test_msg->n_sats = 8; - test_msg->tow = 407084700; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x205, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x205, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_dep_a_t* check_msg = - (msg_vel_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == -9, - "incorrect value for d, expected -9, is %d", check_msg->d); - ck_assert_msg(check_msg->e == -24, - "incorrect value for e, expected -24, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -5, - "incorrect value for n, expected -5, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084700, - "incorrect value for tow, expected 407084700, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x205, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x205, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 5, 2, 195, 4, 22, 0, 159, 67, 24, 10, 0, 0, 0, 2, - 0, 0, 0, 222, 255, 255, 255, 0, 0, 0, 0, 8, 0, 148, 16, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_dep_a_t* test_msg = (msg_vel_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = -34; - test_msg->e = 2; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 10; - test_msg->n_sats = 8; - test_msg->tow = 407084800; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x205, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x205, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_dep_a_t* check_msg = - (msg_vel_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == -34, - "incorrect value for d, expected -34, is %d", check_msg->d); - ck_assert_msg(check_msg->e == 2, "incorrect value for e, expected 2, is %d", - check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == 10, - "incorrect value for n, expected 10, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084800, - "incorrect value for tow, expected 407084800, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x205, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x205, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 5, 2, 195, 4, 22, 100, 159, 67, 24, 248, 255, 255, 255, 254, - 255, 255, 255, 7, 0, 0, 0, 0, 0, 0, 0, 8, 0, 255, 236, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_dep_a_t* test_msg = (msg_vel_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = 7; - test_msg->e = -2; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -8; - test_msg->n_sats = 8; - test_msg->tow = 407084900; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x205, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x205, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_dep_a_t* check_msg = - (msg_vel_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == 7, "incorrect value for d, expected 7, is %d", - check_msg->d); - ck_assert_msg(check_msg->e == -2, - "incorrect value for e, expected -2, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -8, - "incorrect value for n, expected -8, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 8, - "incorrect value for n_sats, expected 8, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407084900, - "incorrect value for tow, expected 407084900, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x205, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x205, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 5, 2, 195, 4, 22, 46, 162, 68, 24, 255, 255, 255, 255, 253, - 255, 255, 255, 148, 255, 255, 255, 0, 0, 0, 0, 5, 0, 166, 189, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_dep_a_t* test_msg = (msg_vel_ned_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = -108; - test_msg->e = -3; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -1; - test_msg->n_sats = 5; - test_msg->tow = 407151150; - test_msg->v_accuracy = 0; - sbp_payload_send(&sbp_state, 0x205, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x205, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_dep_a_t* check_msg = - (msg_vel_ned_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == -108, - "incorrect value for d, expected -108, is %d", check_msg->d); - ck_assert_msg(check_msg->e == -3, - "incorrect value for e, expected -3, is %d", check_msg->e); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 0, - "incorrect value for h_accuracy, expected 0, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -1, - "incorrect value for n, expected -1, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 5, - "incorrect value for n_sats, expected 5, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 407151150, - "incorrect value for tow, expected 407151150, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 0, - "incorrect value for v_accuracy, expected 0, is %d", - check_msg->v_accuracy); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_navigation_MsgVelNEDDepA_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgVelNEDDepA"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgVelNEDDepA"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgVelNedCovGnss.c b/c/test/legacy/auto_check_sbp_navigation_MsgVelNedCovGnss.c deleted file mode 100644 index 13d624b5f0..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgVelNedCovGnss.c +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelNedCovGnss.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgVelNedCovGnss) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x232, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x232, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 50, 2, 0, 16, 42, 168, 230, 233, 29, 251, 255, 255, - 255, 0, 0, 0, 0, 246, 255, 255, 255, 15, 58, 207, 58, - 248, 139, 116, 55, 103, 197, 57, 57, 203, 186, 129, 58, 109, - 171, 44, 57, 135, 39, 1, 60, 21, 2, 155, 3, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_cov_gnss_t *test_msg = - (msg_vel_ned_cov_gnss_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cov_d_d = 0.007882959209382534; - test_msg->cov_e_d = 0.00016467059322167188; - test_msg->cov_e_e = 0.0009897587588056922; - test_msg->cov_n_d = 0.00017716512957122177; - test_msg->cov_n_e = 1.457612233934924e-05; - test_msg->cov_n_n = 0.0015810149488970637; - test_msg->d = -10; - test_msg->e = 0; - test_msg->flags = 2; - test_msg->n = -5; - test_msg->n_sats = 21; - test_msg->tow = 501868200; - sbp_payload_send(&sbp_state, 0x232, 4096, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 4096, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 4096, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x232, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_cov_gnss_t *check_msg = - (msg_vel_ned_cov_gnss_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->cov_d_d * 100 - 0.00788295920938 * 100) < 0.05, - "incorrect value for cov_d_d, expected 0.00788295920938, is %f", - check_msg->cov_d_d); - ck_assert_msg( - (check_msg->cov_e_d * 100 - 0.000164670593222 * 100) < 0.05, - "incorrect value for cov_e_d, expected 0.000164670593222, is %f", - check_msg->cov_e_d); - ck_assert_msg( - (check_msg->cov_e_e * 100 - 0.000989758758806 * 100) < 0.05, - "incorrect value for cov_e_e, expected 0.000989758758806, is %f", - check_msg->cov_e_e); - ck_assert_msg( - (check_msg->cov_n_d * 100 - 0.000177165129571 * 100) < 0.05, - "incorrect value for cov_n_d, expected 0.000177165129571, is %f", - check_msg->cov_n_d); - ck_assert_msg( - (check_msg->cov_n_e * 100 - 1.45761223393e-05 * 100) < 0.05, - "incorrect value for cov_n_e, expected 1.45761223393e-05, is %f", - check_msg->cov_n_e); - ck_assert_msg( - (check_msg->cov_n_n * 100 - 0.0015810149489 * 100) < 0.05, - "incorrect value for cov_n_n, expected 0.0015810149489, is %f", - check_msg->cov_n_n); - ck_assert_msg(check_msg->d == -10, - "incorrect value for d, expected -10, is %d", check_msg->d); - ck_assert_msg(check_msg->e == 0, "incorrect value for e, expected 0, is %d", - check_msg->e); - ck_assert_msg(check_msg->flags == 2, - "incorrect value for flags, expected 2, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n == -5, - "incorrect value for n, expected -5, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 21, - "incorrect value for n_sats, expected 21, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 501868200, - "incorrect value for tow, expected 501868200, is %d", - check_msg->tow); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgVelNedCovGnss_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgVelNedCovGnss"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgVelNedCovGnss"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_navigation_MsgVelNedCovGnss); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_navigation_MsgVelNedGnss.c b/c/test/legacy/auto_check_sbp_navigation_MsgVelNedGnss.c deleted file mode 100644 index 77a517e0eb..0000000000 --- a/c/test/legacy/auto_check_sbp_navigation_MsgVelNedGnss.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelNedGnss.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_navigation_MsgVelNedGnss) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x22e, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x22e, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 46, 2, 0, 16, 22, 168, 230, 233, 29, 251, 255, 255, 255, 0, - 0, 0, 0, 246, 255, 255, 255, 40, 0, 89, 0, 21, 2, 99, 171, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_vel_ned_gnss_t *test_msg = (msg_vel_ned_gnss_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->d = -10; - test_msg->e = 0; - test_msg->flags = 2; - test_msg->h_accuracy = 40; - test_msg->n = -5; - test_msg->n_sats = 21; - test_msg->tow = 501868200; - test_msg->v_accuracy = 89; - sbp_payload_send(&sbp_state, 0x22e, 4096, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 4096, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 4096, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x22e, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_vel_ned_gnss_t *check_msg = - (msg_vel_ned_gnss_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->d == -10, - "incorrect value for d, expected -10, is %d", check_msg->d); - ck_assert_msg(check_msg->e == 0, "incorrect value for e, expected 0, is %d", - check_msg->e); - ck_assert_msg(check_msg->flags == 2, - "incorrect value for flags, expected 2, is %d", - check_msg->flags); - ck_assert_msg(check_msg->h_accuracy == 40, - "incorrect value for h_accuracy, expected 40, is %d", - check_msg->h_accuracy); - ck_assert_msg(check_msg->n == -5, - "incorrect value for n, expected -5, is %d", check_msg->n); - ck_assert_msg(check_msg->n_sats == 21, - "incorrect value for n_sats, expected 21, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 501868200, - "incorrect value for tow, expected 501868200, is %d", - check_msg->tow); - ck_assert_msg(check_msg->v_accuracy == 89, - "incorrect value for v_accuracy, expected 89, is %d", - check_msg->v_accuracy); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_navigation_MsgVelNedGnss_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_navigation_MsgVelNedGnss"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_navigation_MsgVelNedGnss"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_navigation_MsgVelNedGnss); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ndb_MsgNdbEvent.c b/c/test/legacy/auto_check_sbp_ndb_MsgNdbEvent.c deleted file mode 100644 index c0d29d2702..0000000000 --- a/c/test/legacy/auto_check_sbp_ndb_MsgNdbEvent.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ndb/test_MsgNdbEvent.yaml by generate.py. Do not -// modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ndb_MsgNdbEvent) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x400, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x400, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 4, 164, 174, 18, 254, 188, 70, 185, 69, 0, 0, - 0, 249, 73, 205, 115, 238, 74, 98, 66, 182, 148, 16, 166, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ndb_event_t *test_msg = (msg_ndb_event_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->data_source = 115; - test_msg->event = 249; - test_msg->object_sid.code = 74; - test_msg->object_sid.sat = 238; - test_msg->object_type = 73; - test_msg->original_sender = 38070; - test_msg->recv_time = 299461164286; - test_msg->result = 205; - test_msg->src_sid.code = 66; - test_msg->src_sid.sat = 98; - sbp_payload_send(&sbp_state, 0x400, 44708, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 44708, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 44708, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x400, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ndb_event_t *check_msg = (msg_ndb_event_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->data_source == 115, - "incorrect value for data_source, expected 115, is %d", - check_msg->data_source); - ck_assert_msg(check_msg->event == 249, - "incorrect value for event, expected 249, is %d", - check_msg->event); - ck_assert_msg(check_msg->object_sid.code == 74, - "incorrect value for object_sid.code, expected 74, is %d", - check_msg->object_sid.code); - ck_assert_msg(check_msg->object_sid.sat == 238, - "incorrect value for object_sid.sat, expected 238, is %d", - check_msg->object_sid.sat); - ck_assert_msg(check_msg->object_type == 73, - "incorrect value for object_type, expected 73, is %d", - check_msg->object_type); - ck_assert_msg(check_msg->original_sender == 38070, - "incorrect value for original_sender, expected 38070, is %d", - check_msg->original_sender); - ck_assert_msg(check_msg->recv_time == 299461164286, - "incorrect value for recv_time, expected 299461164286, is %d", - check_msg->recv_time); - ck_assert_msg(check_msg->result == 205, - "incorrect value for result, expected 205, is %d", - check_msg->result); - ck_assert_msg(check_msg->src_sid.code == 66, - "incorrect value for src_sid.code, expected 66, is %d", - check_msg->src_sid.code); - ck_assert_msg(check_msg->src_sid.sat == 98, - "incorrect value for src_sid.sat, expected 98, is %d", - check_msg->src_sid.sat); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ndb_MsgNdbEvent_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_ndb_MsgNdbEvent"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_ndb_MsgNdbEvent"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_ndb_MsgNdbEvent); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgAlmanacGLO.c b/c/test/legacy/auto_check_sbp_observation_MsgAlmanacGLO.c deleted file mode 100644 index c7665a96c1..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgAlmanacGLO.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgAlmanacGLO.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgAlmanacGLO) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x73, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x73, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 115, 0, 195, 4, 78, 22, 0, 176, 207, 6, 0, 106, - 8, 154, 153, 153, 153, 153, 153, 1, 64, 64, 56, 0, 0, - 1, 0, 142, 41, 5, 235, 95, 135, 150, 191, 0, 0, 0, - 32, 191, 247, 124, 63, 0, 0, 192, 206, 140, 33, 180, 64, - 41, 131, 179, 134, 141, 248, 253, 191, 227, 133, 81, 54, 204, - 30, 67, 190, 216, 59, 199, 39, 96, 168, 239, 191, 71, 11, - 217, 147, 145, 228, 237, 63, 155, 87, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_almanac_glo_t *test_msg = (msg_almanac_glo_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 0; - test_msg->common.sid.sat = 22; - test_msg->common.toa.tow = 446384; - test_msg->common.toa.wn = 2154; - test_msg->common.ura = 2.2; - test_msg->common.valid = 1; - test_msg->epsilon = -0.9893036629599647; - test_msg->i = 5153.550029754639; - test_msg->lambda_na = -0.02200078842114688; - test_msg->omega = 0.9341514480259797; - test_msg->t = -1.8731818448797617; - test_msg->t_dot = -8.903585155774196e-09; - test_msg->t_lambda_na = 0.007072207052260637; - sbp_payload_send(&sbp_state, 0x73, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x73, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_almanac_glo_t *check_msg = (msg_almanac_glo_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - check_msg->common.fit_interval == 14400, - "incorrect value for common.fit_interval, expected 14400, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 0, - "incorrect value for common.sid.code, expected 0, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.sat == 22, - "incorrect value for common.sid.sat, expected 22, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toa.tow == 446384, - "incorrect value for common.toa.tow, expected 446384, is %d", - check_msg->common.toa.tow); - ck_assert_msg(check_msg->common.toa.wn == 2154, - "incorrect value for common.toa.wn, expected 2154, is %d", - check_msg->common.toa.wn); - ck_assert_msg((check_msg->common.ura * 100 - 2.2 * 100) < 0.05, - "incorrect value for common.ura, expected 2.2, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg((check_msg->epsilon * 100 - -0.98930366296 * 100) < 0.05, - "incorrect value for epsilon, expected -0.98930366296, is %f", - check_msg->epsilon); - ck_assert_msg((check_msg->i * 100 - 5153.55002975 * 100) < 0.05, - "incorrect value for i, expected 5153.55002975, is %f", - check_msg->i); - ck_assert_msg( - (check_msg->lambda_na * 100 - -0.0220007884211 * 100) < 0.05, - "incorrect value for lambda_na, expected -0.0220007884211, is %f", - check_msg->lambda_na); - ck_assert_msg((check_msg->omega * 100 - 0.934151448026 * 100) < 0.05, - "incorrect value for omega, expected 0.934151448026, is %f", - check_msg->omega); - ck_assert_msg((check_msg->t * 100 - -1.87318184488 * 100) < 0.05, - "incorrect value for t, expected -1.87318184488, is %f", - check_msg->t); - ck_assert_msg( - (check_msg->t_dot * 100 - -8.90358515577e-09 * 100) < 0.05, - "incorrect value for t_dot, expected -8.90358515577e-09, is %f", - check_msg->t_dot); - ck_assert_msg( - (check_msg->t_lambda_na * 100 - 0.00707220705226 * 100) < 0.05, - "incorrect value for t_lambda_na, expected 0.00707220705226, is %f", - check_msg->t_lambda_na); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgAlmanacGLO_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgAlmanacGLO"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgAlmanacGLO"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_observation_MsgAlmanacGLO); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgAlmanacGLODep.c b/c/test/legacy/auto_check_sbp_observation_MsgAlmanacGLODep.c deleted file mode 100644 index c42f66018e..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgAlmanacGLODep.c +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgAlmanacGLODep.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgAlmanacGLODep) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x71, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x71, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 113, 0, 195, 4, 80, 22, 0, 0, 0, 176, 207, 6, - 0, 106, 8, 154, 153, 153, 153, 153, 153, 1, 64, 64, 56, - 0, 0, 1, 0, 142, 41, 5, 235, 95, 135, 150, 191, 0, - 0, 0, 32, 191, 247, 124, 63, 0, 0, 192, 206, 140, 33, - 180, 64, 41, 131, 179, 134, 141, 248, 253, 191, 227, 133, 81, - 54, 204, 30, 67, 190, 216, 59, 199, 39, 96, 168, 239, 191, - 71, 11, 217, 147, 145, 228, 237, 63, 203, 178, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_almanac_glo_dep_t *test_msg = (msg_almanac_glo_dep_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 0; - test_msg->common.sid.reserved = 0; - test_msg->common.sid.sat = 22; - test_msg->common.toa.tow = 446384; - test_msg->common.toa.wn = 2154; - test_msg->common.ura = 2.2; - test_msg->common.valid = 1; - test_msg->epsilon = -0.9893036629599647; - test_msg->i = 5153.550029754639; - test_msg->lambda_na = -0.02200078842114688; - test_msg->omega = 0.9341514480259797; - test_msg->t = -1.8731818448797617; - test_msg->t_dot = -8.903585155774196e-09; - test_msg->t_lambda_na = 0.007072207052260637; - sbp_payload_send(&sbp_state, 0x71, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x71, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_almanac_glo_dep_t *check_msg = - (msg_almanac_glo_dep_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - check_msg->common.fit_interval == 14400, - "incorrect value for common.fit_interval, expected 14400, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 0, - "incorrect value for common.sid.code, expected 0, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.reserved == 0, - "incorrect value for common.sid.reserved, expected 0, is %d", - check_msg->common.sid.reserved); - ck_assert_msg(check_msg->common.sid.sat == 22, - "incorrect value for common.sid.sat, expected 22, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toa.tow == 446384, - "incorrect value for common.toa.tow, expected 446384, is %d", - check_msg->common.toa.tow); - ck_assert_msg(check_msg->common.toa.wn == 2154, - "incorrect value for common.toa.wn, expected 2154, is %d", - check_msg->common.toa.wn); - ck_assert_msg((check_msg->common.ura * 100 - 2.2 * 100) < 0.05, - "incorrect value for common.ura, expected 2.2, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg((check_msg->epsilon * 100 - -0.98930366296 * 100) < 0.05, - "incorrect value for epsilon, expected -0.98930366296, is %f", - check_msg->epsilon); - ck_assert_msg((check_msg->i * 100 - 5153.55002975 * 100) < 0.05, - "incorrect value for i, expected 5153.55002975, is %f", - check_msg->i); - ck_assert_msg( - (check_msg->lambda_na * 100 - -0.0220007884211 * 100) < 0.05, - "incorrect value for lambda_na, expected -0.0220007884211, is %f", - check_msg->lambda_na); - ck_assert_msg((check_msg->omega * 100 - 0.934151448026 * 100) < 0.05, - "incorrect value for omega, expected 0.934151448026, is %f", - check_msg->omega); - ck_assert_msg((check_msg->t * 100 - -1.87318184488 * 100) < 0.05, - "incorrect value for t, expected -1.87318184488, is %f", - check_msg->t); - ck_assert_msg( - (check_msg->t_dot * 100 - -8.90358515577e-09 * 100) < 0.05, - "incorrect value for t_dot, expected -8.90358515577e-09, is %f", - check_msg->t_dot); - ck_assert_msg( - (check_msg->t_lambda_na * 100 - 0.00707220705226 * 100) < 0.05, - "incorrect value for t_lambda_na, expected 0.00707220705226, is %f", - check_msg->t_lambda_na); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgAlmanacGLODep_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgAlmanacGLODep"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgAlmanacGLODep"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgAlmanacGLODep); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgAlmanacGPS.c b/c/test/legacy/auto_check_sbp_observation_MsgAlmanacGPS.c deleted file mode 100644 index 43ece06c15..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgAlmanacGPS.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgAlmanacGPS.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgAlmanacGPS) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x72, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x72, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 114, 0, 195, 4, 94, 22, 0, 176, 207, 6, 0, 106, - 8, 154, 153, 153, 153, 153, 153, 1, 64, 64, 56, 0, 0, - 1, 0, 142, 41, 5, 235, 95, 135, 150, 191, 0, 0, 0, - 32, 191, 247, 124, 63, 0, 0, 192, 206, 140, 33, 180, 64, - 41, 131, 179, 134, 141, 248, 253, 191, 227, 133, 81, 54, 204, - 30, 67, 190, 216, 59, 199, 39, 96, 168, 239, 191, 71, 11, - 217, 147, 145, 228, 237, 63, 0, 0, 0, 0, 108, 177, 68, - 191, 0, 0, 0, 0, 0, 192, 163, 61, 190, 45, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_almanac_gps_t *test_msg = (msg_almanac_gps_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = -0.0006315018981695175; - test_msg->af1 = 8.981260180007666e-12; - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 0; - test_msg->common.sid.sat = 22; - test_msg->common.toa.tow = 446384; - test_msg->common.toa.wn = 2154; - test_msg->common.ura = 2.2; - test_msg->common.valid = 1; - test_msg->ecc = 0.007072207052260637; - test_msg->inc = 0.9341514480259797; - test_msg->m0 = -0.02200078842114688; - test_msg->omega0 = -1.8731818448797617; - test_msg->omegadot = -8.903585155774196e-09; - test_msg->sqrta = 5153.550029754639; - test_msg->w = -0.9893036629599647; - sbp_payload_send(&sbp_state, 0x72, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x72, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_almanac_gps_t *check_msg = (msg_almanac_gps_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - -0.00063150189817 * 100) < 0.05, - "incorrect value for af0, expected -0.00063150189817, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - 8.98126018001e-12 * 100) < 0.05, - "incorrect value for af1, expected 8.98126018001e-12, is %f", - check_msg->af1); - ck_assert_msg( - check_msg->common.fit_interval == 14400, - "incorrect value for common.fit_interval, expected 14400, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 0, - "incorrect value for common.sid.code, expected 0, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.sat == 22, - "incorrect value for common.sid.sat, expected 22, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toa.tow == 446384, - "incorrect value for common.toa.tow, expected 446384, is %d", - check_msg->common.toa.tow); - ck_assert_msg(check_msg->common.toa.wn == 2154, - "incorrect value for common.toa.wn, expected 2154, is %d", - check_msg->common.toa.wn); - ck_assert_msg((check_msg->common.ura * 100 - 2.2 * 100) < 0.05, - "incorrect value for common.ura, expected 2.2, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg((check_msg->ecc * 100 - 0.00707220705226 * 100) < 0.05, - "incorrect value for ecc, expected 0.00707220705226, is %f", - check_msg->ecc); - ck_assert_msg((check_msg->inc * 100 - 0.934151448026 * 100) < 0.05, - "incorrect value for inc, expected 0.934151448026, is %f", - check_msg->inc); - ck_assert_msg((check_msg->m0 * 100 - -0.0220007884211 * 100) < 0.05, - "incorrect value for m0, expected -0.0220007884211, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - -1.87318184488 * 100) < 0.05, - "incorrect value for omega0, expected -1.87318184488, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -8.90358515577e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -8.90358515577e-09, is %f", - check_msg->omegadot); - ck_assert_msg((check_msg->sqrta * 100 - 5153.55002975 * 100) < 0.05, - "incorrect value for sqrta, expected 5153.55002975, is %f", - check_msg->sqrta); - ck_assert_msg((check_msg->w * 100 - -0.98930366296 * 100) < 0.05, - "incorrect value for w, expected -0.98930366296, is %f", - check_msg->w); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgAlmanacGPS_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgAlmanacGPS"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgAlmanacGPS"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_observation_MsgAlmanacGPS); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgAlmanacGPSDep.c b/c/test/legacy/auto_check_sbp_observation_MsgAlmanacGPSDep.c deleted file mode 100644 index cd613e3623..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgAlmanacGPSDep.c +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgAlmanacGPSDep.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgAlmanacGPSDep) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x70, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x70, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 112, 0, 195, 4, 96, 22, 0, 0, 0, 176, 207, 6, - 0, 106, 8, 154, 153, 153, 153, 153, 153, 1, 64, 64, 56, - 0, 0, 1, 0, 142, 41, 5, 235, 95, 135, 150, 191, 0, - 0, 0, 32, 191, 247, 124, 63, 0, 0, 192, 206, 140, 33, - 180, 64, 41, 131, 179, 134, 141, 248, 253, 191, 227, 133, 81, - 54, 204, 30, 67, 190, 216, 59, 199, 39, 96, 168, 239, 191, - 71, 11, 217, 147, 145, 228, 237, 63, 0, 0, 0, 0, 108, - 177, 68, 191, 0, 0, 0, 0, 0, 192, 163, 61, 144, 232, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_almanac_gps_dep_t *test_msg = (msg_almanac_gps_dep_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = -0.0006315018981695175; - test_msg->af1 = 8.981260180007666e-12; - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 0; - test_msg->common.sid.reserved = 0; - test_msg->common.sid.sat = 22; - test_msg->common.toa.tow = 446384; - test_msg->common.toa.wn = 2154; - test_msg->common.ura = 2.2; - test_msg->common.valid = 1; - test_msg->ecc = 0.007072207052260637; - test_msg->inc = 0.9341514480259797; - test_msg->m0 = -0.02200078842114688; - test_msg->omega0 = -1.8731818448797617; - test_msg->omegadot = -8.903585155774196e-09; - test_msg->sqrta = 5153.550029754639; - test_msg->w = -0.9893036629599647; - sbp_payload_send(&sbp_state, 0x70, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x70, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_almanac_gps_dep_t *check_msg = - (msg_almanac_gps_dep_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - -0.00063150189817 * 100) < 0.05, - "incorrect value for af0, expected -0.00063150189817, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - 8.98126018001e-12 * 100) < 0.05, - "incorrect value for af1, expected 8.98126018001e-12, is %f", - check_msg->af1); - ck_assert_msg( - check_msg->common.fit_interval == 14400, - "incorrect value for common.fit_interval, expected 14400, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 0, - "incorrect value for common.sid.code, expected 0, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.reserved == 0, - "incorrect value for common.sid.reserved, expected 0, is %d", - check_msg->common.sid.reserved); - ck_assert_msg(check_msg->common.sid.sat == 22, - "incorrect value for common.sid.sat, expected 22, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toa.tow == 446384, - "incorrect value for common.toa.tow, expected 446384, is %d", - check_msg->common.toa.tow); - ck_assert_msg(check_msg->common.toa.wn == 2154, - "incorrect value for common.toa.wn, expected 2154, is %d", - check_msg->common.toa.wn); - ck_assert_msg((check_msg->common.ura * 100 - 2.2 * 100) < 0.05, - "incorrect value for common.ura, expected 2.2, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg((check_msg->ecc * 100 - 0.00707220705226 * 100) < 0.05, - "incorrect value for ecc, expected 0.00707220705226, is %f", - check_msg->ecc); - ck_assert_msg((check_msg->inc * 100 - 0.934151448026 * 100) < 0.05, - "incorrect value for inc, expected 0.934151448026, is %f", - check_msg->inc); - ck_assert_msg((check_msg->m0 * 100 - -0.0220007884211 * 100) < 0.05, - "incorrect value for m0, expected -0.0220007884211, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - -1.87318184488 * 100) < 0.05, - "incorrect value for omega0, expected -1.87318184488, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -8.90358515577e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -8.90358515577e-09, is %f", - check_msg->omegadot); - ck_assert_msg((check_msg->sqrta * 100 - 5153.55002975 * 100) < 0.05, - "incorrect value for sqrta, expected 5153.55002975, is %f", - check_msg->sqrta); - ck_assert_msg((check_msg->w * 100 - -0.98930366296 * 100) < 0.05, - "incorrect value for w, expected -0.98930366296, is %f", - check_msg->w); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgAlmanacGPSDep_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgAlmanacGPSDep"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgAlmanacGPSDep"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgAlmanacGPSDep); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgBasePosEcef.c b/c/test/legacy/auto_check_sbp_observation_MsgBasePosEcef.c deleted file mode 100644 index 696b07f85f..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgBasePosEcef.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgBasePosEcef.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgBasePosEcef) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x48, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x48, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 72, 0, 0, 0, 24, 228, 131, 158, 245, 87, - 205, 68, 193, 66, 62, 232, 209, 32, 118, 80, 193, - 213, 231, 106, 251, 63, 20, 77, 65, 194, 125, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_base_pos_ecef_t *test_msg = (msg_base_pos_ecef_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->x = -2726575.9189; - test_msg->y = -4315267.2798; - test_msg->z = 3811455.9642; - sbp_payload_send(&sbp_state, 0x48, 0, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 0, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 0, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x48, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_base_pos_ecef_t *check_msg = - (msg_base_pos_ecef_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->x * 100 - -2726575.9189 * 100) < 0.05, - "incorrect value for x, expected -2726575.9189, is %f", - check_msg->x); - ck_assert_msg((check_msg->y * 100 - -4315267.2798 * 100) < 0.05, - "incorrect value for y, expected -4315267.2798, is %f", - check_msg->y); - ck_assert_msg((check_msg->z * 100 - 3811455.9642 * 100) < 0.05, - "incorrect value for z, expected 3811455.9642, is %f", - check_msg->z); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgBasePosEcef_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgBasePosEcef"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgBasePosEcef"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_observation_MsgBasePosEcef); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgBasePosLLH.c b/c/test/legacy/auto_check_sbp_observation_MsgBasePosLLH.c deleted file mode 100644 index c904891f37..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgBasePosLLH.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgBasePosLLH.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgBasePosLLH) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x44, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x44, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 68, 0, 123, 0, 24, 225, 237, 238, 90, 42, 160, 66, 64, 59, 143, - 70, 235, 0, 120, 94, 192, 51, 181, 124, 240, 65, 248, 66, 64, 82, 230, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_base_pos_llh_t *test_msg = (msg_base_pos_llh_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->height = 37.939512310879216; - test_msg->lat = 37.251292578377395; - test_msg->lon = -121.87505609407974; - sbp_payload_send(&sbp_state, 0x44, 123, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 123, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 123, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x44, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_base_pos_llh_t *check_msg = - (msg_base_pos_llh_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->height * 100 - 37.9395123109 * 100) < 0.05, - "incorrect value for height, expected 37.9395123109, is %f", - check_msg->height); - ck_assert_msg((check_msg->lat * 100 - 37.2512925784 * 100) < 0.05, - "incorrect value for lat, expected 37.2512925784, is %f", - check_msg->lat); - ck_assert_msg((check_msg->lon * 100 - -121.875056094 * 100) < 0.05, - "incorrect value for lon, expected -121.875056094, is %f", - check_msg->lon); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgBasePosLLH_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgBasePosLLH"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgBasePosLLH"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_observation_MsgBasePosLLH); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisBds.c b/c/test/legacy/auto_check_sbp_observation_MsgEphemerisBds.c deleted file mode 100644 index 0d0bc7a7f2..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisBds.c +++ /dev/null @@ -1,357 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisBds.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgEphemerisBds) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x89, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x89, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 137, 0, 128, 240, 147, 8, 12, 174, 179, 6, 0, 106, - 8, 0, 0, 0, 64, 48, 42, 0, 0, 1, 0, 125, 99, - 52, 50, 207, 46, 151, 176, 0, 112, 96, 67, 0, 164, 106, - 67, 0, 60, 255, 54, 0, 224, 47, 53, 0, 0, 143, 179, - 0, 192, 190, 52, 146, 101, 162, 196, 109, 104, 19, 62, 253, - 87, 86, 202, 62, 28, 251, 63, 0, 0, 0, 96, 151, 60, - 117, 63, 0, 0, 128, 154, 127, 93, 185, 64, 151, 193, 64, - 0, 10, 166, 4, 192, 160, 75, 174, 98, 8, 201, 35, 190, - 205, 29, 12, 71, 189, 150, 5, 192, 176, 72, 249, 189, 193, - 172, 240, 63, 72, 249, 188, 180, 160, 203, 9, 62, 0, 0, - 0, 0, 92, 51, 77, 191, 0, 128, 174, 43, 0, 0, 88, - 161, 174, 179, 6, 0, 106, 8, 6, 5, 0, 157, 249, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_bds_t *test_msg = (msg_ephemeris_bds_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = -0.0008911322802305222; - test_msg->af1 = 1.2398970739013748e-12; - test_msg->af2 = -7.318364664277155e-19; - test_msg->c_ic = -6.658956408500671e-08; - test_msg->c_is = 3.5529956221580505e-07; - test_msg->c_rc = 234.640625; - test_msg->c_rs = 224.4375; - test_msg->c_uc = 7.606577128171921e-06; - test_msg->c_us = 6.551854312419891e-07; - test_msg->common.fit_interval = 10800; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 12; - test_msg->common.sid.sat = 8; - test_msg->common.toe.tow = 439214; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 2.0; - test_msg->common.valid = 1; - test_msg->dn = 1.1296899132622133e-09; - test_msg->ecc = 0.005184737499803305; - test_msg->inc = 1.0421769543504915; - test_msg->inc_dot = 7.507455572801683e-10; - test_msg->iodc = 5; - test_msg->iode = 6; - test_msg->m0 = 1.6943958190727237; - test_msg->omega0 = -2.581073762870982; - test_msg->omegadot = -2.303310227830545e-09; - test_msg->sqrta = 6493.49845123291; - test_msg->tgd1 = 1.0499999980595476e-08; - test_msg->tgd2 = -1.0999999799921056e-09; - test_msg->toc.tow = 439214; - test_msg->toc.wn = 2154; - test_msg->w = -2.698603205735458; - sbp_payload_send(&sbp_state, 0x89, 61568, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 61568, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 61568, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x89, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_bds_t *check_msg = - (msg_ephemeris_bds_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - -0.000891132280231 * 100) < 0.05, - "incorrect value for af0, expected -0.000891132280231, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - 1.2398970739e-12 * 100) < 0.05, - "incorrect value for af1, expected 1.2398970739e-12, is %f", - check_msg->af1); - ck_assert_msg((check_msg->af2 * 100 - -7.31836466428e-19 * 100) < 0.05, - "incorrect value for af2, expected -7.31836466428e-19, is %f", - check_msg->af2); - ck_assert_msg((check_msg->c_ic * 100 - -6.6589564085e-08 * 100) < 0.05, - "incorrect value for c_ic, expected -6.6589564085e-08, is %f", - check_msg->c_ic); - ck_assert_msg((check_msg->c_is * 100 - 3.55299562216e-07 * 100) < 0.05, - "incorrect value for c_is, expected 3.55299562216e-07, is %f", - check_msg->c_is); - ck_assert_msg((check_msg->c_rc * 100 - 234.640625 * 100) < 0.05, - "incorrect value for c_rc, expected 234.640625, is %f", - check_msg->c_rc); - ck_assert_msg((check_msg->c_rs * 100 - 224.4375 * 100) < 0.05, - "incorrect value for c_rs, expected 224.4375, is %f", - check_msg->c_rs); - ck_assert_msg((check_msg->c_uc * 100 - 7.60657712817e-06 * 100) < 0.05, - "incorrect value for c_uc, expected 7.60657712817e-06, is %f", - check_msg->c_uc); - ck_assert_msg((check_msg->c_us * 100 - 6.55185431242e-07 * 100) < 0.05, - "incorrect value for c_us, expected 6.55185431242e-07, is %f", - check_msg->c_us); - ck_assert_msg( - check_msg->common.fit_interval == 10800, - "incorrect value for common.fit_interval, expected 10800, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 12, - "incorrect value for common.sid.code, expected 12, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.sat == 8, - "incorrect value for common.sid.sat, expected 8, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toe.tow == 439214, - "incorrect value for common.toe.tow, expected 439214, is %d", - check_msg->common.toe.tow); - ck_assert_msg(check_msg->common.toe.wn == 2154, - "incorrect value for common.toe.wn, expected 2154, is %d", - check_msg->common.toe.wn); - ck_assert_msg((check_msg->common.ura * 100 - 2.0 * 100) < 0.05, - "incorrect value for common.ura, expected 2.0, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg((check_msg->dn * 100 - 1.12968991326e-09 * 100) < 0.05, - "incorrect value for dn, expected 1.12968991326e-09, is %f", - check_msg->dn); - ck_assert_msg((check_msg->ecc * 100 - 0.0051847374998 * 100) < 0.05, - "incorrect value for ecc, expected 0.0051847374998, is %f", - check_msg->ecc); - ck_assert_msg((check_msg->inc * 100 - 1.04217695435 * 100) < 0.05, - "incorrect value for inc, expected 1.04217695435, is %f", - check_msg->inc); - ck_assert_msg( - (check_msg->inc_dot * 100 - 7.5074555728e-10 * 100) < 0.05, - "incorrect value for inc_dot, expected 7.5074555728e-10, is %f", - check_msg->inc_dot); - ck_assert_msg(check_msg->iodc == 5, - "incorrect value for iodc, expected 5, is %d", - check_msg->iodc); - ck_assert_msg(check_msg->iode == 6, - "incorrect value for iode, expected 6, is %d", - check_msg->iode); - ck_assert_msg((check_msg->m0 * 100 - 1.69439581907 * 100) < 0.05, - "incorrect value for m0, expected 1.69439581907, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - -2.58107376287 * 100) < 0.05, - "incorrect value for omega0, expected -2.58107376287, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -2.30331022783e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -2.30331022783e-09, is %f", - check_msg->omegadot); - ck_assert_msg((check_msg->sqrta * 100 - 6493.49845123 * 100) < 0.05, - "incorrect value for sqrta, expected 6493.49845123, is %f", - check_msg->sqrta); - ck_assert_msg((check_msg->tgd1 * 100 - 1.04999999806e-08 * 100) < 0.05, - "incorrect value for tgd1, expected 1.04999999806e-08, is %f", - check_msg->tgd1); - ck_assert_msg( - (check_msg->tgd2 * 100 - -1.09999997999e-09 * 100) < 0.05, - "incorrect value for tgd2, expected -1.09999997999e-09, is %f", - check_msg->tgd2); - ck_assert_msg(check_msg->toc.tow == 439214, - "incorrect value for toc.tow, expected 439214, is %d", - check_msg->toc.tow); - ck_assert_msg(check_msg->toc.wn == 2154, - "incorrect value for toc.wn, expected 2154, is %d", - check_msg->toc.wn); - ck_assert_msg((check_msg->w * 100 - -2.69860320574 * 100) < 0.05, - "incorrect value for w, expected -2.69860320574, is %f", - check_msg->w); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgEphemerisBds_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgEphemerisBds"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgEphemerisBds"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgEphemerisBds); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisDepA.c b/c/test/legacy/auto_check_sbp_observation_MsgEphemerisDepA.c deleted file mode 100644 index ed5afb38d8..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisDepA.c +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgEphemerisDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x1a, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x1a, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 26, 0, 195, 4, 175, 0, 0, 0, 0, 0, 0, 83, 190, - 0, 0, 0, 0, 0, 40, 74, 192, 0, 0, 0, 0, 0, 74, - 115, 64, 0, 0, 0, 0, 0, 4, 199, 190, 0, 0, 0, 0, - 0, 80, 202, 62, 0, 0, 0, 0, 0, 0, 64, 62, 0, 0, - 0, 0, 0, 0, 127, 190, 114, 216, 96, 180, 49, 117, 56, 62, - 142, 41, 5, 235, 95, 135, 150, 191, 0, 0, 0, 32, 191, 247, - 124, 63, 0, 0, 192, 206, 140, 33, 180, 64, 41, 131, 179, 134, - 141, 248, 253, 191, 227, 133, 81, 54, 204, 30, 67, 190, 216, 59, - 199, 39, 96, 168, 239, 191, 71, 11, 217, 147, 145, 228, 237, 63, - 221, 47, 100, 224, 255, 47, 198, 189, 0, 0, 0, 0, 108, 177, - 68, 191, 0, 0, 0, 0, 0, 192, 163, 61, 154, 153, 153, 153, - 153, 153, 201, 63, 205, 204, 204, 204, 192, 62, 27, 65, 106, 8, - 205, 204, 204, 204, 192, 62, 27, 65, 106, 8, 1, 0, 22, 242, - 84, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_dep_a_t *test_msg = (msg_ephemeris_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = -0.0006315018981695175; - test_msg->af1 = 8.981260180007666e-12; - test_msg->af2 = 0.2; - test_msg->c_ic = 7.450580596923828e-09; - test_msg->c_is = -1.1548399925231934e-07; - test_msg->c_rc = 308.625; - test_msg->c_rs = -52.3125; - test_msg->c_uc = -2.7436763048171997e-06; - test_msg->c_us = 3.1366944313049316e-06; - test_msg->dn = 5.694522914022375e-09; - test_msg->ecc = 0.007072207052260637; - test_msg->healthy = 0; - test_msg->inc = 0.9341514480259797; - test_msg->inc_dot = -4.035882396415757e-11; - test_msg->m0 = -0.02200078842114688; - test_msg->omega0 = -1.8731818448797617; - test_msg->omegadot = -8.903585155774196e-09; - test_msg->prn = 22; - test_msg->sqrta = 5153.550029754639; - test_msg->tgd = -1.7695128917694092e-08; - test_msg->toc_tow = 446384.2; - test_msg->toc_wn = 2154; - test_msg->toe_tow = 446384.2; - test_msg->toe_wn = 2154; - test_msg->valid = 1; - test_msg->w = -0.9893036629599647; - sbp_payload_send(&sbp_state, 0x1a, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x1a, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_dep_a_t *check_msg = - (msg_ephemeris_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - -0.00063150189817 * 100) < 0.05, - "incorrect value for af0, expected -0.00063150189817, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - 8.98126018001e-12 * 100) < 0.05, - "incorrect value for af1, expected 8.98126018001e-12, is %f", - check_msg->af1); - ck_assert_msg((check_msg->af2 * 100 - 0.2 * 100) < 0.05, - "incorrect value for af2, expected 0.2, is %f", - check_msg->af2); - ck_assert_msg((check_msg->c_ic * 100 - 7.45058059692e-09 * 100) < 0.05, - "incorrect value for c_ic, expected 7.45058059692e-09, is %f", - check_msg->c_ic); - ck_assert_msg( - (check_msg->c_is * 100 - -1.15483999252e-07 * 100) < 0.05, - "incorrect value for c_is, expected -1.15483999252e-07, is %f", - check_msg->c_is); - ck_assert_msg((check_msg->c_rc * 100 - 308.625 * 100) < 0.05, - "incorrect value for c_rc, expected 308.625, is %f", - check_msg->c_rc); - ck_assert_msg((check_msg->c_rs * 100 - -52.3125 * 100) < 0.05, - "incorrect value for c_rs, expected -52.3125, is %f", - check_msg->c_rs); - ck_assert_msg( - (check_msg->c_uc * 100 - -2.74367630482e-06 * 100) < 0.05, - "incorrect value for c_uc, expected -2.74367630482e-06, is %f", - check_msg->c_uc); - ck_assert_msg((check_msg->c_us * 100 - 3.1366944313e-06 * 100) < 0.05, - "incorrect value for c_us, expected 3.1366944313e-06, is %f", - check_msg->c_us); - ck_assert_msg((check_msg->dn * 100 - 5.69452291402e-09 * 100) < 0.05, - "incorrect value for dn, expected 5.69452291402e-09, is %f", - check_msg->dn); - ck_assert_msg((check_msg->ecc * 100 - 0.00707220705226 * 100) < 0.05, - "incorrect value for ecc, expected 0.00707220705226, is %f", - check_msg->ecc); - ck_assert_msg(check_msg->healthy == 0, - "incorrect value for healthy, expected 0, is %d", - check_msg->healthy); - ck_assert_msg((check_msg->inc * 100 - 0.934151448026 * 100) < 0.05, - "incorrect value for inc, expected 0.934151448026, is %f", - check_msg->inc); - ck_assert_msg( - (check_msg->inc_dot * 100 - -4.03588239642e-11 * 100) < 0.05, - "incorrect value for inc_dot, expected -4.03588239642e-11, is %f", - check_msg->inc_dot); - ck_assert_msg((check_msg->m0 * 100 - -0.0220007884211 * 100) < 0.05, - "incorrect value for m0, expected -0.0220007884211, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - -1.87318184488 * 100) < 0.05, - "incorrect value for omega0, expected -1.87318184488, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -8.90358515577e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -8.90358515577e-09, is %f", - check_msg->omegadot); - ck_assert_msg(check_msg->prn == 22, - "incorrect value for prn, expected 22, is %d", - check_msg->prn); - ck_assert_msg((check_msg->sqrta * 100 - 5153.55002975 * 100) < 0.05, - "incorrect value for sqrta, expected 5153.55002975, is %f", - check_msg->sqrta); - ck_assert_msg((check_msg->tgd * 100 - -1.76951289177e-08 * 100) < 0.05, - "incorrect value for tgd, expected -1.76951289177e-08, is %f", - check_msg->tgd); - ck_assert_msg((check_msg->toc_tow * 100 - 446384.2 * 100) < 0.05, - "incorrect value for toc_tow, expected 446384.2, is %f", - check_msg->toc_tow); - ck_assert_msg(check_msg->toc_wn == 2154, - "incorrect value for toc_wn, expected 2154, is %d", - check_msg->toc_wn); - ck_assert_msg((check_msg->toe_tow * 100 - 446384.2 * 100) < 0.05, - "incorrect value for toe_tow, expected 446384.2, is %f", - check_msg->toe_tow); - ck_assert_msg(check_msg->toe_wn == 2154, - "incorrect value for toe_wn, expected 2154, is %d", - check_msg->toe_wn); - ck_assert_msg(check_msg->valid == 1, - "incorrect value for valid, expected 1, is %d", - check_msg->valid); - ck_assert_msg((check_msg->w * 100 - -0.98930366296 * 100) < 0.05, - "incorrect value for w, expected -0.98930366296, is %f", - check_msg->w); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgEphemerisDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgEphemerisDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgEphemerisDepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgEphemerisDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisDepC.c b/c/test/legacy/auto_check_sbp_observation_MsgEphemerisDepC.c deleted file mode 100644 index 01a3fd26b1..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisDepC.c +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisDepC.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgEphemerisDepC) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x47, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x47, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 71, 0, 195, 4, 185, 0, 0, 0, 0, 0, 0, 83, 190, - 0, 0, 0, 0, 0, 40, 74, 192, 0, 0, 0, 0, 0, 74, - 115, 64, 0, 0, 0, 0, 0, 4, 199, 190, 0, 0, 0, 0, - 0, 80, 202, 62, 0, 0, 0, 0, 0, 0, 64, 62, 0, 0, - 0, 0, 0, 0, 127, 190, 114, 216, 96, 180, 49, 117, 56, 62, - 142, 41, 5, 235, 95, 135, 150, 191, 0, 0, 0, 32, 191, 247, - 124, 63, 0, 0, 192, 206, 140, 33, 180, 64, 41, 131, 179, 134, - 141, 248, 253, 191, 227, 133, 81, 54, 204, 30, 67, 190, 216, 59, - 199, 39, 96, 168, 239, 191, 71, 11, 217, 147, 145, 228, 237, 63, - 221, 47, 100, 224, 255, 47, 198, 189, 0, 0, 0, 0, 108, 177, - 68, 191, 0, 0, 0, 0, 0, 192, 163, 61, 154, 153, 153, 153, - 153, 153, 201, 63, 205, 204, 204, 204, 192, 62, 27, 65, 106, 8, - 205, 204, 204, 204, 192, 62, 27, 65, 106, 8, 1, 0, 22, 0, - 0, 0, 45, 45, 0, 0, 0, 0, 0, 23, 170, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_dep_c_t *test_msg = (msg_ephemeris_dep_c_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = -0.0006315018981695175; - test_msg->af1 = 8.981260180007666e-12; - test_msg->af2 = 0.2; - test_msg->c_ic = 7.450580596923828e-09; - test_msg->c_is = -1.1548399925231934e-07; - test_msg->c_rc = 308.625; - test_msg->c_rs = -52.3125; - test_msg->c_uc = -2.7436763048171997e-06; - test_msg->c_us = 3.1366944313049316e-06; - test_msg->dn = 5.694522914022375e-09; - test_msg->ecc = 0.007072207052260637; - test_msg->healthy = 0; - test_msg->inc = 0.9341514480259797; - test_msg->inc_dot = -4.035882396415757e-11; - test_msg->iodc = 45; - test_msg->iode = 45; - test_msg->m0 = -0.02200078842114688; - test_msg->omega0 = -1.8731818448797617; - test_msg->omegadot = -8.903585155774196e-09; - test_msg->reserved = 0; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 22; - test_msg->sqrta = 5153.550029754639; - test_msg->tgd = -1.7695128917694092e-08; - test_msg->toc_tow = 446384.2; - test_msg->toc_wn = 2154; - test_msg->toe_tow = 446384.2; - test_msg->toe_wn = 2154; - test_msg->valid = 1; - test_msg->w = -0.9893036629599647; - sbp_payload_send(&sbp_state, 0x47, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x47, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_dep_c_t *check_msg = - (msg_ephemeris_dep_c_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - -0.00063150189817 * 100) < 0.05, - "incorrect value for af0, expected -0.00063150189817, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - 8.98126018001e-12 * 100) < 0.05, - "incorrect value for af1, expected 8.98126018001e-12, is %f", - check_msg->af1); - ck_assert_msg((check_msg->af2 * 100 - 0.2 * 100) < 0.05, - "incorrect value for af2, expected 0.2, is %f", - check_msg->af2); - ck_assert_msg((check_msg->c_ic * 100 - 7.45058059692e-09 * 100) < 0.05, - "incorrect value for c_ic, expected 7.45058059692e-09, is %f", - check_msg->c_ic); - ck_assert_msg( - (check_msg->c_is * 100 - -1.15483999252e-07 * 100) < 0.05, - "incorrect value for c_is, expected -1.15483999252e-07, is %f", - check_msg->c_is); - ck_assert_msg((check_msg->c_rc * 100 - 308.625 * 100) < 0.05, - "incorrect value for c_rc, expected 308.625, is %f", - check_msg->c_rc); - ck_assert_msg((check_msg->c_rs * 100 - -52.3125 * 100) < 0.05, - "incorrect value for c_rs, expected -52.3125, is %f", - check_msg->c_rs); - ck_assert_msg( - (check_msg->c_uc * 100 - -2.74367630482e-06 * 100) < 0.05, - "incorrect value for c_uc, expected -2.74367630482e-06, is %f", - check_msg->c_uc); - ck_assert_msg((check_msg->c_us * 100 - 3.1366944313e-06 * 100) < 0.05, - "incorrect value for c_us, expected 3.1366944313e-06, is %f", - check_msg->c_us); - ck_assert_msg((check_msg->dn * 100 - 5.69452291402e-09 * 100) < 0.05, - "incorrect value for dn, expected 5.69452291402e-09, is %f", - check_msg->dn); - ck_assert_msg((check_msg->ecc * 100 - 0.00707220705226 * 100) < 0.05, - "incorrect value for ecc, expected 0.00707220705226, is %f", - check_msg->ecc); - ck_assert_msg(check_msg->healthy == 0, - "incorrect value for healthy, expected 0, is %d", - check_msg->healthy); - ck_assert_msg((check_msg->inc * 100 - 0.934151448026 * 100) < 0.05, - "incorrect value for inc, expected 0.934151448026, is %f", - check_msg->inc); - ck_assert_msg( - (check_msg->inc_dot * 100 - -4.03588239642e-11 * 100) < 0.05, - "incorrect value for inc_dot, expected -4.03588239642e-11, is %f", - check_msg->inc_dot); - ck_assert_msg(check_msg->iodc == 45, - "incorrect value for iodc, expected 45, is %d", - check_msg->iodc); - ck_assert_msg(check_msg->iode == 45, - "incorrect value for iode, expected 45, is %d", - check_msg->iode); - ck_assert_msg((check_msg->m0 * 100 - -0.0220007884211 * 100) < 0.05, - "incorrect value for m0, expected -0.0220007884211, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - -1.87318184488 * 100) < 0.05, - "incorrect value for omega0, expected -1.87318184488, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -8.90358515577e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -8.90358515577e-09, is %f", - check_msg->omegadot); - ck_assert_msg(check_msg->reserved == 0, - "incorrect value for reserved, expected 0, is %d", - check_msg->reserved); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 22, - "incorrect value for sid.sat, expected 22, is %d", - check_msg->sid.sat); - ck_assert_msg((check_msg->sqrta * 100 - 5153.55002975 * 100) < 0.05, - "incorrect value for sqrta, expected 5153.55002975, is %f", - check_msg->sqrta); - ck_assert_msg((check_msg->tgd * 100 - -1.76951289177e-08 * 100) < 0.05, - "incorrect value for tgd, expected -1.76951289177e-08, is %f", - check_msg->tgd); - ck_assert_msg((check_msg->toc_tow * 100 - 446384.2 * 100) < 0.05, - "incorrect value for toc_tow, expected 446384.2, is %f", - check_msg->toc_tow); - ck_assert_msg(check_msg->toc_wn == 2154, - "incorrect value for toc_wn, expected 2154, is %d", - check_msg->toc_wn); - ck_assert_msg((check_msg->toe_tow * 100 - 446384.2 * 100) < 0.05, - "incorrect value for toe_tow, expected 446384.2, is %f", - check_msg->toe_tow); - ck_assert_msg(check_msg->toe_wn == 2154, - "incorrect value for toe_wn, expected 2154, is %d", - check_msg->toe_wn); - ck_assert_msg(check_msg->valid == 1, - "incorrect value for valid, expected 1, is %d", - check_msg->valid); - ck_assert_msg((check_msg->w * 100 - -0.98930366296 * 100) < 0.05, - "incorrect value for w, expected -0.98930366296, is %f", - check_msg->w); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgEphemerisDepC_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgEphemerisDepC"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgEphemerisDepC"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgEphemerisDepC); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisDepD.c b/c/test/legacy/auto_check_sbp_observation_MsgEphemerisDepD.c deleted file mode 100644 index f5900a1237..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisDepD.c +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisDepD.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgEphemerisDepD) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x80, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x80, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 128, 0, 195, 4, 185, 0, 0, 0, 0, 0, 0, 83, 190, - 0, 0, 0, 0, 0, 40, 74, 192, 0, 0, 0, 0, 0, 74, - 115, 64, 0, 0, 0, 0, 0, 4, 199, 190, 0, 0, 0, 0, - 0, 80, 202, 62, 0, 0, 0, 0, 0, 0, 64, 62, 0, 0, - 0, 0, 0, 0, 127, 190, 114, 216, 96, 180, 49, 117, 56, 62, - 142, 41, 5, 235, 95, 135, 150, 191, 0, 0, 0, 32, 191, 247, - 124, 63, 0, 0, 192, 206, 140, 33, 180, 64, 41, 131, 179, 134, - 141, 248, 253, 191, 227, 133, 81, 54, 204, 30, 67, 190, 216, 59, - 199, 39, 96, 168, 239, 191, 71, 11, 217, 147, 145, 228, 237, 63, - 221, 47, 100, 224, 255, 47, 198, 189, 0, 0, 0, 0, 108, 177, - 68, 191, 0, 0, 0, 0, 0, 192, 163, 61, 154, 153, 153, 153, - 153, 153, 201, 63, 205, 204, 204, 204, 192, 62, 27, 65, 106, 8, - 205, 204, 204, 204, 192, 62, 27, 65, 106, 8, 1, 0, 22, 0, - 0, 0, 45, 45, 0, 0, 0, 0, 0, 95, 7, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_dep_d_t *test_msg = (msg_ephemeris_dep_d_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = -0.0006315018981695175; - test_msg->af1 = 8.981260180007666e-12; - test_msg->af2 = 0.2; - test_msg->c_ic = 7.450580596923828e-09; - test_msg->c_is = -1.1548399925231934e-07; - test_msg->c_rc = 308.625; - test_msg->c_rs = -52.3125; - test_msg->c_uc = -2.7436763048171997e-06; - test_msg->c_us = 3.1366944313049316e-06; - test_msg->dn = 5.694522914022375e-09; - test_msg->ecc = 0.007072207052260637; - test_msg->healthy = 0; - test_msg->inc = 0.9341514480259797; - test_msg->inc_dot = -4.035882396415757e-11; - test_msg->iodc = 45; - test_msg->iode = 45; - test_msg->m0 = -0.02200078842114688; - test_msg->omega0 = -1.8731818448797617; - test_msg->omegadot = -8.903585155774196e-09; - test_msg->reserved = 0; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 22; - test_msg->sqrta = 5153.550029754639; - test_msg->tgd = -1.7695128917694092e-08; - test_msg->toc_tow = 446384.2; - test_msg->toc_wn = 2154; - test_msg->toe_tow = 446384.2; - test_msg->toe_wn = 2154; - test_msg->valid = 1; - test_msg->w = -0.9893036629599647; - sbp_payload_send(&sbp_state, 0x80, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x80, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_dep_d_t *check_msg = - (msg_ephemeris_dep_d_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - -0.00063150189817 * 100) < 0.05, - "incorrect value for af0, expected -0.00063150189817, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - 8.98126018001e-12 * 100) < 0.05, - "incorrect value for af1, expected 8.98126018001e-12, is %f", - check_msg->af1); - ck_assert_msg((check_msg->af2 * 100 - 0.2 * 100) < 0.05, - "incorrect value for af2, expected 0.2, is %f", - check_msg->af2); - ck_assert_msg((check_msg->c_ic * 100 - 7.45058059692e-09 * 100) < 0.05, - "incorrect value for c_ic, expected 7.45058059692e-09, is %f", - check_msg->c_ic); - ck_assert_msg( - (check_msg->c_is * 100 - -1.15483999252e-07 * 100) < 0.05, - "incorrect value for c_is, expected -1.15483999252e-07, is %f", - check_msg->c_is); - ck_assert_msg((check_msg->c_rc * 100 - 308.625 * 100) < 0.05, - "incorrect value for c_rc, expected 308.625, is %f", - check_msg->c_rc); - ck_assert_msg((check_msg->c_rs * 100 - -52.3125 * 100) < 0.05, - "incorrect value for c_rs, expected -52.3125, is %f", - check_msg->c_rs); - ck_assert_msg( - (check_msg->c_uc * 100 - -2.74367630482e-06 * 100) < 0.05, - "incorrect value for c_uc, expected -2.74367630482e-06, is %f", - check_msg->c_uc); - ck_assert_msg((check_msg->c_us * 100 - 3.1366944313e-06 * 100) < 0.05, - "incorrect value for c_us, expected 3.1366944313e-06, is %f", - check_msg->c_us); - ck_assert_msg((check_msg->dn * 100 - 5.69452291402e-09 * 100) < 0.05, - "incorrect value for dn, expected 5.69452291402e-09, is %f", - check_msg->dn); - ck_assert_msg((check_msg->ecc * 100 - 0.00707220705226 * 100) < 0.05, - "incorrect value for ecc, expected 0.00707220705226, is %f", - check_msg->ecc); - ck_assert_msg(check_msg->healthy == 0, - "incorrect value for healthy, expected 0, is %d", - check_msg->healthy); - ck_assert_msg((check_msg->inc * 100 - 0.934151448026 * 100) < 0.05, - "incorrect value for inc, expected 0.934151448026, is %f", - check_msg->inc); - ck_assert_msg( - (check_msg->inc_dot * 100 - -4.03588239642e-11 * 100) < 0.05, - "incorrect value for inc_dot, expected -4.03588239642e-11, is %f", - check_msg->inc_dot); - ck_assert_msg(check_msg->iodc == 45, - "incorrect value for iodc, expected 45, is %d", - check_msg->iodc); - ck_assert_msg(check_msg->iode == 45, - "incorrect value for iode, expected 45, is %d", - check_msg->iode); - ck_assert_msg((check_msg->m0 * 100 - -0.0220007884211 * 100) < 0.05, - "incorrect value for m0, expected -0.0220007884211, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - -1.87318184488 * 100) < 0.05, - "incorrect value for omega0, expected -1.87318184488, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -8.90358515577e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -8.90358515577e-09, is %f", - check_msg->omegadot); - ck_assert_msg(check_msg->reserved == 0, - "incorrect value for reserved, expected 0, is %d", - check_msg->reserved); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 22, - "incorrect value for sid.sat, expected 22, is %d", - check_msg->sid.sat); - ck_assert_msg((check_msg->sqrta * 100 - 5153.55002975 * 100) < 0.05, - "incorrect value for sqrta, expected 5153.55002975, is %f", - check_msg->sqrta); - ck_assert_msg((check_msg->tgd * 100 - -1.76951289177e-08 * 100) < 0.05, - "incorrect value for tgd, expected -1.76951289177e-08, is %f", - check_msg->tgd); - ck_assert_msg((check_msg->toc_tow * 100 - 446384.2 * 100) < 0.05, - "incorrect value for toc_tow, expected 446384.2, is %f", - check_msg->toc_tow); - ck_assert_msg(check_msg->toc_wn == 2154, - "incorrect value for toc_wn, expected 2154, is %d", - check_msg->toc_wn); - ck_assert_msg((check_msg->toe_tow * 100 - 446384.2 * 100) < 0.05, - "incorrect value for toe_tow, expected 446384.2, is %f", - check_msg->toe_tow); - ck_assert_msg(check_msg->toe_wn == 2154, - "incorrect value for toe_wn, expected 2154, is %d", - check_msg->toe_wn); - ck_assert_msg(check_msg->valid == 1, - "incorrect value for valid, expected 1, is %d", - check_msg->valid); - ck_assert_msg((check_msg->w * 100 - -0.98930366296 * 100) < 0.05, - "incorrect value for w, expected -0.98930366296, is %f", - check_msg->w); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgEphemerisDepD_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgEphemerisDepD"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgEphemerisDepD"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgEphemerisDepD); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGLO.c b/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGLO.c deleted file mode 100644 index 8f1738068c..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGLO.c +++ /dev/null @@ -1,351 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGLO.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgEphemerisGLO) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x8b, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x8b, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 139, 0, 10, 9, 92, 4, 3, 70, 197, 6, 0, 106, - 8, 0, 0, 160, 64, 96, 9, 0, 0, 1, 0, 0, 0, - 128, 43, 128, 97, 175, 184, 0, 0, 64, 177, 0, 0, 128, - 66, 246, 57, 103, 193, 0, 0, 0, 34, 170, 78, 34, 65, - 0, 0, 240, 199, 84, 86, 117, 193, 0, 0, 0, 98, 6, - 250, 154, 192, 0, 0, 0, 217, 58, 221, 163, 192, 0, 0, - 0, 184, 138, 46, 139, 64, 0, 0, 122, 53, 0, 0, 122, - 53, 0, 128, 59, 54, 14, 100, 89, 149, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_glo_t *test_msg = (msg_ephemeris_glo_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[0] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[1] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[2] = 2.7939677238464355e-06; - test_msg->common.fit_interval = 2400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 3; - test_msg->common.sid.sat = 4; - test_msg->common.toe.tow = 443718; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 5.0; - test_msg->common.valid = 1; - test_msg->d_tau = -2.7939677238464355e-09; - test_msg->fcn = 14; - test_msg->gamma = 9.094947017729282e-13; - test_msg->iod = 100; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[0] = -12177330.078125; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[1] = 599893.06640625; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[2] = -22373708.49609375; - test_msg->tau = -8.36281105875969e-05; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[0] = -1726.506233215332; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[1] = -2542.6149368286133; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[2] = 869.8177337646484; - sbp_payload_send(&sbp_state, 0x8b, 2314, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 2314, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 2314, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x8b, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_glo_t *check_msg = - (msg_ephemeris_glo_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->acc[0] * 100 - 9.31322574615e-07 * 100) < 0.05, - "incorrect value for acc[0], expected 9.31322574615e-07, is %f", - check_msg->acc[0]); - ck_assert_msg( - (check_msg->acc[1] * 100 - 9.31322574615e-07 * 100) < 0.05, - "incorrect value for acc[1], expected 9.31322574615e-07, is %f", - check_msg->acc[1]); - ck_assert_msg( - (check_msg->acc[2] * 100 - 2.79396772385e-06 * 100) < 0.05, - "incorrect value for acc[2], expected 2.79396772385e-06, is %f", - check_msg->acc[2]); - ck_assert_msg( - check_msg->common.fit_interval == 2400, - "incorrect value for common.fit_interval, expected 2400, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 3, - "incorrect value for common.sid.code, expected 3, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.sat == 4, - "incorrect value for common.sid.sat, expected 4, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toe.tow == 443718, - "incorrect value for common.toe.tow, expected 443718, is %d", - check_msg->common.toe.tow); - ck_assert_msg(check_msg->common.toe.wn == 2154, - "incorrect value for common.toe.wn, expected 2154, is %d", - check_msg->common.toe.wn); - ck_assert_msg((check_msg->common.ura * 100 - 5.0 * 100) < 0.05, - "incorrect value for common.ura, expected 5.0, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg( - (check_msg->d_tau * 100 - -2.79396772385e-09 * 100) < 0.05, - "incorrect value for d_tau, expected -2.79396772385e-09, is %f", - check_msg->d_tau); - ck_assert_msg(check_msg->fcn == 14, - "incorrect value for fcn, expected 14, is %d", - check_msg->fcn); - ck_assert_msg( - (check_msg->gamma * 100 - 9.09494701773e-13 * 100) < 0.05, - "incorrect value for gamma, expected 9.09494701773e-13, is %f", - check_msg->gamma); - ck_assert_msg(check_msg->iod == 100, - "incorrect value for iod, expected 100, is %d", - check_msg->iod); - ck_assert_msg((check_msg->pos[0] * 100 - -12177330.0781 * 100) < 0.05, - "incorrect value for pos[0], expected -12177330.0781, is %f", - check_msg->pos[0]); - ck_assert_msg((check_msg->pos[1] * 100 - 599893.066406 * 100) < 0.05, - "incorrect value for pos[1], expected 599893.066406, is %f", - check_msg->pos[1]); - ck_assert_msg((check_msg->pos[2] * 100 - -22373708.4961 * 100) < 0.05, - "incorrect value for pos[2], expected -22373708.4961, is %f", - check_msg->pos[2]); - ck_assert_msg((check_msg->tau * 100 - -8.36281105876e-05 * 100) < 0.05, - "incorrect value for tau, expected -8.36281105876e-05, is %f", - check_msg->tau); - ck_assert_msg((check_msg->vel[0] * 100 - -1726.50623322 * 100) < 0.05, - "incorrect value for vel[0], expected -1726.50623322, is %f", - check_msg->vel[0]); - ck_assert_msg((check_msg->vel[1] * 100 - -2542.61493683 * 100) < 0.05, - "incorrect value for vel[1], expected -2542.61493683, is %f", - check_msg->vel[1]); - ck_assert_msg((check_msg->vel[2] * 100 - 869.817733765 * 100) < 0.05, - "incorrect value for vel[2], expected 869.817733765, is %f", - check_msg->vel[2]); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgEphemerisGLO_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgEphemerisGLO"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgEphemerisGLO"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgEphemerisGLO); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGLODepA.c b/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGLODepA.c deleted file mode 100644 index 68d51a743f..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGLODepA.c +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGLODepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x83, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x83, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 131, 0, 195, 4, 112, 4, 0, 3, 0, 70, 197, 6, 0, - 106, 8, 205, 204, 204, 204, 204, 204, 20, 64, 96, 9, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 112, 61, 0, 0, 0, 0, - 48, 236, 21, 191, 0, 0, 128, 66, 246, 57, 103, 193, 0, 0, - 0, 34, 170, 78, 34, 65, 0, 0, 240, 199, 84, 86, 117, 193, - 0, 0, 0, 98, 6, 250, 154, 192, 0, 0, 0, 217, 58, 221, - 163, 192, 0, 0, 0, 184, 138, 46, 139, 64, 0, 0, 0, 0, - 0, 64, 175, 62, 0, 0, 0, 0, 0, 64, 175, 62, 0, 0, - 0, 0, 0, 112, 199, 62, 202, 238, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_glo_dep_a_t *test_msg = - (msg_ephemeris_glo_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[0] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[1] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[2] = 2.7939677238464355e-06; - test_msg->common.fit_interval = 2400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 3; - test_msg->common.sid.reserved = 0; - test_msg->common.sid.sat = 4; - test_msg->common.toe.tow = 443718; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 5.2; - test_msg->common.valid = 1; - test_msg->gamma = 9.094947017729282e-13; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[0] = -12177330.078125; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[1] = 599893.06640625; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[2] = -22373708.49609375; - test_msg->tau = -8.36281105875969e-05; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[0] = -1726.506233215332; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[1] = -2542.6149368286133; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[2] = 869.8177337646484; - sbp_payload_send(&sbp_state, 0x83, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x83, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_glo_dep_a_t *check_msg = - (msg_ephemeris_glo_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->acc[0] * 100 - 9.31322574615e-07 * 100) < 0.05, - "incorrect value for acc[0], expected 9.31322574615e-07, is %f", - check_msg->acc[0]); - ck_assert_msg( - (check_msg->acc[1] * 100 - 9.31322574615e-07 * 100) < 0.05, - "incorrect value for acc[1], expected 9.31322574615e-07, is %f", - check_msg->acc[1]); - ck_assert_msg( - (check_msg->acc[2] * 100 - 2.79396772385e-06 * 100) < 0.05, - "incorrect value for acc[2], expected 2.79396772385e-06, is %f", - check_msg->acc[2]); - ck_assert_msg( - check_msg->common.fit_interval == 2400, - "incorrect value for common.fit_interval, expected 2400, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 3, - "incorrect value for common.sid.code, expected 3, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.reserved == 0, - "incorrect value for common.sid.reserved, expected 0, is %d", - check_msg->common.sid.reserved); - ck_assert_msg(check_msg->common.sid.sat == 4, - "incorrect value for common.sid.sat, expected 4, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toe.tow == 443718, - "incorrect value for common.toe.tow, expected 443718, is %d", - check_msg->common.toe.tow); - ck_assert_msg(check_msg->common.toe.wn == 2154, - "incorrect value for common.toe.wn, expected 2154, is %d", - check_msg->common.toe.wn); - ck_assert_msg((check_msg->common.ura * 100 - 5.2 * 100) < 0.05, - "incorrect value for common.ura, expected 5.2, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg( - (check_msg->gamma * 100 - 9.09494701773e-13 * 100) < 0.05, - "incorrect value for gamma, expected 9.09494701773e-13, is %f", - check_msg->gamma); - ck_assert_msg((check_msg->pos[0] * 100 - -12177330.0781 * 100) < 0.05, - "incorrect value for pos[0], expected -12177330.0781, is %f", - check_msg->pos[0]); - ck_assert_msg((check_msg->pos[1] * 100 - 599893.066406 * 100) < 0.05, - "incorrect value for pos[1], expected 599893.066406, is %f", - check_msg->pos[1]); - ck_assert_msg((check_msg->pos[2] * 100 - -22373708.4961 * 100) < 0.05, - "incorrect value for pos[2], expected -22373708.4961, is %f", - check_msg->pos[2]); - ck_assert_msg((check_msg->tau * 100 - -8.36281105876e-05 * 100) < 0.05, - "incorrect value for tau, expected -8.36281105876e-05, is %f", - check_msg->tau); - ck_assert_msg((check_msg->vel[0] * 100 - -1726.50623322 * 100) < 0.05, - "incorrect value for vel[0], expected -1726.50623322, is %f", - check_msg->vel[0]); - ck_assert_msg((check_msg->vel[1] * 100 - -2542.61493683 * 100) < 0.05, - "incorrect value for vel[1], expected -2542.61493683, is %f", - check_msg->vel[1]); - ck_assert_msg((check_msg->vel[2] * 100 - 869.817733765 * 100) < 0.05, - "incorrect value for vel[2], expected 869.817733765, is %f", - check_msg->vel[2]); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgEphemerisGLODepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgEphemerisGLODepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgEphemerisGLODepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGLODepB.c b/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGLODepB.c deleted file mode 100644 index 172c935b64..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGLODepB.c +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGLODepB.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepB) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x85, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x85, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 133, 0, 195, 4, 110, 4, 3, 70, 197, 6, 0, 106, 8, - 205, 204, 204, 204, 204, 204, 20, 64, 96, 9, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 112, 61, 0, 0, 0, 0, 48, 236, - 21, 191, 0, 0, 128, 66, 246, 57, 103, 193, 0, 0, 0, 34, - 170, 78, 34, 65, 0, 0, 240, 199, 84, 86, 117, 193, 0, 0, - 0, 98, 6, 250, 154, 192, 0, 0, 0, 217, 58, 221, 163, 192, - 0, 0, 0, 184, 138, 46, 139, 64, 0, 0, 0, 0, 0, 64, - 175, 62, 0, 0, 0, 0, 0, 64, 175, 62, 0, 0, 0, 0, - 0, 112, 199, 62, 122, 127, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_glo_dep_b_t *test_msg = - (msg_ephemeris_glo_dep_b_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[0] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[1] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[2] = 2.7939677238464355e-06; - test_msg->common.fit_interval = 2400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 3; - test_msg->common.sid.sat = 4; - test_msg->common.toe.tow = 443718; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 5.2; - test_msg->common.valid = 1; - test_msg->gamma = 9.094947017729282e-13; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[0] = -12177330.078125; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[1] = 599893.06640625; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[2] = -22373708.49609375; - test_msg->tau = -8.36281105875969e-05; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[0] = -1726.506233215332; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[1] = -2542.6149368286133; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[2] = 869.8177337646484; - sbp_payload_send(&sbp_state, 0x85, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x85, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_glo_dep_b_t *check_msg = - (msg_ephemeris_glo_dep_b_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->acc[0] * 100 - 9.31322574615e-07 * 100) < 0.05, - "incorrect value for acc[0], expected 9.31322574615e-07, is %f", - check_msg->acc[0]); - ck_assert_msg( - (check_msg->acc[1] * 100 - 9.31322574615e-07 * 100) < 0.05, - "incorrect value for acc[1], expected 9.31322574615e-07, is %f", - check_msg->acc[1]); - ck_assert_msg( - (check_msg->acc[2] * 100 - 2.79396772385e-06 * 100) < 0.05, - "incorrect value for acc[2], expected 2.79396772385e-06, is %f", - check_msg->acc[2]); - ck_assert_msg( - check_msg->common.fit_interval == 2400, - "incorrect value for common.fit_interval, expected 2400, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 3, - "incorrect value for common.sid.code, expected 3, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.sat == 4, - "incorrect value for common.sid.sat, expected 4, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toe.tow == 443718, - "incorrect value for common.toe.tow, expected 443718, is %d", - check_msg->common.toe.tow); - ck_assert_msg(check_msg->common.toe.wn == 2154, - "incorrect value for common.toe.wn, expected 2154, is %d", - check_msg->common.toe.wn); - ck_assert_msg((check_msg->common.ura * 100 - 5.2 * 100) < 0.05, - "incorrect value for common.ura, expected 5.2, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg( - (check_msg->gamma * 100 - 9.09494701773e-13 * 100) < 0.05, - "incorrect value for gamma, expected 9.09494701773e-13, is %f", - check_msg->gamma); - ck_assert_msg((check_msg->pos[0] * 100 - -12177330.0781 * 100) < 0.05, - "incorrect value for pos[0], expected -12177330.0781, is %f", - check_msg->pos[0]); - ck_assert_msg((check_msg->pos[1] * 100 - 599893.066406 * 100) < 0.05, - "incorrect value for pos[1], expected 599893.066406, is %f", - check_msg->pos[1]); - ck_assert_msg((check_msg->pos[2] * 100 - -22373708.4961 * 100) < 0.05, - "incorrect value for pos[2], expected -22373708.4961, is %f", - check_msg->pos[2]); - ck_assert_msg((check_msg->tau * 100 - -8.36281105876e-05 * 100) < 0.05, - "incorrect value for tau, expected -8.36281105876e-05, is %f", - check_msg->tau); - ck_assert_msg((check_msg->vel[0] * 100 - -1726.50623322 * 100) < 0.05, - "incorrect value for vel[0], expected -1726.50623322, is %f", - check_msg->vel[0]); - ck_assert_msg((check_msg->vel[1] * 100 - -2542.61493683 * 100) < 0.05, - "incorrect value for vel[1], expected -2542.61493683, is %f", - check_msg->vel[1]); - ck_assert_msg((check_msg->vel[2] * 100 - 869.817733765 * 100) < 0.05, - "incorrect value for vel[2], expected 869.817733765, is %f", - check_msg->vel[2]); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgEphemerisGLODepB_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgEphemerisGLODepB"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgEphemerisGLODepB"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepB); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGLODepC.c b/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGLODepC.c deleted file mode 100644 index 6970f75b63..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGLODepC.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGLODepC.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepC) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x87, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x87, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 135, 0, 195, 4, 119, 4, 3, 70, 197, 6, 0, 106, - 8, 205, 204, 204, 204, 204, 204, 20, 64, 96, 9, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 112, 61, 0, 0, 0, - 0, 48, 236, 21, 191, 0, 0, 0, 0, 0, 0, 40, 190, - 0, 0, 128, 66, 246, 57, 103, 193, 0, 0, 0, 34, 170, - 78, 34, 65, 0, 0, 240, 199, 84, 86, 117, 193, 0, 0, - 0, 98, 6, 250, 154, 192, 0, 0, 0, 217, 58, 221, 163, - 192, 0, 0, 0, 184, 138, 46, 139, 64, 0, 0, 0, 0, - 0, 64, 175, 62, 0, 0, 0, 0, 0, 64, 175, 62, 0, - 0, 0, 0, 0, 112, 199, 62, 14, 151, 65, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_glo_dep_c_t *test_msg = - (msg_ephemeris_glo_dep_c_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[0] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[1] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[2] = 2.7939677238464355e-06; - test_msg->common.fit_interval = 2400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 3; - test_msg->common.sid.sat = 4; - test_msg->common.toe.tow = 443718; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 5.2; - test_msg->common.valid = 1; - test_msg->d_tau = -2.7939677238464355e-09; - test_msg->fcn = 14; - test_msg->gamma = 9.094947017729282e-13; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[0] = -12177330.078125; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[1] = 599893.06640625; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[2] = -22373708.49609375; - test_msg->tau = -8.36281105875969e-05; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[0] = -1726.506233215332; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[1] = -2542.6149368286133; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[2] = 869.8177337646484; - sbp_payload_send(&sbp_state, 0x87, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x87, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_glo_dep_c_t *check_msg = - (msg_ephemeris_glo_dep_c_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->acc[0] * 100 - 9.31322574615e-07 * 100) < 0.05, - "incorrect value for acc[0], expected 9.31322574615e-07, is %f", - check_msg->acc[0]); - ck_assert_msg( - (check_msg->acc[1] * 100 - 9.31322574615e-07 * 100) < 0.05, - "incorrect value for acc[1], expected 9.31322574615e-07, is %f", - check_msg->acc[1]); - ck_assert_msg( - (check_msg->acc[2] * 100 - 2.79396772385e-06 * 100) < 0.05, - "incorrect value for acc[2], expected 2.79396772385e-06, is %f", - check_msg->acc[2]); - ck_assert_msg( - check_msg->common.fit_interval == 2400, - "incorrect value for common.fit_interval, expected 2400, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 3, - "incorrect value for common.sid.code, expected 3, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.sat == 4, - "incorrect value for common.sid.sat, expected 4, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toe.tow == 443718, - "incorrect value for common.toe.tow, expected 443718, is %d", - check_msg->common.toe.tow); - ck_assert_msg(check_msg->common.toe.wn == 2154, - "incorrect value for common.toe.wn, expected 2154, is %d", - check_msg->common.toe.wn); - ck_assert_msg((check_msg->common.ura * 100 - 5.2 * 100) < 0.05, - "incorrect value for common.ura, expected 5.2, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg( - (check_msg->d_tau * 100 - -2.79396772385e-09 * 100) < 0.05, - "incorrect value for d_tau, expected -2.79396772385e-09, is %f", - check_msg->d_tau); - ck_assert_msg(check_msg->fcn == 14, - "incorrect value for fcn, expected 14, is %d", - check_msg->fcn); - ck_assert_msg( - (check_msg->gamma * 100 - 9.09494701773e-13 * 100) < 0.05, - "incorrect value for gamma, expected 9.09494701773e-13, is %f", - check_msg->gamma); - ck_assert_msg((check_msg->pos[0] * 100 - -12177330.0781 * 100) < 0.05, - "incorrect value for pos[0], expected -12177330.0781, is %f", - check_msg->pos[0]); - ck_assert_msg((check_msg->pos[1] * 100 - 599893.066406 * 100) < 0.05, - "incorrect value for pos[1], expected 599893.066406, is %f", - check_msg->pos[1]); - ck_assert_msg((check_msg->pos[2] * 100 - -22373708.4961 * 100) < 0.05, - "incorrect value for pos[2], expected -22373708.4961, is %f", - check_msg->pos[2]); - ck_assert_msg((check_msg->tau * 100 - -8.36281105876e-05 * 100) < 0.05, - "incorrect value for tau, expected -8.36281105876e-05, is %f", - check_msg->tau); - ck_assert_msg((check_msg->vel[0] * 100 - -1726.50623322 * 100) < 0.05, - "incorrect value for vel[0], expected -1726.50623322, is %f", - check_msg->vel[0]); - ck_assert_msg((check_msg->vel[1] * 100 - -2542.61493683 * 100) < 0.05, - "incorrect value for vel[1], expected -2542.61493683, is %f", - check_msg->vel[1]); - ck_assert_msg((check_msg->vel[2] * 100 - 869.817733765 * 100) < 0.05, - "incorrect value for vel[2], expected 869.817733765, is %f", - check_msg->vel[2]); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgEphemerisGLODepC_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgEphemerisGLODepC"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgEphemerisGLODepC"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepC); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGLODepD.c b/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGLODepD.c deleted file mode 100644 index 1f44f3af50..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGLODepD.c +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGLODepD.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepD) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x88, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x88, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 136, 0, 195, 4, 120, 4, 3, 70, 197, 6, 0, 106, - 8, 205, 204, 204, 204, 204, 204, 20, 64, 96, 9, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 112, 61, 0, 0, 0, - 0, 48, 236, 21, 191, 0, 0, 0, 0, 0, 0, 40, 190, - 0, 0, 128, 66, 246, 57, 103, 193, 0, 0, 0, 34, 170, - 78, 34, 65, 0, 0, 240, 199, 84, 86, 117, 193, 0, 0, - 0, 98, 6, 250, 154, 192, 0, 0, 0, 217, 58, 221, 163, - 192, 0, 0, 0, 184, 138, 46, 139, 64, 0, 0, 0, 0, - 0, 64, 175, 62, 0, 0, 0, 0, 0, 64, 175, 62, 0, - 0, 0, 0, 0, 112, 199, 62, 14, 100, 82, 64, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_glo_dep_d_t *test_msg = - (msg_ephemeris_glo_dep_d_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[0] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[1] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[2] = 2.7939677238464355e-06; - test_msg->common.fit_interval = 2400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 3; - test_msg->common.sid.sat = 4; - test_msg->common.toe.tow = 443718; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 5.2; - test_msg->common.valid = 1; - test_msg->d_tau = -2.7939677238464355e-09; - test_msg->fcn = 14; - test_msg->gamma = 9.094947017729282e-13; - test_msg->iod = 100; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[0] = -12177330.078125; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[1] = 599893.06640625; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[2] = -22373708.49609375; - test_msg->tau = -8.36281105875969e-05; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[0] = -1726.506233215332; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[1] = -2542.6149368286133; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[2] = 869.8177337646484; - sbp_payload_send(&sbp_state, 0x88, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x88, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_glo_dep_d_t *check_msg = - (msg_ephemeris_glo_dep_d_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->acc[0] * 100 - 9.31322574615e-07 * 100) < 0.05, - "incorrect value for acc[0], expected 9.31322574615e-07, is %f", - check_msg->acc[0]); - ck_assert_msg( - (check_msg->acc[1] * 100 - 9.31322574615e-07 * 100) < 0.05, - "incorrect value for acc[1], expected 9.31322574615e-07, is %f", - check_msg->acc[1]); - ck_assert_msg( - (check_msg->acc[2] * 100 - 2.79396772385e-06 * 100) < 0.05, - "incorrect value for acc[2], expected 2.79396772385e-06, is %f", - check_msg->acc[2]); - ck_assert_msg( - check_msg->common.fit_interval == 2400, - "incorrect value for common.fit_interval, expected 2400, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 3, - "incorrect value for common.sid.code, expected 3, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.sat == 4, - "incorrect value for common.sid.sat, expected 4, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toe.tow == 443718, - "incorrect value for common.toe.tow, expected 443718, is %d", - check_msg->common.toe.tow); - ck_assert_msg(check_msg->common.toe.wn == 2154, - "incorrect value for common.toe.wn, expected 2154, is %d", - check_msg->common.toe.wn); - ck_assert_msg((check_msg->common.ura * 100 - 5.2 * 100) < 0.05, - "incorrect value for common.ura, expected 5.2, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg( - (check_msg->d_tau * 100 - -2.79396772385e-09 * 100) < 0.05, - "incorrect value for d_tau, expected -2.79396772385e-09, is %f", - check_msg->d_tau); - ck_assert_msg(check_msg->fcn == 14, - "incorrect value for fcn, expected 14, is %d", - check_msg->fcn); - ck_assert_msg( - (check_msg->gamma * 100 - 9.09494701773e-13 * 100) < 0.05, - "incorrect value for gamma, expected 9.09494701773e-13, is %f", - check_msg->gamma); - ck_assert_msg(check_msg->iod == 100, - "incorrect value for iod, expected 100, is %d", - check_msg->iod); - ck_assert_msg((check_msg->pos[0] * 100 - -12177330.0781 * 100) < 0.05, - "incorrect value for pos[0], expected -12177330.0781, is %f", - check_msg->pos[0]); - ck_assert_msg((check_msg->pos[1] * 100 - 599893.066406 * 100) < 0.05, - "incorrect value for pos[1], expected 599893.066406, is %f", - check_msg->pos[1]); - ck_assert_msg((check_msg->pos[2] * 100 - -22373708.4961 * 100) < 0.05, - "incorrect value for pos[2], expected -22373708.4961, is %f", - check_msg->pos[2]); - ck_assert_msg((check_msg->tau * 100 - -8.36281105876e-05 * 100) < 0.05, - "incorrect value for tau, expected -8.36281105876e-05, is %f", - check_msg->tau); - ck_assert_msg((check_msg->vel[0] * 100 - -1726.50623322 * 100) < 0.05, - "incorrect value for vel[0], expected -1726.50623322, is %f", - check_msg->vel[0]); - ck_assert_msg((check_msg->vel[1] * 100 - -2542.61493683 * 100) < 0.05, - "incorrect value for vel[1], expected -2542.61493683, is %f", - check_msg->vel[1]); - ck_assert_msg((check_msg->vel[2] * 100 - 869.817733765 * 100) < 0.05, - "incorrect value for vel[2], expected 869.817733765, is %f", - check_msg->vel[2]); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgEphemerisGLODepD_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgEphemerisGLODepD"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgEphemerisGLODepD"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepD); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGPS.c b/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGPS.c deleted file mode 100644 index 2a82abea00..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGPS.c +++ /dev/null @@ -1,353 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGPS.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgEphemerisGPS) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x8a, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x8a, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 138, 0, 10, 9, 139, 22, 0, 176, 207, 6, 0, 106, 8, - 0, 0, 0, 64, 64, 56, 0, 0, 1, 0, 0, 0, 152, 178, - 0, 64, 81, 194, 0, 80, 154, 67, 0, 32, 56, 182, 0, 128, - 82, 54, 0, 0, 0, 50, 0, 0, 248, 179, 114, 216, 96, 180, - 49, 117, 56, 62, 142, 41, 5, 235, 95, 135, 150, 191, 0, 0, - 0, 32, 191, 247, 124, 63, 0, 0, 192, 206, 140, 33, 180, 64, - 41, 131, 179, 134, 141, 248, 253, 191, 227, 133, 81, 54, 204, 30, - 67, 190, 216, 59, 199, 39, 96, 168, 239, 191, 71, 11, 217, 147, - 145, 228, 237, 63, 221, 47, 100, 224, 255, 47, 198, 189, 96, 139, - 37, 186, 0, 0, 30, 45, 0, 0, 0, 0, 176, 207, 6, 0, - 106, 8, 45, 45, 0, 170, 4, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_gps_t *test_msg = (msg_ephemeris_gps_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = -0.0006315018981695175; - test_msg->af1 = 8.981260180007666e-12; - test_msg->af2 = 0.0; - test_msg->c_ic = 7.450580596923828e-09; - test_msg->c_is = -1.1548399925231934e-07; - test_msg->c_rc = 308.625; - test_msg->c_rs = -52.3125; - test_msg->c_uc = -2.7436763048171997e-06; - test_msg->c_us = 3.1366944313049316e-06; - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 0; - test_msg->common.sid.sat = 22; - test_msg->common.toe.tow = 446384; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 2.0; - test_msg->common.valid = 1; - test_msg->dn = 5.694522914022375e-09; - test_msg->ecc = 0.007072207052260637; - test_msg->inc = 0.9341514480259797; - test_msg->inc_dot = -4.035882396415757e-11; - test_msg->iodc = 45; - test_msg->iode = 45; - test_msg->m0 = -0.02200078842114688; - test_msg->omega0 = -1.8731818448797617; - test_msg->omegadot = -8.903585155774196e-09; - test_msg->sqrta = 5153.550029754639; - test_msg->tgd = -1.7695128917694092e-08; - test_msg->toc.tow = 446384; - test_msg->toc.wn = 2154; - test_msg->w = -0.9893036629599647; - sbp_payload_send(&sbp_state, 0x8a, 2314, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 2314, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 2314, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x8a, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_gps_t *check_msg = - (msg_ephemeris_gps_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - -0.00063150189817 * 100) < 0.05, - "incorrect value for af0, expected -0.00063150189817, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - 8.98126018001e-12 * 100) < 0.05, - "incorrect value for af1, expected 8.98126018001e-12, is %f", - check_msg->af1); - ck_assert_msg((check_msg->af2 * 100 - 0.0 * 100) < 0.05, - "incorrect value for af2, expected 0.0, is %f", - check_msg->af2); - ck_assert_msg((check_msg->c_ic * 100 - 7.45058059692e-09 * 100) < 0.05, - "incorrect value for c_ic, expected 7.45058059692e-09, is %f", - check_msg->c_ic); - ck_assert_msg( - (check_msg->c_is * 100 - -1.15483999252e-07 * 100) < 0.05, - "incorrect value for c_is, expected -1.15483999252e-07, is %f", - check_msg->c_is); - ck_assert_msg((check_msg->c_rc * 100 - 308.625 * 100) < 0.05, - "incorrect value for c_rc, expected 308.625, is %f", - check_msg->c_rc); - ck_assert_msg((check_msg->c_rs * 100 - -52.3125 * 100) < 0.05, - "incorrect value for c_rs, expected -52.3125, is %f", - check_msg->c_rs); - ck_assert_msg( - (check_msg->c_uc * 100 - -2.74367630482e-06 * 100) < 0.05, - "incorrect value for c_uc, expected -2.74367630482e-06, is %f", - check_msg->c_uc); - ck_assert_msg((check_msg->c_us * 100 - 3.1366944313e-06 * 100) < 0.05, - "incorrect value for c_us, expected 3.1366944313e-06, is %f", - check_msg->c_us); - ck_assert_msg( - check_msg->common.fit_interval == 14400, - "incorrect value for common.fit_interval, expected 14400, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 0, - "incorrect value for common.sid.code, expected 0, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.sat == 22, - "incorrect value for common.sid.sat, expected 22, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toe.tow == 446384, - "incorrect value for common.toe.tow, expected 446384, is %d", - check_msg->common.toe.tow); - ck_assert_msg(check_msg->common.toe.wn == 2154, - "incorrect value for common.toe.wn, expected 2154, is %d", - check_msg->common.toe.wn); - ck_assert_msg((check_msg->common.ura * 100 - 2.0 * 100) < 0.05, - "incorrect value for common.ura, expected 2.0, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg((check_msg->dn * 100 - 5.69452291402e-09 * 100) < 0.05, - "incorrect value for dn, expected 5.69452291402e-09, is %f", - check_msg->dn); - ck_assert_msg((check_msg->ecc * 100 - 0.00707220705226 * 100) < 0.05, - "incorrect value for ecc, expected 0.00707220705226, is %f", - check_msg->ecc); - ck_assert_msg((check_msg->inc * 100 - 0.934151448026 * 100) < 0.05, - "incorrect value for inc, expected 0.934151448026, is %f", - check_msg->inc); - ck_assert_msg( - (check_msg->inc_dot * 100 - -4.03588239642e-11 * 100) < 0.05, - "incorrect value for inc_dot, expected -4.03588239642e-11, is %f", - check_msg->inc_dot); - ck_assert_msg(check_msg->iodc == 45, - "incorrect value for iodc, expected 45, is %d", - check_msg->iodc); - ck_assert_msg(check_msg->iode == 45, - "incorrect value for iode, expected 45, is %d", - check_msg->iode); - ck_assert_msg((check_msg->m0 * 100 - -0.0220007884211 * 100) < 0.05, - "incorrect value for m0, expected -0.0220007884211, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - -1.87318184488 * 100) < 0.05, - "incorrect value for omega0, expected -1.87318184488, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -8.90358515577e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -8.90358515577e-09, is %f", - check_msg->omegadot); - ck_assert_msg((check_msg->sqrta * 100 - 5153.55002975 * 100) < 0.05, - "incorrect value for sqrta, expected 5153.55002975, is %f", - check_msg->sqrta); - ck_assert_msg((check_msg->tgd * 100 - -1.76951289177e-08 * 100) < 0.05, - "incorrect value for tgd, expected -1.76951289177e-08, is %f", - check_msg->tgd); - ck_assert_msg(check_msg->toc.tow == 446384, - "incorrect value for toc.tow, expected 446384, is %d", - check_msg->toc.tow); - ck_assert_msg(check_msg->toc.wn == 2154, - "incorrect value for toc.wn, expected 2154, is %d", - check_msg->toc.wn); - ck_assert_msg((check_msg->w * 100 - -0.98930366296 * 100) < 0.05, - "incorrect value for w, expected -0.98930366296, is %f", - check_msg->w); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgEphemerisGPS_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgEphemerisGPS"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgEphemerisGPS"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgEphemerisGPS); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGPSDepE.c b/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGPSDepE.c deleted file mode 100644 index a73e62520f..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGPSDepE.c +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGPSDepE.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgEphemerisGPSDepE) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x81, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x81, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 129, 0, 123, 0, 185, 22, 0, 0, 0, 176, 207, 6, 0, - 106, 8, 0, 0, 0, 0, 0, 0, 0, 64, 64, 56, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 83, 190, 0, 0, 0, 0, - 0, 40, 74, 192, 0, 0, 0, 0, 0, 74, 115, 64, 0, 0, - 0, 0, 0, 4, 199, 190, 0, 0, 0, 0, 0, 80, 202, 62, - 0, 0, 0, 0, 0, 0, 64, 62, 0, 0, 0, 0, 0, 0, - 127, 190, 114, 216, 96, 180, 49, 117, 56, 62, 142, 41, 5, 235, - 95, 135, 150, 191, 0, 0, 0, 32, 191, 247, 124, 63, 0, 0, - 192, 206, 140, 33, 180, 64, 41, 131, 179, 134, 141, 248, 253, 191, - 227, 133, 81, 54, 204, 30, 67, 190, 216, 59, 199, 39, 96, 168, - 239, 191, 71, 11, 217, 147, 145, 228, 237, 63, 221, 47, 100, 224, - 255, 47, 198, 189, 0, 0, 0, 0, 108, 177, 68, 191, 0, 0, - 0, 0, 0, 192, 163, 61, 0, 0, 0, 0, 0, 0, 0, 0, - 176, 207, 6, 0, 106, 8, 45, 45, 0, 6, 238, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_gps_dep_e_t *test_msg = - (msg_ephemeris_gps_dep_e_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = -0.0006315018981695175; - test_msg->af1 = 8.981260180007666e-12; - test_msg->af2 = 0.0; - test_msg->c_ic = 7.450580596923828e-09; - test_msg->c_is = -1.1548399925231934e-07; - test_msg->c_rc = 308.625; - test_msg->c_rs = -52.3125; - test_msg->c_uc = -2.7436763048171997e-06; - test_msg->c_us = 3.1366944313049316e-06; - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 0; - test_msg->common.sid.reserved = 0; - test_msg->common.sid.sat = 22; - test_msg->common.toe.tow = 446384; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 2.0; - test_msg->common.valid = 1; - test_msg->dn = 5.694522914022375e-09; - test_msg->ecc = 0.007072207052260637; - test_msg->inc = 0.9341514480259797; - test_msg->inc_dot = -4.035882396415757e-11; - test_msg->iodc = 45; - test_msg->iode = 45; - test_msg->m0 = -0.02200078842114688; - test_msg->omega0 = -1.8731818448797617; - test_msg->omegadot = -8.903585155774196e-09; - test_msg->sqrta = 5153.550029754639; - test_msg->tgd = -1.7695128917694092e-08; - test_msg->toc.tow = 446384; - test_msg->toc.wn = 2154; - test_msg->w = -0.9893036629599647; - sbp_payload_send(&sbp_state, 0x81, 123, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 123, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 123, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x81, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_gps_dep_e_t *check_msg = - (msg_ephemeris_gps_dep_e_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - -0.00063150189817 * 100) < 0.05, - "incorrect value for af0, expected -0.00063150189817, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - 8.98126018001e-12 * 100) < 0.05, - "incorrect value for af1, expected 8.98126018001e-12, is %f", - check_msg->af1); - ck_assert_msg((check_msg->af2 * 100 - 0.0 * 100) < 0.05, - "incorrect value for af2, expected 0.0, is %f", - check_msg->af2); - ck_assert_msg((check_msg->c_ic * 100 - 7.45058059692e-09 * 100) < 0.05, - "incorrect value for c_ic, expected 7.45058059692e-09, is %f", - check_msg->c_ic); - ck_assert_msg( - (check_msg->c_is * 100 - -1.15483999252e-07 * 100) < 0.05, - "incorrect value for c_is, expected -1.15483999252e-07, is %f", - check_msg->c_is); - ck_assert_msg((check_msg->c_rc * 100 - 308.625 * 100) < 0.05, - "incorrect value for c_rc, expected 308.625, is %f", - check_msg->c_rc); - ck_assert_msg((check_msg->c_rs * 100 - -52.3125 * 100) < 0.05, - "incorrect value for c_rs, expected -52.3125, is %f", - check_msg->c_rs); - ck_assert_msg( - (check_msg->c_uc * 100 - -2.74367630482e-06 * 100) < 0.05, - "incorrect value for c_uc, expected -2.74367630482e-06, is %f", - check_msg->c_uc); - ck_assert_msg((check_msg->c_us * 100 - 3.1366944313e-06 * 100) < 0.05, - "incorrect value for c_us, expected 3.1366944313e-06, is %f", - check_msg->c_us); - ck_assert_msg( - check_msg->common.fit_interval == 14400, - "incorrect value for common.fit_interval, expected 14400, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 0, - "incorrect value for common.sid.code, expected 0, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.reserved == 0, - "incorrect value for common.sid.reserved, expected 0, is %d", - check_msg->common.sid.reserved); - ck_assert_msg(check_msg->common.sid.sat == 22, - "incorrect value for common.sid.sat, expected 22, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toe.tow == 446384, - "incorrect value for common.toe.tow, expected 446384, is %d", - check_msg->common.toe.tow); - ck_assert_msg(check_msg->common.toe.wn == 2154, - "incorrect value for common.toe.wn, expected 2154, is %d", - check_msg->common.toe.wn); - ck_assert_msg((check_msg->common.ura * 100 - 2.0 * 100) < 0.05, - "incorrect value for common.ura, expected 2.0, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg((check_msg->dn * 100 - 5.69452291402e-09 * 100) < 0.05, - "incorrect value for dn, expected 5.69452291402e-09, is %f", - check_msg->dn); - ck_assert_msg((check_msg->ecc * 100 - 0.00707220705226 * 100) < 0.05, - "incorrect value for ecc, expected 0.00707220705226, is %f", - check_msg->ecc); - ck_assert_msg((check_msg->inc * 100 - 0.934151448026 * 100) < 0.05, - "incorrect value for inc, expected 0.934151448026, is %f", - check_msg->inc); - ck_assert_msg( - (check_msg->inc_dot * 100 - -4.03588239642e-11 * 100) < 0.05, - "incorrect value for inc_dot, expected -4.03588239642e-11, is %f", - check_msg->inc_dot); - ck_assert_msg(check_msg->iodc == 45, - "incorrect value for iodc, expected 45, is %d", - check_msg->iodc); - ck_assert_msg(check_msg->iode == 45, - "incorrect value for iode, expected 45, is %d", - check_msg->iode); - ck_assert_msg((check_msg->m0 * 100 - -0.0220007884211 * 100) < 0.05, - "incorrect value for m0, expected -0.0220007884211, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - -1.87318184488 * 100) < 0.05, - "incorrect value for omega0, expected -1.87318184488, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -8.90358515577e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -8.90358515577e-09, is %f", - check_msg->omegadot); - ck_assert_msg((check_msg->sqrta * 100 - 5153.55002975 * 100) < 0.05, - "incorrect value for sqrta, expected 5153.55002975, is %f", - check_msg->sqrta); - ck_assert_msg((check_msg->tgd * 100 - -1.76951289177e-08 * 100) < 0.05, - "incorrect value for tgd, expected -1.76951289177e-08, is %f", - check_msg->tgd); - ck_assert_msg(check_msg->toc.tow == 446384, - "incorrect value for toc.tow, expected 446384, is %d", - check_msg->toc.tow); - ck_assert_msg(check_msg->toc.wn == 2154, - "incorrect value for toc.wn, expected 2154, is %d", - check_msg->toc.wn); - ck_assert_msg((check_msg->w * 100 - -0.98930366296 * 100) < 0.05, - "incorrect value for w, expected -0.98930366296, is %f", - check_msg->w); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgEphemerisGPSDepE_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgEphemerisGPSDepE"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgEphemerisGPSDepE"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgEphemerisGPSDepE); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGPSDepF.c b/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGPSDepF.c deleted file mode 100644 index e8b4f56361..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGPSDepF.c +++ /dev/null @@ -1,357 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGPSDepF.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgEphemerisGPSDepF) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x86, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x86, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 134, 0, 123, 0, 183, 22, 0, 176, 207, 6, 0, 106, 8, - 0, 0, 0, 0, 0, 0, 0, 64, 64, 56, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 83, 190, 0, 0, 0, 0, 0, 40, - 74, 192, 0, 0, 0, 0, 0, 74, 115, 64, 0, 0, 0, 0, - 0, 4, 199, 190, 0, 0, 0, 0, 0, 80, 202, 62, 0, 0, - 0, 0, 0, 0, 64, 62, 0, 0, 0, 0, 0, 0, 127, 190, - 114, 216, 96, 180, 49, 117, 56, 62, 142, 41, 5, 235, 95, 135, - 150, 191, 0, 0, 0, 32, 191, 247, 124, 63, 0, 0, 192, 206, - 140, 33, 180, 64, 41, 131, 179, 134, 141, 248, 253, 191, 227, 133, - 81, 54, 204, 30, 67, 190, 216, 59, 199, 39, 96, 168, 239, 191, - 71, 11, 217, 147, 145, 228, 237, 63, 221, 47, 100, 224, 255, 47, - 198, 189, 0, 0, 0, 0, 108, 177, 68, 191, 0, 0, 0, 0, - 0, 192, 163, 61, 0, 0, 0, 0, 0, 0, 0, 0, 176, 207, - 6, 0, 106, 8, 45, 45, 0, 115, 254, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_gps_dep_f_t *test_msg = - (msg_ephemeris_gps_dep_f_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = -0.0006315018981695175; - test_msg->af1 = 8.981260180007666e-12; - test_msg->af2 = 0.0; - test_msg->c_ic = 7.450580596923828e-09; - test_msg->c_is = -1.1548399925231934e-07; - test_msg->c_rc = 308.625; - test_msg->c_rs = -52.3125; - test_msg->c_uc = -2.7436763048171997e-06; - test_msg->c_us = 3.1366944313049316e-06; - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 0; - test_msg->common.sid.sat = 22; - test_msg->common.toe.tow = 446384; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 2.0; - test_msg->common.valid = 1; - test_msg->dn = 5.694522914022375e-09; - test_msg->ecc = 0.007072207052260637; - test_msg->inc = 0.9341514480259797; - test_msg->inc_dot = -4.035882396415757e-11; - test_msg->iodc = 45; - test_msg->iode = 45; - test_msg->m0 = -0.02200078842114688; - test_msg->omega0 = -1.8731818448797617; - test_msg->omegadot = -8.903585155774196e-09; - test_msg->sqrta = 5153.550029754639; - test_msg->tgd = -1.7695128917694092e-08; - test_msg->toc.tow = 446384; - test_msg->toc.wn = 2154; - test_msg->w = -0.9893036629599647; - sbp_payload_send(&sbp_state, 0x86, 123, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 123, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 123, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x86, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_gps_dep_f_t *check_msg = - (msg_ephemeris_gps_dep_f_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - -0.00063150189817 * 100) < 0.05, - "incorrect value for af0, expected -0.00063150189817, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - 8.98126018001e-12 * 100) < 0.05, - "incorrect value for af1, expected 8.98126018001e-12, is %f", - check_msg->af1); - ck_assert_msg((check_msg->af2 * 100 - 0.0 * 100) < 0.05, - "incorrect value for af2, expected 0.0, is %f", - check_msg->af2); - ck_assert_msg((check_msg->c_ic * 100 - 7.45058059692e-09 * 100) < 0.05, - "incorrect value for c_ic, expected 7.45058059692e-09, is %f", - check_msg->c_ic); - ck_assert_msg( - (check_msg->c_is * 100 - -1.15483999252e-07 * 100) < 0.05, - "incorrect value for c_is, expected -1.15483999252e-07, is %f", - check_msg->c_is); - ck_assert_msg((check_msg->c_rc * 100 - 308.625 * 100) < 0.05, - "incorrect value for c_rc, expected 308.625, is %f", - check_msg->c_rc); - ck_assert_msg((check_msg->c_rs * 100 - -52.3125 * 100) < 0.05, - "incorrect value for c_rs, expected -52.3125, is %f", - check_msg->c_rs); - ck_assert_msg( - (check_msg->c_uc * 100 - -2.74367630482e-06 * 100) < 0.05, - "incorrect value for c_uc, expected -2.74367630482e-06, is %f", - check_msg->c_uc); - ck_assert_msg((check_msg->c_us * 100 - 3.1366944313e-06 * 100) < 0.05, - "incorrect value for c_us, expected 3.1366944313e-06, is %f", - check_msg->c_us); - ck_assert_msg( - check_msg->common.fit_interval == 14400, - "incorrect value for common.fit_interval, expected 14400, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 0, - "incorrect value for common.sid.code, expected 0, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.sat == 22, - "incorrect value for common.sid.sat, expected 22, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toe.tow == 446384, - "incorrect value for common.toe.tow, expected 446384, is %d", - check_msg->common.toe.tow); - ck_assert_msg(check_msg->common.toe.wn == 2154, - "incorrect value for common.toe.wn, expected 2154, is %d", - check_msg->common.toe.wn); - ck_assert_msg((check_msg->common.ura * 100 - 2.0 * 100) < 0.05, - "incorrect value for common.ura, expected 2.0, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg((check_msg->dn * 100 - 5.69452291402e-09 * 100) < 0.05, - "incorrect value for dn, expected 5.69452291402e-09, is %f", - check_msg->dn); - ck_assert_msg((check_msg->ecc * 100 - 0.00707220705226 * 100) < 0.05, - "incorrect value for ecc, expected 0.00707220705226, is %f", - check_msg->ecc); - ck_assert_msg((check_msg->inc * 100 - 0.934151448026 * 100) < 0.05, - "incorrect value for inc, expected 0.934151448026, is %f", - check_msg->inc); - ck_assert_msg( - (check_msg->inc_dot * 100 - -4.03588239642e-11 * 100) < 0.05, - "incorrect value for inc_dot, expected -4.03588239642e-11, is %f", - check_msg->inc_dot); - ck_assert_msg(check_msg->iodc == 45, - "incorrect value for iodc, expected 45, is %d", - check_msg->iodc); - ck_assert_msg(check_msg->iode == 45, - "incorrect value for iode, expected 45, is %d", - check_msg->iode); - ck_assert_msg((check_msg->m0 * 100 - -0.0220007884211 * 100) < 0.05, - "incorrect value for m0, expected -0.0220007884211, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - -1.87318184488 * 100) < 0.05, - "incorrect value for omega0, expected -1.87318184488, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -8.90358515577e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -8.90358515577e-09, is %f", - check_msg->omegadot); - ck_assert_msg((check_msg->sqrta * 100 - 5153.55002975 * 100) < 0.05, - "incorrect value for sqrta, expected 5153.55002975, is %f", - check_msg->sqrta); - ck_assert_msg((check_msg->tgd * 100 - -1.76951289177e-08 * 100) < 0.05, - "incorrect value for tgd, expected -1.76951289177e-08, is %f", - check_msg->tgd); - ck_assert_msg(check_msg->toc.tow == 446384, - "incorrect value for toc.tow, expected 446384, is %d", - check_msg->toc.tow); - ck_assert_msg(check_msg->toc.wn == 2154, - "incorrect value for toc.wn, expected 2154, is %d", - check_msg->toc.wn); - ck_assert_msg((check_msg->w * 100 - -0.98930366296 * 100) < 0.05, - "incorrect value for w, expected -0.98930366296, is %f", - check_msg->w); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgEphemerisGPSDepF_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgEphemerisGPSDepF"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgEphemerisGPSDepF"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgEphemerisGPSDepF); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGal.c b/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGal.c deleted file mode 100644 index 4ff78266a9..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGal.c +++ /dev/null @@ -1,365 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGal.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgEphemerisGal) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x8d, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x8d, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 141, 0, 128, 240, 153, 27, 14, 32, 217, 6, 0, 106, 8, - 20, 174, 71, 64, 64, 56, 0, 0, 1, 0, 0, 0, 16, 49, - 0, 0, 16, 49, 0, 0, 34, 65, 0, 184, 132, 67, 0, 0, - 16, 53, 0, 0, 134, 54, 0, 0, 8, 179, 0, 0, 8, 179, - 217, 204, 130, 105, 128, 182, 43, 62, 248, 106, 31, 220, 8, 136, - 253, 191, 0, 0, 0, 0, 151, 92, 38, 63, 0, 0, 0, 55, - 154, 64, 181, 64, 56, 38, 1, 141, 255, 182, 242, 63, 222, 147, - 136, 39, 79, 186, 56, 190, 80, 114, 204, 251, 193, 92, 191, 63, - 237, 55, 19, 41, 177, 73, 239, 63, 49, 65, 189, 240, 8, 216, - 245, 189, 255, 255, 255, 255, 67, 235, 241, 190, 255, 255, 255, 255, - 255, 255, 161, 189, 0, 0, 0, 0, 32, 217, 6, 0, 106, 8, - 108, 0, 108, 0, 0, 71, 208, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_gal_t *test_msg = (msg_ephemeris_gal_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = -1.7088896129280325e-05; - test_msg->af1 = -8.185452315956353e-12; - test_msg->af2 = 0.0; - test_msg->bgd_e1e5a = 2.0954757928848267e-09; - test_msg->bgd_e1e5b = 2.0954757928848267e-09; - test_msg->c_ic = -3.166496753692627e-08; - test_msg->c_is = -3.166496753692627e-08; - test_msg->c_rc = 265.4375; - test_msg->c_rs = 10.125; - test_msg->c_uc = 5.364418029785156e-07; - test_msg->c_us = 3.993511199951172e-06; - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 14; - test_msg->common.sid.sat = 27; - test_msg->common.toe.tow = 448800; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 3.119999885559082; - test_msg->common.valid = 1; - test_msg->dn = 3.2262058129932258e-09; - test_msg->ecc = 0.00017060607206076384; - test_msg->inc = 0.9777456094977858; - test_msg->inc_dot = -3.1787038343451465e-10; - test_msg->iodc = 108; - test_msg->iode = 108; - test_msg->m0 = -1.8457115744155868; - test_msg->omega0 = 1.16967730598334; - test_msg->omegadot = -5.757382675240872e-09; - test_msg->source = 0; - test_msg->sqrta = 5440.602401733398; - test_msg->toc.tow = 448800; - test_msg->toc.wn = 2154; - test_msg->w = 0.12250912091662625; - sbp_payload_send(&sbp_state, 0x8d, 61568, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 61568, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 61568, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x8d, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_gal_t *check_msg = - (msg_ephemeris_gal_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - -1.70888961293e-05 * 100) < 0.05, - "incorrect value for af0, expected -1.70888961293e-05, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - -8.18545231596e-12 * 100) < 0.05, - "incorrect value for af1, expected -8.18545231596e-12, is %f", - check_msg->af1); - ck_assert_msg((check_msg->af2 * 100 - 0.0 * 100) < 0.05, - "incorrect value for af2, expected 0.0, is %f", - check_msg->af2); - ck_assert_msg( - (check_msg->bgd_e1e5a * 100 - 2.09547579288e-09 * 100) < 0.05, - "incorrect value for bgd_e1e5a, expected 2.09547579288e-09, is %f", - check_msg->bgd_e1e5a); - ck_assert_msg( - (check_msg->bgd_e1e5b * 100 - 2.09547579288e-09 * 100) < 0.05, - "incorrect value for bgd_e1e5b, expected 2.09547579288e-09, is %f", - check_msg->bgd_e1e5b); - ck_assert_msg( - (check_msg->c_ic * 100 - -3.16649675369e-08 * 100) < 0.05, - "incorrect value for c_ic, expected -3.16649675369e-08, is %f", - check_msg->c_ic); - ck_assert_msg( - (check_msg->c_is * 100 - -3.16649675369e-08 * 100) < 0.05, - "incorrect value for c_is, expected -3.16649675369e-08, is %f", - check_msg->c_is); - ck_assert_msg((check_msg->c_rc * 100 - 265.4375 * 100) < 0.05, - "incorrect value for c_rc, expected 265.4375, is %f", - check_msg->c_rc); - ck_assert_msg((check_msg->c_rs * 100 - 10.125 * 100) < 0.05, - "incorrect value for c_rs, expected 10.125, is %f", - check_msg->c_rs); - ck_assert_msg((check_msg->c_uc * 100 - 5.36441802979e-07 * 100) < 0.05, - "incorrect value for c_uc, expected 5.36441802979e-07, is %f", - check_msg->c_uc); - ck_assert_msg((check_msg->c_us * 100 - 3.99351119995e-06 * 100) < 0.05, - "incorrect value for c_us, expected 3.99351119995e-06, is %f", - check_msg->c_us); - ck_assert_msg( - check_msg->common.fit_interval == 14400, - "incorrect value for common.fit_interval, expected 14400, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 14, - "incorrect value for common.sid.code, expected 14, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.sat == 27, - "incorrect value for common.sid.sat, expected 27, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toe.tow == 448800, - "incorrect value for common.toe.tow, expected 448800, is %d", - check_msg->common.toe.tow); - ck_assert_msg(check_msg->common.toe.wn == 2154, - "incorrect value for common.toe.wn, expected 2154, is %d", - check_msg->common.toe.wn); - ck_assert_msg( - (check_msg->common.ura * 100 - 3.11999988556 * 100) < 0.05, - "incorrect value for common.ura, expected 3.11999988556, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg((check_msg->dn * 100 - 3.22620581299e-09 * 100) < 0.05, - "incorrect value for dn, expected 3.22620581299e-09, is %f", - check_msg->dn); - ck_assert_msg((check_msg->ecc * 100 - 0.000170606072061 * 100) < 0.05, - "incorrect value for ecc, expected 0.000170606072061, is %f", - check_msg->ecc); - ck_assert_msg((check_msg->inc * 100 - 0.977745609498 * 100) < 0.05, - "incorrect value for inc, expected 0.977745609498, is %f", - check_msg->inc); - ck_assert_msg( - (check_msg->inc_dot * 100 - -3.17870383435e-10 * 100) < 0.05, - "incorrect value for inc_dot, expected -3.17870383435e-10, is %f", - check_msg->inc_dot); - ck_assert_msg(check_msg->iodc == 108, - "incorrect value for iodc, expected 108, is %d", - check_msg->iodc); - ck_assert_msg(check_msg->iode == 108, - "incorrect value for iode, expected 108, is %d", - check_msg->iode); - ck_assert_msg((check_msg->m0 * 100 - -1.84571157442 * 100) < 0.05, - "incorrect value for m0, expected -1.84571157442, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - 1.16967730598 * 100) < 0.05, - "incorrect value for omega0, expected 1.16967730598, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -5.75738267524e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -5.75738267524e-09, is %f", - check_msg->omegadot); - ck_assert_msg(check_msg->source == 0, - "incorrect value for source, expected 0, is %d", - check_msg->source); - ck_assert_msg((check_msg->sqrta * 100 - 5440.60240173 * 100) < 0.05, - "incorrect value for sqrta, expected 5440.60240173, is %f", - check_msg->sqrta); - ck_assert_msg(check_msg->toc.tow == 448800, - "incorrect value for toc.tow, expected 448800, is %d", - check_msg->toc.tow); - ck_assert_msg(check_msg->toc.wn == 2154, - "incorrect value for toc.wn, expected 2154, is %d", - check_msg->toc.wn); - ck_assert_msg((check_msg->w * 100 - 0.122509120917 * 100) < 0.05, - "incorrect value for w, expected 0.122509120917, is %f", - check_msg->w); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgEphemerisGal_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgEphemerisGal"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgEphemerisGal"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgEphemerisGal); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGalDepA.c b/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGalDepA.c deleted file mode 100644 index 293b40a43b..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisGalDepA.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGalDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgEphemerisGalDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x95, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x95, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 149, 0, 195, 4, 152, 27, 14, 32, 217, 6, 0, 106, 8, - 102, 102, 230, 64, 64, 56, 0, 0, 1, 0, 154, 153, 153, 63, - 205, 204, 12, 64, 0, 0, 34, 65, 0, 184, 132, 67, 102, 102, - 166, 64, 102, 102, 198, 64, 205, 204, 76, 64, 102, 102, 134, 64, - 217, 204, 130, 105, 128, 182, 43, 62, 248, 106, 31, 220, 8, 136, - 253, 191, 0, 0, 0, 0, 151, 92, 38, 63, 0, 0, 0, 55, - 154, 64, 181, 64, 56, 38, 1, 141, 255, 182, 242, 63, 222, 147, - 136, 39, 79, 186, 56, 190, 80, 114, 204, 251, 193, 92, 191, 63, - 237, 55, 19, 41, 177, 73, 239, 63, 49, 65, 189, 240, 8, 216, - 245, 189, 255, 255, 255, 255, 67, 235, 241, 190, 255, 255, 255, 255, - 255, 255, 161, 189, 205, 204, 76, 62, 32, 217, 6, 0, 106, 8, - 108, 0, 108, 0, 168, 49, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_gal_dep_a_t *test_msg = - (msg_ephemeris_gal_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = -1.7088896129280325e-05; - test_msg->af1 = -8.185452315956353e-12; - test_msg->af2 = 0.20000000298023224; - test_msg->bgd_e1e5a = 1.2000000476837158; - test_msg->bgd_e1e5b = 2.200000047683716; - test_msg->c_ic = 3.200000047683716; - test_msg->c_is = 4.199999809265137; - test_msg->c_rc = 265.4375; - test_msg->c_rs = 10.125; - test_msg->c_uc = 5.199999809265137; - test_msg->c_us = 6.199999809265137; - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 14; - test_msg->common.sid.sat = 27; - test_msg->common.toe.tow = 448800; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 7.199999809265137; - test_msg->common.valid = 1; - test_msg->dn = 3.2262058129932258e-09; - test_msg->ecc = 0.00017060607206076384; - test_msg->inc = 0.9777456094977858; - test_msg->inc_dot = -3.1787038343451465e-10; - test_msg->iodc = 108; - test_msg->iode = 108; - test_msg->m0 = -1.8457115744155868; - test_msg->omega0 = 1.16967730598334; - test_msg->omegadot = -5.757382675240872e-09; - test_msg->sqrta = 5440.602401733398; - test_msg->toc.tow = 448800; - test_msg->toc.wn = 2154; - test_msg->w = 0.12250912091662625; - sbp_payload_send(&sbp_state, 0x95, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x95, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_gal_dep_a_t *check_msg = - (msg_ephemeris_gal_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - -1.70888961293e-05 * 100) < 0.05, - "incorrect value for af0, expected -1.70888961293e-05, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - -8.18545231596e-12 * 100) < 0.05, - "incorrect value for af1, expected -8.18545231596e-12, is %f", - check_msg->af1); - ck_assert_msg((check_msg->af2 * 100 - 0.20000000298 * 100) < 0.05, - "incorrect value for af2, expected 0.20000000298, is %f", - check_msg->af2); - ck_assert_msg( - (check_msg->bgd_e1e5a * 100 - 1.20000004768 * 100) < 0.05, - "incorrect value for bgd_e1e5a, expected 1.20000004768, is %f", - check_msg->bgd_e1e5a); - ck_assert_msg( - (check_msg->bgd_e1e5b * 100 - 2.20000004768 * 100) < 0.05, - "incorrect value for bgd_e1e5b, expected 2.20000004768, is %f", - check_msg->bgd_e1e5b); - ck_assert_msg((check_msg->c_ic * 100 - 3.20000004768 * 100) < 0.05, - "incorrect value for c_ic, expected 3.20000004768, is %f", - check_msg->c_ic); - ck_assert_msg((check_msg->c_is * 100 - 4.19999980927 * 100) < 0.05, - "incorrect value for c_is, expected 4.19999980927, is %f", - check_msg->c_is); - ck_assert_msg((check_msg->c_rc * 100 - 265.4375 * 100) < 0.05, - "incorrect value for c_rc, expected 265.4375, is %f", - check_msg->c_rc); - ck_assert_msg((check_msg->c_rs * 100 - 10.125 * 100) < 0.05, - "incorrect value for c_rs, expected 10.125, is %f", - check_msg->c_rs); - ck_assert_msg((check_msg->c_uc * 100 - 5.19999980927 * 100) < 0.05, - "incorrect value for c_uc, expected 5.19999980927, is %f", - check_msg->c_uc); - ck_assert_msg((check_msg->c_us * 100 - 6.19999980927 * 100) < 0.05, - "incorrect value for c_us, expected 6.19999980927, is %f", - check_msg->c_us); - ck_assert_msg( - check_msg->common.fit_interval == 14400, - "incorrect value for common.fit_interval, expected 14400, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 14, - "incorrect value for common.sid.code, expected 14, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.sat == 27, - "incorrect value for common.sid.sat, expected 27, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toe.tow == 448800, - "incorrect value for common.toe.tow, expected 448800, is %d", - check_msg->common.toe.tow); - ck_assert_msg(check_msg->common.toe.wn == 2154, - "incorrect value for common.toe.wn, expected 2154, is %d", - check_msg->common.toe.wn); - ck_assert_msg( - (check_msg->common.ura * 100 - 7.19999980927 * 100) < 0.05, - "incorrect value for common.ura, expected 7.19999980927, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg((check_msg->dn * 100 - 3.22620581299e-09 * 100) < 0.05, - "incorrect value for dn, expected 3.22620581299e-09, is %f", - check_msg->dn); - ck_assert_msg((check_msg->ecc * 100 - 0.000170606072061 * 100) < 0.05, - "incorrect value for ecc, expected 0.000170606072061, is %f", - check_msg->ecc); - ck_assert_msg((check_msg->inc * 100 - 0.977745609498 * 100) < 0.05, - "incorrect value for inc, expected 0.977745609498, is %f", - check_msg->inc); - ck_assert_msg( - (check_msg->inc_dot * 100 - -3.17870383435e-10 * 100) < 0.05, - "incorrect value for inc_dot, expected -3.17870383435e-10, is %f", - check_msg->inc_dot); - ck_assert_msg(check_msg->iodc == 108, - "incorrect value for iodc, expected 108, is %d", - check_msg->iodc); - ck_assert_msg(check_msg->iode == 108, - "incorrect value for iode, expected 108, is %d", - check_msg->iode); - ck_assert_msg((check_msg->m0 * 100 - -1.84571157442 * 100) < 0.05, - "incorrect value for m0, expected -1.84571157442, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - 1.16967730598 * 100) < 0.05, - "incorrect value for omega0, expected 1.16967730598, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -5.75738267524e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -5.75738267524e-09, is %f", - check_msg->omegadot); - ck_assert_msg((check_msg->sqrta * 100 - 5440.60240173 * 100) < 0.05, - "incorrect value for sqrta, expected 5440.60240173, is %f", - check_msg->sqrta); - ck_assert_msg(check_msg->toc.tow == 448800, - "incorrect value for toc.tow, expected 448800, is %d", - check_msg->toc.tow); - ck_assert_msg(check_msg->toc.wn == 2154, - "incorrect value for toc.wn, expected 2154, is %d", - check_msg->toc.wn); - ck_assert_msg((check_msg->w * 100 - 0.122509120917 * 100) < 0.05, - "incorrect value for w, expected 0.122509120917, is %f", - check_msg->w); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgEphemerisGalDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgEphemerisGalDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgEphemerisGalDepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgEphemerisGalDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisSbas.c b/c/test/legacy/auto_check_sbp_observation_MsgEphemerisSbas.c deleted file mode 100644 index d101e3365e..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisSbas.c +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisSbas.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgEphemerisSbas) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x8c, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x8c, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 140, 0, 195, 4, 74, 22, 6, 176, 207, 6, 0, 106, 8, - 0, 0, 64, 177, 0, 0, 0, 0, 1, 0, 0, 0, 128, 66, - 246, 57, 103, 193, 0, 0, 0, 34, 170, 78, 34, 65, 0, 0, - 240, 199, 84, 86, 117, 193, 51, 208, 215, 196, 215, 233, 30, 197, - 86, 116, 89, 68, 0, 0, 122, 53, 0, 0, 122, 53, 0, 128, - 59, 54, 96, 139, 37, 186, 0, 0, 30, 45, 192, 147, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_sbas_t *test_msg = (msg_ephemeris_sbas_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->a_gf0 = -0.0006315018981695175; - test_msg->a_gf1 = 8.981260180007666e-12; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[0] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[1] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[2] = 2.7939677238464355e-06; - test_msg->common.fit_interval = 0; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 6; - test_msg->common.sid.sat = 22; - test_msg->common.toe.tow = 446384; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = -2.7939677238464355e-09; - test_msg->common.valid = 1; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[0] = -12177330.078125; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[1] = 599893.06640625; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[2] = -22373708.49609375; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[0] = -1726.5062255859375; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[1] = -2542.614990234375; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[2] = 869.8177490234375; - sbp_payload_send(&sbp_state, 0x8c, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x8c, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_sbas_t *check_msg = - (msg_ephemeris_sbas_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->a_gf0 * 100 - -0.00063150189817 * 100) < 0.05, - "incorrect value for a_gf0, expected -0.00063150189817, is %f", - check_msg->a_gf0); - ck_assert_msg( - (check_msg->a_gf1 * 100 - 8.98126018001e-12 * 100) < 0.05, - "incorrect value for a_gf1, expected 8.98126018001e-12, is %f", - check_msg->a_gf1); - ck_assert_msg( - (check_msg->acc[0] * 100 - 9.31322574615e-07 * 100) < 0.05, - "incorrect value for acc[0], expected 9.31322574615e-07, is %f", - check_msg->acc[0]); - ck_assert_msg( - (check_msg->acc[1] * 100 - 9.31322574615e-07 * 100) < 0.05, - "incorrect value for acc[1], expected 9.31322574615e-07, is %f", - check_msg->acc[1]); - ck_assert_msg( - (check_msg->acc[2] * 100 - 2.79396772385e-06 * 100) < 0.05, - "incorrect value for acc[2], expected 2.79396772385e-06, is %f", - check_msg->acc[2]); - ck_assert_msg(check_msg->common.fit_interval == 0, - "incorrect value for common.fit_interval, expected 0, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 6, - "incorrect value for common.sid.code, expected 6, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.sat == 22, - "incorrect value for common.sid.sat, expected 22, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toe.tow == 446384, - "incorrect value for common.toe.tow, expected 446384, is %d", - check_msg->common.toe.tow); - ck_assert_msg(check_msg->common.toe.wn == 2154, - "incorrect value for common.toe.wn, expected 2154, is %d", - check_msg->common.toe.wn); - ck_assert_msg( - (check_msg->common.ura * 100 - -2.79396772385e-09 * 100) < 0.05, - "incorrect value for common.ura, expected -2.79396772385e-09, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg((check_msg->pos[0] * 100 - -12177330.0781 * 100) < 0.05, - "incorrect value for pos[0], expected -12177330.0781, is %f", - check_msg->pos[0]); - ck_assert_msg((check_msg->pos[1] * 100 - 599893.066406 * 100) < 0.05, - "incorrect value for pos[1], expected 599893.066406, is %f", - check_msg->pos[1]); - ck_assert_msg((check_msg->pos[2] * 100 - -22373708.4961 * 100) < 0.05, - "incorrect value for pos[2], expected -22373708.4961, is %f", - check_msg->pos[2]); - ck_assert_msg((check_msg->vel[0] * 100 - -1726.50622559 * 100) < 0.05, - "incorrect value for vel[0], expected -1726.50622559, is %f", - check_msg->vel[0]); - ck_assert_msg((check_msg->vel[1] * 100 - -2542.61499023 * 100) < 0.05, - "incorrect value for vel[1], expected -2542.61499023, is %f", - check_msg->vel[1]); - ck_assert_msg((check_msg->vel[2] * 100 - 869.817749023 * 100) < 0.05, - "incorrect value for vel[2], expected 869.817749023, is %f", - check_msg->vel[2]); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgEphemerisSbas_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgEphemerisSbas"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgEphemerisSbas"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgEphemerisSbas); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisSbasDepA.c b/c/test/legacy/auto_check_sbp_observation_MsgEphemerisSbasDepA.c deleted file mode 100644 index 0b5d09394d..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisSbasDepA.c +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisSbasDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgEphemerisSbasDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x82, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x82, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 130, 0, 123, 0, 112, 22, 0, 6, 0, 176, 207, 6, 0, - 106, 8, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, - 1, 0, 0, 0, 128, 66, 246, 57, 103, 193, 0, 0, 0, 34, - 170, 78, 34, 65, 0, 0, 240, 199, 84, 86, 117, 193, 0, 0, - 0, 98, 6, 250, 154, 192, 0, 0, 0, 217, 58, 221, 163, 192, - 0, 0, 0, 184, 138, 46, 139, 64, 0, 0, 0, 0, 0, 64, - 175, 62, 0, 0, 0, 0, 0, 64, 175, 62, 0, 0, 0, 0, - 0, 112, 199, 62, 0, 0, 0, 0, 108, 177, 68, 191, 0, 0, - 0, 0, 0, 192, 163, 61, 178, 180, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_sbas_dep_a_t *test_msg = - (msg_ephemeris_sbas_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->a_gf0 = -0.0006315018981695175; - test_msg->a_gf1 = 8.981260180007666e-12; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[0] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[1] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[2] = 2.7939677238464355e-06; - test_msg->common.fit_interval = 0; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 6; - test_msg->common.sid.reserved = 0; - test_msg->common.sid.sat = 22; - test_msg->common.toe.tow = 446384; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 2.0; - test_msg->common.valid = 1; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[0] = -12177330.078125; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[1] = 599893.06640625; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[2] = -22373708.49609375; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[0] = -1726.506233215332; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[1] = -2542.6149368286133; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[2] = 869.8177337646484; - sbp_payload_send(&sbp_state, 0x82, 123, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 123, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 123, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x82, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_sbas_dep_a_t *check_msg = - (msg_ephemeris_sbas_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->a_gf0 * 100 - -0.00063150189817 * 100) < 0.05, - "incorrect value for a_gf0, expected -0.00063150189817, is %f", - check_msg->a_gf0); - ck_assert_msg( - (check_msg->a_gf1 * 100 - 8.98126018001e-12 * 100) < 0.05, - "incorrect value for a_gf1, expected 8.98126018001e-12, is %f", - check_msg->a_gf1); - ck_assert_msg( - (check_msg->acc[0] * 100 - 9.31322574615e-07 * 100) < 0.05, - "incorrect value for acc[0], expected 9.31322574615e-07, is %f", - check_msg->acc[0]); - ck_assert_msg( - (check_msg->acc[1] * 100 - 9.31322574615e-07 * 100) < 0.05, - "incorrect value for acc[1], expected 9.31322574615e-07, is %f", - check_msg->acc[1]); - ck_assert_msg( - (check_msg->acc[2] * 100 - 2.79396772385e-06 * 100) < 0.05, - "incorrect value for acc[2], expected 2.79396772385e-06, is %f", - check_msg->acc[2]); - ck_assert_msg(check_msg->common.fit_interval == 0, - "incorrect value for common.fit_interval, expected 0, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 6, - "incorrect value for common.sid.code, expected 6, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.reserved == 0, - "incorrect value for common.sid.reserved, expected 0, is %d", - check_msg->common.sid.reserved); - ck_assert_msg(check_msg->common.sid.sat == 22, - "incorrect value for common.sid.sat, expected 22, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toe.tow == 446384, - "incorrect value for common.toe.tow, expected 446384, is %d", - check_msg->common.toe.tow); - ck_assert_msg(check_msg->common.toe.wn == 2154, - "incorrect value for common.toe.wn, expected 2154, is %d", - check_msg->common.toe.wn); - ck_assert_msg((check_msg->common.ura * 100 - 2.0 * 100) < 0.05, - "incorrect value for common.ura, expected 2.0, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg((check_msg->pos[0] * 100 - -12177330.0781 * 100) < 0.05, - "incorrect value for pos[0], expected -12177330.0781, is %f", - check_msg->pos[0]); - ck_assert_msg((check_msg->pos[1] * 100 - 599893.066406 * 100) < 0.05, - "incorrect value for pos[1], expected 599893.066406, is %f", - check_msg->pos[1]); - ck_assert_msg((check_msg->pos[2] * 100 - -22373708.4961 * 100) < 0.05, - "incorrect value for pos[2], expected -22373708.4961, is %f", - check_msg->pos[2]); - ck_assert_msg((check_msg->vel[0] * 100 - -1726.50623322 * 100) < 0.05, - "incorrect value for vel[0], expected -1726.50623322, is %f", - check_msg->vel[0]); - ck_assert_msg((check_msg->vel[1] * 100 - -2542.61493683 * 100) < 0.05, - "incorrect value for vel[1], expected -2542.61493683, is %f", - check_msg->vel[1]); - ck_assert_msg((check_msg->vel[2] * 100 - 869.817733765 * 100) < 0.05, - "incorrect value for vel[2], expected 869.817733765, is %f", - check_msg->vel[2]); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgEphemerisSbasDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgEphemerisSbasDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgEphemerisSbasDepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgEphemerisSbasDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisSbasDepB.c b/c/test/legacy/auto_check_sbp_observation_MsgEphemerisSbasDepB.c deleted file mode 100644 index 18c35839f4..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgEphemerisSbasDepB.c +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisSbasDepB.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgEphemerisSbasDepB) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x84, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x84, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 132, 0, 123, 0, 110, 22, 6, 176, 207, 6, 0, 106, 8, - 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 1, 0, - 0, 0, 128, 66, 246, 57, 103, 193, 0, 0, 0, 34, 170, 78, - 34, 65, 0, 0, 240, 199, 84, 86, 117, 193, 0, 0, 0, 98, - 6, 250, 154, 192, 0, 0, 0, 217, 58, 221, 163, 192, 0, 0, - 0, 184, 138, 46, 139, 64, 0, 0, 0, 0, 0, 64, 175, 62, - 0, 0, 0, 0, 0, 64, 175, 62, 0, 0, 0, 0, 0, 112, - 199, 62, 0, 0, 0, 0, 108, 177, 68, 191, 0, 0, 0, 0, - 0, 192, 163, 61, 145, 104, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_sbas_dep_b_t *test_msg = - (msg_ephemeris_sbas_dep_b_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->a_gf0 = -0.0006315018981695175; - test_msg->a_gf1 = 8.981260180007666e-12; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[0] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[1] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->acc[0]); - } - test_msg->acc[2] = 2.7939677238464355e-06; - test_msg->common.fit_interval = 0; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 6; - test_msg->common.sid.sat = 22; - test_msg->common.toe.tow = 446384; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 2.0; - test_msg->common.valid = 1; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[0] = -12177330.078125; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[1] = 599893.06640625; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->pos[0]); - } - test_msg->pos[2] = -22373708.49609375; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[0] = -1726.506233215332; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[1] = -2542.6149368286133; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->vel[0]); - } - test_msg->vel[2] = 869.8177337646484; - sbp_payload_send(&sbp_state, 0x84, 123, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 123, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 123, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x84, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_sbas_dep_b_t *check_msg = - (msg_ephemeris_sbas_dep_b_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->a_gf0 * 100 - -0.00063150189817 * 100) < 0.05, - "incorrect value for a_gf0, expected -0.00063150189817, is %f", - check_msg->a_gf0); - ck_assert_msg( - (check_msg->a_gf1 * 100 - 8.98126018001e-12 * 100) < 0.05, - "incorrect value for a_gf1, expected 8.98126018001e-12, is %f", - check_msg->a_gf1); - ck_assert_msg( - (check_msg->acc[0] * 100 - 9.31322574615e-07 * 100) < 0.05, - "incorrect value for acc[0], expected 9.31322574615e-07, is %f", - check_msg->acc[0]); - ck_assert_msg( - (check_msg->acc[1] * 100 - 9.31322574615e-07 * 100) < 0.05, - "incorrect value for acc[1], expected 9.31322574615e-07, is %f", - check_msg->acc[1]); - ck_assert_msg( - (check_msg->acc[2] * 100 - 2.79396772385e-06 * 100) < 0.05, - "incorrect value for acc[2], expected 2.79396772385e-06, is %f", - check_msg->acc[2]); - ck_assert_msg(check_msg->common.fit_interval == 0, - "incorrect value for common.fit_interval, expected 0, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 6, - "incorrect value for common.sid.code, expected 6, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.sat == 22, - "incorrect value for common.sid.sat, expected 22, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toe.tow == 446384, - "incorrect value for common.toe.tow, expected 446384, is %d", - check_msg->common.toe.tow); - ck_assert_msg(check_msg->common.toe.wn == 2154, - "incorrect value for common.toe.wn, expected 2154, is %d", - check_msg->common.toe.wn); - ck_assert_msg((check_msg->common.ura * 100 - 2.0 * 100) < 0.05, - "incorrect value for common.ura, expected 2.0, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 1, - "incorrect value for common.valid, expected 1, is %d", - check_msg->common.valid); - ck_assert_msg((check_msg->pos[0] * 100 - -12177330.0781 * 100) < 0.05, - "incorrect value for pos[0], expected -12177330.0781, is %f", - check_msg->pos[0]); - ck_assert_msg((check_msg->pos[1] * 100 - 599893.066406 * 100) < 0.05, - "incorrect value for pos[1], expected 599893.066406, is %f", - check_msg->pos[1]); - ck_assert_msg((check_msg->pos[2] * 100 - -22373708.4961 * 100) < 0.05, - "incorrect value for pos[2], expected -22373708.4961, is %f", - check_msg->pos[2]); - ck_assert_msg((check_msg->vel[0] * 100 - -1726.50623322 * 100) < 0.05, - "incorrect value for vel[0], expected -1726.50623322, is %f", - check_msg->vel[0]); - ck_assert_msg((check_msg->vel[1] * 100 - -2542.61493683 * 100) < 0.05, - "incorrect value for vel[1], expected -2542.61493683, is %f", - check_msg->vel[1]); - ck_assert_msg((check_msg->vel[2] * 100 - 869.817733765 * 100) < 0.05, - "incorrect value for vel[2], expected 869.817733765, is %f", - check_msg->vel[2]); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgEphemerisSbasDepB_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgEphemerisSbasDepB"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgEphemerisSbasDepB"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgEphemerisSbasDepB); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgGloBiases.c b/c/test/legacy/auto_check_sbp_observation_MsgGloBiases.c deleted file mode 100644 index c4c271be13..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgGloBiases.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgGloBiases.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgGloBiases) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x75, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x75, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 117, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 211, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_glo_biases_t *test_msg = (msg_glo_biases_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->l1ca_bias = 0; - test_msg->l1p_bias = 0; - test_msg->l2ca_bias = 0; - test_msg->l2p_bias = 0; - test_msg->mask = 0; - sbp_payload_send(&sbp_state, 0x75, 0, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 0, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 0, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x75, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_glo_biases_t *check_msg = (msg_glo_biases_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->l1ca_bias == 0, - "incorrect value for l1ca_bias, expected 0, is %d", - check_msg->l1ca_bias); - ck_assert_msg(check_msg->l1p_bias == 0, - "incorrect value for l1p_bias, expected 0, is %d", - check_msg->l1p_bias); - ck_assert_msg(check_msg->l2ca_bias == 0, - "incorrect value for l2ca_bias, expected 0, is %d", - check_msg->l2ca_bias); - ck_assert_msg(check_msg->l2p_bias == 0, - "incorrect value for l2p_bias, expected 0, is %d", - check_msg->l2p_bias); - ck_assert_msg(check_msg->mask == 0, - "incorrect value for mask, expected 0, is %d", - check_msg->mask); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgGloBiases_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgGloBiases"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgGloBiases"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_observation_MsgGloBiases); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgGnssCapb.c b/c/test/legacy/auto_check_sbp_observation_MsgGnssCapb.c deleted file mode 100644 index 909f60b525..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgGnssCapb.c +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgGnssCapb.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgGnssCapb) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x96, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x96, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 150, 0, 123, 0, 110, 176, 207, 6, 0, 106, 8, 26, 171, 80, - 64, 0, 0, 0, 0, 81, 173, 144, 46, 0, 0, 0, 0, 209, 139, - 93, 108, 0, 0, 0, 0, 252, 204, 200, 0, 205, 92, 30, 49, 240, - 203, 21, 24, 212, 93, 182, 32, 0, 0, 0, 0, 105, 32, 192, 27, - 0, 0, 0, 0, 40, 75, 250, 114, 0, 0, 0, 0, 119, 147, 123, - 81, 0, 0, 0, 0, 85, 89, 4, 2, 0, 0, 0, 0, 233, 116, - 137, 22, 0, 0, 0, 0, 199, 109, 219, 11, 221, 171, 248, 82, 0, - 0, 0, 0, 252, 62, 221, 28, 0, 0, 0, 0, 163, 90, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gnss_capb_t *test_msg = (msg_gnss_capb_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->gc.bds_active = 1929005864; - test_msg->gc.bds_b2 = 33839445; - test_msg->gc.bds_b2a = 378107113; - test_msg->gc.bds_d2nav = 1367053175; - test_msg->gc.gal_active = 1392028637; - test_msg->gc.gal_e5 = 484261628; - test_msg->gc.glo_active = 13159676; - test_msg->gc.glo_l2of = 824073421; - test_msg->gc.glo_l3 = 404081648; - test_msg->gc.gps_active = 1079028506; - test_msg->gc.gps_l2c = 781233489; - test_msg->gc.gps_l5 = 1818069969; - test_msg->gc.qzss_active = 198929863; - test_msg->gc.sbas_active = 548822484; - test_msg->gc.sbas_l5 = 465576041; - test_msg->t_nmct.tow = 446384; - test_msg->t_nmct.wn = 2154; - sbp_payload_send(&sbp_state, 0x96, 123, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 123, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 123, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x96, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gnss_capb_t *check_msg = (msg_gnss_capb_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - check_msg->gc.bds_active == 1929005864, - "incorrect value for gc.bds_active, expected 1929005864, is %d", - check_msg->gc.bds_active); - ck_assert_msg(check_msg->gc.bds_b2 == 33839445, - "incorrect value for gc.bds_b2, expected 33839445, is %d", - check_msg->gc.bds_b2); - ck_assert_msg(check_msg->gc.bds_b2a == 378107113, - "incorrect value for gc.bds_b2a, expected 378107113, is %d", - check_msg->gc.bds_b2a); - ck_assert_msg( - check_msg->gc.bds_d2nav == 1367053175, - "incorrect value for gc.bds_d2nav, expected 1367053175, is %d", - check_msg->gc.bds_d2nav); - ck_assert_msg( - check_msg->gc.gal_active == 1392028637, - "incorrect value for gc.gal_active, expected 1392028637, is %d", - check_msg->gc.gal_active); - ck_assert_msg(check_msg->gc.gal_e5 == 484261628, - "incorrect value for gc.gal_e5, expected 484261628, is %d", - check_msg->gc.gal_e5); - ck_assert_msg(check_msg->gc.glo_active == 13159676, - "incorrect value for gc.glo_active, expected 13159676, is %d", - check_msg->gc.glo_active); - ck_assert_msg(check_msg->gc.glo_l2of == 824073421, - "incorrect value for gc.glo_l2of, expected 824073421, is %d", - check_msg->gc.glo_l2of); - ck_assert_msg(check_msg->gc.glo_l3 == 404081648, - "incorrect value for gc.glo_l3, expected 404081648, is %d", - check_msg->gc.glo_l3); - ck_assert_msg( - check_msg->gc.gps_active == 1079028506, - "incorrect value for gc.gps_active, expected 1079028506, is %d", - check_msg->gc.gps_active); - ck_assert_msg(check_msg->gc.gps_l2c == 781233489, - "incorrect value for gc.gps_l2c, expected 781233489, is %d", - check_msg->gc.gps_l2c); - ck_assert_msg(check_msg->gc.gps_l5 == 1818069969, - "incorrect value for gc.gps_l5, expected 1818069969, is %d", - check_msg->gc.gps_l5); - ck_assert_msg( - check_msg->gc.qzss_active == 198929863, - "incorrect value for gc.qzss_active, expected 198929863, is %d", - check_msg->gc.qzss_active); - ck_assert_msg( - check_msg->gc.sbas_active == 548822484, - "incorrect value for gc.sbas_active, expected 548822484, is %d", - check_msg->gc.sbas_active); - ck_assert_msg(check_msg->gc.sbas_l5 == 465576041, - "incorrect value for gc.sbas_l5, expected 465576041, is %d", - check_msg->gc.sbas_l5); - ck_assert_msg(check_msg->t_nmct.tow == 446384, - "incorrect value for t_nmct.tow, expected 446384, is %d", - check_msg->t_nmct.tow); - ck_assert_msg(check_msg->t_nmct.wn == 2154, - "incorrect value for t_nmct.wn, expected 2154, is %d", - check_msg->t_nmct.wn); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgGnssCapb_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgGnssCapb"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgGnssCapb"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_observation_MsgGnssCapb); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgGroupDelay.c b/c/test/legacy/auto_check_sbp_observation_MsgGroupDelay.c deleted file mode 100644 index 7ed678ed57..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgGroupDelay.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgGroupDelay.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgGroupDelay) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x94, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x94, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 148, 0, 123, 0, 15, 176, 207, 6, 0, 106, 8, - 22, 0, 1, 254, 253, 165, 255, 237, 23, 2, 201, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_group_delay_t *test_msg = (msg_group_delay_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->isc_l1ca = -91; - test_msg->isc_l2c = 6125; - test_msg->sid.code = 0; - test_msg->sid.sat = 22; - test_msg->t_op.tow = 446384; - test_msg->t_op.wn = 2154; - test_msg->tgd = -514; - test_msg->valid = 1; - sbp_payload_send(&sbp_state, 0x94, 123, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 123, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 123, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x94, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_group_delay_t *check_msg = (msg_group_delay_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->isc_l1ca == -91, - "incorrect value for isc_l1ca, expected -91, is %d", - check_msg->isc_l1ca); - ck_assert_msg(check_msg->isc_l2c == 6125, - "incorrect value for isc_l2c, expected 6125, is %d", - check_msg->isc_l2c); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.sat == 22, - "incorrect value for sid.sat, expected 22, is %d", - check_msg->sid.sat); - ck_assert_msg(check_msg->t_op.tow == 446384, - "incorrect value for t_op.tow, expected 446384, is %d", - check_msg->t_op.tow); - ck_assert_msg(check_msg->t_op.wn == 2154, - "incorrect value for t_op.wn, expected 2154, is %d", - check_msg->t_op.wn); - ck_assert_msg(check_msg->tgd == -514, - "incorrect value for tgd, expected -514, is %d", - check_msg->tgd); - ck_assert_msg(check_msg->valid == 1, - "incorrect value for valid, expected 1, is %d", - check_msg->valid); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgGroupDelay_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgGroupDelay"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgGroupDelay"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_observation_MsgGroupDelay); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgGroupDelayDepA.c b/c/test/legacy/auto_check_sbp_observation_MsgGroupDelayDepA.c deleted file mode 100644 index 32edb03ee6..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgGroupDelayDepA.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgGroupDelayDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgGroupDelayDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x92, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x92, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 146, 0, 123, 0, 14, 176, 207, 6, 0, 106, - 8, 22, 1, 254, 253, 165, 255, 237, 23, 162, 91, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_group_delay_dep_a_t *test_msg = - (msg_group_delay_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->isc_l1ca = -91; - test_msg->isc_l2c = 6125; - test_msg->prn = 22; - test_msg->t_op.tow = 446384; - test_msg->t_op.wn = 2154; - test_msg->tgd = -514; - test_msg->valid = 1; - sbp_payload_send(&sbp_state, 0x92, 123, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 123, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 123, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x92, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_group_delay_dep_a_t *check_msg = - (msg_group_delay_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->isc_l1ca == -91, - "incorrect value for isc_l1ca, expected -91, is %d", - check_msg->isc_l1ca); - ck_assert_msg(check_msg->isc_l2c == 6125, - "incorrect value for isc_l2c, expected 6125, is %d", - check_msg->isc_l2c); - ck_assert_msg(check_msg->prn == 22, - "incorrect value for prn, expected 22, is %d", - check_msg->prn); - ck_assert_msg(check_msg->t_op.tow == 446384, - "incorrect value for t_op.tow, expected 446384, is %d", - check_msg->t_op.tow); - ck_assert_msg(check_msg->t_op.wn == 2154, - "incorrect value for t_op.wn, expected 2154, is %d", - check_msg->t_op.wn); - ck_assert_msg(check_msg->tgd == -514, - "incorrect value for tgd, expected -514, is %d", - check_msg->tgd); - ck_assert_msg(check_msg->valid == 1, - "incorrect value for valid, expected 1, is %d", - check_msg->valid); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgGroupDelayDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgGroupDelayDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgGroupDelayDepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgGroupDelayDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgGroupDelayDepB.c b/c/test/legacy/auto_check_sbp_observation_MsgGroupDelayDepB.c deleted file mode 100644 index b6f39b4568..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgGroupDelayDepB.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgGroupDelayDepB.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgGroupDelayDepB) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x93, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x93, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 147, 0, 123, 0, 17, 176, 207, 6, 0, 106, 8, 22, - 0, 0, 0, 1, 254, 253, 165, 255, 237, 23, 221, 202, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_group_delay_dep_b_t *test_msg = - (msg_group_delay_dep_b_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->isc_l1ca = -91; - test_msg->isc_l2c = 6125; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 22; - test_msg->t_op.tow = 446384; - test_msg->t_op.wn = 2154; - test_msg->tgd = -514; - test_msg->valid = 1; - sbp_payload_send(&sbp_state, 0x93, 123, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 123, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 123, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x93, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_group_delay_dep_b_t *check_msg = - (msg_group_delay_dep_b_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->isc_l1ca == -91, - "incorrect value for isc_l1ca, expected -91, is %d", - check_msg->isc_l1ca); - ck_assert_msg(check_msg->isc_l2c == 6125, - "incorrect value for isc_l2c, expected 6125, is %d", - check_msg->isc_l2c); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 22, - "incorrect value for sid.sat, expected 22, is %d", - check_msg->sid.sat); - ck_assert_msg(check_msg->t_op.tow == 446384, - "incorrect value for t_op.tow, expected 446384, is %d", - check_msg->t_op.tow); - ck_assert_msg(check_msg->t_op.wn == 2154, - "incorrect value for t_op.wn, expected 2154, is %d", - check_msg->t_op.wn); - ck_assert_msg(check_msg->tgd == -514, - "incorrect value for tgd, expected -514, is %d", - check_msg->tgd); - ck_assert_msg(check_msg->valid == 1, - "incorrect value for valid, expected 1, is %d", - check_msg->valid); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgGroupDelayDepB_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgGroupDelayDepB"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgGroupDelayDepB"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_MsgGroupDelayDepB); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgIono.c b/c/test/legacy/auto_check_sbp_observation_MsgIono.c deleted file mode 100644 index 69e6e5efb6..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgIono.c +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgIono.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgIono) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x90, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x90, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 144, 0, 123, 0, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 52, 62, 0, 0, 0, 0, 0, 0, 80, 62, 0, 0, 0, 0, - 0, 0, 112, 190, 0, 0, 0, 0, 0, 0, 112, 190, 0, 0, 0, 0, - 0, 0, 243, 64, 0, 0, 0, 0, 0, 0, 232, 64, 0, 0, 0, 0, - 0, 0, 240, 192, 0, 0, 0, 0, 0, 0, 20, 193, 101, 31, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_iono_t *test_msg = (msg_iono_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->a0 = 4.6566128730773926e-09; - test_msg->a1 = 1.4901161193847656e-08; - test_msg->a2 = -5.960464477539063e-08; - test_msg->a3 = -5.960464477539063e-08; - test_msg->b0 = 77824.0; - test_msg->b1 = 49152.0; - test_msg->b2 = -65536.0; - test_msg->b3 = -327680.0; - test_msg->t_nmct.tow = 0; - test_msg->t_nmct.wn = 0; - sbp_payload_send(&sbp_state, 0x90, 123, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 123, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 123, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x90, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_iono_t *check_msg = (msg_iono_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->a0 * 100 - 4.65661287308e-09 * 100) < 0.05, - "incorrect value for a0, expected 4.65661287308e-09, is %f", - check_msg->a0); - ck_assert_msg((check_msg->a1 * 100 - 1.49011611938e-08 * 100) < 0.05, - "incorrect value for a1, expected 1.49011611938e-08, is %f", - check_msg->a1); - ck_assert_msg((check_msg->a2 * 100 - -5.96046447754e-08 * 100) < 0.05, - "incorrect value for a2, expected -5.96046447754e-08, is %f", - check_msg->a2); - ck_assert_msg((check_msg->a3 * 100 - -5.96046447754e-08 * 100) < 0.05, - "incorrect value for a3, expected -5.96046447754e-08, is %f", - check_msg->a3); - ck_assert_msg((check_msg->b0 * 100 - 77824.0 * 100) < 0.05, - "incorrect value for b0, expected 77824.0, is %f", - check_msg->b0); - ck_assert_msg((check_msg->b1 * 100 - 49152.0 * 100) < 0.05, - "incorrect value for b1, expected 49152.0, is %f", - check_msg->b1); - ck_assert_msg((check_msg->b2 * 100 - -65536.0 * 100) < 0.05, - "incorrect value for b2, expected -65536.0, is %f", - check_msg->b2); - ck_assert_msg((check_msg->b3 * 100 - -327680.0 * 100) < 0.05, - "incorrect value for b3, expected -327680.0, is %f", - check_msg->b3); - ck_assert_msg(check_msg->t_nmct.tow == 0, - "incorrect value for t_nmct.tow, expected 0, is %d", - check_msg->t_nmct.tow); - ck_assert_msg(check_msg->t_nmct.wn == 0, - "incorrect value for t_nmct.wn, expected 0, is %d", - check_msg->t_nmct.wn); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgIono_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_observation_MsgIono"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_observation_MsgIono"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_observation_MsgIono); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgObs.c b/c/test/legacy/auto_check_sbp_observation_MsgObs.c deleted file mode 100644 index fe58be3a26..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgObs.c +++ /dev/null @@ -1,961 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgObs.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgObs) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x4a, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x4a, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 74, 0, 129, 240, 249, 152, 202, 226, 25, 0, 0, 0, 0, - 106, 8, 32, 49, 227, 254, 62, 121, 242, 158, 6, 146, 0, 250, - 172, 182, 10, 15, 10, 0, 30, 228, 254, 62, 12, 189, 40, 5, - 59, 83, 251, 172, 178, 10, 15, 10, 1, 215, 205, 144, 72, 106, - 111, 160, 7, 243, 109, 243, 119, 158, 10, 15, 18, 0, 25, 207, - 144, 72, 223, 96, 241, 5, 12, 52, 246, 27, 125, 9, 11, 18, - 1, 34, 184, 223, 74, 150, 138, 222, 7, 53, 13, 11, 245, 114, - 9, 15, 22, 0, 113, 80, 6, 69, 162, 41, 65, 7, 70, 127, - 246, 246, 189, 9, 15, 23, 0, 247, 80, 6, 69, 213, 35, 167, - 5, 221, 152, 248, 231, 158, 9, 11, 23, 1, 8, 146, 166, 64, - 12, 122, 203, 6, 114, 51, 248, 67, 93, 3, 11, 27, 0, 221, - 172, 173, 75, 217, 47, 244, 7, 232, 225, 11, 237, 123, 5, 15, - 31, 0, 250, 174, 173, 75, 216, 163, 50, 6, 40, 70, 9, 62, - 120, 3, 11, 31, 1, 135, 16, 6, 66, 99, 218, 11, 7, 7, - 138, 242, 96, 176, 10, 15, 2, 3, 148, 130, 6, 58, 217, 88, - 54, 6, 203, 21, 252, 96, 170, 10, 15, 3, 3, 186, 108, 197, - 63, 127, 54, 211, 6, 80, 4, 241, 219, 200, 10, 15, 17, 3, - 167, 195, 8, 57, 19, 204, 22, 6, 105, 51, 254, 182, 152, 10, - 15, 18, 3, 237, 248, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_t* test_msg = (msg_obs_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.ns_residual = 0; - test_msg->header.t.tow = 434293400; - test_msg->header.t.wn = 2154; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].D.f = 172; - test_msg->obs[0].D.i = -1536; - test_msg->obs[0].L.f = 146; - test_msg->obs[0].L.i = 111080057; - test_msg->obs[0].P = 1056891697; - test_msg->obs[0].cn0 = 182; - test_msg->obs[0].flags = 15; - test_msg->obs[0].lock = 10; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.sat = 10; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[1].D.f = 172; - test_msg->obs[1].D.i = -1197; - test_msg->obs[1].L.f = 59; - test_msg->obs[1].L.i = 86555916; - test_msg->obs[1].P = 1056891934; - test_msg->obs[1].cn0 = 178; - test_msg->obs[1].flags = 15; - test_msg->obs[1].lock = 10; - test_msg->obs[1].sid.code = 1; - test_msg->obs[1].sid.sat = 10; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[2].D.f = 119; - test_msg->obs[2].D.i = -3219; - test_msg->obs[2].L.f = 243; - test_msg->obs[2].L.i = 127954794; - test_msg->obs[2].P = 1217449431; - test_msg->obs[2].cn0 = 158; - test_msg->obs[2].flags = 15; - test_msg->obs[2].lock = 10; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.sat = 18; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[3].D.f = 27; - test_msg->obs[3].D.i = -2508; - test_msg->obs[3].L.f = 12; - test_msg->obs[3].L.i = 99705055; - test_msg->obs[3].P = 1217449753; - test_msg->obs[3].cn0 = 125; - test_msg->obs[3].flags = 11; - test_msg->obs[3].lock = 9; - test_msg->obs[3].sid.code = 1; - test_msg->obs[3].sid.sat = 18; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[4].D.f = 245; - test_msg->obs[4].D.i = 2829; - test_msg->obs[4].L.f = 53; - test_msg->obs[4].L.i = 132024982; - test_msg->obs[4].P = 1256175650; - test_msg->obs[4].cn0 = 114; - test_msg->obs[4].flags = 15; - test_msg->obs[4].lock = 9; - test_msg->obs[4].sid.code = 0; - test_msg->obs[4].sid.sat = 22; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[5].D.f = 246; - test_msg->obs[5].D.i = -2433; - test_msg->obs[5].L.f = 70; - test_msg->obs[5].L.i = 121711010; - test_msg->obs[5].P = 1158041713; - test_msg->obs[5].cn0 = 189; - test_msg->obs[5].flags = 15; - test_msg->obs[5].lock = 9; - test_msg->obs[5].sid.code = 0; - test_msg->obs[5].sid.sat = 23; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[6].D.f = 231; - test_msg->obs[6].D.i = -1896; - test_msg->obs[6].L.f = 221; - test_msg->obs[6].L.i = 94839765; - test_msg->obs[6].P = 1158041847; - test_msg->obs[6].cn0 = 158; - test_msg->obs[6].flags = 11; - test_msg->obs[6].lock = 9; - test_msg->obs[6].sid.code = 1; - test_msg->obs[6].sid.sat = 23; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[7].D.f = 67; - test_msg->obs[7].D.i = -1997; - test_msg->obs[7].L.f = 114; - test_msg->obs[7].L.i = 113998348; - test_msg->obs[7].P = 1084658184; - test_msg->obs[7].cn0 = 93; - test_msg->obs[7].flags = 11; - test_msg->obs[7].lock = 3; - test_msg->obs[7].sid.code = 0; - test_msg->obs[7].sid.sat = 27; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[8].D.f = 237; - test_msg->obs[8].D.i = 3041; - test_msg->obs[8].L.f = 232; - test_msg->obs[8].L.i = 133443545; - test_msg->obs[8].P = 1269673181; - test_msg->obs[8].cn0 = 123; - test_msg->obs[8].flags = 15; - test_msg->obs[8].lock = 5; - test_msg->obs[8].sid.code = 0; - test_msg->obs[8].sid.sat = 31; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[9].D.f = 62; - test_msg->obs[9].D.i = 2374; - test_msg->obs[9].L.f = 40; - test_msg->obs[9].L.i = 103982040; - test_msg->obs[9].P = 1269673722; - test_msg->obs[9].cn0 = 120; - test_msg->obs[9].flags = 11; - test_msg->obs[9].lock = 3; - test_msg->obs[9].sid.code = 1; - test_msg->obs[9].sid.sat = 31; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[10].D.f = 96; - test_msg->obs[10].D.i = -3446; - test_msg->obs[10].L.f = 7; - test_msg->obs[10].L.i = 118217315; - test_msg->obs[10].P = 1107693703; - test_msg->obs[10].cn0 = 176; - test_msg->obs[10].flags = 15; - test_msg->obs[10].lock = 10; - test_msg->obs[10].sid.code = 3; - test_msg->obs[10].sid.sat = 2; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[11].D.f = 96; - test_msg->obs[11].D.i = -1003; - test_msg->obs[11].L.f = 203; - test_msg->obs[11].L.i = 104224985; - test_msg->obs[11].P = 973505172; - test_msg->obs[11].cn0 = 170; - test_msg->obs[11].flags = 15; - test_msg->obs[11].lock = 10; - test_msg->obs[11].sid.code = 3; - test_msg->obs[11].sid.sat = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[12].D.f = 219; - test_msg->obs[12].D.i = -3836; - test_msg->obs[12].L.f = 80; - test_msg->obs[12].L.i = 114505343; - test_msg->obs[12].P = 1069903034; - test_msg->obs[12].cn0 = 200; - test_msg->obs[12].flags = 15; - test_msg->obs[12].lock = 10; - test_msg->obs[12].sid.code = 3; - test_msg->obs[12].sid.sat = 17; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[13].D.f = 182; - test_msg->obs[13].D.i = -461; - test_msg->obs[13].L.f = 105; - test_msg->obs[13].L.i = 102157331; - test_msg->obs[13].P = 956875687; - test_msg->obs[13].cn0 = 152; - test_msg->obs[13].flags = 15; - test_msg->obs[13].lock = 10; - test_msg->obs[13].sid.code = 3; - test_msg->obs[13].sid.sat = 18; - sbp_payload_send(&sbp_state, 0x4a, 61569, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 61569, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 61569, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x4a, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_t* check_msg = (msg_obs_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 32, - "incorrect value for header.n_obs, expected 32, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.ns_residual == 0, - "incorrect value for header.t.ns_residual, expected 0, is %d", - check_msg->header.t.ns_residual); - ck_assert_msg(check_msg->header.t.tow == 434293400, - "incorrect value for header.t.tow, expected 434293400, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 2154, - "incorrect value for header.t.wn, expected 2154, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].D.f == 172, - "incorrect value for obs[0].D.f, expected 172, is %d", - check_msg->obs[0].D.f); - ck_assert_msg(check_msg->obs[0].D.i == -1536, - "incorrect value for obs[0].D.i, expected -1536, is %d", - check_msg->obs[0].D.i); - ck_assert_msg(check_msg->obs[0].L.f == 146, - "incorrect value for obs[0].L.f, expected 146, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == 111080057, - "incorrect value for obs[0].L.i, expected 111080057, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 1056891697, - "incorrect value for obs[0].P, expected 1056891697, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].cn0 == 182, - "incorrect value for obs[0].cn0, expected 182, is %d", - check_msg->obs[0].cn0); - ck_assert_msg(check_msg->obs[0].flags == 15, - "incorrect value for obs[0].flags, expected 15, is %d", - check_msg->obs[0].flags); - ck_assert_msg(check_msg->obs[0].lock == 10, - "incorrect value for obs[0].lock, expected 10, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].sid.code == 0, - "incorrect value for obs[0].sid.code, expected 0, is %d", - check_msg->obs[0].sid.code); - ck_assert_msg(check_msg->obs[0].sid.sat == 10, - "incorrect value for obs[0].sid.sat, expected 10, is %d", - check_msg->obs[0].sid.sat); - ck_assert_msg(check_msg->obs[1].D.f == 172, - "incorrect value for obs[1].D.f, expected 172, is %d", - check_msg->obs[1].D.f); - ck_assert_msg(check_msg->obs[1].D.i == -1197, - "incorrect value for obs[1].D.i, expected -1197, is %d", - check_msg->obs[1].D.i); - ck_assert_msg(check_msg->obs[1].L.f == 59, - "incorrect value for obs[1].L.f, expected 59, is %d", - check_msg->obs[1].L.f); - ck_assert_msg(check_msg->obs[1].L.i == 86555916, - "incorrect value for obs[1].L.i, expected 86555916, is %d", - check_msg->obs[1].L.i); - ck_assert_msg(check_msg->obs[1].P == 1056891934, - "incorrect value for obs[1].P, expected 1056891934, is %d", - check_msg->obs[1].P); - ck_assert_msg(check_msg->obs[1].cn0 == 178, - "incorrect value for obs[1].cn0, expected 178, is %d", - check_msg->obs[1].cn0); - ck_assert_msg(check_msg->obs[1].flags == 15, - "incorrect value for obs[1].flags, expected 15, is %d", - check_msg->obs[1].flags); - ck_assert_msg(check_msg->obs[1].lock == 10, - "incorrect value for obs[1].lock, expected 10, is %d", - check_msg->obs[1].lock); - ck_assert_msg(check_msg->obs[1].sid.code == 1, - "incorrect value for obs[1].sid.code, expected 1, is %d", - check_msg->obs[1].sid.code); - ck_assert_msg(check_msg->obs[1].sid.sat == 10, - "incorrect value for obs[1].sid.sat, expected 10, is %d", - check_msg->obs[1].sid.sat); - ck_assert_msg(check_msg->obs[2].D.f == 119, - "incorrect value for obs[2].D.f, expected 119, is %d", - check_msg->obs[2].D.f); - ck_assert_msg(check_msg->obs[2].D.i == -3219, - "incorrect value for obs[2].D.i, expected -3219, is %d", - check_msg->obs[2].D.i); - ck_assert_msg(check_msg->obs[2].L.f == 243, - "incorrect value for obs[2].L.f, expected 243, is %d", - check_msg->obs[2].L.f); - ck_assert_msg(check_msg->obs[2].L.i == 127954794, - "incorrect value for obs[2].L.i, expected 127954794, is %d", - check_msg->obs[2].L.i); - ck_assert_msg(check_msg->obs[2].P == 1217449431, - "incorrect value for obs[2].P, expected 1217449431, is %d", - check_msg->obs[2].P); - ck_assert_msg(check_msg->obs[2].cn0 == 158, - "incorrect value for obs[2].cn0, expected 158, is %d", - check_msg->obs[2].cn0); - ck_assert_msg(check_msg->obs[2].flags == 15, - "incorrect value for obs[2].flags, expected 15, is %d", - check_msg->obs[2].flags); - ck_assert_msg(check_msg->obs[2].lock == 10, - "incorrect value for obs[2].lock, expected 10, is %d", - check_msg->obs[2].lock); - ck_assert_msg(check_msg->obs[2].sid.code == 0, - "incorrect value for obs[2].sid.code, expected 0, is %d", - check_msg->obs[2].sid.code); - ck_assert_msg(check_msg->obs[2].sid.sat == 18, - "incorrect value for obs[2].sid.sat, expected 18, is %d", - check_msg->obs[2].sid.sat); - ck_assert_msg(check_msg->obs[3].D.f == 27, - "incorrect value for obs[3].D.f, expected 27, is %d", - check_msg->obs[3].D.f); - ck_assert_msg(check_msg->obs[3].D.i == -2508, - "incorrect value for obs[3].D.i, expected -2508, is %d", - check_msg->obs[3].D.i); - ck_assert_msg(check_msg->obs[3].L.f == 12, - "incorrect value for obs[3].L.f, expected 12, is %d", - check_msg->obs[3].L.f); - ck_assert_msg(check_msg->obs[3].L.i == 99705055, - "incorrect value for obs[3].L.i, expected 99705055, is %d", - check_msg->obs[3].L.i); - ck_assert_msg(check_msg->obs[3].P == 1217449753, - "incorrect value for obs[3].P, expected 1217449753, is %d", - check_msg->obs[3].P); - ck_assert_msg(check_msg->obs[3].cn0 == 125, - "incorrect value for obs[3].cn0, expected 125, is %d", - check_msg->obs[3].cn0); - ck_assert_msg(check_msg->obs[3].flags == 11, - "incorrect value for obs[3].flags, expected 11, is %d", - check_msg->obs[3].flags); - ck_assert_msg(check_msg->obs[3].lock == 9, - "incorrect value for obs[3].lock, expected 9, is %d", - check_msg->obs[3].lock); - ck_assert_msg(check_msg->obs[3].sid.code == 1, - "incorrect value for obs[3].sid.code, expected 1, is %d", - check_msg->obs[3].sid.code); - ck_assert_msg(check_msg->obs[3].sid.sat == 18, - "incorrect value for obs[3].sid.sat, expected 18, is %d", - check_msg->obs[3].sid.sat); - ck_assert_msg(check_msg->obs[4].D.f == 245, - "incorrect value for obs[4].D.f, expected 245, is %d", - check_msg->obs[4].D.f); - ck_assert_msg(check_msg->obs[4].D.i == 2829, - "incorrect value for obs[4].D.i, expected 2829, is %d", - check_msg->obs[4].D.i); - ck_assert_msg(check_msg->obs[4].L.f == 53, - "incorrect value for obs[4].L.f, expected 53, is %d", - check_msg->obs[4].L.f); - ck_assert_msg(check_msg->obs[4].L.i == 132024982, - "incorrect value for obs[4].L.i, expected 132024982, is %d", - check_msg->obs[4].L.i); - ck_assert_msg(check_msg->obs[4].P == 1256175650, - "incorrect value for obs[4].P, expected 1256175650, is %d", - check_msg->obs[4].P); - ck_assert_msg(check_msg->obs[4].cn0 == 114, - "incorrect value for obs[4].cn0, expected 114, is %d", - check_msg->obs[4].cn0); - ck_assert_msg(check_msg->obs[4].flags == 15, - "incorrect value for obs[4].flags, expected 15, is %d", - check_msg->obs[4].flags); - ck_assert_msg(check_msg->obs[4].lock == 9, - "incorrect value for obs[4].lock, expected 9, is %d", - check_msg->obs[4].lock); - ck_assert_msg(check_msg->obs[4].sid.code == 0, - "incorrect value for obs[4].sid.code, expected 0, is %d", - check_msg->obs[4].sid.code); - ck_assert_msg(check_msg->obs[4].sid.sat == 22, - "incorrect value for obs[4].sid.sat, expected 22, is %d", - check_msg->obs[4].sid.sat); - ck_assert_msg(check_msg->obs[5].D.f == 246, - "incorrect value for obs[5].D.f, expected 246, is %d", - check_msg->obs[5].D.f); - ck_assert_msg(check_msg->obs[5].D.i == -2433, - "incorrect value for obs[5].D.i, expected -2433, is %d", - check_msg->obs[5].D.i); - ck_assert_msg(check_msg->obs[5].L.f == 70, - "incorrect value for obs[5].L.f, expected 70, is %d", - check_msg->obs[5].L.f); - ck_assert_msg(check_msg->obs[5].L.i == 121711010, - "incorrect value for obs[5].L.i, expected 121711010, is %d", - check_msg->obs[5].L.i); - ck_assert_msg(check_msg->obs[5].P == 1158041713, - "incorrect value for obs[5].P, expected 1158041713, is %d", - check_msg->obs[5].P); - ck_assert_msg(check_msg->obs[5].cn0 == 189, - "incorrect value for obs[5].cn0, expected 189, is %d", - check_msg->obs[5].cn0); - ck_assert_msg(check_msg->obs[5].flags == 15, - "incorrect value for obs[5].flags, expected 15, is %d", - check_msg->obs[5].flags); - ck_assert_msg(check_msg->obs[5].lock == 9, - "incorrect value for obs[5].lock, expected 9, is %d", - check_msg->obs[5].lock); - ck_assert_msg(check_msg->obs[5].sid.code == 0, - "incorrect value for obs[5].sid.code, expected 0, is %d", - check_msg->obs[5].sid.code); - ck_assert_msg(check_msg->obs[5].sid.sat == 23, - "incorrect value for obs[5].sid.sat, expected 23, is %d", - check_msg->obs[5].sid.sat); - ck_assert_msg(check_msg->obs[6].D.f == 231, - "incorrect value for obs[6].D.f, expected 231, is %d", - check_msg->obs[6].D.f); - ck_assert_msg(check_msg->obs[6].D.i == -1896, - "incorrect value for obs[6].D.i, expected -1896, is %d", - check_msg->obs[6].D.i); - ck_assert_msg(check_msg->obs[6].L.f == 221, - "incorrect value for obs[6].L.f, expected 221, is %d", - check_msg->obs[6].L.f); - ck_assert_msg(check_msg->obs[6].L.i == 94839765, - "incorrect value for obs[6].L.i, expected 94839765, is %d", - check_msg->obs[6].L.i); - ck_assert_msg(check_msg->obs[6].P == 1158041847, - "incorrect value for obs[6].P, expected 1158041847, is %d", - check_msg->obs[6].P); - ck_assert_msg(check_msg->obs[6].cn0 == 158, - "incorrect value for obs[6].cn0, expected 158, is %d", - check_msg->obs[6].cn0); - ck_assert_msg(check_msg->obs[6].flags == 11, - "incorrect value for obs[6].flags, expected 11, is %d", - check_msg->obs[6].flags); - ck_assert_msg(check_msg->obs[6].lock == 9, - "incorrect value for obs[6].lock, expected 9, is %d", - check_msg->obs[6].lock); - ck_assert_msg(check_msg->obs[6].sid.code == 1, - "incorrect value for obs[6].sid.code, expected 1, is %d", - check_msg->obs[6].sid.code); - ck_assert_msg(check_msg->obs[6].sid.sat == 23, - "incorrect value for obs[6].sid.sat, expected 23, is %d", - check_msg->obs[6].sid.sat); - ck_assert_msg(check_msg->obs[7].D.f == 67, - "incorrect value for obs[7].D.f, expected 67, is %d", - check_msg->obs[7].D.f); - ck_assert_msg(check_msg->obs[7].D.i == -1997, - "incorrect value for obs[7].D.i, expected -1997, is %d", - check_msg->obs[7].D.i); - ck_assert_msg(check_msg->obs[7].L.f == 114, - "incorrect value for obs[7].L.f, expected 114, is %d", - check_msg->obs[7].L.f); - ck_assert_msg(check_msg->obs[7].L.i == 113998348, - "incorrect value for obs[7].L.i, expected 113998348, is %d", - check_msg->obs[7].L.i); - ck_assert_msg(check_msg->obs[7].P == 1084658184, - "incorrect value for obs[7].P, expected 1084658184, is %d", - check_msg->obs[7].P); - ck_assert_msg(check_msg->obs[7].cn0 == 93, - "incorrect value for obs[7].cn0, expected 93, is %d", - check_msg->obs[7].cn0); - ck_assert_msg(check_msg->obs[7].flags == 11, - "incorrect value for obs[7].flags, expected 11, is %d", - check_msg->obs[7].flags); - ck_assert_msg(check_msg->obs[7].lock == 3, - "incorrect value for obs[7].lock, expected 3, is %d", - check_msg->obs[7].lock); - ck_assert_msg(check_msg->obs[7].sid.code == 0, - "incorrect value for obs[7].sid.code, expected 0, is %d", - check_msg->obs[7].sid.code); - ck_assert_msg(check_msg->obs[7].sid.sat == 27, - "incorrect value for obs[7].sid.sat, expected 27, is %d", - check_msg->obs[7].sid.sat); - ck_assert_msg(check_msg->obs[8].D.f == 237, - "incorrect value for obs[8].D.f, expected 237, is %d", - check_msg->obs[8].D.f); - ck_assert_msg(check_msg->obs[8].D.i == 3041, - "incorrect value for obs[8].D.i, expected 3041, is %d", - check_msg->obs[8].D.i); - ck_assert_msg(check_msg->obs[8].L.f == 232, - "incorrect value for obs[8].L.f, expected 232, is %d", - check_msg->obs[8].L.f); - ck_assert_msg(check_msg->obs[8].L.i == 133443545, - "incorrect value for obs[8].L.i, expected 133443545, is %d", - check_msg->obs[8].L.i); - ck_assert_msg(check_msg->obs[8].P == 1269673181, - "incorrect value for obs[8].P, expected 1269673181, is %d", - check_msg->obs[8].P); - ck_assert_msg(check_msg->obs[8].cn0 == 123, - "incorrect value for obs[8].cn0, expected 123, is %d", - check_msg->obs[8].cn0); - ck_assert_msg(check_msg->obs[8].flags == 15, - "incorrect value for obs[8].flags, expected 15, is %d", - check_msg->obs[8].flags); - ck_assert_msg(check_msg->obs[8].lock == 5, - "incorrect value for obs[8].lock, expected 5, is %d", - check_msg->obs[8].lock); - ck_assert_msg(check_msg->obs[8].sid.code == 0, - "incorrect value for obs[8].sid.code, expected 0, is %d", - check_msg->obs[8].sid.code); - ck_assert_msg(check_msg->obs[8].sid.sat == 31, - "incorrect value for obs[8].sid.sat, expected 31, is %d", - check_msg->obs[8].sid.sat); - ck_assert_msg(check_msg->obs[9].D.f == 62, - "incorrect value for obs[9].D.f, expected 62, is %d", - check_msg->obs[9].D.f); - ck_assert_msg(check_msg->obs[9].D.i == 2374, - "incorrect value for obs[9].D.i, expected 2374, is %d", - check_msg->obs[9].D.i); - ck_assert_msg(check_msg->obs[9].L.f == 40, - "incorrect value for obs[9].L.f, expected 40, is %d", - check_msg->obs[9].L.f); - ck_assert_msg(check_msg->obs[9].L.i == 103982040, - "incorrect value for obs[9].L.i, expected 103982040, is %d", - check_msg->obs[9].L.i); - ck_assert_msg(check_msg->obs[9].P == 1269673722, - "incorrect value for obs[9].P, expected 1269673722, is %d", - check_msg->obs[9].P); - ck_assert_msg(check_msg->obs[9].cn0 == 120, - "incorrect value for obs[9].cn0, expected 120, is %d", - check_msg->obs[9].cn0); - ck_assert_msg(check_msg->obs[9].flags == 11, - "incorrect value for obs[9].flags, expected 11, is %d", - check_msg->obs[9].flags); - ck_assert_msg(check_msg->obs[9].lock == 3, - "incorrect value for obs[9].lock, expected 3, is %d", - check_msg->obs[9].lock); - ck_assert_msg(check_msg->obs[9].sid.code == 1, - "incorrect value for obs[9].sid.code, expected 1, is %d", - check_msg->obs[9].sid.code); - ck_assert_msg(check_msg->obs[9].sid.sat == 31, - "incorrect value for obs[9].sid.sat, expected 31, is %d", - check_msg->obs[9].sid.sat); - ck_assert_msg(check_msg->obs[10].D.f == 96, - "incorrect value for obs[10].D.f, expected 96, is %d", - check_msg->obs[10].D.f); - ck_assert_msg(check_msg->obs[10].D.i == -3446, - "incorrect value for obs[10].D.i, expected -3446, is %d", - check_msg->obs[10].D.i); - ck_assert_msg(check_msg->obs[10].L.f == 7, - "incorrect value for obs[10].L.f, expected 7, is %d", - check_msg->obs[10].L.f); - ck_assert_msg(check_msg->obs[10].L.i == 118217315, - "incorrect value for obs[10].L.i, expected 118217315, is %d", - check_msg->obs[10].L.i); - ck_assert_msg(check_msg->obs[10].P == 1107693703, - "incorrect value for obs[10].P, expected 1107693703, is %d", - check_msg->obs[10].P); - ck_assert_msg(check_msg->obs[10].cn0 == 176, - "incorrect value for obs[10].cn0, expected 176, is %d", - check_msg->obs[10].cn0); - ck_assert_msg(check_msg->obs[10].flags == 15, - "incorrect value for obs[10].flags, expected 15, is %d", - check_msg->obs[10].flags); - ck_assert_msg(check_msg->obs[10].lock == 10, - "incorrect value for obs[10].lock, expected 10, is %d", - check_msg->obs[10].lock); - ck_assert_msg(check_msg->obs[10].sid.code == 3, - "incorrect value for obs[10].sid.code, expected 3, is %d", - check_msg->obs[10].sid.code); - ck_assert_msg(check_msg->obs[10].sid.sat == 2, - "incorrect value for obs[10].sid.sat, expected 2, is %d", - check_msg->obs[10].sid.sat); - ck_assert_msg(check_msg->obs[11].D.f == 96, - "incorrect value for obs[11].D.f, expected 96, is %d", - check_msg->obs[11].D.f); - ck_assert_msg(check_msg->obs[11].D.i == -1003, - "incorrect value for obs[11].D.i, expected -1003, is %d", - check_msg->obs[11].D.i); - ck_assert_msg(check_msg->obs[11].L.f == 203, - "incorrect value for obs[11].L.f, expected 203, is %d", - check_msg->obs[11].L.f); - ck_assert_msg(check_msg->obs[11].L.i == 104224985, - "incorrect value for obs[11].L.i, expected 104224985, is %d", - check_msg->obs[11].L.i); - ck_assert_msg(check_msg->obs[11].P == 973505172, - "incorrect value for obs[11].P, expected 973505172, is %d", - check_msg->obs[11].P); - ck_assert_msg(check_msg->obs[11].cn0 == 170, - "incorrect value for obs[11].cn0, expected 170, is %d", - check_msg->obs[11].cn0); - ck_assert_msg(check_msg->obs[11].flags == 15, - "incorrect value for obs[11].flags, expected 15, is %d", - check_msg->obs[11].flags); - ck_assert_msg(check_msg->obs[11].lock == 10, - "incorrect value for obs[11].lock, expected 10, is %d", - check_msg->obs[11].lock); - ck_assert_msg(check_msg->obs[11].sid.code == 3, - "incorrect value for obs[11].sid.code, expected 3, is %d", - check_msg->obs[11].sid.code); - ck_assert_msg(check_msg->obs[11].sid.sat == 3, - "incorrect value for obs[11].sid.sat, expected 3, is %d", - check_msg->obs[11].sid.sat); - ck_assert_msg(check_msg->obs[12].D.f == 219, - "incorrect value for obs[12].D.f, expected 219, is %d", - check_msg->obs[12].D.f); - ck_assert_msg(check_msg->obs[12].D.i == -3836, - "incorrect value for obs[12].D.i, expected -3836, is %d", - check_msg->obs[12].D.i); - ck_assert_msg(check_msg->obs[12].L.f == 80, - "incorrect value for obs[12].L.f, expected 80, is %d", - check_msg->obs[12].L.f); - ck_assert_msg(check_msg->obs[12].L.i == 114505343, - "incorrect value for obs[12].L.i, expected 114505343, is %d", - check_msg->obs[12].L.i); - ck_assert_msg(check_msg->obs[12].P == 1069903034, - "incorrect value for obs[12].P, expected 1069903034, is %d", - check_msg->obs[12].P); - ck_assert_msg(check_msg->obs[12].cn0 == 200, - "incorrect value for obs[12].cn0, expected 200, is %d", - check_msg->obs[12].cn0); - ck_assert_msg(check_msg->obs[12].flags == 15, - "incorrect value for obs[12].flags, expected 15, is %d", - check_msg->obs[12].flags); - ck_assert_msg(check_msg->obs[12].lock == 10, - "incorrect value for obs[12].lock, expected 10, is %d", - check_msg->obs[12].lock); - ck_assert_msg(check_msg->obs[12].sid.code == 3, - "incorrect value for obs[12].sid.code, expected 3, is %d", - check_msg->obs[12].sid.code); - ck_assert_msg(check_msg->obs[12].sid.sat == 17, - "incorrect value for obs[12].sid.sat, expected 17, is %d", - check_msg->obs[12].sid.sat); - ck_assert_msg(check_msg->obs[13].D.f == 182, - "incorrect value for obs[13].D.f, expected 182, is %d", - check_msg->obs[13].D.f); - ck_assert_msg(check_msg->obs[13].D.i == -461, - "incorrect value for obs[13].D.i, expected -461, is %d", - check_msg->obs[13].D.i); - ck_assert_msg(check_msg->obs[13].L.f == 105, - "incorrect value for obs[13].L.f, expected 105, is %d", - check_msg->obs[13].L.f); - ck_assert_msg(check_msg->obs[13].L.i == 102157331, - "incorrect value for obs[13].L.i, expected 102157331, is %d", - check_msg->obs[13].L.i); - ck_assert_msg(check_msg->obs[13].P == 956875687, - "incorrect value for obs[13].P, expected 956875687, is %d", - check_msg->obs[13].P); - ck_assert_msg(check_msg->obs[13].cn0 == 152, - "incorrect value for obs[13].cn0, expected 152, is %d", - check_msg->obs[13].cn0); - ck_assert_msg(check_msg->obs[13].flags == 15, - "incorrect value for obs[13].flags, expected 15, is %d", - check_msg->obs[13].flags); - ck_assert_msg(check_msg->obs[13].lock == 10, - "incorrect value for obs[13].lock, expected 10, is %d", - check_msg->obs[13].lock); - ck_assert_msg(check_msg->obs[13].sid.code == 3, - "incorrect value for obs[13].sid.code, expected 3, is %d", - check_msg->obs[13].sid.code); - ck_assert_msg(check_msg->obs[13].sid.sat == 18, - "incorrect value for obs[13].sid.sat, expected 18, is %d", - check_msg->obs[13].sid.sat); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x4a, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x4a, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 74, 0, 129, 240, 11, 152, 202, 226, 25, - 0, 0, 0, 0, 106, 8, 16, 201, 101, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_t* test_msg = (msg_obs_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 16; - test_msg->header.t.ns_residual = 0; - test_msg->header.t.tow = 434293400; - test_msg->header.t.wn = 2154; - sbp_payload_send(&sbp_state, 0x4a, 61569, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 61569, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 61569, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x4a, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_t* check_msg = (msg_obs_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 16, - "incorrect value for header.n_obs, expected 16, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.ns_residual == 0, - "incorrect value for header.t.ns_residual, expected 0, is %d", - check_msg->header.t.ns_residual); - ck_assert_msg(check_msg->header.t.tow == 434293400, - "incorrect value for header.t.tow, expected 434293400, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 2154, - "incorrect value for header.t.wn, expected 2154, is %d", - check_msg->header.t.wn); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_observation_MsgObs_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_observation_MsgObs"); - TCase* tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_observation_MsgObs"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_observation_MsgObs); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgObsDepB.c b/c/test/legacy/auto_check_sbp_observation_MsgObsDepB.c deleted file mode 100644 index 5a955e7bc3..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgObsDepB.c +++ /dev/null @@ -1,1495 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgObsDepB.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgObsDepB) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x43, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x43, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 67, 0, 246, 215, 103, 120, 46, 39, 0, 251, 6, 32, 180, - 175, 187, 133, 223, 53, 7, 7, 27, 157, 0, 0, 202, 0, 0, - 0, 58, 140, 85, 147, 88, 28, 190, 7, 175, 144, 0, 0, 203, - 0, 0, 0, 220, 140, 248, 138, 208, 172, 77, 7, 135, 151, 0, - 0, 208, 0, 0, 0, 173, 194, 72, 135, 115, 18, 28, 7, 242, - 156, 0, 0, 212, 0, 0, 0, 164, 144, 105, 124, 18, 196, 137, - 6, 120, 168, 0, 0, 217, 0, 0, 0, 30, 232, 228, 139, 210, - 7, 90, 7, 87, 150, 0, 0, 218, 0, 0, 0, 169, 85, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_dep_b_t* test_msg = (msg_obs_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.tow = 2567800; - test_msg->header.t.wn = 1787; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].L.f = 27; - test_msg->obs[0].L.i = 117913055; - test_msg->obs[0].P = 2243669940; - test_msg->obs[0].cn0 = 157; - test_msg->obs[0].lock = 0; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 202; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[1].L.f = 175; - test_msg->obs[1].L.i = 129899608; - test_msg->obs[1].P = 2471857210; - test_msg->obs[1].cn0 = 144; - test_msg->obs[1].lock = 0; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 203; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[2].L.f = 135; - test_msg->obs[2].L.i = 122531024; - test_msg->obs[2].P = 2331544796; - test_msg->obs[2].cn0 = 151; - test_msg->obs[2].lock = 0; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 208; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[3].L.f = 242; - test_msg->obs[3].L.i = 119280243; - test_msg->obs[3].P = 2269692589; - test_msg->obs[3].cn0 = 156; - test_msg->obs[3].lock = 0; - test_msg->obs[3].sid.code = 0; - test_msg->obs[3].sid.reserved = 0; - test_msg->obs[3].sid.sat = 212; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[4].L.f = 120; - test_msg->obs[4].L.i = 109691922; - test_msg->obs[4].P = 2087293092; - test_msg->obs[4].cn0 = 168; - test_msg->obs[4].lock = 0; - test_msg->obs[4].sid.code = 0; - test_msg->obs[4].sid.reserved = 0; - test_msg->obs[4].sid.sat = 217; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[5].L.f = 87; - test_msg->obs[5].L.i = 123340754; - test_msg->obs[5].P = 2347034654; - test_msg->obs[5].cn0 = 150; - test_msg->obs[5].lock = 0; - test_msg->obs[5].sid.code = 0; - test_msg->obs[5].sid.reserved = 0; - test_msg->obs[5].sid.sat = 218; - sbp_payload_send(&sbp_state, 0x43, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x43, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_dep_b_t* check_msg = (msg_obs_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 32, - "incorrect value for header.n_obs, expected 32, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.tow == 2567800, - "incorrect value for header.t.tow, expected 2567800, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 1787, - "incorrect value for header.t.wn, expected 1787, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].L.f == 27, - "incorrect value for obs[0].L.f, expected 27, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == 117913055, - "incorrect value for obs[0].L.i, expected 117913055, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 2243669940, - "incorrect value for obs[0].P, expected 2243669940, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].cn0 == 157, - "incorrect value for obs[0].cn0, expected 157, is %d", - check_msg->obs[0].cn0); - ck_assert_msg(check_msg->obs[0].lock == 0, - "incorrect value for obs[0].lock, expected 0, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].sid.code == 0, - "incorrect value for obs[0].sid.code, expected 0, is %d", - check_msg->obs[0].sid.code); - ck_assert_msg(check_msg->obs[0].sid.reserved == 0, - "incorrect value for obs[0].sid.reserved, expected 0, is %d", - check_msg->obs[0].sid.reserved); - ck_assert_msg(check_msg->obs[0].sid.sat == 202, - "incorrect value for obs[0].sid.sat, expected 202, is %d", - check_msg->obs[0].sid.sat); - ck_assert_msg(check_msg->obs[1].L.f == 175, - "incorrect value for obs[1].L.f, expected 175, is %d", - check_msg->obs[1].L.f); - ck_assert_msg(check_msg->obs[1].L.i == 129899608, - "incorrect value for obs[1].L.i, expected 129899608, is %d", - check_msg->obs[1].L.i); - ck_assert_msg(check_msg->obs[1].P == 2471857210, - "incorrect value for obs[1].P, expected 2471857210, is %d", - check_msg->obs[1].P); - ck_assert_msg(check_msg->obs[1].cn0 == 144, - "incorrect value for obs[1].cn0, expected 144, is %d", - check_msg->obs[1].cn0); - ck_assert_msg(check_msg->obs[1].lock == 0, - "incorrect value for obs[1].lock, expected 0, is %d", - check_msg->obs[1].lock); - ck_assert_msg(check_msg->obs[1].sid.code == 0, - "incorrect value for obs[1].sid.code, expected 0, is %d", - check_msg->obs[1].sid.code); - ck_assert_msg(check_msg->obs[1].sid.reserved == 0, - "incorrect value for obs[1].sid.reserved, expected 0, is %d", - check_msg->obs[1].sid.reserved); - ck_assert_msg(check_msg->obs[1].sid.sat == 203, - "incorrect value for obs[1].sid.sat, expected 203, is %d", - check_msg->obs[1].sid.sat); - ck_assert_msg(check_msg->obs[2].L.f == 135, - "incorrect value for obs[2].L.f, expected 135, is %d", - check_msg->obs[2].L.f); - ck_assert_msg(check_msg->obs[2].L.i == 122531024, - "incorrect value for obs[2].L.i, expected 122531024, is %d", - check_msg->obs[2].L.i); - ck_assert_msg(check_msg->obs[2].P == 2331544796, - "incorrect value for obs[2].P, expected 2331544796, is %d", - check_msg->obs[2].P); - ck_assert_msg(check_msg->obs[2].cn0 == 151, - "incorrect value for obs[2].cn0, expected 151, is %d", - check_msg->obs[2].cn0); - ck_assert_msg(check_msg->obs[2].lock == 0, - "incorrect value for obs[2].lock, expected 0, is %d", - check_msg->obs[2].lock); - ck_assert_msg(check_msg->obs[2].sid.code == 0, - "incorrect value for obs[2].sid.code, expected 0, is %d", - check_msg->obs[2].sid.code); - ck_assert_msg(check_msg->obs[2].sid.reserved == 0, - "incorrect value for obs[2].sid.reserved, expected 0, is %d", - check_msg->obs[2].sid.reserved); - ck_assert_msg(check_msg->obs[2].sid.sat == 208, - "incorrect value for obs[2].sid.sat, expected 208, is %d", - check_msg->obs[2].sid.sat); - ck_assert_msg(check_msg->obs[3].L.f == 242, - "incorrect value for obs[3].L.f, expected 242, is %d", - check_msg->obs[3].L.f); - ck_assert_msg(check_msg->obs[3].L.i == 119280243, - "incorrect value for obs[3].L.i, expected 119280243, is %d", - check_msg->obs[3].L.i); - ck_assert_msg(check_msg->obs[3].P == 2269692589, - "incorrect value for obs[3].P, expected 2269692589, is %d", - check_msg->obs[3].P); - ck_assert_msg(check_msg->obs[3].cn0 == 156, - "incorrect value for obs[3].cn0, expected 156, is %d", - check_msg->obs[3].cn0); - ck_assert_msg(check_msg->obs[3].lock == 0, - "incorrect value for obs[3].lock, expected 0, is %d", - check_msg->obs[3].lock); - ck_assert_msg(check_msg->obs[3].sid.code == 0, - "incorrect value for obs[3].sid.code, expected 0, is %d", - check_msg->obs[3].sid.code); - ck_assert_msg(check_msg->obs[3].sid.reserved == 0, - "incorrect value for obs[3].sid.reserved, expected 0, is %d", - check_msg->obs[3].sid.reserved); - ck_assert_msg(check_msg->obs[3].sid.sat == 212, - "incorrect value for obs[3].sid.sat, expected 212, is %d", - check_msg->obs[3].sid.sat); - ck_assert_msg(check_msg->obs[4].L.f == 120, - "incorrect value for obs[4].L.f, expected 120, is %d", - check_msg->obs[4].L.f); - ck_assert_msg(check_msg->obs[4].L.i == 109691922, - "incorrect value for obs[4].L.i, expected 109691922, is %d", - check_msg->obs[4].L.i); - ck_assert_msg(check_msg->obs[4].P == 2087293092, - "incorrect value for obs[4].P, expected 2087293092, is %d", - check_msg->obs[4].P); - ck_assert_msg(check_msg->obs[4].cn0 == 168, - "incorrect value for obs[4].cn0, expected 168, is %d", - check_msg->obs[4].cn0); - ck_assert_msg(check_msg->obs[4].lock == 0, - "incorrect value for obs[4].lock, expected 0, is %d", - check_msg->obs[4].lock); - ck_assert_msg(check_msg->obs[4].sid.code == 0, - "incorrect value for obs[4].sid.code, expected 0, is %d", - check_msg->obs[4].sid.code); - ck_assert_msg(check_msg->obs[4].sid.reserved == 0, - "incorrect value for obs[4].sid.reserved, expected 0, is %d", - check_msg->obs[4].sid.reserved); - ck_assert_msg(check_msg->obs[4].sid.sat == 217, - "incorrect value for obs[4].sid.sat, expected 217, is %d", - check_msg->obs[4].sid.sat); - ck_assert_msg(check_msg->obs[5].L.f == 87, - "incorrect value for obs[5].L.f, expected 87, is %d", - check_msg->obs[5].L.f); - ck_assert_msg(check_msg->obs[5].L.i == 123340754, - "incorrect value for obs[5].L.i, expected 123340754, is %d", - check_msg->obs[5].L.i); - ck_assert_msg(check_msg->obs[5].P == 2347034654, - "incorrect value for obs[5].P, expected 2347034654, is %d", - check_msg->obs[5].P); - ck_assert_msg(check_msg->obs[5].cn0 == 150, - "incorrect value for obs[5].cn0, expected 150, is %d", - check_msg->obs[5].cn0); - ck_assert_msg(check_msg->obs[5].lock == 0, - "incorrect value for obs[5].lock, expected 0, is %d", - check_msg->obs[5].lock); - ck_assert_msg(check_msg->obs[5].sid.code == 0, - "incorrect value for obs[5].sid.code, expected 0, is %d", - check_msg->obs[5].sid.code); - ck_assert_msg(check_msg->obs[5].sid.reserved == 0, - "incorrect value for obs[5].sid.reserved, expected 0, is %d", - check_msg->obs[5].sid.reserved); - ck_assert_msg(check_msg->obs[5].sid.sat == 218, - "incorrect value for obs[5].sid.sat, expected 218, is %d", - check_msg->obs[5].sid.sat); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x43, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x43, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 67, 0, 246, 215, 55, 120, 46, 39, 0, 251, 6, 33, - 68, 199, 101, 136, 133, 247, 42, 7, 219, 154, 0, 0, 220, - 0, 0, 0, 219, 14, 123, 133, 96, 215, 3, 7, 235, 156, - 0, 0, 222, 0, 0, 0, 87, 166, 81, 122, 5, 173, 109, - 6, 174, 170, 0, 0, 225, 0, 0, 0, 11, 233, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_dep_b_t* test_msg = (msg_obs_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 33; - test_msg->header.t.tow = 2567800; - test_msg->header.t.wn = 1787; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].L.f = 219; - test_msg->obs[0].L.i = 120256389; - test_msg->obs[0].P = 2288371524; - test_msg->obs[0].cn0 = 154; - test_msg->obs[0].lock = 0; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 220; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[1].L.f = 235; - test_msg->obs[1].L.i = 117692256; - test_msg->obs[1].P = 2239434459; - test_msg->obs[1].cn0 = 156; - test_msg->obs[1].lock = 0; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 222; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[2].L.f = 174; - test_msg->obs[2].L.i = 107851013; - test_msg->obs[2].P = 2052171351; - test_msg->obs[2].cn0 = 170; - test_msg->obs[2].lock = 0; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 225; - sbp_payload_send(&sbp_state, 0x43, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x43, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_dep_b_t* check_msg = (msg_obs_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 33, - "incorrect value for header.n_obs, expected 33, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.tow == 2567800, - "incorrect value for header.t.tow, expected 2567800, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 1787, - "incorrect value for header.t.wn, expected 1787, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].L.f == 219, - "incorrect value for obs[0].L.f, expected 219, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == 120256389, - "incorrect value for obs[0].L.i, expected 120256389, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 2288371524, - "incorrect value for obs[0].P, expected 2288371524, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].cn0 == 154, - "incorrect value for obs[0].cn0, expected 154, is %d", - check_msg->obs[0].cn0); - ck_assert_msg(check_msg->obs[0].lock == 0, - "incorrect value for obs[0].lock, expected 0, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].sid.code == 0, - "incorrect value for obs[0].sid.code, expected 0, is %d", - check_msg->obs[0].sid.code); - ck_assert_msg(check_msg->obs[0].sid.reserved == 0, - "incorrect value for obs[0].sid.reserved, expected 0, is %d", - check_msg->obs[0].sid.reserved); - ck_assert_msg(check_msg->obs[0].sid.sat == 220, - "incorrect value for obs[0].sid.sat, expected 220, is %d", - check_msg->obs[0].sid.sat); - ck_assert_msg(check_msg->obs[1].L.f == 235, - "incorrect value for obs[1].L.f, expected 235, is %d", - check_msg->obs[1].L.f); - ck_assert_msg(check_msg->obs[1].L.i == 117692256, - "incorrect value for obs[1].L.i, expected 117692256, is %d", - check_msg->obs[1].L.i); - ck_assert_msg(check_msg->obs[1].P == 2239434459, - "incorrect value for obs[1].P, expected 2239434459, is %d", - check_msg->obs[1].P); - ck_assert_msg(check_msg->obs[1].cn0 == 156, - "incorrect value for obs[1].cn0, expected 156, is %d", - check_msg->obs[1].cn0); - ck_assert_msg(check_msg->obs[1].lock == 0, - "incorrect value for obs[1].lock, expected 0, is %d", - check_msg->obs[1].lock); - ck_assert_msg(check_msg->obs[1].sid.code == 0, - "incorrect value for obs[1].sid.code, expected 0, is %d", - check_msg->obs[1].sid.code); - ck_assert_msg(check_msg->obs[1].sid.reserved == 0, - "incorrect value for obs[1].sid.reserved, expected 0, is %d", - check_msg->obs[1].sid.reserved); - ck_assert_msg(check_msg->obs[1].sid.sat == 222, - "incorrect value for obs[1].sid.sat, expected 222, is %d", - check_msg->obs[1].sid.sat); - ck_assert_msg(check_msg->obs[2].L.f == 174, - "incorrect value for obs[2].L.f, expected 174, is %d", - check_msg->obs[2].L.f); - ck_assert_msg(check_msg->obs[2].L.i == 107851013, - "incorrect value for obs[2].L.i, expected 107851013, is %d", - check_msg->obs[2].L.i); - ck_assert_msg(check_msg->obs[2].P == 2052171351, - "incorrect value for obs[2].P, expected 2052171351, is %d", - check_msg->obs[2].P); - ck_assert_msg(check_msg->obs[2].cn0 == 170, - "incorrect value for obs[2].cn0, expected 170, is %d", - check_msg->obs[2].cn0); - ck_assert_msg(check_msg->obs[2].lock == 0, - "incorrect value for obs[2].lock, expected 0, is %d", - check_msg->obs[2].lock); - ck_assert_msg(check_msg->obs[2].sid.code == 0, - "incorrect value for obs[2].sid.code, expected 0, is %d", - check_msg->obs[2].sid.code); - ck_assert_msg(check_msg->obs[2].sid.reserved == 0, - "incorrect value for obs[2].sid.reserved, expected 0, is %d", - check_msg->obs[2].sid.reserved); - ck_assert_msg(check_msg->obs[2].sid.sat == 225, - "incorrect value for obs[2].sid.sat, expected 225, is %d", - check_msg->obs[2].sid.sat); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x43, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x43, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 67, 0, 246, 215, 103, 64, 47, 39, 0, 251, 6, 32, 100, - 132, 187, 133, 236, 51, 7, 7, 94, 156, 0, 0, 202, 0, 0, - 0, 97, 184, 85, 147, 178, 30, 190, 7, 40, 140, 0, 0, 203, - 0, 0, 0, 135, 111, 248, 138, 90, 171, 77, 7, 2, 150, 0, - 0, 208, 0, 0, 0, 180, 238, 72, 135, 190, 20, 28, 7, 241, - 155, 0, 0, 212, 0, 0, 0, 15, 153, 105, 124, 92, 196, 137, - 6, 153, 168, 0, 0, 217, 0, 0, 0, 49, 185, 228, 139, 144, - 5, 90, 7, 41, 150, 0, 0, 218, 0, 0, 0, 241, 98, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_dep_b_t* test_msg = (msg_obs_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.tow = 2568000; - test_msg->header.t.wn = 1787; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].L.f = 94; - test_msg->obs[0].L.i = 117912556; - test_msg->obs[0].P = 2243658852; - test_msg->obs[0].cn0 = 156; - test_msg->obs[0].lock = 0; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 202; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[1].L.f = 40; - test_msg->obs[1].L.i = 129900210; - test_msg->obs[1].P = 2471868513; - test_msg->obs[1].cn0 = 140; - test_msg->obs[1].lock = 0; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 203; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[2].L.f = 2; - test_msg->obs[2].L.i = 122530650; - test_msg->obs[2].P = 2331537287; - test_msg->obs[2].cn0 = 150; - test_msg->obs[2].lock = 0; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 208; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[3].L.f = 241; - test_msg->obs[3].L.i = 119280830; - test_msg->obs[3].P = 2269703860; - test_msg->obs[3].cn0 = 155; - test_msg->obs[3].lock = 0; - test_msg->obs[3].sid.code = 0; - test_msg->obs[3].sid.reserved = 0; - test_msg->obs[3].sid.sat = 212; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[4].L.f = 153; - test_msg->obs[4].L.i = 109691996; - test_msg->obs[4].P = 2087295247; - test_msg->obs[4].cn0 = 168; - test_msg->obs[4].lock = 0; - test_msg->obs[4].sid.code = 0; - test_msg->obs[4].sid.reserved = 0; - test_msg->obs[4].sid.sat = 217; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[5].L.f = 41; - test_msg->obs[5].L.i = 123340176; - test_msg->obs[5].P = 2347022641; - test_msg->obs[5].cn0 = 150; - test_msg->obs[5].lock = 0; - test_msg->obs[5].sid.code = 0; - test_msg->obs[5].sid.reserved = 0; - test_msg->obs[5].sid.sat = 218; - sbp_payload_send(&sbp_state, 0x43, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x43, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_dep_b_t* check_msg = (msg_obs_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 32, - "incorrect value for header.n_obs, expected 32, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.tow == 2568000, - "incorrect value for header.t.tow, expected 2568000, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 1787, - "incorrect value for header.t.wn, expected 1787, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].L.f == 94, - "incorrect value for obs[0].L.f, expected 94, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == 117912556, - "incorrect value for obs[0].L.i, expected 117912556, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 2243658852, - "incorrect value for obs[0].P, expected 2243658852, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].cn0 == 156, - "incorrect value for obs[0].cn0, expected 156, is %d", - check_msg->obs[0].cn0); - ck_assert_msg(check_msg->obs[0].lock == 0, - "incorrect value for obs[0].lock, expected 0, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].sid.code == 0, - "incorrect value for obs[0].sid.code, expected 0, is %d", - check_msg->obs[0].sid.code); - ck_assert_msg(check_msg->obs[0].sid.reserved == 0, - "incorrect value for obs[0].sid.reserved, expected 0, is %d", - check_msg->obs[0].sid.reserved); - ck_assert_msg(check_msg->obs[0].sid.sat == 202, - "incorrect value for obs[0].sid.sat, expected 202, is %d", - check_msg->obs[0].sid.sat); - ck_assert_msg(check_msg->obs[1].L.f == 40, - "incorrect value for obs[1].L.f, expected 40, is %d", - check_msg->obs[1].L.f); - ck_assert_msg(check_msg->obs[1].L.i == 129900210, - "incorrect value for obs[1].L.i, expected 129900210, is %d", - check_msg->obs[1].L.i); - ck_assert_msg(check_msg->obs[1].P == 2471868513, - "incorrect value for obs[1].P, expected 2471868513, is %d", - check_msg->obs[1].P); - ck_assert_msg(check_msg->obs[1].cn0 == 140, - "incorrect value for obs[1].cn0, expected 140, is %d", - check_msg->obs[1].cn0); - ck_assert_msg(check_msg->obs[1].lock == 0, - "incorrect value for obs[1].lock, expected 0, is %d", - check_msg->obs[1].lock); - ck_assert_msg(check_msg->obs[1].sid.code == 0, - "incorrect value for obs[1].sid.code, expected 0, is %d", - check_msg->obs[1].sid.code); - ck_assert_msg(check_msg->obs[1].sid.reserved == 0, - "incorrect value for obs[1].sid.reserved, expected 0, is %d", - check_msg->obs[1].sid.reserved); - ck_assert_msg(check_msg->obs[1].sid.sat == 203, - "incorrect value for obs[1].sid.sat, expected 203, is %d", - check_msg->obs[1].sid.sat); - ck_assert_msg(check_msg->obs[2].L.f == 2, - "incorrect value for obs[2].L.f, expected 2, is %d", - check_msg->obs[2].L.f); - ck_assert_msg(check_msg->obs[2].L.i == 122530650, - "incorrect value for obs[2].L.i, expected 122530650, is %d", - check_msg->obs[2].L.i); - ck_assert_msg(check_msg->obs[2].P == 2331537287, - "incorrect value for obs[2].P, expected 2331537287, is %d", - check_msg->obs[2].P); - ck_assert_msg(check_msg->obs[2].cn0 == 150, - "incorrect value for obs[2].cn0, expected 150, is %d", - check_msg->obs[2].cn0); - ck_assert_msg(check_msg->obs[2].lock == 0, - "incorrect value for obs[2].lock, expected 0, is %d", - check_msg->obs[2].lock); - ck_assert_msg(check_msg->obs[2].sid.code == 0, - "incorrect value for obs[2].sid.code, expected 0, is %d", - check_msg->obs[2].sid.code); - ck_assert_msg(check_msg->obs[2].sid.reserved == 0, - "incorrect value for obs[2].sid.reserved, expected 0, is %d", - check_msg->obs[2].sid.reserved); - ck_assert_msg(check_msg->obs[2].sid.sat == 208, - "incorrect value for obs[2].sid.sat, expected 208, is %d", - check_msg->obs[2].sid.sat); - ck_assert_msg(check_msg->obs[3].L.f == 241, - "incorrect value for obs[3].L.f, expected 241, is %d", - check_msg->obs[3].L.f); - ck_assert_msg(check_msg->obs[3].L.i == 119280830, - "incorrect value for obs[3].L.i, expected 119280830, is %d", - check_msg->obs[3].L.i); - ck_assert_msg(check_msg->obs[3].P == 2269703860, - "incorrect value for obs[3].P, expected 2269703860, is %d", - check_msg->obs[3].P); - ck_assert_msg(check_msg->obs[3].cn0 == 155, - "incorrect value for obs[3].cn0, expected 155, is %d", - check_msg->obs[3].cn0); - ck_assert_msg(check_msg->obs[3].lock == 0, - "incorrect value for obs[3].lock, expected 0, is %d", - check_msg->obs[3].lock); - ck_assert_msg(check_msg->obs[3].sid.code == 0, - "incorrect value for obs[3].sid.code, expected 0, is %d", - check_msg->obs[3].sid.code); - ck_assert_msg(check_msg->obs[3].sid.reserved == 0, - "incorrect value for obs[3].sid.reserved, expected 0, is %d", - check_msg->obs[3].sid.reserved); - ck_assert_msg(check_msg->obs[3].sid.sat == 212, - "incorrect value for obs[3].sid.sat, expected 212, is %d", - check_msg->obs[3].sid.sat); - ck_assert_msg(check_msg->obs[4].L.f == 153, - "incorrect value for obs[4].L.f, expected 153, is %d", - check_msg->obs[4].L.f); - ck_assert_msg(check_msg->obs[4].L.i == 109691996, - "incorrect value for obs[4].L.i, expected 109691996, is %d", - check_msg->obs[4].L.i); - ck_assert_msg(check_msg->obs[4].P == 2087295247, - "incorrect value for obs[4].P, expected 2087295247, is %d", - check_msg->obs[4].P); - ck_assert_msg(check_msg->obs[4].cn0 == 168, - "incorrect value for obs[4].cn0, expected 168, is %d", - check_msg->obs[4].cn0); - ck_assert_msg(check_msg->obs[4].lock == 0, - "incorrect value for obs[4].lock, expected 0, is %d", - check_msg->obs[4].lock); - ck_assert_msg(check_msg->obs[4].sid.code == 0, - "incorrect value for obs[4].sid.code, expected 0, is %d", - check_msg->obs[4].sid.code); - ck_assert_msg(check_msg->obs[4].sid.reserved == 0, - "incorrect value for obs[4].sid.reserved, expected 0, is %d", - check_msg->obs[4].sid.reserved); - ck_assert_msg(check_msg->obs[4].sid.sat == 217, - "incorrect value for obs[4].sid.sat, expected 217, is %d", - check_msg->obs[4].sid.sat); - ck_assert_msg(check_msg->obs[5].L.f == 41, - "incorrect value for obs[5].L.f, expected 41, is %d", - check_msg->obs[5].L.f); - ck_assert_msg(check_msg->obs[5].L.i == 123340176, - "incorrect value for obs[5].L.i, expected 123340176, is %d", - check_msg->obs[5].L.i); - ck_assert_msg(check_msg->obs[5].P == 2347022641, - "incorrect value for obs[5].P, expected 2347022641, is %d", - check_msg->obs[5].P); - ck_assert_msg(check_msg->obs[5].cn0 == 150, - "incorrect value for obs[5].cn0, expected 150, is %d", - check_msg->obs[5].cn0); - ck_assert_msg(check_msg->obs[5].lock == 0, - "incorrect value for obs[5].lock, expected 0, is %d", - check_msg->obs[5].lock); - ck_assert_msg(check_msg->obs[5].sid.code == 0, - "incorrect value for obs[5].sid.code, expected 0, is %d", - check_msg->obs[5].sid.code); - ck_assert_msg(check_msg->obs[5].sid.reserved == 0, - "incorrect value for obs[5].sid.reserved, expected 0, is %d", - check_msg->obs[5].sid.reserved); - ck_assert_msg(check_msg->obs[5].sid.sat == 218, - "incorrect value for obs[5].sid.sat, expected 218, is %d", - check_msg->obs[5].sid.sat); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x43, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x43, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 67, 0, 246, 215, 55, 64, 47, 39, 0, 251, 6, 33, 234, 148, 101, - 136, 15, 245, 42, 7, 20, 154, 0, 0, 220, 0, 0, 0, 208, 247, 122, - 133, 16, 214, 3, 7, 38, 156, 0, 0, 222, 0, 0, 0, 15, 150, 81, - 122, 22, 172, 109, 6, 7, 172, 0, 0, 225, 0, 0, 0, 201, 13, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_dep_b_t* test_msg = (msg_obs_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 33; - test_msg->header.t.tow = 2568000; - test_msg->header.t.wn = 1787; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].L.f = 20; - test_msg->obs[0].L.i = 120255759; - test_msg->obs[0].P = 2288358634; - test_msg->obs[0].cn0 = 154; - test_msg->obs[0].lock = 0; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 220; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[1].L.f = 38; - test_msg->obs[1].L.i = 117691920; - test_msg->obs[1].P = 2239428560; - test_msg->obs[1].cn0 = 156; - test_msg->obs[1].lock = 0; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 222; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[2].L.f = 7; - test_msg->obs[2].L.i = 107850774; - test_msg->obs[2].P = 2052167183; - test_msg->obs[2].cn0 = 172; - test_msg->obs[2].lock = 0; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 225; - sbp_payload_send(&sbp_state, 0x43, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x43, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_dep_b_t* check_msg = (msg_obs_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 33, - "incorrect value for header.n_obs, expected 33, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.tow == 2568000, - "incorrect value for header.t.tow, expected 2568000, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 1787, - "incorrect value for header.t.wn, expected 1787, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].L.f == 20, - "incorrect value for obs[0].L.f, expected 20, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == 120255759, - "incorrect value for obs[0].L.i, expected 120255759, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 2288358634, - "incorrect value for obs[0].P, expected 2288358634, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].cn0 == 154, - "incorrect value for obs[0].cn0, expected 154, is %d", - check_msg->obs[0].cn0); - ck_assert_msg(check_msg->obs[0].lock == 0, - "incorrect value for obs[0].lock, expected 0, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].sid.code == 0, - "incorrect value for obs[0].sid.code, expected 0, is %d", - check_msg->obs[0].sid.code); - ck_assert_msg(check_msg->obs[0].sid.reserved == 0, - "incorrect value for obs[0].sid.reserved, expected 0, is %d", - check_msg->obs[0].sid.reserved); - ck_assert_msg(check_msg->obs[0].sid.sat == 220, - "incorrect value for obs[0].sid.sat, expected 220, is %d", - check_msg->obs[0].sid.sat); - ck_assert_msg(check_msg->obs[1].L.f == 38, - "incorrect value for obs[1].L.f, expected 38, is %d", - check_msg->obs[1].L.f); - ck_assert_msg(check_msg->obs[1].L.i == 117691920, - "incorrect value for obs[1].L.i, expected 117691920, is %d", - check_msg->obs[1].L.i); - ck_assert_msg(check_msg->obs[1].P == 2239428560, - "incorrect value for obs[1].P, expected 2239428560, is %d", - check_msg->obs[1].P); - ck_assert_msg(check_msg->obs[1].cn0 == 156, - "incorrect value for obs[1].cn0, expected 156, is %d", - check_msg->obs[1].cn0); - ck_assert_msg(check_msg->obs[1].lock == 0, - "incorrect value for obs[1].lock, expected 0, is %d", - check_msg->obs[1].lock); - ck_assert_msg(check_msg->obs[1].sid.code == 0, - "incorrect value for obs[1].sid.code, expected 0, is %d", - check_msg->obs[1].sid.code); - ck_assert_msg(check_msg->obs[1].sid.reserved == 0, - "incorrect value for obs[1].sid.reserved, expected 0, is %d", - check_msg->obs[1].sid.reserved); - ck_assert_msg(check_msg->obs[1].sid.sat == 222, - "incorrect value for obs[1].sid.sat, expected 222, is %d", - check_msg->obs[1].sid.sat); - ck_assert_msg(check_msg->obs[2].L.f == 7, - "incorrect value for obs[2].L.f, expected 7, is %d", - check_msg->obs[2].L.f); - ck_assert_msg(check_msg->obs[2].L.i == 107850774, - "incorrect value for obs[2].L.i, expected 107850774, is %d", - check_msg->obs[2].L.i); - ck_assert_msg(check_msg->obs[2].P == 2052167183, - "incorrect value for obs[2].P, expected 2052167183, is %d", - check_msg->obs[2].P); - ck_assert_msg(check_msg->obs[2].cn0 == 172, - "incorrect value for obs[2].cn0, expected 172, is %d", - check_msg->obs[2].cn0); - ck_assert_msg(check_msg->obs[2].lock == 0, - "incorrect value for obs[2].lock, expected 0, is %d", - check_msg->obs[2].lock); - ck_assert_msg(check_msg->obs[2].sid.code == 0, - "incorrect value for obs[2].sid.code, expected 0, is %d", - check_msg->obs[2].sid.code); - ck_assert_msg(check_msg->obs[2].sid.reserved == 0, - "incorrect value for obs[2].sid.reserved, expected 0, is %d", - check_msg->obs[2].sid.reserved); - ck_assert_msg(check_msg->obs[2].sid.sat == 225, - "incorrect value for obs[2].sid.sat, expected 225, is %d", - check_msg->obs[2].sid.sat); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x43, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x43, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 67, 0, 246, 215, 103, 8, 48, 39, 0, 251, 6, 32, 254, - 96, 187, 133, 249, 49, 7, 7, 165, 156, 0, 0, 202, 0, 0, - 0, 113, 229, 85, 147, 11, 33, 190, 7, 106, 143, 0, 0, 203, - 0, 0, 0, 182, 85, 248, 138, 227, 169, 77, 7, 159, 150, 0, - 0, 208, 0, 0, 0, 17, 24, 73, 135, 10, 23, 28, 7, 7, - 156, 0, 0, 212, 0, 0, 0, 108, 155, 105, 124, 166, 196, 137, - 6, 186, 170, 0, 0, 217, 0, 0, 0, 214, 142, 228, 139, 77, - 3, 90, 7, 236, 151, 0, 0, 218, 0, 0, 0, 59, 118, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_dep_b_t* test_msg = (msg_obs_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.tow = 2568200; - test_msg->header.t.wn = 1787; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].L.f = 165; - test_msg->obs[0].L.i = 117912057; - test_msg->obs[0].P = 2243649790; - test_msg->obs[0].cn0 = 156; - test_msg->obs[0].lock = 0; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 202; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[1].L.f = 106; - test_msg->obs[1].L.i = 129900811; - test_msg->obs[1].P = 2471880049; - test_msg->obs[1].cn0 = 143; - test_msg->obs[1].lock = 0; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 203; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[2].L.f = 159; - test_msg->obs[2].L.i = 122530275; - test_msg->obs[2].P = 2331530678; - test_msg->obs[2].cn0 = 150; - test_msg->obs[2].lock = 0; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 208; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[3].L.f = 7; - test_msg->obs[3].L.i = 119281418; - test_msg->obs[3].P = 2269714449; - test_msg->obs[3].cn0 = 156; - test_msg->obs[3].lock = 0; - test_msg->obs[3].sid.code = 0; - test_msg->obs[3].sid.reserved = 0; - test_msg->obs[3].sid.sat = 212; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[4].L.f = 186; - test_msg->obs[4].L.i = 109692070; - test_msg->obs[4].P = 2087295852; - test_msg->obs[4].cn0 = 170; - test_msg->obs[4].lock = 0; - test_msg->obs[4].sid.code = 0; - test_msg->obs[4].sid.reserved = 0; - test_msg->obs[4].sid.sat = 217; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[5].L.f = 236; - test_msg->obs[5].L.i = 123339597; - test_msg->obs[5].P = 2347011798; - test_msg->obs[5].cn0 = 151; - test_msg->obs[5].lock = 0; - test_msg->obs[5].sid.code = 0; - test_msg->obs[5].sid.reserved = 0; - test_msg->obs[5].sid.sat = 218; - sbp_payload_send(&sbp_state, 0x43, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x43, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_dep_b_t* check_msg = (msg_obs_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 32, - "incorrect value for header.n_obs, expected 32, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.tow == 2568200, - "incorrect value for header.t.tow, expected 2568200, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 1787, - "incorrect value for header.t.wn, expected 1787, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].L.f == 165, - "incorrect value for obs[0].L.f, expected 165, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == 117912057, - "incorrect value for obs[0].L.i, expected 117912057, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 2243649790, - "incorrect value for obs[0].P, expected 2243649790, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].cn0 == 156, - "incorrect value for obs[0].cn0, expected 156, is %d", - check_msg->obs[0].cn0); - ck_assert_msg(check_msg->obs[0].lock == 0, - "incorrect value for obs[0].lock, expected 0, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].sid.code == 0, - "incorrect value for obs[0].sid.code, expected 0, is %d", - check_msg->obs[0].sid.code); - ck_assert_msg(check_msg->obs[0].sid.reserved == 0, - "incorrect value for obs[0].sid.reserved, expected 0, is %d", - check_msg->obs[0].sid.reserved); - ck_assert_msg(check_msg->obs[0].sid.sat == 202, - "incorrect value for obs[0].sid.sat, expected 202, is %d", - check_msg->obs[0].sid.sat); - ck_assert_msg(check_msg->obs[1].L.f == 106, - "incorrect value for obs[1].L.f, expected 106, is %d", - check_msg->obs[1].L.f); - ck_assert_msg(check_msg->obs[1].L.i == 129900811, - "incorrect value for obs[1].L.i, expected 129900811, is %d", - check_msg->obs[1].L.i); - ck_assert_msg(check_msg->obs[1].P == 2471880049, - "incorrect value for obs[1].P, expected 2471880049, is %d", - check_msg->obs[1].P); - ck_assert_msg(check_msg->obs[1].cn0 == 143, - "incorrect value for obs[1].cn0, expected 143, is %d", - check_msg->obs[1].cn0); - ck_assert_msg(check_msg->obs[1].lock == 0, - "incorrect value for obs[1].lock, expected 0, is %d", - check_msg->obs[1].lock); - ck_assert_msg(check_msg->obs[1].sid.code == 0, - "incorrect value for obs[1].sid.code, expected 0, is %d", - check_msg->obs[1].sid.code); - ck_assert_msg(check_msg->obs[1].sid.reserved == 0, - "incorrect value for obs[1].sid.reserved, expected 0, is %d", - check_msg->obs[1].sid.reserved); - ck_assert_msg(check_msg->obs[1].sid.sat == 203, - "incorrect value for obs[1].sid.sat, expected 203, is %d", - check_msg->obs[1].sid.sat); - ck_assert_msg(check_msg->obs[2].L.f == 159, - "incorrect value for obs[2].L.f, expected 159, is %d", - check_msg->obs[2].L.f); - ck_assert_msg(check_msg->obs[2].L.i == 122530275, - "incorrect value for obs[2].L.i, expected 122530275, is %d", - check_msg->obs[2].L.i); - ck_assert_msg(check_msg->obs[2].P == 2331530678, - "incorrect value for obs[2].P, expected 2331530678, is %d", - check_msg->obs[2].P); - ck_assert_msg(check_msg->obs[2].cn0 == 150, - "incorrect value for obs[2].cn0, expected 150, is %d", - check_msg->obs[2].cn0); - ck_assert_msg(check_msg->obs[2].lock == 0, - "incorrect value for obs[2].lock, expected 0, is %d", - check_msg->obs[2].lock); - ck_assert_msg(check_msg->obs[2].sid.code == 0, - "incorrect value for obs[2].sid.code, expected 0, is %d", - check_msg->obs[2].sid.code); - ck_assert_msg(check_msg->obs[2].sid.reserved == 0, - "incorrect value for obs[2].sid.reserved, expected 0, is %d", - check_msg->obs[2].sid.reserved); - ck_assert_msg(check_msg->obs[2].sid.sat == 208, - "incorrect value for obs[2].sid.sat, expected 208, is %d", - check_msg->obs[2].sid.sat); - ck_assert_msg(check_msg->obs[3].L.f == 7, - "incorrect value for obs[3].L.f, expected 7, is %d", - check_msg->obs[3].L.f); - ck_assert_msg(check_msg->obs[3].L.i == 119281418, - "incorrect value for obs[3].L.i, expected 119281418, is %d", - check_msg->obs[3].L.i); - ck_assert_msg(check_msg->obs[3].P == 2269714449, - "incorrect value for obs[3].P, expected 2269714449, is %d", - check_msg->obs[3].P); - ck_assert_msg(check_msg->obs[3].cn0 == 156, - "incorrect value for obs[3].cn0, expected 156, is %d", - check_msg->obs[3].cn0); - ck_assert_msg(check_msg->obs[3].lock == 0, - "incorrect value for obs[3].lock, expected 0, is %d", - check_msg->obs[3].lock); - ck_assert_msg(check_msg->obs[3].sid.code == 0, - "incorrect value for obs[3].sid.code, expected 0, is %d", - check_msg->obs[3].sid.code); - ck_assert_msg(check_msg->obs[3].sid.reserved == 0, - "incorrect value for obs[3].sid.reserved, expected 0, is %d", - check_msg->obs[3].sid.reserved); - ck_assert_msg(check_msg->obs[3].sid.sat == 212, - "incorrect value for obs[3].sid.sat, expected 212, is %d", - check_msg->obs[3].sid.sat); - ck_assert_msg(check_msg->obs[4].L.f == 186, - "incorrect value for obs[4].L.f, expected 186, is %d", - check_msg->obs[4].L.f); - ck_assert_msg(check_msg->obs[4].L.i == 109692070, - "incorrect value for obs[4].L.i, expected 109692070, is %d", - check_msg->obs[4].L.i); - ck_assert_msg(check_msg->obs[4].P == 2087295852, - "incorrect value for obs[4].P, expected 2087295852, is %d", - check_msg->obs[4].P); - ck_assert_msg(check_msg->obs[4].cn0 == 170, - "incorrect value for obs[4].cn0, expected 170, is %d", - check_msg->obs[4].cn0); - ck_assert_msg(check_msg->obs[4].lock == 0, - "incorrect value for obs[4].lock, expected 0, is %d", - check_msg->obs[4].lock); - ck_assert_msg(check_msg->obs[4].sid.code == 0, - "incorrect value for obs[4].sid.code, expected 0, is %d", - check_msg->obs[4].sid.code); - ck_assert_msg(check_msg->obs[4].sid.reserved == 0, - "incorrect value for obs[4].sid.reserved, expected 0, is %d", - check_msg->obs[4].sid.reserved); - ck_assert_msg(check_msg->obs[4].sid.sat == 217, - "incorrect value for obs[4].sid.sat, expected 217, is %d", - check_msg->obs[4].sid.sat); - ck_assert_msg(check_msg->obs[5].L.f == 236, - "incorrect value for obs[5].L.f, expected 236, is %d", - check_msg->obs[5].L.f); - ck_assert_msg(check_msg->obs[5].L.i == 123339597, - "incorrect value for obs[5].L.i, expected 123339597, is %d", - check_msg->obs[5].L.i); - ck_assert_msg(check_msg->obs[5].P == 2347011798, - "incorrect value for obs[5].P, expected 2347011798, is %d", - check_msg->obs[5].P); - ck_assert_msg(check_msg->obs[5].cn0 == 151, - "incorrect value for obs[5].cn0, expected 151, is %d", - check_msg->obs[5].cn0); - ck_assert_msg(check_msg->obs[5].lock == 0, - "incorrect value for obs[5].lock, expected 0, is %d", - check_msg->obs[5].lock); - ck_assert_msg(check_msg->obs[5].sid.code == 0, - "incorrect value for obs[5].sid.code, expected 0, is %d", - check_msg->obs[5].sid.code); - ck_assert_msg(check_msg->obs[5].sid.reserved == 0, - "incorrect value for obs[5].sid.reserved, expected 0, is %d", - check_msg->obs[5].sid.reserved); - ck_assert_msg(check_msg->obs[5].sid.sat == 218, - "incorrect value for obs[5].sid.sat, expected 218, is %d", - check_msg->obs[5].sid.sat); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_observation_MsgObsDepB_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_observation_MsgObsDepB"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgObsDepB"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_observation_MsgObsDepB); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgObsDepC.c b/c/test/legacy/auto_check_sbp_observation_MsgObsDepC.c deleted file mode 100644 index 18bd59c52e..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgObsDepC.c +++ /dev/null @@ -1,1383 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgObsDepC.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgObsDepC) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x49, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x49, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 73, 0, 70, 152, 87, 8, 95, 183, 24, 106, 7, 32, 126, - 250, 73, 80, 113, 94, 247, 255, 231, 163, 229, 229, 4, 0, 0, - 0, 60, 220, 96, 70, 81, 147, 250, 255, 196, 208, 20, 28, 6, - 0, 0, 0, 248, 61, 62, 77, 28, 60, 242, 255, 110, 171, 180, - 178, 7, 0, 0, 0, 237, 84, 190, 77, 172, 37, 13, 0, 41, - 170, 233, 164, 10, 0, 0, 0, 36, 85, 9, 75, 240, 188, 21, - 0, 19, 182, 196, 209, 12, 0, 0, 0, 190, 175, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_dep_c_t* test_msg = (msg_obs_dep_c_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.tow = 414670600; - test_msg->header.t.wn = 1898; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].L.f = 231; - test_msg->obs[0].L.i = -565647; - test_msg->obs[0].P = 1347025534; - test_msg->obs[0].cn0 = 163; - test_msg->obs[0].lock = 58853; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 4; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[1].L.f = 196; - test_msg->obs[1].L.i = -355503; - test_msg->obs[1].P = 1180752956; - test_msg->obs[1].cn0 = 208; - test_msg->obs[1].lock = 7188; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 6; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[2].L.f = 110; - test_msg->obs[2].L.i = -902116; - test_msg->obs[2].P = 1295924728; - test_msg->obs[2].cn0 = 171; - test_msg->obs[2].lock = 45748; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 7; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[3].L.f = 41; - test_msg->obs[3].L.i = 861612; - test_msg->obs[3].P = 1304319213; - test_msg->obs[3].cn0 = 170; - test_msg->obs[3].lock = 42217; - test_msg->obs[3].sid.code = 0; - test_msg->obs[3].sid.reserved = 0; - test_msg->obs[3].sid.sat = 10; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[4].L.f = 19; - test_msg->obs[4].L.i = 1424624; - test_msg->obs[4].P = 1258902820; - test_msg->obs[4].cn0 = 182; - test_msg->obs[4].lock = 53700; - test_msg->obs[4].sid.code = 0; - test_msg->obs[4].sid.reserved = 0; - test_msg->obs[4].sid.sat = 12; - sbp_payload_send(&sbp_state, 0x49, 38982, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 38982, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 38982, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x49, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_dep_c_t* check_msg = (msg_obs_dep_c_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 32, - "incorrect value for header.n_obs, expected 32, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.tow == 414670600, - "incorrect value for header.t.tow, expected 414670600, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 1898, - "incorrect value for header.t.wn, expected 1898, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].L.f == 231, - "incorrect value for obs[0].L.f, expected 231, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == -565647, - "incorrect value for obs[0].L.i, expected -565647, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 1347025534, - "incorrect value for obs[0].P, expected 1347025534, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].cn0 == 163, - "incorrect value for obs[0].cn0, expected 163, is %d", - check_msg->obs[0].cn0); - ck_assert_msg(check_msg->obs[0].lock == 58853, - "incorrect value for obs[0].lock, expected 58853, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].sid.code == 0, - "incorrect value for obs[0].sid.code, expected 0, is %d", - check_msg->obs[0].sid.code); - ck_assert_msg(check_msg->obs[0].sid.reserved == 0, - "incorrect value for obs[0].sid.reserved, expected 0, is %d", - check_msg->obs[0].sid.reserved); - ck_assert_msg(check_msg->obs[0].sid.sat == 4, - "incorrect value for obs[0].sid.sat, expected 4, is %d", - check_msg->obs[0].sid.sat); - ck_assert_msg(check_msg->obs[1].L.f == 196, - "incorrect value for obs[1].L.f, expected 196, is %d", - check_msg->obs[1].L.f); - ck_assert_msg(check_msg->obs[1].L.i == -355503, - "incorrect value for obs[1].L.i, expected -355503, is %d", - check_msg->obs[1].L.i); - ck_assert_msg(check_msg->obs[1].P == 1180752956, - "incorrect value for obs[1].P, expected 1180752956, is %d", - check_msg->obs[1].P); - ck_assert_msg(check_msg->obs[1].cn0 == 208, - "incorrect value for obs[1].cn0, expected 208, is %d", - check_msg->obs[1].cn0); - ck_assert_msg(check_msg->obs[1].lock == 7188, - "incorrect value for obs[1].lock, expected 7188, is %d", - check_msg->obs[1].lock); - ck_assert_msg(check_msg->obs[1].sid.code == 0, - "incorrect value for obs[1].sid.code, expected 0, is %d", - check_msg->obs[1].sid.code); - ck_assert_msg(check_msg->obs[1].sid.reserved == 0, - "incorrect value for obs[1].sid.reserved, expected 0, is %d", - check_msg->obs[1].sid.reserved); - ck_assert_msg(check_msg->obs[1].sid.sat == 6, - "incorrect value for obs[1].sid.sat, expected 6, is %d", - check_msg->obs[1].sid.sat); - ck_assert_msg(check_msg->obs[2].L.f == 110, - "incorrect value for obs[2].L.f, expected 110, is %d", - check_msg->obs[2].L.f); - ck_assert_msg(check_msg->obs[2].L.i == -902116, - "incorrect value for obs[2].L.i, expected -902116, is %d", - check_msg->obs[2].L.i); - ck_assert_msg(check_msg->obs[2].P == 1295924728, - "incorrect value for obs[2].P, expected 1295924728, is %d", - check_msg->obs[2].P); - ck_assert_msg(check_msg->obs[2].cn0 == 171, - "incorrect value for obs[2].cn0, expected 171, is %d", - check_msg->obs[2].cn0); - ck_assert_msg(check_msg->obs[2].lock == 45748, - "incorrect value for obs[2].lock, expected 45748, is %d", - check_msg->obs[2].lock); - ck_assert_msg(check_msg->obs[2].sid.code == 0, - "incorrect value for obs[2].sid.code, expected 0, is %d", - check_msg->obs[2].sid.code); - ck_assert_msg(check_msg->obs[2].sid.reserved == 0, - "incorrect value for obs[2].sid.reserved, expected 0, is %d", - check_msg->obs[2].sid.reserved); - ck_assert_msg(check_msg->obs[2].sid.sat == 7, - "incorrect value for obs[2].sid.sat, expected 7, is %d", - check_msg->obs[2].sid.sat); - ck_assert_msg(check_msg->obs[3].L.f == 41, - "incorrect value for obs[3].L.f, expected 41, is %d", - check_msg->obs[3].L.f); - ck_assert_msg(check_msg->obs[3].L.i == 861612, - "incorrect value for obs[3].L.i, expected 861612, is %d", - check_msg->obs[3].L.i); - ck_assert_msg(check_msg->obs[3].P == 1304319213, - "incorrect value for obs[3].P, expected 1304319213, is %d", - check_msg->obs[3].P); - ck_assert_msg(check_msg->obs[3].cn0 == 170, - "incorrect value for obs[3].cn0, expected 170, is %d", - check_msg->obs[3].cn0); - ck_assert_msg(check_msg->obs[3].lock == 42217, - "incorrect value for obs[3].lock, expected 42217, is %d", - check_msg->obs[3].lock); - ck_assert_msg(check_msg->obs[3].sid.code == 0, - "incorrect value for obs[3].sid.code, expected 0, is %d", - check_msg->obs[3].sid.code); - ck_assert_msg(check_msg->obs[3].sid.reserved == 0, - "incorrect value for obs[3].sid.reserved, expected 0, is %d", - check_msg->obs[3].sid.reserved); - ck_assert_msg(check_msg->obs[3].sid.sat == 10, - "incorrect value for obs[3].sid.sat, expected 10, is %d", - check_msg->obs[3].sid.sat); - ck_assert_msg(check_msg->obs[4].L.f == 19, - "incorrect value for obs[4].L.f, expected 19, is %d", - check_msg->obs[4].L.f); - ck_assert_msg(check_msg->obs[4].L.i == 1424624, - "incorrect value for obs[4].L.i, expected 1424624, is %d", - check_msg->obs[4].L.i); - ck_assert_msg(check_msg->obs[4].P == 1258902820, - "incorrect value for obs[4].P, expected 1258902820, is %d", - check_msg->obs[4].P); - ck_assert_msg(check_msg->obs[4].cn0 == 182, - "incorrect value for obs[4].cn0, expected 182, is %d", - check_msg->obs[4].cn0); - ck_assert_msg(check_msg->obs[4].lock == 53700, - "incorrect value for obs[4].lock, expected 53700, is %d", - check_msg->obs[4].lock); - ck_assert_msg(check_msg->obs[4].sid.code == 0, - "incorrect value for obs[4].sid.code, expected 0, is %d", - check_msg->obs[4].sid.code); - ck_assert_msg(check_msg->obs[4].sid.reserved == 0, - "incorrect value for obs[4].sid.reserved, expected 0, is %d", - check_msg->obs[4].sid.reserved); - ck_assert_msg(check_msg->obs[4].sid.sat == 12, - "incorrect value for obs[4].sid.sat, expected 12, is %d", - check_msg->obs[4].sid.sat); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x49, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x49, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 73, 0, 70, 152, 55, 8, 95, 183, 24, 106, 7, 33, 68, 166, 75, - 77, 186, 230, 24, 0, 101, 186, 162, 102, 16, 0, 0, 0, 87, 255, 155, - 69, 74, 158, 5, 0, 26, 190, 206, 30, 27, 0, 0, 0, 64, 89, 124, - 68, 26, 22, 3, 0, 114, 217, 225, 73, 29, 0, 0, 0, 37, 179, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_dep_c_t* test_msg = (msg_obs_dep_c_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 33; - test_msg->header.t.tow = 414670600; - test_msg->header.t.wn = 1898; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].L.f = 101; - test_msg->obs[0].L.i = 1631930; - test_msg->obs[0].P = 1296803396; - test_msg->obs[0].cn0 = 186; - test_msg->obs[0].lock = 26274; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 16; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[1].L.f = 26; - test_msg->obs[1].L.i = 368202; - test_msg->obs[1].P = 1167851351; - test_msg->obs[1].cn0 = 190; - test_msg->obs[1].lock = 7886; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 27; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[2].L.f = 114; - test_msg->obs[2].L.i = 202266; - test_msg->obs[2].P = 1149000000; - test_msg->obs[2].cn0 = 217; - test_msg->obs[2].lock = 18913; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 29; - sbp_payload_send(&sbp_state, 0x49, 38982, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 38982, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 38982, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x49, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_dep_c_t* check_msg = (msg_obs_dep_c_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 33, - "incorrect value for header.n_obs, expected 33, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.tow == 414670600, - "incorrect value for header.t.tow, expected 414670600, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 1898, - "incorrect value for header.t.wn, expected 1898, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].L.f == 101, - "incorrect value for obs[0].L.f, expected 101, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == 1631930, - "incorrect value for obs[0].L.i, expected 1631930, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 1296803396, - "incorrect value for obs[0].P, expected 1296803396, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].cn0 == 186, - "incorrect value for obs[0].cn0, expected 186, is %d", - check_msg->obs[0].cn0); - ck_assert_msg(check_msg->obs[0].lock == 26274, - "incorrect value for obs[0].lock, expected 26274, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].sid.code == 0, - "incorrect value for obs[0].sid.code, expected 0, is %d", - check_msg->obs[0].sid.code); - ck_assert_msg(check_msg->obs[0].sid.reserved == 0, - "incorrect value for obs[0].sid.reserved, expected 0, is %d", - check_msg->obs[0].sid.reserved); - ck_assert_msg(check_msg->obs[0].sid.sat == 16, - "incorrect value for obs[0].sid.sat, expected 16, is %d", - check_msg->obs[0].sid.sat); - ck_assert_msg(check_msg->obs[1].L.f == 26, - "incorrect value for obs[1].L.f, expected 26, is %d", - check_msg->obs[1].L.f); - ck_assert_msg(check_msg->obs[1].L.i == 368202, - "incorrect value for obs[1].L.i, expected 368202, is %d", - check_msg->obs[1].L.i); - ck_assert_msg(check_msg->obs[1].P == 1167851351, - "incorrect value for obs[1].P, expected 1167851351, is %d", - check_msg->obs[1].P); - ck_assert_msg(check_msg->obs[1].cn0 == 190, - "incorrect value for obs[1].cn0, expected 190, is %d", - check_msg->obs[1].cn0); - ck_assert_msg(check_msg->obs[1].lock == 7886, - "incorrect value for obs[1].lock, expected 7886, is %d", - check_msg->obs[1].lock); - ck_assert_msg(check_msg->obs[1].sid.code == 0, - "incorrect value for obs[1].sid.code, expected 0, is %d", - check_msg->obs[1].sid.code); - ck_assert_msg(check_msg->obs[1].sid.reserved == 0, - "incorrect value for obs[1].sid.reserved, expected 0, is %d", - check_msg->obs[1].sid.reserved); - ck_assert_msg(check_msg->obs[1].sid.sat == 27, - "incorrect value for obs[1].sid.sat, expected 27, is %d", - check_msg->obs[1].sid.sat); - ck_assert_msg(check_msg->obs[2].L.f == 114, - "incorrect value for obs[2].L.f, expected 114, is %d", - check_msg->obs[2].L.f); - ck_assert_msg(check_msg->obs[2].L.i == 202266, - "incorrect value for obs[2].L.i, expected 202266, is %d", - check_msg->obs[2].L.i); - ck_assert_msg(check_msg->obs[2].P == 1149000000, - "incorrect value for obs[2].P, expected 1149000000, is %d", - check_msg->obs[2].P); - ck_assert_msg(check_msg->obs[2].cn0 == 217, - "incorrect value for obs[2].cn0, expected 217, is %d", - check_msg->obs[2].cn0); - ck_assert_msg(check_msg->obs[2].lock == 18913, - "incorrect value for obs[2].lock, expected 18913, is %d", - check_msg->obs[2].lock); - ck_assert_msg(check_msg->obs[2].sid.code == 0, - "incorrect value for obs[2].sid.code, expected 0, is %d", - check_msg->obs[2].sid.code); - ck_assert_msg(check_msg->obs[2].sid.reserved == 0, - "incorrect value for obs[2].sid.reserved, expected 0, is %d", - check_msg->obs[2].sid.reserved); - ck_assert_msg(check_msg->obs[2].sid.sat == 29, - "incorrect value for obs[2].sid.sat, expected 29, is %d", - check_msg->obs[2].sid.sat); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x49, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x49, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 73, 0, 0, 0, 87, 8, 95, 183, 24, 106, 7, 32, 217, - 251, 73, 80, 9, 72, 248, 255, 30, 168, 113, 81, 4, 0, 0, - 0, 211, 220, 96, 70, 198, 107, 251, 255, 115, 195, 53, 144, 6, - 0, 0, 0, 77, 61, 62, 77, 40, 161, 243, 255, 130, 176, 93, - 142, 7, 0, 0, 0, 1, 86, 190, 77, 88, 77, 12, 0, 116, - 199, 229, 213, 10, 0, 0, 0, 93, 85, 9, 75, 64, 139, 20, - 0, 120, 177, 196, 194, 12, 0, 0, 0, 141, 161, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_dep_c_t* test_msg = (msg_obs_dep_c_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.tow = 414670600; - test_msg->header.t.wn = 1898; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].L.f = 30; - test_msg->obs[0].L.i = -505847; - test_msg->obs[0].P = 1347025881; - test_msg->obs[0].cn0 = 168; - test_msg->obs[0].lock = 20849; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 4; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[1].L.f = 115; - test_msg->obs[1].L.i = -300090; - test_msg->obs[1].P = 1180753107; - test_msg->obs[1].cn0 = 195; - test_msg->obs[1].lock = 36917; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 6; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[2].L.f = 130; - test_msg->obs[2].L.i = -810712; - test_msg->obs[2].P = 1295924557; - test_msg->obs[2].cn0 = 176; - test_msg->obs[2].lock = 36445; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 7; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[3].L.f = 116; - test_msg->obs[3].L.i = 806232; - test_msg->obs[3].P = 1304319489; - test_msg->obs[3].cn0 = 199; - test_msg->obs[3].lock = 54757; - test_msg->obs[3].sid.code = 0; - test_msg->obs[3].sid.reserved = 0; - test_msg->obs[3].sid.sat = 10; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[4].L.f = 120; - test_msg->obs[4].L.i = 1346368; - test_msg->obs[4].P = 1258902877; - test_msg->obs[4].cn0 = 177; - test_msg->obs[4].lock = 49860; - test_msg->obs[4].sid.code = 0; - test_msg->obs[4].sid.reserved = 0; - test_msg->obs[4].sid.sat = 12; - sbp_payload_send(&sbp_state, 0x49, 0, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 0, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 0, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x49, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_dep_c_t* check_msg = (msg_obs_dep_c_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 32, - "incorrect value for header.n_obs, expected 32, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.tow == 414670600, - "incorrect value for header.t.tow, expected 414670600, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 1898, - "incorrect value for header.t.wn, expected 1898, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].L.f == 30, - "incorrect value for obs[0].L.f, expected 30, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == -505847, - "incorrect value for obs[0].L.i, expected -505847, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 1347025881, - "incorrect value for obs[0].P, expected 1347025881, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].cn0 == 168, - "incorrect value for obs[0].cn0, expected 168, is %d", - check_msg->obs[0].cn0); - ck_assert_msg(check_msg->obs[0].lock == 20849, - "incorrect value for obs[0].lock, expected 20849, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].sid.code == 0, - "incorrect value for obs[0].sid.code, expected 0, is %d", - check_msg->obs[0].sid.code); - ck_assert_msg(check_msg->obs[0].sid.reserved == 0, - "incorrect value for obs[0].sid.reserved, expected 0, is %d", - check_msg->obs[0].sid.reserved); - ck_assert_msg(check_msg->obs[0].sid.sat == 4, - "incorrect value for obs[0].sid.sat, expected 4, is %d", - check_msg->obs[0].sid.sat); - ck_assert_msg(check_msg->obs[1].L.f == 115, - "incorrect value for obs[1].L.f, expected 115, is %d", - check_msg->obs[1].L.f); - ck_assert_msg(check_msg->obs[1].L.i == -300090, - "incorrect value for obs[1].L.i, expected -300090, is %d", - check_msg->obs[1].L.i); - ck_assert_msg(check_msg->obs[1].P == 1180753107, - "incorrect value for obs[1].P, expected 1180753107, is %d", - check_msg->obs[1].P); - ck_assert_msg(check_msg->obs[1].cn0 == 195, - "incorrect value for obs[1].cn0, expected 195, is %d", - check_msg->obs[1].cn0); - ck_assert_msg(check_msg->obs[1].lock == 36917, - "incorrect value for obs[1].lock, expected 36917, is %d", - check_msg->obs[1].lock); - ck_assert_msg(check_msg->obs[1].sid.code == 0, - "incorrect value for obs[1].sid.code, expected 0, is %d", - check_msg->obs[1].sid.code); - ck_assert_msg(check_msg->obs[1].sid.reserved == 0, - "incorrect value for obs[1].sid.reserved, expected 0, is %d", - check_msg->obs[1].sid.reserved); - ck_assert_msg(check_msg->obs[1].sid.sat == 6, - "incorrect value for obs[1].sid.sat, expected 6, is %d", - check_msg->obs[1].sid.sat); - ck_assert_msg(check_msg->obs[2].L.f == 130, - "incorrect value for obs[2].L.f, expected 130, is %d", - check_msg->obs[2].L.f); - ck_assert_msg(check_msg->obs[2].L.i == -810712, - "incorrect value for obs[2].L.i, expected -810712, is %d", - check_msg->obs[2].L.i); - ck_assert_msg(check_msg->obs[2].P == 1295924557, - "incorrect value for obs[2].P, expected 1295924557, is %d", - check_msg->obs[2].P); - ck_assert_msg(check_msg->obs[2].cn0 == 176, - "incorrect value for obs[2].cn0, expected 176, is %d", - check_msg->obs[2].cn0); - ck_assert_msg(check_msg->obs[2].lock == 36445, - "incorrect value for obs[2].lock, expected 36445, is %d", - check_msg->obs[2].lock); - ck_assert_msg(check_msg->obs[2].sid.code == 0, - "incorrect value for obs[2].sid.code, expected 0, is %d", - check_msg->obs[2].sid.code); - ck_assert_msg(check_msg->obs[2].sid.reserved == 0, - "incorrect value for obs[2].sid.reserved, expected 0, is %d", - check_msg->obs[2].sid.reserved); - ck_assert_msg(check_msg->obs[2].sid.sat == 7, - "incorrect value for obs[2].sid.sat, expected 7, is %d", - check_msg->obs[2].sid.sat); - ck_assert_msg(check_msg->obs[3].L.f == 116, - "incorrect value for obs[3].L.f, expected 116, is %d", - check_msg->obs[3].L.f); - ck_assert_msg(check_msg->obs[3].L.i == 806232, - "incorrect value for obs[3].L.i, expected 806232, is %d", - check_msg->obs[3].L.i); - ck_assert_msg(check_msg->obs[3].P == 1304319489, - "incorrect value for obs[3].P, expected 1304319489, is %d", - check_msg->obs[3].P); - ck_assert_msg(check_msg->obs[3].cn0 == 199, - "incorrect value for obs[3].cn0, expected 199, is %d", - check_msg->obs[3].cn0); - ck_assert_msg(check_msg->obs[3].lock == 54757, - "incorrect value for obs[3].lock, expected 54757, is %d", - check_msg->obs[3].lock); - ck_assert_msg(check_msg->obs[3].sid.code == 0, - "incorrect value for obs[3].sid.code, expected 0, is %d", - check_msg->obs[3].sid.code); - ck_assert_msg(check_msg->obs[3].sid.reserved == 0, - "incorrect value for obs[3].sid.reserved, expected 0, is %d", - check_msg->obs[3].sid.reserved); - ck_assert_msg(check_msg->obs[3].sid.sat == 10, - "incorrect value for obs[3].sid.sat, expected 10, is %d", - check_msg->obs[3].sid.sat); - ck_assert_msg(check_msg->obs[4].L.f == 120, - "incorrect value for obs[4].L.f, expected 120, is %d", - check_msg->obs[4].L.f); - ck_assert_msg(check_msg->obs[4].L.i == 1346368, - "incorrect value for obs[4].L.i, expected 1346368, is %d", - check_msg->obs[4].L.i); - ck_assert_msg(check_msg->obs[4].P == 1258902877, - "incorrect value for obs[4].P, expected 1258902877, is %d", - check_msg->obs[4].P); - ck_assert_msg(check_msg->obs[4].cn0 == 177, - "incorrect value for obs[4].cn0, expected 177, is %d", - check_msg->obs[4].cn0); - ck_assert_msg(check_msg->obs[4].lock == 49860, - "incorrect value for obs[4].lock, expected 49860, is %d", - check_msg->obs[4].lock); - ck_assert_msg(check_msg->obs[4].sid.code == 0, - "incorrect value for obs[4].sid.code, expected 0, is %d", - check_msg->obs[4].sid.code); - ck_assert_msg(check_msg->obs[4].sid.reserved == 0, - "incorrect value for obs[4].sid.reserved, expected 0, is %d", - check_msg->obs[4].sid.reserved); - ck_assert_msg(check_msg->obs[4].sid.sat == 12, - "incorrect value for obs[4].sid.sat, expected 12, is %d", - check_msg->obs[4].sid.sat); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x49, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x49, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 73, 0, 0, 0, 55, 8, 95, 183, 24, 106, 7, 33, 70, 167, 75, - 77, 140, 136, 23, 0, 90, 187, 158, 129, 16, 0, 0, 0, 232, 255, 155, - 69, 45, 175, 5, 0, 17, 208, 175, 56, 27, 0, 0, 0, 64, 89, 124, - 68, 45, 96, 3, 0, 75, 185, 73, 206, 29, 0, 0, 0, 220, 158, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_dep_c_t* test_msg = (msg_obs_dep_c_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 33; - test_msg->header.t.tow = 414670600; - test_msg->header.t.wn = 1898; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].L.f = 90; - test_msg->obs[0].L.i = 1542284; - test_msg->obs[0].P = 1296803654; - test_msg->obs[0].cn0 = 187; - test_msg->obs[0].lock = 33182; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 16; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[1].L.f = 17; - test_msg->obs[1].L.i = 372525; - test_msg->obs[1].P = 1167851496; - test_msg->obs[1].cn0 = 208; - test_msg->obs[1].lock = 14511; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 27; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[2].L.f = 75; - test_msg->obs[2].L.i = 221229; - test_msg->obs[2].P = 1149000000; - test_msg->obs[2].cn0 = 185; - test_msg->obs[2].lock = 52809; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 29; - sbp_payload_send(&sbp_state, 0x49, 0, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 0, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 0, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x49, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_dep_c_t* check_msg = (msg_obs_dep_c_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 33, - "incorrect value for header.n_obs, expected 33, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.tow == 414670600, - "incorrect value for header.t.tow, expected 414670600, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 1898, - "incorrect value for header.t.wn, expected 1898, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].L.f == 90, - "incorrect value for obs[0].L.f, expected 90, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == 1542284, - "incorrect value for obs[0].L.i, expected 1542284, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 1296803654, - "incorrect value for obs[0].P, expected 1296803654, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].cn0 == 187, - "incorrect value for obs[0].cn0, expected 187, is %d", - check_msg->obs[0].cn0); - ck_assert_msg(check_msg->obs[0].lock == 33182, - "incorrect value for obs[0].lock, expected 33182, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].sid.code == 0, - "incorrect value for obs[0].sid.code, expected 0, is %d", - check_msg->obs[0].sid.code); - ck_assert_msg(check_msg->obs[0].sid.reserved == 0, - "incorrect value for obs[0].sid.reserved, expected 0, is %d", - check_msg->obs[0].sid.reserved); - ck_assert_msg(check_msg->obs[0].sid.sat == 16, - "incorrect value for obs[0].sid.sat, expected 16, is %d", - check_msg->obs[0].sid.sat); - ck_assert_msg(check_msg->obs[1].L.f == 17, - "incorrect value for obs[1].L.f, expected 17, is %d", - check_msg->obs[1].L.f); - ck_assert_msg(check_msg->obs[1].L.i == 372525, - "incorrect value for obs[1].L.i, expected 372525, is %d", - check_msg->obs[1].L.i); - ck_assert_msg(check_msg->obs[1].P == 1167851496, - "incorrect value for obs[1].P, expected 1167851496, is %d", - check_msg->obs[1].P); - ck_assert_msg(check_msg->obs[1].cn0 == 208, - "incorrect value for obs[1].cn0, expected 208, is %d", - check_msg->obs[1].cn0); - ck_assert_msg(check_msg->obs[1].lock == 14511, - "incorrect value for obs[1].lock, expected 14511, is %d", - check_msg->obs[1].lock); - ck_assert_msg(check_msg->obs[1].sid.code == 0, - "incorrect value for obs[1].sid.code, expected 0, is %d", - check_msg->obs[1].sid.code); - ck_assert_msg(check_msg->obs[1].sid.reserved == 0, - "incorrect value for obs[1].sid.reserved, expected 0, is %d", - check_msg->obs[1].sid.reserved); - ck_assert_msg(check_msg->obs[1].sid.sat == 27, - "incorrect value for obs[1].sid.sat, expected 27, is %d", - check_msg->obs[1].sid.sat); - ck_assert_msg(check_msg->obs[2].L.f == 75, - "incorrect value for obs[2].L.f, expected 75, is %d", - check_msg->obs[2].L.f); - ck_assert_msg(check_msg->obs[2].L.i == 221229, - "incorrect value for obs[2].L.i, expected 221229, is %d", - check_msg->obs[2].L.i); - ck_assert_msg(check_msg->obs[2].P == 1149000000, - "incorrect value for obs[2].P, expected 1149000000, is %d", - check_msg->obs[2].P); - ck_assert_msg(check_msg->obs[2].cn0 == 185, - "incorrect value for obs[2].cn0, expected 185, is %d", - check_msg->obs[2].cn0); - ck_assert_msg(check_msg->obs[2].lock == 52809, - "incorrect value for obs[2].lock, expected 52809, is %d", - check_msg->obs[2].lock); - ck_assert_msg(check_msg->obs[2].sid.code == 0, - "incorrect value for obs[2].sid.code, expected 0, is %d", - check_msg->obs[2].sid.code); - ck_assert_msg(check_msg->obs[2].sid.reserved == 0, - "incorrect value for obs[2].sid.reserved, expected 0, is %d", - check_msg->obs[2].sid.reserved); - ck_assert_msg(check_msg->obs[2].sid.sat == 29, - "incorrect value for obs[2].sid.sat, expected 29, is %d", - check_msg->obs[2].sid.sat); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x49, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x49, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 73, 0, 70, 152, 87, 208, 95, 183, 24, 106, 7, 32, 44, - 8, 74, 80, 86, 93, 247, 255, 57, 158, 229, 229, 4, 0, 0, - 0, 224, 229, 96, 70, 156, 146, 250, 255, 221, 200, 20, 28, 6, - 0, 0, 0, 60, 82, 62, 77, 93, 58, 242, 255, 39, 164, 180, - 178, 7, 0, 0, 0, 222, 73, 190, 77, 46, 39, 13, 0, 202, - 181, 233, 164, 10, 0, 0, 0, 149, 64, 9, 75, 114, 191, 21, - 0, 249, 182, 196, 209, 12, 0, 0, 0, 112, 8, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_dep_c_t* test_msg = (msg_obs_dep_c_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.tow = 414670800; - test_msg->header.t.wn = 1898; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].L.f = 57; - test_msg->obs[0].L.i = -565930; - test_msg->obs[0].P = 1347029036; - test_msg->obs[0].cn0 = 158; - test_msg->obs[0].lock = 58853; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 4; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[1].L.f = 221; - test_msg->obs[1].L.i = -355684; - test_msg->obs[1].P = 1180755424; - test_msg->obs[1].cn0 = 200; - test_msg->obs[1].lock = 7188; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 6; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[2].L.f = 39; - test_msg->obs[2].L.i = -902563; - test_msg->obs[2].P = 1295929916; - test_msg->obs[2].cn0 = 164; - test_msg->obs[2].lock = 45748; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 7; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[3].L.f = 202; - test_msg->obs[3].L.i = 861998; - test_msg->obs[3].P = 1304316382; - test_msg->obs[3].cn0 = 181; - test_msg->obs[3].lock = 42217; - test_msg->obs[3].sid.code = 0; - test_msg->obs[3].sid.reserved = 0; - test_msg->obs[3].sid.sat = 10; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[4].L.f = 249; - test_msg->obs[4].L.i = 1425266; - test_msg->obs[4].P = 1258897557; - test_msg->obs[4].cn0 = 182; - test_msg->obs[4].lock = 53700; - test_msg->obs[4].sid.code = 0; - test_msg->obs[4].sid.reserved = 0; - test_msg->obs[4].sid.sat = 12; - sbp_payload_send(&sbp_state, 0x49, 38982, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 38982, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 38982, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x49, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_dep_c_t* check_msg = (msg_obs_dep_c_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 32, - "incorrect value for header.n_obs, expected 32, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.tow == 414670800, - "incorrect value for header.t.tow, expected 414670800, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 1898, - "incorrect value for header.t.wn, expected 1898, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].L.f == 57, - "incorrect value for obs[0].L.f, expected 57, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == -565930, - "incorrect value for obs[0].L.i, expected -565930, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 1347029036, - "incorrect value for obs[0].P, expected 1347029036, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].cn0 == 158, - "incorrect value for obs[0].cn0, expected 158, is %d", - check_msg->obs[0].cn0); - ck_assert_msg(check_msg->obs[0].lock == 58853, - "incorrect value for obs[0].lock, expected 58853, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].sid.code == 0, - "incorrect value for obs[0].sid.code, expected 0, is %d", - check_msg->obs[0].sid.code); - ck_assert_msg(check_msg->obs[0].sid.reserved == 0, - "incorrect value for obs[0].sid.reserved, expected 0, is %d", - check_msg->obs[0].sid.reserved); - ck_assert_msg(check_msg->obs[0].sid.sat == 4, - "incorrect value for obs[0].sid.sat, expected 4, is %d", - check_msg->obs[0].sid.sat); - ck_assert_msg(check_msg->obs[1].L.f == 221, - "incorrect value for obs[1].L.f, expected 221, is %d", - check_msg->obs[1].L.f); - ck_assert_msg(check_msg->obs[1].L.i == -355684, - "incorrect value for obs[1].L.i, expected -355684, is %d", - check_msg->obs[1].L.i); - ck_assert_msg(check_msg->obs[1].P == 1180755424, - "incorrect value for obs[1].P, expected 1180755424, is %d", - check_msg->obs[1].P); - ck_assert_msg(check_msg->obs[1].cn0 == 200, - "incorrect value for obs[1].cn0, expected 200, is %d", - check_msg->obs[1].cn0); - ck_assert_msg(check_msg->obs[1].lock == 7188, - "incorrect value for obs[1].lock, expected 7188, is %d", - check_msg->obs[1].lock); - ck_assert_msg(check_msg->obs[1].sid.code == 0, - "incorrect value for obs[1].sid.code, expected 0, is %d", - check_msg->obs[1].sid.code); - ck_assert_msg(check_msg->obs[1].sid.reserved == 0, - "incorrect value for obs[1].sid.reserved, expected 0, is %d", - check_msg->obs[1].sid.reserved); - ck_assert_msg(check_msg->obs[1].sid.sat == 6, - "incorrect value for obs[1].sid.sat, expected 6, is %d", - check_msg->obs[1].sid.sat); - ck_assert_msg(check_msg->obs[2].L.f == 39, - "incorrect value for obs[2].L.f, expected 39, is %d", - check_msg->obs[2].L.f); - ck_assert_msg(check_msg->obs[2].L.i == -902563, - "incorrect value for obs[2].L.i, expected -902563, is %d", - check_msg->obs[2].L.i); - ck_assert_msg(check_msg->obs[2].P == 1295929916, - "incorrect value for obs[2].P, expected 1295929916, is %d", - check_msg->obs[2].P); - ck_assert_msg(check_msg->obs[2].cn0 == 164, - "incorrect value for obs[2].cn0, expected 164, is %d", - check_msg->obs[2].cn0); - ck_assert_msg(check_msg->obs[2].lock == 45748, - "incorrect value for obs[2].lock, expected 45748, is %d", - check_msg->obs[2].lock); - ck_assert_msg(check_msg->obs[2].sid.code == 0, - "incorrect value for obs[2].sid.code, expected 0, is %d", - check_msg->obs[2].sid.code); - ck_assert_msg(check_msg->obs[2].sid.reserved == 0, - "incorrect value for obs[2].sid.reserved, expected 0, is %d", - check_msg->obs[2].sid.reserved); - ck_assert_msg(check_msg->obs[2].sid.sat == 7, - "incorrect value for obs[2].sid.sat, expected 7, is %d", - check_msg->obs[2].sid.sat); - ck_assert_msg(check_msg->obs[3].L.f == 202, - "incorrect value for obs[3].L.f, expected 202, is %d", - check_msg->obs[3].L.f); - ck_assert_msg(check_msg->obs[3].L.i == 861998, - "incorrect value for obs[3].L.i, expected 861998, is %d", - check_msg->obs[3].L.i); - ck_assert_msg(check_msg->obs[3].P == 1304316382, - "incorrect value for obs[3].P, expected 1304316382, is %d", - check_msg->obs[3].P); - ck_assert_msg(check_msg->obs[3].cn0 == 181, - "incorrect value for obs[3].cn0, expected 181, is %d", - check_msg->obs[3].cn0); - ck_assert_msg(check_msg->obs[3].lock == 42217, - "incorrect value for obs[3].lock, expected 42217, is %d", - check_msg->obs[3].lock); - ck_assert_msg(check_msg->obs[3].sid.code == 0, - "incorrect value for obs[3].sid.code, expected 0, is %d", - check_msg->obs[3].sid.code); - ck_assert_msg(check_msg->obs[3].sid.reserved == 0, - "incorrect value for obs[3].sid.reserved, expected 0, is %d", - check_msg->obs[3].sid.reserved); - ck_assert_msg(check_msg->obs[3].sid.sat == 10, - "incorrect value for obs[3].sid.sat, expected 10, is %d", - check_msg->obs[3].sid.sat); - ck_assert_msg(check_msg->obs[4].L.f == 249, - "incorrect value for obs[4].L.f, expected 249, is %d", - check_msg->obs[4].L.f); - ck_assert_msg(check_msg->obs[4].L.i == 1425266, - "incorrect value for obs[4].L.i, expected 1425266, is %d", - check_msg->obs[4].L.i); - ck_assert_msg(check_msg->obs[4].P == 1258897557, - "incorrect value for obs[4].P, expected 1258897557, is %d", - check_msg->obs[4].P); - ck_assert_msg(check_msg->obs[4].cn0 == 182, - "incorrect value for obs[4].cn0, expected 182, is %d", - check_msg->obs[4].cn0); - ck_assert_msg(check_msg->obs[4].lock == 53700, - "incorrect value for obs[4].lock, expected 53700, is %d", - check_msg->obs[4].lock); - ck_assert_msg(check_msg->obs[4].sid.code == 0, - "incorrect value for obs[4].sid.code, expected 0, is %d", - check_msg->obs[4].sid.code); - ck_assert_msg(check_msg->obs[4].sid.reserved == 0, - "incorrect value for obs[4].sid.reserved, expected 0, is %d", - check_msg->obs[4].sid.reserved); - ck_assert_msg(check_msg->obs[4].sid.sat == 12, - "incorrect value for obs[4].sid.sat, expected 12, is %d", - check_msg->obs[4].sid.sat); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_observation_MsgObsDepC_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_observation_MsgObsDepC"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgObsDepC"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_observation_MsgObsDepC); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgOsr.c b/c/test/legacy/auto_check_sbp_observation_MsgOsr.c deleted file mode 100644 index 5b0a69d2e8..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgOsr.c +++ /dev/null @@ -1,772 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgOsr.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgOsr) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x640, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x640, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 64, 6, 0, 0, 239, 248, 225, 233, 29, 0, 0, 0, 0, - 104, 8, 64, 75, 143, 241, 68, 230, 250, 62, 7, 66, 15, 3, - 1, 0, 13, 0, 7, 0, 7, 0, 206, 232, 105, 63, 236, 49, - 170, 6, 75, 15, 3, 13, 0, 13, 0, 3, 0, 3, 0, 45, - 145, 198, 62, 33, 7, 153, 6, 128, 15, 3, 14, 0, 13, 0, - 3, 0, 3, 0, 89, 132, 204, 67, 143, 46, 32, 7, 127, 15, - 3, 15, 0, 13, 0, 5, 0, 5, 0, 244, 254, 164, 60, 22, - 176, 95, 6, 55, 15, 3, 17, 0, 0, 0, 2, 0, 2, 0, - 106, 157, 101, 62, 151, 214, 142, 6, 108, 15, 3, 19, 0, 13, - 0, 3, 0, 3, 0, 81, 237, 60, 63, 181, 119, 165, 6, 206, - 15, 3, 28, 0, 13, 0, 3, 0, 3, 0, 134, 228, 110, 64, - 183, 159, 197, 6, 200, 15, 3, 30, 0, 13, 0, 3, 0, 3, - 0, 53, 144, 241, 68, 78, 112, 165, 5, 170, 15, 3, 1, 6, - 21, 0, 7, 0, 7, 0, 251, 232, 105, 63, 163, 128, 49, 5, - 129, 15, 3, 13, 6, 21, 0, 3, 0, 3, 0, 112, 145, 198, - 62, 37, 32, 36, 5, 46, 15, 3, 14, 6, 21, 0, 3, 0, - 3, 0, 166, 132, 204, 67, 184, 112, 141, 5, 95, 15, 3, 15, - 6, 21, 0, 5, 0, 5, 0, 121, 227, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_osr_t *test_msg = (msg_osr_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 64; - test_msg->header.t.ns_residual = 0; - test_msg->header.t.tow = 501867000; - test_msg->header.t.wn = 2152; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].L.f = 66; - test_msg->obs[0].L.i = 121567974; - test_msg->obs[0].P = 1156681547; - test_msg->obs[0].flags = 3; - test_msg->obs[0].iono_std = 13; - test_msg->obs[0].lock = 15; - test_msg->obs[0].range_std = 7; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.sat = 1; - test_msg->obs[0].tropo_std = 7; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[1].L.f = 75; - test_msg->obs[1].L.i = 111817196; - test_msg->obs[1].P = 1063905486; - test_msg->obs[1].flags = 3; - test_msg->obs[1].iono_std = 13; - test_msg->obs[1].lock = 15; - test_msg->obs[1].range_std = 3; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.sat = 13; - test_msg->obs[1].tropo_std = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[2].L.f = 128; - test_msg->obs[2].L.i = 110692129; - test_msg->obs[2].P = 1053200685; - test_msg->obs[2].flags = 3; - test_msg->obs[2].iono_std = 13; - test_msg->obs[2].lock = 15; - test_msg->obs[2].range_std = 3; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.sat = 14; - test_msg->obs[2].tropo_std = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[3].L.f = 127; - test_msg->obs[3].L.i = 119549583; - test_msg->obs[3].P = 1137476697; - test_msg->obs[3].flags = 3; - test_msg->obs[3].iono_std = 13; - test_msg->obs[3].lock = 15; - test_msg->obs[3].range_std = 5; - test_msg->obs[3].sid.code = 0; - test_msg->obs[3].sid.sat = 15; - test_msg->obs[3].tropo_std = 5; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[4].L.f = 55; - test_msg->obs[4].L.i = 106934294; - test_msg->obs[4].P = 1017446132; - test_msg->obs[4].flags = 3; - test_msg->obs[4].iono_std = 0; - test_msg->obs[4].lock = 15; - test_msg->obs[4].range_std = 2; - test_msg->obs[4].sid.code = 0; - test_msg->obs[4].sid.sat = 17; - test_msg->obs[4].tropo_std = 2; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[5].L.f = 108; - test_msg->obs[5].L.i = 110024343; - test_msg->obs[5].P = 1046846826; - test_msg->obs[5].flags = 3; - test_msg->obs[5].iono_std = 13; - test_msg->obs[5].lock = 15; - test_msg->obs[5].range_std = 3; - test_msg->obs[5].sid.code = 0; - test_msg->obs[5].sid.sat = 19; - test_msg->obs[5].tropo_std = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[6].L.f = 206; - test_msg->obs[6].L.i = 111507381; - test_msg->obs[6].P = 1060957521; - test_msg->obs[6].flags = 3; - test_msg->obs[6].iono_std = 13; - test_msg->obs[6].lock = 15; - test_msg->obs[6].range_std = 3; - test_msg->obs[6].sid.code = 0; - test_msg->obs[6].sid.sat = 28; - test_msg->obs[6].tropo_std = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[7].L.f = 200; - test_msg->obs[7].L.i = 113614775; - test_msg->obs[7].P = 1081009286; - test_msg->obs[7].flags = 3; - test_msg->obs[7].iono_std = 13; - test_msg->obs[7].lock = 15; - test_msg->obs[7].range_std = 3; - test_msg->obs[7].sid.code = 0; - test_msg->obs[7].sid.sat = 30; - test_msg->obs[7].tropo_std = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[8].L.f = 170; - test_msg->obs[8].L.i = 94728270; - test_msg->obs[8].P = 1156681781; - test_msg->obs[8].flags = 3; - test_msg->obs[8].iono_std = 21; - test_msg->obs[8].lock = 15; - test_msg->obs[8].range_std = 7; - test_msg->obs[8].sid.code = 6; - test_msg->obs[8].sid.sat = 1; - test_msg->obs[8].tropo_std = 7; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[9].L.f = 129; - test_msg->obs[9].L.i = 87130275; - test_msg->obs[9].P = 1063905531; - test_msg->obs[9].flags = 3; - test_msg->obs[9].iono_std = 21; - test_msg->obs[9].lock = 15; - test_msg->obs[9].range_std = 3; - test_msg->obs[9].sid.code = 6; - test_msg->obs[9].sid.sat = 13; - test_msg->obs[9].tropo_std = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[10].L.f = 46; - test_msg->obs[10].L.i = 86253605; - test_msg->obs[10].P = 1053200752; - test_msg->obs[10].flags = 3; - test_msg->obs[10].iono_std = 21; - test_msg->obs[10].lock = 15; - test_msg->obs[10].range_std = 3; - test_msg->obs[10].sid.code = 6; - test_msg->obs[10].sid.sat = 14; - test_msg->obs[10].tropo_std = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[11].L.f = 95; - test_msg->obs[11].L.i = 93155512; - test_msg->obs[11].P = 1137476774; - test_msg->obs[11].flags = 3; - test_msg->obs[11].iono_std = 21; - test_msg->obs[11].lock = 15; - test_msg->obs[11].range_std = 5; - test_msg->obs[11].sid.code = 6; - test_msg->obs[11].sid.sat = 15; - test_msg->obs[11].tropo_std = 5; - sbp_payload_send(&sbp_state, 0x640, 0, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 0, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 0, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x640, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_osr_t *check_msg = (msg_osr_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 64, - "incorrect value for header.n_obs, expected 64, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.ns_residual == 0, - "incorrect value for header.t.ns_residual, expected 0, is %d", - check_msg->header.t.ns_residual); - ck_assert_msg(check_msg->header.t.tow == 501867000, - "incorrect value for header.t.tow, expected 501867000, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 2152, - "incorrect value for header.t.wn, expected 2152, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].L.f == 66, - "incorrect value for obs[0].L.f, expected 66, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == 121567974, - "incorrect value for obs[0].L.i, expected 121567974, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 1156681547, - "incorrect value for obs[0].P, expected 1156681547, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].flags == 3, - "incorrect value for obs[0].flags, expected 3, is %d", - check_msg->obs[0].flags); - ck_assert_msg(check_msg->obs[0].iono_std == 13, - "incorrect value for obs[0].iono_std, expected 13, is %d", - check_msg->obs[0].iono_std); - ck_assert_msg(check_msg->obs[0].lock == 15, - "incorrect value for obs[0].lock, expected 15, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].range_std == 7, - "incorrect value for obs[0].range_std, expected 7, is %d", - check_msg->obs[0].range_std); - ck_assert_msg(check_msg->obs[0].sid.code == 0, - "incorrect value for obs[0].sid.code, expected 0, is %d", - check_msg->obs[0].sid.code); - ck_assert_msg(check_msg->obs[0].sid.sat == 1, - "incorrect value for obs[0].sid.sat, expected 1, is %d", - check_msg->obs[0].sid.sat); - ck_assert_msg(check_msg->obs[0].tropo_std == 7, - "incorrect value for obs[0].tropo_std, expected 7, is %d", - check_msg->obs[0].tropo_std); - ck_assert_msg(check_msg->obs[1].L.f == 75, - "incorrect value for obs[1].L.f, expected 75, is %d", - check_msg->obs[1].L.f); - ck_assert_msg(check_msg->obs[1].L.i == 111817196, - "incorrect value for obs[1].L.i, expected 111817196, is %d", - check_msg->obs[1].L.i); - ck_assert_msg(check_msg->obs[1].P == 1063905486, - "incorrect value for obs[1].P, expected 1063905486, is %d", - check_msg->obs[1].P); - ck_assert_msg(check_msg->obs[1].flags == 3, - "incorrect value for obs[1].flags, expected 3, is %d", - check_msg->obs[1].flags); - ck_assert_msg(check_msg->obs[1].iono_std == 13, - "incorrect value for obs[1].iono_std, expected 13, is %d", - check_msg->obs[1].iono_std); - ck_assert_msg(check_msg->obs[1].lock == 15, - "incorrect value for obs[1].lock, expected 15, is %d", - check_msg->obs[1].lock); - ck_assert_msg(check_msg->obs[1].range_std == 3, - "incorrect value for obs[1].range_std, expected 3, is %d", - check_msg->obs[1].range_std); - ck_assert_msg(check_msg->obs[1].sid.code == 0, - "incorrect value for obs[1].sid.code, expected 0, is %d", - check_msg->obs[1].sid.code); - ck_assert_msg(check_msg->obs[1].sid.sat == 13, - "incorrect value for obs[1].sid.sat, expected 13, is %d", - check_msg->obs[1].sid.sat); - ck_assert_msg(check_msg->obs[1].tropo_std == 3, - "incorrect value for obs[1].tropo_std, expected 3, is %d", - check_msg->obs[1].tropo_std); - ck_assert_msg(check_msg->obs[2].L.f == 128, - "incorrect value for obs[2].L.f, expected 128, is %d", - check_msg->obs[2].L.f); - ck_assert_msg(check_msg->obs[2].L.i == 110692129, - "incorrect value for obs[2].L.i, expected 110692129, is %d", - check_msg->obs[2].L.i); - ck_assert_msg(check_msg->obs[2].P == 1053200685, - "incorrect value for obs[2].P, expected 1053200685, is %d", - check_msg->obs[2].P); - ck_assert_msg(check_msg->obs[2].flags == 3, - "incorrect value for obs[2].flags, expected 3, is %d", - check_msg->obs[2].flags); - ck_assert_msg(check_msg->obs[2].iono_std == 13, - "incorrect value for obs[2].iono_std, expected 13, is %d", - check_msg->obs[2].iono_std); - ck_assert_msg(check_msg->obs[2].lock == 15, - "incorrect value for obs[2].lock, expected 15, is %d", - check_msg->obs[2].lock); - ck_assert_msg(check_msg->obs[2].range_std == 3, - "incorrect value for obs[2].range_std, expected 3, is %d", - check_msg->obs[2].range_std); - ck_assert_msg(check_msg->obs[2].sid.code == 0, - "incorrect value for obs[2].sid.code, expected 0, is %d", - check_msg->obs[2].sid.code); - ck_assert_msg(check_msg->obs[2].sid.sat == 14, - "incorrect value for obs[2].sid.sat, expected 14, is %d", - check_msg->obs[2].sid.sat); - ck_assert_msg(check_msg->obs[2].tropo_std == 3, - "incorrect value for obs[2].tropo_std, expected 3, is %d", - check_msg->obs[2].tropo_std); - ck_assert_msg(check_msg->obs[3].L.f == 127, - "incorrect value for obs[3].L.f, expected 127, is %d", - check_msg->obs[3].L.f); - ck_assert_msg(check_msg->obs[3].L.i == 119549583, - "incorrect value for obs[3].L.i, expected 119549583, is %d", - check_msg->obs[3].L.i); - ck_assert_msg(check_msg->obs[3].P == 1137476697, - "incorrect value for obs[3].P, expected 1137476697, is %d", - check_msg->obs[3].P); - ck_assert_msg(check_msg->obs[3].flags == 3, - "incorrect value for obs[3].flags, expected 3, is %d", - check_msg->obs[3].flags); - ck_assert_msg(check_msg->obs[3].iono_std == 13, - "incorrect value for obs[3].iono_std, expected 13, is %d", - check_msg->obs[3].iono_std); - ck_assert_msg(check_msg->obs[3].lock == 15, - "incorrect value for obs[3].lock, expected 15, is %d", - check_msg->obs[3].lock); - ck_assert_msg(check_msg->obs[3].range_std == 5, - "incorrect value for obs[3].range_std, expected 5, is %d", - check_msg->obs[3].range_std); - ck_assert_msg(check_msg->obs[3].sid.code == 0, - "incorrect value for obs[3].sid.code, expected 0, is %d", - check_msg->obs[3].sid.code); - ck_assert_msg(check_msg->obs[3].sid.sat == 15, - "incorrect value for obs[3].sid.sat, expected 15, is %d", - check_msg->obs[3].sid.sat); - ck_assert_msg(check_msg->obs[3].tropo_std == 5, - "incorrect value for obs[3].tropo_std, expected 5, is %d", - check_msg->obs[3].tropo_std); - ck_assert_msg(check_msg->obs[4].L.f == 55, - "incorrect value for obs[4].L.f, expected 55, is %d", - check_msg->obs[4].L.f); - ck_assert_msg(check_msg->obs[4].L.i == 106934294, - "incorrect value for obs[4].L.i, expected 106934294, is %d", - check_msg->obs[4].L.i); - ck_assert_msg(check_msg->obs[4].P == 1017446132, - "incorrect value for obs[4].P, expected 1017446132, is %d", - check_msg->obs[4].P); - ck_assert_msg(check_msg->obs[4].flags == 3, - "incorrect value for obs[4].flags, expected 3, is %d", - check_msg->obs[4].flags); - ck_assert_msg(check_msg->obs[4].iono_std == 0, - "incorrect value for obs[4].iono_std, expected 0, is %d", - check_msg->obs[4].iono_std); - ck_assert_msg(check_msg->obs[4].lock == 15, - "incorrect value for obs[4].lock, expected 15, is %d", - check_msg->obs[4].lock); - ck_assert_msg(check_msg->obs[4].range_std == 2, - "incorrect value for obs[4].range_std, expected 2, is %d", - check_msg->obs[4].range_std); - ck_assert_msg(check_msg->obs[4].sid.code == 0, - "incorrect value for obs[4].sid.code, expected 0, is %d", - check_msg->obs[4].sid.code); - ck_assert_msg(check_msg->obs[4].sid.sat == 17, - "incorrect value for obs[4].sid.sat, expected 17, is %d", - check_msg->obs[4].sid.sat); - ck_assert_msg(check_msg->obs[4].tropo_std == 2, - "incorrect value for obs[4].tropo_std, expected 2, is %d", - check_msg->obs[4].tropo_std); - ck_assert_msg(check_msg->obs[5].L.f == 108, - "incorrect value for obs[5].L.f, expected 108, is %d", - check_msg->obs[5].L.f); - ck_assert_msg(check_msg->obs[5].L.i == 110024343, - "incorrect value for obs[5].L.i, expected 110024343, is %d", - check_msg->obs[5].L.i); - ck_assert_msg(check_msg->obs[5].P == 1046846826, - "incorrect value for obs[5].P, expected 1046846826, is %d", - check_msg->obs[5].P); - ck_assert_msg(check_msg->obs[5].flags == 3, - "incorrect value for obs[5].flags, expected 3, is %d", - check_msg->obs[5].flags); - ck_assert_msg(check_msg->obs[5].iono_std == 13, - "incorrect value for obs[5].iono_std, expected 13, is %d", - check_msg->obs[5].iono_std); - ck_assert_msg(check_msg->obs[5].lock == 15, - "incorrect value for obs[5].lock, expected 15, is %d", - check_msg->obs[5].lock); - ck_assert_msg(check_msg->obs[5].range_std == 3, - "incorrect value for obs[5].range_std, expected 3, is %d", - check_msg->obs[5].range_std); - ck_assert_msg(check_msg->obs[5].sid.code == 0, - "incorrect value for obs[5].sid.code, expected 0, is %d", - check_msg->obs[5].sid.code); - ck_assert_msg(check_msg->obs[5].sid.sat == 19, - "incorrect value for obs[5].sid.sat, expected 19, is %d", - check_msg->obs[5].sid.sat); - ck_assert_msg(check_msg->obs[5].tropo_std == 3, - "incorrect value for obs[5].tropo_std, expected 3, is %d", - check_msg->obs[5].tropo_std); - ck_assert_msg(check_msg->obs[6].L.f == 206, - "incorrect value for obs[6].L.f, expected 206, is %d", - check_msg->obs[6].L.f); - ck_assert_msg(check_msg->obs[6].L.i == 111507381, - "incorrect value for obs[6].L.i, expected 111507381, is %d", - check_msg->obs[6].L.i); - ck_assert_msg(check_msg->obs[6].P == 1060957521, - "incorrect value for obs[6].P, expected 1060957521, is %d", - check_msg->obs[6].P); - ck_assert_msg(check_msg->obs[6].flags == 3, - "incorrect value for obs[6].flags, expected 3, is %d", - check_msg->obs[6].flags); - ck_assert_msg(check_msg->obs[6].iono_std == 13, - "incorrect value for obs[6].iono_std, expected 13, is %d", - check_msg->obs[6].iono_std); - ck_assert_msg(check_msg->obs[6].lock == 15, - "incorrect value for obs[6].lock, expected 15, is %d", - check_msg->obs[6].lock); - ck_assert_msg(check_msg->obs[6].range_std == 3, - "incorrect value for obs[6].range_std, expected 3, is %d", - check_msg->obs[6].range_std); - ck_assert_msg(check_msg->obs[6].sid.code == 0, - "incorrect value for obs[6].sid.code, expected 0, is %d", - check_msg->obs[6].sid.code); - ck_assert_msg(check_msg->obs[6].sid.sat == 28, - "incorrect value for obs[6].sid.sat, expected 28, is %d", - check_msg->obs[6].sid.sat); - ck_assert_msg(check_msg->obs[6].tropo_std == 3, - "incorrect value for obs[6].tropo_std, expected 3, is %d", - check_msg->obs[6].tropo_std); - ck_assert_msg(check_msg->obs[7].L.f == 200, - "incorrect value for obs[7].L.f, expected 200, is %d", - check_msg->obs[7].L.f); - ck_assert_msg(check_msg->obs[7].L.i == 113614775, - "incorrect value for obs[7].L.i, expected 113614775, is %d", - check_msg->obs[7].L.i); - ck_assert_msg(check_msg->obs[7].P == 1081009286, - "incorrect value for obs[7].P, expected 1081009286, is %d", - check_msg->obs[7].P); - ck_assert_msg(check_msg->obs[7].flags == 3, - "incorrect value for obs[7].flags, expected 3, is %d", - check_msg->obs[7].flags); - ck_assert_msg(check_msg->obs[7].iono_std == 13, - "incorrect value for obs[7].iono_std, expected 13, is %d", - check_msg->obs[7].iono_std); - ck_assert_msg(check_msg->obs[7].lock == 15, - "incorrect value for obs[7].lock, expected 15, is %d", - check_msg->obs[7].lock); - ck_assert_msg(check_msg->obs[7].range_std == 3, - "incorrect value for obs[7].range_std, expected 3, is %d", - check_msg->obs[7].range_std); - ck_assert_msg(check_msg->obs[7].sid.code == 0, - "incorrect value for obs[7].sid.code, expected 0, is %d", - check_msg->obs[7].sid.code); - ck_assert_msg(check_msg->obs[7].sid.sat == 30, - "incorrect value for obs[7].sid.sat, expected 30, is %d", - check_msg->obs[7].sid.sat); - ck_assert_msg(check_msg->obs[7].tropo_std == 3, - "incorrect value for obs[7].tropo_std, expected 3, is %d", - check_msg->obs[7].tropo_std); - ck_assert_msg(check_msg->obs[8].L.f == 170, - "incorrect value for obs[8].L.f, expected 170, is %d", - check_msg->obs[8].L.f); - ck_assert_msg(check_msg->obs[8].L.i == 94728270, - "incorrect value for obs[8].L.i, expected 94728270, is %d", - check_msg->obs[8].L.i); - ck_assert_msg(check_msg->obs[8].P == 1156681781, - "incorrect value for obs[8].P, expected 1156681781, is %d", - check_msg->obs[8].P); - ck_assert_msg(check_msg->obs[8].flags == 3, - "incorrect value for obs[8].flags, expected 3, is %d", - check_msg->obs[8].flags); - ck_assert_msg(check_msg->obs[8].iono_std == 21, - "incorrect value for obs[8].iono_std, expected 21, is %d", - check_msg->obs[8].iono_std); - ck_assert_msg(check_msg->obs[8].lock == 15, - "incorrect value for obs[8].lock, expected 15, is %d", - check_msg->obs[8].lock); - ck_assert_msg(check_msg->obs[8].range_std == 7, - "incorrect value for obs[8].range_std, expected 7, is %d", - check_msg->obs[8].range_std); - ck_assert_msg(check_msg->obs[8].sid.code == 6, - "incorrect value for obs[8].sid.code, expected 6, is %d", - check_msg->obs[8].sid.code); - ck_assert_msg(check_msg->obs[8].sid.sat == 1, - "incorrect value for obs[8].sid.sat, expected 1, is %d", - check_msg->obs[8].sid.sat); - ck_assert_msg(check_msg->obs[8].tropo_std == 7, - "incorrect value for obs[8].tropo_std, expected 7, is %d", - check_msg->obs[8].tropo_std); - ck_assert_msg(check_msg->obs[9].L.f == 129, - "incorrect value for obs[9].L.f, expected 129, is %d", - check_msg->obs[9].L.f); - ck_assert_msg(check_msg->obs[9].L.i == 87130275, - "incorrect value for obs[9].L.i, expected 87130275, is %d", - check_msg->obs[9].L.i); - ck_assert_msg(check_msg->obs[9].P == 1063905531, - "incorrect value for obs[9].P, expected 1063905531, is %d", - check_msg->obs[9].P); - ck_assert_msg(check_msg->obs[9].flags == 3, - "incorrect value for obs[9].flags, expected 3, is %d", - check_msg->obs[9].flags); - ck_assert_msg(check_msg->obs[9].iono_std == 21, - "incorrect value for obs[9].iono_std, expected 21, is %d", - check_msg->obs[9].iono_std); - ck_assert_msg(check_msg->obs[9].lock == 15, - "incorrect value for obs[9].lock, expected 15, is %d", - check_msg->obs[9].lock); - ck_assert_msg(check_msg->obs[9].range_std == 3, - "incorrect value for obs[9].range_std, expected 3, is %d", - check_msg->obs[9].range_std); - ck_assert_msg(check_msg->obs[9].sid.code == 6, - "incorrect value for obs[9].sid.code, expected 6, is %d", - check_msg->obs[9].sid.code); - ck_assert_msg(check_msg->obs[9].sid.sat == 13, - "incorrect value for obs[9].sid.sat, expected 13, is %d", - check_msg->obs[9].sid.sat); - ck_assert_msg(check_msg->obs[9].tropo_std == 3, - "incorrect value for obs[9].tropo_std, expected 3, is %d", - check_msg->obs[9].tropo_std); - ck_assert_msg(check_msg->obs[10].L.f == 46, - "incorrect value for obs[10].L.f, expected 46, is %d", - check_msg->obs[10].L.f); - ck_assert_msg(check_msg->obs[10].L.i == 86253605, - "incorrect value for obs[10].L.i, expected 86253605, is %d", - check_msg->obs[10].L.i); - ck_assert_msg(check_msg->obs[10].P == 1053200752, - "incorrect value for obs[10].P, expected 1053200752, is %d", - check_msg->obs[10].P); - ck_assert_msg(check_msg->obs[10].flags == 3, - "incorrect value for obs[10].flags, expected 3, is %d", - check_msg->obs[10].flags); - ck_assert_msg(check_msg->obs[10].iono_std == 21, - "incorrect value for obs[10].iono_std, expected 21, is %d", - check_msg->obs[10].iono_std); - ck_assert_msg(check_msg->obs[10].lock == 15, - "incorrect value for obs[10].lock, expected 15, is %d", - check_msg->obs[10].lock); - ck_assert_msg(check_msg->obs[10].range_std == 3, - "incorrect value for obs[10].range_std, expected 3, is %d", - check_msg->obs[10].range_std); - ck_assert_msg(check_msg->obs[10].sid.code == 6, - "incorrect value for obs[10].sid.code, expected 6, is %d", - check_msg->obs[10].sid.code); - ck_assert_msg(check_msg->obs[10].sid.sat == 14, - "incorrect value for obs[10].sid.sat, expected 14, is %d", - check_msg->obs[10].sid.sat); - ck_assert_msg(check_msg->obs[10].tropo_std == 3, - "incorrect value for obs[10].tropo_std, expected 3, is %d", - check_msg->obs[10].tropo_std); - ck_assert_msg(check_msg->obs[11].L.f == 95, - "incorrect value for obs[11].L.f, expected 95, is %d", - check_msg->obs[11].L.f); - ck_assert_msg(check_msg->obs[11].L.i == 93155512, - "incorrect value for obs[11].L.i, expected 93155512, is %d", - check_msg->obs[11].L.i); - ck_assert_msg(check_msg->obs[11].P == 1137476774, - "incorrect value for obs[11].P, expected 1137476774, is %d", - check_msg->obs[11].P); - ck_assert_msg(check_msg->obs[11].flags == 3, - "incorrect value for obs[11].flags, expected 3, is %d", - check_msg->obs[11].flags); - ck_assert_msg(check_msg->obs[11].iono_std == 21, - "incorrect value for obs[11].iono_std, expected 21, is %d", - check_msg->obs[11].iono_std); - ck_assert_msg(check_msg->obs[11].lock == 15, - "incorrect value for obs[11].lock, expected 15, is %d", - check_msg->obs[11].lock); - ck_assert_msg(check_msg->obs[11].range_std == 5, - "incorrect value for obs[11].range_std, expected 5, is %d", - check_msg->obs[11].range_std); - ck_assert_msg(check_msg->obs[11].sid.code == 6, - "incorrect value for obs[11].sid.code, expected 6, is %d", - check_msg->obs[11].sid.code); - ck_assert_msg(check_msg->obs[11].sid.sat == 15, - "incorrect value for obs[11].sid.sat, expected 15, is %d", - check_msg->obs[11].sid.sat); - ck_assert_msg(check_msg->obs[11].tropo_std == 5, - "incorrect value for obs[11].tropo_std, expected 5, is %d", - check_msg->obs[11].tropo_std); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgOsr_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_observation_MsgOsr"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_observation_MsgOsr"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_observation_MsgOsr); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgSvAzEl.c b/c/test/legacy/auto_check_sbp_observation_MsgSvAzEl.c deleted file mode 100644 index ee04e712a8..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgSvAzEl.c +++ /dev/null @@ -1,879 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgSvAzEl.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgSvAzEl) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x97, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x97, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 151, 0, 207, 121, 132, 8, 0, 160, 12, 10, 0, 139, 66, 13, 0, - 16, 1, 15, 0, 24, 25, 16, 0, 127, 18, 18, 0, 42, 53, 20, 0, - 31, 16, 23, 0, 12, 67, 24, 0, 47, 10, 26, 0, 116, 8, 27, 0, - 153, 43, 29, 0, 77, 10, 32, 0, 94, 26, 1, 3, 16, 58, 2, 3, - 108, 53, 8, 3, 17, 13, 17, 3, 165, 40, 23, 3, 63, 35, 24, 3, - 41, 73, 20, 12, 114, 26, 27, 12, 72, 54, 28, 12, 69, 3, 29, 12, - 158, 14, 30, 12, 152, 68, 32, 12, 120, 82, 2, 14, 131, 6, 4, 14, - 27, 44, 5, 14, 101, 21, 9, 14, 81, 65, 11, 14, 49, 56, 12, 14, - 59, 6, 30, 14, 154, 4, 36, 14, 165, 62, 168, 36, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_sv_az_el_t *test_msg = (msg_sv_az_el_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[0].az = 160; - test_msg->azel[0].el = 12; - test_msg->azel[0].sid.code = 0; - test_msg->azel[0].sid.sat = 8; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[1].az = 139; - test_msg->azel[1].el = 66; - test_msg->azel[1].sid.code = 0; - test_msg->azel[1].sid.sat = 10; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[2].az = 16; - test_msg->azel[2].el = 1; - test_msg->azel[2].sid.code = 0; - test_msg->azel[2].sid.sat = 13; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[3].az = 24; - test_msg->azel[3].el = 25; - test_msg->azel[3].sid.code = 0; - test_msg->azel[3].sid.sat = 15; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[4].az = 127; - test_msg->azel[4].el = 18; - test_msg->azel[4].sid.code = 0; - test_msg->azel[4].sid.sat = 16; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[5].az = 42; - test_msg->azel[5].el = 53; - test_msg->azel[5].sid.code = 0; - test_msg->azel[5].sid.sat = 18; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[6].az = 31; - test_msg->azel[6].el = 16; - test_msg->azel[6].sid.code = 0; - test_msg->azel[6].sid.sat = 20; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[7].az = 12; - test_msg->azel[7].el = 67; - test_msg->azel[7].sid.code = 0; - test_msg->azel[7].sid.sat = 23; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[8].az = 47; - test_msg->azel[8].el = 10; - test_msg->azel[8].sid.code = 0; - test_msg->azel[8].sid.sat = 24; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[9].az = 116; - test_msg->azel[9].el = 8; - test_msg->azel[9].sid.code = 0; - test_msg->azel[9].sid.sat = 26; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[10].az = 153; - test_msg->azel[10].el = 43; - test_msg->azel[10].sid.code = 0; - test_msg->azel[10].sid.sat = 27; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[11].az = 77; - test_msg->azel[11].el = 10; - test_msg->azel[11].sid.code = 0; - test_msg->azel[11].sid.sat = 29; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[12].az = 94; - test_msg->azel[12].el = 26; - test_msg->azel[12].sid.code = 0; - test_msg->azel[12].sid.sat = 32; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[13].az = 16; - test_msg->azel[13].el = 58; - test_msg->azel[13].sid.code = 3; - test_msg->azel[13].sid.sat = 1; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[14].az = 108; - test_msg->azel[14].el = 53; - test_msg->azel[14].sid.code = 3; - test_msg->azel[14].sid.sat = 2; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[15].az = 17; - test_msg->azel[15].el = 13; - test_msg->azel[15].sid.code = 3; - test_msg->azel[15].sid.sat = 8; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[16].az = 165; - test_msg->azel[16].el = 40; - test_msg->azel[16].sid.code = 3; - test_msg->azel[16].sid.sat = 17; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[17].az = 63; - test_msg->azel[17].el = 35; - test_msg->azel[17].sid.code = 3; - test_msg->azel[17].sid.sat = 23; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[18].az = 41; - test_msg->azel[18].el = 73; - test_msg->azel[18].sid.code = 3; - test_msg->azel[18].sid.sat = 24; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[19].az = 114; - test_msg->azel[19].el = 26; - test_msg->azel[19].sid.code = 12; - test_msg->azel[19].sid.sat = 20; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[20].az = 72; - test_msg->azel[20].el = 54; - test_msg->azel[20].sid.code = 12; - test_msg->azel[20].sid.sat = 27; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[21].az = 69; - test_msg->azel[21].el = 3; - test_msg->azel[21].sid.code = 12; - test_msg->azel[21].sid.sat = 28; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[22].az = 158; - test_msg->azel[22].el = 14; - test_msg->azel[22].sid.code = 12; - test_msg->azel[22].sid.sat = 29; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[23].az = 152; - test_msg->azel[23].el = 68; - test_msg->azel[23].sid.code = 12; - test_msg->azel[23].sid.sat = 30; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[24].az = 120; - test_msg->azel[24].el = 82; - test_msg->azel[24].sid.code = 12; - test_msg->azel[24].sid.sat = 32; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[25].az = 131; - test_msg->azel[25].el = 6; - test_msg->azel[25].sid.code = 14; - test_msg->azel[25].sid.sat = 2; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[26].az = 27; - test_msg->azel[26].el = 44; - test_msg->azel[26].sid.code = 14; - test_msg->azel[26].sid.sat = 4; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[27].az = 101; - test_msg->azel[27].el = 21; - test_msg->azel[27].sid.code = 14; - test_msg->azel[27].sid.sat = 5; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[28].az = 81; - test_msg->azel[28].el = 65; - test_msg->azel[28].sid.code = 14; - test_msg->azel[28].sid.sat = 9; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[29].az = 49; - test_msg->azel[29].el = 56; - test_msg->azel[29].sid.code = 14; - test_msg->azel[29].sid.sat = 11; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[30].az = 59; - test_msg->azel[30].el = 6; - test_msg->azel[30].sid.code = 14; - test_msg->azel[30].sid.sat = 12; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[31].az = 154; - test_msg->azel[31].el = 4; - test_msg->azel[31].sid.code = 14; - test_msg->azel[31].sid.sat = 30; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->azel[0]); - } - test_msg->azel[32].az = 165; - test_msg->azel[32].el = 62; - test_msg->azel[32].sid.code = 14; - test_msg->azel[32].sid.sat = 36; - sbp_payload_send(&sbp_state, 0x97, 31183, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 31183, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 31183, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x97, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_sv_az_el_t *check_msg = (msg_sv_az_el_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->azel[0].az == 160, - "incorrect value for azel[0].az, expected 160, is %d", - check_msg->azel[0].az); - ck_assert_msg(check_msg->azel[0].el == 12, - "incorrect value for azel[0].el, expected 12, is %d", - check_msg->azel[0].el); - ck_assert_msg(check_msg->azel[0].sid.code == 0, - "incorrect value for azel[0].sid.code, expected 0, is %d", - check_msg->azel[0].sid.code); - ck_assert_msg(check_msg->azel[0].sid.sat == 8, - "incorrect value for azel[0].sid.sat, expected 8, is %d", - check_msg->azel[0].sid.sat); - ck_assert_msg(check_msg->azel[1].az == 139, - "incorrect value for azel[1].az, expected 139, is %d", - check_msg->azel[1].az); - ck_assert_msg(check_msg->azel[1].el == 66, - "incorrect value for azel[1].el, expected 66, is %d", - check_msg->azel[1].el); - ck_assert_msg(check_msg->azel[1].sid.code == 0, - "incorrect value for azel[1].sid.code, expected 0, is %d", - check_msg->azel[1].sid.code); - ck_assert_msg(check_msg->azel[1].sid.sat == 10, - "incorrect value for azel[1].sid.sat, expected 10, is %d", - check_msg->azel[1].sid.sat); - ck_assert_msg(check_msg->azel[2].az == 16, - "incorrect value for azel[2].az, expected 16, is %d", - check_msg->azel[2].az); - ck_assert_msg(check_msg->azel[2].el == 1, - "incorrect value for azel[2].el, expected 1, is %d", - check_msg->azel[2].el); - ck_assert_msg(check_msg->azel[2].sid.code == 0, - "incorrect value for azel[2].sid.code, expected 0, is %d", - check_msg->azel[2].sid.code); - ck_assert_msg(check_msg->azel[2].sid.sat == 13, - "incorrect value for azel[2].sid.sat, expected 13, is %d", - check_msg->azel[2].sid.sat); - ck_assert_msg(check_msg->azel[3].az == 24, - "incorrect value for azel[3].az, expected 24, is %d", - check_msg->azel[3].az); - ck_assert_msg(check_msg->azel[3].el == 25, - "incorrect value for azel[3].el, expected 25, is %d", - check_msg->azel[3].el); - ck_assert_msg(check_msg->azel[3].sid.code == 0, - "incorrect value for azel[3].sid.code, expected 0, is %d", - check_msg->azel[3].sid.code); - ck_assert_msg(check_msg->azel[3].sid.sat == 15, - "incorrect value for azel[3].sid.sat, expected 15, is %d", - check_msg->azel[3].sid.sat); - ck_assert_msg(check_msg->azel[4].az == 127, - "incorrect value for azel[4].az, expected 127, is %d", - check_msg->azel[4].az); - ck_assert_msg(check_msg->azel[4].el == 18, - "incorrect value for azel[4].el, expected 18, is %d", - check_msg->azel[4].el); - ck_assert_msg(check_msg->azel[4].sid.code == 0, - "incorrect value for azel[4].sid.code, expected 0, is %d", - check_msg->azel[4].sid.code); - ck_assert_msg(check_msg->azel[4].sid.sat == 16, - "incorrect value for azel[4].sid.sat, expected 16, is %d", - check_msg->azel[4].sid.sat); - ck_assert_msg(check_msg->azel[5].az == 42, - "incorrect value for azel[5].az, expected 42, is %d", - check_msg->azel[5].az); - ck_assert_msg(check_msg->azel[5].el == 53, - "incorrect value for azel[5].el, expected 53, is %d", - check_msg->azel[5].el); - ck_assert_msg(check_msg->azel[5].sid.code == 0, - "incorrect value for azel[5].sid.code, expected 0, is %d", - check_msg->azel[5].sid.code); - ck_assert_msg(check_msg->azel[5].sid.sat == 18, - "incorrect value for azel[5].sid.sat, expected 18, is %d", - check_msg->azel[5].sid.sat); - ck_assert_msg(check_msg->azel[6].az == 31, - "incorrect value for azel[6].az, expected 31, is %d", - check_msg->azel[6].az); - ck_assert_msg(check_msg->azel[6].el == 16, - "incorrect value for azel[6].el, expected 16, is %d", - check_msg->azel[6].el); - ck_assert_msg(check_msg->azel[6].sid.code == 0, - "incorrect value for azel[6].sid.code, expected 0, is %d", - check_msg->azel[6].sid.code); - ck_assert_msg(check_msg->azel[6].sid.sat == 20, - "incorrect value for azel[6].sid.sat, expected 20, is %d", - check_msg->azel[6].sid.sat); - ck_assert_msg(check_msg->azel[7].az == 12, - "incorrect value for azel[7].az, expected 12, is %d", - check_msg->azel[7].az); - ck_assert_msg(check_msg->azel[7].el == 67, - "incorrect value for azel[7].el, expected 67, is %d", - check_msg->azel[7].el); - ck_assert_msg(check_msg->azel[7].sid.code == 0, - "incorrect value for azel[7].sid.code, expected 0, is %d", - check_msg->azel[7].sid.code); - ck_assert_msg(check_msg->azel[7].sid.sat == 23, - "incorrect value for azel[7].sid.sat, expected 23, is %d", - check_msg->azel[7].sid.sat); - ck_assert_msg(check_msg->azel[8].az == 47, - "incorrect value for azel[8].az, expected 47, is %d", - check_msg->azel[8].az); - ck_assert_msg(check_msg->azel[8].el == 10, - "incorrect value for azel[8].el, expected 10, is %d", - check_msg->azel[8].el); - ck_assert_msg(check_msg->azel[8].sid.code == 0, - "incorrect value for azel[8].sid.code, expected 0, is %d", - check_msg->azel[8].sid.code); - ck_assert_msg(check_msg->azel[8].sid.sat == 24, - "incorrect value for azel[8].sid.sat, expected 24, is %d", - check_msg->azel[8].sid.sat); - ck_assert_msg(check_msg->azel[9].az == 116, - "incorrect value for azel[9].az, expected 116, is %d", - check_msg->azel[9].az); - ck_assert_msg(check_msg->azel[9].el == 8, - "incorrect value for azel[9].el, expected 8, is %d", - check_msg->azel[9].el); - ck_assert_msg(check_msg->azel[9].sid.code == 0, - "incorrect value for azel[9].sid.code, expected 0, is %d", - check_msg->azel[9].sid.code); - ck_assert_msg(check_msg->azel[9].sid.sat == 26, - "incorrect value for azel[9].sid.sat, expected 26, is %d", - check_msg->azel[9].sid.sat); - ck_assert_msg(check_msg->azel[10].az == 153, - "incorrect value for azel[10].az, expected 153, is %d", - check_msg->azel[10].az); - ck_assert_msg(check_msg->azel[10].el == 43, - "incorrect value for azel[10].el, expected 43, is %d", - check_msg->azel[10].el); - ck_assert_msg(check_msg->azel[10].sid.code == 0, - "incorrect value for azel[10].sid.code, expected 0, is %d", - check_msg->azel[10].sid.code); - ck_assert_msg(check_msg->azel[10].sid.sat == 27, - "incorrect value for azel[10].sid.sat, expected 27, is %d", - check_msg->azel[10].sid.sat); - ck_assert_msg(check_msg->azel[11].az == 77, - "incorrect value for azel[11].az, expected 77, is %d", - check_msg->azel[11].az); - ck_assert_msg(check_msg->azel[11].el == 10, - "incorrect value for azel[11].el, expected 10, is %d", - check_msg->azel[11].el); - ck_assert_msg(check_msg->azel[11].sid.code == 0, - "incorrect value for azel[11].sid.code, expected 0, is %d", - check_msg->azel[11].sid.code); - ck_assert_msg(check_msg->azel[11].sid.sat == 29, - "incorrect value for azel[11].sid.sat, expected 29, is %d", - check_msg->azel[11].sid.sat); - ck_assert_msg(check_msg->azel[12].az == 94, - "incorrect value for azel[12].az, expected 94, is %d", - check_msg->azel[12].az); - ck_assert_msg(check_msg->azel[12].el == 26, - "incorrect value for azel[12].el, expected 26, is %d", - check_msg->azel[12].el); - ck_assert_msg(check_msg->azel[12].sid.code == 0, - "incorrect value for azel[12].sid.code, expected 0, is %d", - check_msg->azel[12].sid.code); - ck_assert_msg(check_msg->azel[12].sid.sat == 32, - "incorrect value for azel[12].sid.sat, expected 32, is %d", - check_msg->azel[12].sid.sat); - ck_assert_msg(check_msg->azel[13].az == 16, - "incorrect value for azel[13].az, expected 16, is %d", - check_msg->azel[13].az); - ck_assert_msg(check_msg->azel[13].el == 58, - "incorrect value for azel[13].el, expected 58, is %d", - check_msg->azel[13].el); - ck_assert_msg(check_msg->azel[13].sid.code == 3, - "incorrect value for azel[13].sid.code, expected 3, is %d", - check_msg->azel[13].sid.code); - ck_assert_msg(check_msg->azel[13].sid.sat == 1, - "incorrect value for azel[13].sid.sat, expected 1, is %d", - check_msg->azel[13].sid.sat); - ck_assert_msg(check_msg->azel[14].az == 108, - "incorrect value for azel[14].az, expected 108, is %d", - check_msg->azel[14].az); - ck_assert_msg(check_msg->azel[14].el == 53, - "incorrect value for azel[14].el, expected 53, is %d", - check_msg->azel[14].el); - ck_assert_msg(check_msg->azel[14].sid.code == 3, - "incorrect value for azel[14].sid.code, expected 3, is %d", - check_msg->azel[14].sid.code); - ck_assert_msg(check_msg->azel[14].sid.sat == 2, - "incorrect value for azel[14].sid.sat, expected 2, is %d", - check_msg->azel[14].sid.sat); - ck_assert_msg(check_msg->azel[15].az == 17, - "incorrect value for azel[15].az, expected 17, is %d", - check_msg->azel[15].az); - ck_assert_msg(check_msg->azel[15].el == 13, - "incorrect value for azel[15].el, expected 13, is %d", - check_msg->azel[15].el); - ck_assert_msg(check_msg->azel[15].sid.code == 3, - "incorrect value for azel[15].sid.code, expected 3, is %d", - check_msg->azel[15].sid.code); - ck_assert_msg(check_msg->azel[15].sid.sat == 8, - "incorrect value for azel[15].sid.sat, expected 8, is %d", - check_msg->azel[15].sid.sat); - ck_assert_msg(check_msg->azel[16].az == 165, - "incorrect value for azel[16].az, expected 165, is %d", - check_msg->azel[16].az); - ck_assert_msg(check_msg->azel[16].el == 40, - "incorrect value for azel[16].el, expected 40, is %d", - check_msg->azel[16].el); - ck_assert_msg(check_msg->azel[16].sid.code == 3, - "incorrect value for azel[16].sid.code, expected 3, is %d", - check_msg->azel[16].sid.code); - ck_assert_msg(check_msg->azel[16].sid.sat == 17, - "incorrect value for azel[16].sid.sat, expected 17, is %d", - check_msg->azel[16].sid.sat); - ck_assert_msg(check_msg->azel[17].az == 63, - "incorrect value for azel[17].az, expected 63, is %d", - check_msg->azel[17].az); - ck_assert_msg(check_msg->azel[17].el == 35, - "incorrect value for azel[17].el, expected 35, is %d", - check_msg->azel[17].el); - ck_assert_msg(check_msg->azel[17].sid.code == 3, - "incorrect value for azel[17].sid.code, expected 3, is %d", - check_msg->azel[17].sid.code); - ck_assert_msg(check_msg->azel[17].sid.sat == 23, - "incorrect value for azel[17].sid.sat, expected 23, is %d", - check_msg->azel[17].sid.sat); - ck_assert_msg(check_msg->azel[18].az == 41, - "incorrect value for azel[18].az, expected 41, is %d", - check_msg->azel[18].az); - ck_assert_msg(check_msg->azel[18].el == 73, - "incorrect value for azel[18].el, expected 73, is %d", - check_msg->azel[18].el); - ck_assert_msg(check_msg->azel[18].sid.code == 3, - "incorrect value for azel[18].sid.code, expected 3, is %d", - check_msg->azel[18].sid.code); - ck_assert_msg(check_msg->azel[18].sid.sat == 24, - "incorrect value for azel[18].sid.sat, expected 24, is %d", - check_msg->azel[18].sid.sat); - ck_assert_msg(check_msg->azel[19].az == 114, - "incorrect value for azel[19].az, expected 114, is %d", - check_msg->azel[19].az); - ck_assert_msg(check_msg->azel[19].el == 26, - "incorrect value for azel[19].el, expected 26, is %d", - check_msg->azel[19].el); - ck_assert_msg(check_msg->azel[19].sid.code == 12, - "incorrect value for azel[19].sid.code, expected 12, is %d", - check_msg->azel[19].sid.code); - ck_assert_msg(check_msg->azel[19].sid.sat == 20, - "incorrect value for azel[19].sid.sat, expected 20, is %d", - check_msg->azel[19].sid.sat); - ck_assert_msg(check_msg->azel[20].az == 72, - "incorrect value for azel[20].az, expected 72, is %d", - check_msg->azel[20].az); - ck_assert_msg(check_msg->azel[20].el == 54, - "incorrect value for azel[20].el, expected 54, is %d", - check_msg->azel[20].el); - ck_assert_msg(check_msg->azel[20].sid.code == 12, - "incorrect value for azel[20].sid.code, expected 12, is %d", - check_msg->azel[20].sid.code); - ck_assert_msg(check_msg->azel[20].sid.sat == 27, - "incorrect value for azel[20].sid.sat, expected 27, is %d", - check_msg->azel[20].sid.sat); - ck_assert_msg(check_msg->azel[21].az == 69, - "incorrect value for azel[21].az, expected 69, is %d", - check_msg->azel[21].az); - ck_assert_msg(check_msg->azel[21].el == 3, - "incorrect value for azel[21].el, expected 3, is %d", - check_msg->azel[21].el); - ck_assert_msg(check_msg->azel[21].sid.code == 12, - "incorrect value for azel[21].sid.code, expected 12, is %d", - check_msg->azel[21].sid.code); - ck_assert_msg(check_msg->azel[21].sid.sat == 28, - "incorrect value for azel[21].sid.sat, expected 28, is %d", - check_msg->azel[21].sid.sat); - ck_assert_msg(check_msg->azel[22].az == 158, - "incorrect value for azel[22].az, expected 158, is %d", - check_msg->azel[22].az); - ck_assert_msg(check_msg->azel[22].el == 14, - "incorrect value for azel[22].el, expected 14, is %d", - check_msg->azel[22].el); - ck_assert_msg(check_msg->azel[22].sid.code == 12, - "incorrect value for azel[22].sid.code, expected 12, is %d", - check_msg->azel[22].sid.code); - ck_assert_msg(check_msg->azel[22].sid.sat == 29, - "incorrect value for azel[22].sid.sat, expected 29, is %d", - check_msg->azel[22].sid.sat); - ck_assert_msg(check_msg->azel[23].az == 152, - "incorrect value for azel[23].az, expected 152, is %d", - check_msg->azel[23].az); - ck_assert_msg(check_msg->azel[23].el == 68, - "incorrect value for azel[23].el, expected 68, is %d", - check_msg->azel[23].el); - ck_assert_msg(check_msg->azel[23].sid.code == 12, - "incorrect value for azel[23].sid.code, expected 12, is %d", - check_msg->azel[23].sid.code); - ck_assert_msg(check_msg->azel[23].sid.sat == 30, - "incorrect value for azel[23].sid.sat, expected 30, is %d", - check_msg->azel[23].sid.sat); - ck_assert_msg(check_msg->azel[24].az == 120, - "incorrect value for azel[24].az, expected 120, is %d", - check_msg->azel[24].az); - ck_assert_msg(check_msg->azel[24].el == 82, - "incorrect value for azel[24].el, expected 82, is %d", - check_msg->azel[24].el); - ck_assert_msg(check_msg->azel[24].sid.code == 12, - "incorrect value for azel[24].sid.code, expected 12, is %d", - check_msg->azel[24].sid.code); - ck_assert_msg(check_msg->azel[24].sid.sat == 32, - "incorrect value for azel[24].sid.sat, expected 32, is %d", - check_msg->azel[24].sid.sat); - ck_assert_msg(check_msg->azel[25].az == 131, - "incorrect value for azel[25].az, expected 131, is %d", - check_msg->azel[25].az); - ck_assert_msg(check_msg->azel[25].el == 6, - "incorrect value for azel[25].el, expected 6, is %d", - check_msg->azel[25].el); - ck_assert_msg(check_msg->azel[25].sid.code == 14, - "incorrect value for azel[25].sid.code, expected 14, is %d", - check_msg->azel[25].sid.code); - ck_assert_msg(check_msg->azel[25].sid.sat == 2, - "incorrect value for azel[25].sid.sat, expected 2, is %d", - check_msg->azel[25].sid.sat); - ck_assert_msg(check_msg->azel[26].az == 27, - "incorrect value for azel[26].az, expected 27, is %d", - check_msg->azel[26].az); - ck_assert_msg(check_msg->azel[26].el == 44, - "incorrect value for azel[26].el, expected 44, is %d", - check_msg->azel[26].el); - ck_assert_msg(check_msg->azel[26].sid.code == 14, - "incorrect value for azel[26].sid.code, expected 14, is %d", - check_msg->azel[26].sid.code); - ck_assert_msg(check_msg->azel[26].sid.sat == 4, - "incorrect value for azel[26].sid.sat, expected 4, is %d", - check_msg->azel[26].sid.sat); - ck_assert_msg(check_msg->azel[27].az == 101, - "incorrect value for azel[27].az, expected 101, is %d", - check_msg->azel[27].az); - ck_assert_msg(check_msg->azel[27].el == 21, - "incorrect value for azel[27].el, expected 21, is %d", - check_msg->azel[27].el); - ck_assert_msg(check_msg->azel[27].sid.code == 14, - "incorrect value for azel[27].sid.code, expected 14, is %d", - check_msg->azel[27].sid.code); - ck_assert_msg(check_msg->azel[27].sid.sat == 5, - "incorrect value for azel[27].sid.sat, expected 5, is %d", - check_msg->azel[27].sid.sat); - ck_assert_msg(check_msg->azel[28].az == 81, - "incorrect value for azel[28].az, expected 81, is %d", - check_msg->azel[28].az); - ck_assert_msg(check_msg->azel[28].el == 65, - "incorrect value for azel[28].el, expected 65, is %d", - check_msg->azel[28].el); - ck_assert_msg(check_msg->azel[28].sid.code == 14, - "incorrect value for azel[28].sid.code, expected 14, is %d", - check_msg->azel[28].sid.code); - ck_assert_msg(check_msg->azel[28].sid.sat == 9, - "incorrect value for azel[28].sid.sat, expected 9, is %d", - check_msg->azel[28].sid.sat); - ck_assert_msg(check_msg->azel[29].az == 49, - "incorrect value for azel[29].az, expected 49, is %d", - check_msg->azel[29].az); - ck_assert_msg(check_msg->azel[29].el == 56, - "incorrect value for azel[29].el, expected 56, is %d", - check_msg->azel[29].el); - ck_assert_msg(check_msg->azel[29].sid.code == 14, - "incorrect value for azel[29].sid.code, expected 14, is %d", - check_msg->azel[29].sid.code); - ck_assert_msg(check_msg->azel[29].sid.sat == 11, - "incorrect value for azel[29].sid.sat, expected 11, is %d", - check_msg->azel[29].sid.sat); - ck_assert_msg(check_msg->azel[30].az == 59, - "incorrect value for azel[30].az, expected 59, is %d", - check_msg->azel[30].az); - ck_assert_msg(check_msg->azel[30].el == 6, - "incorrect value for azel[30].el, expected 6, is %d", - check_msg->azel[30].el); - ck_assert_msg(check_msg->azel[30].sid.code == 14, - "incorrect value for azel[30].sid.code, expected 14, is %d", - check_msg->azel[30].sid.code); - ck_assert_msg(check_msg->azel[30].sid.sat == 12, - "incorrect value for azel[30].sid.sat, expected 12, is %d", - check_msg->azel[30].sid.sat); - ck_assert_msg(check_msg->azel[31].az == 154, - "incorrect value for azel[31].az, expected 154, is %d", - check_msg->azel[31].az); - ck_assert_msg(check_msg->azel[31].el == 4, - "incorrect value for azel[31].el, expected 4, is %d", - check_msg->azel[31].el); - ck_assert_msg(check_msg->azel[31].sid.code == 14, - "incorrect value for azel[31].sid.code, expected 14, is %d", - check_msg->azel[31].sid.code); - ck_assert_msg(check_msg->azel[31].sid.sat == 30, - "incorrect value for azel[31].sid.sat, expected 30, is %d", - check_msg->azel[31].sid.sat); - ck_assert_msg(check_msg->azel[32].az == 165, - "incorrect value for azel[32].az, expected 165, is %d", - check_msg->azel[32].az); - ck_assert_msg(check_msg->azel[32].el == 62, - "incorrect value for azel[32].el, expected 62, is %d", - check_msg->azel[32].el); - ck_assert_msg(check_msg->azel[32].sid.code == 14, - "incorrect value for azel[32].sid.code, expected 14, is %d", - check_msg->azel[32].sid.code); - ck_assert_msg(check_msg->azel[32].sid.sat == 36, - "incorrect value for azel[32].sid.sat, expected 36, is %d", - check_msg->azel[32].sid.sat); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgSvAzEl_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_observation_MsgSvAzEl"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_MsgSvAzEl"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_observation_MsgSvAzEl); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_MsgSvConfigurationGpsDep.c b/c/test/legacy/auto_check_sbp_observation_MsgSvConfigurationGpsDep.c deleted file mode 100644 index 1c60161072..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_MsgSvConfigurationGpsDep.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgSvConfigurationGpsDep.yaml -// by generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_MsgSvConfigurationGpsDep) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x91, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x91, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 145, 0, 123, 0, 10, 0, 0, 0, 0, 0, 0, 66, 188, 101, 167, 18, 42, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_sv_configuration_gps_dep_t *test_msg = - (msg_sv_configuration_gps_dep_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->l2c_mask = 2808462402; - test_msg->t_nmct.tow = 0; - test_msg->t_nmct.wn = 0; - sbp_payload_send(&sbp_state, 0x91, 123, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 123, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 123, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x91, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_sv_configuration_gps_dep_t *check_msg = - (msg_sv_configuration_gps_dep_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->l2c_mask == 2808462402, - "incorrect value for l2c_mask, expected 2808462402, is %d", - check_msg->l2c_mask); - ck_assert_msg(check_msg->t_nmct.tow == 0, - "incorrect value for t_nmct.tow, expected 0, is %d", - check_msg->t_nmct.tow); - ck_assert_msg(check_msg->t_nmct.wn == 0, - "incorrect value for t_nmct.wn, expected 0, is %d", - check_msg->t_nmct.wn); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_MsgSvConfigurationGpsDep_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_MsgSvConfigurationGpsDep"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_" - "MsgSvConfigurationGpsDep"); - tcase_add_test( - tc_acq, test_legacy_auto_check_sbp_observation_MsgSvConfigurationGpsDep); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_msgEphemerisDepB.c b/c/test/legacy/auto_check_sbp_observation_msgEphemerisDepB.c deleted file mode 100644 index e97cca377a..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_msgEphemerisDepB.c +++ /dev/null @@ -1,1378 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_msgEphemerisDepB.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_msgEphemerisDepB) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x46, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x46, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 0, 60, 190, - 0, 0, 0, 0, 0, 186, 82, 192, 0, 0, 0, 0, 0, 76, - 109, 64, 0, 0, 0, 0, 0, 132, 208, 190, 0, 0, 0, 0, - 0, 254, 220, 62, 0, 0, 0, 0, 0, 0, 113, 62, 0, 0, - 0, 0, 0, 0, 133, 190, 28, 36, 25, 81, 223, 254, 52, 62, - 220, 116, 216, 39, 33, 189, 3, 64, 0, 0, 0, 156, 177, 204, - 134, 63, 0, 0, 160, 220, 182, 33, 180, 64, 152, 225, 192, 44, - 254, 76, 238, 191, 41, 150, 24, 2, 148, 156, 65, 190, 252, 90, - 119, 48, 15, 215, 240, 63, 124, 127, 115, 94, 208, 16, 238, 63, - 165, 115, 52, 74, 97, 167, 246, 189, 0, 0, 0, 0, 192, 180, - 229, 190, 0, 0, 0, 0, 0, 0, 112, 189, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, - 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 1, 1, 3, 0, - 225, 156, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_dep_b_t* test_msg = (msg_ephemeris_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = -1.035025343298912e-05; - test_msg->af1 = -9.094947017729282e-13; - test_msg->af2 = 0.0; - test_msg->c_ic = 6.332993507385254e-08; - test_msg->c_is = -1.564621925354004e-07; - test_msg->c_rc = 234.375; - test_msg->c_rs = -74.90625; - test_msg->c_uc = -3.937631845474243e-06; - test_msg->c_us = 6.9122761487960815e-06; - test_msg->dn = 4.8884179079418005e-09; - test_msg->ecc = 0.011132609914056957; - test_msg->healthy = 1; - test_msg->inc = 0.9395524830579087; - test_msg->inc_dot = -3.296565886629854e-10; - test_msg->iode = 0; - test_msg->m0 = 2.467348395627239; - test_msg->omega0 = -0.9468985437479658; - test_msg->omegadot = -8.201055892610478e-09; - test_msg->prn = 3; - test_msg->sqrta = 5153.714303970337; - test_msg->tgd = -6.51925802230835e-09; - test_msg->toc_tow = 410400.0; - test_msg->toc_wn = 1838; - test_msg->toe_tow = 410400.0; - test_msg->toe_wn = 1838; - test_msg->valid = 1; - test_msg->w = 1.0525047200405302; - sbp_payload_send(&sbp_state, 0x46, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x46, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_dep_b_t* check_msg = - (msg_ephemeris_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - -1.0350253433e-05 * 100) < 0.05, - "incorrect value for af0, expected -1.0350253433e-05, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - -9.09494701773e-13 * 100) < 0.05, - "incorrect value for af1, expected -9.09494701773e-13, is %f", - check_msg->af1); - ck_assert_msg((check_msg->af2 * 100 - 0.0 * 100) < 0.05, - "incorrect value for af2, expected 0.0, is %f", - check_msg->af2); - ck_assert_msg((check_msg->c_ic * 100 - 6.33299350739e-08 * 100) < 0.05, - "incorrect value for c_ic, expected 6.33299350739e-08, is %f", - check_msg->c_ic); - ck_assert_msg( - (check_msg->c_is * 100 - -1.56462192535e-07 * 100) < 0.05, - "incorrect value for c_is, expected -1.56462192535e-07, is %f", - check_msg->c_is); - ck_assert_msg((check_msg->c_rc * 100 - 234.375 * 100) < 0.05, - "incorrect value for c_rc, expected 234.375, is %f", - check_msg->c_rc); - ck_assert_msg((check_msg->c_rs * 100 - -74.90625 * 100) < 0.05, - "incorrect value for c_rs, expected -74.90625, is %f", - check_msg->c_rs); - ck_assert_msg( - (check_msg->c_uc * 100 - -3.93763184547e-06 * 100) < 0.05, - "incorrect value for c_uc, expected -3.93763184547e-06, is %f", - check_msg->c_uc); - ck_assert_msg((check_msg->c_us * 100 - 6.9122761488e-06 * 100) < 0.05, - "incorrect value for c_us, expected 6.9122761488e-06, is %f", - check_msg->c_us); - ck_assert_msg((check_msg->dn * 100 - 4.88841790794e-09 * 100) < 0.05, - "incorrect value for dn, expected 4.88841790794e-09, is %f", - check_msg->dn); - ck_assert_msg((check_msg->ecc * 100 - 0.0111326099141 * 100) < 0.05, - "incorrect value for ecc, expected 0.0111326099141, is %f", - check_msg->ecc); - ck_assert_msg(check_msg->healthy == 1, - "incorrect value for healthy, expected 1, is %d", - check_msg->healthy); - ck_assert_msg((check_msg->inc * 100 - 0.939552483058 * 100) < 0.05, - "incorrect value for inc, expected 0.939552483058, is %f", - check_msg->inc); - ck_assert_msg( - (check_msg->inc_dot * 100 - -3.29656588663e-10 * 100) < 0.05, - "incorrect value for inc_dot, expected -3.29656588663e-10, is %f", - check_msg->inc_dot); - ck_assert_msg(check_msg->iode == 0, - "incorrect value for iode, expected 0, is %d", - check_msg->iode); - ck_assert_msg((check_msg->m0 * 100 - 2.46734839563 * 100) < 0.05, - "incorrect value for m0, expected 2.46734839563, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - -0.946898543748 * 100) < 0.05, - "incorrect value for omega0, expected -0.946898543748, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -8.20105589261e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -8.20105589261e-09, is %f", - check_msg->omegadot); - ck_assert_msg(check_msg->prn == 3, - "incorrect value for prn, expected 3, is %d", check_msg->prn); - ck_assert_msg((check_msg->sqrta * 100 - 5153.71430397 * 100) < 0.05, - "incorrect value for sqrta, expected 5153.71430397, is %f", - check_msg->sqrta); - ck_assert_msg((check_msg->tgd * 100 - -6.51925802231e-09 * 100) < 0.05, - "incorrect value for tgd, expected -6.51925802231e-09, is %f", - check_msg->tgd); - ck_assert_msg((check_msg->toc_tow * 100 - 410400.0 * 100) < 0.05, - "incorrect value for toc_tow, expected 410400.0, is %f", - check_msg->toc_tow); - ck_assert_msg(check_msg->toc_wn == 1838, - "incorrect value for toc_wn, expected 1838, is %d", - check_msg->toc_wn); - ck_assert_msg((check_msg->toe_tow * 100 - 410400.0 * 100) < 0.05, - "incorrect value for toe_tow, expected 410400.0, is %f", - check_msg->toe_tow); - ck_assert_msg(check_msg->toe_wn == 1838, - "incorrect value for toe_wn, expected 1838, is %d", - check_msg->toe_wn); - ck_assert_msg(check_msg->valid == 1, - "incorrect value for valid, expected 1, is %d", - check_msg->valid); - ck_assert_msg((check_msg->w * 100 - 1.05250472004 * 100) < 0.05, - "incorrect value for w, expected 1.05250472004, is %f", - check_msg->w); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x46, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x46, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 0, 68, 190, - 0, 0, 0, 0, 0, 72, 66, 64, 0, 0, 0, 0, 128, 188, - 115, 64, 0, 0, 0, 0, 0, 80, 193, 62, 0, 0, 0, 0, - 0, 164, 204, 62, 0, 0, 0, 0, 0, 0, 130, 62, 0, 0, - 0, 0, 0, 0, 128, 62, 72, 181, 127, 6, 208, 225, 52, 62, - 158, 174, 129, 91, 27, 105, 249, 191, 0, 0, 0, 96, 204, 57, - 128, 63, 0, 0, 160, 35, 146, 33, 180, 64, 247, 169, 1, 36, - 133, 206, 243, 63, 79, 11, 109, 92, 156, 208, 65, 190, 103, 78, - 3, 253, 223, 147, 255, 191, 164, 214, 90, 250, 218, 240, 238, 63, - 94, 239, 187, 37, 36, 10, 242, 61, 0, 0, 0, 0, 176, 91, - 19, 63, 0, 0, 0, 0, 0, 0, 137, 189, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, - 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 1, 1, 13, 0, - 180, 21, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_dep_b_t* test_msg = (msg_ephemeris_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = 7.384549826383591e-05; - test_msg->af1 = -2.8421709430404007e-12; - test_msg->af2 = 0.0; - test_msg->c_ic = 1.341104507446289e-07; - test_msg->c_is = 1.1920928955078125e-07; - test_msg->c_rc = 315.78125; - test_msg->c_rs = 36.5625; - test_msg->c_uc = 2.0638108253479004e-06; - test_msg->c_us = 3.4142285585403442e-06; - test_msg->dn = 4.86198823561129e-09; - test_msg->ecc = 0.007922741584479809; - test_msg->healthy = 1; - test_msg->inc = 0.9669012918227122; - test_msg->inc_dot = 2.6251093463412166e-10; - test_msg->iode = 0; - test_msg->m0 = -1.588160855720083; - test_msg->omega0 = 1.237919941568746; - test_msg->omegadot = -8.295702692172441e-09; - test_msg->prn = 13; - test_msg->sqrta = 5153.57085609436; - test_msg->tgd = -9.313225746154785e-09; - test_msg->toc_tow = 410400.0; - test_msg->toc_wn = 1838; - test_msg->toe_tow = 410400.0; - test_msg->toe_wn = 1838; - test_msg->valid = 1; - test_msg->w = -1.9736022837941165; - sbp_payload_send(&sbp_state, 0x46, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x46, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_dep_b_t* check_msg = - (msg_ephemeris_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - 7.38454982638e-05 * 100) < 0.05, - "incorrect value for af0, expected 7.38454982638e-05, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - -2.84217094304e-12 * 100) < 0.05, - "incorrect value for af1, expected -2.84217094304e-12, is %f", - check_msg->af1); - ck_assert_msg((check_msg->af2 * 100 - 0.0 * 100) < 0.05, - "incorrect value for af2, expected 0.0, is %f", - check_msg->af2); - ck_assert_msg((check_msg->c_ic * 100 - 1.34110450745e-07 * 100) < 0.05, - "incorrect value for c_ic, expected 1.34110450745e-07, is %f", - check_msg->c_ic); - ck_assert_msg((check_msg->c_is * 100 - 1.19209289551e-07 * 100) < 0.05, - "incorrect value for c_is, expected 1.19209289551e-07, is %f", - check_msg->c_is); - ck_assert_msg((check_msg->c_rc * 100 - 315.78125 * 100) < 0.05, - "incorrect value for c_rc, expected 315.78125, is %f", - check_msg->c_rc); - ck_assert_msg((check_msg->c_rs * 100 - 36.5625 * 100) < 0.05, - "incorrect value for c_rs, expected 36.5625, is %f", - check_msg->c_rs); - ck_assert_msg((check_msg->c_uc * 100 - 2.06381082535e-06 * 100) < 0.05, - "incorrect value for c_uc, expected 2.06381082535e-06, is %f", - check_msg->c_uc); - ck_assert_msg((check_msg->c_us * 100 - 3.41422855854e-06 * 100) < 0.05, - "incorrect value for c_us, expected 3.41422855854e-06, is %f", - check_msg->c_us); - ck_assert_msg((check_msg->dn * 100 - 4.86198823561e-09 * 100) < 0.05, - "incorrect value for dn, expected 4.86198823561e-09, is %f", - check_msg->dn); - ck_assert_msg((check_msg->ecc * 100 - 0.00792274158448 * 100) < 0.05, - "incorrect value for ecc, expected 0.00792274158448, is %f", - check_msg->ecc); - ck_assert_msg(check_msg->healthy == 1, - "incorrect value for healthy, expected 1, is %d", - check_msg->healthy); - ck_assert_msg((check_msg->inc * 100 - 0.966901291823 * 100) < 0.05, - "incorrect value for inc, expected 0.966901291823, is %f", - check_msg->inc); - ck_assert_msg( - (check_msg->inc_dot * 100 - 2.62510934634e-10 * 100) < 0.05, - "incorrect value for inc_dot, expected 2.62510934634e-10, is %f", - check_msg->inc_dot); - ck_assert_msg(check_msg->iode == 0, - "incorrect value for iode, expected 0, is %d", - check_msg->iode); - ck_assert_msg((check_msg->m0 * 100 - -1.58816085572 * 100) < 0.05, - "incorrect value for m0, expected -1.58816085572, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - 1.23791994157 * 100) < 0.05, - "incorrect value for omega0, expected 1.23791994157, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -8.29570269217e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -8.29570269217e-09, is %f", - check_msg->omegadot); - ck_assert_msg(check_msg->prn == 13, - "incorrect value for prn, expected 13, is %d", - check_msg->prn); - ck_assert_msg((check_msg->sqrta * 100 - 5153.57085609 * 100) < 0.05, - "incorrect value for sqrta, expected 5153.57085609, is %f", - check_msg->sqrta); - ck_assert_msg((check_msg->tgd * 100 - -9.31322574615e-09 * 100) < 0.05, - "incorrect value for tgd, expected -9.31322574615e-09, is %f", - check_msg->tgd); - ck_assert_msg((check_msg->toc_tow * 100 - 410400.0 * 100) < 0.05, - "incorrect value for toc_tow, expected 410400.0, is %f", - check_msg->toc_tow); - ck_assert_msg(check_msg->toc_wn == 1838, - "incorrect value for toc_wn, expected 1838, is %d", - check_msg->toc_wn); - ck_assert_msg((check_msg->toe_tow * 100 - 410400.0 * 100) < 0.05, - "incorrect value for toe_tow, expected 410400.0, is %f", - check_msg->toe_tow); - ck_assert_msg(check_msg->toe_wn == 1838, - "incorrect value for toe_wn, expected 1838, is %d", - check_msg->toe_wn); - ck_assert_msg(check_msg->valid == 1, - "incorrect value for valid, expected 1, is %d", - check_msg->valid); - ck_assert_msg((check_msg->w * 100 - -1.97360228379 * 100) < 0.05, - "incorrect value for w, expected -1.97360228379, is %f", - check_msg->w); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x46, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x46, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 0, 56, 62, - 0, 0, 0, 0, 0, 40, 81, 192, 0, 0, 0, 0, 0, 129, - 109, 64, 0, 0, 0, 0, 0, 28, 205, 190, 0, 0, 0, 0, - 0, 76, 223, 62, 0, 0, 0, 0, 0, 0, 105, 190, 0, 0, - 0, 0, 0, 0, 92, 190, 134, 161, 223, 255, 243, 43, 51, 62, - 146, 176, 113, 142, 234, 164, 5, 64, 0, 0, 0, 56, 175, 140, - 112, 63, 0, 0, 192, 90, 171, 33, 180, 64, 36, 38, 237, 255, - 200, 160, 237, 191, 204, 92, 63, 154, 49, 91, 65, 190, 125, 94, - 251, 132, 52, 61, 216, 63, 2, 139, 28, 27, 231, 199, 238, 63, - 124, 183, 4, 180, 194, 30, 247, 189, 0, 0, 0, 0, 0, 104, - 222, 190, 0, 0, 0, 0, 0, 0, 96, 61, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, - 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 1, 1, 0, 0, - 222, 152, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_dep_b_t* test_msg = (msg_ephemeris_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = -7.249414920806885e-06; - test_msg->af1 = 4.547473508864641e-13; - test_msg->af2 = 0.0; - test_msg->c_ic = -4.6566128730773926e-08; - test_msg->c_is = -2.60770320892334e-08; - test_msg->c_rc = 236.03125; - test_msg->c_rs = -68.625; - test_msg->c_uc = -3.470107913017273e-06; - test_msg->c_us = 7.461756467819214e-06; - test_msg->dn = 4.4637573619826565e-09; - test_msg->ecc = 0.004040417145006359; - test_msg->healthy = 1; - test_msg->inc = 0.9619021920701416; - test_msg->inc_dot = -3.3644258561271105e-10; - test_msg->iode = 0; - test_msg->m0 = 2.7055255058713295; - test_msg->omega0 = -0.9258770941316397; - test_msg->omegadot = -8.082122367123182e-09; - test_msg->prn = 0; - test_msg->sqrta = 5153.669353485107; - test_msg->tgd = 5.587935447692871e-09; - test_msg->toc_tow = 410400.0; - test_msg->toc_wn = 1838; - test_msg->toe_tow = 410400.0; - test_msg->toe_wn = 1838; - test_msg->valid = 1; - test_msg->w = 0.37873566614641857; - sbp_payload_send(&sbp_state, 0x46, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x46, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_dep_b_t* check_msg = - (msg_ephemeris_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - -7.24941492081e-06 * 100) < 0.05, - "incorrect value for af0, expected -7.24941492081e-06, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - 4.54747350886e-13 * 100) < 0.05, - "incorrect value for af1, expected 4.54747350886e-13, is %f", - check_msg->af1); - ck_assert_msg((check_msg->af2 * 100 - 0.0 * 100) < 0.05, - "incorrect value for af2, expected 0.0, is %f", - check_msg->af2); - ck_assert_msg( - (check_msg->c_ic * 100 - -4.65661287308e-08 * 100) < 0.05, - "incorrect value for c_ic, expected -4.65661287308e-08, is %f", - check_msg->c_ic); - ck_assert_msg( - (check_msg->c_is * 100 - -2.60770320892e-08 * 100) < 0.05, - "incorrect value for c_is, expected -2.60770320892e-08, is %f", - check_msg->c_is); - ck_assert_msg((check_msg->c_rc * 100 - 236.03125 * 100) < 0.05, - "incorrect value for c_rc, expected 236.03125, is %f", - check_msg->c_rc); - ck_assert_msg((check_msg->c_rs * 100 - -68.625 * 100) < 0.05, - "incorrect value for c_rs, expected -68.625, is %f", - check_msg->c_rs); - ck_assert_msg( - (check_msg->c_uc * 100 - -3.47010791302e-06 * 100) < 0.05, - "incorrect value for c_uc, expected -3.47010791302e-06, is %f", - check_msg->c_uc); - ck_assert_msg((check_msg->c_us * 100 - 7.46175646782e-06 * 100) < 0.05, - "incorrect value for c_us, expected 7.46175646782e-06, is %f", - check_msg->c_us); - ck_assert_msg((check_msg->dn * 100 - 4.46375736198e-09 * 100) < 0.05, - "incorrect value for dn, expected 4.46375736198e-09, is %f", - check_msg->dn); - ck_assert_msg((check_msg->ecc * 100 - 0.00404041714501 * 100) < 0.05, - "incorrect value for ecc, expected 0.00404041714501, is %f", - check_msg->ecc); - ck_assert_msg(check_msg->healthy == 1, - "incorrect value for healthy, expected 1, is %d", - check_msg->healthy); - ck_assert_msg((check_msg->inc * 100 - 0.96190219207 * 100) < 0.05, - "incorrect value for inc, expected 0.96190219207, is %f", - check_msg->inc); - ck_assert_msg( - (check_msg->inc_dot * 100 - -3.36442585613e-10 * 100) < 0.05, - "incorrect value for inc_dot, expected -3.36442585613e-10, is %f", - check_msg->inc_dot); - ck_assert_msg(check_msg->iode == 0, - "incorrect value for iode, expected 0, is %d", - check_msg->iode); - ck_assert_msg((check_msg->m0 * 100 - 2.70552550587 * 100) < 0.05, - "incorrect value for m0, expected 2.70552550587, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - -0.925877094132 * 100) < 0.05, - "incorrect value for omega0, expected -0.925877094132, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -8.08212236712e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -8.08212236712e-09, is %f", - check_msg->omegadot); - ck_assert_msg(check_msg->prn == 0, - "incorrect value for prn, expected 0, is %d", check_msg->prn); - ck_assert_msg((check_msg->sqrta * 100 - 5153.66935349 * 100) < 0.05, - "incorrect value for sqrta, expected 5153.66935349, is %f", - check_msg->sqrta); - ck_assert_msg((check_msg->tgd * 100 - 5.58793544769e-09 * 100) < 0.05, - "incorrect value for tgd, expected 5.58793544769e-09, is %f", - check_msg->tgd); - ck_assert_msg((check_msg->toc_tow * 100 - 410400.0 * 100) < 0.05, - "incorrect value for toc_tow, expected 410400.0, is %f", - check_msg->toc_tow); - ck_assert_msg(check_msg->toc_wn == 1838, - "incorrect value for toc_wn, expected 1838, is %d", - check_msg->toc_wn); - ck_assert_msg((check_msg->toe_tow * 100 - 410400.0 * 100) < 0.05, - "incorrect value for toe_tow, expected 410400.0, is %f", - check_msg->toe_tow); - ck_assert_msg(check_msg->toe_wn == 1838, - "incorrect value for toe_wn, expected 1838, is %d", - check_msg->toe_wn); - ck_assert_msg(check_msg->valid == 1, - "incorrect value for valid, expected 1, is %d", - check_msg->valid); - ck_assert_msg((check_msg->w * 100 - 0.378735666146 * 100) < 0.05, - "incorrect value for w, expected 0.378735666146, is %f", - check_msg->w); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x46, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x46, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 0, 68, 190, - 0, 0, 0, 0, 0, 72, 66, 64, 0, 0, 0, 0, 128, 188, - 115, 64, 0, 0, 0, 0, 0, 80, 193, 62, 0, 0, 0, 0, - 0, 164, 204, 62, 0, 0, 0, 0, 0, 0, 130, 62, 0, 0, - 0, 0, 0, 0, 128, 62, 72, 181, 127, 6, 208, 225, 52, 62, - 158, 174, 129, 91, 27, 105, 249, 191, 0, 0, 0, 96, 204, 57, - 128, 63, 0, 0, 160, 35, 146, 33, 180, 64, 247, 169, 1, 36, - 133, 206, 243, 63, 79, 11, 109, 92, 156, 208, 65, 190, 103, 78, - 3, 253, 223, 147, 255, 191, 164, 214, 90, 250, 218, 240, 238, 63, - 94, 239, 187, 37, 36, 10, 242, 61, 0, 0, 0, 0, 176, 91, - 19, 63, 0, 0, 0, 0, 0, 0, 137, 189, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, - 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 1, 1, 13, 0, - 180, 21, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_dep_b_t* test_msg = (msg_ephemeris_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = 7.384549826383591e-05; - test_msg->af1 = -2.8421709430404007e-12; - test_msg->af2 = 0.0; - test_msg->c_ic = 1.341104507446289e-07; - test_msg->c_is = 1.1920928955078125e-07; - test_msg->c_rc = 315.78125; - test_msg->c_rs = 36.5625; - test_msg->c_uc = 2.0638108253479004e-06; - test_msg->c_us = 3.4142285585403442e-06; - test_msg->dn = 4.86198823561129e-09; - test_msg->ecc = 0.007922741584479809; - test_msg->healthy = 1; - test_msg->inc = 0.9669012918227122; - test_msg->inc_dot = 2.6251093463412166e-10; - test_msg->iode = 0; - test_msg->m0 = -1.588160855720083; - test_msg->omega0 = 1.237919941568746; - test_msg->omegadot = -8.295702692172441e-09; - test_msg->prn = 13; - test_msg->sqrta = 5153.57085609436; - test_msg->tgd = -9.313225746154785e-09; - test_msg->toc_tow = 410400.0; - test_msg->toc_wn = 1838; - test_msg->toe_tow = 410400.0; - test_msg->toe_wn = 1838; - test_msg->valid = 1; - test_msg->w = -1.9736022837941165; - sbp_payload_send(&sbp_state, 0x46, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x46, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_dep_b_t* check_msg = - (msg_ephemeris_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - 7.38454982638e-05 * 100) < 0.05, - "incorrect value for af0, expected 7.38454982638e-05, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - -2.84217094304e-12 * 100) < 0.05, - "incorrect value for af1, expected -2.84217094304e-12, is %f", - check_msg->af1); - ck_assert_msg((check_msg->af2 * 100 - 0.0 * 100) < 0.05, - "incorrect value for af2, expected 0.0, is %f", - check_msg->af2); - ck_assert_msg((check_msg->c_ic * 100 - 1.34110450745e-07 * 100) < 0.05, - "incorrect value for c_ic, expected 1.34110450745e-07, is %f", - check_msg->c_ic); - ck_assert_msg((check_msg->c_is * 100 - 1.19209289551e-07 * 100) < 0.05, - "incorrect value for c_is, expected 1.19209289551e-07, is %f", - check_msg->c_is); - ck_assert_msg((check_msg->c_rc * 100 - 315.78125 * 100) < 0.05, - "incorrect value for c_rc, expected 315.78125, is %f", - check_msg->c_rc); - ck_assert_msg((check_msg->c_rs * 100 - 36.5625 * 100) < 0.05, - "incorrect value for c_rs, expected 36.5625, is %f", - check_msg->c_rs); - ck_assert_msg((check_msg->c_uc * 100 - 2.06381082535e-06 * 100) < 0.05, - "incorrect value for c_uc, expected 2.06381082535e-06, is %f", - check_msg->c_uc); - ck_assert_msg((check_msg->c_us * 100 - 3.41422855854e-06 * 100) < 0.05, - "incorrect value for c_us, expected 3.41422855854e-06, is %f", - check_msg->c_us); - ck_assert_msg((check_msg->dn * 100 - 4.86198823561e-09 * 100) < 0.05, - "incorrect value for dn, expected 4.86198823561e-09, is %f", - check_msg->dn); - ck_assert_msg((check_msg->ecc * 100 - 0.00792274158448 * 100) < 0.05, - "incorrect value for ecc, expected 0.00792274158448, is %f", - check_msg->ecc); - ck_assert_msg(check_msg->healthy == 1, - "incorrect value for healthy, expected 1, is %d", - check_msg->healthy); - ck_assert_msg((check_msg->inc * 100 - 0.966901291823 * 100) < 0.05, - "incorrect value for inc, expected 0.966901291823, is %f", - check_msg->inc); - ck_assert_msg( - (check_msg->inc_dot * 100 - 2.62510934634e-10 * 100) < 0.05, - "incorrect value for inc_dot, expected 2.62510934634e-10, is %f", - check_msg->inc_dot); - ck_assert_msg(check_msg->iode == 0, - "incorrect value for iode, expected 0, is %d", - check_msg->iode); - ck_assert_msg((check_msg->m0 * 100 - -1.58816085572 * 100) < 0.05, - "incorrect value for m0, expected -1.58816085572, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - 1.23791994157 * 100) < 0.05, - "incorrect value for omega0, expected 1.23791994157, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -8.29570269217e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -8.29570269217e-09, is %f", - check_msg->omegadot); - ck_assert_msg(check_msg->prn == 13, - "incorrect value for prn, expected 13, is %d", - check_msg->prn); - ck_assert_msg((check_msg->sqrta * 100 - 5153.57085609 * 100) < 0.05, - "incorrect value for sqrta, expected 5153.57085609, is %f", - check_msg->sqrta); - ck_assert_msg((check_msg->tgd * 100 - -9.31322574615e-09 * 100) < 0.05, - "incorrect value for tgd, expected -9.31322574615e-09, is %f", - check_msg->tgd); - ck_assert_msg((check_msg->toc_tow * 100 - 410400.0 * 100) < 0.05, - "incorrect value for toc_tow, expected 410400.0, is %f", - check_msg->toc_tow); - ck_assert_msg(check_msg->toc_wn == 1838, - "incorrect value for toc_wn, expected 1838, is %d", - check_msg->toc_wn); - ck_assert_msg((check_msg->toe_tow * 100 - 410400.0 * 100) < 0.05, - "incorrect value for toe_tow, expected 410400.0, is %f", - check_msg->toe_tow); - ck_assert_msg(check_msg->toe_wn == 1838, - "incorrect value for toe_wn, expected 1838, is %d", - check_msg->toe_wn); - ck_assert_msg(check_msg->valid == 1, - "incorrect value for valid, expected 1, is %d", - check_msg->valid); - ck_assert_msg((check_msg->w * 100 - -1.97360228379 * 100) < 0.05, - "incorrect value for w, expected -1.97360228379, is %f", - check_msg->w); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x46, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x46, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 128, 85, 190, - 0, 0, 0, 0, 0, 156, 69, 64, 0, 0, 0, 0, 128, 19, - 115, 64, 0, 0, 0, 0, 0, 160, 193, 62, 0, 0, 0, 0, - 0, 152, 207, 62, 0, 0, 0, 0, 0, 0, 97, 190, 0, 0, - 0, 0, 0, 192, 139, 190, 26, 26, 13, 149, 16, 152, 54, 62, - 104, 7, 46, 214, 75, 84, 5, 192, 0, 0, 0, 128, 230, 82, - 132, 63, 0, 0, 160, 252, 162, 33, 180, 64, 73, 6, 130, 54, - 217, 171, 242, 63, 81, 224, 163, 123, 238, 42, 66, 190, 206, 43, - 141, 67, 243, 157, 5, 192, 113, 179, 153, 187, 43, 92, 238, 63, - 254, 236, 31, 43, 224, 157, 244, 61, 0, 0, 0, 0, 232, 4, - 26, 191, 0, 0, 0, 0, 0, 0, 134, 189, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, - 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 1, 1, 22, 0, - 99, 61, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_dep_b_t* test_msg = (msg_ephemeris_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = -9.925523772835732e-05; - test_msg->af1 = -2.5011104298755527e-12; - test_msg->af2 = 0.0; - test_msg->c_ic = -3.166496753692627e-08; - test_msg->c_is = -2.0675361156463623e-07; - test_msg->c_rc = 305.21875; - test_msg->c_rs = 43.21875; - test_msg->c_uc = 2.1010637283325195e-06; - test_msg->c_us = 3.766268491744995e-06; - test_msg->dn = 5.26057626697412e-09; - test_msg->ecc = 0.009923744946718216; - test_msg->healthy = 1; - test_msg->inc = 0.9487513221807672; - test_msg->inc_dot = 3.000124967247105e-10; - test_msg->iode = 0; - test_msg->m0 = -2.666160271911327; - test_msg->omega0 = 1.1669551972594425; - test_msg->omegadot = -8.45999524990264e-09; - test_msg->prn = 22; - test_msg->sqrta = 5153.636667251587; - test_msg->tgd = -2.0023435354232788e-08; - test_msg->toc_tow = 410400.0; - test_msg->toc_wn = 1838; - test_msg->toe_tow = 410400.0; - test_msg->toe_wn = 1838; - test_msg->valid = 1; - test_msg->w = -2.7021241452652935; - sbp_payload_send(&sbp_state, 0x46, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x46, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_dep_b_t* check_msg = - (msg_ephemeris_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - -9.92552377284e-05 * 100) < 0.05, - "incorrect value for af0, expected -9.92552377284e-05, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - -2.50111042988e-12 * 100) < 0.05, - "incorrect value for af1, expected -2.50111042988e-12, is %f", - check_msg->af1); - ck_assert_msg((check_msg->af2 * 100 - 0.0 * 100) < 0.05, - "incorrect value for af2, expected 0.0, is %f", - check_msg->af2); - ck_assert_msg( - (check_msg->c_ic * 100 - -3.16649675369e-08 * 100) < 0.05, - "incorrect value for c_ic, expected -3.16649675369e-08, is %f", - check_msg->c_ic); - ck_assert_msg( - (check_msg->c_is * 100 - -2.06753611565e-07 * 100) < 0.05, - "incorrect value for c_is, expected -2.06753611565e-07, is %f", - check_msg->c_is); - ck_assert_msg((check_msg->c_rc * 100 - 305.21875 * 100) < 0.05, - "incorrect value for c_rc, expected 305.21875, is %f", - check_msg->c_rc); - ck_assert_msg((check_msg->c_rs * 100 - 43.21875 * 100) < 0.05, - "incorrect value for c_rs, expected 43.21875, is %f", - check_msg->c_rs); - ck_assert_msg((check_msg->c_uc * 100 - 2.10106372833e-06 * 100) < 0.05, - "incorrect value for c_uc, expected 2.10106372833e-06, is %f", - check_msg->c_uc); - ck_assert_msg((check_msg->c_us * 100 - 3.76626849174e-06 * 100) < 0.05, - "incorrect value for c_us, expected 3.76626849174e-06, is %f", - check_msg->c_us); - ck_assert_msg((check_msg->dn * 100 - 5.26057626697e-09 * 100) < 0.05, - "incorrect value for dn, expected 5.26057626697e-09, is %f", - check_msg->dn); - ck_assert_msg((check_msg->ecc * 100 - 0.00992374494672 * 100) < 0.05, - "incorrect value for ecc, expected 0.00992374494672, is %f", - check_msg->ecc); - ck_assert_msg(check_msg->healthy == 1, - "incorrect value for healthy, expected 1, is %d", - check_msg->healthy); - ck_assert_msg((check_msg->inc * 100 - 0.948751322181 * 100) < 0.05, - "incorrect value for inc, expected 0.948751322181, is %f", - check_msg->inc); - ck_assert_msg( - (check_msg->inc_dot * 100 - 3.00012496725e-10 * 100) < 0.05, - "incorrect value for inc_dot, expected 3.00012496725e-10, is %f", - check_msg->inc_dot); - ck_assert_msg(check_msg->iode == 0, - "incorrect value for iode, expected 0, is %d", - check_msg->iode); - ck_assert_msg((check_msg->m0 * 100 - -2.66616027191 * 100) < 0.05, - "incorrect value for m0, expected -2.66616027191, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - 1.16695519726 * 100) < 0.05, - "incorrect value for omega0, expected 1.16695519726, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -8.4599952499e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -8.4599952499e-09, is %f", - check_msg->omegadot); - ck_assert_msg(check_msg->prn == 22, - "incorrect value for prn, expected 22, is %d", - check_msg->prn); - ck_assert_msg((check_msg->sqrta * 100 - 5153.63666725 * 100) < 0.05, - "incorrect value for sqrta, expected 5153.63666725, is %f", - check_msg->sqrta); - ck_assert_msg((check_msg->tgd * 100 - -2.00234353542e-08 * 100) < 0.05, - "incorrect value for tgd, expected -2.00234353542e-08, is %f", - check_msg->tgd); - ck_assert_msg((check_msg->toc_tow * 100 - 410400.0 * 100) < 0.05, - "incorrect value for toc_tow, expected 410400.0, is %f", - check_msg->toc_tow); - ck_assert_msg(check_msg->toc_wn == 1838, - "incorrect value for toc_wn, expected 1838, is %d", - check_msg->toc_wn); - ck_assert_msg((check_msg->toe_tow * 100 - 410400.0 * 100) < 0.05, - "incorrect value for toe_tow, expected 410400.0, is %f", - check_msg->toe_tow); - ck_assert_msg(check_msg->toe_wn == 1838, - "incorrect value for toe_wn, expected 1838, is %d", - check_msg->toe_wn); - ck_assert_msg(check_msg->valid == 1, - "incorrect value for valid, expected 1, is %d", - check_msg->valid); - ck_assert_msg((check_msg->w * 100 - -2.70212414527 * 100) < 0.05, - "incorrect value for w, expected -2.70212414527, is %f", - check_msg->w); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x46, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x46, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 0, 77, 190, - 0, 0, 0, 0, 0, 122, 83, 192, 0, 0, 0, 0, 0, 233, - 110, 64, 0, 0, 0, 0, 0, 60, 207, 190, 0, 0, 0, 0, - 0, 28, 222, 62, 0, 0, 0, 0, 0, 128, 120, 62, 0, 0, - 0, 0, 0, 0, 108, 62, 10, 230, 183, 140, 214, 230, 50, 62, - 54, 86, 196, 164, 252, 10, 255, 63, 0, 0, 0, 36, 247, 191, - 128, 63, 0, 0, 160, 5, 193, 33, 180, 64, 186, 138, 81, 129, - 88, 239, 1, 64, 94, 210, 120, 170, 106, 25, 65, 190, 103, 213, - 32, 155, 227, 194, 224, 191, 156, 47, 104, 93, 101, 55, 239, 63, - 196, 83, 100, 254, 51, 54, 4, 190, 0, 0, 0, 0, 50, 242, - 52, 63, 0, 0, 0, 0, 0, 0, 114, 189, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, - 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 1, 1, 30, 0, - 170, 33, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_dep_b_t* test_msg = (msg_ephemeris_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = 0.0003196117468178272; - test_msg->af1 = -1.0231815394945443e-12; - test_msg->af2 = 0.0; - test_msg->c_ic = 9.12696123123169e-08; - test_msg->c_is = 5.21540641784668e-08; - test_msg->c_rc = 247.28125; - test_msg->c_rs = -77.90625; - test_msg->c_uc = -3.723427653312683e-06; - test_msg->c_us = 7.178634405136108e-06; - test_msg->dn = 4.400897600764146e-09; - test_msg->ecc = 0.008178644930012524; - test_msg->healthy = 1; - test_msg->inc = 0.9755122017245301; - test_msg->inc_dot = -5.882387882209502e-10; - test_msg->iode = 0; - test_msg->m0 = 1.9401823459824192; - test_msg->omega0 = 2.241868028927766; - test_msg->omegadot = -7.962474526167494e-09; - test_msg->prn = 30; - test_msg->sqrta = 5153.7539920806885; - test_msg->tgd = -1.3504177331924438e-08; - test_msg->toc_tow = 410400.0; - test_msg->toc_wn = 1838; - test_msg->toe_tow = 410400.0; - test_msg->toe_wn = 1838; - test_msg->valid = 1; - test_msg->w = -0.5237901716088061; - sbp_payload_send(&sbp_state, 0x46, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x46, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_dep_b_t* check_msg = - (msg_ephemeris_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - 0.000319611746818 * 100) < 0.05, - "incorrect value for af0, expected 0.000319611746818, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - -1.02318153949e-12 * 100) < 0.05, - "incorrect value for af1, expected -1.02318153949e-12, is %f", - check_msg->af1); - ck_assert_msg((check_msg->af2 * 100 - 0.0 * 100) < 0.05, - "incorrect value for af2, expected 0.0, is %f", - check_msg->af2); - ck_assert_msg((check_msg->c_ic * 100 - 9.12696123123e-08 * 100) < 0.05, - "incorrect value for c_ic, expected 9.12696123123e-08, is %f", - check_msg->c_ic); - ck_assert_msg((check_msg->c_is * 100 - 5.21540641785e-08 * 100) < 0.05, - "incorrect value for c_is, expected 5.21540641785e-08, is %f", - check_msg->c_is); - ck_assert_msg((check_msg->c_rc * 100 - 247.28125 * 100) < 0.05, - "incorrect value for c_rc, expected 247.28125, is %f", - check_msg->c_rc); - ck_assert_msg((check_msg->c_rs * 100 - -77.90625 * 100) < 0.05, - "incorrect value for c_rs, expected -77.90625, is %f", - check_msg->c_rs); - ck_assert_msg( - (check_msg->c_uc * 100 - -3.72342765331e-06 * 100) < 0.05, - "incorrect value for c_uc, expected -3.72342765331e-06, is %f", - check_msg->c_uc); - ck_assert_msg((check_msg->c_us * 100 - 7.17863440514e-06 * 100) < 0.05, - "incorrect value for c_us, expected 7.17863440514e-06, is %f", - check_msg->c_us); - ck_assert_msg((check_msg->dn * 100 - 4.40089760076e-09 * 100) < 0.05, - "incorrect value for dn, expected 4.40089760076e-09, is %f", - check_msg->dn); - ck_assert_msg((check_msg->ecc * 100 - 0.00817864493001 * 100) < 0.05, - "incorrect value for ecc, expected 0.00817864493001, is %f", - check_msg->ecc); - ck_assert_msg(check_msg->healthy == 1, - "incorrect value for healthy, expected 1, is %d", - check_msg->healthy); - ck_assert_msg((check_msg->inc * 100 - 0.975512201725 * 100) < 0.05, - "incorrect value for inc, expected 0.975512201725, is %f", - check_msg->inc); - ck_assert_msg( - (check_msg->inc_dot * 100 - -5.88238788221e-10 * 100) < 0.05, - "incorrect value for inc_dot, expected -5.88238788221e-10, is %f", - check_msg->inc_dot); - ck_assert_msg(check_msg->iode == 0, - "incorrect value for iode, expected 0, is %d", - check_msg->iode); - ck_assert_msg((check_msg->m0 * 100 - 1.94018234598 * 100) < 0.05, - "incorrect value for m0, expected 1.94018234598, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - 2.24186802893 * 100) < 0.05, - "incorrect value for omega0, expected 2.24186802893, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -7.96247452617e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -7.96247452617e-09, is %f", - check_msg->omegadot); - ck_assert_msg(check_msg->prn == 30, - "incorrect value for prn, expected 30, is %d", - check_msg->prn); - ck_assert_msg((check_msg->sqrta * 100 - 5153.75399208 * 100) < 0.05, - "incorrect value for sqrta, expected 5153.75399208, is %f", - check_msg->sqrta); - ck_assert_msg((check_msg->tgd * 100 - -1.35041773319e-08 * 100) < 0.05, - "incorrect value for tgd, expected -1.35041773319e-08, is %f", - check_msg->tgd); - ck_assert_msg((check_msg->toc_tow * 100 - 410400.0 * 100) < 0.05, - "incorrect value for toc_tow, expected 410400.0, is %f", - check_msg->toc_tow); - ck_assert_msg(check_msg->toc_wn == 1838, - "incorrect value for toc_wn, expected 1838, is %d", - check_msg->toc_wn); - ck_assert_msg((check_msg->toe_tow * 100 - 410400.0 * 100) < 0.05, - "incorrect value for toe_tow, expected 410400.0, is %f", - check_msg->toe_tow); - ck_assert_msg(check_msg->toe_wn == 1838, - "incorrect value for toe_wn, expected 1838, is %d", - check_msg->toe_wn); - ck_assert_msg(check_msg->valid == 1, - "incorrect value for valid, expected 1, is %d", - check_msg->valid); - ck_assert_msg((check_msg->w * 100 - -0.523790171609 * 100) < 0.05, - "incorrect value for w, expected -0.523790171609, is %f", - check_msg->w); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_observation_msgEphemerisDepB_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_msgEphemerisDepB"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_msgEphemerisDepB"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_msgEphemerisDepB); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_msgEphemerisQzss.c b/c/test/legacy/auto_check_sbp_observation_msgEphemerisQzss.c deleted file mode 100644 index 4155021678..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_msgEphemerisQzss.c +++ /dev/null @@ -1,353 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_msgEphemerisQzss.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_msgEphemerisQzss) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x8e, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x8e, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 142, 0, 128, 240, 139, 193, 31, 208, 221, 6, 0, 106, 8, - 0, 0, 0, 64, 64, 56, 0, 0, 0, 0, 0, 0, 192, 177, - 0, 232, 228, 195, 0, 160, 19, 194, 0, 224, 135, 183, 0, 96, - 10, 55, 0, 192, 157, 181, 0, 0, 46, 52, 167, 72, 107, 105, - 179, 1, 39, 62, 15, 224, 158, 211, 241, 164, 211, 63, 0, 0, - 0, 24, 251, 83, 179, 63, 0, 0, 0, 34, 44, 93, 185, 64, - 143, 62, 206, 232, 193, 181, 242, 191, 207, 216, 69, 106, 98, 255, - 39, 190, 65, 132, 95, 22, 48, 15, 249, 191, 249, 82, 67, 94, - 30, 100, 231, 63, 117, 167, 187, 233, 187, 253, 181, 61, 160, 129, - 193, 185, 0, 0, 168, 172, 0, 0, 0, 0, 208, 221, 6, 0, - 106, 8, 49, 49, 3, 126, 23, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ephemeris_qzss_t *test_msg = (msg_ephemeris_qzss_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->af0 = -0.00036908406764268875; - test_msg->af1 = -4.774847184307873e-12; - test_msg->af2 = 0.0; - test_msg->c_ic = -1.1753290891647339e-06; - test_msg->c_is = 1.6205012798309326e-07; - test_msg->c_rc = -36.90625; - test_msg->c_rs = -457.8125; - test_msg->c_uc = -1.6197562217712402e-05; - test_msg->c_us = 8.247792720794678e-06; - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 31; - test_msg->common.sid.sat = 193; - test_msg->common.toe.tow = 450000; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 2.0; - test_msg->common.valid = 0; - test_msg->dn = 2.678325848736433e-09; - test_msg->ecc = 0.07550019584596157; - test_msg->inc = 0.7309715119432375; - test_msg->inc_dot = 2.0000833114980698e-11; - test_msg->iodc = 817; - test_msg->iode = 49; - test_msg->m0 = 0.30694242158961144; - test_msg->omega0 = -1.1693743795366662; - test_msg->omegadot = -2.7936877968817684e-09; - test_msg->sqrta = 6493.172393798828; - test_msg->tgd = -5.587935447692871e-09; - test_msg->toc.tow = 450000; - test_msg->toc.wn = 2154; - test_msg->w = -1.5662079690885238; - sbp_payload_send(&sbp_state, 0x8e, 61568, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 61568, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 61568, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x8e, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ephemeris_qzss_t *check_msg = - (msg_ephemeris_qzss_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg((check_msg->af0 * 100 - -0.000369084067643 * 100) < 0.05, - "incorrect value for af0, expected -0.000369084067643, is %f", - check_msg->af0); - ck_assert_msg((check_msg->af1 * 100 - -4.77484718431e-12 * 100) < 0.05, - "incorrect value for af1, expected -4.77484718431e-12, is %f", - check_msg->af1); - ck_assert_msg((check_msg->af2 * 100 - 0.0 * 100) < 0.05, - "incorrect value for af2, expected 0.0, is %f", - check_msg->af2); - ck_assert_msg( - (check_msg->c_ic * 100 - -1.17532908916e-06 * 100) < 0.05, - "incorrect value for c_ic, expected -1.17532908916e-06, is %f", - check_msg->c_ic); - ck_assert_msg((check_msg->c_is * 100 - 1.62050127983e-07 * 100) < 0.05, - "incorrect value for c_is, expected 1.62050127983e-07, is %f", - check_msg->c_is); - ck_assert_msg((check_msg->c_rc * 100 - -36.90625 * 100) < 0.05, - "incorrect value for c_rc, expected -36.90625, is %f", - check_msg->c_rc); - ck_assert_msg((check_msg->c_rs * 100 - -457.8125 * 100) < 0.05, - "incorrect value for c_rs, expected -457.8125, is %f", - check_msg->c_rs); - ck_assert_msg( - (check_msg->c_uc * 100 - -1.61975622177e-05 * 100) < 0.05, - "incorrect value for c_uc, expected -1.61975622177e-05, is %f", - check_msg->c_uc); - ck_assert_msg((check_msg->c_us * 100 - 8.24779272079e-06 * 100) < 0.05, - "incorrect value for c_us, expected 8.24779272079e-06, is %f", - check_msg->c_us); - ck_assert_msg( - check_msg->common.fit_interval == 14400, - "incorrect value for common.fit_interval, expected 14400, is %d", - check_msg->common.fit_interval); - ck_assert_msg(check_msg->common.health_bits == 0, - "incorrect value for common.health_bits, expected 0, is %d", - check_msg->common.health_bits); - ck_assert_msg(check_msg->common.sid.code == 31, - "incorrect value for common.sid.code, expected 31, is %d", - check_msg->common.sid.code); - ck_assert_msg(check_msg->common.sid.sat == 193, - "incorrect value for common.sid.sat, expected 193, is %d", - check_msg->common.sid.sat); - ck_assert_msg(check_msg->common.toe.tow == 450000, - "incorrect value for common.toe.tow, expected 450000, is %d", - check_msg->common.toe.tow); - ck_assert_msg(check_msg->common.toe.wn == 2154, - "incorrect value for common.toe.wn, expected 2154, is %d", - check_msg->common.toe.wn); - ck_assert_msg((check_msg->common.ura * 100 - 2.0 * 100) < 0.05, - "incorrect value for common.ura, expected 2.0, is %f", - check_msg->common.ura); - ck_assert_msg(check_msg->common.valid == 0, - "incorrect value for common.valid, expected 0, is %d", - check_msg->common.valid); - ck_assert_msg((check_msg->dn * 100 - 2.67832584874e-09 * 100) < 0.05, - "incorrect value for dn, expected 2.67832584874e-09, is %f", - check_msg->dn); - ck_assert_msg((check_msg->ecc * 100 - 0.075500195846 * 100) < 0.05, - "incorrect value for ecc, expected 0.075500195846, is %f", - check_msg->ecc); - ck_assert_msg((check_msg->inc * 100 - 0.730971511943 * 100) < 0.05, - "incorrect value for inc, expected 0.730971511943, is %f", - check_msg->inc); - ck_assert_msg( - (check_msg->inc_dot * 100 - 2.0000833115e-11 * 100) < 0.05, - "incorrect value for inc_dot, expected 2.0000833115e-11, is %f", - check_msg->inc_dot); - ck_assert_msg(check_msg->iodc == 817, - "incorrect value for iodc, expected 817, is %d", - check_msg->iodc); - ck_assert_msg(check_msg->iode == 49, - "incorrect value for iode, expected 49, is %d", - check_msg->iode); - ck_assert_msg((check_msg->m0 * 100 - 0.30694242159 * 100) < 0.05, - "incorrect value for m0, expected 0.30694242159, is %f", - check_msg->m0); - ck_assert_msg((check_msg->omega0 * 100 - -1.16937437954 * 100) < 0.05, - "incorrect value for omega0, expected -1.16937437954, is %f", - check_msg->omega0); - ck_assert_msg( - (check_msg->omegadot * 100 - -2.79368779688e-09 * 100) < 0.05, - "incorrect value for omegadot, expected -2.79368779688e-09, is %f", - check_msg->omegadot); - ck_assert_msg((check_msg->sqrta * 100 - 6493.1723938 * 100) < 0.05, - "incorrect value for sqrta, expected 6493.1723938, is %f", - check_msg->sqrta); - ck_assert_msg((check_msg->tgd * 100 - -5.58793544769e-09 * 100) < 0.05, - "incorrect value for tgd, expected -5.58793544769e-09, is %f", - check_msg->tgd); - ck_assert_msg(check_msg->toc.tow == 450000, - "incorrect value for toc.tow, expected 450000, is %d", - check_msg->toc.tow); - ck_assert_msg(check_msg->toc.wn == 2154, - "incorrect value for toc.wn, expected 2154, is %d", - check_msg->toc.wn); - ck_assert_msg((check_msg->w * 100 - -1.56620796909 * 100) < 0.05, - "incorrect value for w, expected -1.56620796909, is %f", - check_msg->w); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_observation_msgEphemerisQzss_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_observation_msgEphemerisQzss"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_msgEphemerisQzss"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_observation_msgEphemerisQzss); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_observation_msgObsDepA.c b/c/test/legacy/auto_check_sbp_observation_msgObsDepA.c deleted file mode 100644 index c31278e358..0000000000 --- a/c/test/legacy/auto_check_sbp_observation_msgObsDepA.c +++ /dev/null @@ -1,1452 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_msgObsDepA.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_observation_msgObsDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x45, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x45, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 69, 0, 195, 4, 98, 56, 158, 67, 24, 46, 7, 32, 56, - 235, 249, 121, 244, 114, 255, 255, 33, 46, 67, 218, 0, 238, 203, - 70, 124, 22, 25, 3, 0, 98, 43, 184, 157, 2, 176, 133, 197, - 125, 126, 71, 253, 255, 185, 39, 68, 55, 3, 60, 173, 162, 131, - 98, 231, 253, 255, 139, 30, 33, 16, 10, 128, 178, 248, 136, 42, - 113, 253, 255, 40, 20, 42, 71, 13, 246, 246, 17, 135, 255, 51, - 3, 0, 64, 27, 108, 249, 22, 210, 41, 114, 118, 131, 48, 255, - 255, 31, 52, 226, 58, 30, 23, 217, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_dep_a_t* test_msg = (msg_obs_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.tow = 407084600; - test_msg->header.t.wn = 1838; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].L.f = 33; - test_msg->obs[0].L.i = -36108; - test_msg->obs[0].P = 2046421816; - test_msg->obs[0].cn0 = 46; - test_msg->obs[0].lock = 55875; - test_msg->obs[0].prn = 0; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[1].L.f = 98; - test_msg->obs[1].L.i = 203030; - test_msg->obs[1].P = 2085014510; - test_msg->obs[1].cn0 = 43; - test_msg->obs[1].lock = 40376; - test_msg->obs[1].prn = 2; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[2].L.f = 185; - test_msg->obs[2].L.i = -178306; - test_msg->obs[2].P = 2110096816; - test_msg->obs[2].cn0 = 39; - test_msg->obs[2].lock = 14148; - test_msg->obs[2].prn = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[3].L.f = 139; - test_msg->obs[3].L.i = -137374; - test_msg->obs[3].P = 2208476476; - test_msg->obs[3].cn0 = 30; - test_msg->obs[3].lock = 4129; - test_msg->obs[3].prn = 10; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[4].L.f = 40; - test_msg->obs[4].L.i = -167638; - test_msg->obs[4].P = 2298000000; - test_msg->obs[4].cn0 = 20; - test_msg->obs[4].lock = 18218; - test_msg->obs[4].prn = 13; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[5].L.f = 64; - test_msg->obs[5].L.i = 209919; - test_msg->obs[5].P = 2266101494; - test_msg->obs[5].cn0 = 27; - test_msg->obs[5].lock = 63852; - test_msg->obs[5].prn = 22; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[6].L.f = 31; - test_msg->obs[6].L.i = -53117; - test_msg->obs[6].P = 1987193298; - test_msg->obs[6].cn0 = 52; - test_msg->obs[6].lock = 15074; - test_msg->obs[6].prn = 30; - sbp_payload_send(&sbp_state, 0x45, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x45, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_dep_a_t* check_msg = (msg_obs_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 32, - "incorrect value for header.n_obs, expected 32, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.tow == 407084600, - "incorrect value for header.t.tow, expected 407084600, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 1838, - "incorrect value for header.t.wn, expected 1838, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].L.f == 33, - "incorrect value for obs[0].L.f, expected 33, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == -36108, - "incorrect value for obs[0].L.i, expected -36108, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 2046421816, - "incorrect value for obs[0].P, expected 2046421816, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].cn0 == 46, - "incorrect value for obs[0].cn0, expected 46, is %d", - check_msg->obs[0].cn0); - ck_assert_msg(check_msg->obs[0].lock == 55875, - "incorrect value for obs[0].lock, expected 55875, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].prn == 0, - "incorrect value for obs[0].prn, expected 0, is %d", - check_msg->obs[0].prn); - ck_assert_msg(check_msg->obs[1].L.f == 98, - "incorrect value for obs[1].L.f, expected 98, is %d", - check_msg->obs[1].L.f); - ck_assert_msg(check_msg->obs[1].L.i == 203030, - "incorrect value for obs[1].L.i, expected 203030, is %d", - check_msg->obs[1].L.i); - ck_assert_msg(check_msg->obs[1].P == 2085014510, - "incorrect value for obs[1].P, expected 2085014510, is %d", - check_msg->obs[1].P); - ck_assert_msg(check_msg->obs[1].cn0 == 43, - "incorrect value for obs[1].cn0, expected 43, is %d", - check_msg->obs[1].cn0); - ck_assert_msg(check_msg->obs[1].lock == 40376, - "incorrect value for obs[1].lock, expected 40376, is %d", - check_msg->obs[1].lock); - ck_assert_msg(check_msg->obs[1].prn == 2, - "incorrect value for obs[1].prn, expected 2, is %d", - check_msg->obs[1].prn); - ck_assert_msg(check_msg->obs[2].L.f == 185, - "incorrect value for obs[2].L.f, expected 185, is %d", - check_msg->obs[2].L.f); - ck_assert_msg(check_msg->obs[2].L.i == -178306, - "incorrect value for obs[2].L.i, expected -178306, is %d", - check_msg->obs[2].L.i); - ck_assert_msg(check_msg->obs[2].P == 2110096816, - "incorrect value for obs[2].P, expected 2110096816, is %d", - check_msg->obs[2].P); - ck_assert_msg(check_msg->obs[2].cn0 == 39, - "incorrect value for obs[2].cn0, expected 39, is %d", - check_msg->obs[2].cn0); - ck_assert_msg(check_msg->obs[2].lock == 14148, - "incorrect value for obs[2].lock, expected 14148, is %d", - check_msg->obs[2].lock); - ck_assert_msg(check_msg->obs[2].prn == 3, - "incorrect value for obs[2].prn, expected 3, is %d", - check_msg->obs[2].prn); - ck_assert_msg(check_msg->obs[3].L.f == 139, - "incorrect value for obs[3].L.f, expected 139, is %d", - check_msg->obs[3].L.f); - ck_assert_msg(check_msg->obs[3].L.i == -137374, - "incorrect value for obs[3].L.i, expected -137374, is %d", - check_msg->obs[3].L.i); - ck_assert_msg(check_msg->obs[3].P == 2208476476, - "incorrect value for obs[3].P, expected 2208476476, is %d", - check_msg->obs[3].P); - ck_assert_msg(check_msg->obs[3].cn0 == 30, - "incorrect value for obs[3].cn0, expected 30, is %d", - check_msg->obs[3].cn0); - ck_assert_msg(check_msg->obs[3].lock == 4129, - "incorrect value for obs[3].lock, expected 4129, is %d", - check_msg->obs[3].lock); - ck_assert_msg(check_msg->obs[3].prn == 10, - "incorrect value for obs[3].prn, expected 10, is %d", - check_msg->obs[3].prn); - ck_assert_msg(check_msg->obs[4].L.f == 40, - "incorrect value for obs[4].L.f, expected 40, is %d", - check_msg->obs[4].L.f); - ck_assert_msg(check_msg->obs[4].L.i == -167638, - "incorrect value for obs[4].L.i, expected -167638, is %d", - check_msg->obs[4].L.i); - ck_assert_msg(check_msg->obs[4].P == 2298000000, - "incorrect value for obs[4].P, expected 2298000000, is %d", - check_msg->obs[4].P); - ck_assert_msg(check_msg->obs[4].cn0 == 20, - "incorrect value for obs[4].cn0, expected 20, is %d", - check_msg->obs[4].cn0); - ck_assert_msg(check_msg->obs[4].lock == 18218, - "incorrect value for obs[4].lock, expected 18218, is %d", - check_msg->obs[4].lock); - ck_assert_msg(check_msg->obs[4].prn == 13, - "incorrect value for obs[4].prn, expected 13, is %d", - check_msg->obs[4].prn); - ck_assert_msg(check_msg->obs[5].L.f == 64, - "incorrect value for obs[5].L.f, expected 64, is %d", - check_msg->obs[5].L.f); - ck_assert_msg(check_msg->obs[5].L.i == 209919, - "incorrect value for obs[5].L.i, expected 209919, is %d", - check_msg->obs[5].L.i); - ck_assert_msg(check_msg->obs[5].P == 2266101494, - "incorrect value for obs[5].P, expected 2266101494, is %d", - check_msg->obs[5].P); - ck_assert_msg(check_msg->obs[5].cn0 == 27, - "incorrect value for obs[5].cn0, expected 27, is %d", - check_msg->obs[5].cn0); - ck_assert_msg(check_msg->obs[5].lock == 63852, - "incorrect value for obs[5].lock, expected 63852, is %d", - check_msg->obs[5].lock); - ck_assert_msg(check_msg->obs[5].prn == 22, - "incorrect value for obs[5].prn, expected 22, is %d", - check_msg->obs[5].prn); - ck_assert_msg(check_msg->obs[6].L.f == 31, - "incorrect value for obs[6].L.f, expected 31, is %d", - check_msg->obs[6].L.f); - ck_assert_msg(check_msg->obs[6].L.i == -53117, - "incorrect value for obs[6].L.i, expected -53117, is %d", - check_msg->obs[6].L.i); - ck_assert_msg(check_msg->obs[6].P == 1987193298, - "incorrect value for obs[6].P, expected 1987193298, is %d", - check_msg->obs[6].P); - ck_assert_msg(check_msg->obs[6].cn0 == 52, - "incorrect value for obs[6].cn0, expected 52, is %d", - check_msg->obs[6].cn0); - ck_assert_msg(check_msg->obs[6].lock == 15074, - "incorrect value for obs[6].lock, expected 15074, is %d", - check_msg->obs[6].lock); - ck_assert_msg(check_msg->obs[6].prn == 30, - "incorrect value for obs[6].prn, expected 30, is %d", - check_msg->obs[6].prn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x45, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x45, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 69, 0, 195, 4, 20, 56, 158, 67, 24, 46, 7, 33, 84, - 52, 164, 117, 102, 32, 0, 0, 147, 62, 62, 250, 31, 234, 14, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_dep_a_t* test_msg = (msg_obs_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 33; - test_msg->header.t.tow = 407084600; - test_msg->header.t.wn = 1838; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].L.f = 147; - test_msg->obs[0].L.i = 8294; - test_msg->obs[0].P = 1973695572; - test_msg->obs[0].cn0 = 62; - test_msg->obs[0].lock = 64062; - test_msg->obs[0].prn = 31; - sbp_payload_send(&sbp_state, 0x45, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x45, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_dep_a_t* check_msg = (msg_obs_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 33, - "incorrect value for header.n_obs, expected 33, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.tow == 407084600, - "incorrect value for header.t.tow, expected 407084600, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 1838, - "incorrect value for header.t.wn, expected 1838, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].L.f == 147, - "incorrect value for obs[0].L.f, expected 147, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == 8294, - "incorrect value for obs[0].L.i, expected 8294, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 1973695572, - "incorrect value for obs[0].P, expected 1973695572, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].cn0 == 62, - "incorrect value for obs[0].cn0, expected 62, is %d", - check_msg->obs[0].cn0); - ck_assert_msg(check_msg->obs[0].lock == 64062, - "incorrect value for obs[0].lock, expected 64062, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].prn == 31, - "incorrect value for obs[0].prn, expected 31, is %d", - check_msg->obs[0].prn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x45, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x45, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 69, 0, 195, 4, 98, 0, 159, 67, 24, 46, 7, 32, 32, - 209, 249, 121, 145, 114, 255, 255, 141, 45, 67, 218, 0, 177, 128, - 70, 124, 79, 27, 3, 0, 159, 44, 184, 157, 2, 59, 135, 197, - 125, 175, 69, 253, 255, 77, 40, 68, 55, 3, 211, 172, 162, 131, - 177, 229, 253, 255, 20, 31, 33, 16, 10, 128, 178, 248, 136, 116, - 111, 253, 255, 94, 21, 42, 71, 13, 182, 173, 17, 135, 37, 54, - 3, 0, 214, 27, 108, 249, 22, 91, 20, 114, 118, 240, 47, 255, - 255, 129, 52, 226, 58, 30, 200, 119, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_dep_a_t* test_msg = (msg_obs_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.tow = 407084800; - test_msg->header.t.wn = 1838; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].L.f = 141; - test_msg->obs[0].L.i = -36207; - test_msg->obs[0].P = 2046415136; - test_msg->obs[0].cn0 = 45; - test_msg->obs[0].lock = 55875; - test_msg->obs[0].prn = 0; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[1].L.f = 159; - test_msg->obs[1].L.i = 203599; - test_msg->obs[1].P = 2084995249; - test_msg->obs[1].cn0 = 44; - test_msg->obs[1].lock = 40376; - test_msg->obs[1].prn = 2; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[2].L.f = 77; - test_msg->obs[2].L.i = -178769; - test_msg->obs[2].P = 2110097211; - test_msg->obs[2].cn0 = 40; - test_msg->obs[2].lock = 14148; - test_msg->obs[2].prn = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[3].L.f = 20; - test_msg->obs[3].L.i = -137807; - test_msg->obs[3].P = 2208476371; - test_msg->obs[3].cn0 = 31; - test_msg->obs[3].lock = 4129; - test_msg->obs[3].prn = 10; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[4].L.f = 94; - test_msg->obs[4].L.i = -168076; - test_msg->obs[4].P = 2298000000; - test_msg->obs[4].cn0 = 21; - test_msg->obs[4].lock = 18218; - test_msg->obs[4].prn = 13; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[5].L.f = 214; - test_msg->obs[5].L.i = 210469; - test_msg->obs[5].P = 2266082742; - test_msg->obs[5].cn0 = 27; - test_msg->obs[5].lock = 63852; - test_msg->obs[5].prn = 22; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[6].L.f = 129; - test_msg->obs[6].L.i = -53264; - test_msg->obs[6].P = 1987187803; - test_msg->obs[6].cn0 = 52; - test_msg->obs[6].lock = 15074; - test_msg->obs[6].prn = 30; - sbp_payload_send(&sbp_state, 0x45, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x45, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_dep_a_t* check_msg = (msg_obs_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 32, - "incorrect value for header.n_obs, expected 32, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.tow == 407084800, - "incorrect value for header.t.tow, expected 407084800, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 1838, - "incorrect value for header.t.wn, expected 1838, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].L.f == 141, - "incorrect value for obs[0].L.f, expected 141, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == -36207, - "incorrect value for obs[0].L.i, expected -36207, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 2046415136, - "incorrect value for obs[0].P, expected 2046415136, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].cn0 == 45, - "incorrect value for obs[0].cn0, expected 45, is %d", - check_msg->obs[0].cn0); - ck_assert_msg(check_msg->obs[0].lock == 55875, - "incorrect value for obs[0].lock, expected 55875, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].prn == 0, - "incorrect value for obs[0].prn, expected 0, is %d", - check_msg->obs[0].prn); - ck_assert_msg(check_msg->obs[1].L.f == 159, - "incorrect value for obs[1].L.f, expected 159, is %d", - check_msg->obs[1].L.f); - ck_assert_msg(check_msg->obs[1].L.i == 203599, - "incorrect value for obs[1].L.i, expected 203599, is %d", - check_msg->obs[1].L.i); - ck_assert_msg(check_msg->obs[1].P == 2084995249, - "incorrect value for obs[1].P, expected 2084995249, is %d", - check_msg->obs[1].P); - ck_assert_msg(check_msg->obs[1].cn0 == 44, - "incorrect value for obs[1].cn0, expected 44, is %d", - check_msg->obs[1].cn0); - ck_assert_msg(check_msg->obs[1].lock == 40376, - "incorrect value for obs[1].lock, expected 40376, is %d", - check_msg->obs[1].lock); - ck_assert_msg(check_msg->obs[1].prn == 2, - "incorrect value for obs[1].prn, expected 2, is %d", - check_msg->obs[1].prn); - ck_assert_msg(check_msg->obs[2].L.f == 77, - "incorrect value for obs[2].L.f, expected 77, is %d", - check_msg->obs[2].L.f); - ck_assert_msg(check_msg->obs[2].L.i == -178769, - "incorrect value for obs[2].L.i, expected -178769, is %d", - check_msg->obs[2].L.i); - ck_assert_msg(check_msg->obs[2].P == 2110097211, - "incorrect value for obs[2].P, expected 2110097211, is %d", - check_msg->obs[2].P); - ck_assert_msg(check_msg->obs[2].cn0 == 40, - "incorrect value for obs[2].cn0, expected 40, is %d", - check_msg->obs[2].cn0); - ck_assert_msg(check_msg->obs[2].lock == 14148, - "incorrect value for obs[2].lock, expected 14148, is %d", - check_msg->obs[2].lock); - ck_assert_msg(check_msg->obs[2].prn == 3, - "incorrect value for obs[2].prn, expected 3, is %d", - check_msg->obs[2].prn); - ck_assert_msg(check_msg->obs[3].L.f == 20, - "incorrect value for obs[3].L.f, expected 20, is %d", - check_msg->obs[3].L.f); - ck_assert_msg(check_msg->obs[3].L.i == -137807, - "incorrect value for obs[3].L.i, expected -137807, is %d", - check_msg->obs[3].L.i); - ck_assert_msg(check_msg->obs[3].P == 2208476371, - "incorrect value for obs[3].P, expected 2208476371, is %d", - check_msg->obs[3].P); - ck_assert_msg(check_msg->obs[3].cn0 == 31, - "incorrect value for obs[3].cn0, expected 31, is %d", - check_msg->obs[3].cn0); - ck_assert_msg(check_msg->obs[3].lock == 4129, - "incorrect value for obs[3].lock, expected 4129, is %d", - check_msg->obs[3].lock); - ck_assert_msg(check_msg->obs[3].prn == 10, - "incorrect value for obs[3].prn, expected 10, is %d", - check_msg->obs[3].prn); - ck_assert_msg(check_msg->obs[4].L.f == 94, - "incorrect value for obs[4].L.f, expected 94, is %d", - check_msg->obs[4].L.f); - ck_assert_msg(check_msg->obs[4].L.i == -168076, - "incorrect value for obs[4].L.i, expected -168076, is %d", - check_msg->obs[4].L.i); - ck_assert_msg(check_msg->obs[4].P == 2298000000, - "incorrect value for obs[4].P, expected 2298000000, is %d", - check_msg->obs[4].P); - ck_assert_msg(check_msg->obs[4].cn0 == 21, - "incorrect value for obs[4].cn0, expected 21, is %d", - check_msg->obs[4].cn0); - ck_assert_msg(check_msg->obs[4].lock == 18218, - "incorrect value for obs[4].lock, expected 18218, is %d", - check_msg->obs[4].lock); - ck_assert_msg(check_msg->obs[4].prn == 13, - "incorrect value for obs[4].prn, expected 13, is %d", - check_msg->obs[4].prn); - ck_assert_msg(check_msg->obs[5].L.f == 214, - "incorrect value for obs[5].L.f, expected 214, is %d", - check_msg->obs[5].L.f); - ck_assert_msg(check_msg->obs[5].L.i == 210469, - "incorrect value for obs[5].L.i, expected 210469, is %d", - check_msg->obs[5].L.i); - ck_assert_msg(check_msg->obs[5].P == 2266082742, - "incorrect value for obs[5].P, expected 2266082742, is %d", - check_msg->obs[5].P); - ck_assert_msg(check_msg->obs[5].cn0 == 27, - "incorrect value for obs[5].cn0, expected 27, is %d", - check_msg->obs[5].cn0); - ck_assert_msg(check_msg->obs[5].lock == 63852, - "incorrect value for obs[5].lock, expected 63852, is %d", - check_msg->obs[5].lock); - ck_assert_msg(check_msg->obs[5].prn == 22, - "incorrect value for obs[5].prn, expected 22, is %d", - check_msg->obs[5].prn); - ck_assert_msg(check_msg->obs[6].L.f == 129, - "incorrect value for obs[6].L.f, expected 129, is %d", - check_msg->obs[6].L.f); - ck_assert_msg(check_msg->obs[6].L.i == -53264, - "incorrect value for obs[6].L.i, expected -53264, is %d", - check_msg->obs[6].L.i); - ck_assert_msg(check_msg->obs[6].P == 1987187803, - "incorrect value for obs[6].P, expected 1987187803, is %d", - check_msg->obs[6].P); - ck_assert_msg(check_msg->obs[6].cn0 == 52, - "incorrect value for obs[6].cn0, expected 52, is %d", - check_msg->obs[6].cn0); - ck_assert_msg(check_msg->obs[6].lock == 15074, - "incorrect value for obs[6].lock, expected 15074, is %d", - check_msg->obs[6].lock); - ck_assert_msg(check_msg->obs[6].prn == 30, - "incorrect value for obs[6].prn, expected 30, is %d", - check_msg->obs[6].prn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x45, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x45, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 69, 0, 195, 4, 20, 0, 159, 67, 24, 46, 7, 33, 49, - 19, 164, 117, 120, 32, 0, 0, 222, 63, 62, 250, 31, 11, 231, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_dep_a_t* test_msg = (msg_obs_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 33; - test_msg->header.t.tow = 407084800; - test_msg->header.t.wn = 1838; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].L.f = 222; - test_msg->obs[0].L.i = 8312; - test_msg->obs[0].P = 1973687089; - test_msg->obs[0].cn0 = 63; - test_msg->obs[0].lock = 64062; - test_msg->obs[0].prn = 31; - sbp_payload_send(&sbp_state, 0x45, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x45, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_dep_a_t* check_msg = (msg_obs_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 33, - "incorrect value for header.n_obs, expected 33, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.tow == 407084800, - "incorrect value for header.t.tow, expected 407084800, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 1838, - "incorrect value for header.t.wn, expected 1838, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].L.f == 222, - "incorrect value for obs[0].L.f, expected 222, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == 8312, - "incorrect value for obs[0].L.i, expected 8312, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 1973687089, - "incorrect value for obs[0].P, expected 1973687089, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].cn0 == 63, - "incorrect value for obs[0].cn0, expected 63, is %d", - check_msg->obs[0].cn0); - ck_assert_msg(check_msg->obs[0].lock == 64062, - "incorrect value for obs[0].lock, expected 64062, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].prn == 31, - "incorrect value for obs[0].prn, expected 31, is %d", - check_msg->obs[0].prn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x45, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x45, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 69, 0, 195, 4, 72, 96, 162, 68, 24, 46, 7, 16, 87, - 132, 217, 121, 121, 148, 255, 255, 189, 43, 175, 147, 0, 132, 64, - 200, 125, 106, 31, 254, 255, 1, 41, 14, 177, 3, 128, 178, 248, - 136, 70, 68, 254, 255, 166, 18, 184, 133, 13, 24, 127, 178, 134, - 6, 25, 2, 0, 249, 28, 33, 96, 22, 170, 104, 86, 118, 67, - 112, 255, 255, 203, 56, 208, 88, 30, 43, 107, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_dep_a_t* test_msg = (msg_obs_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 16; - test_msg->header.t.tow = 407151200; - test_msg->header.t.wn = 1838; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].L.f = 189; - test_msg->obs[0].L.i = -27527; - test_msg->obs[0].P = 2044298327; - test_msg->obs[0].cn0 = 43; - test_msg->obs[0].lock = 37807; - test_msg->obs[0].prn = 0; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[1].L.f = 1; - test_msg->obs[1].L.i = -123030; - test_msg->obs[1].P = 2110275716; - test_msg->obs[1].cn0 = 41; - test_msg->obs[1].lock = 45326; - test_msg->obs[1].prn = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[2].L.f = 166; - test_msg->obs[2].L.i = -113594; - test_msg->obs[2].P = 2298000000; - test_msg->obs[2].cn0 = 18; - test_msg->obs[2].lock = 34232; - test_msg->obs[2].prn = 13; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[3].L.f = 249; - test_msg->obs[3].L.i = 137478; - test_msg->obs[3].P = 2259844888; - test_msg->obs[3].cn0 = 28; - test_msg->obs[3].lock = 24609; - test_msg->obs[3].prn = 22; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[4].L.f = 203; - test_msg->obs[4].L.i = -36797; - test_msg->obs[4].P = 1985374378; - test_msg->obs[4].cn0 = 56; - test_msg->obs[4].lock = 22736; - test_msg->obs[4].prn = 30; - sbp_payload_send(&sbp_state, 0x45, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x45, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_dep_a_t* check_msg = (msg_obs_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 16, - "incorrect value for header.n_obs, expected 16, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.tow == 407151200, - "incorrect value for header.t.tow, expected 407151200, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 1838, - "incorrect value for header.t.wn, expected 1838, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].L.f == 189, - "incorrect value for obs[0].L.f, expected 189, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == -27527, - "incorrect value for obs[0].L.i, expected -27527, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 2044298327, - "incorrect value for obs[0].P, expected 2044298327, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].cn0 == 43, - "incorrect value for obs[0].cn0, expected 43, is %d", - check_msg->obs[0].cn0); - ck_assert_msg(check_msg->obs[0].lock == 37807, - "incorrect value for obs[0].lock, expected 37807, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].prn == 0, - "incorrect value for obs[0].prn, expected 0, is %d", - check_msg->obs[0].prn); - ck_assert_msg(check_msg->obs[1].L.f == 1, - "incorrect value for obs[1].L.f, expected 1, is %d", - check_msg->obs[1].L.f); - ck_assert_msg(check_msg->obs[1].L.i == -123030, - "incorrect value for obs[1].L.i, expected -123030, is %d", - check_msg->obs[1].L.i); - ck_assert_msg(check_msg->obs[1].P == 2110275716, - "incorrect value for obs[1].P, expected 2110275716, is %d", - check_msg->obs[1].P); - ck_assert_msg(check_msg->obs[1].cn0 == 41, - "incorrect value for obs[1].cn0, expected 41, is %d", - check_msg->obs[1].cn0); - ck_assert_msg(check_msg->obs[1].lock == 45326, - "incorrect value for obs[1].lock, expected 45326, is %d", - check_msg->obs[1].lock); - ck_assert_msg(check_msg->obs[1].prn == 3, - "incorrect value for obs[1].prn, expected 3, is %d", - check_msg->obs[1].prn); - ck_assert_msg(check_msg->obs[2].L.f == 166, - "incorrect value for obs[2].L.f, expected 166, is %d", - check_msg->obs[2].L.f); - ck_assert_msg(check_msg->obs[2].L.i == -113594, - "incorrect value for obs[2].L.i, expected -113594, is %d", - check_msg->obs[2].L.i); - ck_assert_msg(check_msg->obs[2].P == 2298000000, - "incorrect value for obs[2].P, expected 2298000000, is %d", - check_msg->obs[2].P); - ck_assert_msg(check_msg->obs[2].cn0 == 18, - "incorrect value for obs[2].cn0, expected 18, is %d", - check_msg->obs[2].cn0); - ck_assert_msg(check_msg->obs[2].lock == 34232, - "incorrect value for obs[2].lock, expected 34232, is %d", - check_msg->obs[2].lock); - ck_assert_msg(check_msg->obs[2].prn == 13, - "incorrect value for obs[2].prn, expected 13, is %d", - check_msg->obs[2].prn); - ck_assert_msg(check_msg->obs[3].L.f == 249, - "incorrect value for obs[3].L.f, expected 249, is %d", - check_msg->obs[3].L.f); - ck_assert_msg(check_msg->obs[3].L.i == 137478, - "incorrect value for obs[3].L.i, expected 137478, is %d", - check_msg->obs[3].L.i); - ck_assert_msg(check_msg->obs[3].P == 2259844888, - "incorrect value for obs[3].P, expected 2259844888, is %d", - check_msg->obs[3].P); - ck_assert_msg(check_msg->obs[3].cn0 == 28, - "incorrect value for obs[3].cn0, expected 28, is %d", - check_msg->obs[3].cn0); - ck_assert_msg(check_msg->obs[3].lock == 24609, - "incorrect value for obs[3].lock, expected 24609, is %d", - check_msg->obs[3].lock); - ck_assert_msg(check_msg->obs[3].prn == 22, - "incorrect value for obs[3].prn, expected 22, is %d", - check_msg->obs[3].prn); - ck_assert_msg(check_msg->obs[4].L.f == 203, - "incorrect value for obs[4].L.f, expected 203, is %d", - check_msg->obs[4].L.f); - ck_assert_msg(check_msg->obs[4].L.i == -36797, - "incorrect value for obs[4].L.i, expected -36797, is %d", - check_msg->obs[4].L.i); - ck_assert_msg(check_msg->obs[4].P == 1985374378, - "incorrect value for obs[4].P, expected 1985374378, is %d", - check_msg->obs[4].P); - ck_assert_msg(check_msg->obs[4].cn0 == 56, - "incorrect value for obs[4].cn0, expected 56, is %d", - check_msg->obs[4].cn0); - ck_assert_msg(check_msg->obs[4].lock == 22736, - "incorrect value for obs[4].lock, expected 22736, is %d", - check_msg->obs[4].lock); - ck_assert_msg(check_msg->obs[4].prn == 30, - "incorrect value for obs[4].prn, expected 30, is %d", - check_msg->obs[4].prn); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x45, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x45, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 69, 0, 195, 4, 72, 40, 163, 68, 24, 46, 7, 16, 132, - 107, 217, 121, 14, 148, 255, 255, 1, 44, 175, 147, 0, 129, 66, - 200, 125, 148, 29, 254, 255, 153, 41, 14, 177, 3, 128, 178, 248, - 136, 143, 66, 254, 255, 222, 18, 184, 133, 13, 158, 53, 178, 134, - 42, 27, 2, 0, 237, 30, 33, 96, 22, 38, 83, 86, 118, 168, - 111, 255, 255, 45, 56, 208, 88, 30, 1, 175, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_obs_dep_a_t* test_msg = (msg_obs_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.n_obs = 16; - test_msg->header.t.tow = 407151400; - test_msg->header.t.wn = 1838; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[0].L.f = 1; - test_msg->obs[0].L.i = -27634; - test_msg->obs[0].P = 2044291972; - test_msg->obs[0].cn0 = 44; - test_msg->obs[0].lock = 37807; - test_msg->obs[0].prn = 0; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[1].L.f = 153; - test_msg->obs[1].L.i = -123500; - test_msg->obs[1].P = 2110276225; - test_msg->obs[1].cn0 = 41; - test_msg->obs[1].lock = 45326; - test_msg->obs[1].prn = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[2].L.f = 222; - test_msg->obs[2].L.i = -114033; - test_msg->obs[2].P = 2298000000; - test_msg->obs[2].cn0 = 18; - test_msg->obs[2].lock = 34232; - test_msg->obs[2].prn = 13; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[3].L.f = 237; - test_msg->obs[3].L.i = 138026; - test_msg->obs[3].P = 2259826078; - test_msg->obs[3].cn0 = 30; - test_msg->obs[3].lock = 24609; - test_msg->obs[3].prn = 22; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->obs[0]); - } - test_msg->obs[4].L.f = 45; - test_msg->obs[4].L.i = -36952; - test_msg->obs[4].P = 1985368870; - test_msg->obs[4].cn0 = 56; - test_msg->obs[4].lock = 22736; - test_msg->obs[4].prn = 30; - sbp_payload_send(&sbp_state, 0x45, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x45, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_obs_dep_a_t* check_msg = (msg_obs_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.n_obs == 16, - "incorrect value for header.n_obs, expected 16, is %d", - check_msg->header.n_obs); - ck_assert_msg(check_msg->header.t.tow == 407151400, - "incorrect value for header.t.tow, expected 407151400, is %d", - check_msg->header.t.tow); - ck_assert_msg(check_msg->header.t.wn == 1838, - "incorrect value for header.t.wn, expected 1838, is %d", - check_msg->header.t.wn); - ck_assert_msg(check_msg->obs[0].L.f == 1, - "incorrect value for obs[0].L.f, expected 1, is %d", - check_msg->obs[0].L.f); - ck_assert_msg(check_msg->obs[0].L.i == -27634, - "incorrect value for obs[0].L.i, expected -27634, is %d", - check_msg->obs[0].L.i); - ck_assert_msg(check_msg->obs[0].P == 2044291972, - "incorrect value for obs[0].P, expected 2044291972, is %d", - check_msg->obs[0].P); - ck_assert_msg(check_msg->obs[0].cn0 == 44, - "incorrect value for obs[0].cn0, expected 44, is %d", - check_msg->obs[0].cn0); - ck_assert_msg(check_msg->obs[0].lock == 37807, - "incorrect value for obs[0].lock, expected 37807, is %d", - check_msg->obs[0].lock); - ck_assert_msg(check_msg->obs[0].prn == 0, - "incorrect value for obs[0].prn, expected 0, is %d", - check_msg->obs[0].prn); - ck_assert_msg(check_msg->obs[1].L.f == 153, - "incorrect value for obs[1].L.f, expected 153, is %d", - check_msg->obs[1].L.f); - ck_assert_msg(check_msg->obs[1].L.i == -123500, - "incorrect value for obs[1].L.i, expected -123500, is %d", - check_msg->obs[1].L.i); - ck_assert_msg(check_msg->obs[1].P == 2110276225, - "incorrect value for obs[1].P, expected 2110276225, is %d", - check_msg->obs[1].P); - ck_assert_msg(check_msg->obs[1].cn0 == 41, - "incorrect value for obs[1].cn0, expected 41, is %d", - check_msg->obs[1].cn0); - ck_assert_msg(check_msg->obs[1].lock == 45326, - "incorrect value for obs[1].lock, expected 45326, is %d", - check_msg->obs[1].lock); - ck_assert_msg(check_msg->obs[1].prn == 3, - "incorrect value for obs[1].prn, expected 3, is %d", - check_msg->obs[1].prn); - ck_assert_msg(check_msg->obs[2].L.f == 222, - "incorrect value for obs[2].L.f, expected 222, is %d", - check_msg->obs[2].L.f); - ck_assert_msg(check_msg->obs[2].L.i == -114033, - "incorrect value for obs[2].L.i, expected -114033, is %d", - check_msg->obs[2].L.i); - ck_assert_msg(check_msg->obs[2].P == 2298000000, - "incorrect value for obs[2].P, expected 2298000000, is %d", - check_msg->obs[2].P); - ck_assert_msg(check_msg->obs[2].cn0 == 18, - "incorrect value for obs[2].cn0, expected 18, is %d", - check_msg->obs[2].cn0); - ck_assert_msg(check_msg->obs[2].lock == 34232, - "incorrect value for obs[2].lock, expected 34232, is %d", - check_msg->obs[2].lock); - ck_assert_msg(check_msg->obs[2].prn == 13, - "incorrect value for obs[2].prn, expected 13, is %d", - check_msg->obs[2].prn); - ck_assert_msg(check_msg->obs[3].L.f == 237, - "incorrect value for obs[3].L.f, expected 237, is %d", - check_msg->obs[3].L.f); - ck_assert_msg(check_msg->obs[3].L.i == 138026, - "incorrect value for obs[3].L.i, expected 138026, is %d", - check_msg->obs[3].L.i); - ck_assert_msg(check_msg->obs[3].P == 2259826078, - "incorrect value for obs[3].P, expected 2259826078, is %d", - check_msg->obs[3].P); - ck_assert_msg(check_msg->obs[3].cn0 == 30, - "incorrect value for obs[3].cn0, expected 30, is %d", - check_msg->obs[3].cn0); - ck_assert_msg(check_msg->obs[3].lock == 24609, - "incorrect value for obs[3].lock, expected 24609, is %d", - check_msg->obs[3].lock); - ck_assert_msg(check_msg->obs[3].prn == 22, - "incorrect value for obs[3].prn, expected 22, is %d", - check_msg->obs[3].prn); - ck_assert_msg(check_msg->obs[4].L.f == 45, - "incorrect value for obs[4].L.f, expected 45, is %d", - check_msg->obs[4].L.f); - ck_assert_msg(check_msg->obs[4].L.i == -36952, - "incorrect value for obs[4].L.i, expected -36952, is %d", - check_msg->obs[4].L.i); - ck_assert_msg(check_msg->obs[4].P == 1985368870, - "incorrect value for obs[4].P, expected 1985368870, is %d", - check_msg->obs[4].P); - ck_assert_msg(check_msg->obs[4].cn0 == 56, - "incorrect value for obs[4].cn0, expected 56, is %d", - check_msg->obs[4].cn0); - ck_assert_msg(check_msg->obs[4].lock == 22736, - "incorrect value for obs[4].lock, expected 22736, is %d", - check_msg->obs[4].lock); - ck_assert_msg(check_msg->obs[4].prn == 30, - "incorrect value for obs[4].prn, expected 30, is %d", - check_msg->obs[4].prn); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_observation_msgObsDepA_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_observation_msgObsDepA"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_observation_msgObsDepA"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_observation_msgObsDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_orientation_MsgAngularRate.c b/c/test/legacy/auto_check_sbp_orientation_MsgAngularRate.c deleted file mode 100644 index 1ba0783f07..0000000000 --- a/c/test/legacy/auto_check_sbp_orientation_MsgAngularRate.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/orientation/test_MsgAngularRate.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_orientation_MsgAngularRate) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x222, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x222, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 34, 2, 66, 0, 17, 2, 0, 0, 0, 2, 0, 0, - 0, 5, 0, 0, 0, 2, 0, 0, 0, 0, 88, 70, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_angular_rate_t *test_msg = (msg_angular_rate_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->tow = 2; - test_msg->x = 2; - test_msg->y = 5; - test_msg->z = 2; - sbp_payload_send(&sbp_state, 0x222, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x222, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_angular_rate_t *check_msg = - (msg_angular_rate_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->tow == 2, - "incorrect value for tow, expected 2, is %d", check_msg->tow); - ck_assert_msg(check_msg->x == 2, "incorrect value for x, expected 2, is %d", - check_msg->x); - ck_assert_msg(check_msg->y == 5, "incorrect value for y, expected 5, is %d", - check_msg->y); - ck_assert_msg(check_msg->z == 2, "incorrect value for z, expected 2, is %d", - check_msg->z); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_orientation_MsgAngularRate_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_orientation_MsgAngularRate"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_orientation_MsgAngularRate"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_orientation_MsgAngularRate); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_orientation_MsgBaselineHeading.c b/c/test/legacy/auto_check_sbp_orientation_MsgBaselineHeading.c deleted file mode 100644 index d15f66011a..0000000000 --- a/c/test/legacy/auto_check_sbp_orientation_MsgBaselineHeading.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/orientation/test_MsgBaselineHeading.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_orientation_MsgBaselineHeading) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x20f, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x20f, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 15, 2, 211, 93, 10, 156, 45, 13, - 196, 44, 84, 197, 61, 91, 91, 224, 254, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_baseline_heading_t *test_msg = - (msg_baseline_heading_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 91; - test_msg->heading = 1036342316; - test_msg->n_sats = 91; - test_msg->tow = 3289197980; - sbp_payload_send(&sbp_state, 0x20f, 24019, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 24019, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 24019, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x20f, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_baseline_heading_t *check_msg = - (msg_baseline_heading_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 91, - "incorrect value for flags, expected 91, is %d", - check_msg->flags); - ck_assert_msg(check_msg->heading == 1036342316, - "incorrect value for heading, expected 1036342316, is %d", - check_msg->heading); - ck_assert_msg(check_msg->n_sats == 91, - "incorrect value for n_sats, expected 91, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->tow == 3289197980, - "incorrect value for tow, expected 3289197980, is %d", - check_msg->tow); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_orientation_MsgBaselineHeading_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_orientation_MsgBaselineHeading"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_orientation_MsgBaselineHeading"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_orientation_MsgBaselineHeading); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_orientation_MsgOrientEuler.c b/c/test/legacy/auto_check_sbp_orientation_MsgOrientEuler.c deleted file mode 100644 index 2206410ef8..0000000000 --- a/c/test/legacy/auto_check_sbp_orientation_MsgOrientEuler.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/orientation/test_MsgOrientEuler.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_orientation_MsgOrientEuler) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x221, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x221, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 33, 2, 66, 0, 29, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 8, - 0, 0, 0, 0, 0, 224, 64, 0, 0, 64, 64, 0, 0, 224, 64, 3, 44, 226, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_orient_euler_t *test_msg = (msg_orient_euler_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 3; - test_msg->pitch = 2; - test_msg->pitch_accuracy = 3.0; - test_msg->roll = 1; - test_msg->roll_accuracy = 7.0; - test_msg->tow = 1; - test_msg->yaw = 8; - test_msg->yaw_accuracy = 7.0; - sbp_payload_send(&sbp_state, 0x221, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x221, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_orient_euler_t *check_msg = - (msg_orient_euler_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 3, - "incorrect value for flags, expected 3, is %d", - check_msg->flags); - ck_assert_msg(check_msg->pitch == 2, - "incorrect value for pitch, expected 2, is %d", - check_msg->pitch); - ck_assert_msg((check_msg->pitch_accuracy * 100 - 3.0 * 100) < 0.05, - "incorrect value for pitch_accuracy, expected 3.0, is %f", - check_msg->pitch_accuracy); - ck_assert_msg(check_msg->roll == 1, - "incorrect value for roll, expected 1, is %d", - check_msg->roll); - ck_assert_msg((check_msg->roll_accuracy * 100 - 7.0 * 100) < 0.05, - "incorrect value for roll_accuracy, expected 7.0, is %f", - check_msg->roll_accuracy); - ck_assert_msg(check_msg->tow == 1, - "incorrect value for tow, expected 1, is %d", check_msg->tow); - ck_assert_msg(check_msg->yaw == 8, - "incorrect value for yaw, expected 8, is %d", check_msg->yaw); - ck_assert_msg((check_msg->yaw_accuracy * 100 - 7.0 * 100) < 0.05, - "incorrect value for yaw_accuracy, expected 7.0, is %f", - check_msg->yaw_accuracy); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_orientation_MsgOrientEuler_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_orientation_MsgOrientEuler"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_orientation_MsgOrientEuler"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_orientation_MsgOrientEuler); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_orientation_MsgOrientQuat.c b/c/test/legacy/auto_check_sbp_orientation_MsgOrientQuat.c deleted file mode 100644 index 13fd2be4ca..0000000000 --- a/c/test/legacy/auto_check_sbp_orientation_MsgOrientQuat.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/orientation/test_MsgOrientQuat.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_orientation_MsgOrientQuat) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x220, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x220, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 32, 2, 66, 0, 37, 0, 0, 0, 0, 3, 0, 0, 0, 7, - 0, 0, 0, 8, 0, 0, 0, 4, 0, 0, 0, 0, 0, 64, 64, - 0, 0, 128, 64, 0, 0, 0, 65, 0, 0, 64, 64, 1, 186, 6, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_orient_quat_t *test_msg = (msg_orient_quat_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 1; - test_msg->tow = 0; - test_msg->w = 3; - test_msg->w_accuracy = 3.0; - test_msg->x = 7; - test_msg->x_accuracy = 4.0; - test_msg->y = 8; - test_msg->y_accuracy = 8.0; - test_msg->z = 4; - test_msg->z_accuracy = 3.0; - sbp_payload_send(&sbp_state, 0x220, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x220, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_orient_quat_t *check_msg = (msg_orient_quat_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->tow == 0, - "incorrect value for tow, expected 0, is %d", check_msg->tow); - ck_assert_msg(check_msg->w == 3, "incorrect value for w, expected 3, is %d", - check_msg->w); - ck_assert_msg((check_msg->w_accuracy * 100 - 3.0 * 100) < 0.05, - "incorrect value for w_accuracy, expected 3.0, is %f", - check_msg->w_accuracy); - ck_assert_msg(check_msg->x == 7, "incorrect value for x, expected 7, is %d", - check_msg->x); - ck_assert_msg((check_msg->x_accuracy * 100 - 4.0 * 100) < 0.05, - "incorrect value for x_accuracy, expected 4.0, is %f", - check_msg->x_accuracy); - ck_assert_msg(check_msg->y == 8, "incorrect value for y, expected 8, is %d", - check_msg->y); - ck_assert_msg((check_msg->y_accuracy * 100 - 8.0 * 100) < 0.05, - "incorrect value for y_accuracy, expected 8.0, is %f", - check_msg->y_accuracy); - ck_assert_msg(check_msg->z == 4, "incorrect value for z, expected 4, is %d", - check_msg->z); - ck_assert_msg((check_msg->z_accuracy * 100 - 3.0 * 100) < 0.05, - "incorrect value for z_accuracy, expected 3.0, is %f", - check_msg->z_accuracy); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_orientation_MsgOrientQuat_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_orientation_MsgOrientQuat"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_orientation_MsgOrientQuat"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_orientation_MsgOrientQuat); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgAlmanac.c b/c/test/legacy/auto_check_sbp_piksi_MsgAlmanac.c deleted file mode 100644 index 9777ea5873..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgAlmanac.c +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgAlmanac.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgAlmanac) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x69, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x69, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 105, 0, 108, 138, 0, 249, 171, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - sbp_payload_send(&sbp_state, 0x69, 35436, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35436, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35436, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x69, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgAlmanac_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgAlmanac"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_piksi_MsgAlmanac"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgAlmanac); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgCellModemStatus.c b/c/test/legacy/auto_check_sbp_piksi_MsgCellModemStatus.c deleted file mode 100644 index e8178d71ce..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgCellModemStatus.c +++ /dev/null @@ -1,2241 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgCellModemStatus.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgCellModemStatus) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xbe, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xbe, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 190, 0, 19, 27, 255, 103, 205, 48, 6, 70, 123, 242, 46, - 52, 64, 176, 154, 98, 43, 132, 196, 89, 253, 161, 250, 174, 204, - 110, 47, 38, 187, 63, 102, 177, 162, 49, 80, 194, 37, 107, 60, - 225, 52, 101, 178, 142, 246, 21, 17, 93, 75, 169, 86, 16, 209, - 80, 243, 30, 206, 220, 206, 115, 47, 154, 91, 227, 88, 11, 1, - 85, 146, 100, 190, 232, 207, 61, 61, 201, 220, 31, 78, 34, 57, - 82, 59, 104, 65, 221, 0, 43, 210, 9, 32, 122, 29, 237, 11, - 151, 223, 18, 81, 204, 172, 234, 127, 3, 82, 133, 169, 12, 176, - 193, 0, 24, 121, 85, 55, 214, 198, 75, 234, 179, 214, 85, 94, - 115, 21, 73, 121, 75, 46, 158, 63, 100, 122, 213, 20, 85, 212, - 131, 50, 224, 218, 215, 215, 149, 2, 19, 129, 39, 164, 5, 175, - 6, 62, 51, 78, 66, 248, 116, 88, 90, 128, 226, 177, 0, 47, - 140, 33, 126, 221, 110, 144, 97, 74, 250, 181, 199, 27, 176, 65, - 185, 110, 92, 34, 44, 131, 96, 178, 40, 176, 4, 90, 36, 7, - 180, 244, 244, 23, 108, 171, 204, 196, 61, 51, 179, 242, 156, 81, - 83, 16, 15, 134, 40, 245, 253, 150, 94, 150, 144, 197, 113, 5, - 141, 232, 33, 101, 231, 38, 75, 178, 243, 119, 1, 248, 218, 86, - 7, 88, 197, 148, 240, 227, 2, 65, 173, 122, 143, 251, 156, 217, - 67, 239, 219, 31, 224, 176, 129, 81, 80, 40, 230, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_cell_modem_status_t *test_msg = - (msg_cell_modem_status_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[0] = 123; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[1] = 242; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[2] = 46; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[3] = 52; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[4] = 64; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[5] = 176; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[6] = 154; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[7] = 98; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[8] = 43; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[9] = 132; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[10] = 196; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[11] = 89; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[12] = 253; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[13] = 161; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[14] = 250; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[15] = 174; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[16] = 204; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[17] = 110; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[18] = 47; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[19] = 38; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[20] = 187; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[21] = 63; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[22] = 102; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[23] = 177; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[24] = 162; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[25] = 49; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[26] = 80; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[27] = 194; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[28] = 37; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[29] = 107; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[30] = 60; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[31] = 225; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[32] = 52; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[33] = 101; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[34] = 178; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[35] = 142; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[36] = 246; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[37] = 21; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[38] = 17; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[39] = 93; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[40] = 75; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[41] = 169; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[42] = 86; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[43] = 16; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[44] = 209; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[45] = 80; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[46] = 243; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[47] = 30; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[48] = 206; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[49] = 220; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[50] = 206; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[51] = 115; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[52] = 47; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[53] = 154; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[54] = 91; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[55] = 227; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[56] = 88; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[57] = 11; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[58] = 1; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[59] = 85; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[60] = 146; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[61] = 100; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[62] = 190; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[63] = 232; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[64] = 207; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[65] = 61; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[66] = 61; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[67] = 201; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[68] = 220; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[69] = 31; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[70] = 78; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[71] = 34; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[72] = 57; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[73] = 82; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[74] = 59; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[75] = 104; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[76] = 65; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[77] = 221; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[78] = 0; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[79] = 43; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[80] = 210; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[81] = 9; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[82] = 32; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[83] = 122; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[84] = 29; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[85] = 237; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[86] = 11; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[87] = 151; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[88] = 223; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[89] = 18; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[90] = 81; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[91] = 204; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[92] = 172; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[93] = 234; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[94] = 127; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[95] = 3; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[96] = 82; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[97] = 133; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[98] = 169; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[99] = 12; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[100] = 176; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[101] = 193; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[102] = 0; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[103] = 24; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[104] = 121; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[105] = 85; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[106] = 55; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[107] = 214; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[108] = 198; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[109] = 75; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[110] = 234; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[111] = 179; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[112] = 214; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[113] = 85; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[114] = 94; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[115] = 115; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[116] = 21; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[117] = 73; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[118] = 121; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[119] = 75; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[120] = 46; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[121] = 158; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[122] = 63; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[123] = 100; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[124] = 122; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[125] = 213; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[126] = 20; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[127] = 85; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[128] = 212; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[129] = 131; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[130] = 50; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[131] = 224; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[132] = 218; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[133] = 215; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[134] = 215; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[135] = 149; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[136] = 2; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[137] = 19; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[138] = 129; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[139] = 39; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[140] = 164; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[141] = 5; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[142] = 175; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[143] = 6; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[144] = 62; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[145] = 51; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[146] = 78; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[147] = 66; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[148] = 248; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[149] = 116; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[150] = 88; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[151] = 90; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[152] = 128; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[153] = 226; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[154] = 177; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[155] = 0; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[156] = 47; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[157] = 140; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[158] = 33; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[159] = 126; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[160] = 221; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[161] = 110; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[162] = 144; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[163] = 97; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[164] = 74; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[165] = 250; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[166] = 181; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[167] = 199; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[168] = 27; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[169] = 176; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[170] = 65; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[171] = 185; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[172] = 110; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[173] = 92; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[174] = 34; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[175] = 44; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[176] = 131; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[177] = 96; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[178] = 178; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[179] = 40; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[180] = 176; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[181] = 4; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[182] = 90; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[183] = 36; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[184] = 7; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[185] = 180; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[186] = 244; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[187] = 244; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[188] = 23; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[189] = 108; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[190] = 171; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[191] = 204; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[192] = 196; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[193] = 61; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[194] = 51; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[195] = 179; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[196] = 242; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[197] = 156; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[198] = 81; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[199] = 83; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[200] = 16; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[201] = 15; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[202] = 134; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[203] = 40; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[204] = 245; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[205] = 253; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[206] = 150; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[207] = 94; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[208] = 150; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[209] = 144; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[210] = 197; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[211] = 113; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[212] = 5; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[213] = 141; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[214] = 232; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[215] = 33; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[216] = 101; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[217] = 231; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[218] = 38; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[219] = 75; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[220] = 178; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[221] = 243; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[222] = 119; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[223] = 1; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[224] = 248; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[225] = 218; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[226] = 86; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[227] = 7; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[228] = 88; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[229] = 197; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[230] = 148; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[231] = 240; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[232] = 227; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[233] = 2; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[234] = 65; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[235] = 173; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[236] = 122; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[237] = 143; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[238] = 251; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[239] = 156; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[240] = 217; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[241] = 67; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[242] = 239; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[243] = 219; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[244] = 31; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[245] = 224; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[246] = 176; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[247] = 129; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[248] = 81; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->reserved[0]); - } - test_msg->reserved[249] = 80; - test_msg->signal_error_rate = 8588.2001953125; - test_msg->signal_strength = 103; - sbp_payload_send(&sbp_state, 0xbe, 6931, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 6931, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 6931, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xbe, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_cell_modem_status_t *check_msg = - (msg_cell_modem_status_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->reserved[0] == 123, - "incorrect value for reserved[0], expected 123, is %d", - check_msg->reserved[0]); - ck_assert_msg(check_msg->reserved[1] == 242, - "incorrect value for reserved[1], expected 242, is %d", - check_msg->reserved[1]); - ck_assert_msg(check_msg->reserved[2] == 46, - "incorrect value for reserved[2], expected 46, is %d", - check_msg->reserved[2]); - ck_assert_msg(check_msg->reserved[3] == 52, - "incorrect value for reserved[3], expected 52, is %d", - check_msg->reserved[3]); - ck_assert_msg(check_msg->reserved[4] == 64, - "incorrect value for reserved[4], expected 64, is %d", - check_msg->reserved[4]); - ck_assert_msg(check_msg->reserved[5] == 176, - "incorrect value for reserved[5], expected 176, is %d", - check_msg->reserved[5]); - ck_assert_msg(check_msg->reserved[6] == 154, - "incorrect value for reserved[6], expected 154, is %d", - check_msg->reserved[6]); - ck_assert_msg(check_msg->reserved[7] == 98, - "incorrect value for reserved[7], expected 98, is %d", - check_msg->reserved[7]); - ck_assert_msg(check_msg->reserved[8] == 43, - "incorrect value for reserved[8], expected 43, is %d", - check_msg->reserved[8]); - ck_assert_msg(check_msg->reserved[9] == 132, - "incorrect value for reserved[9], expected 132, is %d", - check_msg->reserved[9]); - ck_assert_msg(check_msg->reserved[10] == 196, - "incorrect value for reserved[10], expected 196, is %d", - check_msg->reserved[10]); - ck_assert_msg(check_msg->reserved[11] == 89, - "incorrect value for reserved[11], expected 89, is %d", - check_msg->reserved[11]); - ck_assert_msg(check_msg->reserved[12] == 253, - "incorrect value for reserved[12], expected 253, is %d", - check_msg->reserved[12]); - ck_assert_msg(check_msg->reserved[13] == 161, - "incorrect value for reserved[13], expected 161, is %d", - check_msg->reserved[13]); - ck_assert_msg(check_msg->reserved[14] == 250, - "incorrect value for reserved[14], expected 250, is %d", - check_msg->reserved[14]); - ck_assert_msg(check_msg->reserved[15] == 174, - "incorrect value for reserved[15], expected 174, is %d", - check_msg->reserved[15]); - ck_assert_msg(check_msg->reserved[16] == 204, - "incorrect value for reserved[16], expected 204, is %d", - check_msg->reserved[16]); - ck_assert_msg(check_msg->reserved[17] == 110, - "incorrect value for reserved[17], expected 110, is %d", - check_msg->reserved[17]); - ck_assert_msg(check_msg->reserved[18] == 47, - "incorrect value for reserved[18], expected 47, is %d", - check_msg->reserved[18]); - ck_assert_msg(check_msg->reserved[19] == 38, - "incorrect value for reserved[19], expected 38, is %d", - check_msg->reserved[19]); - ck_assert_msg(check_msg->reserved[20] == 187, - "incorrect value for reserved[20], expected 187, is %d", - check_msg->reserved[20]); - ck_assert_msg(check_msg->reserved[21] == 63, - "incorrect value for reserved[21], expected 63, is %d", - check_msg->reserved[21]); - ck_assert_msg(check_msg->reserved[22] == 102, - "incorrect value for reserved[22], expected 102, is %d", - check_msg->reserved[22]); - ck_assert_msg(check_msg->reserved[23] == 177, - "incorrect value for reserved[23], expected 177, is %d", - check_msg->reserved[23]); - ck_assert_msg(check_msg->reserved[24] == 162, - "incorrect value for reserved[24], expected 162, is %d", - check_msg->reserved[24]); - ck_assert_msg(check_msg->reserved[25] == 49, - "incorrect value for reserved[25], expected 49, is %d", - check_msg->reserved[25]); - ck_assert_msg(check_msg->reserved[26] == 80, - "incorrect value for reserved[26], expected 80, is %d", - check_msg->reserved[26]); - ck_assert_msg(check_msg->reserved[27] == 194, - "incorrect value for reserved[27], expected 194, is %d", - check_msg->reserved[27]); - ck_assert_msg(check_msg->reserved[28] == 37, - "incorrect value for reserved[28], expected 37, is %d", - check_msg->reserved[28]); - ck_assert_msg(check_msg->reserved[29] == 107, - "incorrect value for reserved[29], expected 107, is %d", - check_msg->reserved[29]); - ck_assert_msg(check_msg->reserved[30] == 60, - "incorrect value for reserved[30], expected 60, is %d", - check_msg->reserved[30]); - ck_assert_msg(check_msg->reserved[31] == 225, - "incorrect value for reserved[31], expected 225, is %d", - check_msg->reserved[31]); - ck_assert_msg(check_msg->reserved[32] == 52, - "incorrect value for reserved[32], expected 52, is %d", - check_msg->reserved[32]); - ck_assert_msg(check_msg->reserved[33] == 101, - "incorrect value for reserved[33], expected 101, is %d", - check_msg->reserved[33]); - ck_assert_msg(check_msg->reserved[34] == 178, - "incorrect value for reserved[34], expected 178, is %d", - check_msg->reserved[34]); - ck_assert_msg(check_msg->reserved[35] == 142, - "incorrect value for reserved[35], expected 142, is %d", - check_msg->reserved[35]); - ck_assert_msg(check_msg->reserved[36] == 246, - "incorrect value for reserved[36], expected 246, is %d", - check_msg->reserved[36]); - ck_assert_msg(check_msg->reserved[37] == 21, - "incorrect value for reserved[37], expected 21, is %d", - check_msg->reserved[37]); - ck_assert_msg(check_msg->reserved[38] == 17, - "incorrect value for reserved[38], expected 17, is %d", - check_msg->reserved[38]); - ck_assert_msg(check_msg->reserved[39] == 93, - "incorrect value for reserved[39], expected 93, is %d", - check_msg->reserved[39]); - ck_assert_msg(check_msg->reserved[40] == 75, - "incorrect value for reserved[40], expected 75, is %d", - check_msg->reserved[40]); - ck_assert_msg(check_msg->reserved[41] == 169, - "incorrect value for reserved[41], expected 169, is %d", - check_msg->reserved[41]); - ck_assert_msg(check_msg->reserved[42] == 86, - "incorrect value for reserved[42], expected 86, is %d", - check_msg->reserved[42]); - ck_assert_msg(check_msg->reserved[43] == 16, - "incorrect value for reserved[43], expected 16, is %d", - check_msg->reserved[43]); - ck_assert_msg(check_msg->reserved[44] == 209, - "incorrect value for reserved[44], expected 209, is %d", - check_msg->reserved[44]); - ck_assert_msg(check_msg->reserved[45] == 80, - "incorrect value for reserved[45], expected 80, is %d", - check_msg->reserved[45]); - ck_assert_msg(check_msg->reserved[46] == 243, - "incorrect value for reserved[46], expected 243, is %d", - check_msg->reserved[46]); - ck_assert_msg(check_msg->reserved[47] == 30, - "incorrect value for reserved[47], expected 30, is %d", - check_msg->reserved[47]); - ck_assert_msg(check_msg->reserved[48] == 206, - "incorrect value for reserved[48], expected 206, is %d", - check_msg->reserved[48]); - ck_assert_msg(check_msg->reserved[49] == 220, - "incorrect value for reserved[49], expected 220, is %d", - check_msg->reserved[49]); - ck_assert_msg(check_msg->reserved[50] == 206, - "incorrect value for reserved[50], expected 206, is %d", - check_msg->reserved[50]); - ck_assert_msg(check_msg->reserved[51] == 115, - "incorrect value for reserved[51], expected 115, is %d", - check_msg->reserved[51]); - ck_assert_msg(check_msg->reserved[52] == 47, - "incorrect value for reserved[52], expected 47, is %d", - check_msg->reserved[52]); - ck_assert_msg(check_msg->reserved[53] == 154, - "incorrect value for reserved[53], expected 154, is %d", - check_msg->reserved[53]); - ck_assert_msg(check_msg->reserved[54] == 91, - "incorrect value for reserved[54], expected 91, is %d", - check_msg->reserved[54]); - ck_assert_msg(check_msg->reserved[55] == 227, - "incorrect value for reserved[55], expected 227, is %d", - check_msg->reserved[55]); - ck_assert_msg(check_msg->reserved[56] == 88, - "incorrect value for reserved[56], expected 88, is %d", - check_msg->reserved[56]); - ck_assert_msg(check_msg->reserved[57] == 11, - "incorrect value for reserved[57], expected 11, is %d", - check_msg->reserved[57]); - ck_assert_msg(check_msg->reserved[58] == 1, - "incorrect value for reserved[58], expected 1, is %d", - check_msg->reserved[58]); - ck_assert_msg(check_msg->reserved[59] == 85, - "incorrect value for reserved[59], expected 85, is %d", - check_msg->reserved[59]); - ck_assert_msg(check_msg->reserved[60] == 146, - "incorrect value for reserved[60], expected 146, is %d", - check_msg->reserved[60]); - ck_assert_msg(check_msg->reserved[61] == 100, - "incorrect value for reserved[61], expected 100, is %d", - check_msg->reserved[61]); - ck_assert_msg(check_msg->reserved[62] == 190, - "incorrect value for reserved[62], expected 190, is %d", - check_msg->reserved[62]); - ck_assert_msg(check_msg->reserved[63] == 232, - "incorrect value for reserved[63], expected 232, is %d", - check_msg->reserved[63]); - ck_assert_msg(check_msg->reserved[64] == 207, - "incorrect value for reserved[64], expected 207, is %d", - check_msg->reserved[64]); - ck_assert_msg(check_msg->reserved[65] == 61, - "incorrect value for reserved[65], expected 61, is %d", - check_msg->reserved[65]); - ck_assert_msg(check_msg->reserved[66] == 61, - "incorrect value for reserved[66], expected 61, is %d", - check_msg->reserved[66]); - ck_assert_msg(check_msg->reserved[67] == 201, - "incorrect value for reserved[67], expected 201, is %d", - check_msg->reserved[67]); - ck_assert_msg(check_msg->reserved[68] == 220, - "incorrect value for reserved[68], expected 220, is %d", - check_msg->reserved[68]); - ck_assert_msg(check_msg->reserved[69] == 31, - "incorrect value for reserved[69], expected 31, is %d", - check_msg->reserved[69]); - ck_assert_msg(check_msg->reserved[70] == 78, - "incorrect value for reserved[70], expected 78, is %d", - check_msg->reserved[70]); - ck_assert_msg(check_msg->reserved[71] == 34, - "incorrect value for reserved[71], expected 34, is %d", - check_msg->reserved[71]); - ck_assert_msg(check_msg->reserved[72] == 57, - "incorrect value for reserved[72], expected 57, is %d", - check_msg->reserved[72]); - ck_assert_msg(check_msg->reserved[73] == 82, - "incorrect value for reserved[73], expected 82, is %d", - check_msg->reserved[73]); - ck_assert_msg(check_msg->reserved[74] == 59, - "incorrect value for reserved[74], expected 59, is %d", - check_msg->reserved[74]); - ck_assert_msg(check_msg->reserved[75] == 104, - "incorrect value for reserved[75], expected 104, is %d", - check_msg->reserved[75]); - ck_assert_msg(check_msg->reserved[76] == 65, - "incorrect value for reserved[76], expected 65, is %d", - check_msg->reserved[76]); - ck_assert_msg(check_msg->reserved[77] == 221, - "incorrect value for reserved[77], expected 221, is %d", - check_msg->reserved[77]); - ck_assert_msg(check_msg->reserved[78] == 0, - "incorrect value for reserved[78], expected 0, is %d", - check_msg->reserved[78]); - ck_assert_msg(check_msg->reserved[79] == 43, - "incorrect value for reserved[79], expected 43, is %d", - check_msg->reserved[79]); - ck_assert_msg(check_msg->reserved[80] == 210, - "incorrect value for reserved[80], expected 210, is %d", - check_msg->reserved[80]); - ck_assert_msg(check_msg->reserved[81] == 9, - "incorrect value for reserved[81], expected 9, is %d", - check_msg->reserved[81]); - ck_assert_msg(check_msg->reserved[82] == 32, - "incorrect value for reserved[82], expected 32, is %d", - check_msg->reserved[82]); - ck_assert_msg(check_msg->reserved[83] == 122, - "incorrect value for reserved[83], expected 122, is %d", - check_msg->reserved[83]); - ck_assert_msg(check_msg->reserved[84] == 29, - "incorrect value for reserved[84], expected 29, is %d", - check_msg->reserved[84]); - ck_assert_msg(check_msg->reserved[85] == 237, - "incorrect value for reserved[85], expected 237, is %d", - check_msg->reserved[85]); - ck_assert_msg(check_msg->reserved[86] == 11, - "incorrect value for reserved[86], expected 11, is %d", - check_msg->reserved[86]); - ck_assert_msg(check_msg->reserved[87] == 151, - "incorrect value for reserved[87], expected 151, is %d", - check_msg->reserved[87]); - ck_assert_msg(check_msg->reserved[88] == 223, - "incorrect value for reserved[88], expected 223, is %d", - check_msg->reserved[88]); - ck_assert_msg(check_msg->reserved[89] == 18, - "incorrect value for reserved[89], expected 18, is %d", - check_msg->reserved[89]); - ck_assert_msg(check_msg->reserved[90] == 81, - "incorrect value for reserved[90], expected 81, is %d", - check_msg->reserved[90]); - ck_assert_msg(check_msg->reserved[91] == 204, - "incorrect value for reserved[91], expected 204, is %d", - check_msg->reserved[91]); - ck_assert_msg(check_msg->reserved[92] == 172, - "incorrect value for reserved[92], expected 172, is %d", - check_msg->reserved[92]); - ck_assert_msg(check_msg->reserved[93] == 234, - "incorrect value for reserved[93], expected 234, is %d", - check_msg->reserved[93]); - ck_assert_msg(check_msg->reserved[94] == 127, - "incorrect value for reserved[94], expected 127, is %d", - check_msg->reserved[94]); - ck_assert_msg(check_msg->reserved[95] == 3, - "incorrect value for reserved[95], expected 3, is %d", - check_msg->reserved[95]); - ck_assert_msg(check_msg->reserved[96] == 82, - "incorrect value for reserved[96], expected 82, is %d", - check_msg->reserved[96]); - ck_assert_msg(check_msg->reserved[97] == 133, - "incorrect value for reserved[97], expected 133, is %d", - check_msg->reserved[97]); - ck_assert_msg(check_msg->reserved[98] == 169, - "incorrect value for reserved[98], expected 169, is %d", - check_msg->reserved[98]); - ck_assert_msg(check_msg->reserved[99] == 12, - "incorrect value for reserved[99], expected 12, is %d", - check_msg->reserved[99]); - ck_assert_msg(check_msg->reserved[100] == 176, - "incorrect value for reserved[100], expected 176, is %d", - check_msg->reserved[100]); - ck_assert_msg(check_msg->reserved[101] == 193, - "incorrect value for reserved[101], expected 193, is %d", - check_msg->reserved[101]); - ck_assert_msg(check_msg->reserved[102] == 0, - "incorrect value for reserved[102], expected 0, is %d", - check_msg->reserved[102]); - ck_assert_msg(check_msg->reserved[103] == 24, - "incorrect value for reserved[103], expected 24, is %d", - check_msg->reserved[103]); - ck_assert_msg(check_msg->reserved[104] == 121, - "incorrect value for reserved[104], expected 121, is %d", - check_msg->reserved[104]); - ck_assert_msg(check_msg->reserved[105] == 85, - "incorrect value for reserved[105], expected 85, is %d", - check_msg->reserved[105]); - ck_assert_msg(check_msg->reserved[106] == 55, - "incorrect value for reserved[106], expected 55, is %d", - check_msg->reserved[106]); - ck_assert_msg(check_msg->reserved[107] == 214, - "incorrect value for reserved[107], expected 214, is %d", - check_msg->reserved[107]); - ck_assert_msg(check_msg->reserved[108] == 198, - "incorrect value for reserved[108], expected 198, is %d", - check_msg->reserved[108]); - ck_assert_msg(check_msg->reserved[109] == 75, - "incorrect value for reserved[109], expected 75, is %d", - check_msg->reserved[109]); - ck_assert_msg(check_msg->reserved[110] == 234, - "incorrect value for reserved[110], expected 234, is %d", - check_msg->reserved[110]); - ck_assert_msg(check_msg->reserved[111] == 179, - "incorrect value for reserved[111], expected 179, is %d", - check_msg->reserved[111]); - ck_assert_msg(check_msg->reserved[112] == 214, - "incorrect value for reserved[112], expected 214, is %d", - check_msg->reserved[112]); - ck_assert_msg(check_msg->reserved[113] == 85, - "incorrect value for reserved[113], expected 85, is %d", - check_msg->reserved[113]); - ck_assert_msg(check_msg->reserved[114] == 94, - "incorrect value for reserved[114], expected 94, is %d", - check_msg->reserved[114]); - ck_assert_msg(check_msg->reserved[115] == 115, - "incorrect value for reserved[115], expected 115, is %d", - check_msg->reserved[115]); - ck_assert_msg(check_msg->reserved[116] == 21, - "incorrect value for reserved[116], expected 21, is %d", - check_msg->reserved[116]); - ck_assert_msg(check_msg->reserved[117] == 73, - "incorrect value for reserved[117], expected 73, is %d", - check_msg->reserved[117]); - ck_assert_msg(check_msg->reserved[118] == 121, - "incorrect value for reserved[118], expected 121, is %d", - check_msg->reserved[118]); - ck_assert_msg(check_msg->reserved[119] == 75, - "incorrect value for reserved[119], expected 75, is %d", - check_msg->reserved[119]); - ck_assert_msg(check_msg->reserved[120] == 46, - "incorrect value for reserved[120], expected 46, is %d", - check_msg->reserved[120]); - ck_assert_msg(check_msg->reserved[121] == 158, - "incorrect value for reserved[121], expected 158, is %d", - check_msg->reserved[121]); - ck_assert_msg(check_msg->reserved[122] == 63, - "incorrect value for reserved[122], expected 63, is %d", - check_msg->reserved[122]); - ck_assert_msg(check_msg->reserved[123] == 100, - "incorrect value for reserved[123], expected 100, is %d", - check_msg->reserved[123]); - ck_assert_msg(check_msg->reserved[124] == 122, - "incorrect value for reserved[124], expected 122, is %d", - check_msg->reserved[124]); - ck_assert_msg(check_msg->reserved[125] == 213, - "incorrect value for reserved[125], expected 213, is %d", - check_msg->reserved[125]); - ck_assert_msg(check_msg->reserved[126] == 20, - "incorrect value for reserved[126], expected 20, is %d", - check_msg->reserved[126]); - ck_assert_msg(check_msg->reserved[127] == 85, - "incorrect value for reserved[127], expected 85, is %d", - check_msg->reserved[127]); - ck_assert_msg(check_msg->reserved[128] == 212, - "incorrect value for reserved[128], expected 212, is %d", - check_msg->reserved[128]); - ck_assert_msg(check_msg->reserved[129] == 131, - "incorrect value for reserved[129], expected 131, is %d", - check_msg->reserved[129]); - ck_assert_msg(check_msg->reserved[130] == 50, - "incorrect value for reserved[130], expected 50, is %d", - check_msg->reserved[130]); - ck_assert_msg(check_msg->reserved[131] == 224, - "incorrect value for reserved[131], expected 224, is %d", - check_msg->reserved[131]); - ck_assert_msg(check_msg->reserved[132] == 218, - "incorrect value for reserved[132], expected 218, is %d", - check_msg->reserved[132]); - ck_assert_msg(check_msg->reserved[133] == 215, - "incorrect value for reserved[133], expected 215, is %d", - check_msg->reserved[133]); - ck_assert_msg(check_msg->reserved[134] == 215, - "incorrect value for reserved[134], expected 215, is %d", - check_msg->reserved[134]); - ck_assert_msg(check_msg->reserved[135] == 149, - "incorrect value for reserved[135], expected 149, is %d", - check_msg->reserved[135]); - ck_assert_msg(check_msg->reserved[136] == 2, - "incorrect value for reserved[136], expected 2, is %d", - check_msg->reserved[136]); - ck_assert_msg(check_msg->reserved[137] == 19, - "incorrect value for reserved[137], expected 19, is %d", - check_msg->reserved[137]); - ck_assert_msg(check_msg->reserved[138] == 129, - "incorrect value for reserved[138], expected 129, is %d", - check_msg->reserved[138]); - ck_assert_msg(check_msg->reserved[139] == 39, - "incorrect value for reserved[139], expected 39, is %d", - check_msg->reserved[139]); - ck_assert_msg(check_msg->reserved[140] == 164, - "incorrect value for reserved[140], expected 164, is %d", - check_msg->reserved[140]); - ck_assert_msg(check_msg->reserved[141] == 5, - "incorrect value for reserved[141], expected 5, is %d", - check_msg->reserved[141]); - ck_assert_msg(check_msg->reserved[142] == 175, - "incorrect value for reserved[142], expected 175, is %d", - check_msg->reserved[142]); - ck_assert_msg(check_msg->reserved[143] == 6, - "incorrect value for reserved[143], expected 6, is %d", - check_msg->reserved[143]); - ck_assert_msg(check_msg->reserved[144] == 62, - "incorrect value for reserved[144], expected 62, is %d", - check_msg->reserved[144]); - ck_assert_msg(check_msg->reserved[145] == 51, - "incorrect value for reserved[145], expected 51, is %d", - check_msg->reserved[145]); - ck_assert_msg(check_msg->reserved[146] == 78, - "incorrect value for reserved[146], expected 78, is %d", - check_msg->reserved[146]); - ck_assert_msg(check_msg->reserved[147] == 66, - "incorrect value for reserved[147], expected 66, is %d", - check_msg->reserved[147]); - ck_assert_msg(check_msg->reserved[148] == 248, - "incorrect value for reserved[148], expected 248, is %d", - check_msg->reserved[148]); - ck_assert_msg(check_msg->reserved[149] == 116, - "incorrect value for reserved[149], expected 116, is %d", - check_msg->reserved[149]); - ck_assert_msg(check_msg->reserved[150] == 88, - "incorrect value for reserved[150], expected 88, is %d", - check_msg->reserved[150]); - ck_assert_msg(check_msg->reserved[151] == 90, - "incorrect value for reserved[151], expected 90, is %d", - check_msg->reserved[151]); - ck_assert_msg(check_msg->reserved[152] == 128, - "incorrect value for reserved[152], expected 128, is %d", - check_msg->reserved[152]); - ck_assert_msg(check_msg->reserved[153] == 226, - "incorrect value for reserved[153], expected 226, is %d", - check_msg->reserved[153]); - ck_assert_msg(check_msg->reserved[154] == 177, - "incorrect value for reserved[154], expected 177, is %d", - check_msg->reserved[154]); - ck_assert_msg(check_msg->reserved[155] == 0, - "incorrect value for reserved[155], expected 0, is %d", - check_msg->reserved[155]); - ck_assert_msg(check_msg->reserved[156] == 47, - "incorrect value for reserved[156], expected 47, is %d", - check_msg->reserved[156]); - ck_assert_msg(check_msg->reserved[157] == 140, - "incorrect value for reserved[157], expected 140, is %d", - check_msg->reserved[157]); - ck_assert_msg(check_msg->reserved[158] == 33, - "incorrect value for reserved[158], expected 33, is %d", - check_msg->reserved[158]); - ck_assert_msg(check_msg->reserved[159] == 126, - "incorrect value for reserved[159], expected 126, is %d", - check_msg->reserved[159]); - ck_assert_msg(check_msg->reserved[160] == 221, - "incorrect value for reserved[160], expected 221, is %d", - check_msg->reserved[160]); - ck_assert_msg(check_msg->reserved[161] == 110, - "incorrect value for reserved[161], expected 110, is %d", - check_msg->reserved[161]); - ck_assert_msg(check_msg->reserved[162] == 144, - "incorrect value for reserved[162], expected 144, is %d", - check_msg->reserved[162]); - ck_assert_msg(check_msg->reserved[163] == 97, - "incorrect value for reserved[163], expected 97, is %d", - check_msg->reserved[163]); - ck_assert_msg(check_msg->reserved[164] == 74, - "incorrect value for reserved[164], expected 74, is %d", - check_msg->reserved[164]); - ck_assert_msg(check_msg->reserved[165] == 250, - "incorrect value for reserved[165], expected 250, is %d", - check_msg->reserved[165]); - ck_assert_msg(check_msg->reserved[166] == 181, - "incorrect value for reserved[166], expected 181, is %d", - check_msg->reserved[166]); - ck_assert_msg(check_msg->reserved[167] == 199, - "incorrect value for reserved[167], expected 199, is %d", - check_msg->reserved[167]); - ck_assert_msg(check_msg->reserved[168] == 27, - "incorrect value for reserved[168], expected 27, is %d", - check_msg->reserved[168]); - ck_assert_msg(check_msg->reserved[169] == 176, - "incorrect value for reserved[169], expected 176, is %d", - check_msg->reserved[169]); - ck_assert_msg(check_msg->reserved[170] == 65, - "incorrect value for reserved[170], expected 65, is %d", - check_msg->reserved[170]); - ck_assert_msg(check_msg->reserved[171] == 185, - "incorrect value for reserved[171], expected 185, is %d", - check_msg->reserved[171]); - ck_assert_msg(check_msg->reserved[172] == 110, - "incorrect value for reserved[172], expected 110, is %d", - check_msg->reserved[172]); - ck_assert_msg(check_msg->reserved[173] == 92, - "incorrect value for reserved[173], expected 92, is %d", - check_msg->reserved[173]); - ck_assert_msg(check_msg->reserved[174] == 34, - "incorrect value for reserved[174], expected 34, is %d", - check_msg->reserved[174]); - ck_assert_msg(check_msg->reserved[175] == 44, - "incorrect value for reserved[175], expected 44, is %d", - check_msg->reserved[175]); - ck_assert_msg(check_msg->reserved[176] == 131, - "incorrect value for reserved[176], expected 131, is %d", - check_msg->reserved[176]); - ck_assert_msg(check_msg->reserved[177] == 96, - "incorrect value for reserved[177], expected 96, is %d", - check_msg->reserved[177]); - ck_assert_msg(check_msg->reserved[178] == 178, - "incorrect value for reserved[178], expected 178, is %d", - check_msg->reserved[178]); - ck_assert_msg(check_msg->reserved[179] == 40, - "incorrect value for reserved[179], expected 40, is %d", - check_msg->reserved[179]); - ck_assert_msg(check_msg->reserved[180] == 176, - "incorrect value for reserved[180], expected 176, is %d", - check_msg->reserved[180]); - ck_assert_msg(check_msg->reserved[181] == 4, - "incorrect value for reserved[181], expected 4, is %d", - check_msg->reserved[181]); - ck_assert_msg(check_msg->reserved[182] == 90, - "incorrect value for reserved[182], expected 90, is %d", - check_msg->reserved[182]); - ck_assert_msg(check_msg->reserved[183] == 36, - "incorrect value for reserved[183], expected 36, is %d", - check_msg->reserved[183]); - ck_assert_msg(check_msg->reserved[184] == 7, - "incorrect value for reserved[184], expected 7, is %d", - check_msg->reserved[184]); - ck_assert_msg(check_msg->reserved[185] == 180, - "incorrect value for reserved[185], expected 180, is %d", - check_msg->reserved[185]); - ck_assert_msg(check_msg->reserved[186] == 244, - "incorrect value for reserved[186], expected 244, is %d", - check_msg->reserved[186]); - ck_assert_msg(check_msg->reserved[187] == 244, - "incorrect value for reserved[187], expected 244, is %d", - check_msg->reserved[187]); - ck_assert_msg(check_msg->reserved[188] == 23, - "incorrect value for reserved[188], expected 23, is %d", - check_msg->reserved[188]); - ck_assert_msg(check_msg->reserved[189] == 108, - "incorrect value for reserved[189], expected 108, is %d", - check_msg->reserved[189]); - ck_assert_msg(check_msg->reserved[190] == 171, - "incorrect value for reserved[190], expected 171, is %d", - check_msg->reserved[190]); - ck_assert_msg(check_msg->reserved[191] == 204, - "incorrect value for reserved[191], expected 204, is %d", - check_msg->reserved[191]); - ck_assert_msg(check_msg->reserved[192] == 196, - "incorrect value for reserved[192], expected 196, is %d", - check_msg->reserved[192]); - ck_assert_msg(check_msg->reserved[193] == 61, - "incorrect value for reserved[193], expected 61, is %d", - check_msg->reserved[193]); - ck_assert_msg(check_msg->reserved[194] == 51, - "incorrect value for reserved[194], expected 51, is %d", - check_msg->reserved[194]); - ck_assert_msg(check_msg->reserved[195] == 179, - "incorrect value for reserved[195], expected 179, is %d", - check_msg->reserved[195]); - ck_assert_msg(check_msg->reserved[196] == 242, - "incorrect value for reserved[196], expected 242, is %d", - check_msg->reserved[196]); - ck_assert_msg(check_msg->reserved[197] == 156, - "incorrect value for reserved[197], expected 156, is %d", - check_msg->reserved[197]); - ck_assert_msg(check_msg->reserved[198] == 81, - "incorrect value for reserved[198], expected 81, is %d", - check_msg->reserved[198]); - ck_assert_msg(check_msg->reserved[199] == 83, - "incorrect value for reserved[199], expected 83, is %d", - check_msg->reserved[199]); - ck_assert_msg(check_msg->reserved[200] == 16, - "incorrect value for reserved[200], expected 16, is %d", - check_msg->reserved[200]); - ck_assert_msg(check_msg->reserved[201] == 15, - "incorrect value for reserved[201], expected 15, is %d", - check_msg->reserved[201]); - ck_assert_msg(check_msg->reserved[202] == 134, - "incorrect value for reserved[202], expected 134, is %d", - check_msg->reserved[202]); - ck_assert_msg(check_msg->reserved[203] == 40, - "incorrect value for reserved[203], expected 40, is %d", - check_msg->reserved[203]); - ck_assert_msg(check_msg->reserved[204] == 245, - "incorrect value for reserved[204], expected 245, is %d", - check_msg->reserved[204]); - ck_assert_msg(check_msg->reserved[205] == 253, - "incorrect value for reserved[205], expected 253, is %d", - check_msg->reserved[205]); - ck_assert_msg(check_msg->reserved[206] == 150, - "incorrect value for reserved[206], expected 150, is %d", - check_msg->reserved[206]); - ck_assert_msg(check_msg->reserved[207] == 94, - "incorrect value for reserved[207], expected 94, is %d", - check_msg->reserved[207]); - ck_assert_msg(check_msg->reserved[208] == 150, - "incorrect value for reserved[208], expected 150, is %d", - check_msg->reserved[208]); - ck_assert_msg(check_msg->reserved[209] == 144, - "incorrect value for reserved[209], expected 144, is %d", - check_msg->reserved[209]); - ck_assert_msg(check_msg->reserved[210] == 197, - "incorrect value for reserved[210], expected 197, is %d", - check_msg->reserved[210]); - ck_assert_msg(check_msg->reserved[211] == 113, - "incorrect value for reserved[211], expected 113, is %d", - check_msg->reserved[211]); - ck_assert_msg(check_msg->reserved[212] == 5, - "incorrect value for reserved[212], expected 5, is %d", - check_msg->reserved[212]); - ck_assert_msg(check_msg->reserved[213] == 141, - "incorrect value for reserved[213], expected 141, is %d", - check_msg->reserved[213]); - ck_assert_msg(check_msg->reserved[214] == 232, - "incorrect value for reserved[214], expected 232, is %d", - check_msg->reserved[214]); - ck_assert_msg(check_msg->reserved[215] == 33, - "incorrect value for reserved[215], expected 33, is %d", - check_msg->reserved[215]); - ck_assert_msg(check_msg->reserved[216] == 101, - "incorrect value for reserved[216], expected 101, is %d", - check_msg->reserved[216]); - ck_assert_msg(check_msg->reserved[217] == 231, - "incorrect value for reserved[217], expected 231, is %d", - check_msg->reserved[217]); - ck_assert_msg(check_msg->reserved[218] == 38, - "incorrect value for reserved[218], expected 38, is %d", - check_msg->reserved[218]); - ck_assert_msg(check_msg->reserved[219] == 75, - "incorrect value for reserved[219], expected 75, is %d", - check_msg->reserved[219]); - ck_assert_msg(check_msg->reserved[220] == 178, - "incorrect value for reserved[220], expected 178, is %d", - check_msg->reserved[220]); - ck_assert_msg(check_msg->reserved[221] == 243, - "incorrect value for reserved[221], expected 243, is %d", - check_msg->reserved[221]); - ck_assert_msg(check_msg->reserved[222] == 119, - "incorrect value for reserved[222], expected 119, is %d", - check_msg->reserved[222]); - ck_assert_msg(check_msg->reserved[223] == 1, - "incorrect value for reserved[223], expected 1, is %d", - check_msg->reserved[223]); - ck_assert_msg(check_msg->reserved[224] == 248, - "incorrect value for reserved[224], expected 248, is %d", - check_msg->reserved[224]); - ck_assert_msg(check_msg->reserved[225] == 218, - "incorrect value for reserved[225], expected 218, is %d", - check_msg->reserved[225]); - ck_assert_msg(check_msg->reserved[226] == 86, - "incorrect value for reserved[226], expected 86, is %d", - check_msg->reserved[226]); - ck_assert_msg(check_msg->reserved[227] == 7, - "incorrect value for reserved[227], expected 7, is %d", - check_msg->reserved[227]); - ck_assert_msg(check_msg->reserved[228] == 88, - "incorrect value for reserved[228], expected 88, is %d", - check_msg->reserved[228]); - ck_assert_msg(check_msg->reserved[229] == 197, - "incorrect value for reserved[229], expected 197, is %d", - check_msg->reserved[229]); - ck_assert_msg(check_msg->reserved[230] == 148, - "incorrect value for reserved[230], expected 148, is %d", - check_msg->reserved[230]); - ck_assert_msg(check_msg->reserved[231] == 240, - "incorrect value for reserved[231], expected 240, is %d", - check_msg->reserved[231]); - ck_assert_msg(check_msg->reserved[232] == 227, - "incorrect value for reserved[232], expected 227, is %d", - check_msg->reserved[232]); - ck_assert_msg(check_msg->reserved[233] == 2, - "incorrect value for reserved[233], expected 2, is %d", - check_msg->reserved[233]); - ck_assert_msg(check_msg->reserved[234] == 65, - "incorrect value for reserved[234], expected 65, is %d", - check_msg->reserved[234]); - ck_assert_msg(check_msg->reserved[235] == 173, - "incorrect value for reserved[235], expected 173, is %d", - check_msg->reserved[235]); - ck_assert_msg(check_msg->reserved[236] == 122, - "incorrect value for reserved[236], expected 122, is %d", - check_msg->reserved[236]); - ck_assert_msg(check_msg->reserved[237] == 143, - "incorrect value for reserved[237], expected 143, is %d", - check_msg->reserved[237]); - ck_assert_msg(check_msg->reserved[238] == 251, - "incorrect value for reserved[238], expected 251, is %d", - check_msg->reserved[238]); - ck_assert_msg(check_msg->reserved[239] == 156, - "incorrect value for reserved[239], expected 156, is %d", - check_msg->reserved[239]); - ck_assert_msg(check_msg->reserved[240] == 217, - "incorrect value for reserved[240], expected 217, is %d", - check_msg->reserved[240]); - ck_assert_msg(check_msg->reserved[241] == 67, - "incorrect value for reserved[241], expected 67, is %d", - check_msg->reserved[241]); - ck_assert_msg(check_msg->reserved[242] == 239, - "incorrect value for reserved[242], expected 239, is %d", - check_msg->reserved[242]); - ck_assert_msg(check_msg->reserved[243] == 219, - "incorrect value for reserved[243], expected 219, is %d", - check_msg->reserved[243]); - ck_assert_msg(check_msg->reserved[244] == 31, - "incorrect value for reserved[244], expected 31, is %d", - check_msg->reserved[244]); - ck_assert_msg(check_msg->reserved[245] == 224, - "incorrect value for reserved[245], expected 224, is %d", - check_msg->reserved[245]); - ck_assert_msg(check_msg->reserved[246] == 176, - "incorrect value for reserved[246], expected 176, is %d", - check_msg->reserved[246]); - ck_assert_msg(check_msg->reserved[247] == 129, - "incorrect value for reserved[247], expected 129, is %d", - check_msg->reserved[247]); - ck_assert_msg(check_msg->reserved[248] == 81, - "incorrect value for reserved[248], expected 81, is %d", - check_msg->reserved[248]); - ck_assert_msg(check_msg->reserved[249] == 80, - "incorrect value for reserved[249], expected 80, is %d", - check_msg->reserved[249]); - ck_assert_msg( - (check_msg->signal_error_rate * 100 - 8588.20019531 * 100) < 0.05, - "incorrect value for signal_error_rate, expected 8588.20019531, is %f", - check_msg->signal_error_rate); - ck_assert_msg(check_msg->signal_strength == 103, - "incorrect value for signal_strength, expected 103, is %d", - check_msg->signal_strength); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgCellModemStatus_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_piksi_MsgCellModemStatus"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_piksi_MsgCellModemStatus"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgCellModemStatus); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgCommandOutput.c b/c/test/legacy/auto_check_sbp_piksi_MsgCommandOutput.c deleted file mode 100644 index b033c2e7bf..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgCommandOutput.c +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgCommandOutput.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgCommandOutput) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xbc, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xbc, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 188, 0, 50, 84, 20, 126, 164, 116, 149, 83, 111, 109, 101, - 32, 111, 117, 116, 112, 117, 116, 32, 116, 101, 120, 116, 11, 109, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_command_output_t *test_msg = (msg_command_output_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = {(char)83, (char)111, (char)109, (char)101, - (char)32, (char)111, (char)117, (char)116, - (char)112, (char)117, (char)116, (char)32, - (char)116, (char)101, (char)120, (char)116}; - memcpy(test_msg->line, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->line) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->sequence = 2507449470; - sbp_payload_send(&sbp_state, 0xbc, 21554, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 21554, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 21554, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xbc, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_command_output_t *check_msg = - (msg_command_output_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = {(char)83, (char)111, (char)109, (char)101, - (char)32, (char)111, (char)117, (char)116, - (char)112, (char)117, (char)116, (char)32, - (char)116, (char)101, (char)120, (char)116}; - ck_assert_msg( - memcmp(check_msg->line, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->line, expected string '%s', is '%s'", - check_string, check_msg->line); - } - ck_assert_msg(check_msg->sequence == 2507449470, - "incorrect value for sequence, expected 2507449470, is %d", - check_msg->sequence); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgCommandOutput_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgCommandOutput"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_piksi_MsgCommandOutput"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgCommandOutput); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgCommandReq.c b/c/test/legacy/auto_check_sbp_piksi_MsgCommandReq.c deleted file mode 100644 index b42a8382db..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgCommandReq.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgCommandReq.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgCommandReq) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xb8, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xb8, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 184, 0, 170, 184, 31, 51, 77, 163, 104, 47, 112, 97, - 116, 104, 47, 116, 111, 47, 99, 111, 109, 109, 97, 110, 100, - 32, 119, 105, 116, 104, 32, 97, 114, 103, 115, 0, 38, 24, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_command_req_t *test_msg = (msg_command_req_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)99, (char)111, (char)109, - (char)109, (char)97, (char)110, (char)100, (char)32, (char)119, - (char)105, (char)116, (char)104, (char)32, (char)97, (char)114, - (char)103, (char)115, (char)0}; - memcpy(test_msg->command, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->command) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->sequence = 1755532595; - sbp_payload_send(&sbp_state, 0xb8, 47274, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 47274, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 47274, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xb8, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_command_req_t *check_msg = (msg_command_req_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)99, (char)111, (char)109, - (char)109, (char)97, (char)110, (char)100, (char)32, (char)119, - (char)105, (char)116, (char)104, (char)32, (char)97, (char)114, - (char)103, (char)115, (char)0}; - ck_assert_msg( - memcmp(check_msg->command, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->command, expected string '%s', is " - "'%s'", - check_string, check_msg->command); - } - ck_assert_msg(check_msg->sequence == 1755532595, - "incorrect value for sequence, expected 1755532595, is %d", - check_msg->sequence); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgCommandReq_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgCommandReq"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_piksi_MsgCommandReq"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgCommandReq); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgCommandResp.c b/c/test/legacy/auto_check_sbp_piksi_MsgCommandResp.c deleted file mode 100644 index e3b7149979..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgCommandResp.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgCommandResp.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgCommandResp) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xb9, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xb9, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 185, 0, 57, 206, 8, 118, 215, - 131, 160, 210, 110, 150, 103, 164, 240, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_command_resp_t *test_msg = (msg_command_resp_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->code = 1737912018; - test_msg->sequence = 2692994934; - sbp_payload_send(&sbp_state, 0xb9, 52793, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 52793, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 52793, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xb9, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_command_resp_t *check_msg = - (msg_command_resp_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->code == 1737912018, - "incorrect value for code, expected 1737912018, is %d", - check_msg->code); - ck_assert_msg(check_msg->sequence == 2692994934, - "incorrect value for sequence, expected 2692994934, is %d", - check_msg->sequence); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgCommandResp_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgCommandResp"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_piksi_MsgCommandResp"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgCommandResp); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgCwResults.c b/c/test/legacy/auto_check_sbp_piksi_MsgCwResults.c deleted file mode 100644 index 60be41939a..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgCwResults.c +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgCwResults.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgCwResults) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xc0, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xc0, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 192, 0, 99, 246, 0, 228, 72, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - sbp_payload_send(&sbp_state, 0xc0, 63075, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 63075, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 63075, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xc0, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgCwResults_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgCwResults"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_piksi_MsgCwResults"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgCwResults); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgCwStart.c b/c/test/legacy/auto_check_sbp_piksi_MsgCwStart.c deleted file mode 100644 index 3756df1d58..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgCwStart.c +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgCwStart.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgCwStart) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xc1, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xc1, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 193, 0, 30, 179, 0, 213, 138, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - sbp_payload_send(&sbp_state, 0xc1, 45854, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 45854, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 45854, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xc1, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgCwStart_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgCwStart"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_piksi_MsgCwStart"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgCwStart); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgDeviceMonitor.c b/c/test/legacy/auto_check_sbp_piksi_MsgDeviceMonitor.c deleted file mode 100644 index f42cbf5bc6..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgDeviceMonitor.c +++ /dev/null @@ -1,653 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgDeviceMonitor.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgDeviceMonitor) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xb5, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xb5, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 181, 0, 95, 66, 10, 241, 216, 219, - 3, 253, 6, 21, 24, 168, 18, 207, 233, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_device_monitor_t* test_msg = (msg_device_monitor_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cpu_temperature = 6165; - test_msg->cpu_vaux = 1789; - test_msg->cpu_vint = 987; - test_msg->dev_vin = -9999; - test_msg->fe_temperature = 4776; - sbp_payload_send(&sbp_state, 0xb5, 16991, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 16991, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 16991, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xb5, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_device_monitor_t* check_msg = - (msg_device_monitor_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cpu_temperature == 6165, - "incorrect value for cpu_temperature, expected 6165, is %d", - check_msg->cpu_temperature); - ck_assert_msg(check_msg->cpu_vaux == 1789, - "incorrect value for cpu_vaux, expected 1789, is %d", - check_msg->cpu_vaux); - ck_assert_msg(check_msg->cpu_vint == 987, - "incorrect value for cpu_vint, expected 987, is %d", - check_msg->cpu_vint); - ck_assert_msg(check_msg->dev_vin == -9999, - "incorrect value for dev_vin, expected -9999, is %d", - check_msg->dev_vin); - ck_assert_msg(check_msg->fe_temperature == 4776, - "incorrect value for fe_temperature, expected 4776, is %d", - check_msg->fe_temperature); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xb5, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xb5, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 181, 0, 95, 66, 10, 241, 216, 219, - 3, 254, 6, 24, 24, 168, 18, 169, 30, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_device_monitor_t* test_msg = (msg_device_monitor_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cpu_temperature = 6168; - test_msg->cpu_vaux = 1790; - test_msg->cpu_vint = 987; - test_msg->dev_vin = -9999; - test_msg->fe_temperature = 4776; - sbp_payload_send(&sbp_state, 0xb5, 16991, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 16991, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 16991, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xb5, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_device_monitor_t* check_msg = - (msg_device_monitor_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cpu_temperature == 6168, - "incorrect value for cpu_temperature, expected 6168, is %d", - check_msg->cpu_temperature); - ck_assert_msg(check_msg->cpu_vaux == 1790, - "incorrect value for cpu_vaux, expected 1790, is %d", - check_msg->cpu_vaux); - ck_assert_msg(check_msg->cpu_vint == 987, - "incorrect value for cpu_vint, expected 987, is %d", - check_msg->cpu_vint); - ck_assert_msg(check_msg->dev_vin == -9999, - "incorrect value for dev_vin, expected -9999, is %d", - check_msg->dev_vin); - ck_assert_msg(check_msg->fe_temperature == 4776, - "incorrect value for fe_temperature, expected 4776, is %d", - check_msg->fe_temperature); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xb5, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xb5, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 181, 0, 95, 66, 10, 241, 216, 219, - 3, 253, 6, 22, 24, 168, 18, 19, 114, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_device_monitor_t* test_msg = (msg_device_monitor_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cpu_temperature = 6166; - test_msg->cpu_vaux = 1789; - test_msg->cpu_vint = 987; - test_msg->dev_vin = -9999; - test_msg->fe_temperature = 4776; - sbp_payload_send(&sbp_state, 0xb5, 16991, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 16991, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 16991, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xb5, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_device_monitor_t* check_msg = - (msg_device_monitor_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cpu_temperature == 6166, - "incorrect value for cpu_temperature, expected 6166, is %d", - check_msg->cpu_temperature); - ck_assert_msg(check_msg->cpu_vaux == 1789, - "incorrect value for cpu_vaux, expected 1789, is %d", - check_msg->cpu_vaux); - ck_assert_msg(check_msg->cpu_vint == 987, - "incorrect value for cpu_vint, expected 987, is %d", - check_msg->cpu_vint); - ck_assert_msg(check_msg->dev_vin == -9999, - "incorrect value for dev_vin, expected -9999, is %d", - check_msg->dev_vin); - ck_assert_msg(check_msg->fe_temperature == 4776, - "incorrect value for fe_temperature, expected 4776, is %d", - check_msg->fe_temperature); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xb5, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xb5, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 181, 0, 95, 66, 10, 241, 216, 218, - 3, 252, 6, 6, 24, 168, 18, 199, 107, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_device_monitor_t* test_msg = (msg_device_monitor_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cpu_temperature = 6150; - test_msg->cpu_vaux = 1788; - test_msg->cpu_vint = 986; - test_msg->dev_vin = -9999; - test_msg->fe_temperature = 4776; - sbp_payload_send(&sbp_state, 0xb5, 16991, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 16991, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 16991, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xb5, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_device_monitor_t* check_msg = - (msg_device_monitor_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cpu_temperature == 6150, - "incorrect value for cpu_temperature, expected 6150, is %d", - check_msg->cpu_temperature); - ck_assert_msg(check_msg->cpu_vaux == 1788, - "incorrect value for cpu_vaux, expected 1788, is %d", - check_msg->cpu_vaux); - ck_assert_msg(check_msg->cpu_vint == 986, - "incorrect value for cpu_vint, expected 986, is %d", - check_msg->cpu_vint); - ck_assert_msg(check_msg->dev_vin == -9999, - "incorrect value for dev_vin, expected -9999, is %d", - check_msg->dev_vin); - ck_assert_msg(check_msg->fe_temperature == 4776, - "incorrect value for fe_temperature, expected 4776, is %d", - check_msg->fe_temperature); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xb5, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xb5, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 181, 0, 95, 66, 10, 241, 216, 220, - 3, 253, 6, 235, 23, 168, 18, 241, 63, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_device_monitor_t* test_msg = (msg_device_monitor_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cpu_temperature = 6123; - test_msg->cpu_vaux = 1789; - test_msg->cpu_vint = 988; - test_msg->dev_vin = -9999; - test_msg->fe_temperature = 4776; - sbp_payload_send(&sbp_state, 0xb5, 16991, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 16991, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 16991, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xb5, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_device_monitor_t* check_msg = - (msg_device_monitor_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cpu_temperature == 6123, - "incorrect value for cpu_temperature, expected 6123, is %d", - check_msg->cpu_temperature); - ck_assert_msg(check_msg->cpu_vaux == 1789, - "incorrect value for cpu_vaux, expected 1789, is %d", - check_msg->cpu_vaux); - ck_assert_msg(check_msg->cpu_vint == 988, - "incorrect value for cpu_vint, expected 988, is %d", - check_msg->cpu_vint); - ck_assert_msg(check_msg->dev_vin == -9999, - "incorrect value for dev_vin, expected -9999, is %d", - check_msg->dev_vin); - ck_assert_msg(check_msg->fe_temperature == 4776, - "incorrect value for fe_temperature, expected 4776, is %d", - check_msg->fe_temperature); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_piksi_MsgDeviceMonitor_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgDeviceMonitor"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_piksi_MsgDeviceMonitor"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgDeviceMonitor); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgFrontEndGain.c b/c/test/legacy/auto_check_sbp_piksi_MsgFrontEndGain.c deleted file mode 100644 index f9e613e30e..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgFrontEndGain.c +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgFrontEndGain.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgFrontEndGain) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xbf, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xbf, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 191, 0, 175, 245, 16, 41, 133, 134, 10, 105, 20, - 38, 38, 246, 233, 216, 80, 187, 213, 85, 2, 235, 135, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_front_end_gain_t *test_msg = (msg_front_end_gain_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->if_gain) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->if_gain[0]); - } - test_msg->if_gain[0] = -10; - if (sizeof(test_msg->if_gain) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->if_gain[0]); - } - test_msg->if_gain[1] = -23; - if (sizeof(test_msg->if_gain) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->if_gain[0]); - } - test_msg->if_gain[2] = -40; - if (sizeof(test_msg->if_gain) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->if_gain[0]); - } - test_msg->if_gain[3] = 80; - if (sizeof(test_msg->if_gain) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->if_gain[0]); - } - test_msg->if_gain[4] = -69; - if (sizeof(test_msg->if_gain) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->if_gain[0]); - } - test_msg->if_gain[5] = -43; - if (sizeof(test_msg->if_gain) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->if_gain[0]); - } - test_msg->if_gain[6] = 85; - if (sizeof(test_msg->if_gain) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->if_gain[0]); - } - test_msg->if_gain[7] = 2; - if (sizeof(test_msg->rf_gain) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rf_gain[0]); - } - test_msg->rf_gain[0] = 41; - if (sizeof(test_msg->rf_gain) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rf_gain[0]); - } - test_msg->rf_gain[1] = -123; - if (sizeof(test_msg->rf_gain) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rf_gain[0]); - } - test_msg->rf_gain[2] = -122; - if (sizeof(test_msg->rf_gain) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rf_gain[0]); - } - test_msg->rf_gain[3] = 10; - if (sizeof(test_msg->rf_gain) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rf_gain[0]); - } - test_msg->rf_gain[4] = 105; - if (sizeof(test_msg->rf_gain) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rf_gain[0]); - } - test_msg->rf_gain[5] = 20; - if (sizeof(test_msg->rf_gain) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rf_gain[0]); - } - test_msg->rf_gain[6] = 38; - if (sizeof(test_msg->rf_gain) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rf_gain[0]); - } - test_msg->rf_gain[7] = 38; - sbp_payload_send(&sbp_state, 0xbf, 62895, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 62895, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 62895, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xbf, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_front_end_gain_t *check_msg = - (msg_front_end_gain_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->if_gain[0] == -10, - "incorrect value for if_gain[0], expected -10, is %d", - check_msg->if_gain[0]); - ck_assert_msg(check_msg->if_gain[1] == -23, - "incorrect value for if_gain[1], expected -23, is %d", - check_msg->if_gain[1]); - ck_assert_msg(check_msg->if_gain[2] == -40, - "incorrect value for if_gain[2], expected -40, is %d", - check_msg->if_gain[2]); - ck_assert_msg(check_msg->if_gain[3] == 80, - "incorrect value for if_gain[3], expected 80, is %d", - check_msg->if_gain[3]); - ck_assert_msg(check_msg->if_gain[4] == -69, - "incorrect value for if_gain[4], expected -69, is %d", - check_msg->if_gain[4]); - ck_assert_msg(check_msg->if_gain[5] == -43, - "incorrect value for if_gain[5], expected -43, is %d", - check_msg->if_gain[5]); - ck_assert_msg(check_msg->if_gain[6] == 85, - "incorrect value for if_gain[6], expected 85, is %d", - check_msg->if_gain[6]); - ck_assert_msg(check_msg->if_gain[7] == 2, - "incorrect value for if_gain[7], expected 2, is %d", - check_msg->if_gain[7]); - ck_assert_msg(check_msg->rf_gain[0] == 41, - "incorrect value for rf_gain[0], expected 41, is %d", - check_msg->rf_gain[0]); - ck_assert_msg(check_msg->rf_gain[1] == -123, - "incorrect value for rf_gain[1], expected -123, is %d", - check_msg->rf_gain[1]); - ck_assert_msg(check_msg->rf_gain[2] == -122, - "incorrect value for rf_gain[2], expected -122, is %d", - check_msg->rf_gain[2]); - ck_assert_msg(check_msg->rf_gain[3] == 10, - "incorrect value for rf_gain[3], expected 10, is %d", - check_msg->rf_gain[3]); - ck_assert_msg(check_msg->rf_gain[4] == 105, - "incorrect value for rf_gain[4], expected 105, is %d", - check_msg->rf_gain[4]); - ck_assert_msg(check_msg->rf_gain[5] == 20, - "incorrect value for rf_gain[5], expected 20, is %d", - check_msg->rf_gain[5]); - ck_assert_msg(check_msg->rf_gain[6] == 38, - "incorrect value for rf_gain[6], expected 38, is %d", - check_msg->rf_gain[6]); - ck_assert_msg(check_msg->rf_gain[7] == 38, - "incorrect value for rf_gain[7], expected 38, is %d", - check_msg->rf_gain[7]); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgFrontEndGain_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgFrontEndGain"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_piksi_MsgFrontEndGain"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgFrontEndGain); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgIarState.c b/c/test/legacy/auto_check_sbp_piksi_MsgIarState.c deleted file mode 100644 index 3731aaf914..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgIarState.c +++ /dev/null @@ -1,737 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgIarState.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgIarState) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x19, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x19, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 25, 0, 246, 215, 4, 1, 0, 0, 0, 216, 140, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_iar_state_t* test_msg = (msg_iar_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->num_hyps = 1; - sbp_payload_send(&sbp_state, 0x19, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x19, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_iar_state_t* check_msg = (msg_iar_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->num_hyps == 1, - "incorrect value for num_hyps, expected 1, is %d", - check_msg->num_hyps); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x19, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x19, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 25, 0, 195, 4, 4, 0, 0, 0, 0, 18, 176, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_iar_state_t* test_msg = (msg_iar_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->num_hyps = 0; - sbp_payload_send(&sbp_state, 0x19, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x19, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_iar_state_t* check_msg = (msg_iar_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->num_hyps == 0, - "incorrect value for num_hyps, expected 0, is %d", - check_msg->num_hyps); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x19, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x19, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 25, 0, 195, 4, 4, 1, 0, 0, 0, 166, 198, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_iar_state_t* test_msg = (msg_iar_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->num_hyps = 1; - sbp_payload_send(&sbp_state, 0x19, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x19, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_iar_state_t* check_msg = (msg_iar_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->num_hyps == 1, - "incorrect value for num_hyps, expected 1, is %d", - check_msg->num_hyps); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x19, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x19, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 25, 0, 195, 4, 4, 217, 2, 0, 0, 6, 133, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_iar_state_t* test_msg = (msg_iar_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->num_hyps = 729; - sbp_payload_send(&sbp_state, 0x19, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x19, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_iar_state_t* check_msg = (msg_iar_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->num_hyps == 729, - "incorrect value for num_hyps, expected 729, is %d", - check_msg->num_hyps); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x19, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x19, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 25, 0, 195, 4, 4, 216, 2, 0, 0, 178, 243, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_iar_state_t* test_msg = (msg_iar_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->num_hyps = 728; - sbp_payload_send(&sbp_state, 0x19, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x19, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_iar_state_t* check_msg = (msg_iar_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->num_hyps == 728, - "incorrect value for num_hyps, expected 728, is %d", - check_msg->num_hyps); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x19, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x19, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 25, 0, 195, 4, 4, 215, 2, 0, 0, 92, 39, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_iar_state_t* test_msg = (msg_iar_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->num_hyps = 727; - sbp_payload_send(&sbp_state, 0x19, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x19, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_iar_state_t* check_msg = (msg_iar_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->num_hyps == 727, - "incorrect value for num_hyps, expected 727, is %d", - check_msg->num_hyps); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x19, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x19, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 25, 0, 195, 4, 4, 211, 2, 0, 0, 173, 237, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_iar_state_t* test_msg = (msg_iar_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->num_hyps = 723; - sbp_payload_send(&sbp_state, 0x19, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x19, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_iar_state_t* check_msg = (msg_iar_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->num_hyps == 723, - "incorrect value for num_hyps, expected 723, is %d", - check_msg->num_hyps); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_piksi_MsgIarState_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgIarState"); - TCase* tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_piksi_MsgIarState"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgIarState); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgInitBaseDep.c b/c/test/legacy/auto_check_sbp_piksi_MsgInitBaseDep.c deleted file mode 100644 index e83e7bbf2a..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgInitBaseDep.c +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgInitBaseDep.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgInitBaseDep) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x23, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x23, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 35, 0, 184, 41, 0, 70, 13, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - sbp_payload_send(&sbp_state, 0x23, 10680, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 10680, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 10680, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x23, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgInitBaseDep_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgInitBaseDep"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_piksi_MsgInitBaseDep"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgInitBaseDep); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgMaskSatellite.c b/c/test/legacy/auto_check_sbp_piksi_MsgMaskSatellite.c deleted file mode 100644 index b33c89e9e2..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgMaskSatellite.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgMaskSatellite.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgMaskSatellite) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x2b, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x2b, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 43, 0, 173, 151, 3, 183, 87, 57, 19, 147, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_mask_satellite_t *test_msg = (msg_mask_satellite_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->mask = 183; - test_msg->sid.code = 57; - test_msg->sid.sat = 87; - sbp_payload_send(&sbp_state, 0x2b, 38829, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 38829, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 38829, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x2b, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_mask_satellite_t *check_msg = - (msg_mask_satellite_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->mask == 183, - "incorrect value for mask, expected 183, is %d", - check_msg->mask); - ck_assert_msg(check_msg->sid.code == 57, - "incorrect value for sid.code, expected 57, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.sat == 87, - "incorrect value for sid.sat, expected 87, is %d", - check_msg->sid.sat); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgMaskSatellite_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgMaskSatellite"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_piksi_MsgMaskSatellite"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgMaskSatellite); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgMaskSatelliteDep.c b/c/test/legacy/auto_check_sbp_piksi_MsgMaskSatelliteDep.c deleted file mode 100644 index 41942e426f..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgMaskSatelliteDep.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgMaskSatelliteDep.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgMaskSatelliteDep) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x1b, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x1b, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 27, 0, 187, 134, 5, 33, 2, 153, 95, 4, 29, 188, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_mask_satellite_dep_t *test_msg = - (msg_mask_satellite_dep_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->mask = 33; - test_msg->sid.code = 95; - test_msg->sid.reserved = 4; - test_msg->sid.sat = 39170; - sbp_payload_send(&sbp_state, 0x1b, 34491, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 34491, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 34491, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x1b, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_mask_satellite_dep_t *check_msg = - (msg_mask_satellite_dep_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->mask == 33, - "incorrect value for mask, expected 33, is %d", - check_msg->mask); - ck_assert_msg(check_msg->sid.code == 95, - "incorrect value for sid.code, expected 95, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 4, - "incorrect value for sid.reserved, expected 4, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 39170, - "incorrect value for sid.sat, expected 39170, is %d", - check_msg->sid.sat); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgMaskSatelliteDep_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_piksi_MsgMaskSatelliteDep"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_piksi_MsgMaskSatelliteDep"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgMaskSatelliteDep); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgNetworkBandwidthUsage.c b/c/test/legacy/auto_check_sbp_piksi_MsgNetworkBandwidthUsage.c deleted file mode 100644 index 410c21ca41..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgNetworkBandwidthUsage.c +++ /dev/null @@ -1,464 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgNetworkBandwidthUsage.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgNetworkBandwidthUsage) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xBD, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xBD, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 189, 0, 207, 121, 200, 94, 105, 178, 128, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 99, 97, 110, 48, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 94, 105, 178, 128, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 99, 97, 110, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 94, 105, 178, 128, 0, 0, 0, 0, 165, 235, 94, 203, - 0, 0, 0, 0, 237, 14, 148, 240, 184, 220, 202, 218, 101, 116, - 104, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 94, 105, 178, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 111, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 94, 105, - 178, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 115, 105, 116, 48, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 133, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_network_bandwidth_usage_t *test_msg = - (msg_network_bandwidth_usage_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->interfaces) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->interfaces[0]); - } - test_msg->interfaces[0].duration = 2159176030; - { - const char assign_string[] = {(char)99, (char)97, (char)110, (char)48, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->interfaces[0].interface_name, assign_string, - sizeof(assign_string)); - if (sizeof(test_msg->interfaces[0].interface_name) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->interfaces[0].rx_bytes = 0; - test_msg->interfaces[0].total_bytes = 0; - test_msg->interfaces[0].tx_bytes = 0; - if (sizeof(test_msg->interfaces) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->interfaces[0]); - } - test_msg->interfaces[1].duration = 2159176030; - { - const char assign_string[] = {(char)99, (char)97, (char)110, (char)49, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->interfaces[1].interface_name, assign_string, - sizeof(assign_string)); - if (sizeof(test_msg->interfaces[1].interface_name) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->interfaces[1].rx_bytes = 0; - test_msg->interfaces[1].total_bytes = 0; - test_msg->interfaces[1].tx_bytes = 0; - if (sizeof(test_msg->interfaces) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->interfaces[0]); - } - test_msg->interfaces[2].duration = 2159176030; - { - const char assign_string[] = {(char)101, (char)116, (char)104, (char)48, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->interfaces[2].interface_name, assign_string, - sizeof(assign_string)); - if (sizeof(test_msg->interfaces[2].interface_name) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->interfaces[2].rx_bytes = 4036234989; - test_msg->interfaces[2].total_bytes = 3411995557; - test_msg->interfaces[2].tx_bytes = 3670727864; - if (sizeof(test_msg->interfaces) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->interfaces[0]); - } - test_msg->interfaces[3].duration = 2159176030; - { - const char assign_string[] = {(char)108, (char)111, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->interfaces[3].interface_name, assign_string, - sizeof(assign_string)); - if (sizeof(test_msg->interfaces[3].interface_name) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->interfaces[3].rx_bytes = 0; - test_msg->interfaces[3].total_bytes = 0; - test_msg->interfaces[3].tx_bytes = 0; - if (sizeof(test_msg->interfaces) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->interfaces[0]); - } - test_msg->interfaces[4].duration = 2159176030; - { - const char assign_string[] = {(char)115, (char)105, (char)116, (char)48, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->interfaces[4].interface_name, assign_string, - sizeof(assign_string)); - if (sizeof(test_msg->interfaces[4].interface_name) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->interfaces[4].rx_bytes = 0; - test_msg->interfaces[4].total_bytes = 0; - test_msg->interfaces[4].tx_bytes = 0; - sbp_payload_send(&sbp_state, 0xBD, 31183, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 31183, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 31183, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xBD, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_network_bandwidth_usage_t *check_msg = - (msg_network_bandwidth_usage_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->interfaces[0].duration == 2159176030, - "incorrect value for interfaces[0].duration, expected " - "2159176030, is %d", - check_msg->interfaces[0].duration); - { - const char check_string[] = {(char)99, (char)97, (char)110, (char)48, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->interfaces[0].interface_name, check_string, - sizeof(check_string)) == 0, - "incorrect value for check_msg->interfaces[0].interface_name, " - "expected string '%s', is '%s'", - check_string, check_msg->interfaces[0].interface_name); - } - ck_assert_msg( - check_msg->interfaces[0].rx_bytes == 0, - "incorrect value for interfaces[0].rx_bytes, expected 0, is %d", - check_msg->interfaces[0].rx_bytes); - ck_assert_msg( - check_msg->interfaces[0].total_bytes == 0, - "incorrect value for interfaces[0].total_bytes, expected 0, is %d", - check_msg->interfaces[0].total_bytes); - ck_assert_msg( - check_msg->interfaces[0].tx_bytes == 0, - "incorrect value for interfaces[0].tx_bytes, expected 0, is %d", - check_msg->interfaces[0].tx_bytes); - ck_assert_msg(check_msg->interfaces[1].duration == 2159176030, - "incorrect value for interfaces[1].duration, expected " - "2159176030, is %d", - check_msg->interfaces[1].duration); - { - const char check_string[] = {(char)99, (char)97, (char)110, (char)49, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->interfaces[1].interface_name, check_string, - sizeof(check_string)) == 0, - "incorrect value for check_msg->interfaces[1].interface_name, " - "expected string '%s', is '%s'", - check_string, check_msg->interfaces[1].interface_name); - } - ck_assert_msg( - check_msg->interfaces[1].rx_bytes == 0, - "incorrect value for interfaces[1].rx_bytes, expected 0, is %d", - check_msg->interfaces[1].rx_bytes); - ck_assert_msg( - check_msg->interfaces[1].total_bytes == 0, - "incorrect value for interfaces[1].total_bytes, expected 0, is %d", - check_msg->interfaces[1].total_bytes); - ck_assert_msg( - check_msg->interfaces[1].tx_bytes == 0, - "incorrect value for interfaces[1].tx_bytes, expected 0, is %d", - check_msg->interfaces[1].tx_bytes); - ck_assert_msg(check_msg->interfaces[2].duration == 2159176030, - "incorrect value for interfaces[2].duration, expected " - "2159176030, is %d", - check_msg->interfaces[2].duration); - { - const char check_string[] = {(char)101, (char)116, (char)104, (char)48, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->interfaces[2].interface_name, check_string, - sizeof(check_string)) == 0, - "incorrect value for check_msg->interfaces[2].interface_name, " - "expected string '%s', is '%s'", - check_string, check_msg->interfaces[2].interface_name); - } - ck_assert_msg(check_msg->interfaces[2].rx_bytes == 4036234989, - "incorrect value for interfaces[2].rx_bytes, expected " - "4036234989, is %d", - check_msg->interfaces[2].rx_bytes); - ck_assert_msg(check_msg->interfaces[2].total_bytes == 3411995557, - "incorrect value for interfaces[2].total_bytes, expected " - "3411995557, is %d", - check_msg->interfaces[2].total_bytes); - ck_assert_msg(check_msg->interfaces[2].tx_bytes == 3670727864, - "incorrect value for interfaces[2].tx_bytes, expected " - "3670727864, is %d", - check_msg->interfaces[2].tx_bytes); - ck_assert_msg(check_msg->interfaces[3].duration == 2159176030, - "incorrect value for interfaces[3].duration, expected " - "2159176030, is %d", - check_msg->interfaces[3].duration); - { - const char check_string[] = {(char)108, (char)111, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->interfaces[3].interface_name, check_string, - sizeof(check_string)) == 0, - "incorrect value for check_msg->interfaces[3].interface_name, " - "expected string '%s', is '%s'", - check_string, check_msg->interfaces[3].interface_name); - } - ck_assert_msg( - check_msg->interfaces[3].rx_bytes == 0, - "incorrect value for interfaces[3].rx_bytes, expected 0, is %d", - check_msg->interfaces[3].rx_bytes); - ck_assert_msg( - check_msg->interfaces[3].total_bytes == 0, - "incorrect value for interfaces[3].total_bytes, expected 0, is %d", - check_msg->interfaces[3].total_bytes); - ck_assert_msg( - check_msg->interfaces[3].tx_bytes == 0, - "incorrect value for interfaces[3].tx_bytes, expected 0, is %d", - check_msg->interfaces[3].tx_bytes); - ck_assert_msg(check_msg->interfaces[4].duration == 2159176030, - "incorrect value for interfaces[4].duration, expected " - "2159176030, is %d", - check_msg->interfaces[4].duration); - { - const char check_string[] = {(char)115, (char)105, (char)116, (char)48, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->interfaces[4].interface_name, check_string, - sizeof(check_string)) == 0, - "incorrect value for check_msg->interfaces[4].interface_name, " - "expected string '%s', is '%s'", - check_string, check_msg->interfaces[4].interface_name); - } - ck_assert_msg( - check_msg->interfaces[4].rx_bytes == 0, - "incorrect value for interfaces[4].rx_bytes, expected 0, is %d", - check_msg->interfaces[4].rx_bytes); - ck_assert_msg( - check_msg->interfaces[4].total_bytes == 0, - "incorrect value for interfaces[4].total_bytes, expected 0, is %d", - check_msg->interfaces[4].total_bytes); - ck_assert_msg( - check_msg->interfaces[4].tx_bytes == 0, - "incorrect value for interfaces[4].tx_bytes, expected 0, is %d", - check_msg->interfaces[4].tx_bytes); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgNetworkBandwidthUsage_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_piksi_MsgNetworkBandwidthUsage"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_piksi_MsgNetworkBandwidthUsage"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_piksi_MsgNetworkBandwidthUsage); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgNetworkStateReq.c b/c/test/legacy/auto_check_sbp_piksi_MsgNetworkStateReq.c deleted file mode 100644 index 796b0123ab..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgNetworkStateReq.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgNetworkStateReq.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgNetworkStateReq) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xba, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xba, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 186, 0, 83, 62, 0, 148, 73, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - sbp_payload_send(&sbp_state, 0xba, 15955, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 15955, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 15955, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xba, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgNetworkStateReq_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_piksi_MsgNetworkStateReq"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_piksi_MsgNetworkStateReq"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgNetworkStateReq); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgNetworkStateResp.c b/c/test/legacy/auto_check_sbp_piksi_MsgNetworkStateResp.c deleted file mode 100644 index 34f03e9602..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgNetworkStateResp.c +++ /dev/null @@ -1,419 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgNetworkStateResp.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgNetworkStateResp) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xbb, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xbb, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 187, 0, 40, 15, 50, 143, 241, 84, 180, 152, 194, - 137, 32, 44, 114, 147, 68, 222, 92, 192, 78, 235, 63, - 208, 114, 53, 183, 24, 244, 231, 26, 105, 25, 136, 3, - 105, 102, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 195, 229, 80, 147, 118, 193, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_network_state_resp_t *test_msg = - (msg_network_state_resp_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 2471552451; - { - const char assign_string[] = {(char)105, (char)102, (char)48, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->interface_name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->interface_name) == 0) { - test_msg_len += sizeof(assign_string); - } - } - if (sizeof(test_msg->ipv4_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv4_address[0]); - } - test_msg->ipv4_address[0] = 143; - if (sizeof(test_msg->ipv4_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv4_address[0]); - } - test_msg->ipv4_address[1] = 241; - if (sizeof(test_msg->ipv4_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv4_address[0]); - } - test_msg->ipv4_address[2] = 84; - if (sizeof(test_msg->ipv4_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv4_address[0]); - } - test_msg->ipv4_address[3] = 180; - test_msg->ipv4_mask_size = 152; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv6_address[0]); - } - test_msg->ipv6_address[0] = 194; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv6_address[0]); - } - test_msg->ipv6_address[1] = 137; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv6_address[0]); - } - test_msg->ipv6_address[2] = 32; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv6_address[0]); - } - test_msg->ipv6_address[3] = 44; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv6_address[0]); - } - test_msg->ipv6_address[4] = 114; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv6_address[0]); - } - test_msg->ipv6_address[5] = 147; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv6_address[0]); - } - test_msg->ipv6_address[6] = 68; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv6_address[0]); - } - test_msg->ipv6_address[7] = 222; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv6_address[0]); - } - test_msg->ipv6_address[8] = 92; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv6_address[0]); - } - test_msg->ipv6_address[9] = 192; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv6_address[0]); - } - test_msg->ipv6_address[10] = 78; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv6_address[0]); - } - test_msg->ipv6_address[11] = 235; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv6_address[0]); - } - test_msg->ipv6_address[12] = 63; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv6_address[0]); - } - test_msg->ipv6_address[13] = 208; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv6_address[0]); - } - test_msg->ipv6_address[14] = 114; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->ipv6_address[0]); - } - test_msg->ipv6_address[15] = 53; - test_msg->ipv6_mask_size = 183; - test_msg->rx_bytes = 451408920; - test_msg->tx_bytes = 59251049; - sbp_payload_send(&sbp_state, 0xbb, 3880, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 3880, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 3880, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xbb, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_network_state_resp_t *check_msg = - (msg_network_state_resp_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 2471552451, - "incorrect value for flags, expected 2471552451, is %d", - check_msg->flags); - { - const char check_string[] = {(char)105, (char)102, (char)48, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg(memcmp(check_msg->interface_name, check_string, - sizeof(check_string)) == 0, - "incorrect value for check_msg->interface_name, expected " - "string '%s', is '%s'", - check_string, check_msg->interface_name); - } - ck_assert_msg(check_msg->ipv4_address[0] == 143, - "incorrect value for ipv4_address[0], expected 143, is %d", - check_msg->ipv4_address[0]); - ck_assert_msg(check_msg->ipv4_address[1] == 241, - "incorrect value for ipv4_address[1], expected 241, is %d", - check_msg->ipv4_address[1]); - ck_assert_msg(check_msg->ipv4_address[2] == 84, - "incorrect value for ipv4_address[2], expected 84, is %d", - check_msg->ipv4_address[2]); - ck_assert_msg(check_msg->ipv4_address[3] == 180, - "incorrect value for ipv4_address[3], expected 180, is %d", - check_msg->ipv4_address[3]); - ck_assert_msg(check_msg->ipv4_mask_size == 152, - "incorrect value for ipv4_mask_size, expected 152, is %d", - check_msg->ipv4_mask_size); - ck_assert_msg(check_msg->ipv6_address[0] == 194, - "incorrect value for ipv6_address[0], expected 194, is %d", - check_msg->ipv6_address[0]); - ck_assert_msg(check_msg->ipv6_address[1] == 137, - "incorrect value for ipv6_address[1], expected 137, is %d", - check_msg->ipv6_address[1]); - ck_assert_msg(check_msg->ipv6_address[2] == 32, - "incorrect value for ipv6_address[2], expected 32, is %d", - check_msg->ipv6_address[2]); - ck_assert_msg(check_msg->ipv6_address[3] == 44, - "incorrect value for ipv6_address[3], expected 44, is %d", - check_msg->ipv6_address[3]); - ck_assert_msg(check_msg->ipv6_address[4] == 114, - "incorrect value for ipv6_address[4], expected 114, is %d", - check_msg->ipv6_address[4]); - ck_assert_msg(check_msg->ipv6_address[5] == 147, - "incorrect value for ipv6_address[5], expected 147, is %d", - check_msg->ipv6_address[5]); - ck_assert_msg(check_msg->ipv6_address[6] == 68, - "incorrect value for ipv6_address[6], expected 68, is %d", - check_msg->ipv6_address[6]); - ck_assert_msg(check_msg->ipv6_address[7] == 222, - "incorrect value for ipv6_address[7], expected 222, is %d", - check_msg->ipv6_address[7]); - ck_assert_msg(check_msg->ipv6_address[8] == 92, - "incorrect value for ipv6_address[8], expected 92, is %d", - check_msg->ipv6_address[8]); - ck_assert_msg(check_msg->ipv6_address[9] == 192, - "incorrect value for ipv6_address[9], expected 192, is %d", - check_msg->ipv6_address[9]); - ck_assert_msg(check_msg->ipv6_address[10] == 78, - "incorrect value for ipv6_address[10], expected 78, is %d", - check_msg->ipv6_address[10]); - ck_assert_msg(check_msg->ipv6_address[11] == 235, - "incorrect value for ipv6_address[11], expected 235, is %d", - check_msg->ipv6_address[11]); - ck_assert_msg(check_msg->ipv6_address[12] == 63, - "incorrect value for ipv6_address[12], expected 63, is %d", - check_msg->ipv6_address[12]); - ck_assert_msg(check_msg->ipv6_address[13] == 208, - "incorrect value for ipv6_address[13], expected 208, is %d", - check_msg->ipv6_address[13]); - ck_assert_msg(check_msg->ipv6_address[14] == 114, - "incorrect value for ipv6_address[14], expected 114, is %d", - check_msg->ipv6_address[14]); - ck_assert_msg(check_msg->ipv6_address[15] == 53, - "incorrect value for ipv6_address[15], expected 53, is %d", - check_msg->ipv6_address[15]); - ck_assert_msg(check_msg->ipv6_mask_size == 183, - "incorrect value for ipv6_mask_size, expected 183, is %d", - check_msg->ipv6_mask_size); - ck_assert_msg(check_msg->rx_bytes == 451408920, - "incorrect value for rx_bytes, expected 451408920, is %d", - check_msg->rx_bytes); - ck_assert_msg(check_msg->tx_bytes == 59251049, - "incorrect value for tx_bytes, expected 59251049, is %d", - check_msg->tx_bytes); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgNetworkStateResp_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_piksi_MsgNetworkStateResp"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_piksi_MsgNetworkStateResp"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgNetworkStateResp); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgReset.c b/c/test/legacy/auto_check_sbp_piksi_MsgReset.c deleted file mode 100644 index a110933a6c..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgReset.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgReset.yaml by generate.py. Do not -// modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgReset) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xb6, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xb6, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 182, 0, 63, 210, 4, 88, 248, 238, 19, 74, 207, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_reset_t *test_msg = (msg_reset_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 334428248; - sbp_payload_send(&sbp_state, 0xb6, 53823, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 53823, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 53823, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xb6, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_reset_t *check_msg = (msg_reset_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 334428248, - "incorrect value for flags, expected 334428248, is %d", - check_msg->flags); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgReset_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgReset"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_piksi_MsgReset"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgReset); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgResetDep.c b/c/test/legacy/auto_check_sbp_piksi_MsgResetDep.c deleted file mode 100644 index f1439b3e62..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgResetDep.c +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgResetDep.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgResetDep) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xb2, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xb2, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 178, 0, 64, 11, 0, 234, 171, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - sbp_payload_send(&sbp_state, 0xb2, 2880, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 2880, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 2880, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xb2, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgResetDep_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgResetDep"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_piksi_MsgResetDep"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgResetDep); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgResetFilters.c b/c/test/legacy/auto_check_sbp_piksi_MsgResetFilters.c deleted file mode 100644 index db561228e6..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgResetFilters.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgResetFilters.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgResetFilters) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x22, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x22, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 34, 0, 81, 200, 1, 100, 130, 45, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_reset_filters_t *test_msg = (msg_reset_filters_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->filter = 100; - sbp_payload_send(&sbp_state, 0x22, 51281, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 51281, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 51281, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x22, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_reset_filters_t *check_msg = - (msg_reset_filters_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->filter == 100, - "incorrect value for filter, expected 100, is %d", - check_msg->filter); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgResetFilters_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgResetFilters"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_piksi_MsgResetFilters"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgResetFilters); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgSetTime.c b/c/test/legacy/auto_check_sbp_piksi_MsgSetTime.c deleted file mode 100644 index 5559eb5184..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgSetTime.c +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgSetTime.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgSetTime) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x68, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x68, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 104, 0, 21, 170, 0, 215, 65, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - sbp_payload_send(&sbp_state, 0x68, 43541, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 43541, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 43541, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x68, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgSetTime_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgSetTime"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_piksi_MsgSetTime"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgSetTime); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgSpecan.c b/c/test/legacy/auto_check_sbp_piksi_MsgSpecan.c deleted file mode 100644 index 6b729e1aaa..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgSpecan.c +++ /dev/null @@ -1,2259 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgSpecan.yaml by generate.py. Do not -// modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgSpecan) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x51, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x51, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 81, 0, 28, 212, 255, 74, 137, 71, 245, 34, 73, 12, 221, - 215, 167, 211, 19, 154, 201, 241, 69, 205, 136, 0, 70, 51, 67, - 108, 69, 102, 38, 166, 68, 100, 179, 185, 17, 175, 49, 193, 228, - 228, 47, 33, 24, 141, 177, 18, 99, 246, 121, 61, 40, 91, 145, - 223, 167, 174, 9, 116, 11, 247, 84, 49, 153, 205, 2, 230, 194, - 218, 241, 101, 107, 45, 137, 93, 114, 230, 43, 224, 23, 74, 209, - 199, 211, 130, 89, 220, 163, 68, 20, 253, 7, 206, 50, 129, 116, - 194, 23, 31, 226, 217, 157, 205, 221, 5, 224, 92, 82, 109, 223, - 195, 233, 165, 1, 82, 141, 157, 177, 169, 244, 131, 96, 109, 111, - 253, 149, 28, 225, 225, 72, 158, 158, 210, 196, 206, 70, 63, 225, - 184, 150, 174, 240, 45, 146, 59, 82, 194, 4, 179, 148, 66, 254, - 115, 77, 30, 46, 4, 204, 37, 200, 121, 18, 17, 171, 102, 163, - 175, 50, 66, 101, 69, 13, 223, 172, 160, 233, 220, 101, 237, 156, - 62, 117, 47, 143, 94, 135, 22, 155, 113, 110, 15, 243, 141, 227, - 46, 143, 227, 209, 249, 2, 153, 168, 131, 249, 160, 88, 38, 117, - 129, 57, 40, 109, 209, 177, 38, 47, 12, 15, 16, 9, 175, 69, - 70, 182, 239, 117, 135, 6, 71, 99, 230, 115, 2, 71, 165, 228, - 123, 210, 168, 90, 124, 20, 7, 220, 144, 168, 69, 22, 72, 162, - 69, 111, 91, 251, 72, 220, 28, 119, 150, 95, 2, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_specan_t *test_msg = (msg_specan_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->amplitude_ref = 3780.199951171875; - test_msg->amplitude_unit = 1329.199951171875; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[0] = 100; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[1] = 179; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[2] = 185; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[3] = 17; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[4] = 175; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[5] = 49; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[6] = 193; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[7] = 228; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[8] = 228; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[9] = 47; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[10] = 33; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[11] = 24; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[12] = 141; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[13] = 177; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[14] = 18; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[15] = 99; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[16] = 246; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[17] = 121; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[18] = 61; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[19] = 40; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[20] = 91; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[21] = 145; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[22] = 223; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[23] = 167; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[24] = 174; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[25] = 9; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[26] = 116; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[27] = 11; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[28] = 247; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[29] = 84; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[30] = 49; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[31] = 153; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[32] = 205; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[33] = 2; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[34] = 230; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[35] = 194; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[36] = 218; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[37] = 241; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[38] = 101; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[39] = 107; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[40] = 45; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[41] = 137; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[42] = 93; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[43] = 114; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[44] = 230; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[45] = 43; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[46] = 224; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[47] = 23; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[48] = 74; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[49] = 209; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[50] = 199; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[51] = 211; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[52] = 130; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[53] = 89; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[54] = 220; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[55] = 163; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[56] = 68; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[57] = 20; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[58] = 253; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[59] = 7; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[60] = 206; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[61] = 50; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[62] = 129; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[63] = 116; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[64] = 194; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[65] = 23; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[66] = 31; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[67] = 226; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[68] = 217; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[69] = 157; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[70] = 205; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[71] = 221; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[72] = 5; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[73] = 224; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[74] = 92; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[75] = 82; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[76] = 109; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[77] = 223; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[78] = 195; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[79] = 233; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[80] = 165; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[81] = 1; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[82] = 82; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[83] = 141; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[84] = 157; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[85] = 177; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[86] = 169; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[87] = 244; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[88] = 131; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[89] = 96; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[90] = 109; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[91] = 111; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[92] = 253; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[93] = 149; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[94] = 28; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[95] = 225; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[96] = 225; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[97] = 72; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[98] = 158; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[99] = 158; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[100] = 210; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[101] = 196; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[102] = 206; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[103] = 70; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[104] = 63; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[105] = 225; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[106] = 184; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[107] = 150; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[108] = 174; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[109] = 240; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[110] = 45; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[111] = 146; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[112] = 59; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[113] = 82; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[114] = 194; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[115] = 4; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[116] = 179; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[117] = 148; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[118] = 66; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[119] = 254; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[120] = 115; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[121] = 77; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[122] = 30; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[123] = 46; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[124] = 4; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[125] = 204; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[126] = 37; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[127] = 200; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[128] = 121; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[129] = 18; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[130] = 17; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[131] = 171; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[132] = 102; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[133] = 163; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[134] = 175; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[135] = 50; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[136] = 66; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[137] = 101; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[138] = 69; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[139] = 13; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[140] = 223; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[141] = 172; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[142] = 160; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[143] = 233; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[144] = 220; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[145] = 101; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[146] = 237; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[147] = 156; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[148] = 62; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[149] = 117; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[150] = 47; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[151] = 143; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[152] = 94; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[153] = 135; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[154] = 22; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[155] = 155; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[156] = 113; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[157] = 110; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[158] = 15; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[159] = 243; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[160] = 141; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[161] = 227; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[162] = 46; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[163] = 143; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[164] = 227; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[165] = 209; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[166] = 249; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[167] = 2; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[168] = 153; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[169] = 168; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[170] = 131; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[171] = 249; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[172] = 160; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[173] = 88; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[174] = 38; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[175] = 117; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[176] = 129; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[177] = 57; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[178] = 40; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[179] = 109; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[180] = 209; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[181] = 177; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[182] = 38; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[183] = 47; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[184] = 12; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[185] = 15; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[186] = 16; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[187] = 9; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[188] = 175; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[189] = 69; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[190] = 70; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[191] = 182; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[192] = 239; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[193] = 117; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[194] = 135; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[195] = 6; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[196] = 71; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[197] = 99; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[198] = 230; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[199] = 115; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[200] = 2; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[201] = 71; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[202] = 165; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[203] = 228; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[204] = 123; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[205] = 210; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[206] = 168; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[207] = 90; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[208] = 124; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[209] = 20; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[210] = 7; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[211] = 220; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[212] = 144; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[213] = 168; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[214] = 69; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[215] = 22; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[216] = 72; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[217] = 162; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[218] = 69; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[219] = 111; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[220] = 91; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[221] = 251; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[222] = 72; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[223] = 220; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[224] = 28; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[225] = 119; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[226] = 150; - test_msg->channel_tag = 35146; - test_msg->freq_ref = 7737.2001953125; - test_msg->freq_step = 8226.2001953125; - test_msg->t.ns_residual = -1479025396; - test_msg->t.tow = 1227027783; - test_msg->t.wn = 5075; - sbp_payload_send(&sbp_state, 0x51, 54300, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 54300, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 54300, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x51, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_specan_t *check_msg = (msg_specan_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->amplitude_ref * 100 - 3780.19995117 * 100) < 0.05, - "incorrect value for amplitude_ref, expected 3780.19995117, is %f", - check_msg->amplitude_ref); - ck_assert_msg( - (check_msg->amplitude_unit * 100 - 1329.19995117 * 100) < 0.05, - "incorrect value for amplitude_unit, expected 1329.19995117, is %f", - check_msg->amplitude_unit); - ck_assert_msg(check_msg->amplitude_value[0] == 100, - "incorrect value for amplitude_value[0], expected 100, is %d", - check_msg->amplitude_value[0]); - ck_assert_msg(check_msg->amplitude_value[1] == 179, - "incorrect value for amplitude_value[1], expected 179, is %d", - check_msg->amplitude_value[1]); - ck_assert_msg(check_msg->amplitude_value[2] == 185, - "incorrect value for amplitude_value[2], expected 185, is %d", - check_msg->amplitude_value[2]); - ck_assert_msg(check_msg->amplitude_value[3] == 17, - "incorrect value for amplitude_value[3], expected 17, is %d", - check_msg->amplitude_value[3]); - ck_assert_msg(check_msg->amplitude_value[4] == 175, - "incorrect value for amplitude_value[4], expected 175, is %d", - check_msg->amplitude_value[4]); - ck_assert_msg(check_msg->amplitude_value[5] == 49, - "incorrect value for amplitude_value[5], expected 49, is %d", - check_msg->amplitude_value[5]); - ck_assert_msg(check_msg->amplitude_value[6] == 193, - "incorrect value for amplitude_value[6], expected 193, is %d", - check_msg->amplitude_value[6]); - ck_assert_msg(check_msg->amplitude_value[7] == 228, - "incorrect value for amplitude_value[7], expected 228, is %d", - check_msg->amplitude_value[7]); - ck_assert_msg(check_msg->amplitude_value[8] == 228, - "incorrect value for amplitude_value[8], expected 228, is %d", - check_msg->amplitude_value[8]); - ck_assert_msg(check_msg->amplitude_value[9] == 47, - "incorrect value for amplitude_value[9], expected 47, is %d", - check_msg->amplitude_value[9]); - ck_assert_msg(check_msg->amplitude_value[10] == 33, - "incorrect value for amplitude_value[10], expected 33, is %d", - check_msg->amplitude_value[10]); - ck_assert_msg(check_msg->amplitude_value[11] == 24, - "incorrect value for amplitude_value[11], expected 24, is %d", - check_msg->amplitude_value[11]); - ck_assert_msg( - check_msg->amplitude_value[12] == 141, - "incorrect value for amplitude_value[12], expected 141, is %d", - check_msg->amplitude_value[12]); - ck_assert_msg( - check_msg->amplitude_value[13] == 177, - "incorrect value for amplitude_value[13], expected 177, is %d", - check_msg->amplitude_value[13]); - ck_assert_msg(check_msg->amplitude_value[14] == 18, - "incorrect value for amplitude_value[14], expected 18, is %d", - check_msg->amplitude_value[14]); - ck_assert_msg(check_msg->amplitude_value[15] == 99, - "incorrect value for amplitude_value[15], expected 99, is %d", - check_msg->amplitude_value[15]); - ck_assert_msg( - check_msg->amplitude_value[16] == 246, - "incorrect value for amplitude_value[16], expected 246, is %d", - check_msg->amplitude_value[16]); - ck_assert_msg( - check_msg->amplitude_value[17] == 121, - "incorrect value for amplitude_value[17], expected 121, is %d", - check_msg->amplitude_value[17]); - ck_assert_msg(check_msg->amplitude_value[18] == 61, - "incorrect value for amplitude_value[18], expected 61, is %d", - check_msg->amplitude_value[18]); - ck_assert_msg(check_msg->amplitude_value[19] == 40, - "incorrect value for amplitude_value[19], expected 40, is %d", - check_msg->amplitude_value[19]); - ck_assert_msg(check_msg->amplitude_value[20] == 91, - "incorrect value for amplitude_value[20], expected 91, is %d", - check_msg->amplitude_value[20]); - ck_assert_msg( - check_msg->amplitude_value[21] == 145, - "incorrect value for amplitude_value[21], expected 145, is %d", - check_msg->amplitude_value[21]); - ck_assert_msg( - check_msg->amplitude_value[22] == 223, - "incorrect value for amplitude_value[22], expected 223, is %d", - check_msg->amplitude_value[22]); - ck_assert_msg( - check_msg->amplitude_value[23] == 167, - "incorrect value for amplitude_value[23], expected 167, is %d", - check_msg->amplitude_value[23]); - ck_assert_msg( - check_msg->amplitude_value[24] == 174, - "incorrect value for amplitude_value[24], expected 174, is %d", - check_msg->amplitude_value[24]); - ck_assert_msg(check_msg->amplitude_value[25] == 9, - "incorrect value for amplitude_value[25], expected 9, is %d", - check_msg->amplitude_value[25]); - ck_assert_msg( - check_msg->amplitude_value[26] == 116, - "incorrect value for amplitude_value[26], expected 116, is %d", - check_msg->amplitude_value[26]); - ck_assert_msg(check_msg->amplitude_value[27] == 11, - "incorrect value for amplitude_value[27], expected 11, is %d", - check_msg->amplitude_value[27]); - ck_assert_msg( - check_msg->amplitude_value[28] == 247, - "incorrect value for amplitude_value[28], expected 247, is %d", - check_msg->amplitude_value[28]); - ck_assert_msg(check_msg->amplitude_value[29] == 84, - "incorrect value for amplitude_value[29], expected 84, is %d", - check_msg->amplitude_value[29]); - ck_assert_msg(check_msg->amplitude_value[30] == 49, - "incorrect value for amplitude_value[30], expected 49, is %d", - check_msg->amplitude_value[30]); - ck_assert_msg( - check_msg->amplitude_value[31] == 153, - "incorrect value for amplitude_value[31], expected 153, is %d", - check_msg->amplitude_value[31]); - ck_assert_msg( - check_msg->amplitude_value[32] == 205, - "incorrect value for amplitude_value[32], expected 205, is %d", - check_msg->amplitude_value[32]); - ck_assert_msg(check_msg->amplitude_value[33] == 2, - "incorrect value for amplitude_value[33], expected 2, is %d", - check_msg->amplitude_value[33]); - ck_assert_msg( - check_msg->amplitude_value[34] == 230, - "incorrect value for amplitude_value[34], expected 230, is %d", - check_msg->amplitude_value[34]); - ck_assert_msg( - check_msg->amplitude_value[35] == 194, - "incorrect value for amplitude_value[35], expected 194, is %d", - check_msg->amplitude_value[35]); - ck_assert_msg( - check_msg->amplitude_value[36] == 218, - "incorrect value for amplitude_value[36], expected 218, is %d", - check_msg->amplitude_value[36]); - ck_assert_msg( - check_msg->amplitude_value[37] == 241, - "incorrect value for amplitude_value[37], expected 241, is %d", - check_msg->amplitude_value[37]); - ck_assert_msg( - check_msg->amplitude_value[38] == 101, - "incorrect value for amplitude_value[38], expected 101, is %d", - check_msg->amplitude_value[38]); - ck_assert_msg( - check_msg->amplitude_value[39] == 107, - "incorrect value for amplitude_value[39], expected 107, is %d", - check_msg->amplitude_value[39]); - ck_assert_msg(check_msg->amplitude_value[40] == 45, - "incorrect value for amplitude_value[40], expected 45, is %d", - check_msg->amplitude_value[40]); - ck_assert_msg( - check_msg->amplitude_value[41] == 137, - "incorrect value for amplitude_value[41], expected 137, is %d", - check_msg->amplitude_value[41]); - ck_assert_msg(check_msg->amplitude_value[42] == 93, - "incorrect value for amplitude_value[42], expected 93, is %d", - check_msg->amplitude_value[42]); - ck_assert_msg( - check_msg->amplitude_value[43] == 114, - "incorrect value for amplitude_value[43], expected 114, is %d", - check_msg->amplitude_value[43]); - ck_assert_msg( - check_msg->amplitude_value[44] == 230, - "incorrect value for amplitude_value[44], expected 230, is %d", - check_msg->amplitude_value[44]); - ck_assert_msg(check_msg->amplitude_value[45] == 43, - "incorrect value for amplitude_value[45], expected 43, is %d", - check_msg->amplitude_value[45]); - ck_assert_msg( - check_msg->amplitude_value[46] == 224, - "incorrect value for amplitude_value[46], expected 224, is %d", - check_msg->amplitude_value[46]); - ck_assert_msg(check_msg->amplitude_value[47] == 23, - "incorrect value for amplitude_value[47], expected 23, is %d", - check_msg->amplitude_value[47]); - ck_assert_msg(check_msg->amplitude_value[48] == 74, - "incorrect value for amplitude_value[48], expected 74, is %d", - check_msg->amplitude_value[48]); - ck_assert_msg( - check_msg->amplitude_value[49] == 209, - "incorrect value for amplitude_value[49], expected 209, is %d", - check_msg->amplitude_value[49]); - ck_assert_msg( - check_msg->amplitude_value[50] == 199, - "incorrect value for amplitude_value[50], expected 199, is %d", - check_msg->amplitude_value[50]); - ck_assert_msg( - check_msg->amplitude_value[51] == 211, - "incorrect value for amplitude_value[51], expected 211, is %d", - check_msg->amplitude_value[51]); - ck_assert_msg( - check_msg->amplitude_value[52] == 130, - "incorrect value for amplitude_value[52], expected 130, is %d", - check_msg->amplitude_value[52]); - ck_assert_msg(check_msg->amplitude_value[53] == 89, - "incorrect value for amplitude_value[53], expected 89, is %d", - check_msg->amplitude_value[53]); - ck_assert_msg( - check_msg->amplitude_value[54] == 220, - "incorrect value for amplitude_value[54], expected 220, is %d", - check_msg->amplitude_value[54]); - ck_assert_msg( - check_msg->amplitude_value[55] == 163, - "incorrect value for amplitude_value[55], expected 163, is %d", - check_msg->amplitude_value[55]); - ck_assert_msg(check_msg->amplitude_value[56] == 68, - "incorrect value for amplitude_value[56], expected 68, is %d", - check_msg->amplitude_value[56]); - ck_assert_msg(check_msg->amplitude_value[57] == 20, - "incorrect value for amplitude_value[57], expected 20, is %d", - check_msg->amplitude_value[57]); - ck_assert_msg( - check_msg->amplitude_value[58] == 253, - "incorrect value for amplitude_value[58], expected 253, is %d", - check_msg->amplitude_value[58]); - ck_assert_msg(check_msg->amplitude_value[59] == 7, - "incorrect value for amplitude_value[59], expected 7, is %d", - check_msg->amplitude_value[59]); - ck_assert_msg( - check_msg->amplitude_value[60] == 206, - "incorrect value for amplitude_value[60], expected 206, is %d", - check_msg->amplitude_value[60]); - ck_assert_msg(check_msg->amplitude_value[61] == 50, - "incorrect value for amplitude_value[61], expected 50, is %d", - check_msg->amplitude_value[61]); - ck_assert_msg( - check_msg->amplitude_value[62] == 129, - "incorrect value for amplitude_value[62], expected 129, is %d", - check_msg->amplitude_value[62]); - ck_assert_msg( - check_msg->amplitude_value[63] == 116, - "incorrect value for amplitude_value[63], expected 116, is %d", - check_msg->amplitude_value[63]); - ck_assert_msg( - check_msg->amplitude_value[64] == 194, - "incorrect value for amplitude_value[64], expected 194, is %d", - check_msg->amplitude_value[64]); - ck_assert_msg(check_msg->amplitude_value[65] == 23, - "incorrect value for amplitude_value[65], expected 23, is %d", - check_msg->amplitude_value[65]); - ck_assert_msg(check_msg->amplitude_value[66] == 31, - "incorrect value for amplitude_value[66], expected 31, is %d", - check_msg->amplitude_value[66]); - ck_assert_msg( - check_msg->amplitude_value[67] == 226, - "incorrect value for amplitude_value[67], expected 226, is %d", - check_msg->amplitude_value[67]); - ck_assert_msg( - check_msg->amplitude_value[68] == 217, - "incorrect value for amplitude_value[68], expected 217, is %d", - check_msg->amplitude_value[68]); - ck_assert_msg( - check_msg->amplitude_value[69] == 157, - "incorrect value for amplitude_value[69], expected 157, is %d", - check_msg->amplitude_value[69]); - ck_assert_msg( - check_msg->amplitude_value[70] == 205, - "incorrect value for amplitude_value[70], expected 205, is %d", - check_msg->amplitude_value[70]); - ck_assert_msg( - check_msg->amplitude_value[71] == 221, - "incorrect value for amplitude_value[71], expected 221, is %d", - check_msg->amplitude_value[71]); - ck_assert_msg(check_msg->amplitude_value[72] == 5, - "incorrect value for amplitude_value[72], expected 5, is %d", - check_msg->amplitude_value[72]); - ck_assert_msg( - check_msg->amplitude_value[73] == 224, - "incorrect value for amplitude_value[73], expected 224, is %d", - check_msg->amplitude_value[73]); - ck_assert_msg(check_msg->amplitude_value[74] == 92, - "incorrect value for amplitude_value[74], expected 92, is %d", - check_msg->amplitude_value[74]); - ck_assert_msg(check_msg->amplitude_value[75] == 82, - "incorrect value for amplitude_value[75], expected 82, is %d", - check_msg->amplitude_value[75]); - ck_assert_msg( - check_msg->amplitude_value[76] == 109, - "incorrect value for amplitude_value[76], expected 109, is %d", - check_msg->amplitude_value[76]); - ck_assert_msg( - check_msg->amplitude_value[77] == 223, - "incorrect value for amplitude_value[77], expected 223, is %d", - check_msg->amplitude_value[77]); - ck_assert_msg( - check_msg->amplitude_value[78] == 195, - "incorrect value for amplitude_value[78], expected 195, is %d", - check_msg->amplitude_value[78]); - ck_assert_msg( - check_msg->amplitude_value[79] == 233, - "incorrect value for amplitude_value[79], expected 233, is %d", - check_msg->amplitude_value[79]); - ck_assert_msg( - check_msg->amplitude_value[80] == 165, - "incorrect value for amplitude_value[80], expected 165, is %d", - check_msg->amplitude_value[80]); - ck_assert_msg(check_msg->amplitude_value[81] == 1, - "incorrect value for amplitude_value[81], expected 1, is %d", - check_msg->amplitude_value[81]); - ck_assert_msg(check_msg->amplitude_value[82] == 82, - "incorrect value for amplitude_value[82], expected 82, is %d", - check_msg->amplitude_value[82]); - ck_assert_msg( - check_msg->amplitude_value[83] == 141, - "incorrect value for amplitude_value[83], expected 141, is %d", - check_msg->amplitude_value[83]); - ck_assert_msg( - check_msg->amplitude_value[84] == 157, - "incorrect value for amplitude_value[84], expected 157, is %d", - check_msg->amplitude_value[84]); - ck_assert_msg( - check_msg->amplitude_value[85] == 177, - "incorrect value for amplitude_value[85], expected 177, is %d", - check_msg->amplitude_value[85]); - ck_assert_msg( - check_msg->amplitude_value[86] == 169, - "incorrect value for amplitude_value[86], expected 169, is %d", - check_msg->amplitude_value[86]); - ck_assert_msg( - check_msg->amplitude_value[87] == 244, - "incorrect value for amplitude_value[87], expected 244, is %d", - check_msg->amplitude_value[87]); - ck_assert_msg( - check_msg->amplitude_value[88] == 131, - "incorrect value for amplitude_value[88], expected 131, is %d", - check_msg->amplitude_value[88]); - ck_assert_msg(check_msg->amplitude_value[89] == 96, - "incorrect value for amplitude_value[89], expected 96, is %d", - check_msg->amplitude_value[89]); - ck_assert_msg( - check_msg->amplitude_value[90] == 109, - "incorrect value for amplitude_value[90], expected 109, is %d", - check_msg->amplitude_value[90]); - ck_assert_msg( - check_msg->amplitude_value[91] == 111, - "incorrect value for amplitude_value[91], expected 111, is %d", - check_msg->amplitude_value[91]); - ck_assert_msg( - check_msg->amplitude_value[92] == 253, - "incorrect value for amplitude_value[92], expected 253, is %d", - check_msg->amplitude_value[92]); - ck_assert_msg( - check_msg->amplitude_value[93] == 149, - "incorrect value for amplitude_value[93], expected 149, is %d", - check_msg->amplitude_value[93]); - ck_assert_msg(check_msg->amplitude_value[94] == 28, - "incorrect value for amplitude_value[94], expected 28, is %d", - check_msg->amplitude_value[94]); - ck_assert_msg( - check_msg->amplitude_value[95] == 225, - "incorrect value for amplitude_value[95], expected 225, is %d", - check_msg->amplitude_value[95]); - ck_assert_msg( - check_msg->amplitude_value[96] == 225, - "incorrect value for amplitude_value[96], expected 225, is %d", - check_msg->amplitude_value[96]); - ck_assert_msg(check_msg->amplitude_value[97] == 72, - "incorrect value for amplitude_value[97], expected 72, is %d", - check_msg->amplitude_value[97]); - ck_assert_msg( - check_msg->amplitude_value[98] == 158, - "incorrect value for amplitude_value[98], expected 158, is %d", - check_msg->amplitude_value[98]); - ck_assert_msg( - check_msg->amplitude_value[99] == 158, - "incorrect value for amplitude_value[99], expected 158, is %d", - check_msg->amplitude_value[99]); - ck_assert_msg( - check_msg->amplitude_value[100] == 210, - "incorrect value for amplitude_value[100], expected 210, is %d", - check_msg->amplitude_value[100]); - ck_assert_msg( - check_msg->amplitude_value[101] == 196, - "incorrect value for amplitude_value[101], expected 196, is %d", - check_msg->amplitude_value[101]); - ck_assert_msg( - check_msg->amplitude_value[102] == 206, - "incorrect value for amplitude_value[102], expected 206, is %d", - check_msg->amplitude_value[102]); - ck_assert_msg( - check_msg->amplitude_value[103] == 70, - "incorrect value for amplitude_value[103], expected 70, is %d", - check_msg->amplitude_value[103]); - ck_assert_msg( - check_msg->amplitude_value[104] == 63, - "incorrect value for amplitude_value[104], expected 63, is %d", - check_msg->amplitude_value[104]); - ck_assert_msg( - check_msg->amplitude_value[105] == 225, - "incorrect value for amplitude_value[105], expected 225, is %d", - check_msg->amplitude_value[105]); - ck_assert_msg( - check_msg->amplitude_value[106] == 184, - "incorrect value for amplitude_value[106], expected 184, is %d", - check_msg->amplitude_value[106]); - ck_assert_msg( - check_msg->amplitude_value[107] == 150, - "incorrect value for amplitude_value[107], expected 150, is %d", - check_msg->amplitude_value[107]); - ck_assert_msg( - check_msg->amplitude_value[108] == 174, - "incorrect value for amplitude_value[108], expected 174, is %d", - check_msg->amplitude_value[108]); - ck_assert_msg( - check_msg->amplitude_value[109] == 240, - "incorrect value for amplitude_value[109], expected 240, is %d", - check_msg->amplitude_value[109]); - ck_assert_msg( - check_msg->amplitude_value[110] == 45, - "incorrect value for amplitude_value[110], expected 45, is %d", - check_msg->amplitude_value[110]); - ck_assert_msg( - check_msg->amplitude_value[111] == 146, - "incorrect value for amplitude_value[111], expected 146, is %d", - check_msg->amplitude_value[111]); - ck_assert_msg( - check_msg->amplitude_value[112] == 59, - "incorrect value for amplitude_value[112], expected 59, is %d", - check_msg->amplitude_value[112]); - ck_assert_msg( - check_msg->amplitude_value[113] == 82, - "incorrect value for amplitude_value[113], expected 82, is %d", - check_msg->amplitude_value[113]); - ck_assert_msg( - check_msg->amplitude_value[114] == 194, - "incorrect value for amplitude_value[114], expected 194, is %d", - check_msg->amplitude_value[114]); - ck_assert_msg(check_msg->amplitude_value[115] == 4, - "incorrect value for amplitude_value[115], expected 4, is %d", - check_msg->amplitude_value[115]); - ck_assert_msg( - check_msg->amplitude_value[116] == 179, - "incorrect value for amplitude_value[116], expected 179, is %d", - check_msg->amplitude_value[116]); - ck_assert_msg( - check_msg->amplitude_value[117] == 148, - "incorrect value for amplitude_value[117], expected 148, is %d", - check_msg->amplitude_value[117]); - ck_assert_msg( - check_msg->amplitude_value[118] == 66, - "incorrect value for amplitude_value[118], expected 66, is %d", - check_msg->amplitude_value[118]); - ck_assert_msg( - check_msg->amplitude_value[119] == 254, - "incorrect value for amplitude_value[119], expected 254, is %d", - check_msg->amplitude_value[119]); - ck_assert_msg( - check_msg->amplitude_value[120] == 115, - "incorrect value for amplitude_value[120], expected 115, is %d", - check_msg->amplitude_value[120]); - ck_assert_msg( - check_msg->amplitude_value[121] == 77, - "incorrect value for amplitude_value[121], expected 77, is %d", - check_msg->amplitude_value[121]); - ck_assert_msg( - check_msg->amplitude_value[122] == 30, - "incorrect value for amplitude_value[122], expected 30, is %d", - check_msg->amplitude_value[122]); - ck_assert_msg( - check_msg->amplitude_value[123] == 46, - "incorrect value for amplitude_value[123], expected 46, is %d", - check_msg->amplitude_value[123]); - ck_assert_msg(check_msg->amplitude_value[124] == 4, - "incorrect value for amplitude_value[124], expected 4, is %d", - check_msg->amplitude_value[124]); - ck_assert_msg( - check_msg->amplitude_value[125] == 204, - "incorrect value for amplitude_value[125], expected 204, is %d", - check_msg->amplitude_value[125]); - ck_assert_msg( - check_msg->amplitude_value[126] == 37, - "incorrect value for amplitude_value[126], expected 37, is %d", - check_msg->amplitude_value[126]); - ck_assert_msg( - check_msg->amplitude_value[127] == 200, - "incorrect value for amplitude_value[127], expected 200, is %d", - check_msg->amplitude_value[127]); - ck_assert_msg( - check_msg->amplitude_value[128] == 121, - "incorrect value for amplitude_value[128], expected 121, is %d", - check_msg->amplitude_value[128]); - ck_assert_msg( - check_msg->amplitude_value[129] == 18, - "incorrect value for amplitude_value[129], expected 18, is %d", - check_msg->amplitude_value[129]); - ck_assert_msg( - check_msg->amplitude_value[130] == 17, - "incorrect value for amplitude_value[130], expected 17, is %d", - check_msg->amplitude_value[130]); - ck_assert_msg( - check_msg->amplitude_value[131] == 171, - "incorrect value for amplitude_value[131], expected 171, is %d", - check_msg->amplitude_value[131]); - ck_assert_msg( - check_msg->amplitude_value[132] == 102, - "incorrect value for amplitude_value[132], expected 102, is %d", - check_msg->amplitude_value[132]); - ck_assert_msg( - check_msg->amplitude_value[133] == 163, - "incorrect value for amplitude_value[133], expected 163, is %d", - check_msg->amplitude_value[133]); - ck_assert_msg( - check_msg->amplitude_value[134] == 175, - "incorrect value for amplitude_value[134], expected 175, is %d", - check_msg->amplitude_value[134]); - ck_assert_msg( - check_msg->amplitude_value[135] == 50, - "incorrect value for amplitude_value[135], expected 50, is %d", - check_msg->amplitude_value[135]); - ck_assert_msg( - check_msg->amplitude_value[136] == 66, - "incorrect value for amplitude_value[136], expected 66, is %d", - check_msg->amplitude_value[136]); - ck_assert_msg( - check_msg->amplitude_value[137] == 101, - "incorrect value for amplitude_value[137], expected 101, is %d", - check_msg->amplitude_value[137]); - ck_assert_msg( - check_msg->amplitude_value[138] == 69, - "incorrect value for amplitude_value[138], expected 69, is %d", - check_msg->amplitude_value[138]); - ck_assert_msg( - check_msg->amplitude_value[139] == 13, - "incorrect value for amplitude_value[139], expected 13, is %d", - check_msg->amplitude_value[139]); - ck_assert_msg( - check_msg->amplitude_value[140] == 223, - "incorrect value for amplitude_value[140], expected 223, is %d", - check_msg->amplitude_value[140]); - ck_assert_msg( - check_msg->amplitude_value[141] == 172, - "incorrect value for amplitude_value[141], expected 172, is %d", - check_msg->amplitude_value[141]); - ck_assert_msg( - check_msg->amplitude_value[142] == 160, - "incorrect value for amplitude_value[142], expected 160, is %d", - check_msg->amplitude_value[142]); - ck_assert_msg( - check_msg->amplitude_value[143] == 233, - "incorrect value for amplitude_value[143], expected 233, is %d", - check_msg->amplitude_value[143]); - ck_assert_msg( - check_msg->amplitude_value[144] == 220, - "incorrect value for amplitude_value[144], expected 220, is %d", - check_msg->amplitude_value[144]); - ck_assert_msg( - check_msg->amplitude_value[145] == 101, - "incorrect value for amplitude_value[145], expected 101, is %d", - check_msg->amplitude_value[145]); - ck_assert_msg( - check_msg->amplitude_value[146] == 237, - "incorrect value for amplitude_value[146], expected 237, is %d", - check_msg->amplitude_value[146]); - ck_assert_msg( - check_msg->amplitude_value[147] == 156, - "incorrect value for amplitude_value[147], expected 156, is %d", - check_msg->amplitude_value[147]); - ck_assert_msg( - check_msg->amplitude_value[148] == 62, - "incorrect value for amplitude_value[148], expected 62, is %d", - check_msg->amplitude_value[148]); - ck_assert_msg( - check_msg->amplitude_value[149] == 117, - "incorrect value for amplitude_value[149], expected 117, is %d", - check_msg->amplitude_value[149]); - ck_assert_msg( - check_msg->amplitude_value[150] == 47, - "incorrect value for amplitude_value[150], expected 47, is %d", - check_msg->amplitude_value[150]); - ck_assert_msg( - check_msg->amplitude_value[151] == 143, - "incorrect value for amplitude_value[151], expected 143, is %d", - check_msg->amplitude_value[151]); - ck_assert_msg( - check_msg->amplitude_value[152] == 94, - "incorrect value for amplitude_value[152], expected 94, is %d", - check_msg->amplitude_value[152]); - ck_assert_msg( - check_msg->amplitude_value[153] == 135, - "incorrect value for amplitude_value[153], expected 135, is %d", - check_msg->amplitude_value[153]); - ck_assert_msg( - check_msg->amplitude_value[154] == 22, - "incorrect value for amplitude_value[154], expected 22, is %d", - check_msg->amplitude_value[154]); - ck_assert_msg( - check_msg->amplitude_value[155] == 155, - "incorrect value for amplitude_value[155], expected 155, is %d", - check_msg->amplitude_value[155]); - ck_assert_msg( - check_msg->amplitude_value[156] == 113, - "incorrect value for amplitude_value[156], expected 113, is %d", - check_msg->amplitude_value[156]); - ck_assert_msg( - check_msg->amplitude_value[157] == 110, - "incorrect value for amplitude_value[157], expected 110, is %d", - check_msg->amplitude_value[157]); - ck_assert_msg( - check_msg->amplitude_value[158] == 15, - "incorrect value for amplitude_value[158], expected 15, is %d", - check_msg->amplitude_value[158]); - ck_assert_msg( - check_msg->amplitude_value[159] == 243, - "incorrect value for amplitude_value[159], expected 243, is %d", - check_msg->amplitude_value[159]); - ck_assert_msg( - check_msg->amplitude_value[160] == 141, - "incorrect value for amplitude_value[160], expected 141, is %d", - check_msg->amplitude_value[160]); - ck_assert_msg( - check_msg->amplitude_value[161] == 227, - "incorrect value for amplitude_value[161], expected 227, is %d", - check_msg->amplitude_value[161]); - ck_assert_msg( - check_msg->amplitude_value[162] == 46, - "incorrect value for amplitude_value[162], expected 46, is %d", - check_msg->amplitude_value[162]); - ck_assert_msg( - check_msg->amplitude_value[163] == 143, - "incorrect value for amplitude_value[163], expected 143, is %d", - check_msg->amplitude_value[163]); - ck_assert_msg( - check_msg->amplitude_value[164] == 227, - "incorrect value for amplitude_value[164], expected 227, is %d", - check_msg->amplitude_value[164]); - ck_assert_msg( - check_msg->amplitude_value[165] == 209, - "incorrect value for amplitude_value[165], expected 209, is %d", - check_msg->amplitude_value[165]); - ck_assert_msg( - check_msg->amplitude_value[166] == 249, - "incorrect value for amplitude_value[166], expected 249, is %d", - check_msg->amplitude_value[166]); - ck_assert_msg(check_msg->amplitude_value[167] == 2, - "incorrect value for amplitude_value[167], expected 2, is %d", - check_msg->amplitude_value[167]); - ck_assert_msg( - check_msg->amplitude_value[168] == 153, - "incorrect value for amplitude_value[168], expected 153, is %d", - check_msg->amplitude_value[168]); - ck_assert_msg( - check_msg->amplitude_value[169] == 168, - "incorrect value for amplitude_value[169], expected 168, is %d", - check_msg->amplitude_value[169]); - ck_assert_msg( - check_msg->amplitude_value[170] == 131, - "incorrect value for amplitude_value[170], expected 131, is %d", - check_msg->amplitude_value[170]); - ck_assert_msg( - check_msg->amplitude_value[171] == 249, - "incorrect value for amplitude_value[171], expected 249, is %d", - check_msg->amplitude_value[171]); - ck_assert_msg( - check_msg->amplitude_value[172] == 160, - "incorrect value for amplitude_value[172], expected 160, is %d", - check_msg->amplitude_value[172]); - ck_assert_msg( - check_msg->amplitude_value[173] == 88, - "incorrect value for amplitude_value[173], expected 88, is %d", - check_msg->amplitude_value[173]); - ck_assert_msg( - check_msg->amplitude_value[174] == 38, - "incorrect value for amplitude_value[174], expected 38, is %d", - check_msg->amplitude_value[174]); - ck_assert_msg( - check_msg->amplitude_value[175] == 117, - "incorrect value for amplitude_value[175], expected 117, is %d", - check_msg->amplitude_value[175]); - ck_assert_msg( - check_msg->amplitude_value[176] == 129, - "incorrect value for amplitude_value[176], expected 129, is %d", - check_msg->amplitude_value[176]); - ck_assert_msg( - check_msg->amplitude_value[177] == 57, - "incorrect value for amplitude_value[177], expected 57, is %d", - check_msg->amplitude_value[177]); - ck_assert_msg( - check_msg->amplitude_value[178] == 40, - "incorrect value for amplitude_value[178], expected 40, is %d", - check_msg->amplitude_value[178]); - ck_assert_msg( - check_msg->amplitude_value[179] == 109, - "incorrect value for amplitude_value[179], expected 109, is %d", - check_msg->amplitude_value[179]); - ck_assert_msg( - check_msg->amplitude_value[180] == 209, - "incorrect value for amplitude_value[180], expected 209, is %d", - check_msg->amplitude_value[180]); - ck_assert_msg( - check_msg->amplitude_value[181] == 177, - "incorrect value for amplitude_value[181], expected 177, is %d", - check_msg->amplitude_value[181]); - ck_assert_msg( - check_msg->amplitude_value[182] == 38, - "incorrect value for amplitude_value[182], expected 38, is %d", - check_msg->amplitude_value[182]); - ck_assert_msg( - check_msg->amplitude_value[183] == 47, - "incorrect value for amplitude_value[183], expected 47, is %d", - check_msg->amplitude_value[183]); - ck_assert_msg( - check_msg->amplitude_value[184] == 12, - "incorrect value for amplitude_value[184], expected 12, is %d", - check_msg->amplitude_value[184]); - ck_assert_msg( - check_msg->amplitude_value[185] == 15, - "incorrect value for amplitude_value[185], expected 15, is %d", - check_msg->amplitude_value[185]); - ck_assert_msg( - check_msg->amplitude_value[186] == 16, - "incorrect value for amplitude_value[186], expected 16, is %d", - check_msg->amplitude_value[186]); - ck_assert_msg(check_msg->amplitude_value[187] == 9, - "incorrect value for amplitude_value[187], expected 9, is %d", - check_msg->amplitude_value[187]); - ck_assert_msg( - check_msg->amplitude_value[188] == 175, - "incorrect value for amplitude_value[188], expected 175, is %d", - check_msg->amplitude_value[188]); - ck_assert_msg( - check_msg->amplitude_value[189] == 69, - "incorrect value for amplitude_value[189], expected 69, is %d", - check_msg->amplitude_value[189]); - ck_assert_msg( - check_msg->amplitude_value[190] == 70, - "incorrect value for amplitude_value[190], expected 70, is %d", - check_msg->amplitude_value[190]); - ck_assert_msg( - check_msg->amplitude_value[191] == 182, - "incorrect value for amplitude_value[191], expected 182, is %d", - check_msg->amplitude_value[191]); - ck_assert_msg( - check_msg->amplitude_value[192] == 239, - "incorrect value for amplitude_value[192], expected 239, is %d", - check_msg->amplitude_value[192]); - ck_assert_msg( - check_msg->amplitude_value[193] == 117, - "incorrect value for amplitude_value[193], expected 117, is %d", - check_msg->amplitude_value[193]); - ck_assert_msg( - check_msg->amplitude_value[194] == 135, - "incorrect value for amplitude_value[194], expected 135, is %d", - check_msg->amplitude_value[194]); - ck_assert_msg(check_msg->amplitude_value[195] == 6, - "incorrect value for amplitude_value[195], expected 6, is %d", - check_msg->amplitude_value[195]); - ck_assert_msg( - check_msg->amplitude_value[196] == 71, - "incorrect value for amplitude_value[196], expected 71, is %d", - check_msg->amplitude_value[196]); - ck_assert_msg( - check_msg->amplitude_value[197] == 99, - "incorrect value for amplitude_value[197], expected 99, is %d", - check_msg->amplitude_value[197]); - ck_assert_msg( - check_msg->amplitude_value[198] == 230, - "incorrect value for amplitude_value[198], expected 230, is %d", - check_msg->amplitude_value[198]); - ck_assert_msg( - check_msg->amplitude_value[199] == 115, - "incorrect value for amplitude_value[199], expected 115, is %d", - check_msg->amplitude_value[199]); - ck_assert_msg(check_msg->amplitude_value[200] == 2, - "incorrect value for amplitude_value[200], expected 2, is %d", - check_msg->amplitude_value[200]); - ck_assert_msg( - check_msg->amplitude_value[201] == 71, - "incorrect value for amplitude_value[201], expected 71, is %d", - check_msg->amplitude_value[201]); - ck_assert_msg( - check_msg->amplitude_value[202] == 165, - "incorrect value for amplitude_value[202], expected 165, is %d", - check_msg->amplitude_value[202]); - ck_assert_msg( - check_msg->amplitude_value[203] == 228, - "incorrect value for amplitude_value[203], expected 228, is %d", - check_msg->amplitude_value[203]); - ck_assert_msg( - check_msg->amplitude_value[204] == 123, - "incorrect value for amplitude_value[204], expected 123, is %d", - check_msg->amplitude_value[204]); - ck_assert_msg( - check_msg->amplitude_value[205] == 210, - "incorrect value for amplitude_value[205], expected 210, is %d", - check_msg->amplitude_value[205]); - ck_assert_msg( - check_msg->amplitude_value[206] == 168, - "incorrect value for amplitude_value[206], expected 168, is %d", - check_msg->amplitude_value[206]); - ck_assert_msg( - check_msg->amplitude_value[207] == 90, - "incorrect value for amplitude_value[207], expected 90, is %d", - check_msg->amplitude_value[207]); - ck_assert_msg( - check_msg->amplitude_value[208] == 124, - "incorrect value for amplitude_value[208], expected 124, is %d", - check_msg->amplitude_value[208]); - ck_assert_msg( - check_msg->amplitude_value[209] == 20, - "incorrect value for amplitude_value[209], expected 20, is %d", - check_msg->amplitude_value[209]); - ck_assert_msg(check_msg->amplitude_value[210] == 7, - "incorrect value for amplitude_value[210], expected 7, is %d", - check_msg->amplitude_value[210]); - ck_assert_msg( - check_msg->amplitude_value[211] == 220, - "incorrect value for amplitude_value[211], expected 220, is %d", - check_msg->amplitude_value[211]); - ck_assert_msg( - check_msg->amplitude_value[212] == 144, - "incorrect value for amplitude_value[212], expected 144, is %d", - check_msg->amplitude_value[212]); - ck_assert_msg( - check_msg->amplitude_value[213] == 168, - "incorrect value for amplitude_value[213], expected 168, is %d", - check_msg->amplitude_value[213]); - ck_assert_msg( - check_msg->amplitude_value[214] == 69, - "incorrect value for amplitude_value[214], expected 69, is %d", - check_msg->amplitude_value[214]); - ck_assert_msg( - check_msg->amplitude_value[215] == 22, - "incorrect value for amplitude_value[215], expected 22, is %d", - check_msg->amplitude_value[215]); - ck_assert_msg( - check_msg->amplitude_value[216] == 72, - "incorrect value for amplitude_value[216], expected 72, is %d", - check_msg->amplitude_value[216]); - ck_assert_msg( - check_msg->amplitude_value[217] == 162, - "incorrect value for amplitude_value[217], expected 162, is %d", - check_msg->amplitude_value[217]); - ck_assert_msg( - check_msg->amplitude_value[218] == 69, - "incorrect value for amplitude_value[218], expected 69, is %d", - check_msg->amplitude_value[218]); - ck_assert_msg( - check_msg->amplitude_value[219] == 111, - "incorrect value for amplitude_value[219], expected 111, is %d", - check_msg->amplitude_value[219]); - ck_assert_msg( - check_msg->amplitude_value[220] == 91, - "incorrect value for amplitude_value[220], expected 91, is %d", - check_msg->amplitude_value[220]); - ck_assert_msg( - check_msg->amplitude_value[221] == 251, - "incorrect value for amplitude_value[221], expected 251, is %d", - check_msg->amplitude_value[221]); - ck_assert_msg( - check_msg->amplitude_value[222] == 72, - "incorrect value for amplitude_value[222], expected 72, is %d", - check_msg->amplitude_value[222]); - ck_assert_msg( - check_msg->amplitude_value[223] == 220, - "incorrect value for amplitude_value[223], expected 220, is %d", - check_msg->amplitude_value[223]); - ck_assert_msg( - check_msg->amplitude_value[224] == 28, - "incorrect value for amplitude_value[224], expected 28, is %d", - check_msg->amplitude_value[224]); - ck_assert_msg( - check_msg->amplitude_value[225] == 119, - "incorrect value for amplitude_value[225], expected 119, is %d", - check_msg->amplitude_value[225]); - ck_assert_msg( - check_msg->amplitude_value[226] == 150, - "incorrect value for amplitude_value[226], expected 150, is %d", - check_msg->amplitude_value[226]); - ck_assert_msg(check_msg->channel_tag == 35146, - "incorrect value for channel_tag, expected 35146, is %d", - check_msg->channel_tag); - ck_assert_msg((check_msg->freq_ref * 100 - 7737.20019531 * 100) < 0.05, - "incorrect value for freq_ref, expected 7737.20019531, is %f", - check_msg->freq_ref); - ck_assert_msg( - (check_msg->freq_step * 100 - 8226.20019531 * 100) < 0.05, - "incorrect value for freq_step, expected 8226.20019531, is %f", - check_msg->freq_step); - ck_assert_msg( - check_msg->t.ns_residual == -1479025396, - "incorrect value for t.ns_residual, expected -1479025396, is %d", - check_msg->t.ns_residual); - ck_assert_msg(check_msg->t.tow == 1227027783, - "incorrect value for t.tow, expected 1227027783, is %d", - check_msg->t.tow); - ck_assert_msg(check_msg->t.wn == 5075, - "incorrect value for t.wn, expected 5075, is %d", - check_msg->t.wn); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgSpecan_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgSpecan"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_piksi_MsgSpecan"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgSpecan); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgSpecanDep.c b/c/test/legacy/auto_check_sbp_piksi_MsgSpecanDep.c deleted file mode 100644 index 6ca3ce70ce..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgSpecanDep.c +++ /dev/null @@ -1,2281 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgSpecanDep.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgSpecanDep) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x50, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x50, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 80, 0, 112, 217, 255, 246, 22, 221, 56, 37, 59, 45, 27, - 154, 97, 198, 69, 154, 1, 144, 69, 205, 20, 18, 70, 51, 211, - 89, 69, 240, 14, 179, 186, 227, 244, 173, 240, 182, 71, 166, 117, - 196, 13, 44, 27, 33, 28, 67, 254, 3, 249, 92, 44, 122, 169, - 77, 186, 68, 135, 63, 168, 162, 89, 36, 186, 99, 63, 105, 116, - 216, 44, 67, 212, 156, 75, 81, 53, 250, 225, 23, 205, 26, 34, - 119, 50, 101, 64, 7, 231, 124, 183, 203, 102, 234, 84, 83, 208, - 23, 68, 54, 179, 98, 96, 116, 244, 246, 94, 104, 94, 13, 56, - 210, 18, 191, 22, 133, 81, 153, 159, 161, 219, 59, 21, 164, 121, - 145, 203, 171, 132, 57, 180, 102, 101, 11, 229, 175, 145, 73, 72, - 124, 4, 184, 228, 61, 234, 218, 62, 226, 217, 193, 7, 109, 44, - 83, 201, 20, 101, 9, 140, 186, 162, 81, 91, 30, 231, 161, 81, - 216, 114, 60, 231, 163, 163, 49, 237, 244, 185, 240, 89, 143, 174, - 165, 211, 241, 13, 16, 61, 141, 101, 89, 37, 117, 189, 86, 118, - 176, 228, 12, 14, 119, 135, 129, 243, 50, 29, 207, 198, 117, 100, - 225, 6, 139, 110, 39, 210, 68, 199, 43, 132, 64, 17, 51, 173, - 181, 12, 140, 16, 247, 84, 183, 105, 39, 157, 77, 30, 205, 194, - 59, 64, 241, 183, 238, 105, 181, 170, 45, 8, 166, 164, 238, 83, - 148, 173, 108, 228, 67, 89, 189, 67, 26, 39, 216, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_specan_dep_t *test_msg = (msg_specan_dep_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->amplitude_ref = 9349.2001953125; - test_msg->amplitude_unit = 3485.199951171875; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[0] = 240; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[1] = 14; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[2] = 179; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[3] = 186; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[4] = 227; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[5] = 244; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[6] = 173; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[7] = 240; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[8] = 182; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[9] = 71; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[10] = 166; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[11] = 117; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[12] = 196; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[13] = 13; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[14] = 44; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[15] = 27; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[16] = 33; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[17] = 28; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[18] = 67; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[19] = 254; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[20] = 3; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[21] = 249; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[22] = 92; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[23] = 44; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[24] = 122; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[25] = 169; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[26] = 77; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[27] = 186; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[28] = 68; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[29] = 135; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[30] = 63; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[31] = 168; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[32] = 162; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[33] = 89; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[34] = 36; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[35] = 186; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[36] = 99; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[37] = 63; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[38] = 105; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[39] = 116; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[40] = 216; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[41] = 44; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[42] = 67; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[43] = 212; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[44] = 156; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[45] = 75; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[46] = 81; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[47] = 53; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[48] = 250; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[49] = 225; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[50] = 23; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[51] = 205; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[52] = 26; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[53] = 34; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[54] = 119; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[55] = 50; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[56] = 101; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[57] = 64; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[58] = 7; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[59] = 231; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[60] = 124; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[61] = 183; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[62] = 203; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[63] = 102; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[64] = 234; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[65] = 84; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[66] = 83; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[67] = 208; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[68] = 23; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[69] = 68; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[70] = 54; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[71] = 179; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[72] = 98; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[73] = 96; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[74] = 116; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[75] = 244; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[76] = 246; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[77] = 94; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[78] = 104; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[79] = 94; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[80] = 13; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[81] = 56; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[82] = 210; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[83] = 18; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[84] = 191; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[85] = 22; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[86] = 133; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[87] = 81; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[88] = 153; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[89] = 159; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[90] = 161; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[91] = 219; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[92] = 59; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[93] = 21; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[94] = 164; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[95] = 121; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[96] = 145; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[97] = 203; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[98] = 171; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[99] = 132; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[100] = 57; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[101] = 180; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[102] = 102; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[103] = 101; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[104] = 11; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[105] = 229; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[106] = 175; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[107] = 145; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[108] = 73; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[109] = 72; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[110] = 124; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[111] = 4; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[112] = 184; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[113] = 228; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[114] = 61; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[115] = 234; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[116] = 218; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[117] = 62; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[118] = 226; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[119] = 217; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[120] = 193; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[121] = 7; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[122] = 109; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[123] = 44; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[124] = 83; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[125] = 201; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[126] = 20; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[127] = 101; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[128] = 9; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[129] = 140; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[130] = 186; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[131] = 162; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[132] = 81; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[133] = 91; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[134] = 30; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[135] = 231; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[136] = 161; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[137] = 81; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[138] = 216; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[139] = 114; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[140] = 60; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[141] = 231; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[142] = 163; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[143] = 163; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[144] = 49; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[145] = 237; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[146] = 244; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[147] = 185; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[148] = 240; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[149] = 89; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[150] = 143; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[151] = 174; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[152] = 165; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[153] = 211; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[154] = 241; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[155] = 13; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[156] = 16; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[157] = 61; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[158] = 141; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[159] = 101; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[160] = 89; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[161] = 37; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[162] = 117; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[163] = 189; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[164] = 86; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[165] = 118; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[166] = 176; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[167] = 228; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[168] = 12; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[169] = 14; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[170] = 119; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[171] = 135; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[172] = 129; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[173] = 243; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[174] = 50; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[175] = 29; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[176] = 207; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[177] = 198; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[178] = 117; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[179] = 100; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[180] = 225; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[181] = 6; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[182] = 139; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[183] = 110; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[184] = 39; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[185] = 210; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[186] = 68; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[187] = 199; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[188] = 43; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[189] = 132; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[190] = 64; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[191] = 17; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[192] = 51; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[193] = 173; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[194] = 181; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[195] = 12; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[196] = 140; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[197] = 16; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[198] = 247; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[199] = 84; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[200] = 183; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[201] = 105; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[202] = 39; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[203] = 157; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[204] = 77; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[205] = 30; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[206] = 205; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[207] = 194; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[208] = 59; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[209] = 64; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[210] = 241; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[211] = 183; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[212] = 238; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[213] = 105; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[214] = 181; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[215] = 170; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[216] = 45; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[217] = 8; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[218] = 166; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[219] = 164; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[220] = 238; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[221] = 83; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[222] = 148; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[223] = 173; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[224] = 108; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[225] = 228; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[226] = 67; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[227] = 89; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[228] = 189; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[229] = 67; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->amplitude_value[0]); - } - test_msg->amplitude_value[230] = 26; - test_msg->channel_tag = 5878; - test_msg->freq_ref = 6348.2001953125; - test_msg->freq_step = 4608.2001953125; - test_msg->t.tow = 992295133; - test_msg->t.wn = 6957; - sbp_payload_send(&sbp_state, 0x50, 55664, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55664, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55664, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x50, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_specan_dep_t *check_msg = (msg_specan_dep_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->amplitude_ref * 100 - 9349.20019531 * 100) < 0.05, - "incorrect value for amplitude_ref, expected 9349.20019531, is %f", - check_msg->amplitude_ref); - ck_assert_msg( - (check_msg->amplitude_unit * 100 - 3485.19995117 * 100) < 0.05, - "incorrect value for amplitude_unit, expected 3485.19995117, is %f", - check_msg->amplitude_unit); - ck_assert_msg(check_msg->amplitude_value[0] == 240, - "incorrect value for amplitude_value[0], expected 240, is %d", - check_msg->amplitude_value[0]); - ck_assert_msg(check_msg->amplitude_value[1] == 14, - "incorrect value for amplitude_value[1], expected 14, is %d", - check_msg->amplitude_value[1]); - ck_assert_msg(check_msg->amplitude_value[2] == 179, - "incorrect value for amplitude_value[2], expected 179, is %d", - check_msg->amplitude_value[2]); - ck_assert_msg(check_msg->amplitude_value[3] == 186, - "incorrect value for amplitude_value[3], expected 186, is %d", - check_msg->amplitude_value[3]); - ck_assert_msg(check_msg->amplitude_value[4] == 227, - "incorrect value for amplitude_value[4], expected 227, is %d", - check_msg->amplitude_value[4]); - ck_assert_msg(check_msg->amplitude_value[5] == 244, - "incorrect value for amplitude_value[5], expected 244, is %d", - check_msg->amplitude_value[5]); - ck_assert_msg(check_msg->amplitude_value[6] == 173, - "incorrect value for amplitude_value[6], expected 173, is %d", - check_msg->amplitude_value[6]); - ck_assert_msg(check_msg->amplitude_value[7] == 240, - "incorrect value for amplitude_value[7], expected 240, is %d", - check_msg->amplitude_value[7]); - ck_assert_msg(check_msg->amplitude_value[8] == 182, - "incorrect value for amplitude_value[8], expected 182, is %d", - check_msg->amplitude_value[8]); - ck_assert_msg(check_msg->amplitude_value[9] == 71, - "incorrect value for amplitude_value[9], expected 71, is %d", - check_msg->amplitude_value[9]); - ck_assert_msg( - check_msg->amplitude_value[10] == 166, - "incorrect value for amplitude_value[10], expected 166, is %d", - check_msg->amplitude_value[10]); - ck_assert_msg( - check_msg->amplitude_value[11] == 117, - "incorrect value for amplitude_value[11], expected 117, is %d", - check_msg->amplitude_value[11]); - ck_assert_msg( - check_msg->amplitude_value[12] == 196, - "incorrect value for amplitude_value[12], expected 196, is %d", - check_msg->amplitude_value[12]); - ck_assert_msg(check_msg->amplitude_value[13] == 13, - "incorrect value for amplitude_value[13], expected 13, is %d", - check_msg->amplitude_value[13]); - ck_assert_msg(check_msg->amplitude_value[14] == 44, - "incorrect value for amplitude_value[14], expected 44, is %d", - check_msg->amplitude_value[14]); - ck_assert_msg(check_msg->amplitude_value[15] == 27, - "incorrect value for amplitude_value[15], expected 27, is %d", - check_msg->amplitude_value[15]); - ck_assert_msg(check_msg->amplitude_value[16] == 33, - "incorrect value for amplitude_value[16], expected 33, is %d", - check_msg->amplitude_value[16]); - ck_assert_msg(check_msg->amplitude_value[17] == 28, - "incorrect value for amplitude_value[17], expected 28, is %d", - check_msg->amplitude_value[17]); - ck_assert_msg(check_msg->amplitude_value[18] == 67, - "incorrect value for amplitude_value[18], expected 67, is %d", - check_msg->amplitude_value[18]); - ck_assert_msg( - check_msg->amplitude_value[19] == 254, - "incorrect value for amplitude_value[19], expected 254, is %d", - check_msg->amplitude_value[19]); - ck_assert_msg(check_msg->amplitude_value[20] == 3, - "incorrect value for amplitude_value[20], expected 3, is %d", - check_msg->amplitude_value[20]); - ck_assert_msg( - check_msg->amplitude_value[21] == 249, - "incorrect value for amplitude_value[21], expected 249, is %d", - check_msg->amplitude_value[21]); - ck_assert_msg(check_msg->amplitude_value[22] == 92, - "incorrect value for amplitude_value[22], expected 92, is %d", - check_msg->amplitude_value[22]); - ck_assert_msg(check_msg->amplitude_value[23] == 44, - "incorrect value for amplitude_value[23], expected 44, is %d", - check_msg->amplitude_value[23]); - ck_assert_msg( - check_msg->amplitude_value[24] == 122, - "incorrect value for amplitude_value[24], expected 122, is %d", - check_msg->amplitude_value[24]); - ck_assert_msg( - check_msg->amplitude_value[25] == 169, - "incorrect value for amplitude_value[25], expected 169, is %d", - check_msg->amplitude_value[25]); - ck_assert_msg(check_msg->amplitude_value[26] == 77, - "incorrect value for amplitude_value[26], expected 77, is %d", - check_msg->amplitude_value[26]); - ck_assert_msg( - check_msg->amplitude_value[27] == 186, - "incorrect value for amplitude_value[27], expected 186, is %d", - check_msg->amplitude_value[27]); - ck_assert_msg(check_msg->amplitude_value[28] == 68, - "incorrect value for amplitude_value[28], expected 68, is %d", - check_msg->amplitude_value[28]); - ck_assert_msg( - check_msg->amplitude_value[29] == 135, - "incorrect value for amplitude_value[29], expected 135, is %d", - check_msg->amplitude_value[29]); - ck_assert_msg(check_msg->amplitude_value[30] == 63, - "incorrect value for amplitude_value[30], expected 63, is %d", - check_msg->amplitude_value[30]); - ck_assert_msg( - check_msg->amplitude_value[31] == 168, - "incorrect value for amplitude_value[31], expected 168, is %d", - check_msg->amplitude_value[31]); - ck_assert_msg( - check_msg->amplitude_value[32] == 162, - "incorrect value for amplitude_value[32], expected 162, is %d", - check_msg->amplitude_value[32]); - ck_assert_msg(check_msg->amplitude_value[33] == 89, - "incorrect value for amplitude_value[33], expected 89, is %d", - check_msg->amplitude_value[33]); - ck_assert_msg(check_msg->amplitude_value[34] == 36, - "incorrect value for amplitude_value[34], expected 36, is %d", - check_msg->amplitude_value[34]); - ck_assert_msg( - check_msg->amplitude_value[35] == 186, - "incorrect value for amplitude_value[35], expected 186, is %d", - check_msg->amplitude_value[35]); - ck_assert_msg(check_msg->amplitude_value[36] == 99, - "incorrect value for amplitude_value[36], expected 99, is %d", - check_msg->amplitude_value[36]); - ck_assert_msg(check_msg->amplitude_value[37] == 63, - "incorrect value for amplitude_value[37], expected 63, is %d", - check_msg->amplitude_value[37]); - ck_assert_msg( - check_msg->amplitude_value[38] == 105, - "incorrect value for amplitude_value[38], expected 105, is %d", - check_msg->amplitude_value[38]); - ck_assert_msg( - check_msg->amplitude_value[39] == 116, - "incorrect value for amplitude_value[39], expected 116, is %d", - check_msg->amplitude_value[39]); - ck_assert_msg( - check_msg->amplitude_value[40] == 216, - "incorrect value for amplitude_value[40], expected 216, is %d", - check_msg->amplitude_value[40]); - ck_assert_msg(check_msg->amplitude_value[41] == 44, - "incorrect value for amplitude_value[41], expected 44, is %d", - check_msg->amplitude_value[41]); - ck_assert_msg(check_msg->amplitude_value[42] == 67, - "incorrect value for amplitude_value[42], expected 67, is %d", - check_msg->amplitude_value[42]); - ck_assert_msg( - check_msg->amplitude_value[43] == 212, - "incorrect value for amplitude_value[43], expected 212, is %d", - check_msg->amplitude_value[43]); - ck_assert_msg( - check_msg->amplitude_value[44] == 156, - "incorrect value for amplitude_value[44], expected 156, is %d", - check_msg->amplitude_value[44]); - ck_assert_msg(check_msg->amplitude_value[45] == 75, - "incorrect value for amplitude_value[45], expected 75, is %d", - check_msg->amplitude_value[45]); - ck_assert_msg(check_msg->amplitude_value[46] == 81, - "incorrect value for amplitude_value[46], expected 81, is %d", - check_msg->amplitude_value[46]); - ck_assert_msg(check_msg->amplitude_value[47] == 53, - "incorrect value for amplitude_value[47], expected 53, is %d", - check_msg->amplitude_value[47]); - ck_assert_msg( - check_msg->amplitude_value[48] == 250, - "incorrect value for amplitude_value[48], expected 250, is %d", - check_msg->amplitude_value[48]); - ck_assert_msg( - check_msg->amplitude_value[49] == 225, - "incorrect value for amplitude_value[49], expected 225, is %d", - check_msg->amplitude_value[49]); - ck_assert_msg(check_msg->amplitude_value[50] == 23, - "incorrect value for amplitude_value[50], expected 23, is %d", - check_msg->amplitude_value[50]); - ck_assert_msg( - check_msg->amplitude_value[51] == 205, - "incorrect value for amplitude_value[51], expected 205, is %d", - check_msg->amplitude_value[51]); - ck_assert_msg(check_msg->amplitude_value[52] == 26, - "incorrect value for amplitude_value[52], expected 26, is %d", - check_msg->amplitude_value[52]); - ck_assert_msg(check_msg->amplitude_value[53] == 34, - "incorrect value for amplitude_value[53], expected 34, is %d", - check_msg->amplitude_value[53]); - ck_assert_msg( - check_msg->amplitude_value[54] == 119, - "incorrect value for amplitude_value[54], expected 119, is %d", - check_msg->amplitude_value[54]); - ck_assert_msg(check_msg->amplitude_value[55] == 50, - "incorrect value for amplitude_value[55], expected 50, is %d", - check_msg->amplitude_value[55]); - ck_assert_msg( - check_msg->amplitude_value[56] == 101, - "incorrect value for amplitude_value[56], expected 101, is %d", - check_msg->amplitude_value[56]); - ck_assert_msg(check_msg->amplitude_value[57] == 64, - "incorrect value for amplitude_value[57], expected 64, is %d", - check_msg->amplitude_value[57]); - ck_assert_msg(check_msg->amplitude_value[58] == 7, - "incorrect value for amplitude_value[58], expected 7, is %d", - check_msg->amplitude_value[58]); - ck_assert_msg( - check_msg->amplitude_value[59] == 231, - "incorrect value for amplitude_value[59], expected 231, is %d", - check_msg->amplitude_value[59]); - ck_assert_msg( - check_msg->amplitude_value[60] == 124, - "incorrect value for amplitude_value[60], expected 124, is %d", - check_msg->amplitude_value[60]); - ck_assert_msg( - check_msg->amplitude_value[61] == 183, - "incorrect value for amplitude_value[61], expected 183, is %d", - check_msg->amplitude_value[61]); - ck_assert_msg( - check_msg->amplitude_value[62] == 203, - "incorrect value for amplitude_value[62], expected 203, is %d", - check_msg->amplitude_value[62]); - ck_assert_msg( - check_msg->amplitude_value[63] == 102, - "incorrect value for amplitude_value[63], expected 102, is %d", - check_msg->amplitude_value[63]); - ck_assert_msg( - check_msg->amplitude_value[64] == 234, - "incorrect value for amplitude_value[64], expected 234, is %d", - check_msg->amplitude_value[64]); - ck_assert_msg(check_msg->amplitude_value[65] == 84, - "incorrect value for amplitude_value[65], expected 84, is %d", - check_msg->amplitude_value[65]); - ck_assert_msg(check_msg->amplitude_value[66] == 83, - "incorrect value for amplitude_value[66], expected 83, is %d", - check_msg->amplitude_value[66]); - ck_assert_msg( - check_msg->amplitude_value[67] == 208, - "incorrect value for amplitude_value[67], expected 208, is %d", - check_msg->amplitude_value[67]); - ck_assert_msg(check_msg->amplitude_value[68] == 23, - "incorrect value for amplitude_value[68], expected 23, is %d", - check_msg->amplitude_value[68]); - ck_assert_msg(check_msg->amplitude_value[69] == 68, - "incorrect value for amplitude_value[69], expected 68, is %d", - check_msg->amplitude_value[69]); - ck_assert_msg(check_msg->amplitude_value[70] == 54, - "incorrect value for amplitude_value[70], expected 54, is %d", - check_msg->amplitude_value[70]); - ck_assert_msg( - check_msg->amplitude_value[71] == 179, - "incorrect value for amplitude_value[71], expected 179, is %d", - check_msg->amplitude_value[71]); - ck_assert_msg(check_msg->amplitude_value[72] == 98, - "incorrect value for amplitude_value[72], expected 98, is %d", - check_msg->amplitude_value[72]); - ck_assert_msg(check_msg->amplitude_value[73] == 96, - "incorrect value for amplitude_value[73], expected 96, is %d", - check_msg->amplitude_value[73]); - ck_assert_msg( - check_msg->amplitude_value[74] == 116, - "incorrect value for amplitude_value[74], expected 116, is %d", - check_msg->amplitude_value[74]); - ck_assert_msg( - check_msg->amplitude_value[75] == 244, - "incorrect value for amplitude_value[75], expected 244, is %d", - check_msg->amplitude_value[75]); - ck_assert_msg( - check_msg->amplitude_value[76] == 246, - "incorrect value for amplitude_value[76], expected 246, is %d", - check_msg->amplitude_value[76]); - ck_assert_msg(check_msg->amplitude_value[77] == 94, - "incorrect value for amplitude_value[77], expected 94, is %d", - check_msg->amplitude_value[77]); - ck_assert_msg( - check_msg->amplitude_value[78] == 104, - "incorrect value for amplitude_value[78], expected 104, is %d", - check_msg->amplitude_value[78]); - ck_assert_msg(check_msg->amplitude_value[79] == 94, - "incorrect value for amplitude_value[79], expected 94, is %d", - check_msg->amplitude_value[79]); - ck_assert_msg(check_msg->amplitude_value[80] == 13, - "incorrect value for amplitude_value[80], expected 13, is %d", - check_msg->amplitude_value[80]); - ck_assert_msg(check_msg->amplitude_value[81] == 56, - "incorrect value for amplitude_value[81], expected 56, is %d", - check_msg->amplitude_value[81]); - ck_assert_msg( - check_msg->amplitude_value[82] == 210, - "incorrect value for amplitude_value[82], expected 210, is %d", - check_msg->amplitude_value[82]); - ck_assert_msg(check_msg->amplitude_value[83] == 18, - "incorrect value for amplitude_value[83], expected 18, is %d", - check_msg->amplitude_value[83]); - ck_assert_msg( - check_msg->amplitude_value[84] == 191, - "incorrect value for amplitude_value[84], expected 191, is %d", - check_msg->amplitude_value[84]); - ck_assert_msg(check_msg->amplitude_value[85] == 22, - "incorrect value for amplitude_value[85], expected 22, is %d", - check_msg->amplitude_value[85]); - ck_assert_msg( - check_msg->amplitude_value[86] == 133, - "incorrect value for amplitude_value[86], expected 133, is %d", - check_msg->amplitude_value[86]); - ck_assert_msg(check_msg->amplitude_value[87] == 81, - "incorrect value for amplitude_value[87], expected 81, is %d", - check_msg->amplitude_value[87]); - ck_assert_msg( - check_msg->amplitude_value[88] == 153, - "incorrect value for amplitude_value[88], expected 153, is %d", - check_msg->amplitude_value[88]); - ck_assert_msg( - check_msg->amplitude_value[89] == 159, - "incorrect value for amplitude_value[89], expected 159, is %d", - check_msg->amplitude_value[89]); - ck_assert_msg( - check_msg->amplitude_value[90] == 161, - "incorrect value for amplitude_value[90], expected 161, is %d", - check_msg->amplitude_value[90]); - ck_assert_msg( - check_msg->amplitude_value[91] == 219, - "incorrect value for amplitude_value[91], expected 219, is %d", - check_msg->amplitude_value[91]); - ck_assert_msg(check_msg->amplitude_value[92] == 59, - "incorrect value for amplitude_value[92], expected 59, is %d", - check_msg->amplitude_value[92]); - ck_assert_msg(check_msg->amplitude_value[93] == 21, - "incorrect value for amplitude_value[93], expected 21, is %d", - check_msg->amplitude_value[93]); - ck_assert_msg( - check_msg->amplitude_value[94] == 164, - "incorrect value for amplitude_value[94], expected 164, is %d", - check_msg->amplitude_value[94]); - ck_assert_msg( - check_msg->amplitude_value[95] == 121, - "incorrect value for amplitude_value[95], expected 121, is %d", - check_msg->amplitude_value[95]); - ck_assert_msg( - check_msg->amplitude_value[96] == 145, - "incorrect value for amplitude_value[96], expected 145, is %d", - check_msg->amplitude_value[96]); - ck_assert_msg( - check_msg->amplitude_value[97] == 203, - "incorrect value for amplitude_value[97], expected 203, is %d", - check_msg->amplitude_value[97]); - ck_assert_msg( - check_msg->amplitude_value[98] == 171, - "incorrect value for amplitude_value[98], expected 171, is %d", - check_msg->amplitude_value[98]); - ck_assert_msg( - check_msg->amplitude_value[99] == 132, - "incorrect value for amplitude_value[99], expected 132, is %d", - check_msg->amplitude_value[99]); - ck_assert_msg( - check_msg->amplitude_value[100] == 57, - "incorrect value for amplitude_value[100], expected 57, is %d", - check_msg->amplitude_value[100]); - ck_assert_msg( - check_msg->amplitude_value[101] == 180, - "incorrect value for amplitude_value[101], expected 180, is %d", - check_msg->amplitude_value[101]); - ck_assert_msg( - check_msg->amplitude_value[102] == 102, - "incorrect value for amplitude_value[102], expected 102, is %d", - check_msg->amplitude_value[102]); - ck_assert_msg( - check_msg->amplitude_value[103] == 101, - "incorrect value for amplitude_value[103], expected 101, is %d", - check_msg->amplitude_value[103]); - ck_assert_msg( - check_msg->amplitude_value[104] == 11, - "incorrect value for amplitude_value[104], expected 11, is %d", - check_msg->amplitude_value[104]); - ck_assert_msg( - check_msg->amplitude_value[105] == 229, - "incorrect value for amplitude_value[105], expected 229, is %d", - check_msg->amplitude_value[105]); - ck_assert_msg( - check_msg->amplitude_value[106] == 175, - "incorrect value for amplitude_value[106], expected 175, is %d", - check_msg->amplitude_value[106]); - ck_assert_msg( - check_msg->amplitude_value[107] == 145, - "incorrect value for amplitude_value[107], expected 145, is %d", - check_msg->amplitude_value[107]); - ck_assert_msg( - check_msg->amplitude_value[108] == 73, - "incorrect value for amplitude_value[108], expected 73, is %d", - check_msg->amplitude_value[108]); - ck_assert_msg( - check_msg->amplitude_value[109] == 72, - "incorrect value for amplitude_value[109], expected 72, is %d", - check_msg->amplitude_value[109]); - ck_assert_msg( - check_msg->amplitude_value[110] == 124, - "incorrect value for amplitude_value[110], expected 124, is %d", - check_msg->amplitude_value[110]); - ck_assert_msg(check_msg->amplitude_value[111] == 4, - "incorrect value for amplitude_value[111], expected 4, is %d", - check_msg->amplitude_value[111]); - ck_assert_msg( - check_msg->amplitude_value[112] == 184, - "incorrect value for amplitude_value[112], expected 184, is %d", - check_msg->amplitude_value[112]); - ck_assert_msg( - check_msg->amplitude_value[113] == 228, - "incorrect value for amplitude_value[113], expected 228, is %d", - check_msg->amplitude_value[113]); - ck_assert_msg( - check_msg->amplitude_value[114] == 61, - "incorrect value for amplitude_value[114], expected 61, is %d", - check_msg->amplitude_value[114]); - ck_assert_msg( - check_msg->amplitude_value[115] == 234, - "incorrect value for amplitude_value[115], expected 234, is %d", - check_msg->amplitude_value[115]); - ck_assert_msg( - check_msg->amplitude_value[116] == 218, - "incorrect value for amplitude_value[116], expected 218, is %d", - check_msg->amplitude_value[116]); - ck_assert_msg( - check_msg->amplitude_value[117] == 62, - "incorrect value for amplitude_value[117], expected 62, is %d", - check_msg->amplitude_value[117]); - ck_assert_msg( - check_msg->amplitude_value[118] == 226, - "incorrect value for amplitude_value[118], expected 226, is %d", - check_msg->amplitude_value[118]); - ck_assert_msg( - check_msg->amplitude_value[119] == 217, - "incorrect value for amplitude_value[119], expected 217, is %d", - check_msg->amplitude_value[119]); - ck_assert_msg( - check_msg->amplitude_value[120] == 193, - "incorrect value for amplitude_value[120], expected 193, is %d", - check_msg->amplitude_value[120]); - ck_assert_msg(check_msg->amplitude_value[121] == 7, - "incorrect value for amplitude_value[121], expected 7, is %d", - check_msg->amplitude_value[121]); - ck_assert_msg( - check_msg->amplitude_value[122] == 109, - "incorrect value for amplitude_value[122], expected 109, is %d", - check_msg->amplitude_value[122]); - ck_assert_msg( - check_msg->amplitude_value[123] == 44, - "incorrect value for amplitude_value[123], expected 44, is %d", - check_msg->amplitude_value[123]); - ck_assert_msg( - check_msg->amplitude_value[124] == 83, - "incorrect value for amplitude_value[124], expected 83, is %d", - check_msg->amplitude_value[124]); - ck_assert_msg( - check_msg->amplitude_value[125] == 201, - "incorrect value for amplitude_value[125], expected 201, is %d", - check_msg->amplitude_value[125]); - ck_assert_msg( - check_msg->amplitude_value[126] == 20, - "incorrect value for amplitude_value[126], expected 20, is %d", - check_msg->amplitude_value[126]); - ck_assert_msg( - check_msg->amplitude_value[127] == 101, - "incorrect value for amplitude_value[127], expected 101, is %d", - check_msg->amplitude_value[127]); - ck_assert_msg(check_msg->amplitude_value[128] == 9, - "incorrect value for amplitude_value[128], expected 9, is %d", - check_msg->amplitude_value[128]); - ck_assert_msg( - check_msg->amplitude_value[129] == 140, - "incorrect value for amplitude_value[129], expected 140, is %d", - check_msg->amplitude_value[129]); - ck_assert_msg( - check_msg->amplitude_value[130] == 186, - "incorrect value for amplitude_value[130], expected 186, is %d", - check_msg->amplitude_value[130]); - ck_assert_msg( - check_msg->amplitude_value[131] == 162, - "incorrect value for amplitude_value[131], expected 162, is %d", - check_msg->amplitude_value[131]); - ck_assert_msg( - check_msg->amplitude_value[132] == 81, - "incorrect value for amplitude_value[132], expected 81, is %d", - check_msg->amplitude_value[132]); - ck_assert_msg( - check_msg->amplitude_value[133] == 91, - "incorrect value for amplitude_value[133], expected 91, is %d", - check_msg->amplitude_value[133]); - ck_assert_msg( - check_msg->amplitude_value[134] == 30, - "incorrect value for amplitude_value[134], expected 30, is %d", - check_msg->amplitude_value[134]); - ck_assert_msg( - check_msg->amplitude_value[135] == 231, - "incorrect value for amplitude_value[135], expected 231, is %d", - check_msg->amplitude_value[135]); - ck_assert_msg( - check_msg->amplitude_value[136] == 161, - "incorrect value for amplitude_value[136], expected 161, is %d", - check_msg->amplitude_value[136]); - ck_assert_msg( - check_msg->amplitude_value[137] == 81, - "incorrect value for amplitude_value[137], expected 81, is %d", - check_msg->amplitude_value[137]); - ck_assert_msg( - check_msg->amplitude_value[138] == 216, - "incorrect value for amplitude_value[138], expected 216, is %d", - check_msg->amplitude_value[138]); - ck_assert_msg( - check_msg->amplitude_value[139] == 114, - "incorrect value for amplitude_value[139], expected 114, is %d", - check_msg->amplitude_value[139]); - ck_assert_msg( - check_msg->amplitude_value[140] == 60, - "incorrect value for amplitude_value[140], expected 60, is %d", - check_msg->amplitude_value[140]); - ck_assert_msg( - check_msg->amplitude_value[141] == 231, - "incorrect value for amplitude_value[141], expected 231, is %d", - check_msg->amplitude_value[141]); - ck_assert_msg( - check_msg->amplitude_value[142] == 163, - "incorrect value for amplitude_value[142], expected 163, is %d", - check_msg->amplitude_value[142]); - ck_assert_msg( - check_msg->amplitude_value[143] == 163, - "incorrect value for amplitude_value[143], expected 163, is %d", - check_msg->amplitude_value[143]); - ck_assert_msg( - check_msg->amplitude_value[144] == 49, - "incorrect value for amplitude_value[144], expected 49, is %d", - check_msg->amplitude_value[144]); - ck_assert_msg( - check_msg->amplitude_value[145] == 237, - "incorrect value for amplitude_value[145], expected 237, is %d", - check_msg->amplitude_value[145]); - ck_assert_msg( - check_msg->amplitude_value[146] == 244, - "incorrect value for amplitude_value[146], expected 244, is %d", - check_msg->amplitude_value[146]); - ck_assert_msg( - check_msg->amplitude_value[147] == 185, - "incorrect value for amplitude_value[147], expected 185, is %d", - check_msg->amplitude_value[147]); - ck_assert_msg( - check_msg->amplitude_value[148] == 240, - "incorrect value for amplitude_value[148], expected 240, is %d", - check_msg->amplitude_value[148]); - ck_assert_msg( - check_msg->amplitude_value[149] == 89, - "incorrect value for amplitude_value[149], expected 89, is %d", - check_msg->amplitude_value[149]); - ck_assert_msg( - check_msg->amplitude_value[150] == 143, - "incorrect value for amplitude_value[150], expected 143, is %d", - check_msg->amplitude_value[150]); - ck_assert_msg( - check_msg->amplitude_value[151] == 174, - "incorrect value for amplitude_value[151], expected 174, is %d", - check_msg->amplitude_value[151]); - ck_assert_msg( - check_msg->amplitude_value[152] == 165, - "incorrect value for amplitude_value[152], expected 165, is %d", - check_msg->amplitude_value[152]); - ck_assert_msg( - check_msg->amplitude_value[153] == 211, - "incorrect value for amplitude_value[153], expected 211, is %d", - check_msg->amplitude_value[153]); - ck_assert_msg( - check_msg->amplitude_value[154] == 241, - "incorrect value for amplitude_value[154], expected 241, is %d", - check_msg->amplitude_value[154]); - ck_assert_msg( - check_msg->amplitude_value[155] == 13, - "incorrect value for amplitude_value[155], expected 13, is %d", - check_msg->amplitude_value[155]); - ck_assert_msg( - check_msg->amplitude_value[156] == 16, - "incorrect value for amplitude_value[156], expected 16, is %d", - check_msg->amplitude_value[156]); - ck_assert_msg( - check_msg->amplitude_value[157] == 61, - "incorrect value for amplitude_value[157], expected 61, is %d", - check_msg->amplitude_value[157]); - ck_assert_msg( - check_msg->amplitude_value[158] == 141, - "incorrect value for amplitude_value[158], expected 141, is %d", - check_msg->amplitude_value[158]); - ck_assert_msg( - check_msg->amplitude_value[159] == 101, - "incorrect value for amplitude_value[159], expected 101, is %d", - check_msg->amplitude_value[159]); - ck_assert_msg( - check_msg->amplitude_value[160] == 89, - "incorrect value for amplitude_value[160], expected 89, is %d", - check_msg->amplitude_value[160]); - ck_assert_msg( - check_msg->amplitude_value[161] == 37, - "incorrect value for amplitude_value[161], expected 37, is %d", - check_msg->amplitude_value[161]); - ck_assert_msg( - check_msg->amplitude_value[162] == 117, - "incorrect value for amplitude_value[162], expected 117, is %d", - check_msg->amplitude_value[162]); - ck_assert_msg( - check_msg->amplitude_value[163] == 189, - "incorrect value for amplitude_value[163], expected 189, is %d", - check_msg->amplitude_value[163]); - ck_assert_msg( - check_msg->amplitude_value[164] == 86, - "incorrect value for amplitude_value[164], expected 86, is %d", - check_msg->amplitude_value[164]); - ck_assert_msg( - check_msg->amplitude_value[165] == 118, - "incorrect value for amplitude_value[165], expected 118, is %d", - check_msg->amplitude_value[165]); - ck_assert_msg( - check_msg->amplitude_value[166] == 176, - "incorrect value for amplitude_value[166], expected 176, is %d", - check_msg->amplitude_value[166]); - ck_assert_msg( - check_msg->amplitude_value[167] == 228, - "incorrect value for amplitude_value[167], expected 228, is %d", - check_msg->amplitude_value[167]); - ck_assert_msg( - check_msg->amplitude_value[168] == 12, - "incorrect value for amplitude_value[168], expected 12, is %d", - check_msg->amplitude_value[168]); - ck_assert_msg( - check_msg->amplitude_value[169] == 14, - "incorrect value for amplitude_value[169], expected 14, is %d", - check_msg->amplitude_value[169]); - ck_assert_msg( - check_msg->amplitude_value[170] == 119, - "incorrect value for amplitude_value[170], expected 119, is %d", - check_msg->amplitude_value[170]); - ck_assert_msg( - check_msg->amplitude_value[171] == 135, - "incorrect value for amplitude_value[171], expected 135, is %d", - check_msg->amplitude_value[171]); - ck_assert_msg( - check_msg->amplitude_value[172] == 129, - "incorrect value for amplitude_value[172], expected 129, is %d", - check_msg->amplitude_value[172]); - ck_assert_msg( - check_msg->amplitude_value[173] == 243, - "incorrect value for amplitude_value[173], expected 243, is %d", - check_msg->amplitude_value[173]); - ck_assert_msg( - check_msg->amplitude_value[174] == 50, - "incorrect value for amplitude_value[174], expected 50, is %d", - check_msg->amplitude_value[174]); - ck_assert_msg( - check_msg->amplitude_value[175] == 29, - "incorrect value for amplitude_value[175], expected 29, is %d", - check_msg->amplitude_value[175]); - ck_assert_msg( - check_msg->amplitude_value[176] == 207, - "incorrect value for amplitude_value[176], expected 207, is %d", - check_msg->amplitude_value[176]); - ck_assert_msg( - check_msg->amplitude_value[177] == 198, - "incorrect value for amplitude_value[177], expected 198, is %d", - check_msg->amplitude_value[177]); - ck_assert_msg( - check_msg->amplitude_value[178] == 117, - "incorrect value for amplitude_value[178], expected 117, is %d", - check_msg->amplitude_value[178]); - ck_assert_msg( - check_msg->amplitude_value[179] == 100, - "incorrect value for amplitude_value[179], expected 100, is %d", - check_msg->amplitude_value[179]); - ck_assert_msg( - check_msg->amplitude_value[180] == 225, - "incorrect value for amplitude_value[180], expected 225, is %d", - check_msg->amplitude_value[180]); - ck_assert_msg(check_msg->amplitude_value[181] == 6, - "incorrect value for amplitude_value[181], expected 6, is %d", - check_msg->amplitude_value[181]); - ck_assert_msg( - check_msg->amplitude_value[182] == 139, - "incorrect value for amplitude_value[182], expected 139, is %d", - check_msg->amplitude_value[182]); - ck_assert_msg( - check_msg->amplitude_value[183] == 110, - "incorrect value for amplitude_value[183], expected 110, is %d", - check_msg->amplitude_value[183]); - ck_assert_msg( - check_msg->amplitude_value[184] == 39, - "incorrect value for amplitude_value[184], expected 39, is %d", - check_msg->amplitude_value[184]); - ck_assert_msg( - check_msg->amplitude_value[185] == 210, - "incorrect value for amplitude_value[185], expected 210, is %d", - check_msg->amplitude_value[185]); - ck_assert_msg( - check_msg->amplitude_value[186] == 68, - "incorrect value for amplitude_value[186], expected 68, is %d", - check_msg->amplitude_value[186]); - ck_assert_msg( - check_msg->amplitude_value[187] == 199, - "incorrect value for amplitude_value[187], expected 199, is %d", - check_msg->amplitude_value[187]); - ck_assert_msg( - check_msg->amplitude_value[188] == 43, - "incorrect value for amplitude_value[188], expected 43, is %d", - check_msg->amplitude_value[188]); - ck_assert_msg( - check_msg->amplitude_value[189] == 132, - "incorrect value for amplitude_value[189], expected 132, is %d", - check_msg->amplitude_value[189]); - ck_assert_msg( - check_msg->amplitude_value[190] == 64, - "incorrect value for amplitude_value[190], expected 64, is %d", - check_msg->amplitude_value[190]); - ck_assert_msg( - check_msg->amplitude_value[191] == 17, - "incorrect value for amplitude_value[191], expected 17, is %d", - check_msg->amplitude_value[191]); - ck_assert_msg( - check_msg->amplitude_value[192] == 51, - "incorrect value for amplitude_value[192], expected 51, is %d", - check_msg->amplitude_value[192]); - ck_assert_msg( - check_msg->amplitude_value[193] == 173, - "incorrect value for amplitude_value[193], expected 173, is %d", - check_msg->amplitude_value[193]); - ck_assert_msg( - check_msg->amplitude_value[194] == 181, - "incorrect value for amplitude_value[194], expected 181, is %d", - check_msg->amplitude_value[194]); - ck_assert_msg( - check_msg->amplitude_value[195] == 12, - "incorrect value for amplitude_value[195], expected 12, is %d", - check_msg->amplitude_value[195]); - ck_assert_msg( - check_msg->amplitude_value[196] == 140, - "incorrect value for amplitude_value[196], expected 140, is %d", - check_msg->amplitude_value[196]); - ck_assert_msg( - check_msg->amplitude_value[197] == 16, - "incorrect value for amplitude_value[197], expected 16, is %d", - check_msg->amplitude_value[197]); - ck_assert_msg( - check_msg->amplitude_value[198] == 247, - "incorrect value for amplitude_value[198], expected 247, is %d", - check_msg->amplitude_value[198]); - ck_assert_msg( - check_msg->amplitude_value[199] == 84, - "incorrect value for amplitude_value[199], expected 84, is %d", - check_msg->amplitude_value[199]); - ck_assert_msg( - check_msg->amplitude_value[200] == 183, - "incorrect value for amplitude_value[200], expected 183, is %d", - check_msg->amplitude_value[200]); - ck_assert_msg( - check_msg->amplitude_value[201] == 105, - "incorrect value for amplitude_value[201], expected 105, is %d", - check_msg->amplitude_value[201]); - ck_assert_msg( - check_msg->amplitude_value[202] == 39, - "incorrect value for amplitude_value[202], expected 39, is %d", - check_msg->amplitude_value[202]); - ck_assert_msg( - check_msg->amplitude_value[203] == 157, - "incorrect value for amplitude_value[203], expected 157, is %d", - check_msg->amplitude_value[203]); - ck_assert_msg( - check_msg->amplitude_value[204] == 77, - "incorrect value for amplitude_value[204], expected 77, is %d", - check_msg->amplitude_value[204]); - ck_assert_msg( - check_msg->amplitude_value[205] == 30, - "incorrect value for amplitude_value[205], expected 30, is %d", - check_msg->amplitude_value[205]); - ck_assert_msg( - check_msg->amplitude_value[206] == 205, - "incorrect value for amplitude_value[206], expected 205, is %d", - check_msg->amplitude_value[206]); - ck_assert_msg( - check_msg->amplitude_value[207] == 194, - "incorrect value for amplitude_value[207], expected 194, is %d", - check_msg->amplitude_value[207]); - ck_assert_msg( - check_msg->amplitude_value[208] == 59, - "incorrect value for amplitude_value[208], expected 59, is %d", - check_msg->amplitude_value[208]); - ck_assert_msg( - check_msg->amplitude_value[209] == 64, - "incorrect value for amplitude_value[209], expected 64, is %d", - check_msg->amplitude_value[209]); - ck_assert_msg( - check_msg->amplitude_value[210] == 241, - "incorrect value for amplitude_value[210], expected 241, is %d", - check_msg->amplitude_value[210]); - ck_assert_msg( - check_msg->amplitude_value[211] == 183, - "incorrect value for amplitude_value[211], expected 183, is %d", - check_msg->amplitude_value[211]); - ck_assert_msg( - check_msg->amplitude_value[212] == 238, - "incorrect value for amplitude_value[212], expected 238, is %d", - check_msg->amplitude_value[212]); - ck_assert_msg( - check_msg->amplitude_value[213] == 105, - "incorrect value for amplitude_value[213], expected 105, is %d", - check_msg->amplitude_value[213]); - ck_assert_msg( - check_msg->amplitude_value[214] == 181, - "incorrect value for amplitude_value[214], expected 181, is %d", - check_msg->amplitude_value[214]); - ck_assert_msg( - check_msg->amplitude_value[215] == 170, - "incorrect value for amplitude_value[215], expected 170, is %d", - check_msg->amplitude_value[215]); - ck_assert_msg( - check_msg->amplitude_value[216] == 45, - "incorrect value for amplitude_value[216], expected 45, is %d", - check_msg->amplitude_value[216]); - ck_assert_msg(check_msg->amplitude_value[217] == 8, - "incorrect value for amplitude_value[217], expected 8, is %d", - check_msg->amplitude_value[217]); - ck_assert_msg( - check_msg->amplitude_value[218] == 166, - "incorrect value for amplitude_value[218], expected 166, is %d", - check_msg->amplitude_value[218]); - ck_assert_msg( - check_msg->amplitude_value[219] == 164, - "incorrect value for amplitude_value[219], expected 164, is %d", - check_msg->amplitude_value[219]); - ck_assert_msg( - check_msg->amplitude_value[220] == 238, - "incorrect value for amplitude_value[220], expected 238, is %d", - check_msg->amplitude_value[220]); - ck_assert_msg( - check_msg->amplitude_value[221] == 83, - "incorrect value for amplitude_value[221], expected 83, is %d", - check_msg->amplitude_value[221]); - ck_assert_msg( - check_msg->amplitude_value[222] == 148, - "incorrect value for amplitude_value[222], expected 148, is %d", - check_msg->amplitude_value[222]); - ck_assert_msg( - check_msg->amplitude_value[223] == 173, - "incorrect value for amplitude_value[223], expected 173, is %d", - check_msg->amplitude_value[223]); - ck_assert_msg( - check_msg->amplitude_value[224] == 108, - "incorrect value for amplitude_value[224], expected 108, is %d", - check_msg->amplitude_value[224]); - ck_assert_msg( - check_msg->amplitude_value[225] == 228, - "incorrect value for amplitude_value[225], expected 228, is %d", - check_msg->amplitude_value[225]); - ck_assert_msg( - check_msg->amplitude_value[226] == 67, - "incorrect value for amplitude_value[226], expected 67, is %d", - check_msg->amplitude_value[226]); - ck_assert_msg( - check_msg->amplitude_value[227] == 89, - "incorrect value for amplitude_value[227], expected 89, is %d", - check_msg->amplitude_value[227]); - ck_assert_msg( - check_msg->amplitude_value[228] == 189, - "incorrect value for amplitude_value[228], expected 189, is %d", - check_msg->amplitude_value[228]); - ck_assert_msg( - check_msg->amplitude_value[229] == 67, - "incorrect value for amplitude_value[229], expected 67, is %d", - check_msg->amplitude_value[229]); - ck_assert_msg( - check_msg->amplitude_value[230] == 26, - "incorrect value for amplitude_value[230], expected 26, is %d", - check_msg->amplitude_value[230]); - ck_assert_msg(check_msg->channel_tag == 5878, - "incorrect value for channel_tag, expected 5878, is %d", - check_msg->channel_tag); - ck_assert_msg((check_msg->freq_ref * 100 - 6348.20019531 * 100) < 0.05, - "incorrect value for freq_ref, expected 6348.20019531, is %f", - check_msg->freq_ref); - ck_assert_msg( - (check_msg->freq_step * 100 - 4608.20019531 * 100) < 0.05, - "incorrect value for freq_step, expected 4608.20019531, is %f", - check_msg->freq_step); - ck_assert_msg(check_msg->t.tow == 992295133, - "incorrect value for t.tow, expected 992295133, is %d", - check_msg->t.tow); - ck_assert_msg(check_msg->t.wn == 6957, - "incorrect value for t.wn, expected 6957, is %d", - check_msg->t.wn); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_piksi_MsgSpecanDep_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgSpecanDep"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_piksi_MsgSpecanDep"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgSpecanDep); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgThreadState.c b/c/test/legacy/auto_check_sbp_piksi_MsgThreadState.c deleted file mode 100644 index dcd7757d93..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgThreadState.c +++ /dev/null @@ -1,1362 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgThreadState.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgThreadState) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x17, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x17, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 23, 0, 246, 215, 26, 109, 97, 105, 110, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 9, 0, 0, 73, 138, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_thread_state_t* test_msg = (msg_thread_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cpu = 0; - { - const char assign_string[] = { - (char)109, (char)97, (char)105, (char)110, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->stack_free = 2460; - sbp_payload_send(&sbp_state, 0x17, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x17, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_thread_state_t* check_msg = (msg_thread_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cpu == 0, - "incorrect value for cpu, expected 0, is %d", check_msg->cpu); - { - const char check_string[] = { - (char)109, (char)97, (char)105, (char)110, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->name, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->name, expected string '%s', is '%s'", - check_string, check_msg->name); - } - ck_assert_msg(check_msg->stack_free == 2460, - "incorrect value for stack_free, expected 2460, is %d", - check_msg->stack_free); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x17, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x17, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 23, 0, 246, 215, 26, 105, 100, 108, 101, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 2, 36, 0, 0, 0, 151, 20, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_thread_state_t* test_msg = (msg_thread_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cpu = 595; - { - const char assign_string[] = { - (char)105, (char)100, (char)108, (char)101, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->stack_free = 36; - sbp_payload_send(&sbp_state, 0x17, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x17, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_thread_state_t* check_msg = (msg_thread_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cpu == 595, - "incorrect value for cpu, expected 595, is %d", - check_msg->cpu); - { - const char check_string[] = { - (char)105, (char)100, (char)108, (char)101, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->name, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->name, expected string '%s', is '%s'", - check_string, check_msg->name); - } - ck_assert_msg(check_msg->stack_free == 36, - "incorrect value for stack_free, expected 36, is %d", - check_msg->stack_free); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x17, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x17, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 23, 0, 246, 215, 26, 78, 65, 80, 32, 73, 83, 82, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 116, 4, 0, 0, 226, 60, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_thread_state_t* test_msg = (msg_thread_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cpu = 14; - { - const char assign_string[] = { - (char)78, (char)65, (char)80, (char)32, (char)73, (char)83, (char)82, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->stack_free = 1140; - sbp_payload_send(&sbp_state, 0x17, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x17, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_thread_state_t* check_msg = (msg_thread_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cpu == 14, - "incorrect value for cpu, expected 14, is %d", - check_msg->cpu); - { - const char check_string[] = { - (char)78, (char)65, (char)80, (char)32, (char)73, (char)83, (char)82, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->name, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->name, expected string '%s', is '%s'", - check_string, check_msg->name); - } - ck_assert_msg(check_msg->stack_free == 1140, - "incorrect value for stack_free, expected 1140, is %d", - check_msg->stack_free); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x17, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x17, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 23, 0, 246, 215, 26, 83, 66, 80, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 196, 19, 0, 0, 90, 169, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_thread_state_t* test_msg = (msg_thread_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cpu = 1; - { - const char assign_string[] = { - (char)83, (char)66, (char)80, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->stack_free = 5060; - sbp_payload_send(&sbp_state, 0x17, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x17, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_thread_state_t* check_msg = (msg_thread_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cpu == 1, - "incorrect value for cpu, expected 1, is %d", check_msg->cpu); - { - const char check_string[] = { - (char)83, (char)66, (char)80, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->name, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->name, expected string '%s', is '%s'", - check_string, check_msg->name); - } - ck_assert_msg(check_msg->stack_free == 5060, - "incorrect value for stack_free, expected 5060, is %d", - check_msg->stack_free); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x17, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x17, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 23, 0, 246, 215, 26, 109, 97, 110, 97, 103, 101, - 32, 97, 99, 113, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 7, 0, 20, 9, 0, 0, 47, 75, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_thread_state_t* test_msg = (msg_thread_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cpu = 7; - { - const char assign_string[] = {(char)109, (char)97, (char)110, (char)97, - (char)103, (char)101, (char)32, (char)97, - (char)99, (char)113, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->stack_free = 2324; - sbp_payload_send(&sbp_state, 0x17, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x17, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_thread_state_t* check_msg = (msg_thread_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cpu == 7, - "incorrect value for cpu, expected 7, is %d", check_msg->cpu); - { - const char check_string[] = {(char)109, (char)97, (char)110, (char)97, - (char)103, (char)101, (char)32, (char)97, - (char)99, (char)113, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->name, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->name, expected string '%s', is '%s'", - check_string, check_msg->name); - } - ck_assert_msg(check_msg->stack_free == 2324, - "incorrect value for stack_free, expected 2324, is %d", - check_msg->stack_free); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x17, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x17, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 23, 0, 195, 4, 26, 109, 97, 105, 110, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 148, 9, 0, 0, 195, 212, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_thread_state_t* test_msg = (msg_thread_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cpu = 0; - { - const char assign_string[] = { - (char)109, (char)97, (char)105, (char)110, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->stack_free = 2452; - sbp_payload_send(&sbp_state, 0x17, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x17, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_thread_state_t* check_msg = (msg_thread_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cpu == 0, - "incorrect value for cpu, expected 0, is %d", check_msg->cpu); - { - const char check_string[] = { - (char)109, (char)97, (char)105, (char)110, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->name, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->name, expected string '%s', is '%s'", - check_string, check_msg->name); - } - ck_assert_msg(check_msg->stack_free == 2452, - "incorrect value for stack_free, expected 2452, is %d", - check_msg->stack_free); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x17, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x17, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 23, 0, 195, 4, 26, 105, 100, 108, 101, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 228, 1, 36, 0, 0, 0, 225, 18, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_thread_state_t* test_msg = (msg_thread_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cpu = 484; - { - const char assign_string[] = { - (char)105, (char)100, (char)108, (char)101, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->stack_free = 36; - sbp_payload_send(&sbp_state, 0x17, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x17, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_thread_state_t* check_msg = (msg_thread_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cpu == 484, - "incorrect value for cpu, expected 484, is %d", - check_msg->cpu); - { - const char check_string[] = { - (char)105, (char)100, (char)108, (char)101, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->name, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->name, expected string '%s', is '%s'", - check_string, check_msg->name); - } - ck_assert_msg(check_msg->stack_free == 36, - "incorrect value for stack_free, expected 36, is %d", - check_msg->stack_free); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x17, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x17, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 23, 0, 195, 4, 26, 78, 65, 80, 32, 73, 83, 82, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 1, 92, 7, 0, 0, 166, 116, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_thread_state_t* test_msg = (msg_thread_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cpu = 394; - { - const char assign_string[] = { - (char)78, (char)65, (char)80, (char)32, (char)73, (char)83, (char)82, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->stack_free = 1884; - sbp_payload_send(&sbp_state, 0x17, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x17, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_thread_state_t* check_msg = (msg_thread_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cpu == 394, - "incorrect value for cpu, expected 394, is %d", - check_msg->cpu); - { - const char check_string[] = { - (char)78, (char)65, (char)80, (char)32, (char)73, (char)83, (char)82, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->name, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->name, expected string '%s', is '%s'", - check_string, check_msg->name); - } - ck_assert_msg(check_msg->stack_free == 1884, - "incorrect value for stack_free, expected 1884, is %d", - check_msg->stack_free); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x17, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x17, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 23, 0, 195, 4, 26, 83, 66, 80, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 12, 0, 0, 229, 174, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_thread_state_t* test_msg = (msg_thread_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cpu = 1; - { - const char assign_string[] = { - (char)83, (char)66, (char)80, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->stack_free = 3076; - sbp_payload_send(&sbp_state, 0x17, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x17, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_thread_state_t* check_msg = (msg_thread_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cpu == 1, - "incorrect value for cpu, expected 1, is %d", check_msg->cpu); - { - const char check_string[] = { - (char)83, (char)66, (char)80, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->name, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->name, expected string '%s', is '%s'", - check_string, check_msg->name); - } - ck_assert_msg(check_msg->stack_free == 3076, - "incorrect value for stack_free, expected 3076, is %d", - check_msg->stack_free); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x17, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x17, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 23, 0, 195, 4, 26, 109, 97, 110, 97, 103, 101, 32, 97, 99, 113, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 124, 9, 0, 0, 52, 2, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_thread_state_t* test_msg = (msg_thread_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cpu = 10; - { - const char assign_string[] = {(char)109, (char)97, (char)110, (char)97, - (char)103, (char)101, (char)32, (char)97, - (char)99, (char)113, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->stack_free = 2428; - sbp_payload_send(&sbp_state, 0x17, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x17, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_thread_state_t* check_msg = (msg_thread_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cpu == 10, - "incorrect value for cpu, expected 10, is %d", - check_msg->cpu); - { - const char check_string[] = {(char)109, (char)97, (char)110, (char)97, - (char)103, (char)101, (char)32, (char)97, - (char)99, (char)113, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->name, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->name, expected string '%s', is '%s'", - check_string, check_msg->name); - } - ck_assert_msg(check_msg->stack_free == 2428, - "incorrect value for stack_free, expected 2428, is %d", - check_msg->stack_free); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x17, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x17, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 23, 0, 195, 4, 26, 109, 97, 110, 97, 103, 101, - 32, 116, 114, 97, 99, 107, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 28, 9, 0, 0, 122, 54, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_thread_state_t* test_msg = (msg_thread_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cpu = 0; - { - const char assign_string[] = {(char)109, (char)97, (char)110, (char)97, - (char)103, (char)101, (char)32, (char)116, - (char)114, (char)97, (char)99, (char)107, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->stack_free = 2332; - sbp_payload_send(&sbp_state, 0x17, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x17, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_thread_state_t* check_msg = (msg_thread_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cpu == 0, - "incorrect value for cpu, expected 0, is %d", check_msg->cpu); - { - const char check_string[] = {(char)109, (char)97, (char)110, (char)97, - (char)103, (char)101, (char)32, (char)116, - (char)114, (char)97, (char)99, (char)107, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - ck_assert_msg( - memcmp(check_msg->name, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->name, expected string '%s', is '%s'", - check_string, check_msg->name); - } - ck_assert_msg(check_msg->stack_free == 2332, - "incorrect value for stack_free, expected 2332, is %d", - check_msg->stack_free); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_piksi_MsgThreadState_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgThreadState"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_piksi_MsgThreadState"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgThreadState); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgUartState.c b/c/test/legacy/auto_check_sbp_piksi_MsgUartState.c deleted file mode 100644 index a4a641ad4b..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgUartState.c +++ /dev/null @@ -1,746 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgUartState.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgUartState) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x1d, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x1d, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 29, 0, 200, 224, 74, 154, 169, 242, 69, 102, 166, 231, 68, - 89, 98, 79, 184, 138, 244, 154, 73, 201, 69, 154, 65, 211, 69, - 201, 16, 103, 249, 143, 161, 154, 17, 186, 69, 51, 211, 7, 69, - 215, 149, 253, 25, 218, 24, 29, 195, 16, 19, 159, 142, 71, 17, - 10, 113, 137, 219, 135, 18, 182, 21, 38, 190, 59, 196, 169, 155, - 107, 111, 253, 168, 244, 158, 112, 19, 251, 131, 100, 225, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_uart_state_t* test_msg = (msg_uart_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->latency.avg = 319865629; - test_msg->latency.current = 364253831; - test_msg->latency.lmax = -611749622; - test_msg->latency.lmin = 289902239; - test_msg->obs_period.avg = -1002717658; - test_msg->obs_period.current = -2080697488; - test_msg->obs_period.pmax = -1628133123; - test_msg->obs_period.pmin = 1869323177; - test_msg->uart_a.crc_error_count = 25177; - test_msg->uart_a.io_error_count = 47183; - test_msg->uart_a.rx_buffer_level = 244; - test_msg->uart_a.rx_throughput = 1853.199951171875; - test_msg->uart_a.tx_buffer_level = 138; - test_msg->uart_a.tx_throughput = 7765.2001953125; - test_msg->uart_b.crc_error_count = 4297; - test_msg->uart_b.io_error_count = 63847; - test_msg->uart_b.rx_buffer_level = 161; - test_msg->uart_b.rx_throughput = 6760.2001953125; - test_msg->uart_b.tx_buffer_level = 143; - test_msg->uart_b.tx_throughput = 6441.2001953125; - test_msg->uart_ftdi.crc_error_count = 38359; - test_msg->uart_ftdi.io_error_count = 6653; - test_msg->uart_ftdi.rx_buffer_level = 24; - test_msg->uart_ftdi.rx_throughput = 2173.199951171875; - test_msg->uart_ftdi.tx_buffer_level = 218; - test_msg->uart_ftdi.tx_throughput = 5954.2001953125; - sbp_payload_send(&sbp_state, 0x1d, 57544, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 57544, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 57544, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x1d, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_uart_state_t* check_msg = (msg_uart_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->latency.avg == 319865629, - "incorrect value for latency.avg, expected 319865629, is %d", - check_msg->latency.avg); - ck_assert_msg( - check_msg->latency.current == 364253831, - "incorrect value for latency.current, expected 364253831, is %d", - check_msg->latency.current); - ck_assert_msg( - check_msg->latency.lmax == -611749622, - "incorrect value for latency.lmax, expected -611749622, is %d", - check_msg->latency.lmax); - ck_assert_msg(check_msg->latency.lmin == 289902239, - "incorrect value for latency.lmin, expected 289902239, is %d", - check_msg->latency.lmin); - ck_assert_msg( - check_msg->obs_period.avg == -1002717658, - "incorrect value for obs_period.avg, expected -1002717658, is %d", - check_msg->obs_period.avg); - ck_assert_msg( - check_msg->obs_period.current == -2080697488, - "incorrect value for obs_period.current, expected -2080697488, is %d", - check_msg->obs_period.current); - ck_assert_msg( - check_msg->obs_period.pmax == -1628133123, - "incorrect value for obs_period.pmax, expected -1628133123, is %d", - check_msg->obs_period.pmax); - ck_assert_msg( - check_msg->obs_period.pmin == 1869323177, - "incorrect value for obs_period.pmin, expected 1869323177, is %d", - check_msg->obs_period.pmin); - ck_assert_msg( - check_msg->uart_a.crc_error_count == 25177, - "incorrect value for uart_a.crc_error_count, expected 25177, is %d", - check_msg->uart_a.crc_error_count); - ck_assert_msg( - check_msg->uart_a.io_error_count == 47183, - "incorrect value for uart_a.io_error_count, expected 47183, is %d", - check_msg->uart_a.io_error_count); - ck_assert_msg( - check_msg->uart_a.rx_buffer_level == 244, - "incorrect value for uart_a.rx_buffer_level, expected 244, is %d", - check_msg->uart_a.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.rx_throughput * 100 - 1853.19995117 * 100) < 0.05, - "incorrect value for uart_a.rx_throughput, expected 1853.19995117, is " - "%f", - check_msg->uart_a.rx_throughput); - ck_assert_msg( - check_msg->uart_a.tx_buffer_level == 138, - "incorrect value for uart_a.tx_buffer_level, expected 138, is %d", - check_msg->uart_a.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.tx_throughput * 100 - 7765.20019531 * 100) < 0.05, - "incorrect value for uart_a.tx_throughput, expected 7765.20019531, is " - "%f", - check_msg->uart_a.tx_throughput); - ck_assert_msg( - check_msg->uart_b.crc_error_count == 4297, - "incorrect value for uart_b.crc_error_count, expected 4297, is %d", - check_msg->uart_b.crc_error_count); - ck_assert_msg( - check_msg->uart_b.io_error_count == 63847, - "incorrect value for uart_b.io_error_count, expected 63847, is %d", - check_msg->uart_b.io_error_count); - ck_assert_msg( - check_msg->uart_b.rx_buffer_level == 161, - "incorrect value for uart_b.rx_buffer_level, expected 161, is %d", - check_msg->uart_b.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.rx_throughput * 100 - 6760.20019531 * 100) < 0.05, - "incorrect value for uart_b.rx_throughput, expected 6760.20019531, is " - "%f", - check_msg->uart_b.rx_throughput); - ck_assert_msg( - check_msg->uart_b.tx_buffer_level == 143, - "incorrect value for uart_b.tx_buffer_level, expected 143, is %d", - check_msg->uart_b.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.tx_throughput * 100 - 6441.20019531 * 100) < 0.05, - "incorrect value for uart_b.tx_throughput, expected 6441.20019531, is " - "%f", - check_msg->uart_b.tx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.crc_error_count == 38359, - "incorrect value for uart_ftdi.crc_error_count, expected 38359, is %d", - check_msg->uart_ftdi.crc_error_count); - ck_assert_msg( - check_msg->uart_ftdi.io_error_count == 6653, - "incorrect value for uart_ftdi.io_error_count, expected 6653, is %d", - check_msg->uart_ftdi.io_error_count); - ck_assert_msg( - check_msg->uart_ftdi.rx_buffer_level == 24, - "incorrect value for uart_ftdi.rx_buffer_level, expected 24, is %d", - check_msg->uart_ftdi.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_ftdi.rx_throughput * 100 - 2173.19995117 * 100) < 0.05, - "incorrect value for uart_ftdi.rx_throughput, expected 2173.19995117, " - "is %f", - check_msg->uart_ftdi.rx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.tx_buffer_level == 218, - "incorrect value for uart_ftdi.tx_buffer_level, expected 218, is %d", - check_msg->uart_ftdi.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_ftdi.tx_throughput * 100 - 5954.20019531 * 100) < 0.05, - "incorrect value for uart_ftdi.tx_throughput, expected 5954.20019531, " - "is %f", - check_msg->uart_ftdi.tx_throughput); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x18, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x18, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 24, 0, 246, 215, 58, 26, 191, 93, 63, 0, 0, 0, 0, - 0, 0, 0, 0, 24, 0, 123, 50, 62, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 54, 7, 162, 64, 177, 57, 16, 61, - 0, 0, 0, 0, 81, 1, 255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, 71, 124, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_uart_state_depa_t* test_msg = (msg_uart_state_depa_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->latency.avg = -1; - test_msg->latency.current = -1; - test_msg->latency.lmax = 0; - test_msg->latency.lmin = 0; - test_msg->uart_a.crc_error_count = 0; - test_msg->uart_a.io_error_count = 0; - test_msg->uart_a.rx_buffer_level = 0; - test_msg->uart_a.rx_throughput = 0.0; - test_msg->uart_a.tx_buffer_level = 24; - test_msg->uart_a.tx_throughput = 0.8661972284317017; - test_msg->uart_b.crc_error_count = 0; - test_msg->uart_b.io_error_count = 0; - test_msg->uart_b.rx_buffer_level = 0; - test_msg->uart_b.rx_throughput = 0.0; - test_msg->uart_b.tx_buffer_level = 40; - test_msg->uart_b.tx_throughput = 2.9718310832977295; - test_msg->uart_ftdi.crc_error_count = 0; - test_msg->uart_ftdi.io_error_count = 0; - test_msg->uart_ftdi.rx_buffer_level = 1; - test_msg->uart_ftdi.rx_throughput = 0.035211268812417984; - test_msg->uart_ftdi.tx_buffer_level = 81; - test_msg->uart_ftdi.tx_throughput = 5.063380241394043; - sbp_payload_send(&sbp_state, 0x18, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x18, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_uart_state_depa_t* check_msg = - (msg_uart_state_depa_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->latency.avg == -1, - "incorrect value for latency.avg, expected -1, is %d", - check_msg->latency.avg); - ck_assert_msg(check_msg->latency.current == -1, - "incorrect value for latency.current, expected -1, is %d", - check_msg->latency.current); - ck_assert_msg(check_msg->latency.lmax == 0, - "incorrect value for latency.lmax, expected 0, is %d", - check_msg->latency.lmax); - ck_assert_msg(check_msg->latency.lmin == 0, - "incorrect value for latency.lmin, expected 0, is %d", - check_msg->latency.lmin); - ck_assert_msg( - check_msg->uart_a.crc_error_count == 0, - "incorrect value for uart_a.crc_error_count, expected 0, is %d", - check_msg->uart_a.crc_error_count); - ck_assert_msg( - check_msg->uart_a.io_error_count == 0, - "incorrect value for uart_a.io_error_count, expected 0, is %d", - check_msg->uart_a.io_error_count); - ck_assert_msg( - check_msg->uart_a.rx_buffer_level == 0, - "incorrect value for uart_a.rx_buffer_level, expected 0, is %d", - check_msg->uart_a.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_a.rx_throughput, expected 0.0, is %f", - check_msg->uart_a.rx_throughput); - ck_assert_msg( - check_msg->uart_a.tx_buffer_level == 24, - "incorrect value for uart_a.tx_buffer_level, expected 24, is %d", - check_msg->uart_a.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.tx_throughput * 100 - 0.866197228432 * 100) < 0.05, - "incorrect value for uart_a.tx_throughput, expected 0.866197228432, is " - "%f", - check_msg->uart_a.tx_throughput); - ck_assert_msg( - check_msg->uart_b.crc_error_count == 0, - "incorrect value for uart_b.crc_error_count, expected 0, is %d", - check_msg->uart_b.crc_error_count); - ck_assert_msg( - check_msg->uart_b.io_error_count == 0, - "incorrect value for uart_b.io_error_count, expected 0, is %d", - check_msg->uart_b.io_error_count); - ck_assert_msg( - check_msg->uart_b.rx_buffer_level == 0, - "incorrect value for uart_b.rx_buffer_level, expected 0, is %d", - check_msg->uart_b.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_b.rx_throughput, expected 0.0, is %f", - check_msg->uart_b.rx_throughput); - ck_assert_msg( - check_msg->uart_b.tx_buffer_level == 40, - "incorrect value for uart_b.tx_buffer_level, expected 40, is %d", - check_msg->uart_b.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.tx_throughput * 100 - 2.9718310833 * 100) < 0.05, - "incorrect value for uart_b.tx_throughput, expected 2.9718310833, is " - "%f", - check_msg->uart_b.tx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.crc_error_count == 0, - "incorrect value for uart_ftdi.crc_error_count, expected 0, is %d", - check_msg->uart_ftdi.crc_error_count); - ck_assert_msg( - check_msg->uart_ftdi.io_error_count == 0, - "incorrect value for uart_ftdi.io_error_count, expected 0, is %d", - check_msg->uart_ftdi.io_error_count); - ck_assert_msg( - check_msg->uart_ftdi.rx_buffer_level == 1, - "incorrect value for uart_ftdi.rx_buffer_level, expected 1, is %d", - check_msg->uart_ftdi.rx_buffer_level); - ck_assert_msg((check_msg->uart_ftdi.rx_throughput * 100 - - 0.0352112688124 * 100) < 0.05, - "incorrect value for uart_ftdi.rx_throughput, expected " - "0.0352112688124, is %f", - check_msg->uart_ftdi.rx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.tx_buffer_level == 81, - "incorrect value for uart_ftdi.tx_buffer_level, expected 81, is %d", - check_msg->uart_ftdi.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_ftdi.tx_throughput * 100 - 5.06338024139 * 100) < 0.05, - "incorrect value for uart_ftdi.tx_throughput, expected 5.06338024139, " - "is %f", - check_msg->uart_ftdi.tx_throughput); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x18, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x18, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 24, 0, 246, 215, 58, 237, 232, 95, 63, 0, 0, 0, 0, - 0, 0, 0, 0, 24, 0, 198, 186, 63, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 214, 72, 217, 64, 29, 72, 180, 62, - 0, 0, 0, 0, 85, 1, 255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, 153, 248, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_uart_state_depa_t* test_msg = (msg_uart_state_depa_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->latency.avg = -1; - test_msg->latency.current = -1; - test_msg->latency.lmax = 0; - test_msg->latency.lmin = 0; - test_msg->uart_a.crc_error_count = 0; - test_msg->uart_a.io_error_count = 0; - test_msg->uart_a.rx_buffer_level = 0; - test_msg->uart_a.rx_throughput = 0.0; - test_msg->uart_a.tx_buffer_level = 24; - test_msg->uart_a.tx_throughput = 0.8746479153633118; - test_msg->uart_b.crc_error_count = 0; - test_msg->uart_b.io_error_count = 0; - test_msg->uart_b.rx_buffer_level = 0; - test_msg->uart_b.rx_throughput = 0.0; - test_msg->uart_b.tx_buffer_level = 40; - test_msg->uart_b.tx_throughput = 2.995774745941162; - test_msg->uart_ftdi.crc_error_count = 0; - test_msg->uart_ftdi.io_error_count = 0; - test_msg->uart_ftdi.rx_buffer_level = 1; - test_msg->uart_ftdi.rx_throughput = 0.35211268067359924; - test_msg->uart_ftdi.tx_buffer_level = 85; - test_msg->uart_ftdi.tx_throughput = 6.7901411056518555; - sbp_payload_send(&sbp_state, 0x18, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x18, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_uart_state_depa_t* check_msg = - (msg_uart_state_depa_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->latency.avg == -1, - "incorrect value for latency.avg, expected -1, is %d", - check_msg->latency.avg); - ck_assert_msg(check_msg->latency.current == -1, - "incorrect value for latency.current, expected -1, is %d", - check_msg->latency.current); - ck_assert_msg(check_msg->latency.lmax == 0, - "incorrect value for latency.lmax, expected 0, is %d", - check_msg->latency.lmax); - ck_assert_msg(check_msg->latency.lmin == 0, - "incorrect value for latency.lmin, expected 0, is %d", - check_msg->latency.lmin); - ck_assert_msg( - check_msg->uart_a.crc_error_count == 0, - "incorrect value for uart_a.crc_error_count, expected 0, is %d", - check_msg->uart_a.crc_error_count); - ck_assert_msg( - check_msg->uart_a.io_error_count == 0, - "incorrect value for uart_a.io_error_count, expected 0, is %d", - check_msg->uart_a.io_error_count); - ck_assert_msg( - check_msg->uart_a.rx_buffer_level == 0, - "incorrect value for uart_a.rx_buffer_level, expected 0, is %d", - check_msg->uart_a.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_a.rx_throughput, expected 0.0, is %f", - check_msg->uart_a.rx_throughput); - ck_assert_msg( - check_msg->uart_a.tx_buffer_level == 24, - "incorrect value for uart_a.tx_buffer_level, expected 24, is %d", - check_msg->uart_a.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.tx_throughput * 100 - 0.874647915363 * 100) < 0.05, - "incorrect value for uart_a.tx_throughput, expected 0.874647915363, is " - "%f", - check_msg->uart_a.tx_throughput); - ck_assert_msg( - check_msg->uart_b.crc_error_count == 0, - "incorrect value for uart_b.crc_error_count, expected 0, is %d", - check_msg->uart_b.crc_error_count); - ck_assert_msg( - check_msg->uart_b.io_error_count == 0, - "incorrect value for uart_b.io_error_count, expected 0, is %d", - check_msg->uart_b.io_error_count); - ck_assert_msg( - check_msg->uart_b.rx_buffer_level == 0, - "incorrect value for uart_b.rx_buffer_level, expected 0, is %d", - check_msg->uart_b.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_b.rx_throughput, expected 0.0, is %f", - check_msg->uart_b.rx_throughput); - ck_assert_msg( - check_msg->uart_b.tx_buffer_level == 40, - "incorrect value for uart_b.tx_buffer_level, expected 40, is %d", - check_msg->uart_b.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.tx_throughput * 100 - 2.99577474594 * 100) < 0.05, - "incorrect value for uart_b.tx_throughput, expected 2.99577474594, is " - "%f", - check_msg->uart_b.tx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.crc_error_count == 0, - "incorrect value for uart_ftdi.crc_error_count, expected 0, is %d", - check_msg->uart_ftdi.crc_error_count); - ck_assert_msg( - check_msg->uart_ftdi.io_error_count == 0, - "incorrect value for uart_ftdi.io_error_count, expected 0, is %d", - check_msg->uart_ftdi.io_error_count); - ck_assert_msg( - check_msg->uart_ftdi.rx_buffer_level == 1, - "incorrect value for uart_ftdi.rx_buffer_level, expected 1, is %d", - check_msg->uart_ftdi.rx_buffer_level); - ck_assert_msg((check_msg->uart_ftdi.rx_throughput * 100 - - 0.352112680674 * 100) < 0.05, - "incorrect value for uart_ftdi.rx_throughput, expected " - "0.352112680674, is %f", - check_msg->uart_ftdi.rx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.tx_buffer_level == 85, - "incorrect value for uart_ftdi.tx_buffer_level, expected 85, is %d", - check_msg->uart_ftdi.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_ftdi.tx_throughput * 100 - 6.79014110565 * 100) < 0.05, - "incorrect value for uart_ftdi.tx_throughput, expected 6.79014110565, " - "is %f", - check_msg->uart_ftdi.tx_throughput); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_piksi_MsgUartState_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgUartState"); - TCase* tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_piksi_MsgUartState"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgUartState); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_piksi_MsgUartStateDepA.c b/c/test/legacy/auto_check_sbp_piksi_MsgUartStateDepA.c deleted file mode 100644 index 7b4cc17f95..0000000000 --- a/c/test/legacy/auto_check_sbp_piksi_MsgUartStateDepA.c +++ /dev/null @@ -1,1302 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgUartStateDepA.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_piksi_MsgUartStateDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x18, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x18, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 24, 0, 195, 4, 58, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 154, 153, 57, 65, 0, 0, 0, 0, - 0, 0, 0, 0, 15, 0, 255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, 247, 5, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_uart_state_depa_t* test_msg = (msg_uart_state_depa_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->latency.avg = -1; - test_msg->latency.current = -1; - test_msg->latency.lmax = 0; - test_msg->latency.lmin = 0; - test_msg->uart_a.crc_error_count = 0; - test_msg->uart_a.io_error_count = 0; - test_msg->uart_a.rx_buffer_level = 0; - test_msg->uart_a.rx_throughput = 0.0; - test_msg->uart_a.tx_buffer_level = 0; - test_msg->uart_a.tx_throughput = 0.0; - test_msg->uart_b.crc_error_count = 0; - test_msg->uart_b.io_error_count = 0; - test_msg->uart_b.rx_buffer_level = 0; - test_msg->uart_b.rx_throughput = 0.0; - test_msg->uart_b.tx_buffer_level = 0; - test_msg->uart_b.tx_throughput = 0.0; - test_msg->uart_ftdi.crc_error_count = 0; - test_msg->uart_ftdi.io_error_count = 0; - test_msg->uart_ftdi.rx_buffer_level = 0; - test_msg->uart_ftdi.rx_throughput = 0.0; - test_msg->uart_ftdi.tx_buffer_level = 15; - test_msg->uart_ftdi.tx_throughput = 11.600000381469727; - sbp_payload_send(&sbp_state, 0x18, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x18, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_uart_state_depa_t* check_msg = - (msg_uart_state_depa_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->latency.avg == -1, - "incorrect value for latency.avg, expected -1, is %d", - check_msg->latency.avg); - ck_assert_msg(check_msg->latency.current == -1, - "incorrect value for latency.current, expected -1, is %d", - check_msg->latency.current); - ck_assert_msg(check_msg->latency.lmax == 0, - "incorrect value for latency.lmax, expected 0, is %d", - check_msg->latency.lmax); - ck_assert_msg(check_msg->latency.lmin == 0, - "incorrect value for latency.lmin, expected 0, is %d", - check_msg->latency.lmin); - ck_assert_msg( - check_msg->uart_a.crc_error_count == 0, - "incorrect value for uart_a.crc_error_count, expected 0, is %d", - check_msg->uart_a.crc_error_count); - ck_assert_msg( - check_msg->uart_a.io_error_count == 0, - "incorrect value for uart_a.io_error_count, expected 0, is %d", - check_msg->uart_a.io_error_count); - ck_assert_msg( - check_msg->uart_a.rx_buffer_level == 0, - "incorrect value for uart_a.rx_buffer_level, expected 0, is %d", - check_msg->uart_a.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_a.rx_throughput, expected 0.0, is %f", - check_msg->uart_a.rx_throughput); - ck_assert_msg( - check_msg->uart_a.tx_buffer_level == 0, - "incorrect value for uart_a.tx_buffer_level, expected 0, is %d", - check_msg->uart_a.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.tx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_a.tx_throughput, expected 0.0, is %f", - check_msg->uart_a.tx_throughput); - ck_assert_msg( - check_msg->uart_b.crc_error_count == 0, - "incorrect value for uart_b.crc_error_count, expected 0, is %d", - check_msg->uart_b.crc_error_count); - ck_assert_msg( - check_msg->uart_b.io_error_count == 0, - "incorrect value for uart_b.io_error_count, expected 0, is %d", - check_msg->uart_b.io_error_count); - ck_assert_msg( - check_msg->uart_b.rx_buffer_level == 0, - "incorrect value for uart_b.rx_buffer_level, expected 0, is %d", - check_msg->uart_b.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_b.rx_throughput, expected 0.0, is %f", - check_msg->uart_b.rx_throughput); - ck_assert_msg( - check_msg->uart_b.tx_buffer_level == 0, - "incorrect value for uart_b.tx_buffer_level, expected 0, is %d", - check_msg->uart_b.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.tx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_b.tx_throughput, expected 0.0, is %f", - check_msg->uart_b.tx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.crc_error_count == 0, - "incorrect value for uart_ftdi.crc_error_count, expected 0, is %d", - check_msg->uart_ftdi.crc_error_count); - ck_assert_msg( - check_msg->uart_ftdi.io_error_count == 0, - "incorrect value for uart_ftdi.io_error_count, expected 0, is %d", - check_msg->uart_ftdi.io_error_count); - ck_assert_msg( - check_msg->uart_ftdi.rx_buffer_level == 0, - "incorrect value for uart_ftdi.rx_buffer_level, expected 0, is %d", - check_msg->uart_ftdi.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_ftdi.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_ftdi.rx_throughput, expected 0.0, is %f", - check_msg->uart_ftdi.rx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.tx_buffer_level == 15, - "incorrect value for uart_ftdi.tx_buffer_level, expected 15, is %d", - check_msg->uart_ftdi.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_ftdi.tx_throughput * 100 - 11.6000003815 * 100) < 0.05, - "incorrect value for uart_ftdi.tx_throughput, expected 11.6000003815, " - "is %f", - check_msg->uart_ftdi.tx_throughput); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x18, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x18, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 24, 0, 195, 4, 58, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 2, 43, 135, 61, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, 65, 110, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_uart_state_depa_t* test_msg = (msg_uart_state_depa_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->latency.avg = -1; - test_msg->latency.current = -1; - test_msg->latency.lmax = 0; - test_msg->latency.lmin = 0; - test_msg->uart_a.crc_error_count = 0; - test_msg->uart_a.io_error_count = 0; - test_msg->uart_a.rx_buffer_level = 0; - test_msg->uart_a.rx_throughput = 0.0; - test_msg->uart_a.tx_buffer_level = 0; - test_msg->uart_a.tx_throughput = 0.0; - test_msg->uart_b.crc_error_count = 0; - test_msg->uart_b.io_error_count = 0; - test_msg->uart_b.rx_buffer_level = 0; - test_msg->uart_b.rx_throughput = 0.0; - test_msg->uart_b.tx_buffer_level = 0; - test_msg->uart_b.tx_throughput = 0.0; - test_msg->uart_ftdi.crc_error_count = 0; - test_msg->uart_ftdi.io_error_count = 0; - test_msg->uart_ftdi.rx_buffer_level = 0; - test_msg->uart_ftdi.rx_throughput = 0.0; - test_msg->uart_ftdi.tx_buffer_level = 0; - test_msg->uart_ftdi.tx_throughput = 0.06599999964237213; - sbp_payload_send(&sbp_state, 0x18, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x18, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_uart_state_depa_t* check_msg = - (msg_uart_state_depa_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->latency.avg == -1, - "incorrect value for latency.avg, expected -1, is %d", - check_msg->latency.avg); - ck_assert_msg(check_msg->latency.current == -1, - "incorrect value for latency.current, expected -1, is %d", - check_msg->latency.current); - ck_assert_msg(check_msg->latency.lmax == 0, - "incorrect value for latency.lmax, expected 0, is %d", - check_msg->latency.lmax); - ck_assert_msg(check_msg->latency.lmin == 0, - "incorrect value for latency.lmin, expected 0, is %d", - check_msg->latency.lmin); - ck_assert_msg( - check_msg->uart_a.crc_error_count == 0, - "incorrect value for uart_a.crc_error_count, expected 0, is %d", - check_msg->uart_a.crc_error_count); - ck_assert_msg( - check_msg->uart_a.io_error_count == 0, - "incorrect value for uart_a.io_error_count, expected 0, is %d", - check_msg->uart_a.io_error_count); - ck_assert_msg( - check_msg->uart_a.rx_buffer_level == 0, - "incorrect value for uart_a.rx_buffer_level, expected 0, is %d", - check_msg->uart_a.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_a.rx_throughput, expected 0.0, is %f", - check_msg->uart_a.rx_throughput); - ck_assert_msg( - check_msg->uart_a.tx_buffer_level == 0, - "incorrect value for uart_a.tx_buffer_level, expected 0, is %d", - check_msg->uart_a.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.tx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_a.tx_throughput, expected 0.0, is %f", - check_msg->uart_a.tx_throughput); - ck_assert_msg( - check_msg->uart_b.crc_error_count == 0, - "incorrect value for uart_b.crc_error_count, expected 0, is %d", - check_msg->uart_b.crc_error_count); - ck_assert_msg( - check_msg->uart_b.io_error_count == 0, - "incorrect value for uart_b.io_error_count, expected 0, is %d", - check_msg->uart_b.io_error_count); - ck_assert_msg( - check_msg->uart_b.rx_buffer_level == 0, - "incorrect value for uart_b.rx_buffer_level, expected 0, is %d", - check_msg->uart_b.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_b.rx_throughput, expected 0.0, is %f", - check_msg->uart_b.rx_throughput); - ck_assert_msg( - check_msg->uart_b.tx_buffer_level == 0, - "incorrect value for uart_b.tx_buffer_level, expected 0, is %d", - check_msg->uart_b.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.tx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_b.tx_throughput, expected 0.0, is %f", - check_msg->uart_b.tx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.crc_error_count == 0, - "incorrect value for uart_ftdi.crc_error_count, expected 0, is %d", - check_msg->uart_ftdi.crc_error_count); - ck_assert_msg( - check_msg->uart_ftdi.io_error_count == 0, - "incorrect value for uart_ftdi.io_error_count, expected 0, is %d", - check_msg->uart_ftdi.io_error_count); - ck_assert_msg( - check_msg->uart_ftdi.rx_buffer_level == 0, - "incorrect value for uart_ftdi.rx_buffer_level, expected 0, is %d", - check_msg->uart_ftdi.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_ftdi.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_ftdi.rx_throughput, expected 0.0, is %f", - check_msg->uart_ftdi.rx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.tx_buffer_level == 0, - "incorrect value for uart_ftdi.tx_buffer_level, expected 0, is %d", - check_msg->uart_ftdi.tx_buffer_level); - ck_assert_msg((check_msg->uart_ftdi.tx_throughput * 100 - - 0.0659999996424 * 100) < 0.05, - "incorrect value for uart_ftdi.tx_throughput, expected " - "0.0659999996424, is %f", - check_msg->uart_ftdi.tx_throughput); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x18, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x18, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 24, 0, 195, 4, 58, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 4, 86, 14, 62, 0, 0, 0, 0, - 0, 0, 0, 0, 10, 0, 255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, 198, 36, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_uart_state_depa_t* test_msg = (msg_uart_state_depa_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->latency.avg = -1; - test_msg->latency.current = -1; - test_msg->latency.lmax = 0; - test_msg->latency.lmin = 0; - test_msg->uart_a.crc_error_count = 0; - test_msg->uart_a.io_error_count = 0; - test_msg->uart_a.rx_buffer_level = 0; - test_msg->uart_a.rx_throughput = 0.0; - test_msg->uart_a.tx_buffer_level = 0; - test_msg->uart_a.tx_throughput = 0.0; - test_msg->uart_b.crc_error_count = 0; - test_msg->uart_b.io_error_count = 0; - test_msg->uart_b.rx_buffer_level = 0; - test_msg->uart_b.rx_throughput = 0.0; - test_msg->uart_b.tx_buffer_level = 0; - test_msg->uart_b.tx_throughput = 0.0; - test_msg->uart_ftdi.crc_error_count = 0; - test_msg->uart_ftdi.io_error_count = 0; - test_msg->uart_ftdi.rx_buffer_level = 0; - test_msg->uart_ftdi.rx_throughput = 0.0; - test_msg->uart_ftdi.tx_buffer_level = 10; - test_msg->uart_ftdi.tx_throughput = 0.13899999856948853; - sbp_payload_send(&sbp_state, 0x18, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x18, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_uart_state_depa_t* check_msg = - (msg_uart_state_depa_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->latency.avg == -1, - "incorrect value for latency.avg, expected -1, is %d", - check_msg->latency.avg); - ck_assert_msg(check_msg->latency.current == -1, - "incorrect value for latency.current, expected -1, is %d", - check_msg->latency.current); - ck_assert_msg(check_msg->latency.lmax == 0, - "incorrect value for latency.lmax, expected 0, is %d", - check_msg->latency.lmax); - ck_assert_msg(check_msg->latency.lmin == 0, - "incorrect value for latency.lmin, expected 0, is %d", - check_msg->latency.lmin); - ck_assert_msg( - check_msg->uart_a.crc_error_count == 0, - "incorrect value for uart_a.crc_error_count, expected 0, is %d", - check_msg->uart_a.crc_error_count); - ck_assert_msg( - check_msg->uart_a.io_error_count == 0, - "incorrect value for uart_a.io_error_count, expected 0, is %d", - check_msg->uart_a.io_error_count); - ck_assert_msg( - check_msg->uart_a.rx_buffer_level == 0, - "incorrect value for uart_a.rx_buffer_level, expected 0, is %d", - check_msg->uart_a.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_a.rx_throughput, expected 0.0, is %f", - check_msg->uart_a.rx_throughput); - ck_assert_msg( - check_msg->uart_a.tx_buffer_level == 0, - "incorrect value for uart_a.tx_buffer_level, expected 0, is %d", - check_msg->uart_a.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.tx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_a.tx_throughput, expected 0.0, is %f", - check_msg->uart_a.tx_throughput); - ck_assert_msg( - check_msg->uart_b.crc_error_count == 0, - "incorrect value for uart_b.crc_error_count, expected 0, is %d", - check_msg->uart_b.crc_error_count); - ck_assert_msg( - check_msg->uart_b.io_error_count == 0, - "incorrect value for uart_b.io_error_count, expected 0, is %d", - check_msg->uart_b.io_error_count); - ck_assert_msg( - check_msg->uart_b.rx_buffer_level == 0, - "incorrect value for uart_b.rx_buffer_level, expected 0, is %d", - check_msg->uart_b.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_b.rx_throughput, expected 0.0, is %f", - check_msg->uart_b.rx_throughput); - ck_assert_msg( - check_msg->uart_b.tx_buffer_level == 0, - "incorrect value for uart_b.tx_buffer_level, expected 0, is %d", - check_msg->uart_b.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.tx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_b.tx_throughput, expected 0.0, is %f", - check_msg->uart_b.tx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.crc_error_count == 0, - "incorrect value for uart_ftdi.crc_error_count, expected 0, is %d", - check_msg->uart_ftdi.crc_error_count); - ck_assert_msg( - check_msg->uart_ftdi.io_error_count == 0, - "incorrect value for uart_ftdi.io_error_count, expected 0, is %d", - check_msg->uart_ftdi.io_error_count); - ck_assert_msg( - check_msg->uart_ftdi.rx_buffer_level == 0, - "incorrect value for uart_ftdi.rx_buffer_level, expected 0, is %d", - check_msg->uart_ftdi.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_ftdi.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_ftdi.rx_throughput, expected 0.0, is %f", - check_msg->uart_ftdi.rx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.tx_buffer_level == 10, - "incorrect value for uart_ftdi.tx_buffer_level, expected 10, is %d", - check_msg->uart_ftdi.tx_buffer_level); - ck_assert_msg((check_msg->uart_ftdi.tx_throughput * 100 - - 0.138999998569 * 100) < 0.05, - "incorrect value for uart_ftdi.tx_throughput, expected " - "0.138999998569, is %f", - check_msg->uart_ftdi.tx_throughput); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x18, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x18, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 24, 0, 195, 4, 58, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 2, 43, 135, 61, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, 65, 110, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_uart_state_depa_t* test_msg = (msg_uart_state_depa_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->latency.avg = -1; - test_msg->latency.current = -1; - test_msg->latency.lmax = 0; - test_msg->latency.lmin = 0; - test_msg->uart_a.crc_error_count = 0; - test_msg->uart_a.io_error_count = 0; - test_msg->uart_a.rx_buffer_level = 0; - test_msg->uart_a.rx_throughput = 0.0; - test_msg->uart_a.tx_buffer_level = 0; - test_msg->uart_a.tx_throughput = 0.0; - test_msg->uart_b.crc_error_count = 0; - test_msg->uart_b.io_error_count = 0; - test_msg->uart_b.rx_buffer_level = 0; - test_msg->uart_b.rx_throughput = 0.0; - test_msg->uart_b.tx_buffer_level = 0; - test_msg->uart_b.tx_throughput = 0.0; - test_msg->uart_ftdi.crc_error_count = 0; - test_msg->uart_ftdi.io_error_count = 0; - test_msg->uart_ftdi.rx_buffer_level = 0; - test_msg->uart_ftdi.rx_throughput = 0.0; - test_msg->uart_ftdi.tx_buffer_level = 0; - test_msg->uart_ftdi.tx_throughput = 0.06599999964237213; - sbp_payload_send(&sbp_state, 0x18, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x18, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_uart_state_depa_t* check_msg = - (msg_uart_state_depa_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->latency.avg == -1, - "incorrect value for latency.avg, expected -1, is %d", - check_msg->latency.avg); - ck_assert_msg(check_msg->latency.current == -1, - "incorrect value for latency.current, expected -1, is %d", - check_msg->latency.current); - ck_assert_msg(check_msg->latency.lmax == 0, - "incorrect value for latency.lmax, expected 0, is %d", - check_msg->latency.lmax); - ck_assert_msg(check_msg->latency.lmin == 0, - "incorrect value for latency.lmin, expected 0, is %d", - check_msg->latency.lmin); - ck_assert_msg( - check_msg->uart_a.crc_error_count == 0, - "incorrect value for uart_a.crc_error_count, expected 0, is %d", - check_msg->uart_a.crc_error_count); - ck_assert_msg( - check_msg->uart_a.io_error_count == 0, - "incorrect value for uart_a.io_error_count, expected 0, is %d", - check_msg->uart_a.io_error_count); - ck_assert_msg( - check_msg->uart_a.rx_buffer_level == 0, - "incorrect value for uart_a.rx_buffer_level, expected 0, is %d", - check_msg->uart_a.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_a.rx_throughput, expected 0.0, is %f", - check_msg->uart_a.rx_throughput); - ck_assert_msg( - check_msg->uart_a.tx_buffer_level == 0, - "incorrect value for uart_a.tx_buffer_level, expected 0, is %d", - check_msg->uart_a.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.tx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_a.tx_throughput, expected 0.0, is %f", - check_msg->uart_a.tx_throughput); - ck_assert_msg( - check_msg->uart_b.crc_error_count == 0, - "incorrect value for uart_b.crc_error_count, expected 0, is %d", - check_msg->uart_b.crc_error_count); - ck_assert_msg( - check_msg->uart_b.io_error_count == 0, - "incorrect value for uart_b.io_error_count, expected 0, is %d", - check_msg->uart_b.io_error_count); - ck_assert_msg( - check_msg->uart_b.rx_buffer_level == 0, - "incorrect value for uart_b.rx_buffer_level, expected 0, is %d", - check_msg->uart_b.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_b.rx_throughput, expected 0.0, is %f", - check_msg->uart_b.rx_throughput); - ck_assert_msg( - check_msg->uart_b.tx_buffer_level == 0, - "incorrect value for uart_b.tx_buffer_level, expected 0, is %d", - check_msg->uart_b.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.tx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_b.tx_throughput, expected 0.0, is %f", - check_msg->uart_b.tx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.crc_error_count == 0, - "incorrect value for uart_ftdi.crc_error_count, expected 0, is %d", - check_msg->uart_ftdi.crc_error_count); - ck_assert_msg( - check_msg->uart_ftdi.io_error_count == 0, - "incorrect value for uart_ftdi.io_error_count, expected 0, is %d", - check_msg->uart_ftdi.io_error_count); - ck_assert_msg( - check_msg->uart_ftdi.rx_buffer_level == 0, - "incorrect value for uart_ftdi.rx_buffer_level, expected 0, is %d", - check_msg->uart_ftdi.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_ftdi.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_ftdi.rx_throughput, expected 0.0, is %f", - check_msg->uart_ftdi.rx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.tx_buffer_level == 0, - "incorrect value for uart_ftdi.tx_buffer_level, expected 0, is %d", - check_msg->uart_ftdi.tx_buffer_level); - ck_assert_msg((check_msg->uart_ftdi.tx_throughput * 100 - - 0.0659999996424 * 100) < 0.05, - "incorrect value for uart_ftdi.tx_throughput, expected " - "0.0659999996424, is %f", - check_msg->uart_ftdi.tx_throughput); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x18, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x18, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 24, 0, 195, 4, 58, 0, 0, 0, 0, 138, 75, 6, 60, - 0, 0, 0, 0, 0, 0, 80, 113, 201, 61, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, 145, 237, 252, 62, 0, 0, 0, 0, - 0, 0, 0, 0, 38, 0, 255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, 112, 111, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_uart_state_depa_t* test_msg = (msg_uart_state_depa_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->latency.avg = -1; - test_msg->latency.current = -1; - test_msg->latency.lmax = 0; - test_msg->latency.lmin = 0; - test_msg->uart_a.crc_error_count = 0; - test_msg->uart_a.io_error_count = 0; - test_msg->uart_a.rx_buffer_level = 0; - test_msg->uart_a.rx_throughput = 0.008196720853447914; - test_msg->uart_a.tx_buffer_level = 0; - test_msg->uart_a.tx_throughput = 0.0; - test_msg->uart_b.crc_error_count = 0; - test_msg->uart_b.io_error_count = 0; - test_msg->uart_b.rx_buffer_level = 0; - test_msg->uart_b.rx_throughput = 0.0; - test_msg->uart_b.tx_buffer_level = 2; - test_msg->uart_b.tx_throughput = 0.09836065769195557; - test_msg->uart_ftdi.crc_error_count = 0; - test_msg->uart_ftdi.io_error_count = 0; - test_msg->uart_ftdi.rx_buffer_level = 0; - test_msg->uart_ftdi.rx_throughput = 0.0; - test_msg->uart_ftdi.tx_buffer_level = 38; - test_msg->uart_ftdi.tx_throughput = 0.49399998784065247; - sbp_payload_send(&sbp_state, 0x18, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x18, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_uart_state_depa_t* check_msg = - (msg_uart_state_depa_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->latency.avg == -1, - "incorrect value for latency.avg, expected -1, is %d", - check_msg->latency.avg); - ck_assert_msg(check_msg->latency.current == -1, - "incorrect value for latency.current, expected -1, is %d", - check_msg->latency.current); - ck_assert_msg(check_msg->latency.lmax == 0, - "incorrect value for latency.lmax, expected 0, is %d", - check_msg->latency.lmax); - ck_assert_msg(check_msg->latency.lmin == 0, - "incorrect value for latency.lmin, expected 0, is %d", - check_msg->latency.lmin); - ck_assert_msg( - check_msg->uart_a.crc_error_count == 0, - "incorrect value for uart_a.crc_error_count, expected 0, is %d", - check_msg->uart_a.crc_error_count); - ck_assert_msg( - check_msg->uart_a.io_error_count == 0, - "incorrect value for uart_a.io_error_count, expected 0, is %d", - check_msg->uart_a.io_error_count); - ck_assert_msg( - check_msg->uart_a.rx_buffer_level == 0, - "incorrect value for uart_a.rx_buffer_level, expected 0, is %d", - check_msg->uart_a.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.rx_throughput * 100 - 0.00819672085345 * 100) < 0.05, - "incorrect value for uart_a.rx_throughput, expected 0.00819672085345, " - "is %f", - check_msg->uart_a.rx_throughput); - ck_assert_msg( - check_msg->uart_a.tx_buffer_level == 0, - "incorrect value for uart_a.tx_buffer_level, expected 0, is %d", - check_msg->uart_a.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.tx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_a.tx_throughput, expected 0.0, is %f", - check_msg->uart_a.tx_throughput); - ck_assert_msg( - check_msg->uart_b.crc_error_count == 0, - "incorrect value for uart_b.crc_error_count, expected 0, is %d", - check_msg->uart_b.crc_error_count); - ck_assert_msg( - check_msg->uart_b.io_error_count == 0, - "incorrect value for uart_b.io_error_count, expected 0, is %d", - check_msg->uart_b.io_error_count); - ck_assert_msg( - check_msg->uart_b.rx_buffer_level == 0, - "incorrect value for uart_b.rx_buffer_level, expected 0, is %d", - check_msg->uart_b.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_b.rx_throughput, expected 0.0, is %f", - check_msg->uart_b.rx_throughput); - ck_assert_msg( - check_msg->uart_b.tx_buffer_level == 2, - "incorrect value for uart_b.tx_buffer_level, expected 2, is %d", - check_msg->uart_b.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.tx_throughput * 100 - 0.098360657692 * 100) < 0.05, - "incorrect value for uart_b.tx_throughput, expected 0.098360657692, is " - "%f", - check_msg->uart_b.tx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.crc_error_count == 0, - "incorrect value for uart_ftdi.crc_error_count, expected 0, is %d", - check_msg->uart_ftdi.crc_error_count); - ck_assert_msg( - check_msg->uart_ftdi.io_error_count == 0, - "incorrect value for uart_ftdi.io_error_count, expected 0, is %d", - check_msg->uart_ftdi.io_error_count); - ck_assert_msg( - check_msg->uart_ftdi.rx_buffer_level == 0, - "incorrect value for uart_ftdi.rx_buffer_level, expected 0, is %d", - check_msg->uart_ftdi.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_ftdi.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_ftdi.rx_throughput, expected 0.0, is %f", - check_msg->uart_ftdi.rx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.tx_buffer_level == 38, - "incorrect value for uart_ftdi.tx_buffer_level, expected 38, is %d", - check_msg->uart_ftdi.tx_buffer_level); - ck_assert_msg((check_msg->uart_ftdi.tx_throughput * 100 - - 0.493999987841 * 100) < 0.05, - "incorrect value for uart_ftdi.tx_throughput, expected " - "0.493999987841, is %f", - check_msg->uart_ftdi.tx_throughput); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x18, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x18, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 24, 0, 195, 4, 58, 166, 155, 68, 60, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, 166, 155, 68, 60, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, 236, 81, 168, 63, 0, 0, 0, 0, - 0, 0, 0, 0, 50, 0, 255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, 22, 72, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_uart_state_depa_t* test_msg = (msg_uart_state_depa_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->latency.avg = -1; - test_msg->latency.current = -1; - test_msg->latency.lmax = 0; - test_msg->latency.lmin = 0; - test_msg->uart_a.crc_error_count = 0; - test_msg->uart_a.io_error_count = 0; - test_msg->uart_a.rx_buffer_level = 0; - test_msg->uart_a.rx_throughput = 0.0; - test_msg->uart_a.tx_buffer_level = 2; - test_msg->uart_a.tx_throughput = 0.012000000104308128; - test_msg->uart_b.crc_error_count = 0; - test_msg->uart_b.io_error_count = 0; - test_msg->uart_b.rx_buffer_level = 0; - test_msg->uart_b.rx_throughput = 0.0; - test_msg->uart_b.tx_buffer_level = 2; - test_msg->uart_b.tx_throughput = 0.012000000104308128; - test_msg->uart_ftdi.crc_error_count = 0; - test_msg->uart_ftdi.io_error_count = 0; - test_msg->uart_ftdi.rx_buffer_level = 0; - test_msg->uart_ftdi.rx_throughput = 0.0; - test_msg->uart_ftdi.tx_buffer_level = 50; - test_msg->uart_ftdi.tx_throughput = 1.315000057220459; - sbp_payload_send(&sbp_state, 0x18, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x18, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_uart_state_depa_t* check_msg = - (msg_uart_state_depa_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->latency.avg == -1, - "incorrect value for latency.avg, expected -1, is %d", - check_msg->latency.avg); - ck_assert_msg(check_msg->latency.current == -1, - "incorrect value for latency.current, expected -1, is %d", - check_msg->latency.current); - ck_assert_msg(check_msg->latency.lmax == 0, - "incorrect value for latency.lmax, expected 0, is %d", - check_msg->latency.lmax); - ck_assert_msg(check_msg->latency.lmin == 0, - "incorrect value for latency.lmin, expected 0, is %d", - check_msg->latency.lmin); - ck_assert_msg( - check_msg->uart_a.crc_error_count == 0, - "incorrect value for uart_a.crc_error_count, expected 0, is %d", - check_msg->uart_a.crc_error_count); - ck_assert_msg( - check_msg->uart_a.io_error_count == 0, - "incorrect value for uart_a.io_error_count, expected 0, is %d", - check_msg->uart_a.io_error_count); - ck_assert_msg( - check_msg->uart_a.rx_buffer_level == 0, - "incorrect value for uart_a.rx_buffer_level, expected 0, is %d", - check_msg->uart_a.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_a.rx_throughput, expected 0.0, is %f", - check_msg->uart_a.rx_throughput); - ck_assert_msg( - check_msg->uart_a.tx_buffer_level == 2, - "incorrect value for uart_a.tx_buffer_level, expected 2, is %d", - check_msg->uart_a.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_a.tx_throughput * 100 - 0.0120000001043 * 100) < 0.05, - "incorrect value for uart_a.tx_throughput, expected 0.0120000001043, " - "is %f", - check_msg->uart_a.tx_throughput); - ck_assert_msg( - check_msg->uart_b.crc_error_count == 0, - "incorrect value for uart_b.crc_error_count, expected 0, is %d", - check_msg->uart_b.crc_error_count); - ck_assert_msg( - check_msg->uart_b.io_error_count == 0, - "incorrect value for uart_b.io_error_count, expected 0, is %d", - check_msg->uart_b.io_error_count); - ck_assert_msg( - check_msg->uart_b.rx_buffer_level == 0, - "incorrect value for uart_b.rx_buffer_level, expected 0, is %d", - check_msg->uart_b.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_b.rx_throughput, expected 0.0, is %f", - check_msg->uart_b.rx_throughput); - ck_assert_msg( - check_msg->uart_b.tx_buffer_level == 2, - "incorrect value for uart_b.tx_buffer_level, expected 2, is %d", - check_msg->uart_b.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_b.tx_throughput * 100 - 0.0120000001043 * 100) < 0.05, - "incorrect value for uart_b.tx_throughput, expected 0.0120000001043, " - "is %f", - check_msg->uart_b.tx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.crc_error_count == 0, - "incorrect value for uart_ftdi.crc_error_count, expected 0, is %d", - check_msg->uart_ftdi.crc_error_count); - ck_assert_msg( - check_msg->uart_ftdi.io_error_count == 0, - "incorrect value for uart_ftdi.io_error_count, expected 0, is %d", - check_msg->uart_ftdi.io_error_count); - ck_assert_msg( - check_msg->uart_ftdi.rx_buffer_level == 0, - "incorrect value for uart_ftdi.rx_buffer_level, expected 0, is %d", - check_msg->uart_ftdi.rx_buffer_level); - ck_assert_msg( - (check_msg->uart_ftdi.rx_throughput * 100 - 0.0 * 100) < 0.05, - "incorrect value for uart_ftdi.rx_throughput, expected 0.0, is %f", - check_msg->uart_ftdi.rx_throughput); - ck_assert_msg( - check_msg->uart_ftdi.tx_buffer_level == 50, - "incorrect value for uart_ftdi.tx_buffer_level, expected 50, is %d", - check_msg->uart_ftdi.tx_buffer_level); - ck_assert_msg( - (check_msg->uart_ftdi.tx_throughput * 100 - 1.31500005722 * 100) < 0.05, - "incorrect value for uart_ftdi.tx_throughput, expected 1.31500005722, " - "is %f", - check_msg->uart_ftdi.tx_throughput); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_piksi_MsgUartStateDepA_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_piksi_MsgUartStateDepA"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_piksi_MsgUartStateDepA"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_piksi_MsgUartStateDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_profiling_MsgMeasurementPoint.c b/c/test/legacy/auto_check_sbp_profiling_MsgMeasurementPoint.c deleted file mode 100644 index daec9dd41e..0000000000 --- a/c/test/legacy/auto_check_sbp_profiling_MsgMeasurementPoint.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/profiling/test_MsgMeasurementPoint.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_profiling_MsgMeasurementPoint) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xCF00, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xCF00, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 207, 0, 16, 48, 250, 7, 0, 0, 180, 0, 2, 0, - 0, 0, 40, 0, 0, 0, 130, 201, 148, 141, 97, 85, 0, 0, - 18, 130, 201, 148, 0, 0, 0, 0, 66, 64, 157, 15, 0, 0, - 0, 0, 18, 0, 114, 111, 117, 116, 101, 40, 41, 0, 212, 165, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_measurement_point_t *test_msg = - (msg_measurement_point_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = {(char)114, (char)111, (char)117, (char)116, - (char)101, (char)40, (char)41, (char)0}; - memcpy(test_msg->func, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->func) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->id = 2496234002; - test_msg->line = 18; - test_msg->max = 40; - test_msg->min = 2; - test_msg->num_executions = 180; - test_msg->return_addr = 93877475527042; - test_msg->slice_time = 261963842; - test_msg->total_time = 2042; - sbp_payload_send(&sbp_state, 0xCF00, 4096, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 4096, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 4096, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xCF00, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_measurement_point_t *check_msg = - (msg_measurement_point_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = {(char)114, (char)111, (char)117, (char)116, - (char)101, (char)40, (char)41, (char)0}; - ck_assert_msg( - memcmp(check_msg->func, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->func, expected string '%s', is '%s'", - check_string, check_msg->func); - } - ck_assert_msg(check_msg->id == 2496234002, - "incorrect value for id, expected 2496234002, is %d", - check_msg->id); - ck_assert_msg(check_msg->line == 18, - "incorrect value for line, expected 18, is %d", - check_msg->line); - ck_assert_msg(check_msg->max == 40, - "incorrect value for max, expected 40, is %d", - check_msg->max); - ck_assert_msg(check_msg->min == 2, - "incorrect value for min, expected 2, is %d", check_msg->min); - ck_assert_msg(check_msg->num_executions == 180, - "incorrect value for num_executions, expected 180, is %d", - check_msg->num_executions); - ck_assert_msg( - check_msg->return_addr == 93877475527042, - "incorrect value for return_addr, expected 93877475527042, is %d", - check_msg->return_addr); - ck_assert_msg(check_msg->slice_time == 261963842, - "incorrect value for slice_time, expected 261963842, is %d", - check_msg->slice_time); - ck_assert_msg(check_msg->total_time == 2042, - "incorrect value for total_time, expected 2042, is %d", - check_msg->total_time); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_profiling_MsgMeasurementPoint_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_profiling_MsgMeasurementPoint"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_profiling_MsgMeasurementPoint"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_profiling_MsgMeasurementPoint); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_sbas_MsgSbasRaw.c b/c/test/legacy/auto_check_sbp_sbas_MsgSbasRaw.c deleted file mode 100644 index f0cacfbf6b..0000000000 --- a/c/test/legacy/auto_check_sbp_sbas_MsgSbasRaw.c +++ /dev/null @@ -1,445 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/sbas/test_MsgSbasRaw.yaml by generate.py. Do not -// modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_sbas_MsgSbasRaw) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x7777, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x7777, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 119, 119, 28, 200, 34, 131, 2, 201, 228, 233, 29, 4, 23, - 255, 0, 23, 255, 0, 23, 255, 127, 240, 2, 255, 192, 3, 127, - 247, 255, 127, 247, 255, 229, 229, 238, 170, 175, 255, 240, 167, 14, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_sbas_raw_t *test_msg = (msg_sbas_raw_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[0] = 23; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[1] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[2] = 0; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[3] = 23; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[4] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[5] = 0; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[6] = 23; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[7] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[8] = 127; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[9] = 240; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[10] = 2; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[11] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[12] = 192; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[13] = 3; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[14] = 127; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[15] = 247; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[16] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[17] = 127; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[18] = 247; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[19] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[20] = 229; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[21] = 229; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[22] = 238; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[23] = 170; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[24] = 175; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[25] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->data[0]); - } - test_msg->data[26] = 240; - test_msg->message_type = 4; - test_msg->sid.code = 2; - test_msg->sid.sat = 131; - test_msg->tow = 501867721; - sbp_payload_send(&sbp_state, 0x7777, 51228, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 51228, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 51228, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x7777, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_sbas_raw_t *check_msg = (msg_sbas_raw_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->data[0] == 23, - "incorrect value for data[0], expected 23, is %d", - check_msg->data[0]); - ck_assert_msg(check_msg->data[1] == 255, - "incorrect value for data[1], expected 255, is %d", - check_msg->data[1]); - ck_assert_msg(check_msg->data[2] == 0, - "incorrect value for data[2], expected 0, is %d", - check_msg->data[2]); - ck_assert_msg(check_msg->data[3] == 23, - "incorrect value for data[3], expected 23, is %d", - check_msg->data[3]); - ck_assert_msg(check_msg->data[4] == 255, - "incorrect value for data[4], expected 255, is %d", - check_msg->data[4]); - ck_assert_msg(check_msg->data[5] == 0, - "incorrect value for data[5], expected 0, is %d", - check_msg->data[5]); - ck_assert_msg(check_msg->data[6] == 23, - "incorrect value for data[6], expected 23, is %d", - check_msg->data[6]); - ck_assert_msg(check_msg->data[7] == 255, - "incorrect value for data[7], expected 255, is %d", - check_msg->data[7]); - ck_assert_msg(check_msg->data[8] == 127, - "incorrect value for data[8], expected 127, is %d", - check_msg->data[8]); - ck_assert_msg(check_msg->data[9] == 240, - "incorrect value for data[9], expected 240, is %d", - check_msg->data[9]); - ck_assert_msg(check_msg->data[10] == 2, - "incorrect value for data[10], expected 2, is %d", - check_msg->data[10]); - ck_assert_msg(check_msg->data[11] == 255, - "incorrect value for data[11], expected 255, is %d", - check_msg->data[11]); - ck_assert_msg(check_msg->data[12] == 192, - "incorrect value for data[12], expected 192, is %d", - check_msg->data[12]); - ck_assert_msg(check_msg->data[13] == 3, - "incorrect value for data[13], expected 3, is %d", - check_msg->data[13]); - ck_assert_msg(check_msg->data[14] == 127, - "incorrect value for data[14], expected 127, is %d", - check_msg->data[14]); - ck_assert_msg(check_msg->data[15] == 247, - "incorrect value for data[15], expected 247, is %d", - check_msg->data[15]); - ck_assert_msg(check_msg->data[16] == 255, - "incorrect value for data[16], expected 255, is %d", - check_msg->data[16]); - ck_assert_msg(check_msg->data[17] == 127, - "incorrect value for data[17], expected 127, is %d", - check_msg->data[17]); - ck_assert_msg(check_msg->data[18] == 247, - "incorrect value for data[18], expected 247, is %d", - check_msg->data[18]); - ck_assert_msg(check_msg->data[19] == 255, - "incorrect value for data[19], expected 255, is %d", - check_msg->data[19]); - ck_assert_msg(check_msg->data[20] == 229, - "incorrect value for data[20], expected 229, is %d", - check_msg->data[20]); - ck_assert_msg(check_msg->data[21] == 229, - "incorrect value for data[21], expected 229, is %d", - check_msg->data[21]); - ck_assert_msg(check_msg->data[22] == 238, - "incorrect value for data[22], expected 238, is %d", - check_msg->data[22]); - ck_assert_msg(check_msg->data[23] == 170, - "incorrect value for data[23], expected 170, is %d", - check_msg->data[23]); - ck_assert_msg(check_msg->data[24] == 175, - "incorrect value for data[24], expected 175, is %d", - check_msg->data[24]); - ck_assert_msg(check_msg->data[25] == 255, - "incorrect value for data[25], expected 255, is %d", - check_msg->data[25]); - ck_assert_msg(check_msg->data[26] == 240, - "incorrect value for data[26], expected 240, is %d", - check_msg->data[26]); - ck_assert_msg(check_msg->message_type == 4, - "incorrect value for message_type, expected 4, is %d", - check_msg->message_type); - ck_assert_msg(check_msg->sid.code == 2, - "incorrect value for sid.code, expected 2, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.sat == 131, - "incorrect value for sid.sat, expected 131, is %d", - check_msg->sid.sat); - ck_assert_msg(check_msg->tow == 501867721, - "incorrect value for tow, expected 501867721, is %d", - check_msg->tow); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_sbas_MsgSbasRaw_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_sbas_MsgSbasRaw"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_sbas_MsgSbasRaw"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_sbas_MsgSbasRaw); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_settings_MsgSettingsReadByIndexDone.c b/c/test/legacy/auto_check_sbp_settings_MsgSettingsReadByIndexDone.c deleted file mode 100644 index 77f6c4ccc7..0000000000 --- a/c/test/legacy/auto_check_sbp_settings_MsgSettingsReadByIndexDone.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsReadByIndexDone.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexDone) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xa6, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xa6, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 166, 0, 246, 215, 0, 163, 58, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - sbp_payload_send(&sbp_state, 0xa6, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xa6, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - } -} -END_TEST - -Suite *legacy_auto_check_sbp_settings_MsgSettingsReadByIndexDone_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_settings_MsgSettingsReadByIndexDone"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_settings_" - "MsgSettingsReadByIndexDone"); - tcase_add_test( - tc_acq, test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexDone); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_settings_MsgSettingsReadByIndexReq.c b/c/test/legacy/auto_check_sbp_settings_MsgSettingsReadByIndexReq.c deleted file mode 100644 index 5fc9e0b636..0000000000 --- a/c/test/legacy/auto_check_sbp_settings_MsgSettingsReadByIndexReq.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsReadByIndexReq.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexReq) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xa2, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xa2, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 162, 0, 122, 123, 2, 244, 34, 235, 23, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_settings_read_by_index_req_t *test_msg = - (msg_settings_read_by_index_req_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->index = 8948; - sbp_payload_send(&sbp_state, 0xa2, 31610, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 31610, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 31610, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xa2, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_settings_read_by_index_req_t *check_msg = - (msg_settings_read_by_index_req_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->index == 8948, - "incorrect value for index, expected 8948, is %d", - check_msg->index); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_settings_MsgSettingsReadByIndexReq_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_settings_MsgSettingsReadByIndexReq"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_settings_" - "MsgSettingsReadByIndexReq"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexReq); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_settings_MsgSettingsReadByIndexResp.c b/c/test/legacy/auto_check_sbp_settings_MsgSettingsReadByIndexResp.c deleted file mode 100644 index 9669175274..0000000000 --- a/c/test/legacy/auto_check_sbp_settings_MsgSettingsReadByIndexResp.c +++ /dev/null @@ -1,738 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsReadByIndexResp.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xa7, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xa7, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 167, 0, 246, 215, 78, 0, 0, 116, 101, 108, 101, 109, - 101, 116, 114, 121, 95, 114, 97, 100, 105, 111, 0, 99, 111, - 110, 102, 105, 103, 117, 114, 97, 116, 105, 111, 110, 95, 115, - 116, 114, 105, 110, 103, 0, 65, 84, 38, 70, 44, 65, 84, - 83, 49, 61, 49, 49, 53, 44, 65, 84, 83, 50, 61, 49, - 50, 56, 44, 65, 84, 83, 53, 61, 48, 44, 65, 84, 38, - 87, 44, 65, 84, 90, 0, 248, 233, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_settings_read_by_index_resp_t* test_msg = - (msg_settings_read_by_index_resp_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->index = 0; - { - const char assign_string[] = { - (char)116, (char)101, (char)108, (char)101, (char)109, (char)101, - (char)116, (char)114, (char)121, (char)95, (char)114, (char)97, - (char)100, (char)105, (char)111, (char)0, (char)99, (char)111, - (char)110, (char)102, (char)105, (char)103, (char)117, (char)114, - (char)97, (char)116, (char)105, (char)111, (char)110, (char)95, - (char)115, (char)116, (char)114, (char)105, (char)110, (char)103, - (char)0, (char)65, (char)84, (char)38, (char)70, (char)44, - (char)65, (char)84, (char)83, (char)49, (char)61, (char)49, - (char)49, (char)53, (char)44, (char)65, (char)84, (char)83, - (char)50, (char)61, (char)49, (char)50, (char)56, (char)44, - (char)65, (char)84, (char)83, (char)53, (char)61, (char)48, - (char)44, (char)65, (char)84, (char)38, (char)87, (char)44, - (char)65, (char)84, (char)90, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0xa7, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xa7, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_settings_read_by_index_resp_t* check_msg = - (msg_settings_read_by_index_resp_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->index == 0, - "incorrect value for index, expected 0, is %d", - check_msg->index); - { - const char check_string[] = { - (char)116, (char)101, (char)108, (char)101, (char)109, (char)101, - (char)116, (char)114, (char)121, (char)95, (char)114, (char)97, - (char)100, (char)105, (char)111, (char)0, (char)99, (char)111, - (char)110, (char)102, (char)105, (char)103, (char)117, (char)114, - (char)97, (char)116, (char)105, (char)111, (char)110, (char)95, - (char)115, (char)116, (char)114, (char)105, (char)110, (char)103, - (char)0, (char)65, (char)84, (char)38, (char)70, (char)44, - (char)65, (char)84, (char)83, (char)49, (char)61, (char)49, - (char)49, (char)53, (char)44, (char)65, (char)84, (char)83, - (char)50, (char)61, (char)49, (char)50, (char)56, (char)44, - (char)65, (char)84, (char)83, (char)53, (char)61, (char)48, - (char)44, (char)65, (char)84, (char)38, (char)87, (char)44, - (char)65, (char)84, (char)90, (char)0}; - ck_assert_msg( - memcmp(check_msg->setting, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->setting, expected string '%s', is " - "'%s'", - check_string, check_msg->setting); - } - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xa7, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xa7, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 167, 0, 246, 215, 35, 1, 0, 117, 97, 114, 116, 95, 102, 116, - 100, 105, 0, 109, 111, 100, 101, 0, 83, 66, 80, 0, 101, 110, 117, - 109, 58, 83, 66, 80, 44, 78, 77, 69, 65, 0, 167, 243, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_settings_read_by_index_resp_t* test_msg = - (msg_settings_read_by_index_resp_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->index = 1; - { - const char assign_string[] = { - (char)117, (char)97, (char)114, (char)116, (char)95, (char)102, - (char)116, (char)100, (char)105, (char)0, (char)109, (char)111, - (char)100, (char)101, (char)0, (char)83, (char)66, (char)80, - (char)0, (char)101, (char)110, (char)117, (char)109, (char)58, - (char)83, (char)66, (char)80, (char)44, (char)78, (char)77, - (char)69, (char)65, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0xa7, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xa7, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_settings_read_by_index_resp_t* check_msg = - (msg_settings_read_by_index_resp_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->index == 1, - "incorrect value for index, expected 1, is %d", - check_msg->index); - { - const char check_string[] = { - (char)117, (char)97, (char)114, (char)116, (char)95, (char)102, - (char)116, (char)100, (char)105, (char)0, (char)109, (char)111, - (char)100, (char)101, (char)0, (char)83, (char)66, (char)80, - (char)0, (char)101, (char)110, (char)117, (char)109, (char)58, - (char)83, (char)66, (char)80, (char)44, (char)78, (char)77, - (char)69, (char)65, (char)0}; - ck_assert_msg( - memcmp(check_msg->setting, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->setting, expected string '%s', is " - "'%s'", - check_string, check_msg->setting); - } - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xa7, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xa7, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 167, 0, 246, 215, 35, 2, 0, 117, 97, 114, - 116, 95, 102, 116, 100, 105, 0, 115, 98, 112, 95, - 109, 101, 115, 115, 97, 103, 101, 95, 109, 97, 115, - 107, 0, 54, 53, 53, 51, 53, 0, 4, 56, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_settings_read_by_index_resp_t* test_msg = - (msg_settings_read_by_index_resp_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->index = 2; - { - const char assign_string[] = { - (char)117, (char)97, (char)114, (char)116, (char)95, (char)102, - (char)116, (char)100, (char)105, (char)0, (char)115, (char)98, - (char)112, (char)95, (char)109, (char)101, (char)115, (char)115, - (char)97, (char)103, (char)101, (char)95, (char)109, (char)97, - (char)115, (char)107, (char)0, (char)54, (char)53, (char)53, - (char)51, (char)53, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0xa7, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xa7, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_settings_read_by_index_resp_t* check_msg = - (msg_settings_read_by_index_resp_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->index == 2, - "incorrect value for index, expected 2, is %d", - check_msg->index); - { - const char check_string[] = { - (char)117, (char)97, (char)114, (char)116, (char)95, (char)102, - (char)116, (char)100, (char)105, (char)0, (char)115, (char)98, - (char)112, (char)95, (char)109, (char)101, (char)115, (char)115, - (char)97, (char)103, (char)101, (char)95, (char)109, (char)97, - (char)115, (char)107, (char)0, (char)54, (char)53, (char)53, - (char)51, (char)53, (char)0}; - ck_assert_msg( - memcmp(check_msg->setting, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->setting, expected string '%s', is " - "'%s'", - check_string, check_msg->setting); - } - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xa7, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xa7, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 167, 0, 246, 215, 29, 3, 0, 117, 97, 114, 116, 95, - 102, 116, 100, 105, 0, 98, 97, 117, 100, 114, 97, 116, 101, - 0, 49, 48, 48, 48, 48, 48, 48, 0, 242, 146, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_settings_read_by_index_resp_t* test_msg = - (msg_settings_read_by_index_resp_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->index = 3; - { - const char assign_string[] = { - (char)117, (char)97, (char)114, (char)116, (char)95, (char)102, - (char)116, (char)100, (char)105, (char)0, (char)98, (char)97, - (char)117, (char)100, (char)114, (char)97, (char)116, (char)101, - (char)0, (char)49, (char)48, (char)48, (char)48, (char)48, - (char)48, (char)48, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0xa7, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xa7, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_settings_read_by_index_resp_t* check_msg = - (msg_settings_read_by_index_resp_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->index == 3, - "incorrect value for index, expected 3, is %d", - check_msg->index); - { - const char check_string[] = { - (char)117, (char)97, (char)114, (char)116, (char)95, (char)102, - (char)116, (char)100, (char)105, (char)0, (char)98, (char)97, - (char)117, (char)100, (char)114, (char)97, (char)116, (char)101, - (char)0, (char)49, (char)48, (char)48, (char)48, (char)48, - (char)48, (char)48, (char)0}; - ck_assert_msg( - memcmp(check_msg->setting, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->setting, expected string '%s', is " - "'%s'", - check_string, check_msg->setting); - } - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xa7, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xa7, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 167, 0, 246, 215, 36, 4, 0, 117, 97, 114, 116, 95, 117, 97, - 114, 116, 97, 0, 109, 111, 100, 101, 0, 83, 66, 80, 0, 101, 110, - 117, 109, 58, 83, 66, 80, 44, 78, 77, 69, 65, 0, 22, 4, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_settings_read_by_index_resp_t* test_msg = - (msg_settings_read_by_index_resp_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->index = 4; - { - const char assign_string[] = { - (char)117, (char)97, (char)114, (char)116, (char)95, (char)117, - (char)97, (char)114, (char)116, (char)97, (char)0, (char)109, - (char)111, (char)100, (char)101, (char)0, (char)83, (char)66, - (char)80, (char)0, (char)101, (char)110, (char)117, (char)109, - (char)58, (char)83, (char)66, (char)80, (char)44, (char)78, - (char)77, (char)69, (char)65, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0xa7, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xa7, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_settings_read_by_index_resp_t* check_msg = - (msg_settings_read_by_index_resp_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->index == 4, - "incorrect value for index, expected 4, is %d", - check_msg->index); - { - const char check_string[] = { - (char)117, (char)97, (char)114, (char)116, (char)95, (char)117, - (char)97, (char)114, (char)116, (char)97, (char)0, (char)109, - (char)111, (char)100, (char)101, (char)0, (char)83, (char)66, - (char)80, (char)0, (char)101, (char)110, (char)117, (char)109, - (char)58, (char)83, (char)66, (char)80, (char)44, (char)78, - (char)77, (char)69, (char)65, (char)0}; - ck_assert_msg( - memcmp(check_msg->setting, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->setting, expected string '%s', is " - "'%s'", - check_string, check_msg->setting); - } - } -} -END_TEST - -Suite* legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_settings_" - "MsgSettingsReadByIndexResp"); - tcase_add_test( - tc_acq, test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_settings_MsgSettingsReadReq.c b/c/test/legacy/auto_check_sbp_settings_MsgSettingsReadReq.c deleted file mode 100644 index de8571c27a..0000000000 --- a/c/test/legacy/auto_check_sbp_settings_MsgSettingsReadReq.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsReadReq.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_settings_MsgSettingsReadReq) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xa4, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xa4, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 164, 0, 152, 214, 26, 115, 101, 99, 116, 105, 111, - 110, 45, 110, 97, 109, 101, 0, 115, 101, 116, 116, 105, - 110, 103, 45, 110, 97, 109, 101, 0, 181, 228, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_settings_read_req_t *test_msg = - (msg_settings_read_req_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0xa4, 54936, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 54936, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 54936, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xa4, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_settings_read_req_t *check_msg = - (msg_settings_read_req_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0}; - ck_assert_msg( - memcmp(check_msg->setting, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->setting, expected string '%s', is " - "'%s'", - check_string, check_msg->setting); - } - } -} -END_TEST - -Suite *legacy_auto_check_sbp_settings_MsgSettingsReadReq_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_settings_MsgSettingsReadReq"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_settings_MsgSettingsReadReq"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_settings_MsgSettingsReadReq); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_settings_MsgSettingsReadResp.c b/c/test/legacy/auto_check_sbp_settings_MsgSettingsReadResp.c deleted file mode 100644 index b5d05389f7..0000000000 --- a/c/test/legacy/auto_check_sbp_settings_MsgSettingsReadResp.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsReadResp.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_settings_MsgSettingsReadResp) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xa5, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xa5, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 165, 0, 136, 240, 66, 115, 101, 99, 116, 105, 111, 110, - 45, 110, 97, 109, 101, 0, 115, 101, 116, 116, 105, 110, 103, - 45, 110, 97, 109, 101, 0, 115, 101, 116, 116, 105, 110, 103, - 45, 118, 97, 108, 117, 101, 0, 101, 110, 117, 109, 59, 118, - 97, 108, 117, 101, 49, 44, 118, 97, 108, 117, 101, 50, 44, - 118, 97, 108, 117, 101, 51, 0, 203, 199, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_settings_read_resp_t *test_msg = - (msg_settings_read_resp_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0, (char)101, (char)110, - (char)117, (char)109, (char)59, (char)118, (char)97, (char)108, - (char)117, (char)101, (char)49, (char)44, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)50, (char)44, (char)118, - (char)97, (char)108, (char)117, (char)101, (char)51, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0xa5, 61576, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 61576, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 61576, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xa5, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_settings_read_resp_t *check_msg = - (msg_settings_read_resp_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0, (char)101, (char)110, - (char)117, (char)109, (char)59, (char)118, (char)97, (char)108, - (char)117, (char)101, (char)49, (char)44, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)50, (char)44, (char)118, - (char)97, (char)108, (char)117, (char)101, (char)51, (char)0}; - ck_assert_msg( - memcmp(check_msg->setting, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->setting, expected string '%s', is " - "'%s'", - check_string, check_msg->setting); - } - } -} -END_TEST - -Suite *legacy_auto_check_sbp_settings_MsgSettingsReadResp_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_settings_MsgSettingsReadResp"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_settings_MsgSettingsReadResp"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_settings_MsgSettingsReadResp); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_settings_MsgSettingsRegister.c b/c/test/legacy/auto_check_sbp_settings_MsgSettingsRegister.c deleted file mode 100644 index dbcf932fbf..0000000000 --- a/c/test/legacy/auto_check_sbp_settings_MsgSettingsRegister.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsRegister.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_settings_MsgSettingsRegister) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xae, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xae, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 174, 0, 84, 6, 66, 115, 101, 99, 116, 105, 111, 110, - 45, 110, 97, 109, 101, 0, 115, 101, 116, 116, 105, 110, 103, - 45, 110, 97, 109, 101, 0, 115, 101, 116, 116, 105, 110, 103, - 45, 118, 97, 108, 117, 101, 0, 101, 110, 117, 109, 59, 118, - 97, 108, 117, 101, 49, 44, 118, 97, 108, 117, 101, 50, 44, - 118, 97, 108, 117, 101, 51, 0, 142, 235, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_settings_register_t *test_msg = - (msg_settings_register_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0, (char)101, (char)110, - (char)117, (char)109, (char)59, (char)118, (char)97, (char)108, - (char)117, (char)101, (char)49, (char)44, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)50, (char)44, (char)118, - (char)97, (char)108, (char)117, (char)101, (char)51, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0xae, 1620, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1620, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1620, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xae, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_settings_register_t *check_msg = - (msg_settings_register_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0, (char)101, (char)110, - (char)117, (char)109, (char)59, (char)118, (char)97, (char)108, - (char)117, (char)101, (char)49, (char)44, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)50, (char)44, (char)118, - (char)97, (char)108, (char)117, (char)101, (char)51, (char)0}; - ck_assert_msg( - memcmp(check_msg->setting, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->setting, expected string '%s', is " - "'%s'", - check_string, check_msg->setting); - } - } -} -END_TEST - -Suite *legacy_auto_check_sbp_settings_MsgSettingsRegister_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_settings_MsgSettingsRegister"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_settings_MsgSettingsRegister"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_settings_MsgSettingsRegister); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_settings_MsgSettingsRegisterResp.c b/c/test/legacy/auto_check_sbp_settings_MsgSettingsRegisterResp.c deleted file mode 100644 index e4eddbd305..0000000000 --- a/c/test/legacy/auto_check_sbp_settings_MsgSettingsRegisterResp.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsRegisterResp.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_settings_MsgSettingsRegisterResp) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x1af, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x1af, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 175, 1, 41, 213, 67, 18, 115, 101, 99, 116, 105, 111, - 110, 45, 110, 97, 109, 101, 0, 115, 101, 116, 116, 105, 110, - 103, 45, 110, 97, 109, 101, 0, 115, 101, 116, 116, 105, 110, - 103, 45, 118, 97, 108, 117, 101, 0, 101, 110, 117, 109, 59, - 118, 97, 108, 117, 101, 49, 44, 118, 97, 108, 117, 101, 50, - 44, 118, 97, 108, 117, 101, 51, 0, 82, 16, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_settings_register_resp_t *test_msg = - (msg_settings_register_resp_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0, (char)101, (char)110, - (char)117, (char)109, (char)59, (char)118, (char)97, (char)108, - (char)117, (char)101, (char)49, (char)44, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)50, (char)44, (char)118, - (char)97, (char)108, (char)117, (char)101, (char)51, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->status = 18; - sbp_payload_send(&sbp_state, 0x1af, 54569, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 54569, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 54569, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x1af, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_settings_register_resp_t *check_msg = - (msg_settings_register_resp_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0, (char)101, (char)110, - (char)117, (char)109, (char)59, (char)118, (char)97, (char)108, - (char)117, (char)101, (char)49, (char)44, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)50, (char)44, (char)118, - (char)97, (char)108, (char)117, (char)101, (char)51, (char)0}; - ck_assert_msg( - memcmp(check_msg->setting, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->setting, expected string '%s', is " - "'%s'", - check_string, check_msg->setting); - } - ck_assert_msg(check_msg->status == 18, - "incorrect value for status, expected 18, is %d", - check_msg->status); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_settings_MsgSettingsRegisterResp_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_settings_MsgSettingsRegisterResp"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_settings_MsgSettingsRegisterResp"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_settings_MsgSettingsRegisterResp); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_settings_MsgSettingsSave.c b/c/test/legacy/auto_check_sbp_settings_MsgSettingsSave.c deleted file mode 100644 index 4cc64fa6b1..0000000000 --- a/c/test/legacy/auto_check_sbp_settings_MsgSettingsSave.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsSave.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_settings_MsgSettingsSave) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xa1, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xa1, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 161, 0, 162, 224, 0, 123, 67, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - sbp_payload_send(&sbp_state, 0xa1, 57506, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 57506, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 57506, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xa1, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - } -} -END_TEST - -Suite *legacy_auto_check_sbp_settings_MsgSettingsSave_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_settings_MsgSettingsSave"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_settings_MsgSettingsSave"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_settings_MsgSettingsSave); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_settings_MsgSettingsWrite.c b/c/test/legacy/auto_check_sbp_settings_MsgSettingsWrite.c deleted file mode 100644 index 2bd4720418..0000000000 --- a/c/test/legacy/auto_check_sbp_settings_MsgSettingsWrite.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsWrite.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_settings_MsgSettingsWrite) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xa0, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xa0, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 160, 0, 123, 0, 40, 115, 101, 99, 116, 105, 111, - 110, 45, 110, 97, 109, 101, 0, 115, 101, 116, 116, 105, - 110, 103, 45, 110, 97, 109, 101, 0, 115, 101, 116, 116, - 105, 110, 103, 45, 118, 97, 108, 117, 101, 0, 244, 10, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_settings_write_t *test_msg = (msg_settings_write_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0xa0, 123, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 123, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 123, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xa0, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_settings_write_t *check_msg = - (msg_settings_write_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0}; - ck_assert_msg( - memcmp(check_msg->setting, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->setting, expected string '%s', is " - "'%s'", - check_string, check_msg->setting); - } - } -} -END_TEST - -Suite *legacy_auto_check_sbp_settings_MsgSettingsWrite_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_settings_MsgSettingsWrite"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_settings_MsgSettingsWrite"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_settings_MsgSettingsWrite); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_settings_MsgSettingsWriteResp.c b/c/test/legacy/auto_check_sbp_settings_MsgSettingsWriteResp.c deleted file mode 100644 index 20ed464e50..0000000000 --- a/c/test/legacy/auto_check_sbp_settings_MsgSettingsWriteResp.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsWriteResp.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_settings_MsgSettingsWriteResp) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xaf, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xaf, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 175, 0, 91, 55, 67, 152, 115, 101, 99, 116, 105, 111, - 110, 45, 110, 97, 109, 101, 0, 115, 101, 116, 116, 105, 110, - 103, 45, 110, 97, 109, 101, 0, 115, 101, 116, 116, 105, 110, - 103, 45, 118, 97, 108, 117, 101, 0, 101, 110, 117, 109, 59, - 118, 97, 108, 117, 101, 49, 44, 118, 97, 108, 117, 101, 50, - 44, 118, 97, 108, 117, 101, 51, 0, 54, 0, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_settings_write_resp_t *test_msg = - (msg_settings_write_resp_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - { - const char assign_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0, (char)101, (char)110, - (char)117, (char)109, (char)59, (char)118, (char)97, (char)108, - (char)117, (char)101, (char)49, (char)44, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)50, (char)44, (char)118, - (char)97, (char)108, (char)117, (char)101, (char)51, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len += sizeof(assign_string); - } - } - test_msg->status = 152; - sbp_payload_send(&sbp_state, 0xaf, 14171, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 14171, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 14171, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xaf, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_settings_write_resp_t *check_msg = - (msg_settings_write_resp_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - { - const char check_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0, (char)101, (char)110, - (char)117, (char)109, (char)59, (char)118, (char)97, (char)108, - (char)117, (char)101, (char)49, (char)44, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)50, (char)44, (char)118, - (char)97, (char)108, (char)117, (char)101, (char)51, (char)0}; - ck_assert_msg( - memcmp(check_msg->setting, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->setting, expected string '%s', is " - "'%s'", - check_string, check_msg->setting); - } - ck_assert_msg(check_msg->status == 152, - "incorrect value for status, expected 152, is %d", - check_msg->status); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_settings_MsgSettingsWriteResp_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_settings_MsgSettingsWriteResp"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_settings_MsgSettingsWriteResp"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_settings_MsgSettingsWriteResp); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_signing_MsgCertificateChain.c b/c/test/legacy/auto_check_sbp_signing_MsgCertificateChain.c deleted file mode 100644 index 93697b8424..0000000000 --- a/c/test/legacy/auto_check_sbp_signing_MsgCertificateChain.c +++ /dev/null @@ -1,1362 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgCertificateChain.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_signing_MsgCertificateChain) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xC09, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xC09, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 9, 12, 66, 0, 144, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 232, 7, - 3, 30, 12, 34, 59, 21, 205, 91, 7, 72, 0, 1, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 227, 224, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_certificate_chain_t *test_msg = - (msg_certificate_chain_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[0] = 20; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[1] = 21; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[2] = 22; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[3] = 23; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[4] = 24; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[5] = 25; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[6] = 26; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[7] = 27; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[8] = 28; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[9] = 29; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[10] = 10; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[11] = 11; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[12] = 12; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[13] = 13; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[14] = 14; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[15] = 15; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[16] = 16; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[17] = 17; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[18] = 18; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[19] = 19; - test_msg->expiration.day = 30; - test_msg->expiration.hours = 12; - test_msg->expiration.minutes = 34; - test_msg->expiration.month = 3; - test_msg->expiration.ns = 123456789; - test_msg->expiration.seconds = 59; - test_msg->expiration.year = 2024; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[0] = 10; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[1] = 11; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[2] = 12; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[3] = 13; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[4] = 14; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[5] = 15; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[6] = 16; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[7] = 17; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[8] = 18; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[9] = 19; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[10] = 0; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[11] = 1; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[12] = 2; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[13] = 3; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[14] = 4; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[15] = 5; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[16] = 6; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[17] = 7; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[18] = 8; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[19] = 9; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[0] = 0; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[1] = 1; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[2] = 2; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[3] = 3; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[4] = 4; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[5] = 5; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[6] = 6; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[7] = 7; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[8] = 8; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[9] = 9; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[10] = 10; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[11] = 11; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[12] = 12; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[13] = 13; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[14] = 14; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[15] = 15; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[16] = 16; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[17] = 17; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[18] = 18; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[19] = 19; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[0] = 0; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[1] = 1; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[2] = 2; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[3] = 3; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[4] = 4; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[5] = 5; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[6] = 6; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[7] = 7; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[8] = 8; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[9] = 9; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[10] = 10; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[11] = 11; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[12] = 12; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[13] = 13; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[14] = 14; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[15] = 15; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[16] = 16; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[17] = 17; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[18] = 18; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[19] = 19; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[20] = 20; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[21] = 21; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[22] = 22; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[23] = 23; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[24] = 24; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[25] = 25; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[26] = 26; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[27] = 27; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[28] = 28; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[29] = 29; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[30] = 30; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[31] = 31; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[32] = 32; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[33] = 33; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[34] = 34; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[35] = 35; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[36] = 36; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[37] = 37; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[38] = 38; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[39] = 39; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[40] = 40; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[41] = 41; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[42] = 42; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[43] = 43; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[44] = 44; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[45] = 45; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[46] = 46; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[47] = 47; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[48] = 48; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[49] = 49; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[50] = 50; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[51] = 51; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[52] = 52; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[53] = 53; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[54] = 54; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[55] = 55; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[56] = 56; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[57] = 57; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[58] = 58; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[59] = 59; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[60] = 60; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[61] = 61; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[62] = 62; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[63] = 63; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[64] = 64; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[65] = 65; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[66] = 66; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[67] = 67; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[68] = 68; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[69] = 69; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[70] = 70; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[71] = 71; - test_msg->signature.len = 72; - sbp_payload_send(&sbp_state, 0xC09, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xC09, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_certificate_chain_t *check_msg = - (msg_certificate_chain_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - check_msg->corrections_certificate[0] == 20, - "incorrect value for corrections_certificate[0], expected 20, is %d", - check_msg->corrections_certificate[0]); - ck_assert_msg( - check_msg->corrections_certificate[1] == 21, - "incorrect value for corrections_certificate[1], expected 21, is %d", - check_msg->corrections_certificate[1]); - ck_assert_msg( - check_msg->corrections_certificate[2] == 22, - "incorrect value for corrections_certificate[2], expected 22, is %d", - check_msg->corrections_certificate[2]); - ck_assert_msg( - check_msg->corrections_certificate[3] == 23, - "incorrect value for corrections_certificate[3], expected 23, is %d", - check_msg->corrections_certificate[3]); - ck_assert_msg( - check_msg->corrections_certificate[4] == 24, - "incorrect value for corrections_certificate[4], expected 24, is %d", - check_msg->corrections_certificate[4]); - ck_assert_msg( - check_msg->corrections_certificate[5] == 25, - "incorrect value for corrections_certificate[5], expected 25, is %d", - check_msg->corrections_certificate[5]); - ck_assert_msg( - check_msg->corrections_certificate[6] == 26, - "incorrect value for corrections_certificate[6], expected 26, is %d", - check_msg->corrections_certificate[6]); - ck_assert_msg( - check_msg->corrections_certificate[7] == 27, - "incorrect value for corrections_certificate[7], expected 27, is %d", - check_msg->corrections_certificate[7]); - ck_assert_msg( - check_msg->corrections_certificate[8] == 28, - "incorrect value for corrections_certificate[8], expected 28, is %d", - check_msg->corrections_certificate[8]); - ck_assert_msg( - check_msg->corrections_certificate[9] == 29, - "incorrect value for corrections_certificate[9], expected 29, is %d", - check_msg->corrections_certificate[9]); - ck_assert_msg( - check_msg->corrections_certificate[10] == 10, - "incorrect value for corrections_certificate[10], expected 10, is %d", - check_msg->corrections_certificate[10]); - ck_assert_msg( - check_msg->corrections_certificate[11] == 11, - "incorrect value for corrections_certificate[11], expected 11, is %d", - check_msg->corrections_certificate[11]); - ck_assert_msg( - check_msg->corrections_certificate[12] == 12, - "incorrect value for corrections_certificate[12], expected 12, is %d", - check_msg->corrections_certificate[12]); - ck_assert_msg( - check_msg->corrections_certificate[13] == 13, - "incorrect value for corrections_certificate[13], expected 13, is %d", - check_msg->corrections_certificate[13]); - ck_assert_msg( - check_msg->corrections_certificate[14] == 14, - "incorrect value for corrections_certificate[14], expected 14, is %d", - check_msg->corrections_certificate[14]); - ck_assert_msg( - check_msg->corrections_certificate[15] == 15, - "incorrect value for corrections_certificate[15], expected 15, is %d", - check_msg->corrections_certificate[15]); - ck_assert_msg( - check_msg->corrections_certificate[16] == 16, - "incorrect value for corrections_certificate[16], expected 16, is %d", - check_msg->corrections_certificate[16]); - ck_assert_msg( - check_msg->corrections_certificate[17] == 17, - "incorrect value for corrections_certificate[17], expected 17, is %d", - check_msg->corrections_certificate[17]); - ck_assert_msg( - check_msg->corrections_certificate[18] == 18, - "incorrect value for corrections_certificate[18], expected 18, is %d", - check_msg->corrections_certificate[18]); - ck_assert_msg( - check_msg->corrections_certificate[19] == 19, - "incorrect value for corrections_certificate[19], expected 19, is %d", - check_msg->corrections_certificate[19]); - ck_assert_msg(check_msg->expiration.day == 30, - "incorrect value for expiration.day, expected 30, is %d", - check_msg->expiration.day); - ck_assert_msg(check_msg->expiration.hours == 12, - "incorrect value for expiration.hours, expected 12, is %d", - check_msg->expiration.hours); - ck_assert_msg(check_msg->expiration.minutes == 34, - "incorrect value for expiration.minutes, expected 34, is %d", - check_msg->expiration.minutes); - ck_assert_msg(check_msg->expiration.month == 3, - "incorrect value for expiration.month, expected 3, is %d", - check_msg->expiration.month); - ck_assert_msg( - check_msg->expiration.ns == 123456789, - "incorrect value for expiration.ns, expected 123456789, is %d", - check_msg->expiration.ns); - ck_assert_msg(check_msg->expiration.seconds == 59, - "incorrect value for expiration.seconds, expected 59, is %d", - check_msg->expiration.seconds); - ck_assert_msg(check_msg->expiration.year == 2024, - "incorrect value for expiration.year, expected 2024, is %d", - check_msg->expiration.year); - ck_assert_msg( - check_msg->intermediate_certificate[0] == 10, - "incorrect value for intermediate_certificate[0], expected 10, is %d", - check_msg->intermediate_certificate[0]); - ck_assert_msg( - check_msg->intermediate_certificate[1] == 11, - "incorrect value for intermediate_certificate[1], expected 11, is %d", - check_msg->intermediate_certificate[1]); - ck_assert_msg( - check_msg->intermediate_certificate[2] == 12, - "incorrect value for intermediate_certificate[2], expected 12, is %d", - check_msg->intermediate_certificate[2]); - ck_assert_msg( - check_msg->intermediate_certificate[3] == 13, - "incorrect value for intermediate_certificate[3], expected 13, is %d", - check_msg->intermediate_certificate[3]); - ck_assert_msg( - check_msg->intermediate_certificate[4] == 14, - "incorrect value for intermediate_certificate[4], expected 14, is %d", - check_msg->intermediate_certificate[4]); - ck_assert_msg( - check_msg->intermediate_certificate[5] == 15, - "incorrect value for intermediate_certificate[5], expected 15, is %d", - check_msg->intermediate_certificate[5]); - ck_assert_msg( - check_msg->intermediate_certificate[6] == 16, - "incorrect value for intermediate_certificate[6], expected 16, is %d", - check_msg->intermediate_certificate[6]); - ck_assert_msg( - check_msg->intermediate_certificate[7] == 17, - "incorrect value for intermediate_certificate[7], expected 17, is %d", - check_msg->intermediate_certificate[7]); - ck_assert_msg( - check_msg->intermediate_certificate[8] == 18, - "incorrect value for intermediate_certificate[8], expected 18, is %d", - check_msg->intermediate_certificate[8]); - ck_assert_msg( - check_msg->intermediate_certificate[9] == 19, - "incorrect value for intermediate_certificate[9], expected 19, is %d", - check_msg->intermediate_certificate[9]); - ck_assert_msg( - check_msg->intermediate_certificate[10] == 0, - "incorrect value for intermediate_certificate[10], expected 0, is %d", - check_msg->intermediate_certificate[10]); - ck_assert_msg( - check_msg->intermediate_certificate[11] == 1, - "incorrect value for intermediate_certificate[11], expected 1, is %d", - check_msg->intermediate_certificate[11]); - ck_assert_msg( - check_msg->intermediate_certificate[12] == 2, - "incorrect value for intermediate_certificate[12], expected 2, is %d", - check_msg->intermediate_certificate[12]); - ck_assert_msg( - check_msg->intermediate_certificate[13] == 3, - "incorrect value for intermediate_certificate[13], expected 3, is %d", - check_msg->intermediate_certificate[13]); - ck_assert_msg( - check_msg->intermediate_certificate[14] == 4, - "incorrect value for intermediate_certificate[14], expected 4, is %d", - check_msg->intermediate_certificate[14]); - ck_assert_msg( - check_msg->intermediate_certificate[15] == 5, - "incorrect value for intermediate_certificate[15], expected 5, is %d", - check_msg->intermediate_certificate[15]); - ck_assert_msg( - check_msg->intermediate_certificate[16] == 6, - "incorrect value for intermediate_certificate[16], expected 6, is %d", - check_msg->intermediate_certificate[16]); - ck_assert_msg( - check_msg->intermediate_certificate[17] == 7, - "incorrect value for intermediate_certificate[17], expected 7, is %d", - check_msg->intermediate_certificate[17]); - ck_assert_msg( - check_msg->intermediate_certificate[18] == 8, - "incorrect value for intermediate_certificate[18], expected 8, is %d", - check_msg->intermediate_certificate[18]); - ck_assert_msg( - check_msg->intermediate_certificate[19] == 9, - "incorrect value for intermediate_certificate[19], expected 9, is %d", - check_msg->intermediate_certificate[19]); - ck_assert_msg(check_msg->root_certificate[0] == 0, - "incorrect value for root_certificate[0], expected 0, is %d", - check_msg->root_certificate[0]); - ck_assert_msg(check_msg->root_certificate[1] == 1, - "incorrect value for root_certificate[1], expected 1, is %d", - check_msg->root_certificate[1]); - ck_assert_msg(check_msg->root_certificate[2] == 2, - "incorrect value for root_certificate[2], expected 2, is %d", - check_msg->root_certificate[2]); - ck_assert_msg(check_msg->root_certificate[3] == 3, - "incorrect value for root_certificate[3], expected 3, is %d", - check_msg->root_certificate[3]); - ck_assert_msg(check_msg->root_certificate[4] == 4, - "incorrect value for root_certificate[4], expected 4, is %d", - check_msg->root_certificate[4]); - ck_assert_msg(check_msg->root_certificate[5] == 5, - "incorrect value for root_certificate[5], expected 5, is %d", - check_msg->root_certificate[5]); - ck_assert_msg(check_msg->root_certificate[6] == 6, - "incorrect value for root_certificate[6], expected 6, is %d", - check_msg->root_certificate[6]); - ck_assert_msg(check_msg->root_certificate[7] == 7, - "incorrect value for root_certificate[7], expected 7, is %d", - check_msg->root_certificate[7]); - ck_assert_msg(check_msg->root_certificate[8] == 8, - "incorrect value for root_certificate[8], expected 8, is %d", - check_msg->root_certificate[8]); - ck_assert_msg(check_msg->root_certificate[9] == 9, - "incorrect value for root_certificate[9], expected 9, is %d", - check_msg->root_certificate[9]); - ck_assert_msg( - check_msg->root_certificate[10] == 10, - "incorrect value for root_certificate[10], expected 10, is %d", - check_msg->root_certificate[10]); - ck_assert_msg( - check_msg->root_certificate[11] == 11, - "incorrect value for root_certificate[11], expected 11, is %d", - check_msg->root_certificate[11]); - ck_assert_msg( - check_msg->root_certificate[12] == 12, - "incorrect value for root_certificate[12], expected 12, is %d", - check_msg->root_certificate[12]); - ck_assert_msg( - check_msg->root_certificate[13] == 13, - "incorrect value for root_certificate[13], expected 13, is %d", - check_msg->root_certificate[13]); - ck_assert_msg( - check_msg->root_certificate[14] == 14, - "incorrect value for root_certificate[14], expected 14, is %d", - check_msg->root_certificate[14]); - ck_assert_msg( - check_msg->root_certificate[15] == 15, - "incorrect value for root_certificate[15], expected 15, is %d", - check_msg->root_certificate[15]); - ck_assert_msg( - check_msg->root_certificate[16] == 16, - "incorrect value for root_certificate[16], expected 16, is %d", - check_msg->root_certificate[16]); - ck_assert_msg( - check_msg->root_certificate[17] == 17, - "incorrect value for root_certificate[17], expected 17, is %d", - check_msg->root_certificate[17]); - ck_assert_msg( - check_msg->root_certificate[18] == 18, - "incorrect value for root_certificate[18], expected 18, is %d", - check_msg->root_certificate[18]); - ck_assert_msg( - check_msg->root_certificate[19] == 19, - "incorrect value for root_certificate[19], expected 19, is %d", - check_msg->root_certificate[19]); - ck_assert_msg(check_msg->signature.data[0] == 0, - "incorrect value for signature.data[0], expected 0, is %d", - check_msg->signature.data[0]); - ck_assert_msg(check_msg->signature.data[1] == 1, - "incorrect value for signature.data[1], expected 1, is %d", - check_msg->signature.data[1]); - ck_assert_msg(check_msg->signature.data[2] == 2, - "incorrect value for signature.data[2], expected 2, is %d", - check_msg->signature.data[2]); - ck_assert_msg(check_msg->signature.data[3] == 3, - "incorrect value for signature.data[3], expected 3, is %d", - check_msg->signature.data[3]); - ck_assert_msg(check_msg->signature.data[4] == 4, - "incorrect value for signature.data[4], expected 4, is %d", - check_msg->signature.data[4]); - ck_assert_msg(check_msg->signature.data[5] == 5, - "incorrect value for signature.data[5], expected 5, is %d", - check_msg->signature.data[5]); - ck_assert_msg(check_msg->signature.data[6] == 6, - "incorrect value for signature.data[6], expected 6, is %d", - check_msg->signature.data[6]); - ck_assert_msg(check_msg->signature.data[7] == 7, - "incorrect value for signature.data[7], expected 7, is %d", - check_msg->signature.data[7]); - ck_assert_msg(check_msg->signature.data[8] == 8, - "incorrect value for signature.data[8], expected 8, is %d", - check_msg->signature.data[8]); - ck_assert_msg(check_msg->signature.data[9] == 9, - "incorrect value for signature.data[9], expected 9, is %d", - check_msg->signature.data[9]); - ck_assert_msg(check_msg->signature.data[10] == 10, - "incorrect value for signature.data[10], expected 10, is %d", - check_msg->signature.data[10]); - ck_assert_msg(check_msg->signature.data[11] == 11, - "incorrect value for signature.data[11], expected 11, is %d", - check_msg->signature.data[11]); - ck_assert_msg(check_msg->signature.data[12] == 12, - "incorrect value for signature.data[12], expected 12, is %d", - check_msg->signature.data[12]); - ck_assert_msg(check_msg->signature.data[13] == 13, - "incorrect value for signature.data[13], expected 13, is %d", - check_msg->signature.data[13]); - ck_assert_msg(check_msg->signature.data[14] == 14, - "incorrect value for signature.data[14], expected 14, is %d", - check_msg->signature.data[14]); - ck_assert_msg(check_msg->signature.data[15] == 15, - "incorrect value for signature.data[15], expected 15, is %d", - check_msg->signature.data[15]); - ck_assert_msg(check_msg->signature.data[16] == 16, - "incorrect value for signature.data[16], expected 16, is %d", - check_msg->signature.data[16]); - ck_assert_msg(check_msg->signature.data[17] == 17, - "incorrect value for signature.data[17], expected 17, is %d", - check_msg->signature.data[17]); - ck_assert_msg(check_msg->signature.data[18] == 18, - "incorrect value for signature.data[18], expected 18, is %d", - check_msg->signature.data[18]); - ck_assert_msg(check_msg->signature.data[19] == 19, - "incorrect value for signature.data[19], expected 19, is %d", - check_msg->signature.data[19]); - ck_assert_msg(check_msg->signature.data[20] == 20, - "incorrect value for signature.data[20], expected 20, is %d", - check_msg->signature.data[20]); - ck_assert_msg(check_msg->signature.data[21] == 21, - "incorrect value for signature.data[21], expected 21, is %d", - check_msg->signature.data[21]); - ck_assert_msg(check_msg->signature.data[22] == 22, - "incorrect value for signature.data[22], expected 22, is %d", - check_msg->signature.data[22]); - ck_assert_msg(check_msg->signature.data[23] == 23, - "incorrect value for signature.data[23], expected 23, is %d", - check_msg->signature.data[23]); - ck_assert_msg(check_msg->signature.data[24] == 24, - "incorrect value for signature.data[24], expected 24, is %d", - check_msg->signature.data[24]); - ck_assert_msg(check_msg->signature.data[25] == 25, - "incorrect value for signature.data[25], expected 25, is %d", - check_msg->signature.data[25]); - ck_assert_msg(check_msg->signature.data[26] == 26, - "incorrect value for signature.data[26], expected 26, is %d", - check_msg->signature.data[26]); - ck_assert_msg(check_msg->signature.data[27] == 27, - "incorrect value for signature.data[27], expected 27, is %d", - check_msg->signature.data[27]); - ck_assert_msg(check_msg->signature.data[28] == 28, - "incorrect value for signature.data[28], expected 28, is %d", - check_msg->signature.data[28]); - ck_assert_msg(check_msg->signature.data[29] == 29, - "incorrect value for signature.data[29], expected 29, is %d", - check_msg->signature.data[29]); - ck_assert_msg(check_msg->signature.data[30] == 30, - "incorrect value for signature.data[30], expected 30, is %d", - check_msg->signature.data[30]); - ck_assert_msg(check_msg->signature.data[31] == 31, - "incorrect value for signature.data[31], expected 31, is %d", - check_msg->signature.data[31]); - ck_assert_msg(check_msg->signature.data[32] == 32, - "incorrect value for signature.data[32], expected 32, is %d", - check_msg->signature.data[32]); - ck_assert_msg(check_msg->signature.data[33] == 33, - "incorrect value for signature.data[33], expected 33, is %d", - check_msg->signature.data[33]); - ck_assert_msg(check_msg->signature.data[34] == 34, - "incorrect value for signature.data[34], expected 34, is %d", - check_msg->signature.data[34]); - ck_assert_msg(check_msg->signature.data[35] == 35, - "incorrect value for signature.data[35], expected 35, is %d", - check_msg->signature.data[35]); - ck_assert_msg(check_msg->signature.data[36] == 36, - "incorrect value for signature.data[36], expected 36, is %d", - check_msg->signature.data[36]); - ck_assert_msg(check_msg->signature.data[37] == 37, - "incorrect value for signature.data[37], expected 37, is %d", - check_msg->signature.data[37]); - ck_assert_msg(check_msg->signature.data[38] == 38, - "incorrect value for signature.data[38], expected 38, is %d", - check_msg->signature.data[38]); - ck_assert_msg(check_msg->signature.data[39] == 39, - "incorrect value for signature.data[39], expected 39, is %d", - check_msg->signature.data[39]); - ck_assert_msg(check_msg->signature.data[40] == 40, - "incorrect value for signature.data[40], expected 40, is %d", - check_msg->signature.data[40]); - ck_assert_msg(check_msg->signature.data[41] == 41, - "incorrect value for signature.data[41], expected 41, is %d", - check_msg->signature.data[41]); - ck_assert_msg(check_msg->signature.data[42] == 42, - "incorrect value for signature.data[42], expected 42, is %d", - check_msg->signature.data[42]); - ck_assert_msg(check_msg->signature.data[43] == 43, - "incorrect value for signature.data[43], expected 43, is %d", - check_msg->signature.data[43]); - ck_assert_msg(check_msg->signature.data[44] == 44, - "incorrect value for signature.data[44], expected 44, is %d", - check_msg->signature.data[44]); - ck_assert_msg(check_msg->signature.data[45] == 45, - "incorrect value for signature.data[45], expected 45, is %d", - check_msg->signature.data[45]); - ck_assert_msg(check_msg->signature.data[46] == 46, - "incorrect value for signature.data[46], expected 46, is %d", - check_msg->signature.data[46]); - ck_assert_msg(check_msg->signature.data[47] == 47, - "incorrect value for signature.data[47], expected 47, is %d", - check_msg->signature.data[47]); - ck_assert_msg(check_msg->signature.data[48] == 48, - "incorrect value for signature.data[48], expected 48, is %d", - check_msg->signature.data[48]); - ck_assert_msg(check_msg->signature.data[49] == 49, - "incorrect value for signature.data[49], expected 49, is %d", - check_msg->signature.data[49]); - ck_assert_msg(check_msg->signature.data[50] == 50, - "incorrect value for signature.data[50], expected 50, is %d", - check_msg->signature.data[50]); - ck_assert_msg(check_msg->signature.data[51] == 51, - "incorrect value for signature.data[51], expected 51, is %d", - check_msg->signature.data[51]); - ck_assert_msg(check_msg->signature.data[52] == 52, - "incorrect value for signature.data[52], expected 52, is %d", - check_msg->signature.data[52]); - ck_assert_msg(check_msg->signature.data[53] == 53, - "incorrect value for signature.data[53], expected 53, is %d", - check_msg->signature.data[53]); - ck_assert_msg(check_msg->signature.data[54] == 54, - "incorrect value for signature.data[54], expected 54, is %d", - check_msg->signature.data[54]); - ck_assert_msg(check_msg->signature.data[55] == 55, - "incorrect value for signature.data[55], expected 55, is %d", - check_msg->signature.data[55]); - ck_assert_msg(check_msg->signature.data[56] == 56, - "incorrect value for signature.data[56], expected 56, is %d", - check_msg->signature.data[56]); - ck_assert_msg(check_msg->signature.data[57] == 57, - "incorrect value for signature.data[57], expected 57, is %d", - check_msg->signature.data[57]); - ck_assert_msg(check_msg->signature.data[58] == 58, - "incorrect value for signature.data[58], expected 58, is %d", - check_msg->signature.data[58]); - ck_assert_msg(check_msg->signature.data[59] == 59, - "incorrect value for signature.data[59], expected 59, is %d", - check_msg->signature.data[59]); - ck_assert_msg(check_msg->signature.data[60] == 60, - "incorrect value for signature.data[60], expected 60, is %d", - check_msg->signature.data[60]); - ck_assert_msg(check_msg->signature.data[61] == 61, - "incorrect value for signature.data[61], expected 61, is %d", - check_msg->signature.data[61]); - ck_assert_msg(check_msg->signature.data[62] == 62, - "incorrect value for signature.data[62], expected 62, is %d", - check_msg->signature.data[62]); - ck_assert_msg(check_msg->signature.data[63] == 63, - "incorrect value for signature.data[63], expected 63, is %d", - check_msg->signature.data[63]); - ck_assert_msg(check_msg->signature.data[64] == 64, - "incorrect value for signature.data[64], expected 64, is %d", - check_msg->signature.data[64]); - ck_assert_msg(check_msg->signature.data[65] == 65, - "incorrect value for signature.data[65], expected 65, is %d", - check_msg->signature.data[65]); - ck_assert_msg(check_msg->signature.data[66] == 66, - "incorrect value for signature.data[66], expected 66, is %d", - check_msg->signature.data[66]); - ck_assert_msg(check_msg->signature.data[67] == 67, - "incorrect value for signature.data[67], expected 67, is %d", - check_msg->signature.data[67]); - ck_assert_msg(check_msg->signature.data[68] == 68, - "incorrect value for signature.data[68], expected 68, is %d", - check_msg->signature.data[68]); - ck_assert_msg(check_msg->signature.data[69] == 69, - "incorrect value for signature.data[69], expected 69, is %d", - check_msg->signature.data[69]); - ck_assert_msg(check_msg->signature.data[70] == 70, - "incorrect value for signature.data[70], expected 70, is %d", - check_msg->signature.data[70]); - ck_assert_msg(check_msg->signature.data[71] == 71, - "incorrect value for signature.data[71], expected 71, is %d", - check_msg->signature.data[71]); - ck_assert_msg(check_msg->signature.len == 72, - "incorrect value for signature.len, expected 72, is %d", - check_msg->signature.len); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_signing_MsgCertificateChain_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_signing_MsgCertificateChain"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_signing_MsgCertificateChain"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_signing_MsgCertificateChain); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_signing_MsgCertificateChainDep.c b/c/test/legacy/auto_check_sbp_signing_MsgCertificateChainDep.c deleted file mode 100644 index a5b892e41e..0000000000 --- a/c/test/legacy/auto_check_sbp_signing_MsgCertificateChainDep.c +++ /dev/null @@ -1,1294 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgCertificateChainDep.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_signing_MsgCertificateChainDep) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xC05, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xC05, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 5, 12, 66, 0, 135, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 232, 7, 3, 30, 12, 34, 59, 21, 205, 91, 7, 0, 1, 2, - 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, - 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, - 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, - 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 112, 100, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_certificate_chain_dep_t *test_msg = - (msg_certificate_chain_dep_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[0] = 20; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[1] = 21; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[2] = 22; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[3] = 23; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[4] = 24; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[5] = 25; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[6] = 26; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[7] = 27; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[8] = 28; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[9] = 29; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[10] = 10; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[11] = 11; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[12] = 12; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[13] = 13; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[14] = 14; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[15] = 15; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[16] = 16; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[17] = 17; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[18] = 18; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrections_certificate[0]); - } - test_msg->corrections_certificate[19] = 19; - test_msg->expiration.day = 30; - test_msg->expiration.hours = 12; - test_msg->expiration.minutes = 34; - test_msg->expiration.month = 3; - test_msg->expiration.ns = 123456789; - test_msg->expiration.seconds = 59; - test_msg->expiration.year = 2024; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[0] = 10; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[1] = 11; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[2] = 12; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[3] = 13; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[4] = 14; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[5] = 15; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[6] = 16; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[7] = 17; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[8] = 18; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[9] = 19; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[10] = 0; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[11] = 1; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[12] = 2; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[13] = 3; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[14] = 4; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[15] = 5; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[16] = 6; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[17] = 7; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[18] = 8; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->intermediate_certificate[0]); - } - test_msg->intermediate_certificate[19] = 9; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[0] = 0; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[1] = 1; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[2] = 2; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[3] = 3; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[4] = 4; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[5] = 5; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[6] = 6; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[7] = 7; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[8] = 8; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[9] = 9; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[10] = 10; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[11] = 11; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[12] = 12; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[13] = 13; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[14] = 14; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[15] = 15; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[16] = 16; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[17] = 17; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[18] = 18; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->root_certificate[0]); - } - test_msg->root_certificate[19] = 19; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[0] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[1] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[2] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[3] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[4] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[5] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[6] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[7] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[8] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[9] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[10] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[11] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[12] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[13] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[14] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[15] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[16] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[17] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[18] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[19] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[20] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[21] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[22] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[23] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[24] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[25] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[26] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[27] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[28] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[29] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[30] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[31] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[32] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[33] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[34] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[35] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[36] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[37] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[38] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[39] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[40] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[41] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[42] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[43] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[44] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[45] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[46] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[47] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[48] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[49] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[50] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[51] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[52] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[53] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[54] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[55] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[56] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[57] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[58] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[59] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[60] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[61] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[62] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[63] = 7; - sbp_payload_send(&sbp_state, 0xC05, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xC05, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_certificate_chain_dep_t *check_msg = - (msg_certificate_chain_dep_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - check_msg->corrections_certificate[0] == 20, - "incorrect value for corrections_certificate[0], expected 20, is %d", - check_msg->corrections_certificate[0]); - ck_assert_msg( - check_msg->corrections_certificate[1] == 21, - "incorrect value for corrections_certificate[1], expected 21, is %d", - check_msg->corrections_certificate[1]); - ck_assert_msg( - check_msg->corrections_certificate[2] == 22, - "incorrect value for corrections_certificate[2], expected 22, is %d", - check_msg->corrections_certificate[2]); - ck_assert_msg( - check_msg->corrections_certificate[3] == 23, - "incorrect value for corrections_certificate[3], expected 23, is %d", - check_msg->corrections_certificate[3]); - ck_assert_msg( - check_msg->corrections_certificate[4] == 24, - "incorrect value for corrections_certificate[4], expected 24, is %d", - check_msg->corrections_certificate[4]); - ck_assert_msg( - check_msg->corrections_certificate[5] == 25, - "incorrect value for corrections_certificate[5], expected 25, is %d", - check_msg->corrections_certificate[5]); - ck_assert_msg( - check_msg->corrections_certificate[6] == 26, - "incorrect value for corrections_certificate[6], expected 26, is %d", - check_msg->corrections_certificate[6]); - ck_assert_msg( - check_msg->corrections_certificate[7] == 27, - "incorrect value for corrections_certificate[7], expected 27, is %d", - check_msg->corrections_certificate[7]); - ck_assert_msg( - check_msg->corrections_certificate[8] == 28, - "incorrect value for corrections_certificate[8], expected 28, is %d", - check_msg->corrections_certificate[8]); - ck_assert_msg( - check_msg->corrections_certificate[9] == 29, - "incorrect value for corrections_certificate[9], expected 29, is %d", - check_msg->corrections_certificate[9]); - ck_assert_msg( - check_msg->corrections_certificate[10] == 10, - "incorrect value for corrections_certificate[10], expected 10, is %d", - check_msg->corrections_certificate[10]); - ck_assert_msg( - check_msg->corrections_certificate[11] == 11, - "incorrect value for corrections_certificate[11], expected 11, is %d", - check_msg->corrections_certificate[11]); - ck_assert_msg( - check_msg->corrections_certificate[12] == 12, - "incorrect value for corrections_certificate[12], expected 12, is %d", - check_msg->corrections_certificate[12]); - ck_assert_msg( - check_msg->corrections_certificate[13] == 13, - "incorrect value for corrections_certificate[13], expected 13, is %d", - check_msg->corrections_certificate[13]); - ck_assert_msg( - check_msg->corrections_certificate[14] == 14, - "incorrect value for corrections_certificate[14], expected 14, is %d", - check_msg->corrections_certificate[14]); - ck_assert_msg( - check_msg->corrections_certificate[15] == 15, - "incorrect value for corrections_certificate[15], expected 15, is %d", - check_msg->corrections_certificate[15]); - ck_assert_msg( - check_msg->corrections_certificate[16] == 16, - "incorrect value for corrections_certificate[16], expected 16, is %d", - check_msg->corrections_certificate[16]); - ck_assert_msg( - check_msg->corrections_certificate[17] == 17, - "incorrect value for corrections_certificate[17], expected 17, is %d", - check_msg->corrections_certificate[17]); - ck_assert_msg( - check_msg->corrections_certificate[18] == 18, - "incorrect value for corrections_certificate[18], expected 18, is %d", - check_msg->corrections_certificate[18]); - ck_assert_msg( - check_msg->corrections_certificate[19] == 19, - "incorrect value for corrections_certificate[19], expected 19, is %d", - check_msg->corrections_certificate[19]); - ck_assert_msg(check_msg->expiration.day == 30, - "incorrect value for expiration.day, expected 30, is %d", - check_msg->expiration.day); - ck_assert_msg(check_msg->expiration.hours == 12, - "incorrect value for expiration.hours, expected 12, is %d", - check_msg->expiration.hours); - ck_assert_msg(check_msg->expiration.minutes == 34, - "incorrect value for expiration.minutes, expected 34, is %d", - check_msg->expiration.minutes); - ck_assert_msg(check_msg->expiration.month == 3, - "incorrect value for expiration.month, expected 3, is %d", - check_msg->expiration.month); - ck_assert_msg( - check_msg->expiration.ns == 123456789, - "incorrect value for expiration.ns, expected 123456789, is %d", - check_msg->expiration.ns); - ck_assert_msg(check_msg->expiration.seconds == 59, - "incorrect value for expiration.seconds, expected 59, is %d", - check_msg->expiration.seconds); - ck_assert_msg(check_msg->expiration.year == 2024, - "incorrect value for expiration.year, expected 2024, is %d", - check_msg->expiration.year); - ck_assert_msg( - check_msg->intermediate_certificate[0] == 10, - "incorrect value for intermediate_certificate[0], expected 10, is %d", - check_msg->intermediate_certificate[0]); - ck_assert_msg( - check_msg->intermediate_certificate[1] == 11, - "incorrect value for intermediate_certificate[1], expected 11, is %d", - check_msg->intermediate_certificate[1]); - ck_assert_msg( - check_msg->intermediate_certificate[2] == 12, - "incorrect value for intermediate_certificate[2], expected 12, is %d", - check_msg->intermediate_certificate[2]); - ck_assert_msg( - check_msg->intermediate_certificate[3] == 13, - "incorrect value for intermediate_certificate[3], expected 13, is %d", - check_msg->intermediate_certificate[3]); - ck_assert_msg( - check_msg->intermediate_certificate[4] == 14, - "incorrect value for intermediate_certificate[4], expected 14, is %d", - check_msg->intermediate_certificate[4]); - ck_assert_msg( - check_msg->intermediate_certificate[5] == 15, - "incorrect value for intermediate_certificate[5], expected 15, is %d", - check_msg->intermediate_certificate[5]); - ck_assert_msg( - check_msg->intermediate_certificate[6] == 16, - "incorrect value for intermediate_certificate[6], expected 16, is %d", - check_msg->intermediate_certificate[6]); - ck_assert_msg( - check_msg->intermediate_certificate[7] == 17, - "incorrect value for intermediate_certificate[7], expected 17, is %d", - check_msg->intermediate_certificate[7]); - ck_assert_msg( - check_msg->intermediate_certificate[8] == 18, - "incorrect value for intermediate_certificate[8], expected 18, is %d", - check_msg->intermediate_certificate[8]); - ck_assert_msg( - check_msg->intermediate_certificate[9] == 19, - "incorrect value for intermediate_certificate[9], expected 19, is %d", - check_msg->intermediate_certificate[9]); - ck_assert_msg( - check_msg->intermediate_certificate[10] == 0, - "incorrect value for intermediate_certificate[10], expected 0, is %d", - check_msg->intermediate_certificate[10]); - ck_assert_msg( - check_msg->intermediate_certificate[11] == 1, - "incorrect value for intermediate_certificate[11], expected 1, is %d", - check_msg->intermediate_certificate[11]); - ck_assert_msg( - check_msg->intermediate_certificate[12] == 2, - "incorrect value for intermediate_certificate[12], expected 2, is %d", - check_msg->intermediate_certificate[12]); - ck_assert_msg( - check_msg->intermediate_certificate[13] == 3, - "incorrect value for intermediate_certificate[13], expected 3, is %d", - check_msg->intermediate_certificate[13]); - ck_assert_msg( - check_msg->intermediate_certificate[14] == 4, - "incorrect value for intermediate_certificate[14], expected 4, is %d", - check_msg->intermediate_certificate[14]); - ck_assert_msg( - check_msg->intermediate_certificate[15] == 5, - "incorrect value for intermediate_certificate[15], expected 5, is %d", - check_msg->intermediate_certificate[15]); - ck_assert_msg( - check_msg->intermediate_certificate[16] == 6, - "incorrect value for intermediate_certificate[16], expected 6, is %d", - check_msg->intermediate_certificate[16]); - ck_assert_msg( - check_msg->intermediate_certificate[17] == 7, - "incorrect value for intermediate_certificate[17], expected 7, is %d", - check_msg->intermediate_certificate[17]); - ck_assert_msg( - check_msg->intermediate_certificate[18] == 8, - "incorrect value for intermediate_certificate[18], expected 8, is %d", - check_msg->intermediate_certificate[18]); - ck_assert_msg( - check_msg->intermediate_certificate[19] == 9, - "incorrect value for intermediate_certificate[19], expected 9, is %d", - check_msg->intermediate_certificate[19]); - ck_assert_msg(check_msg->root_certificate[0] == 0, - "incorrect value for root_certificate[0], expected 0, is %d", - check_msg->root_certificate[0]); - ck_assert_msg(check_msg->root_certificate[1] == 1, - "incorrect value for root_certificate[1], expected 1, is %d", - check_msg->root_certificate[1]); - ck_assert_msg(check_msg->root_certificate[2] == 2, - "incorrect value for root_certificate[2], expected 2, is %d", - check_msg->root_certificate[2]); - ck_assert_msg(check_msg->root_certificate[3] == 3, - "incorrect value for root_certificate[3], expected 3, is %d", - check_msg->root_certificate[3]); - ck_assert_msg(check_msg->root_certificate[4] == 4, - "incorrect value for root_certificate[4], expected 4, is %d", - check_msg->root_certificate[4]); - ck_assert_msg(check_msg->root_certificate[5] == 5, - "incorrect value for root_certificate[5], expected 5, is %d", - check_msg->root_certificate[5]); - ck_assert_msg(check_msg->root_certificate[6] == 6, - "incorrect value for root_certificate[6], expected 6, is %d", - check_msg->root_certificate[6]); - ck_assert_msg(check_msg->root_certificate[7] == 7, - "incorrect value for root_certificate[7], expected 7, is %d", - check_msg->root_certificate[7]); - ck_assert_msg(check_msg->root_certificate[8] == 8, - "incorrect value for root_certificate[8], expected 8, is %d", - check_msg->root_certificate[8]); - ck_assert_msg(check_msg->root_certificate[9] == 9, - "incorrect value for root_certificate[9], expected 9, is %d", - check_msg->root_certificate[9]); - ck_assert_msg( - check_msg->root_certificate[10] == 10, - "incorrect value for root_certificate[10], expected 10, is %d", - check_msg->root_certificate[10]); - ck_assert_msg( - check_msg->root_certificate[11] == 11, - "incorrect value for root_certificate[11], expected 11, is %d", - check_msg->root_certificate[11]); - ck_assert_msg( - check_msg->root_certificate[12] == 12, - "incorrect value for root_certificate[12], expected 12, is %d", - check_msg->root_certificate[12]); - ck_assert_msg( - check_msg->root_certificate[13] == 13, - "incorrect value for root_certificate[13], expected 13, is %d", - check_msg->root_certificate[13]); - ck_assert_msg( - check_msg->root_certificate[14] == 14, - "incorrect value for root_certificate[14], expected 14, is %d", - check_msg->root_certificate[14]); - ck_assert_msg( - check_msg->root_certificate[15] == 15, - "incorrect value for root_certificate[15], expected 15, is %d", - check_msg->root_certificate[15]); - ck_assert_msg( - check_msg->root_certificate[16] == 16, - "incorrect value for root_certificate[16], expected 16, is %d", - check_msg->root_certificate[16]); - ck_assert_msg( - check_msg->root_certificate[17] == 17, - "incorrect value for root_certificate[17], expected 17, is %d", - check_msg->root_certificate[17]); - ck_assert_msg( - check_msg->root_certificate[18] == 18, - "incorrect value for root_certificate[18], expected 18, is %d", - check_msg->root_certificate[18]); - ck_assert_msg( - check_msg->root_certificate[19] == 19, - "incorrect value for root_certificate[19], expected 19, is %d", - check_msg->root_certificate[19]); - ck_assert_msg(check_msg->signature[0] == 0, - "incorrect value for signature[0], expected 0, is %d", - check_msg->signature[0]); - ck_assert_msg(check_msg->signature[1] == 1, - "incorrect value for signature[1], expected 1, is %d", - check_msg->signature[1]); - ck_assert_msg(check_msg->signature[2] == 2, - "incorrect value for signature[2], expected 2, is %d", - check_msg->signature[2]); - ck_assert_msg(check_msg->signature[3] == 3, - "incorrect value for signature[3], expected 3, is %d", - check_msg->signature[3]); - ck_assert_msg(check_msg->signature[4] == 4, - "incorrect value for signature[4], expected 4, is %d", - check_msg->signature[4]); - ck_assert_msg(check_msg->signature[5] == 5, - "incorrect value for signature[5], expected 5, is %d", - check_msg->signature[5]); - ck_assert_msg(check_msg->signature[6] == 6, - "incorrect value for signature[6], expected 6, is %d", - check_msg->signature[6]); - ck_assert_msg(check_msg->signature[7] == 7, - "incorrect value for signature[7], expected 7, is %d", - check_msg->signature[7]); - ck_assert_msg(check_msg->signature[8] == 0, - "incorrect value for signature[8], expected 0, is %d", - check_msg->signature[8]); - ck_assert_msg(check_msg->signature[9] == 1, - "incorrect value for signature[9], expected 1, is %d", - check_msg->signature[9]); - ck_assert_msg(check_msg->signature[10] == 2, - "incorrect value for signature[10], expected 2, is %d", - check_msg->signature[10]); - ck_assert_msg(check_msg->signature[11] == 3, - "incorrect value for signature[11], expected 3, is %d", - check_msg->signature[11]); - ck_assert_msg(check_msg->signature[12] == 4, - "incorrect value for signature[12], expected 4, is %d", - check_msg->signature[12]); - ck_assert_msg(check_msg->signature[13] == 5, - "incorrect value for signature[13], expected 5, is %d", - check_msg->signature[13]); - ck_assert_msg(check_msg->signature[14] == 6, - "incorrect value for signature[14], expected 6, is %d", - check_msg->signature[14]); - ck_assert_msg(check_msg->signature[15] == 7, - "incorrect value for signature[15], expected 7, is %d", - check_msg->signature[15]); - ck_assert_msg(check_msg->signature[16] == 0, - "incorrect value for signature[16], expected 0, is %d", - check_msg->signature[16]); - ck_assert_msg(check_msg->signature[17] == 1, - "incorrect value for signature[17], expected 1, is %d", - check_msg->signature[17]); - ck_assert_msg(check_msg->signature[18] == 2, - "incorrect value for signature[18], expected 2, is %d", - check_msg->signature[18]); - ck_assert_msg(check_msg->signature[19] == 3, - "incorrect value for signature[19], expected 3, is %d", - check_msg->signature[19]); - ck_assert_msg(check_msg->signature[20] == 4, - "incorrect value for signature[20], expected 4, is %d", - check_msg->signature[20]); - ck_assert_msg(check_msg->signature[21] == 5, - "incorrect value for signature[21], expected 5, is %d", - check_msg->signature[21]); - ck_assert_msg(check_msg->signature[22] == 6, - "incorrect value for signature[22], expected 6, is %d", - check_msg->signature[22]); - ck_assert_msg(check_msg->signature[23] == 7, - "incorrect value for signature[23], expected 7, is %d", - check_msg->signature[23]); - ck_assert_msg(check_msg->signature[24] == 0, - "incorrect value for signature[24], expected 0, is %d", - check_msg->signature[24]); - ck_assert_msg(check_msg->signature[25] == 1, - "incorrect value for signature[25], expected 1, is %d", - check_msg->signature[25]); - ck_assert_msg(check_msg->signature[26] == 2, - "incorrect value for signature[26], expected 2, is %d", - check_msg->signature[26]); - ck_assert_msg(check_msg->signature[27] == 3, - "incorrect value for signature[27], expected 3, is %d", - check_msg->signature[27]); - ck_assert_msg(check_msg->signature[28] == 4, - "incorrect value for signature[28], expected 4, is %d", - check_msg->signature[28]); - ck_assert_msg(check_msg->signature[29] == 5, - "incorrect value for signature[29], expected 5, is %d", - check_msg->signature[29]); - ck_assert_msg(check_msg->signature[30] == 6, - "incorrect value for signature[30], expected 6, is %d", - check_msg->signature[30]); - ck_assert_msg(check_msg->signature[31] == 7, - "incorrect value for signature[31], expected 7, is %d", - check_msg->signature[31]); - ck_assert_msg(check_msg->signature[32] == 0, - "incorrect value for signature[32], expected 0, is %d", - check_msg->signature[32]); - ck_assert_msg(check_msg->signature[33] == 1, - "incorrect value for signature[33], expected 1, is %d", - check_msg->signature[33]); - ck_assert_msg(check_msg->signature[34] == 2, - "incorrect value for signature[34], expected 2, is %d", - check_msg->signature[34]); - ck_assert_msg(check_msg->signature[35] == 3, - "incorrect value for signature[35], expected 3, is %d", - check_msg->signature[35]); - ck_assert_msg(check_msg->signature[36] == 4, - "incorrect value for signature[36], expected 4, is %d", - check_msg->signature[36]); - ck_assert_msg(check_msg->signature[37] == 5, - "incorrect value for signature[37], expected 5, is %d", - check_msg->signature[37]); - ck_assert_msg(check_msg->signature[38] == 6, - "incorrect value for signature[38], expected 6, is %d", - check_msg->signature[38]); - ck_assert_msg(check_msg->signature[39] == 7, - "incorrect value for signature[39], expected 7, is %d", - check_msg->signature[39]); - ck_assert_msg(check_msg->signature[40] == 0, - "incorrect value for signature[40], expected 0, is %d", - check_msg->signature[40]); - ck_assert_msg(check_msg->signature[41] == 1, - "incorrect value for signature[41], expected 1, is %d", - check_msg->signature[41]); - ck_assert_msg(check_msg->signature[42] == 2, - "incorrect value for signature[42], expected 2, is %d", - check_msg->signature[42]); - ck_assert_msg(check_msg->signature[43] == 3, - "incorrect value for signature[43], expected 3, is %d", - check_msg->signature[43]); - ck_assert_msg(check_msg->signature[44] == 4, - "incorrect value for signature[44], expected 4, is %d", - check_msg->signature[44]); - ck_assert_msg(check_msg->signature[45] == 5, - "incorrect value for signature[45], expected 5, is %d", - check_msg->signature[45]); - ck_assert_msg(check_msg->signature[46] == 6, - "incorrect value for signature[46], expected 6, is %d", - check_msg->signature[46]); - ck_assert_msg(check_msg->signature[47] == 7, - "incorrect value for signature[47], expected 7, is %d", - check_msg->signature[47]); - ck_assert_msg(check_msg->signature[48] == 0, - "incorrect value for signature[48], expected 0, is %d", - check_msg->signature[48]); - ck_assert_msg(check_msg->signature[49] == 1, - "incorrect value for signature[49], expected 1, is %d", - check_msg->signature[49]); - ck_assert_msg(check_msg->signature[50] == 2, - "incorrect value for signature[50], expected 2, is %d", - check_msg->signature[50]); - ck_assert_msg(check_msg->signature[51] == 3, - "incorrect value for signature[51], expected 3, is %d", - check_msg->signature[51]); - ck_assert_msg(check_msg->signature[52] == 4, - "incorrect value for signature[52], expected 4, is %d", - check_msg->signature[52]); - ck_assert_msg(check_msg->signature[53] == 5, - "incorrect value for signature[53], expected 5, is %d", - check_msg->signature[53]); - ck_assert_msg(check_msg->signature[54] == 6, - "incorrect value for signature[54], expected 6, is %d", - check_msg->signature[54]); - ck_assert_msg(check_msg->signature[55] == 7, - "incorrect value for signature[55], expected 7, is %d", - check_msg->signature[55]); - ck_assert_msg(check_msg->signature[56] == 0, - "incorrect value for signature[56], expected 0, is %d", - check_msg->signature[56]); - ck_assert_msg(check_msg->signature[57] == 1, - "incorrect value for signature[57], expected 1, is %d", - check_msg->signature[57]); - ck_assert_msg(check_msg->signature[58] == 2, - "incorrect value for signature[58], expected 2, is %d", - check_msg->signature[58]); - ck_assert_msg(check_msg->signature[59] == 3, - "incorrect value for signature[59], expected 3, is %d", - check_msg->signature[59]); - ck_assert_msg(check_msg->signature[60] == 4, - "incorrect value for signature[60], expected 4, is %d", - check_msg->signature[60]); - ck_assert_msg(check_msg->signature[61] == 5, - "incorrect value for signature[61], expected 5, is %d", - check_msg->signature[61]); - ck_assert_msg(check_msg->signature[62] == 6, - "incorrect value for signature[62], expected 6, is %d", - check_msg->signature[62]); - ck_assert_msg(check_msg->signature[63] == 7, - "incorrect value for signature[63], expected 7, is %d", - check_msg->signature[63]); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_signing_MsgCertificateChainDep_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_signing_MsgCertificateChainDep"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_signing_MsgCertificateChainDep"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_signing_MsgCertificateChainDep); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_signing_MsgEcdsaCertificate.c b/c/test/legacy/auto_check_sbp_signing_MsgEcdsaCertificate.c deleted file mode 100644 index e5ae26798c..0000000000 --- a/c/test/legacy/auto_check_sbp_signing_MsgEcdsaCertificate.c +++ /dev/null @@ -1,2496 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgEcdsaCertificate.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_signing_MsgEcdsaCertificate) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xC04, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xC04, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 12, 66, 0, 253, 48, 10, 11, 12, 13, 2, 180, 160, - 116, 77, 243, 28, 173, 36, 86, 33, 8, 31, 120, 73, 64, 169, - 148, 224, 57, 95, 17, 40, 213, 92, 195, 146, 235, 228, 177, 101, - 82, 182, 25, 172, 170, 250, 236, 7, 119, 4, 201, 10, 14, 208, - 47, 126, 49, 210, 174, 75, 221, 203, 24, 66, 52, 35, 26, 30, - 140, 111, 246, 39, 226, 205, 198, 178, 196, 5, 81, 9, 44, 164, - 163, 214, 138, 123, 76, 74, 237, 121, 13, 137, 186, 97, 193, 189, - 200, 124, 69, 115, 230, 159, 185, 158, 51, 12, 225, 65, 192, 105, - 56, 41, 85, 133, 19, 217, 166, 48, 139, 131, 96, 216, 98, 147, - 132, 234, 167, 248, 247, 32, 239, 194, 188, 254, 114, 117, 83, 25, - 251, 191, 104, 240, 118, 68, 42, 93, 18, 16, 37, 232, 99, 179, - 23, 90, 94, 136, 6, 125, 91, 255, 15, 71, 43, 46, 25, 252, - 229, 80, 143, 58, 241, 11, 62, 181, 155, 53, 153, 149, 152, 227, - 150, 87, 112, 165, 2, 128, 231, 25, 157, 244, 204, 108, 253, 127, - 122, 145, 113, 162, 197, 171, 199, 54, 184, 222, 206, 67, 144, 78, - 187, 207, 60, 211, 141, 135, 106, 220, 79, 183, 245, 21, 161, 168, - 34, 129, 50, 176, 1, 218, 20, 130, 59, 249, 109, 219, 0, 100, - 103, 55, 29, 242, 110, 154, 190, 233, 142, 45, 61, 215, 202, 238, - 88, 209, 70, 63, 151, 27, 102, 219, 30, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ecdsa_certificate_t *test_msg = - (msg_ecdsa_certificate_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[0] = 180; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[1] = 160; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[2] = 116; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[3] = 77; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[4] = 243; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[5] = 28; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[6] = 173; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[7] = 36; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[8] = 86; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[9] = 33; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[10] = 8; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[11] = 31; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[12] = 120; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[13] = 73; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[14] = 64; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[15] = 169; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[16] = 148; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[17] = 224; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[18] = 57; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[19] = 95; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[20] = 17; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[21] = 40; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[22] = 213; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[23] = 92; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[24] = 195; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[25] = 146; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[26] = 235; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[27] = 228; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[28] = 177; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[29] = 101; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[30] = 82; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[31] = 182; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[32] = 25; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[33] = 172; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[34] = 170; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[35] = 250; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[36] = 236; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[37] = 7; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[38] = 119; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[39] = 4; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[40] = 201; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[41] = 10; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[42] = 14; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[43] = 208; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[44] = 47; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[45] = 126; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[46] = 49; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[47] = 210; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[48] = 174; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[49] = 75; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[50] = 221; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[51] = 203; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[52] = 24; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[53] = 66; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[54] = 52; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[55] = 35; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[56] = 26; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[57] = 30; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[58] = 140; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[59] = 111; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[60] = 246; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[61] = 39; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[62] = 226; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[63] = 205; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[64] = 198; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[65] = 178; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[66] = 196; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[67] = 5; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[68] = 81; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[69] = 9; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[70] = 44; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[71] = 164; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[72] = 163; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[73] = 214; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[74] = 138; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[75] = 123; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[76] = 76; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[77] = 74; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[78] = 237; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[79] = 121; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[80] = 13; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[81] = 137; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[82] = 186; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[83] = 97; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[84] = 193; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[85] = 189; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[86] = 200; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[87] = 124; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[88] = 69; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[89] = 115; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[90] = 230; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[91] = 159; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[92] = 185; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[93] = 158; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[94] = 51; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[95] = 12; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[96] = 225; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[97] = 65; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[98] = 192; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[99] = 105; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[100] = 56; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[101] = 41; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[102] = 85; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[103] = 133; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[104] = 19; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[105] = 217; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[106] = 166; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[107] = 48; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[108] = 139; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[109] = 131; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[110] = 96; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[111] = 216; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[112] = 98; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[113] = 147; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[114] = 132; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[115] = 234; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[116] = 167; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[117] = 248; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[118] = 247; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[119] = 32; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[120] = 239; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[121] = 194; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[122] = 188; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[123] = 254; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[124] = 114; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[125] = 117; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[126] = 83; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[127] = 25; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[128] = 251; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[129] = 191; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[130] = 104; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[131] = 240; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[132] = 118; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[133] = 68; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[134] = 42; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[135] = 93; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[136] = 18; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[137] = 16; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[138] = 37; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[139] = 232; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[140] = 99; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[141] = 179; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[142] = 23; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[143] = 90; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[144] = 94; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[145] = 136; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[146] = 6; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[147] = 125; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[148] = 91; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[149] = 255; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[150] = 15; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[151] = 71; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[152] = 43; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[153] = 46; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[154] = 25; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[155] = 252; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[156] = 229; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[157] = 80; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[158] = 143; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[159] = 58; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[160] = 241; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[161] = 11; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[162] = 62; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[163] = 181; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[164] = 155; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[165] = 53; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[166] = 153; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[167] = 149; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[168] = 152; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[169] = 227; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[170] = 150; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[171] = 87; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[172] = 112; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[173] = 165; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[174] = 2; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[175] = 128; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[176] = 231; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[177] = 25; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[178] = 157; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[179] = 244; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[180] = 204; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[181] = 108; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[182] = 253; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[183] = 127; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[184] = 122; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[185] = 145; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[186] = 113; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[187] = 162; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[188] = 197; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[189] = 171; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[190] = 199; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[191] = 54; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[192] = 184; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[193] = 222; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[194] = 206; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[195] = 67; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[196] = 144; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[197] = 78; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[198] = 187; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[199] = 207; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[200] = 60; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[201] = 211; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[202] = 141; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[203] = 135; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[204] = 106; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[205] = 220; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[206] = 79; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[207] = 183; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[208] = 245; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[209] = 21; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[210] = 161; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[211] = 168; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[212] = 34; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[213] = 129; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[214] = 50; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[215] = 176; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[216] = 1; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[217] = 218; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[218] = 20; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[219] = 130; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[220] = 59; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[221] = 249; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[222] = 109; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[223] = 219; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[224] = 0; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[225] = 100; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[226] = 103; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[227] = 55; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[228] = 29; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[229] = 242; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[230] = 110; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[231] = 154; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[232] = 190; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[233] = 233; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[234] = 142; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[235] = 45; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[236] = 61; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[237] = 215; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[238] = 202; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[239] = 238; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[240] = 88; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[241] = 209; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[242] = 70; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[243] = 63; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[244] = 151; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[245] = 27; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[246] = 102; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_id[0]); - } - test_msg->certificate_id[0] = 10; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_id[0]); - } - test_msg->certificate_id[1] = 11; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_id[0]); - } - test_msg->certificate_id[2] = 12; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_id[0]); - } - test_msg->certificate_id[3] = 13; - test_msg->flags = 2; - test_msg->n_msg = 48; - sbp_payload_send(&sbp_state, 0xC04, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xC04, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ecdsa_certificate_t *check_msg = - (msg_ecdsa_certificate_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - check_msg->certificate_bytes[0] == 180, - "incorrect value for certificate_bytes[0], expected 180, is %d", - check_msg->certificate_bytes[0]); - ck_assert_msg( - check_msg->certificate_bytes[1] == 160, - "incorrect value for certificate_bytes[1], expected 160, is %d", - check_msg->certificate_bytes[1]); - ck_assert_msg( - check_msg->certificate_bytes[2] == 116, - "incorrect value for certificate_bytes[2], expected 116, is %d", - check_msg->certificate_bytes[2]); - ck_assert_msg( - check_msg->certificate_bytes[3] == 77, - "incorrect value for certificate_bytes[3], expected 77, is %d", - check_msg->certificate_bytes[3]); - ck_assert_msg( - check_msg->certificate_bytes[4] == 243, - "incorrect value for certificate_bytes[4], expected 243, is %d", - check_msg->certificate_bytes[4]); - ck_assert_msg( - check_msg->certificate_bytes[5] == 28, - "incorrect value for certificate_bytes[5], expected 28, is %d", - check_msg->certificate_bytes[5]); - ck_assert_msg( - check_msg->certificate_bytes[6] == 173, - "incorrect value for certificate_bytes[6], expected 173, is %d", - check_msg->certificate_bytes[6]); - ck_assert_msg( - check_msg->certificate_bytes[7] == 36, - "incorrect value for certificate_bytes[7], expected 36, is %d", - check_msg->certificate_bytes[7]); - ck_assert_msg( - check_msg->certificate_bytes[8] == 86, - "incorrect value for certificate_bytes[8], expected 86, is %d", - check_msg->certificate_bytes[8]); - ck_assert_msg( - check_msg->certificate_bytes[9] == 33, - "incorrect value for certificate_bytes[9], expected 33, is %d", - check_msg->certificate_bytes[9]); - ck_assert_msg( - check_msg->certificate_bytes[10] == 8, - "incorrect value for certificate_bytes[10], expected 8, is %d", - check_msg->certificate_bytes[10]); - ck_assert_msg( - check_msg->certificate_bytes[11] == 31, - "incorrect value for certificate_bytes[11], expected 31, is %d", - check_msg->certificate_bytes[11]); - ck_assert_msg( - check_msg->certificate_bytes[12] == 120, - "incorrect value for certificate_bytes[12], expected 120, is %d", - check_msg->certificate_bytes[12]); - ck_assert_msg( - check_msg->certificate_bytes[13] == 73, - "incorrect value for certificate_bytes[13], expected 73, is %d", - check_msg->certificate_bytes[13]); - ck_assert_msg( - check_msg->certificate_bytes[14] == 64, - "incorrect value for certificate_bytes[14], expected 64, is %d", - check_msg->certificate_bytes[14]); - ck_assert_msg( - check_msg->certificate_bytes[15] == 169, - "incorrect value for certificate_bytes[15], expected 169, is %d", - check_msg->certificate_bytes[15]); - ck_assert_msg( - check_msg->certificate_bytes[16] == 148, - "incorrect value for certificate_bytes[16], expected 148, is %d", - check_msg->certificate_bytes[16]); - ck_assert_msg( - check_msg->certificate_bytes[17] == 224, - "incorrect value for certificate_bytes[17], expected 224, is %d", - check_msg->certificate_bytes[17]); - ck_assert_msg( - check_msg->certificate_bytes[18] == 57, - "incorrect value for certificate_bytes[18], expected 57, is %d", - check_msg->certificate_bytes[18]); - ck_assert_msg( - check_msg->certificate_bytes[19] == 95, - "incorrect value for certificate_bytes[19], expected 95, is %d", - check_msg->certificate_bytes[19]); - ck_assert_msg( - check_msg->certificate_bytes[20] == 17, - "incorrect value for certificate_bytes[20], expected 17, is %d", - check_msg->certificate_bytes[20]); - ck_assert_msg( - check_msg->certificate_bytes[21] == 40, - "incorrect value for certificate_bytes[21], expected 40, is %d", - check_msg->certificate_bytes[21]); - ck_assert_msg( - check_msg->certificate_bytes[22] == 213, - "incorrect value for certificate_bytes[22], expected 213, is %d", - check_msg->certificate_bytes[22]); - ck_assert_msg( - check_msg->certificate_bytes[23] == 92, - "incorrect value for certificate_bytes[23], expected 92, is %d", - check_msg->certificate_bytes[23]); - ck_assert_msg( - check_msg->certificate_bytes[24] == 195, - "incorrect value for certificate_bytes[24], expected 195, is %d", - check_msg->certificate_bytes[24]); - ck_assert_msg( - check_msg->certificate_bytes[25] == 146, - "incorrect value for certificate_bytes[25], expected 146, is %d", - check_msg->certificate_bytes[25]); - ck_assert_msg( - check_msg->certificate_bytes[26] == 235, - "incorrect value for certificate_bytes[26], expected 235, is %d", - check_msg->certificate_bytes[26]); - ck_assert_msg( - check_msg->certificate_bytes[27] == 228, - "incorrect value for certificate_bytes[27], expected 228, is %d", - check_msg->certificate_bytes[27]); - ck_assert_msg( - check_msg->certificate_bytes[28] == 177, - "incorrect value for certificate_bytes[28], expected 177, is %d", - check_msg->certificate_bytes[28]); - ck_assert_msg( - check_msg->certificate_bytes[29] == 101, - "incorrect value for certificate_bytes[29], expected 101, is %d", - check_msg->certificate_bytes[29]); - ck_assert_msg( - check_msg->certificate_bytes[30] == 82, - "incorrect value for certificate_bytes[30], expected 82, is %d", - check_msg->certificate_bytes[30]); - ck_assert_msg( - check_msg->certificate_bytes[31] == 182, - "incorrect value for certificate_bytes[31], expected 182, is %d", - check_msg->certificate_bytes[31]); - ck_assert_msg( - check_msg->certificate_bytes[32] == 25, - "incorrect value for certificate_bytes[32], expected 25, is %d", - check_msg->certificate_bytes[32]); - ck_assert_msg( - check_msg->certificate_bytes[33] == 172, - "incorrect value for certificate_bytes[33], expected 172, is %d", - check_msg->certificate_bytes[33]); - ck_assert_msg( - check_msg->certificate_bytes[34] == 170, - "incorrect value for certificate_bytes[34], expected 170, is %d", - check_msg->certificate_bytes[34]); - ck_assert_msg( - check_msg->certificate_bytes[35] == 250, - "incorrect value for certificate_bytes[35], expected 250, is %d", - check_msg->certificate_bytes[35]); - ck_assert_msg( - check_msg->certificate_bytes[36] == 236, - "incorrect value for certificate_bytes[36], expected 236, is %d", - check_msg->certificate_bytes[36]); - ck_assert_msg( - check_msg->certificate_bytes[37] == 7, - "incorrect value for certificate_bytes[37], expected 7, is %d", - check_msg->certificate_bytes[37]); - ck_assert_msg( - check_msg->certificate_bytes[38] == 119, - "incorrect value for certificate_bytes[38], expected 119, is %d", - check_msg->certificate_bytes[38]); - ck_assert_msg( - check_msg->certificate_bytes[39] == 4, - "incorrect value for certificate_bytes[39], expected 4, is %d", - check_msg->certificate_bytes[39]); - ck_assert_msg( - check_msg->certificate_bytes[40] == 201, - "incorrect value for certificate_bytes[40], expected 201, is %d", - check_msg->certificate_bytes[40]); - ck_assert_msg( - check_msg->certificate_bytes[41] == 10, - "incorrect value for certificate_bytes[41], expected 10, is %d", - check_msg->certificate_bytes[41]); - ck_assert_msg( - check_msg->certificate_bytes[42] == 14, - "incorrect value for certificate_bytes[42], expected 14, is %d", - check_msg->certificate_bytes[42]); - ck_assert_msg( - check_msg->certificate_bytes[43] == 208, - "incorrect value for certificate_bytes[43], expected 208, is %d", - check_msg->certificate_bytes[43]); - ck_assert_msg( - check_msg->certificate_bytes[44] == 47, - "incorrect value for certificate_bytes[44], expected 47, is %d", - check_msg->certificate_bytes[44]); - ck_assert_msg( - check_msg->certificate_bytes[45] == 126, - "incorrect value for certificate_bytes[45], expected 126, is %d", - check_msg->certificate_bytes[45]); - ck_assert_msg( - check_msg->certificate_bytes[46] == 49, - "incorrect value for certificate_bytes[46], expected 49, is %d", - check_msg->certificate_bytes[46]); - ck_assert_msg( - check_msg->certificate_bytes[47] == 210, - "incorrect value for certificate_bytes[47], expected 210, is %d", - check_msg->certificate_bytes[47]); - ck_assert_msg( - check_msg->certificate_bytes[48] == 174, - "incorrect value for certificate_bytes[48], expected 174, is %d", - check_msg->certificate_bytes[48]); - ck_assert_msg( - check_msg->certificate_bytes[49] == 75, - "incorrect value for certificate_bytes[49], expected 75, is %d", - check_msg->certificate_bytes[49]); - ck_assert_msg( - check_msg->certificate_bytes[50] == 221, - "incorrect value for certificate_bytes[50], expected 221, is %d", - check_msg->certificate_bytes[50]); - ck_assert_msg( - check_msg->certificate_bytes[51] == 203, - "incorrect value for certificate_bytes[51], expected 203, is %d", - check_msg->certificate_bytes[51]); - ck_assert_msg( - check_msg->certificate_bytes[52] == 24, - "incorrect value for certificate_bytes[52], expected 24, is %d", - check_msg->certificate_bytes[52]); - ck_assert_msg( - check_msg->certificate_bytes[53] == 66, - "incorrect value for certificate_bytes[53], expected 66, is %d", - check_msg->certificate_bytes[53]); - ck_assert_msg( - check_msg->certificate_bytes[54] == 52, - "incorrect value for certificate_bytes[54], expected 52, is %d", - check_msg->certificate_bytes[54]); - ck_assert_msg( - check_msg->certificate_bytes[55] == 35, - "incorrect value for certificate_bytes[55], expected 35, is %d", - check_msg->certificate_bytes[55]); - ck_assert_msg( - check_msg->certificate_bytes[56] == 26, - "incorrect value for certificate_bytes[56], expected 26, is %d", - check_msg->certificate_bytes[56]); - ck_assert_msg( - check_msg->certificate_bytes[57] == 30, - "incorrect value for certificate_bytes[57], expected 30, is %d", - check_msg->certificate_bytes[57]); - ck_assert_msg( - check_msg->certificate_bytes[58] == 140, - "incorrect value for certificate_bytes[58], expected 140, is %d", - check_msg->certificate_bytes[58]); - ck_assert_msg( - check_msg->certificate_bytes[59] == 111, - "incorrect value for certificate_bytes[59], expected 111, is %d", - check_msg->certificate_bytes[59]); - ck_assert_msg( - check_msg->certificate_bytes[60] == 246, - "incorrect value for certificate_bytes[60], expected 246, is %d", - check_msg->certificate_bytes[60]); - ck_assert_msg( - check_msg->certificate_bytes[61] == 39, - "incorrect value for certificate_bytes[61], expected 39, is %d", - check_msg->certificate_bytes[61]); - ck_assert_msg( - check_msg->certificate_bytes[62] == 226, - "incorrect value for certificate_bytes[62], expected 226, is %d", - check_msg->certificate_bytes[62]); - ck_assert_msg( - check_msg->certificate_bytes[63] == 205, - "incorrect value for certificate_bytes[63], expected 205, is %d", - check_msg->certificate_bytes[63]); - ck_assert_msg( - check_msg->certificate_bytes[64] == 198, - "incorrect value for certificate_bytes[64], expected 198, is %d", - check_msg->certificate_bytes[64]); - ck_assert_msg( - check_msg->certificate_bytes[65] == 178, - "incorrect value for certificate_bytes[65], expected 178, is %d", - check_msg->certificate_bytes[65]); - ck_assert_msg( - check_msg->certificate_bytes[66] == 196, - "incorrect value for certificate_bytes[66], expected 196, is %d", - check_msg->certificate_bytes[66]); - ck_assert_msg( - check_msg->certificate_bytes[67] == 5, - "incorrect value for certificate_bytes[67], expected 5, is %d", - check_msg->certificate_bytes[67]); - ck_assert_msg( - check_msg->certificate_bytes[68] == 81, - "incorrect value for certificate_bytes[68], expected 81, is %d", - check_msg->certificate_bytes[68]); - ck_assert_msg( - check_msg->certificate_bytes[69] == 9, - "incorrect value for certificate_bytes[69], expected 9, is %d", - check_msg->certificate_bytes[69]); - ck_assert_msg( - check_msg->certificate_bytes[70] == 44, - "incorrect value for certificate_bytes[70], expected 44, is %d", - check_msg->certificate_bytes[70]); - ck_assert_msg( - check_msg->certificate_bytes[71] == 164, - "incorrect value for certificate_bytes[71], expected 164, is %d", - check_msg->certificate_bytes[71]); - ck_assert_msg( - check_msg->certificate_bytes[72] == 163, - "incorrect value for certificate_bytes[72], expected 163, is %d", - check_msg->certificate_bytes[72]); - ck_assert_msg( - check_msg->certificate_bytes[73] == 214, - "incorrect value for certificate_bytes[73], expected 214, is %d", - check_msg->certificate_bytes[73]); - ck_assert_msg( - check_msg->certificate_bytes[74] == 138, - "incorrect value for certificate_bytes[74], expected 138, is %d", - check_msg->certificate_bytes[74]); - ck_assert_msg( - check_msg->certificate_bytes[75] == 123, - "incorrect value for certificate_bytes[75], expected 123, is %d", - check_msg->certificate_bytes[75]); - ck_assert_msg( - check_msg->certificate_bytes[76] == 76, - "incorrect value for certificate_bytes[76], expected 76, is %d", - check_msg->certificate_bytes[76]); - ck_assert_msg( - check_msg->certificate_bytes[77] == 74, - "incorrect value for certificate_bytes[77], expected 74, is %d", - check_msg->certificate_bytes[77]); - ck_assert_msg( - check_msg->certificate_bytes[78] == 237, - "incorrect value for certificate_bytes[78], expected 237, is %d", - check_msg->certificate_bytes[78]); - ck_assert_msg( - check_msg->certificate_bytes[79] == 121, - "incorrect value for certificate_bytes[79], expected 121, is %d", - check_msg->certificate_bytes[79]); - ck_assert_msg( - check_msg->certificate_bytes[80] == 13, - "incorrect value for certificate_bytes[80], expected 13, is %d", - check_msg->certificate_bytes[80]); - ck_assert_msg( - check_msg->certificate_bytes[81] == 137, - "incorrect value for certificate_bytes[81], expected 137, is %d", - check_msg->certificate_bytes[81]); - ck_assert_msg( - check_msg->certificate_bytes[82] == 186, - "incorrect value for certificate_bytes[82], expected 186, is %d", - check_msg->certificate_bytes[82]); - ck_assert_msg( - check_msg->certificate_bytes[83] == 97, - "incorrect value for certificate_bytes[83], expected 97, is %d", - check_msg->certificate_bytes[83]); - ck_assert_msg( - check_msg->certificate_bytes[84] == 193, - "incorrect value for certificate_bytes[84], expected 193, is %d", - check_msg->certificate_bytes[84]); - ck_assert_msg( - check_msg->certificate_bytes[85] == 189, - "incorrect value for certificate_bytes[85], expected 189, is %d", - check_msg->certificate_bytes[85]); - ck_assert_msg( - check_msg->certificate_bytes[86] == 200, - "incorrect value for certificate_bytes[86], expected 200, is %d", - check_msg->certificate_bytes[86]); - ck_assert_msg( - check_msg->certificate_bytes[87] == 124, - "incorrect value for certificate_bytes[87], expected 124, is %d", - check_msg->certificate_bytes[87]); - ck_assert_msg( - check_msg->certificate_bytes[88] == 69, - "incorrect value for certificate_bytes[88], expected 69, is %d", - check_msg->certificate_bytes[88]); - ck_assert_msg( - check_msg->certificate_bytes[89] == 115, - "incorrect value for certificate_bytes[89], expected 115, is %d", - check_msg->certificate_bytes[89]); - ck_assert_msg( - check_msg->certificate_bytes[90] == 230, - "incorrect value for certificate_bytes[90], expected 230, is %d", - check_msg->certificate_bytes[90]); - ck_assert_msg( - check_msg->certificate_bytes[91] == 159, - "incorrect value for certificate_bytes[91], expected 159, is %d", - check_msg->certificate_bytes[91]); - ck_assert_msg( - check_msg->certificate_bytes[92] == 185, - "incorrect value for certificate_bytes[92], expected 185, is %d", - check_msg->certificate_bytes[92]); - ck_assert_msg( - check_msg->certificate_bytes[93] == 158, - "incorrect value for certificate_bytes[93], expected 158, is %d", - check_msg->certificate_bytes[93]); - ck_assert_msg( - check_msg->certificate_bytes[94] == 51, - "incorrect value for certificate_bytes[94], expected 51, is %d", - check_msg->certificate_bytes[94]); - ck_assert_msg( - check_msg->certificate_bytes[95] == 12, - "incorrect value for certificate_bytes[95], expected 12, is %d", - check_msg->certificate_bytes[95]); - ck_assert_msg( - check_msg->certificate_bytes[96] == 225, - "incorrect value for certificate_bytes[96], expected 225, is %d", - check_msg->certificate_bytes[96]); - ck_assert_msg( - check_msg->certificate_bytes[97] == 65, - "incorrect value for certificate_bytes[97], expected 65, is %d", - check_msg->certificate_bytes[97]); - ck_assert_msg( - check_msg->certificate_bytes[98] == 192, - "incorrect value for certificate_bytes[98], expected 192, is %d", - check_msg->certificate_bytes[98]); - ck_assert_msg( - check_msg->certificate_bytes[99] == 105, - "incorrect value for certificate_bytes[99], expected 105, is %d", - check_msg->certificate_bytes[99]); - ck_assert_msg( - check_msg->certificate_bytes[100] == 56, - "incorrect value for certificate_bytes[100], expected 56, is %d", - check_msg->certificate_bytes[100]); - ck_assert_msg( - check_msg->certificate_bytes[101] == 41, - "incorrect value for certificate_bytes[101], expected 41, is %d", - check_msg->certificate_bytes[101]); - ck_assert_msg( - check_msg->certificate_bytes[102] == 85, - "incorrect value for certificate_bytes[102], expected 85, is %d", - check_msg->certificate_bytes[102]); - ck_assert_msg( - check_msg->certificate_bytes[103] == 133, - "incorrect value for certificate_bytes[103], expected 133, is %d", - check_msg->certificate_bytes[103]); - ck_assert_msg( - check_msg->certificate_bytes[104] == 19, - "incorrect value for certificate_bytes[104], expected 19, is %d", - check_msg->certificate_bytes[104]); - ck_assert_msg( - check_msg->certificate_bytes[105] == 217, - "incorrect value for certificate_bytes[105], expected 217, is %d", - check_msg->certificate_bytes[105]); - ck_assert_msg( - check_msg->certificate_bytes[106] == 166, - "incorrect value for certificate_bytes[106], expected 166, is %d", - check_msg->certificate_bytes[106]); - ck_assert_msg( - check_msg->certificate_bytes[107] == 48, - "incorrect value for certificate_bytes[107], expected 48, is %d", - check_msg->certificate_bytes[107]); - ck_assert_msg( - check_msg->certificate_bytes[108] == 139, - "incorrect value for certificate_bytes[108], expected 139, is %d", - check_msg->certificate_bytes[108]); - ck_assert_msg( - check_msg->certificate_bytes[109] == 131, - "incorrect value for certificate_bytes[109], expected 131, is %d", - check_msg->certificate_bytes[109]); - ck_assert_msg( - check_msg->certificate_bytes[110] == 96, - "incorrect value for certificate_bytes[110], expected 96, is %d", - check_msg->certificate_bytes[110]); - ck_assert_msg( - check_msg->certificate_bytes[111] == 216, - "incorrect value for certificate_bytes[111], expected 216, is %d", - check_msg->certificate_bytes[111]); - ck_assert_msg( - check_msg->certificate_bytes[112] == 98, - "incorrect value for certificate_bytes[112], expected 98, is %d", - check_msg->certificate_bytes[112]); - ck_assert_msg( - check_msg->certificate_bytes[113] == 147, - "incorrect value for certificate_bytes[113], expected 147, is %d", - check_msg->certificate_bytes[113]); - ck_assert_msg( - check_msg->certificate_bytes[114] == 132, - "incorrect value for certificate_bytes[114], expected 132, is %d", - check_msg->certificate_bytes[114]); - ck_assert_msg( - check_msg->certificate_bytes[115] == 234, - "incorrect value for certificate_bytes[115], expected 234, is %d", - check_msg->certificate_bytes[115]); - ck_assert_msg( - check_msg->certificate_bytes[116] == 167, - "incorrect value for certificate_bytes[116], expected 167, is %d", - check_msg->certificate_bytes[116]); - ck_assert_msg( - check_msg->certificate_bytes[117] == 248, - "incorrect value for certificate_bytes[117], expected 248, is %d", - check_msg->certificate_bytes[117]); - ck_assert_msg( - check_msg->certificate_bytes[118] == 247, - "incorrect value for certificate_bytes[118], expected 247, is %d", - check_msg->certificate_bytes[118]); - ck_assert_msg( - check_msg->certificate_bytes[119] == 32, - "incorrect value for certificate_bytes[119], expected 32, is %d", - check_msg->certificate_bytes[119]); - ck_assert_msg( - check_msg->certificate_bytes[120] == 239, - "incorrect value for certificate_bytes[120], expected 239, is %d", - check_msg->certificate_bytes[120]); - ck_assert_msg( - check_msg->certificate_bytes[121] == 194, - "incorrect value for certificate_bytes[121], expected 194, is %d", - check_msg->certificate_bytes[121]); - ck_assert_msg( - check_msg->certificate_bytes[122] == 188, - "incorrect value for certificate_bytes[122], expected 188, is %d", - check_msg->certificate_bytes[122]); - ck_assert_msg( - check_msg->certificate_bytes[123] == 254, - "incorrect value for certificate_bytes[123], expected 254, is %d", - check_msg->certificate_bytes[123]); - ck_assert_msg( - check_msg->certificate_bytes[124] == 114, - "incorrect value for certificate_bytes[124], expected 114, is %d", - check_msg->certificate_bytes[124]); - ck_assert_msg( - check_msg->certificate_bytes[125] == 117, - "incorrect value for certificate_bytes[125], expected 117, is %d", - check_msg->certificate_bytes[125]); - ck_assert_msg( - check_msg->certificate_bytes[126] == 83, - "incorrect value for certificate_bytes[126], expected 83, is %d", - check_msg->certificate_bytes[126]); - ck_assert_msg( - check_msg->certificate_bytes[127] == 25, - "incorrect value for certificate_bytes[127], expected 25, is %d", - check_msg->certificate_bytes[127]); - ck_assert_msg( - check_msg->certificate_bytes[128] == 251, - "incorrect value for certificate_bytes[128], expected 251, is %d", - check_msg->certificate_bytes[128]); - ck_assert_msg( - check_msg->certificate_bytes[129] == 191, - "incorrect value for certificate_bytes[129], expected 191, is %d", - check_msg->certificate_bytes[129]); - ck_assert_msg( - check_msg->certificate_bytes[130] == 104, - "incorrect value for certificate_bytes[130], expected 104, is %d", - check_msg->certificate_bytes[130]); - ck_assert_msg( - check_msg->certificate_bytes[131] == 240, - "incorrect value for certificate_bytes[131], expected 240, is %d", - check_msg->certificate_bytes[131]); - ck_assert_msg( - check_msg->certificate_bytes[132] == 118, - "incorrect value for certificate_bytes[132], expected 118, is %d", - check_msg->certificate_bytes[132]); - ck_assert_msg( - check_msg->certificate_bytes[133] == 68, - "incorrect value for certificate_bytes[133], expected 68, is %d", - check_msg->certificate_bytes[133]); - ck_assert_msg( - check_msg->certificate_bytes[134] == 42, - "incorrect value for certificate_bytes[134], expected 42, is %d", - check_msg->certificate_bytes[134]); - ck_assert_msg( - check_msg->certificate_bytes[135] == 93, - "incorrect value for certificate_bytes[135], expected 93, is %d", - check_msg->certificate_bytes[135]); - ck_assert_msg( - check_msg->certificate_bytes[136] == 18, - "incorrect value for certificate_bytes[136], expected 18, is %d", - check_msg->certificate_bytes[136]); - ck_assert_msg( - check_msg->certificate_bytes[137] == 16, - "incorrect value for certificate_bytes[137], expected 16, is %d", - check_msg->certificate_bytes[137]); - ck_assert_msg( - check_msg->certificate_bytes[138] == 37, - "incorrect value for certificate_bytes[138], expected 37, is %d", - check_msg->certificate_bytes[138]); - ck_assert_msg( - check_msg->certificate_bytes[139] == 232, - "incorrect value for certificate_bytes[139], expected 232, is %d", - check_msg->certificate_bytes[139]); - ck_assert_msg( - check_msg->certificate_bytes[140] == 99, - "incorrect value for certificate_bytes[140], expected 99, is %d", - check_msg->certificate_bytes[140]); - ck_assert_msg( - check_msg->certificate_bytes[141] == 179, - "incorrect value for certificate_bytes[141], expected 179, is %d", - check_msg->certificate_bytes[141]); - ck_assert_msg( - check_msg->certificate_bytes[142] == 23, - "incorrect value for certificate_bytes[142], expected 23, is %d", - check_msg->certificate_bytes[142]); - ck_assert_msg( - check_msg->certificate_bytes[143] == 90, - "incorrect value for certificate_bytes[143], expected 90, is %d", - check_msg->certificate_bytes[143]); - ck_assert_msg( - check_msg->certificate_bytes[144] == 94, - "incorrect value for certificate_bytes[144], expected 94, is %d", - check_msg->certificate_bytes[144]); - ck_assert_msg( - check_msg->certificate_bytes[145] == 136, - "incorrect value for certificate_bytes[145], expected 136, is %d", - check_msg->certificate_bytes[145]); - ck_assert_msg( - check_msg->certificate_bytes[146] == 6, - "incorrect value for certificate_bytes[146], expected 6, is %d", - check_msg->certificate_bytes[146]); - ck_assert_msg( - check_msg->certificate_bytes[147] == 125, - "incorrect value for certificate_bytes[147], expected 125, is %d", - check_msg->certificate_bytes[147]); - ck_assert_msg( - check_msg->certificate_bytes[148] == 91, - "incorrect value for certificate_bytes[148], expected 91, is %d", - check_msg->certificate_bytes[148]); - ck_assert_msg( - check_msg->certificate_bytes[149] == 255, - "incorrect value for certificate_bytes[149], expected 255, is %d", - check_msg->certificate_bytes[149]); - ck_assert_msg( - check_msg->certificate_bytes[150] == 15, - "incorrect value for certificate_bytes[150], expected 15, is %d", - check_msg->certificate_bytes[150]); - ck_assert_msg( - check_msg->certificate_bytes[151] == 71, - "incorrect value for certificate_bytes[151], expected 71, is %d", - check_msg->certificate_bytes[151]); - ck_assert_msg( - check_msg->certificate_bytes[152] == 43, - "incorrect value for certificate_bytes[152], expected 43, is %d", - check_msg->certificate_bytes[152]); - ck_assert_msg( - check_msg->certificate_bytes[153] == 46, - "incorrect value for certificate_bytes[153], expected 46, is %d", - check_msg->certificate_bytes[153]); - ck_assert_msg( - check_msg->certificate_bytes[154] == 25, - "incorrect value for certificate_bytes[154], expected 25, is %d", - check_msg->certificate_bytes[154]); - ck_assert_msg( - check_msg->certificate_bytes[155] == 252, - "incorrect value for certificate_bytes[155], expected 252, is %d", - check_msg->certificate_bytes[155]); - ck_assert_msg( - check_msg->certificate_bytes[156] == 229, - "incorrect value for certificate_bytes[156], expected 229, is %d", - check_msg->certificate_bytes[156]); - ck_assert_msg( - check_msg->certificate_bytes[157] == 80, - "incorrect value for certificate_bytes[157], expected 80, is %d", - check_msg->certificate_bytes[157]); - ck_assert_msg( - check_msg->certificate_bytes[158] == 143, - "incorrect value for certificate_bytes[158], expected 143, is %d", - check_msg->certificate_bytes[158]); - ck_assert_msg( - check_msg->certificate_bytes[159] == 58, - "incorrect value for certificate_bytes[159], expected 58, is %d", - check_msg->certificate_bytes[159]); - ck_assert_msg( - check_msg->certificate_bytes[160] == 241, - "incorrect value for certificate_bytes[160], expected 241, is %d", - check_msg->certificate_bytes[160]); - ck_assert_msg( - check_msg->certificate_bytes[161] == 11, - "incorrect value for certificate_bytes[161], expected 11, is %d", - check_msg->certificate_bytes[161]); - ck_assert_msg( - check_msg->certificate_bytes[162] == 62, - "incorrect value for certificate_bytes[162], expected 62, is %d", - check_msg->certificate_bytes[162]); - ck_assert_msg( - check_msg->certificate_bytes[163] == 181, - "incorrect value for certificate_bytes[163], expected 181, is %d", - check_msg->certificate_bytes[163]); - ck_assert_msg( - check_msg->certificate_bytes[164] == 155, - "incorrect value for certificate_bytes[164], expected 155, is %d", - check_msg->certificate_bytes[164]); - ck_assert_msg( - check_msg->certificate_bytes[165] == 53, - "incorrect value for certificate_bytes[165], expected 53, is %d", - check_msg->certificate_bytes[165]); - ck_assert_msg( - check_msg->certificate_bytes[166] == 153, - "incorrect value for certificate_bytes[166], expected 153, is %d", - check_msg->certificate_bytes[166]); - ck_assert_msg( - check_msg->certificate_bytes[167] == 149, - "incorrect value for certificate_bytes[167], expected 149, is %d", - check_msg->certificate_bytes[167]); - ck_assert_msg( - check_msg->certificate_bytes[168] == 152, - "incorrect value for certificate_bytes[168], expected 152, is %d", - check_msg->certificate_bytes[168]); - ck_assert_msg( - check_msg->certificate_bytes[169] == 227, - "incorrect value for certificate_bytes[169], expected 227, is %d", - check_msg->certificate_bytes[169]); - ck_assert_msg( - check_msg->certificate_bytes[170] == 150, - "incorrect value for certificate_bytes[170], expected 150, is %d", - check_msg->certificate_bytes[170]); - ck_assert_msg( - check_msg->certificate_bytes[171] == 87, - "incorrect value for certificate_bytes[171], expected 87, is %d", - check_msg->certificate_bytes[171]); - ck_assert_msg( - check_msg->certificate_bytes[172] == 112, - "incorrect value for certificate_bytes[172], expected 112, is %d", - check_msg->certificate_bytes[172]); - ck_assert_msg( - check_msg->certificate_bytes[173] == 165, - "incorrect value for certificate_bytes[173], expected 165, is %d", - check_msg->certificate_bytes[173]); - ck_assert_msg( - check_msg->certificate_bytes[174] == 2, - "incorrect value for certificate_bytes[174], expected 2, is %d", - check_msg->certificate_bytes[174]); - ck_assert_msg( - check_msg->certificate_bytes[175] == 128, - "incorrect value for certificate_bytes[175], expected 128, is %d", - check_msg->certificate_bytes[175]); - ck_assert_msg( - check_msg->certificate_bytes[176] == 231, - "incorrect value for certificate_bytes[176], expected 231, is %d", - check_msg->certificate_bytes[176]); - ck_assert_msg( - check_msg->certificate_bytes[177] == 25, - "incorrect value for certificate_bytes[177], expected 25, is %d", - check_msg->certificate_bytes[177]); - ck_assert_msg( - check_msg->certificate_bytes[178] == 157, - "incorrect value for certificate_bytes[178], expected 157, is %d", - check_msg->certificate_bytes[178]); - ck_assert_msg( - check_msg->certificate_bytes[179] == 244, - "incorrect value for certificate_bytes[179], expected 244, is %d", - check_msg->certificate_bytes[179]); - ck_assert_msg( - check_msg->certificate_bytes[180] == 204, - "incorrect value for certificate_bytes[180], expected 204, is %d", - check_msg->certificate_bytes[180]); - ck_assert_msg( - check_msg->certificate_bytes[181] == 108, - "incorrect value for certificate_bytes[181], expected 108, is %d", - check_msg->certificate_bytes[181]); - ck_assert_msg( - check_msg->certificate_bytes[182] == 253, - "incorrect value for certificate_bytes[182], expected 253, is %d", - check_msg->certificate_bytes[182]); - ck_assert_msg( - check_msg->certificate_bytes[183] == 127, - "incorrect value for certificate_bytes[183], expected 127, is %d", - check_msg->certificate_bytes[183]); - ck_assert_msg( - check_msg->certificate_bytes[184] == 122, - "incorrect value for certificate_bytes[184], expected 122, is %d", - check_msg->certificate_bytes[184]); - ck_assert_msg( - check_msg->certificate_bytes[185] == 145, - "incorrect value for certificate_bytes[185], expected 145, is %d", - check_msg->certificate_bytes[185]); - ck_assert_msg( - check_msg->certificate_bytes[186] == 113, - "incorrect value for certificate_bytes[186], expected 113, is %d", - check_msg->certificate_bytes[186]); - ck_assert_msg( - check_msg->certificate_bytes[187] == 162, - "incorrect value for certificate_bytes[187], expected 162, is %d", - check_msg->certificate_bytes[187]); - ck_assert_msg( - check_msg->certificate_bytes[188] == 197, - "incorrect value for certificate_bytes[188], expected 197, is %d", - check_msg->certificate_bytes[188]); - ck_assert_msg( - check_msg->certificate_bytes[189] == 171, - "incorrect value for certificate_bytes[189], expected 171, is %d", - check_msg->certificate_bytes[189]); - ck_assert_msg( - check_msg->certificate_bytes[190] == 199, - "incorrect value for certificate_bytes[190], expected 199, is %d", - check_msg->certificate_bytes[190]); - ck_assert_msg( - check_msg->certificate_bytes[191] == 54, - "incorrect value for certificate_bytes[191], expected 54, is %d", - check_msg->certificate_bytes[191]); - ck_assert_msg( - check_msg->certificate_bytes[192] == 184, - "incorrect value for certificate_bytes[192], expected 184, is %d", - check_msg->certificate_bytes[192]); - ck_assert_msg( - check_msg->certificate_bytes[193] == 222, - "incorrect value for certificate_bytes[193], expected 222, is %d", - check_msg->certificate_bytes[193]); - ck_assert_msg( - check_msg->certificate_bytes[194] == 206, - "incorrect value for certificate_bytes[194], expected 206, is %d", - check_msg->certificate_bytes[194]); - ck_assert_msg( - check_msg->certificate_bytes[195] == 67, - "incorrect value for certificate_bytes[195], expected 67, is %d", - check_msg->certificate_bytes[195]); - ck_assert_msg( - check_msg->certificate_bytes[196] == 144, - "incorrect value for certificate_bytes[196], expected 144, is %d", - check_msg->certificate_bytes[196]); - ck_assert_msg( - check_msg->certificate_bytes[197] == 78, - "incorrect value for certificate_bytes[197], expected 78, is %d", - check_msg->certificate_bytes[197]); - ck_assert_msg( - check_msg->certificate_bytes[198] == 187, - "incorrect value for certificate_bytes[198], expected 187, is %d", - check_msg->certificate_bytes[198]); - ck_assert_msg( - check_msg->certificate_bytes[199] == 207, - "incorrect value for certificate_bytes[199], expected 207, is %d", - check_msg->certificate_bytes[199]); - ck_assert_msg( - check_msg->certificate_bytes[200] == 60, - "incorrect value for certificate_bytes[200], expected 60, is %d", - check_msg->certificate_bytes[200]); - ck_assert_msg( - check_msg->certificate_bytes[201] == 211, - "incorrect value for certificate_bytes[201], expected 211, is %d", - check_msg->certificate_bytes[201]); - ck_assert_msg( - check_msg->certificate_bytes[202] == 141, - "incorrect value for certificate_bytes[202], expected 141, is %d", - check_msg->certificate_bytes[202]); - ck_assert_msg( - check_msg->certificate_bytes[203] == 135, - "incorrect value for certificate_bytes[203], expected 135, is %d", - check_msg->certificate_bytes[203]); - ck_assert_msg( - check_msg->certificate_bytes[204] == 106, - "incorrect value for certificate_bytes[204], expected 106, is %d", - check_msg->certificate_bytes[204]); - ck_assert_msg( - check_msg->certificate_bytes[205] == 220, - "incorrect value for certificate_bytes[205], expected 220, is %d", - check_msg->certificate_bytes[205]); - ck_assert_msg( - check_msg->certificate_bytes[206] == 79, - "incorrect value for certificate_bytes[206], expected 79, is %d", - check_msg->certificate_bytes[206]); - ck_assert_msg( - check_msg->certificate_bytes[207] == 183, - "incorrect value for certificate_bytes[207], expected 183, is %d", - check_msg->certificate_bytes[207]); - ck_assert_msg( - check_msg->certificate_bytes[208] == 245, - "incorrect value for certificate_bytes[208], expected 245, is %d", - check_msg->certificate_bytes[208]); - ck_assert_msg( - check_msg->certificate_bytes[209] == 21, - "incorrect value for certificate_bytes[209], expected 21, is %d", - check_msg->certificate_bytes[209]); - ck_assert_msg( - check_msg->certificate_bytes[210] == 161, - "incorrect value for certificate_bytes[210], expected 161, is %d", - check_msg->certificate_bytes[210]); - ck_assert_msg( - check_msg->certificate_bytes[211] == 168, - "incorrect value for certificate_bytes[211], expected 168, is %d", - check_msg->certificate_bytes[211]); - ck_assert_msg( - check_msg->certificate_bytes[212] == 34, - "incorrect value for certificate_bytes[212], expected 34, is %d", - check_msg->certificate_bytes[212]); - ck_assert_msg( - check_msg->certificate_bytes[213] == 129, - "incorrect value for certificate_bytes[213], expected 129, is %d", - check_msg->certificate_bytes[213]); - ck_assert_msg( - check_msg->certificate_bytes[214] == 50, - "incorrect value for certificate_bytes[214], expected 50, is %d", - check_msg->certificate_bytes[214]); - ck_assert_msg( - check_msg->certificate_bytes[215] == 176, - "incorrect value for certificate_bytes[215], expected 176, is %d", - check_msg->certificate_bytes[215]); - ck_assert_msg( - check_msg->certificate_bytes[216] == 1, - "incorrect value for certificate_bytes[216], expected 1, is %d", - check_msg->certificate_bytes[216]); - ck_assert_msg( - check_msg->certificate_bytes[217] == 218, - "incorrect value for certificate_bytes[217], expected 218, is %d", - check_msg->certificate_bytes[217]); - ck_assert_msg( - check_msg->certificate_bytes[218] == 20, - "incorrect value for certificate_bytes[218], expected 20, is %d", - check_msg->certificate_bytes[218]); - ck_assert_msg( - check_msg->certificate_bytes[219] == 130, - "incorrect value for certificate_bytes[219], expected 130, is %d", - check_msg->certificate_bytes[219]); - ck_assert_msg( - check_msg->certificate_bytes[220] == 59, - "incorrect value for certificate_bytes[220], expected 59, is %d", - check_msg->certificate_bytes[220]); - ck_assert_msg( - check_msg->certificate_bytes[221] == 249, - "incorrect value for certificate_bytes[221], expected 249, is %d", - check_msg->certificate_bytes[221]); - ck_assert_msg( - check_msg->certificate_bytes[222] == 109, - "incorrect value for certificate_bytes[222], expected 109, is %d", - check_msg->certificate_bytes[222]); - ck_assert_msg( - check_msg->certificate_bytes[223] == 219, - "incorrect value for certificate_bytes[223], expected 219, is %d", - check_msg->certificate_bytes[223]); - ck_assert_msg( - check_msg->certificate_bytes[224] == 0, - "incorrect value for certificate_bytes[224], expected 0, is %d", - check_msg->certificate_bytes[224]); - ck_assert_msg( - check_msg->certificate_bytes[225] == 100, - "incorrect value for certificate_bytes[225], expected 100, is %d", - check_msg->certificate_bytes[225]); - ck_assert_msg( - check_msg->certificate_bytes[226] == 103, - "incorrect value for certificate_bytes[226], expected 103, is %d", - check_msg->certificate_bytes[226]); - ck_assert_msg( - check_msg->certificate_bytes[227] == 55, - "incorrect value for certificate_bytes[227], expected 55, is %d", - check_msg->certificate_bytes[227]); - ck_assert_msg( - check_msg->certificate_bytes[228] == 29, - "incorrect value for certificate_bytes[228], expected 29, is %d", - check_msg->certificate_bytes[228]); - ck_assert_msg( - check_msg->certificate_bytes[229] == 242, - "incorrect value for certificate_bytes[229], expected 242, is %d", - check_msg->certificate_bytes[229]); - ck_assert_msg( - check_msg->certificate_bytes[230] == 110, - "incorrect value for certificate_bytes[230], expected 110, is %d", - check_msg->certificate_bytes[230]); - ck_assert_msg( - check_msg->certificate_bytes[231] == 154, - "incorrect value for certificate_bytes[231], expected 154, is %d", - check_msg->certificate_bytes[231]); - ck_assert_msg( - check_msg->certificate_bytes[232] == 190, - "incorrect value for certificate_bytes[232], expected 190, is %d", - check_msg->certificate_bytes[232]); - ck_assert_msg( - check_msg->certificate_bytes[233] == 233, - "incorrect value for certificate_bytes[233], expected 233, is %d", - check_msg->certificate_bytes[233]); - ck_assert_msg( - check_msg->certificate_bytes[234] == 142, - "incorrect value for certificate_bytes[234], expected 142, is %d", - check_msg->certificate_bytes[234]); - ck_assert_msg( - check_msg->certificate_bytes[235] == 45, - "incorrect value for certificate_bytes[235], expected 45, is %d", - check_msg->certificate_bytes[235]); - ck_assert_msg( - check_msg->certificate_bytes[236] == 61, - "incorrect value for certificate_bytes[236], expected 61, is %d", - check_msg->certificate_bytes[236]); - ck_assert_msg( - check_msg->certificate_bytes[237] == 215, - "incorrect value for certificate_bytes[237], expected 215, is %d", - check_msg->certificate_bytes[237]); - ck_assert_msg( - check_msg->certificate_bytes[238] == 202, - "incorrect value for certificate_bytes[238], expected 202, is %d", - check_msg->certificate_bytes[238]); - ck_assert_msg( - check_msg->certificate_bytes[239] == 238, - "incorrect value for certificate_bytes[239], expected 238, is %d", - check_msg->certificate_bytes[239]); - ck_assert_msg( - check_msg->certificate_bytes[240] == 88, - "incorrect value for certificate_bytes[240], expected 88, is %d", - check_msg->certificate_bytes[240]); - ck_assert_msg( - check_msg->certificate_bytes[241] == 209, - "incorrect value for certificate_bytes[241], expected 209, is %d", - check_msg->certificate_bytes[241]); - ck_assert_msg( - check_msg->certificate_bytes[242] == 70, - "incorrect value for certificate_bytes[242], expected 70, is %d", - check_msg->certificate_bytes[242]); - ck_assert_msg( - check_msg->certificate_bytes[243] == 63, - "incorrect value for certificate_bytes[243], expected 63, is %d", - check_msg->certificate_bytes[243]); - ck_assert_msg( - check_msg->certificate_bytes[244] == 151, - "incorrect value for certificate_bytes[244], expected 151, is %d", - check_msg->certificate_bytes[244]); - ck_assert_msg( - check_msg->certificate_bytes[245] == 27, - "incorrect value for certificate_bytes[245], expected 27, is %d", - check_msg->certificate_bytes[245]); - ck_assert_msg( - check_msg->certificate_bytes[246] == 102, - "incorrect value for certificate_bytes[246], expected 102, is %d", - check_msg->certificate_bytes[246]); - ck_assert_msg(check_msg->certificate_id[0] == 10, - "incorrect value for certificate_id[0], expected 10, is %d", - check_msg->certificate_id[0]); - ck_assert_msg(check_msg->certificate_id[1] == 11, - "incorrect value for certificate_id[1], expected 11, is %d", - check_msg->certificate_id[1]); - ck_assert_msg(check_msg->certificate_id[2] == 12, - "incorrect value for certificate_id[2], expected 12, is %d", - check_msg->certificate_id[2]); - ck_assert_msg(check_msg->certificate_id[3] == 13, - "incorrect value for certificate_id[3], expected 13, is %d", - check_msg->certificate_id[3]); - ck_assert_msg(check_msg->flags == 2, - "incorrect value for flags, expected 2, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_msg == 48, - "incorrect value for n_msg, expected 48, is %d", - check_msg->n_msg); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_signing_MsgEcdsaCertificate_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_signing_MsgEcdsaCertificate"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_signing_MsgEcdsaCertificate"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_signing_MsgEcdsaCertificate); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_signing_MsgEcdsaSignature.c b/c/test/legacy/auto_check_sbp_signing_MsgEcdsaSignature.c deleted file mode 100644 index 190bebbeec..0000000000 --- a/c/test/legacy/auto_check_sbp_signing_MsgEcdsaSignature.c +++ /dev/null @@ -1,866 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgEcdsaSignature.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_signing_MsgEcdsaSignature) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xC08, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xC08, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 8, 12, 66, 0, 83, 0, 1, 2, 1, 2, 3, 4, 72, 0, 1, - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 10, 21, 23, 232, 131, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ecdsa_signature_t *test_msg = (msg_ecdsa_signature_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_id[0]); - } - test_msg->certificate_id[0] = 1; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_id[0]); - } - test_msg->certificate_id[1] = 2; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_id[0]); - } - test_msg->certificate_id[2] = 3; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_id[0]); - } - test_msg->certificate_id[3] = 4; - test_msg->flags = 0; - test_msg->on_demand_counter = 2; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[0] = 0; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[1] = 1; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[2] = 2; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[3] = 3; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[4] = 4; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[5] = 5; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[6] = 6; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[7] = 7; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[8] = 8; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[9] = 9; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[10] = 10; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[11] = 11; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[12] = 12; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[13] = 13; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[14] = 14; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[15] = 15; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[16] = 16; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[17] = 17; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[18] = 18; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[19] = 19; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[20] = 20; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[21] = 21; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[22] = 22; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[23] = 23; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[24] = 24; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[25] = 25; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[26] = 26; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[27] = 27; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[28] = 28; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[29] = 29; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[30] = 30; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[31] = 31; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[32] = 32; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[33] = 33; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[34] = 34; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[35] = 35; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[36] = 36; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[37] = 37; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[38] = 38; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[39] = 39; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[40] = 40; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[41] = 41; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[42] = 42; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[43] = 43; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[44] = 44; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[45] = 45; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[46] = 46; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[47] = 47; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[48] = 48; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[49] = 49; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[50] = 50; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[51] = 51; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[52] = 52; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[53] = 53; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[54] = 54; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[55] = 55; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[56] = 56; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[57] = 57; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[58] = 58; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[59] = 59; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[60] = 60; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[61] = 61; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[62] = 62; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[63] = 63; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[64] = 64; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[65] = 65; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[66] = 66; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[67] = 67; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[68] = 68; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[69] = 69; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[70] = 70; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature.data[0]); - } - test_msg->signature.data[71] = 71; - test_msg->signature.len = 72; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[0] = 10; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[1] = 21; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[2] = 23; - test_msg->stream_counter = 1; - sbp_payload_send(&sbp_state, 0xC08, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xC08, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ecdsa_signature_t *check_msg = - (msg_ecdsa_signature_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->certificate_id[0] == 1, - "incorrect value for certificate_id[0], expected 1, is %d", - check_msg->certificate_id[0]); - ck_assert_msg(check_msg->certificate_id[1] == 2, - "incorrect value for certificate_id[1], expected 2, is %d", - check_msg->certificate_id[1]); - ck_assert_msg(check_msg->certificate_id[2] == 3, - "incorrect value for certificate_id[2], expected 3, is %d", - check_msg->certificate_id[2]); - ck_assert_msg(check_msg->certificate_id[3] == 4, - "incorrect value for certificate_id[3], expected 4, is %d", - check_msg->certificate_id[3]); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->on_demand_counter == 2, - "incorrect value for on_demand_counter, expected 2, is %d", - check_msg->on_demand_counter); - ck_assert_msg(check_msg->signature.data[0] == 0, - "incorrect value for signature.data[0], expected 0, is %d", - check_msg->signature.data[0]); - ck_assert_msg(check_msg->signature.data[1] == 1, - "incorrect value for signature.data[1], expected 1, is %d", - check_msg->signature.data[1]); - ck_assert_msg(check_msg->signature.data[2] == 2, - "incorrect value for signature.data[2], expected 2, is %d", - check_msg->signature.data[2]); - ck_assert_msg(check_msg->signature.data[3] == 3, - "incorrect value for signature.data[3], expected 3, is %d", - check_msg->signature.data[3]); - ck_assert_msg(check_msg->signature.data[4] == 4, - "incorrect value for signature.data[4], expected 4, is %d", - check_msg->signature.data[4]); - ck_assert_msg(check_msg->signature.data[5] == 5, - "incorrect value for signature.data[5], expected 5, is %d", - check_msg->signature.data[5]); - ck_assert_msg(check_msg->signature.data[6] == 6, - "incorrect value for signature.data[6], expected 6, is %d", - check_msg->signature.data[6]); - ck_assert_msg(check_msg->signature.data[7] == 7, - "incorrect value for signature.data[7], expected 7, is %d", - check_msg->signature.data[7]); - ck_assert_msg(check_msg->signature.data[8] == 8, - "incorrect value for signature.data[8], expected 8, is %d", - check_msg->signature.data[8]); - ck_assert_msg(check_msg->signature.data[9] == 9, - "incorrect value for signature.data[9], expected 9, is %d", - check_msg->signature.data[9]); - ck_assert_msg(check_msg->signature.data[10] == 10, - "incorrect value for signature.data[10], expected 10, is %d", - check_msg->signature.data[10]); - ck_assert_msg(check_msg->signature.data[11] == 11, - "incorrect value for signature.data[11], expected 11, is %d", - check_msg->signature.data[11]); - ck_assert_msg(check_msg->signature.data[12] == 12, - "incorrect value for signature.data[12], expected 12, is %d", - check_msg->signature.data[12]); - ck_assert_msg(check_msg->signature.data[13] == 13, - "incorrect value for signature.data[13], expected 13, is %d", - check_msg->signature.data[13]); - ck_assert_msg(check_msg->signature.data[14] == 14, - "incorrect value for signature.data[14], expected 14, is %d", - check_msg->signature.data[14]); - ck_assert_msg(check_msg->signature.data[15] == 15, - "incorrect value for signature.data[15], expected 15, is %d", - check_msg->signature.data[15]); - ck_assert_msg(check_msg->signature.data[16] == 16, - "incorrect value for signature.data[16], expected 16, is %d", - check_msg->signature.data[16]); - ck_assert_msg(check_msg->signature.data[17] == 17, - "incorrect value for signature.data[17], expected 17, is %d", - check_msg->signature.data[17]); - ck_assert_msg(check_msg->signature.data[18] == 18, - "incorrect value for signature.data[18], expected 18, is %d", - check_msg->signature.data[18]); - ck_assert_msg(check_msg->signature.data[19] == 19, - "incorrect value for signature.data[19], expected 19, is %d", - check_msg->signature.data[19]); - ck_assert_msg(check_msg->signature.data[20] == 20, - "incorrect value for signature.data[20], expected 20, is %d", - check_msg->signature.data[20]); - ck_assert_msg(check_msg->signature.data[21] == 21, - "incorrect value for signature.data[21], expected 21, is %d", - check_msg->signature.data[21]); - ck_assert_msg(check_msg->signature.data[22] == 22, - "incorrect value for signature.data[22], expected 22, is %d", - check_msg->signature.data[22]); - ck_assert_msg(check_msg->signature.data[23] == 23, - "incorrect value for signature.data[23], expected 23, is %d", - check_msg->signature.data[23]); - ck_assert_msg(check_msg->signature.data[24] == 24, - "incorrect value for signature.data[24], expected 24, is %d", - check_msg->signature.data[24]); - ck_assert_msg(check_msg->signature.data[25] == 25, - "incorrect value for signature.data[25], expected 25, is %d", - check_msg->signature.data[25]); - ck_assert_msg(check_msg->signature.data[26] == 26, - "incorrect value for signature.data[26], expected 26, is %d", - check_msg->signature.data[26]); - ck_assert_msg(check_msg->signature.data[27] == 27, - "incorrect value for signature.data[27], expected 27, is %d", - check_msg->signature.data[27]); - ck_assert_msg(check_msg->signature.data[28] == 28, - "incorrect value for signature.data[28], expected 28, is %d", - check_msg->signature.data[28]); - ck_assert_msg(check_msg->signature.data[29] == 29, - "incorrect value for signature.data[29], expected 29, is %d", - check_msg->signature.data[29]); - ck_assert_msg(check_msg->signature.data[30] == 30, - "incorrect value for signature.data[30], expected 30, is %d", - check_msg->signature.data[30]); - ck_assert_msg(check_msg->signature.data[31] == 31, - "incorrect value for signature.data[31], expected 31, is %d", - check_msg->signature.data[31]); - ck_assert_msg(check_msg->signature.data[32] == 32, - "incorrect value for signature.data[32], expected 32, is %d", - check_msg->signature.data[32]); - ck_assert_msg(check_msg->signature.data[33] == 33, - "incorrect value for signature.data[33], expected 33, is %d", - check_msg->signature.data[33]); - ck_assert_msg(check_msg->signature.data[34] == 34, - "incorrect value for signature.data[34], expected 34, is %d", - check_msg->signature.data[34]); - ck_assert_msg(check_msg->signature.data[35] == 35, - "incorrect value for signature.data[35], expected 35, is %d", - check_msg->signature.data[35]); - ck_assert_msg(check_msg->signature.data[36] == 36, - "incorrect value for signature.data[36], expected 36, is %d", - check_msg->signature.data[36]); - ck_assert_msg(check_msg->signature.data[37] == 37, - "incorrect value for signature.data[37], expected 37, is %d", - check_msg->signature.data[37]); - ck_assert_msg(check_msg->signature.data[38] == 38, - "incorrect value for signature.data[38], expected 38, is %d", - check_msg->signature.data[38]); - ck_assert_msg(check_msg->signature.data[39] == 39, - "incorrect value for signature.data[39], expected 39, is %d", - check_msg->signature.data[39]); - ck_assert_msg(check_msg->signature.data[40] == 40, - "incorrect value for signature.data[40], expected 40, is %d", - check_msg->signature.data[40]); - ck_assert_msg(check_msg->signature.data[41] == 41, - "incorrect value for signature.data[41], expected 41, is %d", - check_msg->signature.data[41]); - ck_assert_msg(check_msg->signature.data[42] == 42, - "incorrect value for signature.data[42], expected 42, is %d", - check_msg->signature.data[42]); - ck_assert_msg(check_msg->signature.data[43] == 43, - "incorrect value for signature.data[43], expected 43, is %d", - check_msg->signature.data[43]); - ck_assert_msg(check_msg->signature.data[44] == 44, - "incorrect value for signature.data[44], expected 44, is %d", - check_msg->signature.data[44]); - ck_assert_msg(check_msg->signature.data[45] == 45, - "incorrect value for signature.data[45], expected 45, is %d", - check_msg->signature.data[45]); - ck_assert_msg(check_msg->signature.data[46] == 46, - "incorrect value for signature.data[46], expected 46, is %d", - check_msg->signature.data[46]); - ck_assert_msg(check_msg->signature.data[47] == 47, - "incorrect value for signature.data[47], expected 47, is %d", - check_msg->signature.data[47]); - ck_assert_msg(check_msg->signature.data[48] == 48, - "incorrect value for signature.data[48], expected 48, is %d", - check_msg->signature.data[48]); - ck_assert_msg(check_msg->signature.data[49] == 49, - "incorrect value for signature.data[49], expected 49, is %d", - check_msg->signature.data[49]); - ck_assert_msg(check_msg->signature.data[50] == 50, - "incorrect value for signature.data[50], expected 50, is %d", - check_msg->signature.data[50]); - ck_assert_msg(check_msg->signature.data[51] == 51, - "incorrect value for signature.data[51], expected 51, is %d", - check_msg->signature.data[51]); - ck_assert_msg(check_msg->signature.data[52] == 52, - "incorrect value for signature.data[52], expected 52, is %d", - check_msg->signature.data[52]); - ck_assert_msg(check_msg->signature.data[53] == 53, - "incorrect value for signature.data[53], expected 53, is %d", - check_msg->signature.data[53]); - ck_assert_msg(check_msg->signature.data[54] == 54, - "incorrect value for signature.data[54], expected 54, is %d", - check_msg->signature.data[54]); - ck_assert_msg(check_msg->signature.data[55] == 55, - "incorrect value for signature.data[55], expected 55, is %d", - check_msg->signature.data[55]); - ck_assert_msg(check_msg->signature.data[56] == 56, - "incorrect value for signature.data[56], expected 56, is %d", - check_msg->signature.data[56]); - ck_assert_msg(check_msg->signature.data[57] == 57, - "incorrect value for signature.data[57], expected 57, is %d", - check_msg->signature.data[57]); - ck_assert_msg(check_msg->signature.data[58] == 58, - "incorrect value for signature.data[58], expected 58, is %d", - check_msg->signature.data[58]); - ck_assert_msg(check_msg->signature.data[59] == 59, - "incorrect value for signature.data[59], expected 59, is %d", - check_msg->signature.data[59]); - ck_assert_msg(check_msg->signature.data[60] == 60, - "incorrect value for signature.data[60], expected 60, is %d", - check_msg->signature.data[60]); - ck_assert_msg(check_msg->signature.data[61] == 61, - "incorrect value for signature.data[61], expected 61, is %d", - check_msg->signature.data[61]); - ck_assert_msg(check_msg->signature.data[62] == 62, - "incorrect value for signature.data[62], expected 62, is %d", - check_msg->signature.data[62]); - ck_assert_msg(check_msg->signature.data[63] == 63, - "incorrect value for signature.data[63], expected 63, is %d", - check_msg->signature.data[63]); - ck_assert_msg(check_msg->signature.data[64] == 64, - "incorrect value for signature.data[64], expected 64, is %d", - check_msg->signature.data[64]); - ck_assert_msg(check_msg->signature.data[65] == 65, - "incorrect value for signature.data[65], expected 65, is %d", - check_msg->signature.data[65]); - ck_assert_msg(check_msg->signature.data[66] == 66, - "incorrect value for signature.data[66], expected 66, is %d", - check_msg->signature.data[66]); - ck_assert_msg(check_msg->signature.data[67] == 67, - "incorrect value for signature.data[67], expected 67, is %d", - check_msg->signature.data[67]); - ck_assert_msg(check_msg->signature.data[68] == 68, - "incorrect value for signature.data[68], expected 68, is %d", - check_msg->signature.data[68]); - ck_assert_msg(check_msg->signature.data[69] == 69, - "incorrect value for signature.data[69], expected 69, is %d", - check_msg->signature.data[69]); - ck_assert_msg(check_msg->signature.data[70] == 70, - "incorrect value for signature.data[70], expected 70, is %d", - check_msg->signature.data[70]); - ck_assert_msg(check_msg->signature.data[71] == 71, - "incorrect value for signature.data[71], expected 71, is %d", - check_msg->signature.data[71]); - ck_assert_msg(check_msg->signature.len == 72, - "incorrect value for signature.len, expected 72, is %d", - check_msg->signature.len); - ck_assert_msg(check_msg->signed_messages[0] == 10, - "incorrect value for signed_messages[0], expected 10, is %d", - check_msg->signed_messages[0]); - ck_assert_msg(check_msg->signed_messages[1] == 21, - "incorrect value for signed_messages[1], expected 21, is %d", - check_msg->signed_messages[1]); - ck_assert_msg(check_msg->signed_messages[2] == 23, - "incorrect value for signed_messages[2], expected 23, is %d", - check_msg->signed_messages[2]); - ck_assert_msg(check_msg->stream_counter == 1, - "incorrect value for stream_counter, expected 1, is %d", - check_msg->stream_counter); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_signing_MsgEcdsaSignature_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_signing_MsgEcdsaSignature"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_signing_MsgEcdsaSignature"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_signing_MsgEcdsaSignature); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_signing_MsgEcdsaSignatureDepA.c b/c/test/legacy/auto_check_sbp_signing_MsgEcdsaSignatureDepA.c deleted file mode 100644 index feba85e05a..0000000000 --- a/c/test/legacy/auto_check_sbp_signing_MsgEcdsaSignatureDepA.c +++ /dev/null @@ -1,2386 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgEcdsaSignatureDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xC06, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xC06, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 6, 12, 66, 0, 255, 0, 1, 2, 1, 2, 3, 4, 0, - 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, - 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, - 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, - 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, - 1, 2, 3, 4, 5, 6, 7, 10, 21, 23, 63, 140, 37, 130, - 106, 28, 40, 165, 179, 73, 178, 60, 126, 114, 78, 113, 27, 95, - 3, 62, 104, 145, 96, 19, 92, 123, 14, 90, 153, 183, 9, 72, - 81, 118, 112, 124, 16, 182, 76, 146, 115, 58, 144, 17, 105, 66, - 31, 135, 54, 100, 84, 181, 103, 11, 88, 133, 155, 167, 173, 143, - 86, 158, 20, 168, 132, 141, 102, 50, 48, 71, 147, 53, 87, 1, - 108, 138, 36, 134, 139, 163, 82, 43, 52, 150, 12, 30, 110, 156, - 107, 120, 91, 122, 69, 164, 170, 116, 25, 94, 5, 22, 24, 162, - 175, 38, 157, 98, 44, 160, 47, 97, 142, 8, 74, 13, 177, 15, - 128, 26, 131, 154, 65, 169, 55, 136, 125, 171, 161, 29, 129, 151, - 68, 166, 51, 70, 45, 56, 79, 149, 99, 42, 101, 152, 39, 89, - 180, 64, 49, 6, 80, 172, 32, 109, 2, 119, 93, 176, 0, 33, - 57, 34, 18, 85, 121, 137, 83, 111, 59, 7, 77, 4, 117, 159, - 148, 35, 61, 41, 67, 46, 127, 75, 174, 97, 172, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ecdsa_signature_dep_a_t *test_msg = - (msg_ecdsa_signature_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_id[0]); - } - test_msg->certificate_id[0] = 1; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_id[0]); - } - test_msg->certificate_id[1] = 2; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_id[0]); - } - test_msg->certificate_id[2] = 3; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_id[0]); - } - test_msg->certificate_id[3] = 4; - test_msg->flags = 0; - test_msg->on_demand_counter = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[0] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[1] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[2] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[3] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[4] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[5] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[6] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[7] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[8] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[9] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[10] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[11] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[12] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[13] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[14] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[15] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[16] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[17] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[18] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[19] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[20] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[21] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[22] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[23] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[24] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[25] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[26] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[27] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[28] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[29] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[30] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[31] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[32] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[33] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[34] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[35] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[36] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[37] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[38] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[39] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[40] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[41] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[42] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[43] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[44] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[45] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[46] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[47] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[48] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[49] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[50] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[51] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[52] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[53] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[54] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[55] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[56] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[57] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[58] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[59] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[60] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[61] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[62] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[63] = 7; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[0] = 10; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[1] = 21; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[2] = 23; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[3] = 63; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[4] = 140; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[5] = 37; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[6] = 130; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[7] = 106; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[8] = 28; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[9] = 40; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[10] = 165; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[11] = 179; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[12] = 73; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[13] = 178; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[14] = 60; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[15] = 126; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[16] = 114; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[17] = 78; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[18] = 113; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[19] = 27; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[20] = 95; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[21] = 3; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[22] = 62; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[23] = 104; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[24] = 145; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[25] = 96; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[26] = 19; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[27] = 92; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[28] = 123; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[29] = 14; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[30] = 90; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[31] = 153; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[32] = 183; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[33] = 9; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[34] = 72; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[35] = 81; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[36] = 118; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[37] = 112; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[38] = 124; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[39] = 16; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[40] = 182; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[41] = 76; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[42] = 146; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[43] = 115; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[44] = 58; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[45] = 144; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[46] = 17; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[47] = 105; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[48] = 66; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[49] = 31; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[50] = 135; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[51] = 54; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[52] = 100; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[53] = 84; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[54] = 181; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[55] = 103; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[56] = 11; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[57] = 88; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[58] = 133; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[59] = 155; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[60] = 167; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[61] = 173; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[62] = 143; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[63] = 86; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[64] = 158; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[65] = 20; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[66] = 168; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[67] = 132; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[68] = 141; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[69] = 102; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[70] = 50; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[71] = 48; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[72] = 71; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[73] = 147; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[74] = 53; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[75] = 87; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[76] = 1; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[77] = 108; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[78] = 138; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[79] = 36; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[80] = 134; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[81] = 139; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[82] = 163; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[83] = 82; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[84] = 43; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[85] = 52; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[86] = 150; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[87] = 12; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[88] = 30; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[89] = 110; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[90] = 156; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[91] = 107; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[92] = 120; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[93] = 91; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[94] = 122; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[95] = 69; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[96] = 164; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[97] = 170; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[98] = 116; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[99] = 25; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[100] = 94; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[101] = 5; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[102] = 22; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[103] = 24; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[104] = 162; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[105] = 175; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[106] = 38; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[107] = 157; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[108] = 98; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[109] = 44; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[110] = 160; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[111] = 47; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[112] = 97; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[113] = 142; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[114] = 8; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[115] = 74; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[116] = 13; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[117] = 177; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[118] = 15; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[119] = 128; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[120] = 26; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[121] = 131; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[122] = 154; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[123] = 65; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[124] = 169; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[125] = 55; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[126] = 136; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[127] = 125; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[128] = 171; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[129] = 161; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[130] = 29; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[131] = 129; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[132] = 151; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[133] = 68; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[134] = 166; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[135] = 51; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[136] = 70; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[137] = 45; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[138] = 56; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[139] = 79; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[140] = 149; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[141] = 99; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[142] = 42; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[143] = 101; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[144] = 152; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[145] = 39; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[146] = 89; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[147] = 180; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[148] = 64; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[149] = 49; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[150] = 6; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[151] = 80; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[152] = 172; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[153] = 32; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[154] = 109; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[155] = 2; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[156] = 119; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[157] = 93; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[158] = 176; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[159] = 0; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[160] = 33; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[161] = 57; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[162] = 34; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[163] = 18; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[164] = 85; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[165] = 121; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[166] = 137; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[167] = 83; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[168] = 111; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[169] = 59; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[170] = 7; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[171] = 77; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[172] = 4; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[173] = 117; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[174] = 159; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[175] = 148; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[176] = 35; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[177] = 61; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[178] = 41; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[179] = 67; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[180] = 46; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[181] = 127; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[182] = 75; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[183] = 174; - test_msg->stream_counter = 1; - sbp_payload_send(&sbp_state, 0xC06, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xC06, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ecdsa_signature_dep_a_t *check_msg = - (msg_ecdsa_signature_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->certificate_id[0] == 1, - "incorrect value for certificate_id[0], expected 1, is %d", - check_msg->certificate_id[0]); - ck_assert_msg(check_msg->certificate_id[1] == 2, - "incorrect value for certificate_id[1], expected 2, is %d", - check_msg->certificate_id[1]); - ck_assert_msg(check_msg->certificate_id[2] == 3, - "incorrect value for certificate_id[2], expected 3, is %d", - check_msg->certificate_id[2]); - ck_assert_msg(check_msg->certificate_id[3] == 4, - "incorrect value for certificate_id[3], expected 4, is %d", - check_msg->certificate_id[3]); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->on_demand_counter == 2, - "incorrect value for on_demand_counter, expected 2, is %d", - check_msg->on_demand_counter); - ck_assert_msg(check_msg->signature[0] == 0, - "incorrect value for signature[0], expected 0, is %d", - check_msg->signature[0]); - ck_assert_msg(check_msg->signature[1] == 1, - "incorrect value for signature[1], expected 1, is %d", - check_msg->signature[1]); - ck_assert_msg(check_msg->signature[2] == 2, - "incorrect value for signature[2], expected 2, is %d", - check_msg->signature[2]); - ck_assert_msg(check_msg->signature[3] == 3, - "incorrect value for signature[3], expected 3, is %d", - check_msg->signature[3]); - ck_assert_msg(check_msg->signature[4] == 4, - "incorrect value for signature[4], expected 4, is %d", - check_msg->signature[4]); - ck_assert_msg(check_msg->signature[5] == 5, - "incorrect value for signature[5], expected 5, is %d", - check_msg->signature[5]); - ck_assert_msg(check_msg->signature[6] == 6, - "incorrect value for signature[6], expected 6, is %d", - check_msg->signature[6]); - ck_assert_msg(check_msg->signature[7] == 7, - "incorrect value for signature[7], expected 7, is %d", - check_msg->signature[7]); - ck_assert_msg(check_msg->signature[8] == 0, - "incorrect value for signature[8], expected 0, is %d", - check_msg->signature[8]); - ck_assert_msg(check_msg->signature[9] == 1, - "incorrect value for signature[9], expected 1, is %d", - check_msg->signature[9]); - ck_assert_msg(check_msg->signature[10] == 2, - "incorrect value for signature[10], expected 2, is %d", - check_msg->signature[10]); - ck_assert_msg(check_msg->signature[11] == 3, - "incorrect value for signature[11], expected 3, is %d", - check_msg->signature[11]); - ck_assert_msg(check_msg->signature[12] == 4, - "incorrect value for signature[12], expected 4, is %d", - check_msg->signature[12]); - ck_assert_msg(check_msg->signature[13] == 5, - "incorrect value for signature[13], expected 5, is %d", - check_msg->signature[13]); - ck_assert_msg(check_msg->signature[14] == 6, - "incorrect value for signature[14], expected 6, is %d", - check_msg->signature[14]); - ck_assert_msg(check_msg->signature[15] == 7, - "incorrect value for signature[15], expected 7, is %d", - check_msg->signature[15]); - ck_assert_msg(check_msg->signature[16] == 0, - "incorrect value for signature[16], expected 0, is %d", - check_msg->signature[16]); - ck_assert_msg(check_msg->signature[17] == 1, - "incorrect value for signature[17], expected 1, is %d", - check_msg->signature[17]); - ck_assert_msg(check_msg->signature[18] == 2, - "incorrect value for signature[18], expected 2, is %d", - check_msg->signature[18]); - ck_assert_msg(check_msg->signature[19] == 3, - "incorrect value for signature[19], expected 3, is %d", - check_msg->signature[19]); - ck_assert_msg(check_msg->signature[20] == 4, - "incorrect value for signature[20], expected 4, is %d", - check_msg->signature[20]); - ck_assert_msg(check_msg->signature[21] == 5, - "incorrect value for signature[21], expected 5, is %d", - check_msg->signature[21]); - ck_assert_msg(check_msg->signature[22] == 6, - "incorrect value for signature[22], expected 6, is %d", - check_msg->signature[22]); - ck_assert_msg(check_msg->signature[23] == 7, - "incorrect value for signature[23], expected 7, is %d", - check_msg->signature[23]); - ck_assert_msg(check_msg->signature[24] == 0, - "incorrect value for signature[24], expected 0, is %d", - check_msg->signature[24]); - ck_assert_msg(check_msg->signature[25] == 1, - "incorrect value for signature[25], expected 1, is %d", - check_msg->signature[25]); - ck_assert_msg(check_msg->signature[26] == 2, - "incorrect value for signature[26], expected 2, is %d", - check_msg->signature[26]); - ck_assert_msg(check_msg->signature[27] == 3, - "incorrect value for signature[27], expected 3, is %d", - check_msg->signature[27]); - ck_assert_msg(check_msg->signature[28] == 4, - "incorrect value for signature[28], expected 4, is %d", - check_msg->signature[28]); - ck_assert_msg(check_msg->signature[29] == 5, - "incorrect value for signature[29], expected 5, is %d", - check_msg->signature[29]); - ck_assert_msg(check_msg->signature[30] == 6, - "incorrect value for signature[30], expected 6, is %d", - check_msg->signature[30]); - ck_assert_msg(check_msg->signature[31] == 7, - "incorrect value for signature[31], expected 7, is %d", - check_msg->signature[31]); - ck_assert_msg(check_msg->signature[32] == 0, - "incorrect value for signature[32], expected 0, is %d", - check_msg->signature[32]); - ck_assert_msg(check_msg->signature[33] == 1, - "incorrect value for signature[33], expected 1, is %d", - check_msg->signature[33]); - ck_assert_msg(check_msg->signature[34] == 2, - "incorrect value for signature[34], expected 2, is %d", - check_msg->signature[34]); - ck_assert_msg(check_msg->signature[35] == 3, - "incorrect value for signature[35], expected 3, is %d", - check_msg->signature[35]); - ck_assert_msg(check_msg->signature[36] == 4, - "incorrect value for signature[36], expected 4, is %d", - check_msg->signature[36]); - ck_assert_msg(check_msg->signature[37] == 5, - "incorrect value for signature[37], expected 5, is %d", - check_msg->signature[37]); - ck_assert_msg(check_msg->signature[38] == 6, - "incorrect value for signature[38], expected 6, is %d", - check_msg->signature[38]); - ck_assert_msg(check_msg->signature[39] == 7, - "incorrect value for signature[39], expected 7, is %d", - check_msg->signature[39]); - ck_assert_msg(check_msg->signature[40] == 0, - "incorrect value for signature[40], expected 0, is %d", - check_msg->signature[40]); - ck_assert_msg(check_msg->signature[41] == 1, - "incorrect value for signature[41], expected 1, is %d", - check_msg->signature[41]); - ck_assert_msg(check_msg->signature[42] == 2, - "incorrect value for signature[42], expected 2, is %d", - check_msg->signature[42]); - ck_assert_msg(check_msg->signature[43] == 3, - "incorrect value for signature[43], expected 3, is %d", - check_msg->signature[43]); - ck_assert_msg(check_msg->signature[44] == 4, - "incorrect value for signature[44], expected 4, is %d", - check_msg->signature[44]); - ck_assert_msg(check_msg->signature[45] == 5, - "incorrect value for signature[45], expected 5, is %d", - check_msg->signature[45]); - ck_assert_msg(check_msg->signature[46] == 6, - "incorrect value for signature[46], expected 6, is %d", - check_msg->signature[46]); - ck_assert_msg(check_msg->signature[47] == 7, - "incorrect value for signature[47], expected 7, is %d", - check_msg->signature[47]); - ck_assert_msg(check_msg->signature[48] == 0, - "incorrect value for signature[48], expected 0, is %d", - check_msg->signature[48]); - ck_assert_msg(check_msg->signature[49] == 1, - "incorrect value for signature[49], expected 1, is %d", - check_msg->signature[49]); - ck_assert_msg(check_msg->signature[50] == 2, - "incorrect value for signature[50], expected 2, is %d", - check_msg->signature[50]); - ck_assert_msg(check_msg->signature[51] == 3, - "incorrect value for signature[51], expected 3, is %d", - check_msg->signature[51]); - ck_assert_msg(check_msg->signature[52] == 4, - "incorrect value for signature[52], expected 4, is %d", - check_msg->signature[52]); - ck_assert_msg(check_msg->signature[53] == 5, - "incorrect value for signature[53], expected 5, is %d", - check_msg->signature[53]); - ck_assert_msg(check_msg->signature[54] == 6, - "incorrect value for signature[54], expected 6, is %d", - check_msg->signature[54]); - ck_assert_msg(check_msg->signature[55] == 7, - "incorrect value for signature[55], expected 7, is %d", - check_msg->signature[55]); - ck_assert_msg(check_msg->signature[56] == 0, - "incorrect value for signature[56], expected 0, is %d", - check_msg->signature[56]); - ck_assert_msg(check_msg->signature[57] == 1, - "incorrect value for signature[57], expected 1, is %d", - check_msg->signature[57]); - ck_assert_msg(check_msg->signature[58] == 2, - "incorrect value for signature[58], expected 2, is %d", - check_msg->signature[58]); - ck_assert_msg(check_msg->signature[59] == 3, - "incorrect value for signature[59], expected 3, is %d", - check_msg->signature[59]); - ck_assert_msg(check_msg->signature[60] == 4, - "incorrect value for signature[60], expected 4, is %d", - check_msg->signature[60]); - ck_assert_msg(check_msg->signature[61] == 5, - "incorrect value for signature[61], expected 5, is %d", - check_msg->signature[61]); - ck_assert_msg(check_msg->signature[62] == 6, - "incorrect value for signature[62], expected 6, is %d", - check_msg->signature[62]); - ck_assert_msg(check_msg->signature[63] == 7, - "incorrect value for signature[63], expected 7, is %d", - check_msg->signature[63]); - ck_assert_msg(check_msg->signed_messages[0] == 10, - "incorrect value for signed_messages[0], expected 10, is %d", - check_msg->signed_messages[0]); - ck_assert_msg(check_msg->signed_messages[1] == 21, - "incorrect value for signed_messages[1], expected 21, is %d", - check_msg->signed_messages[1]); - ck_assert_msg(check_msg->signed_messages[2] == 23, - "incorrect value for signed_messages[2], expected 23, is %d", - check_msg->signed_messages[2]); - ck_assert_msg(check_msg->signed_messages[3] == 63, - "incorrect value for signed_messages[3], expected 63, is %d", - check_msg->signed_messages[3]); - ck_assert_msg(check_msg->signed_messages[4] == 140, - "incorrect value for signed_messages[4], expected 140, is %d", - check_msg->signed_messages[4]); - ck_assert_msg(check_msg->signed_messages[5] == 37, - "incorrect value for signed_messages[5], expected 37, is %d", - check_msg->signed_messages[5]); - ck_assert_msg(check_msg->signed_messages[6] == 130, - "incorrect value for signed_messages[6], expected 130, is %d", - check_msg->signed_messages[6]); - ck_assert_msg(check_msg->signed_messages[7] == 106, - "incorrect value for signed_messages[7], expected 106, is %d", - check_msg->signed_messages[7]); - ck_assert_msg(check_msg->signed_messages[8] == 28, - "incorrect value for signed_messages[8], expected 28, is %d", - check_msg->signed_messages[8]); - ck_assert_msg(check_msg->signed_messages[9] == 40, - "incorrect value for signed_messages[9], expected 40, is %d", - check_msg->signed_messages[9]); - ck_assert_msg( - check_msg->signed_messages[10] == 165, - "incorrect value for signed_messages[10], expected 165, is %d", - check_msg->signed_messages[10]); - ck_assert_msg( - check_msg->signed_messages[11] == 179, - "incorrect value for signed_messages[11], expected 179, is %d", - check_msg->signed_messages[11]); - ck_assert_msg(check_msg->signed_messages[12] == 73, - "incorrect value for signed_messages[12], expected 73, is %d", - check_msg->signed_messages[12]); - ck_assert_msg( - check_msg->signed_messages[13] == 178, - "incorrect value for signed_messages[13], expected 178, is %d", - check_msg->signed_messages[13]); - ck_assert_msg(check_msg->signed_messages[14] == 60, - "incorrect value for signed_messages[14], expected 60, is %d", - check_msg->signed_messages[14]); - ck_assert_msg( - check_msg->signed_messages[15] == 126, - "incorrect value for signed_messages[15], expected 126, is %d", - check_msg->signed_messages[15]); - ck_assert_msg( - check_msg->signed_messages[16] == 114, - "incorrect value for signed_messages[16], expected 114, is %d", - check_msg->signed_messages[16]); - ck_assert_msg(check_msg->signed_messages[17] == 78, - "incorrect value for signed_messages[17], expected 78, is %d", - check_msg->signed_messages[17]); - ck_assert_msg( - check_msg->signed_messages[18] == 113, - "incorrect value for signed_messages[18], expected 113, is %d", - check_msg->signed_messages[18]); - ck_assert_msg(check_msg->signed_messages[19] == 27, - "incorrect value for signed_messages[19], expected 27, is %d", - check_msg->signed_messages[19]); - ck_assert_msg(check_msg->signed_messages[20] == 95, - "incorrect value for signed_messages[20], expected 95, is %d", - check_msg->signed_messages[20]); - ck_assert_msg(check_msg->signed_messages[21] == 3, - "incorrect value for signed_messages[21], expected 3, is %d", - check_msg->signed_messages[21]); - ck_assert_msg(check_msg->signed_messages[22] == 62, - "incorrect value for signed_messages[22], expected 62, is %d", - check_msg->signed_messages[22]); - ck_assert_msg( - check_msg->signed_messages[23] == 104, - "incorrect value for signed_messages[23], expected 104, is %d", - check_msg->signed_messages[23]); - ck_assert_msg( - check_msg->signed_messages[24] == 145, - "incorrect value for signed_messages[24], expected 145, is %d", - check_msg->signed_messages[24]); - ck_assert_msg(check_msg->signed_messages[25] == 96, - "incorrect value for signed_messages[25], expected 96, is %d", - check_msg->signed_messages[25]); - ck_assert_msg(check_msg->signed_messages[26] == 19, - "incorrect value for signed_messages[26], expected 19, is %d", - check_msg->signed_messages[26]); - ck_assert_msg(check_msg->signed_messages[27] == 92, - "incorrect value for signed_messages[27], expected 92, is %d", - check_msg->signed_messages[27]); - ck_assert_msg( - check_msg->signed_messages[28] == 123, - "incorrect value for signed_messages[28], expected 123, is %d", - check_msg->signed_messages[28]); - ck_assert_msg(check_msg->signed_messages[29] == 14, - "incorrect value for signed_messages[29], expected 14, is %d", - check_msg->signed_messages[29]); - ck_assert_msg(check_msg->signed_messages[30] == 90, - "incorrect value for signed_messages[30], expected 90, is %d", - check_msg->signed_messages[30]); - ck_assert_msg( - check_msg->signed_messages[31] == 153, - "incorrect value for signed_messages[31], expected 153, is %d", - check_msg->signed_messages[31]); - ck_assert_msg( - check_msg->signed_messages[32] == 183, - "incorrect value for signed_messages[32], expected 183, is %d", - check_msg->signed_messages[32]); - ck_assert_msg(check_msg->signed_messages[33] == 9, - "incorrect value for signed_messages[33], expected 9, is %d", - check_msg->signed_messages[33]); - ck_assert_msg(check_msg->signed_messages[34] == 72, - "incorrect value for signed_messages[34], expected 72, is %d", - check_msg->signed_messages[34]); - ck_assert_msg(check_msg->signed_messages[35] == 81, - "incorrect value for signed_messages[35], expected 81, is %d", - check_msg->signed_messages[35]); - ck_assert_msg( - check_msg->signed_messages[36] == 118, - "incorrect value for signed_messages[36], expected 118, is %d", - check_msg->signed_messages[36]); - ck_assert_msg( - check_msg->signed_messages[37] == 112, - "incorrect value for signed_messages[37], expected 112, is %d", - check_msg->signed_messages[37]); - ck_assert_msg( - check_msg->signed_messages[38] == 124, - "incorrect value for signed_messages[38], expected 124, is %d", - check_msg->signed_messages[38]); - ck_assert_msg(check_msg->signed_messages[39] == 16, - "incorrect value for signed_messages[39], expected 16, is %d", - check_msg->signed_messages[39]); - ck_assert_msg( - check_msg->signed_messages[40] == 182, - "incorrect value for signed_messages[40], expected 182, is %d", - check_msg->signed_messages[40]); - ck_assert_msg(check_msg->signed_messages[41] == 76, - "incorrect value for signed_messages[41], expected 76, is %d", - check_msg->signed_messages[41]); - ck_assert_msg( - check_msg->signed_messages[42] == 146, - "incorrect value for signed_messages[42], expected 146, is %d", - check_msg->signed_messages[42]); - ck_assert_msg( - check_msg->signed_messages[43] == 115, - "incorrect value for signed_messages[43], expected 115, is %d", - check_msg->signed_messages[43]); - ck_assert_msg(check_msg->signed_messages[44] == 58, - "incorrect value for signed_messages[44], expected 58, is %d", - check_msg->signed_messages[44]); - ck_assert_msg( - check_msg->signed_messages[45] == 144, - "incorrect value for signed_messages[45], expected 144, is %d", - check_msg->signed_messages[45]); - ck_assert_msg(check_msg->signed_messages[46] == 17, - "incorrect value for signed_messages[46], expected 17, is %d", - check_msg->signed_messages[46]); - ck_assert_msg( - check_msg->signed_messages[47] == 105, - "incorrect value for signed_messages[47], expected 105, is %d", - check_msg->signed_messages[47]); - ck_assert_msg(check_msg->signed_messages[48] == 66, - "incorrect value for signed_messages[48], expected 66, is %d", - check_msg->signed_messages[48]); - ck_assert_msg(check_msg->signed_messages[49] == 31, - "incorrect value for signed_messages[49], expected 31, is %d", - check_msg->signed_messages[49]); - ck_assert_msg( - check_msg->signed_messages[50] == 135, - "incorrect value for signed_messages[50], expected 135, is %d", - check_msg->signed_messages[50]); - ck_assert_msg(check_msg->signed_messages[51] == 54, - "incorrect value for signed_messages[51], expected 54, is %d", - check_msg->signed_messages[51]); - ck_assert_msg( - check_msg->signed_messages[52] == 100, - "incorrect value for signed_messages[52], expected 100, is %d", - check_msg->signed_messages[52]); - ck_assert_msg(check_msg->signed_messages[53] == 84, - "incorrect value for signed_messages[53], expected 84, is %d", - check_msg->signed_messages[53]); - ck_assert_msg( - check_msg->signed_messages[54] == 181, - "incorrect value for signed_messages[54], expected 181, is %d", - check_msg->signed_messages[54]); - ck_assert_msg( - check_msg->signed_messages[55] == 103, - "incorrect value for signed_messages[55], expected 103, is %d", - check_msg->signed_messages[55]); - ck_assert_msg(check_msg->signed_messages[56] == 11, - "incorrect value for signed_messages[56], expected 11, is %d", - check_msg->signed_messages[56]); - ck_assert_msg(check_msg->signed_messages[57] == 88, - "incorrect value for signed_messages[57], expected 88, is %d", - check_msg->signed_messages[57]); - ck_assert_msg( - check_msg->signed_messages[58] == 133, - "incorrect value for signed_messages[58], expected 133, is %d", - check_msg->signed_messages[58]); - ck_assert_msg( - check_msg->signed_messages[59] == 155, - "incorrect value for signed_messages[59], expected 155, is %d", - check_msg->signed_messages[59]); - ck_assert_msg( - check_msg->signed_messages[60] == 167, - "incorrect value for signed_messages[60], expected 167, is %d", - check_msg->signed_messages[60]); - ck_assert_msg( - check_msg->signed_messages[61] == 173, - "incorrect value for signed_messages[61], expected 173, is %d", - check_msg->signed_messages[61]); - ck_assert_msg( - check_msg->signed_messages[62] == 143, - "incorrect value for signed_messages[62], expected 143, is %d", - check_msg->signed_messages[62]); - ck_assert_msg(check_msg->signed_messages[63] == 86, - "incorrect value for signed_messages[63], expected 86, is %d", - check_msg->signed_messages[63]); - ck_assert_msg( - check_msg->signed_messages[64] == 158, - "incorrect value for signed_messages[64], expected 158, is %d", - check_msg->signed_messages[64]); - ck_assert_msg(check_msg->signed_messages[65] == 20, - "incorrect value for signed_messages[65], expected 20, is %d", - check_msg->signed_messages[65]); - ck_assert_msg( - check_msg->signed_messages[66] == 168, - "incorrect value for signed_messages[66], expected 168, is %d", - check_msg->signed_messages[66]); - ck_assert_msg( - check_msg->signed_messages[67] == 132, - "incorrect value for signed_messages[67], expected 132, is %d", - check_msg->signed_messages[67]); - ck_assert_msg( - check_msg->signed_messages[68] == 141, - "incorrect value for signed_messages[68], expected 141, is %d", - check_msg->signed_messages[68]); - ck_assert_msg( - check_msg->signed_messages[69] == 102, - "incorrect value for signed_messages[69], expected 102, is %d", - check_msg->signed_messages[69]); - ck_assert_msg(check_msg->signed_messages[70] == 50, - "incorrect value for signed_messages[70], expected 50, is %d", - check_msg->signed_messages[70]); - ck_assert_msg(check_msg->signed_messages[71] == 48, - "incorrect value for signed_messages[71], expected 48, is %d", - check_msg->signed_messages[71]); - ck_assert_msg(check_msg->signed_messages[72] == 71, - "incorrect value for signed_messages[72], expected 71, is %d", - check_msg->signed_messages[72]); - ck_assert_msg( - check_msg->signed_messages[73] == 147, - "incorrect value for signed_messages[73], expected 147, is %d", - check_msg->signed_messages[73]); - ck_assert_msg(check_msg->signed_messages[74] == 53, - "incorrect value for signed_messages[74], expected 53, is %d", - check_msg->signed_messages[74]); - ck_assert_msg(check_msg->signed_messages[75] == 87, - "incorrect value for signed_messages[75], expected 87, is %d", - check_msg->signed_messages[75]); - ck_assert_msg(check_msg->signed_messages[76] == 1, - "incorrect value for signed_messages[76], expected 1, is %d", - check_msg->signed_messages[76]); - ck_assert_msg( - check_msg->signed_messages[77] == 108, - "incorrect value for signed_messages[77], expected 108, is %d", - check_msg->signed_messages[77]); - ck_assert_msg( - check_msg->signed_messages[78] == 138, - "incorrect value for signed_messages[78], expected 138, is %d", - check_msg->signed_messages[78]); - ck_assert_msg(check_msg->signed_messages[79] == 36, - "incorrect value for signed_messages[79], expected 36, is %d", - check_msg->signed_messages[79]); - ck_assert_msg( - check_msg->signed_messages[80] == 134, - "incorrect value for signed_messages[80], expected 134, is %d", - check_msg->signed_messages[80]); - ck_assert_msg( - check_msg->signed_messages[81] == 139, - "incorrect value for signed_messages[81], expected 139, is %d", - check_msg->signed_messages[81]); - ck_assert_msg( - check_msg->signed_messages[82] == 163, - "incorrect value for signed_messages[82], expected 163, is %d", - check_msg->signed_messages[82]); - ck_assert_msg(check_msg->signed_messages[83] == 82, - "incorrect value for signed_messages[83], expected 82, is %d", - check_msg->signed_messages[83]); - ck_assert_msg(check_msg->signed_messages[84] == 43, - "incorrect value for signed_messages[84], expected 43, is %d", - check_msg->signed_messages[84]); - ck_assert_msg(check_msg->signed_messages[85] == 52, - "incorrect value for signed_messages[85], expected 52, is %d", - check_msg->signed_messages[85]); - ck_assert_msg( - check_msg->signed_messages[86] == 150, - "incorrect value for signed_messages[86], expected 150, is %d", - check_msg->signed_messages[86]); - ck_assert_msg(check_msg->signed_messages[87] == 12, - "incorrect value for signed_messages[87], expected 12, is %d", - check_msg->signed_messages[87]); - ck_assert_msg(check_msg->signed_messages[88] == 30, - "incorrect value for signed_messages[88], expected 30, is %d", - check_msg->signed_messages[88]); - ck_assert_msg( - check_msg->signed_messages[89] == 110, - "incorrect value for signed_messages[89], expected 110, is %d", - check_msg->signed_messages[89]); - ck_assert_msg( - check_msg->signed_messages[90] == 156, - "incorrect value for signed_messages[90], expected 156, is %d", - check_msg->signed_messages[90]); - ck_assert_msg( - check_msg->signed_messages[91] == 107, - "incorrect value for signed_messages[91], expected 107, is %d", - check_msg->signed_messages[91]); - ck_assert_msg( - check_msg->signed_messages[92] == 120, - "incorrect value for signed_messages[92], expected 120, is %d", - check_msg->signed_messages[92]); - ck_assert_msg(check_msg->signed_messages[93] == 91, - "incorrect value for signed_messages[93], expected 91, is %d", - check_msg->signed_messages[93]); - ck_assert_msg( - check_msg->signed_messages[94] == 122, - "incorrect value for signed_messages[94], expected 122, is %d", - check_msg->signed_messages[94]); - ck_assert_msg(check_msg->signed_messages[95] == 69, - "incorrect value for signed_messages[95], expected 69, is %d", - check_msg->signed_messages[95]); - ck_assert_msg( - check_msg->signed_messages[96] == 164, - "incorrect value for signed_messages[96], expected 164, is %d", - check_msg->signed_messages[96]); - ck_assert_msg( - check_msg->signed_messages[97] == 170, - "incorrect value for signed_messages[97], expected 170, is %d", - check_msg->signed_messages[97]); - ck_assert_msg( - check_msg->signed_messages[98] == 116, - "incorrect value for signed_messages[98], expected 116, is %d", - check_msg->signed_messages[98]); - ck_assert_msg(check_msg->signed_messages[99] == 25, - "incorrect value for signed_messages[99], expected 25, is %d", - check_msg->signed_messages[99]); - ck_assert_msg( - check_msg->signed_messages[100] == 94, - "incorrect value for signed_messages[100], expected 94, is %d", - check_msg->signed_messages[100]); - ck_assert_msg(check_msg->signed_messages[101] == 5, - "incorrect value for signed_messages[101], expected 5, is %d", - check_msg->signed_messages[101]); - ck_assert_msg( - check_msg->signed_messages[102] == 22, - "incorrect value for signed_messages[102], expected 22, is %d", - check_msg->signed_messages[102]); - ck_assert_msg( - check_msg->signed_messages[103] == 24, - "incorrect value for signed_messages[103], expected 24, is %d", - check_msg->signed_messages[103]); - ck_assert_msg( - check_msg->signed_messages[104] == 162, - "incorrect value for signed_messages[104], expected 162, is %d", - check_msg->signed_messages[104]); - ck_assert_msg( - check_msg->signed_messages[105] == 175, - "incorrect value for signed_messages[105], expected 175, is %d", - check_msg->signed_messages[105]); - ck_assert_msg( - check_msg->signed_messages[106] == 38, - "incorrect value for signed_messages[106], expected 38, is %d", - check_msg->signed_messages[106]); - ck_assert_msg( - check_msg->signed_messages[107] == 157, - "incorrect value for signed_messages[107], expected 157, is %d", - check_msg->signed_messages[107]); - ck_assert_msg( - check_msg->signed_messages[108] == 98, - "incorrect value for signed_messages[108], expected 98, is %d", - check_msg->signed_messages[108]); - ck_assert_msg( - check_msg->signed_messages[109] == 44, - "incorrect value for signed_messages[109], expected 44, is %d", - check_msg->signed_messages[109]); - ck_assert_msg( - check_msg->signed_messages[110] == 160, - "incorrect value for signed_messages[110], expected 160, is %d", - check_msg->signed_messages[110]); - ck_assert_msg( - check_msg->signed_messages[111] == 47, - "incorrect value for signed_messages[111], expected 47, is %d", - check_msg->signed_messages[111]); - ck_assert_msg( - check_msg->signed_messages[112] == 97, - "incorrect value for signed_messages[112], expected 97, is %d", - check_msg->signed_messages[112]); - ck_assert_msg( - check_msg->signed_messages[113] == 142, - "incorrect value for signed_messages[113], expected 142, is %d", - check_msg->signed_messages[113]); - ck_assert_msg(check_msg->signed_messages[114] == 8, - "incorrect value for signed_messages[114], expected 8, is %d", - check_msg->signed_messages[114]); - ck_assert_msg( - check_msg->signed_messages[115] == 74, - "incorrect value for signed_messages[115], expected 74, is %d", - check_msg->signed_messages[115]); - ck_assert_msg( - check_msg->signed_messages[116] == 13, - "incorrect value for signed_messages[116], expected 13, is %d", - check_msg->signed_messages[116]); - ck_assert_msg( - check_msg->signed_messages[117] == 177, - "incorrect value for signed_messages[117], expected 177, is %d", - check_msg->signed_messages[117]); - ck_assert_msg( - check_msg->signed_messages[118] == 15, - "incorrect value for signed_messages[118], expected 15, is %d", - check_msg->signed_messages[118]); - ck_assert_msg( - check_msg->signed_messages[119] == 128, - "incorrect value for signed_messages[119], expected 128, is %d", - check_msg->signed_messages[119]); - ck_assert_msg( - check_msg->signed_messages[120] == 26, - "incorrect value for signed_messages[120], expected 26, is %d", - check_msg->signed_messages[120]); - ck_assert_msg( - check_msg->signed_messages[121] == 131, - "incorrect value for signed_messages[121], expected 131, is %d", - check_msg->signed_messages[121]); - ck_assert_msg( - check_msg->signed_messages[122] == 154, - "incorrect value for signed_messages[122], expected 154, is %d", - check_msg->signed_messages[122]); - ck_assert_msg( - check_msg->signed_messages[123] == 65, - "incorrect value for signed_messages[123], expected 65, is %d", - check_msg->signed_messages[123]); - ck_assert_msg( - check_msg->signed_messages[124] == 169, - "incorrect value for signed_messages[124], expected 169, is %d", - check_msg->signed_messages[124]); - ck_assert_msg( - check_msg->signed_messages[125] == 55, - "incorrect value for signed_messages[125], expected 55, is %d", - check_msg->signed_messages[125]); - ck_assert_msg( - check_msg->signed_messages[126] == 136, - "incorrect value for signed_messages[126], expected 136, is %d", - check_msg->signed_messages[126]); - ck_assert_msg( - check_msg->signed_messages[127] == 125, - "incorrect value for signed_messages[127], expected 125, is %d", - check_msg->signed_messages[127]); - ck_assert_msg( - check_msg->signed_messages[128] == 171, - "incorrect value for signed_messages[128], expected 171, is %d", - check_msg->signed_messages[128]); - ck_assert_msg( - check_msg->signed_messages[129] == 161, - "incorrect value for signed_messages[129], expected 161, is %d", - check_msg->signed_messages[129]); - ck_assert_msg( - check_msg->signed_messages[130] == 29, - "incorrect value for signed_messages[130], expected 29, is %d", - check_msg->signed_messages[130]); - ck_assert_msg( - check_msg->signed_messages[131] == 129, - "incorrect value for signed_messages[131], expected 129, is %d", - check_msg->signed_messages[131]); - ck_assert_msg( - check_msg->signed_messages[132] == 151, - "incorrect value for signed_messages[132], expected 151, is %d", - check_msg->signed_messages[132]); - ck_assert_msg( - check_msg->signed_messages[133] == 68, - "incorrect value for signed_messages[133], expected 68, is %d", - check_msg->signed_messages[133]); - ck_assert_msg( - check_msg->signed_messages[134] == 166, - "incorrect value for signed_messages[134], expected 166, is %d", - check_msg->signed_messages[134]); - ck_assert_msg( - check_msg->signed_messages[135] == 51, - "incorrect value for signed_messages[135], expected 51, is %d", - check_msg->signed_messages[135]); - ck_assert_msg( - check_msg->signed_messages[136] == 70, - "incorrect value for signed_messages[136], expected 70, is %d", - check_msg->signed_messages[136]); - ck_assert_msg( - check_msg->signed_messages[137] == 45, - "incorrect value for signed_messages[137], expected 45, is %d", - check_msg->signed_messages[137]); - ck_assert_msg( - check_msg->signed_messages[138] == 56, - "incorrect value for signed_messages[138], expected 56, is %d", - check_msg->signed_messages[138]); - ck_assert_msg( - check_msg->signed_messages[139] == 79, - "incorrect value for signed_messages[139], expected 79, is %d", - check_msg->signed_messages[139]); - ck_assert_msg( - check_msg->signed_messages[140] == 149, - "incorrect value for signed_messages[140], expected 149, is %d", - check_msg->signed_messages[140]); - ck_assert_msg( - check_msg->signed_messages[141] == 99, - "incorrect value for signed_messages[141], expected 99, is %d", - check_msg->signed_messages[141]); - ck_assert_msg( - check_msg->signed_messages[142] == 42, - "incorrect value for signed_messages[142], expected 42, is %d", - check_msg->signed_messages[142]); - ck_assert_msg( - check_msg->signed_messages[143] == 101, - "incorrect value for signed_messages[143], expected 101, is %d", - check_msg->signed_messages[143]); - ck_assert_msg( - check_msg->signed_messages[144] == 152, - "incorrect value for signed_messages[144], expected 152, is %d", - check_msg->signed_messages[144]); - ck_assert_msg( - check_msg->signed_messages[145] == 39, - "incorrect value for signed_messages[145], expected 39, is %d", - check_msg->signed_messages[145]); - ck_assert_msg( - check_msg->signed_messages[146] == 89, - "incorrect value for signed_messages[146], expected 89, is %d", - check_msg->signed_messages[146]); - ck_assert_msg( - check_msg->signed_messages[147] == 180, - "incorrect value for signed_messages[147], expected 180, is %d", - check_msg->signed_messages[147]); - ck_assert_msg( - check_msg->signed_messages[148] == 64, - "incorrect value for signed_messages[148], expected 64, is %d", - check_msg->signed_messages[148]); - ck_assert_msg( - check_msg->signed_messages[149] == 49, - "incorrect value for signed_messages[149], expected 49, is %d", - check_msg->signed_messages[149]); - ck_assert_msg(check_msg->signed_messages[150] == 6, - "incorrect value for signed_messages[150], expected 6, is %d", - check_msg->signed_messages[150]); - ck_assert_msg( - check_msg->signed_messages[151] == 80, - "incorrect value for signed_messages[151], expected 80, is %d", - check_msg->signed_messages[151]); - ck_assert_msg( - check_msg->signed_messages[152] == 172, - "incorrect value for signed_messages[152], expected 172, is %d", - check_msg->signed_messages[152]); - ck_assert_msg( - check_msg->signed_messages[153] == 32, - "incorrect value for signed_messages[153], expected 32, is %d", - check_msg->signed_messages[153]); - ck_assert_msg( - check_msg->signed_messages[154] == 109, - "incorrect value for signed_messages[154], expected 109, is %d", - check_msg->signed_messages[154]); - ck_assert_msg(check_msg->signed_messages[155] == 2, - "incorrect value for signed_messages[155], expected 2, is %d", - check_msg->signed_messages[155]); - ck_assert_msg( - check_msg->signed_messages[156] == 119, - "incorrect value for signed_messages[156], expected 119, is %d", - check_msg->signed_messages[156]); - ck_assert_msg( - check_msg->signed_messages[157] == 93, - "incorrect value for signed_messages[157], expected 93, is %d", - check_msg->signed_messages[157]); - ck_assert_msg( - check_msg->signed_messages[158] == 176, - "incorrect value for signed_messages[158], expected 176, is %d", - check_msg->signed_messages[158]); - ck_assert_msg(check_msg->signed_messages[159] == 0, - "incorrect value for signed_messages[159], expected 0, is %d", - check_msg->signed_messages[159]); - ck_assert_msg( - check_msg->signed_messages[160] == 33, - "incorrect value for signed_messages[160], expected 33, is %d", - check_msg->signed_messages[160]); - ck_assert_msg( - check_msg->signed_messages[161] == 57, - "incorrect value for signed_messages[161], expected 57, is %d", - check_msg->signed_messages[161]); - ck_assert_msg( - check_msg->signed_messages[162] == 34, - "incorrect value for signed_messages[162], expected 34, is %d", - check_msg->signed_messages[162]); - ck_assert_msg( - check_msg->signed_messages[163] == 18, - "incorrect value for signed_messages[163], expected 18, is %d", - check_msg->signed_messages[163]); - ck_assert_msg( - check_msg->signed_messages[164] == 85, - "incorrect value for signed_messages[164], expected 85, is %d", - check_msg->signed_messages[164]); - ck_assert_msg( - check_msg->signed_messages[165] == 121, - "incorrect value for signed_messages[165], expected 121, is %d", - check_msg->signed_messages[165]); - ck_assert_msg( - check_msg->signed_messages[166] == 137, - "incorrect value for signed_messages[166], expected 137, is %d", - check_msg->signed_messages[166]); - ck_assert_msg( - check_msg->signed_messages[167] == 83, - "incorrect value for signed_messages[167], expected 83, is %d", - check_msg->signed_messages[167]); - ck_assert_msg( - check_msg->signed_messages[168] == 111, - "incorrect value for signed_messages[168], expected 111, is %d", - check_msg->signed_messages[168]); - ck_assert_msg( - check_msg->signed_messages[169] == 59, - "incorrect value for signed_messages[169], expected 59, is %d", - check_msg->signed_messages[169]); - ck_assert_msg(check_msg->signed_messages[170] == 7, - "incorrect value for signed_messages[170], expected 7, is %d", - check_msg->signed_messages[170]); - ck_assert_msg( - check_msg->signed_messages[171] == 77, - "incorrect value for signed_messages[171], expected 77, is %d", - check_msg->signed_messages[171]); - ck_assert_msg(check_msg->signed_messages[172] == 4, - "incorrect value for signed_messages[172], expected 4, is %d", - check_msg->signed_messages[172]); - ck_assert_msg( - check_msg->signed_messages[173] == 117, - "incorrect value for signed_messages[173], expected 117, is %d", - check_msg->signed_messages[173]); - ck_assert_msg( - check_msg->signed_messages[174] == 159, - "incorrect value for signed_messages[174], expected 159, is %d", - check_msg->signed_messages[174]); - ck_assert_msg( - check_msg->signed_messages[175] == 148, - "incorrect value for signed_messages[175], expected 148, is %d", - check_msg->signed_messages[175]); - ck_assert_msg( - check_msg->signed_messages[176] == 35, - "incorrect value for signed_messages[176], expected 35, is %d", - check_msg->signed_messages[176]); - ck_assert_msg( - check_msg->signed_messages[177] == 61, - "incorrect value for signed_messages[177], expected 61, is %d", - check_msg->signed_messages[177]); - ck_assert_msg( - check_msg->signed_messages[178] == 41, - "incorrect value for signed_messages[178], expected 41, is %d", - check_msg->signed_messages[178]); - ck_assert_msg( - check_msg->signed_messages[179] == 67, - "incorrect value for signed_messages[179], expected 67, is %d", - check_msg->signed_messages[179]); - ck_assert_msg( - check_msg->signed_messages[180] == 46, - "incorrect value for signed_messages[180], expected 46, is %d", - check_msg->signed_messages[180]); - ck_assert_msg( - check_msg->signed_messages[181] == 127, - "incorrect value for signed_messages[181], expected 127, is %d", - check_msg->signed_messages[181]); - ck_assert_msg( - check_msg->signed_messages[182] == 75, - "incorrect value for signed_messages[182], expected 75, is %d", - check_msg->signed_messages[182]); - ck_assert_msg( - check_msg->signed_messages[183] == 174, - "incorrect value for signed_messages[183], expected 174, is %d", - check_msg->signed_messages[183]); - ck_assert_msg(check_msg->stream_counter == 1, - "incorrect value for stream_counter, expected 1, is %d", - check_msg->stream_counter); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_signing_MsgEcdsaSignatureDepB.c b/c/test/legacy/auto_check_sbp_signing_MsgEcdsaSignatureDepB.c deleted file mode 100644 index c1f37de209..0000000000 --- a/c/test/legacy/auto_check_sbp_signing_MsgEcdsaSignatureDepB.c +++ /dev/null @@ -1,868 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgEcdsaSignatureDepB.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepB) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xC07, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xC07, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 7, 12, 66, 0, 83, 0, 1, 2, 1, 2, 3, 4, 72, 0, 1, - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 10, 21, 23, 254, 159, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ecdsa_signature_dep_b_t *test_msg = - (msg_ecdsa_signature_dep_b_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_id[0]); - } - test_msg->certificate_id[0] = 1; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_id[0]); - } - test_msg->certificate_id[1] = 2; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_id[0]); - } - test_msg->certificate_id[2] = 3; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_id[0]); - } - test_msg->certificate_id[3] = 4; - test_msg->flags = 0; - test_msg->n_signature_bytes = 72; - test_msg->on_demand_counter = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[0] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[1] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[2] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[3] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[4] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[5] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[6] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[7] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[8] = 8; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[9] = 9; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[10] = 10; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[11] = 11; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[12] = 12; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[13] = 13; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[14] = 14; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[15] = 15; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[16] = 16; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[17] = 17; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[18] = 18; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[19] = 19; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[20] = 20; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[21] = 21; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[22] = 22; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[23] = 23; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[24] = 24; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[25] = 25; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[26] = 26; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[27] = 27; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[28] = 28; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[29] = 29; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[30] = 30; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[31] = 31; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[32] = 32; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[33] = 33; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[34] = 34; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[35] = 35; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[36] = 36; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[37] = 37; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[38] = 38; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[39] = 39; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[40] = 40; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[41] = 41; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[42] = 42; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[43] = 43; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[44] = 44; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[45] = 45; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[46] = 46; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[47] = 47; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[48] = 48; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[49] = 49; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[50] = 50; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[51] = 51; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[52] = 52; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[53] = 53; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[54] = 54; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[55] = 55; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[56] = 56; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[57] = 57; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[58] = 58; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[59] = 59; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[60] = 60; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[61] = 61; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[62] = 62; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[63] = 63; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[64] = 64; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[65] = 65; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[66] = 66; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[67] = 67; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[68] = 68; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[69] = 69; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[70] = 70; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[71] = 71; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[0] = 10; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[1] = 21; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[2] = 23; - test_msg->stream_counter = 1; - sbp_payload_send(&sbp_state, 0xC07, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xC07, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ecdsa_signature_dep_b_t *check_msg = - (msg_ecdsa_signature_dep_b_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->certificate_id[0] == 1, - "incorrect value for certificate_id[0], expected 1, is %d", - check_msg->certificate_id[0]); - ck_assert_msg(check_msg->certificate_id[1] == 2, - "incorrect value for certificate_id[1], expected 2, is %d", - check_msg->certificate_id[1]); - ck_assert_msg(check_msg->certificate_id[2] == 3, - "incorrect value for certificate_id[2], expected 3, is %d", - check_msg->certificate_id[2]); - ck_assert_msg(check_msg->certificate_id[3] == 4, - "incorrect value for certificate_id[3], expected 4, is %d", - check_msg->certificate_id[3]); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_signature_bytes == 72, - "incorrect value for n_signature_bytes, expected 72, is %d", - check_msg->n_signature_bytes); - ck_assert_msg(check_msg->on_demand_counter == 2, - "incorrect value for on_demand_counter, expected 2, is %d", - check_msg->on_demand_counter); - ck_assert_msg(check_msg->signature[0] == 0, - "incorrect value for signature[0], expected 0, is %d", - check_msg->signature[0]); - ck_assert_msg(check_msg->signature[1] == 1, - "incorrect value for signature[1], expected 1, is %d", - check_msg->signature[1]); - ck_assert_msg(check_msg->signature[2] == 2, - "incorrect value for signature[2], expected 2, is %d", - check_msg->signature[2]); - ck_assert_msg(check_msg->signature[3] == 3, - "incorrect value for signature[3], expected 3, is %d", - check_msg->signature[3]); - ck_assert_msg(check_msg->signature[4] == 4, - "incorrect value for signature[4], expected 4, is %d", - check_msg->signature[4]); - ck_assert_msg(check_msg->signature[5] == 5, - "incorrect value for signature[5], expected 5, is %d", - check_msg->signature[5]); - ck_assert_msg(check_msg->signature[6] == 6, - "incorrect value for signature[6], expected 6, is %d", - check_msg->signature[6]); - ck_assert_msg(check_msg->signature[7] == 7, - "incorrect value for signature[7], expected 7, is %d", - check_msg->signature[7]); - ck_assert_msg(check_msg->signature[8] == 8, - "incorrect value for signature[8], expected 8, is %d", - check_msg->signature[8]); - ck_assert_msg(check_msg->signature[9] == 9, - "incorrect value for signature[9], expected 9, is %d", - check_msg->signature[9]); - ck_assert_msg(check_msg->signature[10] == 10, - "incorrect value for signature[10], expected 10, is %d", - check_msg->signature[10]); - ck_assert_msg(check_msg->signature[11] == 11, - "incorrect value for signature[11], expected 11, is %d", - check_msg->signature[11]); - ck_assert_msg(check_msg->signature[12] == 12, - "incorrect value for signature[12], expected 12, is %d", - check_msg->signature[12]); - ck_assert_msg(check_msg->signature[13] == 13, - "incorrect value for signature[13], expected 13, is %d", - check_msg->signature[13]); - ck_assert_msg(check_msg->signature[14] == 14, - "incorrect value for signature[14], expected 14, is %d", - check_msg->signature[14]); - ck_assert_msg(check_msg->signature[15] == 15, - "incorrect value for signature[15], expected 15, is %d", - check_msg->signature[15]); - ck_assert_msg(check_msg->signature[16] == 16, - "incorrect value for signature[16], expected 16, is %d", - check_msg->signature[16]); - ck_assert_msg(check_msg->signature[17] == 17, - "incorrect value for signature[17], expected 17, is %d", - check_msg->signature[17]); - ck_assert_msg(check_msg->signature[18] == 18, - "incorrect value for signature[18], expected 18, is %d", - check_msg->signature[18]); - ck_assert_msg(check_msg->signature[19] == 19, - "incorrect value for signature[19], expected 19, is %d", - check_msg->signature[19]); - ck_assert_msg(check_msg->signature[20] == 20, - "incorrect value for signature[20], expected 20, is %d", - check_msg->signature[20]); - ck_assert_msg(check_msg->signature[21] == 21, - "incorrect value for signature[21], expected 21, is %d", - check_msg->signature[21]); - ck_assert_msg(check_msg->signature[22] == 22, - "incorrect value for signature[22], expected 22, is %d", - check_msg->signature[22]); - ck_assert_msg(check_msg->signature[23] == 23, - "incorrect value for signature[23], expected 23, is %d", - check_msg->signature[23]); - ck_assert_msg(check_msg->signature[24] == 24, - "incorrect value for signature[24], expected 24, is %d", - check_msg->signature[24]); - ck_assert_msg(check_msg->signature[25] == 25, - "incorrect value for signature[25], expected 25, is %d", - check_msg->signature[25]); - ck_assert_msg(check_msg->signature[26] == 26, - "incorrect value for signature[26], expected 26, is %d", - check_msg->signature[26]); - ck_assert_msg(check_msg->signature[27] == 27, - "incorrect value for signature[27], expected 27, is %d", - check_msg->signature[27]); - ck_assert_msg(check_msg->signature[28] == 28, - "incorrect value for signature[28], expected 28, is %d", - check_msg->signature[28]); - ck_assert_msg(check_msg->signature[29] == 29, - "incorrect value for signature[29], expected 29, is %d", - check_msg->signature[29]); - ck_assert_msg(check_msg->signature[30] == 30, - "incorrect value for signature[30], expected 30, is %d", - check_msg->signature[30]); - ck_assert_msg(check_msg->signature[31] == 31, - "incorrect value for signature[31], expected 31, is %d", - check_msg->signature[31]); - ck_assert_msg(check_msg->signature[32] == 32, - "incorrect value for signature[32], expected 32, is %d", - check_msg->signature[32]); - ck_assert_msg(check_msg->signature[33] == 33, - "incorrect value for signature[33], expected 33, is %d", - check_msg->signature[33]); - ck_assert_msg(check_msg->signature[34] == 34, - "incorrect value for signature[34], expected 34, is %d", - check_msg->signature[34]); - ck_assert_msg(check_msg->signature[35] == 35, - "incorrect value for signature[35], expected 35, is %d", - check_msg->signature[35]); - ck_assert_msg(check_msg->signature[36] == 36, - "incorrect value for signature[36], expected 36, is %d", - check_msg->signature[36]); - ck_assert_msg(check_msg->signature[37] == 37, - "incorrect value for signature[37], expected 37, is %d", - check_msg->signature[37]); - ck_assert_msg(check_msg->signature[38] == 38, - "incorrect value for signature[38], expected 38, is %d", - check_msg->signature[38]); - ck_assert_msg(check_msg->signature[39] == 39, - "incorrect value for signature[39], expected 39, is %d", - check_msg->signature[39]); - ck_assert_msg(check_msg->signature[40] == 40, - "incorrect value for signature[40], expected 40, is %d", - check_msg->signature[40]); - ck_assert_msg(check_msg->signature[41] == 41, - "incorrect value for signature[41], expected 41, is %d", - check_msg->signature[41]); - ck_assert_msg(check_msg->signature[42] == 42, - "incorrect value for signature[42], expected 42, is %d", - check_msg->signature[42]); - ck_assert_msg(check_msg->signature[43] == 43, - "incorrect value for signature[43], expected 43, is %d", - check_msg->signature[43]); - ck_assert_msg(check_msg->signature[44] == 44, - "incorrect value for signature[44], expected 44, is %d", - check_msg->signature[44]); - ck_assert_msg(check_msg->signature[45] == 45, - "incorrect value for signature[45], expected 45, is %d", - check_msg->signature[45]); - ck_assert_msg(check_msg->signature[46] == 46, - "incorrect value for signature[46], expected 46, is %d", - check_msg->signature[46]); - ck_assert_msg(check_msg->signature[47] == 47, - "incorrect value for signature[47], expected 47, is %d", - check_msg->signature[47]); - ck_assert_msg(check_msg->signature[48] == 48, - "incorrect value for signature[48], expected 48, is %d", - check_msg->signature[48]); - ck_assert_msg(check_msg->signature[49] == 49, - "incorrect value for signature[49], expected 49, is %d", - check_msg->signature[49]); - ck_assert_msg(check_msg->signature[50] == 50, - "incorrect value for signature[50], expected 50, is %d", - check_msg->signature[50]); - ck_assert_msg(check_msg->signature[51] == 51, - "incorrect value for signature[51], expected 51, is %d", - check_msg->signature[51]); - ck_assert_msg(check_msg->signature[52] == 52, - "incorrect value for signature[52], expected 52, is %d", - check_msg->signature[52]); - ck_assert_msg(check_msg->signature[53] == 53, - "incorrect value for signature[53], expected 53, is %d", - check_msg->signature[53]); - ck_assert_msg(check_msg->signature[54] == 54, - "incorrect value for signature[54], expected 54, is %d", - check_msg->signature[54]); - ck_assert_msg(check_msg->signature[55] == 55, - "incorrect value for signature[55], expected 55, is %d", - check_msg->signature[55]); - ck_assert_msg(check_msg->signature[56] == 56, - "incorrect value for signature[56], expected 56, is %d", - check_msg->signature[56]); - ck_assert_msg(check_msg->signature[57] == 57, - "incorrect value for signature[57], expected 57, is %d", - check_msg->signature[57]); - ck_assert_msg(check_msg->signature[58] == 58, - "incorrect value for signature[58], expected 58, is %d", - check_msg->signature[58]); - ck_assert_msg(check_msg->signature[59] == 59, - "incorrect value for signature[59], expected 59, is %d", - check_msg->signature[59]); - ck_assert_msg(check_msg->signature[60] == 60, - "incorrect value for signature[60], expected 60, is %d", - check_msg->signature[60]); - ck_assert_msg(check_msg->signature[61] == 61, - "incorrect value for signature[61], expected 61, is %d", - check_msg->signature[61]); - ck_assert_msg(check_msg->signature[62] == 62, - "incorrect value for signature[62], expected 62, is %d", - check_msg->signature[62]); - ck_assert_msg(check_msg->signature[63] == 63, - "incorrect value for signature[63], expected 63, is %d", - check_msg->signature[63]); - ck_assert_msg(check_msg->signature[64] == 64, - "incorrect value for signature[64], expected 64, is %d", - check_msg->signature[64]); - ck_assert_msg(check_msg->signature[65] == 65, - "incorrect value for signature[65], expected 65, is %d", - check_msg->signature[65]); - ck_assert_msg(check_msg->signature[66] == 66, - "incorrect value for signature[66], expected 66, is %d", - check_msg->signature[66]); - ck_assert_msg(check_msg->signature[67] == 67, - "incorrect value for signature[67], expected 67, is %d", - check_msg->signature[67]); - ck_assert_msg(check_msg->signature[68] == 68, - "incorrect value for signature[68], expected 68, is %d", - check_msg->signature[68]); - ck_assert_msg(check_msg->signature[69] == 69, - "incorrect value for signature[69], expected 69, is %d", - check_msg->signature[69]); - ck_assert_msg(check_msg->signature[70] == 70, - "incorrect value for signature[70], expected 70, is %d", - check_msg->signature[70]); - ck_assert_msg(check_msg->signature[71] == 71, - "incorrect value for signature[71], expected 71, is %d", - check_msg->signature[71]); - ck_assert_msg(check_msg->signed_messages[0] == 10, - "incorrect value for signed_messages[0], expected 10, is %d", - check_msg->signed_messages[0]); - ck_assert_msg(check_msg->signed_messages[1] == 21, - "incorrect value for signed_messages[1], expected 21, is %d", - check_msg->signed_messages[1]); - ck_assert_msg(check_msg->signed_messages[2] == 23, - "incorrect value for signed_messages[2], expected 23, is %d", - check_msg->signed_messages[2]); - ck_assert_msg(check_msg->stream_counter == 1, - "incorrect value for stream_counter, expected 1, is %d", - check_msg->stream_counter); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepB_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepB"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepB"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepB); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_signing_MsgEd25519CertificateDep.c b/c/test/legacy/auto_check_sbp_signing_MsgEd25519CertificateDep.c deleted file mode 100644 index 1e1e916650..0000000000 --- a/c/test/legacy/auto_check_sbp_signing_MsgEd25519CertificateDep.c +++ /dev/null @@ -1,1148 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgEd25519CertificateDep.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_signing_MsgEd25519CertificateDep) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xC02, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xC02, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 12, 66, 0, 106, 16, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, - 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, - 75, 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, - 114, 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, 150, - 153, 156, 159, 162, 165, 168, 171, 174, 177, 180, 183, 186, 189, - 192, 195, 198, 201, 204, 207, 210, 213, 216, 219, 222, 225, 228, - 231, 234, 237, 240, 243, 246, 249, 252, 218, 148, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ed25519_certificate_dep_t *test_msg = - (msg_ed25519_certificate_dep_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[0] = 0; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[1] = 3; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[2] = 6; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[3] = 9; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[4] = 12; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[5] = 15; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[6] = 18; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[7] = 21; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[8] = 24; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[9] = 27; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[10] = 30; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[11] = 33; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[12] = 36; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[13] = 39; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[14] = 42; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[15] = 45; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[16] = 48; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[17] = 51; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[18] = 54; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[19] = 57; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[20] = 60; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[21] = 63; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[22] = 66; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[23] = 69; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[24] = 72; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[25] = 75; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[26] = 78; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[27] = 81; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[28] = 84; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[29] = 87; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[30] = 90; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[31] = 93; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[32] = 96; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[33] = 99; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[34] = 102; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[35] = 105; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[36] = 108; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[37] = 111; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[38] = 114; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[39] = 117; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[40] = 120; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[41] = 123; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[42] = 126; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[43] = 129; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[44] = 132; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[45] = 135; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[46] = 138; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[47] = 141; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[48] = 144; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[49] = 147; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[50] = 150; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[51] = 153; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[52] = 156; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[53] = 159; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[54] = 162; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[55] = 165; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[56] = 168; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[57] = 171; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[58] = 174; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[59] = 177; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[60] = 180; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[61] = 183; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[62] = 186; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[63] = 189; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[64] = 192; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[65] = 195; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[66] = 198; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[67] = 201; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[68] = 204; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[69] = 207; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[70] = 210; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[71] = 213; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[72] = 216; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[73] = 219; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[74] = 222; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[75] = 225; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[76] = 228; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[77] = 231; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[78] = 234; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[79] = 237; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[80] = 240; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[81] = 243; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[82] = 246; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[83] = 249; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->certificate_bytes[0]); - } - test_msg->certificate_bytes[84] = 252; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[0] = 100; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[1] = 101; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[2] = 102; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[3] = 103; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[4] = 104; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[5] = 105; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[6] = 106; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[7] = 107; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[8] = 108; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[9] = 109; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[10] = 110; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[11] = 111; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[12] = 112; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[13] = 113; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[14] = 114; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[15] = 115; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[16] = 116; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[17] = 117; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[18] = 118; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[19] = 119; - test_msg->n_msg = 16; - sbp_payload_send(&sbp_state, 0xC02, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xC02, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ed25519_certificate_dep_t *check_msg = - (msg_ed25519_certificate_dep_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->certificate_bytes[0] == 0, - "incorrect value for certificate_bytes[0], expected 0, is %d", - check_msg->certificate_bytes[0]); - ck_assert_msg(check_msg->certificate_bytes[1] == 3, - "incorrect value for certificate_bytes[1], expected 3, is %d", - check_msg->certificate_bytes[1]); - ck_assert_msg(check_msg->certificate_bytes[2] == 6, - "incorrect value for certificate_bytes[2], expected 6, is %d", - check_msg->certificate_bytes[2]); - ck_assert_msg(check_msg->certificate_bytes[3] == 9, - "incorrect value for certificate_bytes[3], expected 9, is %d", - check_msg->certificate_bytes[3]); - ck_assert_msg( - check_msg->certificate_bytes[4] == 12, - "incorrect value for certificate_bytes[4], expected 12, is %d", - check_msg->certificate_bytes[4]); - ck_assert_msg( - check_msg->certificate_bytes[5] == 15, - "incorrect value for certificate_bytes[5], expected 15, is %d", - check_msg->certificate_bytes[5]); - ck_assert_msg( - check_msg->certificate_bytes[6] == 18, - "incorrect value for certificate_bytes[6], expected 18, is %d", - check_msg->certificate_bytes[6]); - ck_assert_msg( - check_msg->certificate_bytes[7] == 21, - "incorrect value for certificate_bytes[7], expected 21, is %d", - check_msg->certificate_bytes[7]); - ck_assert_msg( - check_msg->certificate_bytes[8] == 24, - "incorrect value for certificate_bytes[8], expected 24, is %d", - check_msg->certificate_bytes[8]); - ck_assert_msg( - check_msg->certificate_bytes[9] == 27, - "incorrect value for certificate_bytes[9], expected 27, is %d", - check_msg->certificate_bytes[9]); - ck_assert_msg( - check_msg->certificate_bytes[10] == 30, - "incorrect value for certificate_bytes[10], expected 30, is %d", - check_msg->certificate_bytes[10]); - ck_assert_msg( - check_msg->certificate_bytes[11] == 33, - "incorrect value for certificate_bytes[11], expected 33, is %d", - check_msg->certificate_bytes[11]); - ck_assert_msg( - check_msg->certificate_bytes[12] == 36, - "incorrect value for certificate_bytes[12], expected 36, is %d", - check_msg->certificate_bytes[12]); - ck_assert_msg( - check_msg->certificate_bytes[13] == 39, - "incorrect value for certificate_bytes[13], expected 39, is %d", - check_msg->certificate_bytes[13]); - ck_assert_msg( - check_msg->certificate_bytes[14] == 42, - "incorrect value for certificate_bytes[14], expected 42, is %d", - check_msg->certificate_bytes[14]); - ck_assert_msg( - check_msg->certificate_bytes[15] == 45, - "incorrect value for certificate_bytes[15], expected 45, is %d", - check_msg->certificate_bytes[15]); - ck_assert_msg( - check_msg->certificate_bytes[16] == 48, - "incorrect value for certificate_bytes[16], expected 48, is %d", - check_msg->certificate_bytes[16]); - ck_assert_msg( - check_msg->certificate_bytes[17] == 51, - "incorrect value for certificate_bytes[17], expected 51, is %d", - check_msg->certificate_bytes[17]); - ck_assert_msg( - check_msg->certificate_bytes[18] == 54, - "incorrect value for certificate_bytes[18], expected 54, is %d", - check_msg->certificate_bytes[18]); - ck_assert_msg( - check_msg->certificate_bytes[19] == 57, - "incorrect value for certificate_bytes[19], expected 57, is %d", - check_msg->certificate_bytes[19]); - ck_assert_msg( - check_msg->certificate_bytes[20] == 60, - "incorrect value for certificate_bytes[20], expected 60, is %d", - check_msg->certificate_bytes[20]); - ck_assert_msg( - check_msg->certificate_bytes[21] == 63, - "incorrect value for certificate_bytes[21], expected 63, is %d", - check_msg->certificate_bytes[21]); - ck_assert_msg( - check_msg->certificate_bytes[22] == 66, - "incorrect value for certificate_bytes[22], expected 66, is %d", - check_msg->certificate_bytes[22]); - ck_assert_msg( - check_msg->certificate_bytes[23] == 69, - "incorrect value for certificate_bytes[23], expected 69, is %d", - check_msg->certificate_bytes[23]); - ck_assert_msg( - check_msg->certificate_bytes[24] == 72, - "incorrect value for certificate_bytes[24], expected 72, is %d", - check_msg->certificate_bytes[24]); - ck_assert_msg( - check_msg->certificate_bytes[25] == 75, - "incorrect value for certificate_bytes[25], expected 75, is %d", - check_msg->certificate_bytes[25]); - ck_assert_msg( - check_msg->certificate_bytes[26] == 78, - "incorrect value for certificate_bytes[26], expected 78, is %d", - check_msg->certificate_bytes[26]); - ck_assert_msg( - check_msg->certificate_bytes[27] == 81, - "incorrect value for certificate_bytes[27], expected 81, is %d", - check_msg->certificate_bytes[27]); - ck_assert_msg( - check_msg->certificate_bytes[28] == 84, - "incorrect value for certificate_bytes[28], expected 84, is %d", - check_msg->certificate_bytes[28]); - ck_assert_msg( - check_msg->certificate_bytes[29] == 87, - "incorrect value for certificate_bytes[29], expected 87, is %d", - check_msg->certificate_bytes[29]); - ck_assert_msg( - check_msg->certificate_bytes[30] == 90, - "incorrect value for certificate_bytes[30], expected 90, is %d", - check_msg->certificate_bytes[30]); - ck_assert_msg( - check_msg->certificate_bytes[31] == 93, - "incorrect value for certificate_bytes[31], expected 93, is %d", - check_msg->certificate_bytes[31]); - ck_assert_msg( - check_msg->certificate_bytes[32] == 96, - "incorrect value for certificate_bytes[32], expected 96, is %d", - check_msg->certificate_bytes[32]); - ck_assert_msg( - check_msg->certificate_bytes[33] == 99, - "incorrect value for certificate_bytes[33], expected 99, is %d", - check_msg->certificate_bytes[33]); - ck_assert_msg( - check_msg->certificate_bytes[34] == 102, - "incorrect value for certificate_bytes[34], expected 102, is %d", - check_msg->certificate_bytes[34]); - ck_assert_msg( - check_msg->certificate_bytes[35] == 105, - "incorrect value for certificate_bytes[35], expected 105, is %d", - check_msg->certificate_bytes[35]); - ck_assert_msg( - check_msg->certificate_bytes[36] == 108, - "incorrect value for certificate_bytes[36], expected 108, is %d", - check_msg->certificate_bytes[36]); - ck_assert_msg( - check_msg->certificate_bytes[37] == 111, - "incorrect value for certificate_bytes[37], expected 111, is %d", - check_msg->certificate_bytes[37]); - ck_assert_msg( - check_msg->certificate_bytes[38] == 114, - "incorrect value for certificate_bytes[38], expected 114, is %d", - check_msg->certificate_bytes[38]); - ck_assert_msg( - check_msg->certificate_bytes[39] == 117, - "incorrect value for certificate_bytes[39], expected 117, is %d", - check_msg->certificate_bytes[39]); - ck_assert_msg( - check_msg->certificate_bytes[40] == 120, - "incorrect value for certificate_bytes[40], expected 120, is %d", - check_msg->certificate_bytes[40]); - ck_assert_msg( - check_msg->certificate_bytes[41] == 123, - "incorrect value for certificate_bytes[41], expected 123, is %d", - check_msg->certificate_bytes[41]); - ck_assert_msg( - check_msg->certificate_bytes[42] == 126, - "incorrect value for certificate_bytes[42], expected 126, is %d", - check_msg->certificate_bytes[42]); - ck_assert_msg( - check_msg->certificate_bytes[43] == 129, - "incorrect value for certificate_bytes[43], expected 129, is %d", - check_msg->certificate_bytes[43]); - ck_assert_msg( - check_msg->certificate_bytes[44] == 132, - "incorrect value for certificate_bytes[44], expected 132, is %d", - check_msg->certificate_bytes[44]); - ck_assert_msg( - check_msg->certificate_bytes[45] == 135, - "incorrect value for certificate_bytes[45], expected 135, is %d", - check_msg->certificate_bytes[45]); - ck_assert_msg( - check_msg->certificate_bytes[46] == 138, - "incorrect value for certificate_bytes[46], expected 138, is %d", - check_msg->certificate_bytes[46]); - ck_assert_msg( - check_msg->certificate_bytes[47] == 141, - "incorrect value for certificate_bytes[47], expected 141, is %d", - check_msg->certificate_bytes[47]); - ck_assert_msg( - check_msg->certificate_bytes[48] == 144, - "incorrect value for certificate_bytes[48], expected 144, is %d", - check_msg->certificate_bytes[48]); - ck_assert_msg( - check_msg->certificate_bytes[49] == 147, - "incorrect value for certificate_bytes[49], expected 147, is %d", - check_msg->certificate_bytes[49]); - ck_assert_msg( - check_msg->certificate_bytes[50] == 150, - "incorrect value for certificate_bytes[50], expected 150, is %d", - check_msg->certificate_bytes[50]); - ck_assert_msg( - check_msg->certificate_bytes[51] == 153, - "incorrect value for certificate_bytes[51], expected 153, is %d", - check_msg->certificate_bytes[51]); - ck_assert_msg( - check_msg->certificate_bytes[52] == 156, - "incorrect value for certificate_bytes[52], expected 156, is %d", - check_msg->certificate_bytes[52]); - ck_assert_msg( - check_msg->certificate_bytes[53] == 159, - "incorrect value for certificate_bytes[53], expected 159, is %d", - check_msg->certificate_bytes[53]); - ck_assert_msg( - check_msg->certificate_bytes[54] == 162, - "incorrect value for certificate_bytes[54], expected 162, is %d", - check_msg->certificate_bytes[54]); - ck_assert_msg( - check_msg->certificate_bytes[55] == 165, - "incorrect value for certificate_bytes[55], expected 165, is %d", - check_msg->certificate_bytes[55]); - ck_assert_msg( - check_msg->certificate_bytes[56] == 168, - "incorrect value for certificate_bytes[56], expected 168, is %d", - check_msg->certificate_bytes[56]); - ck_assert_msg( - check_msg->certificate_bytes[57] == 171, - "incorrect value for certificate_bytes[57], expected 171, is %d", - check_msg->certificate_bytes[57]); - ck_assert_msg( - check_msg->certificate_bytes[58] == 174, - "incorrect value for certificate_bytes[58], expected 174, is %d", - check_msg->certificate_bytes[58]); - ck_assert_msg( - check_msg->certificate_bytes[59] == 177, - "incorrect value for certificate_bytes[59], expected 177, is %d", - check_msg->certificate_bytes[59]); - ck_assert_msg( - check_msg->certificate_bytes[60] == 180, - "incorrect value for certificate_bytes[60], expected 180, is %d", - check_msg->certificate_bytes[60]); - ck_assert_msg( - check_msg->certificate_bytes[61] == 183, - "incorrect value for certificate_bytes[61], expected 183, is %d", - check_msg->certificate_bytes[61]); - ck_assert_msg( - check_msg->certificate_bytes[62] == 186, - "incorrect value for certificate_bytes[62], expected 186, is %d", - check_msg->certificate_bytes[62]); - ck_assert_msg( - check_msg->certificate_bytes[63] == 189, - "incorrect value for certificate_bytes[63], expected 189, is %d", - check_msg->certificate_bytes[63]); - ck_assert_msg( - check_msg->certificate_bytes[64] == 192, - "incorrect value for certificate_bytes[64], expected 192, is %d", - check_msg->certificate_bytes[64]); - ck_assert_msg( - check_msg->certificate_bytes[65] == 195, - "incorrect value for certificate_bytes[65], expected 195, is %d", - check_msg->certificate_bytes[65]); - ck_assert_msg( - check_msg->certificate_bytes[66] == 198, - "incorrect value for certificate_bytes[66], expected 198, is %d", - check_msg->certificate_bytes[66]); - ck_assert_msg( - check_msg->certificate_bytes[67] == 201, - "incorrect value for certificate_bytes[67], expected 201, is %d", - check_msg->certificate_bytes[67]); - ck_assert_msg( - check_msg->certificate_bytes[68] == 204, - "incorrect value for certificate_bytes[68], expected 204, is %d", - check_msg->certificate_bytes[68]); - ck_assert_msg( - check_msg->certificate_bytes[69] == 207, - "incorrect value for certificate_bytes[69], expected 207, is %d", - check_msg->certificate_bytes[69]); - ck_assert_msg( - check_msg->certificate_bytes[70] == 210, - "incorrect value for certificate_bytes[70], expected 210, is %d", - check_msg->certificate_bytes[70]); - ck_assert_msg( - check_msg->certificate_bytes[71] == 213, - "incorrect value for certificate_bytes[71], expected 213, is %d", - check_msg->certificate_bytes[71]); - ck_assert_msg( - check_msg->certificate_bytes[72] == 216, - "incorrect value for certificate_bytes[72], expected 216, is %d", - check_msg->certificate_bytes[72]); - ck_assert_msg( - check_msg->certificate_bytes[73] == 219, - "incorrect value for certificate_bytes[73], expected 219, is %d", - check_msg->certificate_bytes[73]); - ck_assert_msg( - check_msg->certificate_bytes[74] == 222, - "incorrect value for certificate_bytes[74], expected 222, is %d", - check_msg->certificate_bytes[74]); - ck_assert_msg( - check_msg->certificate_bytes[75] == 225, - "incorrect value for certificate_bytes[75], expected 225, is %d", - check_msg->certificate_bytes[75]); - ck_assert_msg( - check_msg->certificate_bytes[76] == 228, - "incorrect value for certificate_bytes[76], expected 228, is %d", - check_msg->certificate_bytes[76]); - ck_assert_msg( - check_msg->certificate_bytes[77] == 231, - "incorrect value for certificate_bytes[77], expected 231, is %d", - check_msg->certificate_bytes[77]); - ck_assert_msg( - check_msg->certificate_bytes[78] == 234, - "incorrect value for certificate_bytes[78], expected 234, is %d", - check_msg->certificate_bytes[78]); - ck_assert_msg( - check_msg->certificate_bytes[79] == 237, - "incorrect value for certificate_bytes[79], expected 237, is %d", - check_msg->certificate_bytes[79]); - ck_assert_msg( - check_msg->certificate_bytes[80] == 240, - "incorrect value for certificate_bytes[80], expected 240, is %d", - check_msg->certificate_bytes[80]); - ck_assert_msg( - check_msg->certificate_bytes[81] == 243, - "incorrect value for certificate_bytes[81], expected 243, is %d", - check_msg->certificate_bytes[81]); - ck_assert_msg( - check_msg->certificate_bytes[82] == 246, - "incorrect value for certificate_bytes[82], expected 246, is %d", - check_msg->certificate_bytes[82]); - ck_assert_msg( - check_msg->certificate_bytes[83] == 249, - "incorrect value for certificate_bytes[83], expected 249, is %d", - check_msg->certificate_bytes[83]); - ck_assert_msg( - check_msg->certificate_bytes[84] == 252, - "incorrect value for certificate_bytes[84], expected 252, is %d", - check_msg->certificate_bytes[84]); - ck_assert_msg(check_msg->fingerprint[0] == 100, - "incorrect value for fingerprint[0], expected 100, is %d", - check_msg->fingerprint[0]); - ck_assert_msg(check_msg->fingerprint[1] == 101, - "incorrect value for fingerprint[1], expected 101, is %d", - check_msg->fingerprint[1]); - ck_assert_msg(check_msg->fingerprint[2] == 102, - "incorrect value for fingerprint[2], expected 102, is %d", - check_msg->fingerprint[2]); - ck_assert_msg(check_msg->fingerprint[3] == 103, - "incorrect value for fingerprint[3], expected 103, is %d", - check_msg->fingerprint[3]); - ck_assert_msg(check_msg->fingerprint[4] == 104, - "incorrect value for fingerprint[4], expected 104, is %d", - check_msg->fingerprint[4]); - ck_assert_msg(check_msg->fingerprint[5] == 105, - "incorrect value for fingerprint[5], expected 105, is %d", - check_msg->fingerprint[5]); - ck_assert_msg(check_msg->fingerprint[6] == 106, - "incorrect value for fingerprint[6], expected 106, is %d", - check_msg->fingerprint[6]); - ck_assert_msg(check_msg->fingerprint[7] == 107, - "incorrect value for fingerprint[7], expected 107, is %d", - check_msg->fingerprint[7]); - ck_assert_msg(check_msg->fingerprint[8] == 108, - "incorrect value for fingerprint[8], expected 108, is %d", - check_msg->fingerprint[8]); - ck_assert_msg(check_msg->fingerprint[9] == 109, - "incorrect value for fingerprint[9], expected 109, is %d", - check_msg->fingerprint[9]); - ck_assert_msg(check_msg->fingerprint[10] == 110, - "incorrect value for fingerprint[10], expected 110, is %d", - check_msg->fingerprint[10]); - ck_assert_msg(check_msg->fingerprint[11] == 111, - "incorrect value for fingerprint[11], expected 111, is %d", - check_msg->fingerprint[11]); - ck_assert_msg(check_msg->fingerprint[12] == 112, - "incorrect value for fingerprint[12], expected 112, is %d", - check_msg->fingerprint[12]); - ck_assert_msg(check_msg->fingerprint[13] == 113, - "incorrect value for fingerprint[13], expected 113, is %d", - check_msg->fingerprint[13]); - ck_assert_msg(check_msg->fingerprint[14] == 114, - "incorrect value for fingerprint[14], expected 114, is %d", - check_msg->fingerprint[14]); - ck_assert_msg(check_msg->fingerprint[15] == 115, - "incorrect value for fingerprint[15], expected 115, is %d", - check_msg->fingerprint[15]); - ck_assert_msg(check_msg->fingerprint[16] == 116, - "incorrect value for fingerprint[16], expected 116, is %d", - check_msg->fingerprint[16]); - ck_assert_msg(check_msg->fingerprint[17] == 117, - "incorrect value for fingerprint[17], expected 117, is %d", - check_msg->fingerprint[17]); - ck_assert_msg(check_msg->fingerprint[18] == 118, - "incorrect value for fingerprint[18], expected 118, is %d", - check_msg->fingerprint[18]); - ck_assert_msg(check_msg->fingerprint[19] == 119, - "incorrect value for fingerprint[19], expected 119, is %d", - check_msg->fingerprint[19]); - ck_assert_msg(check_msg->n_msg == 16, - "incorrect value for n_msg, expected 16, is %d", - check_msg->n_msg); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_signing_MsgEd25519CertificateDep_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_signing_MsgEd25519CertificateDep"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_signing_MsgEd25519CertificateDep"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_signing_MsgEd25519CertificateDep); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_signing_MsgEd25519SignatureDepA.c b/c/test/legacy/auto_check_sbp_signing_MsgEd25519SignatureDepA.c deleted file mode 100644 index 150052ea30..0000000000 --- a/c/test/legacy/auto_check_sbp_signing_MsgEd25519SignatureDepA.c +++ /dev/null @@ -1,1125 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgEd25519SignatureDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_signing_MsgEd25519SignatureDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xC01, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xC01, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 1, 12, 66, 0, 184, 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, 117, 118, 119, 136, 19, 0, 0, 114, 20, 0, 0, - 92, 21, 0, 0, 70, 22, 0, 0, 48, 23, 0, 0, 26, 24, - 0, 0, 4, 25, 0, 0, 238, 25, 0, 0, 216, 26, 0, 0, - 194, 27, 0, 0, 172, 28, 0, 0, 150, 29, 0, 0, 128, 30, - 0, 0, 106, 31, 0, 0, 84, 32, 0, 0, 62, 33, 0, 0, - 40, 34, 0, 0, 18, 35, 0, 0, 252, 35, 0, 0, 230, 36, - 0, 0, 208, 37, 0, 0, 186, 38, 0, 0, 164, 39, 0, 0, - 142, 40, 0, 0, 120, 41, 0, 0, 169, 111, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ed25519_signature_dep_a_t *test_msg = - (msg_ed25519_signature_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[0] = 100; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[1] = 101; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[2] = 102; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[3] = 103; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[4] = 104; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[5] = 105; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[6] = 106; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[7] = 107; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[8] = 108; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[9] = 109; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[10] = 110; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[11] = 111; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[12] = 112; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[13] = 113; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[14] = 114; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[15] = 115; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[16] = 116; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[17] = 117; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[18] = 118; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[19] = 119; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[0] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[1] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[2] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[3] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[4] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[5] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[6] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[7] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[8] = 8; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[9] = 9; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[10] = 10; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[11] = 11; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[12] = 12; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[13] = 13; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[14] = 14; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[15] = 15; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[16] = 16; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[17] = 17; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[18] = 18; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[19] = 19; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[20] = 20; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[21] = 21; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[22] = 22; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[23] = 23; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[24] = 24; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[25] = 25; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[26] = 26; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[27] = 27; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[28] = 28; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[29] = 29; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[30] = 30; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[31] = 31; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[32] = 32; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[33] = 33; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[34] = 34; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[35] = 35; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[36] = 36; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[37] = 37; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[38] = 38; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[39] = 39; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[40] = 40; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[41] = 41; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[42] = 42; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[43] = 43; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[44] = 44; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[45] = 45; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[46] = 46; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[47] = 47; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[48] = 48; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[49] = 49; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[50] = 50; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[51] = 51; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[52] = 52; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[53] = 53; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[54] = 54; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[55] = 55; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[56] = 56; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[57] = 57; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[58] = 58; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[59] = 59; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[60] = 60; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[61] = 61; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[62] = 62; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[63] = 63; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[0] = 5000; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[1] = 5234; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[2] = 5468; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[3] = 5702; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[4] = 5936; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[5] = 6170; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[6] = 6404; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[7] = 6638; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[8] = 6872; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[9] = 7106; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[10] = 7340; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[11] = 7574; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[12] = 7808; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[13] = 8042; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[14] = 8276; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[15] = 8510; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[16] = 8744; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[17] = 8978; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[18] = 9212; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[19] = 9446; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[20] = 9680; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[21] = 9914; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[22] = 10148; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[23] = 10382; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[24] = 10616; - sbp_payload_send(&sbp_state, 0xC01, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xC01, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ed25519_signature_dep_a_t *check_msg = - (msg_ed25519_signature_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->fingerprint[0] == 100, - "incorrect value for fingerprint[0], expected 100, is %d", - check_msg->fingerprint[0]); - ck_assert_msg(check_msg->fingerprint[1] == 101, - "incorrect value for fingerprint[1], expected 101, is %d", - check_msg->fingerprint[1]); - ck_assert_msg(check_msg->fingerprint[2] == 102, - "incorrect value for fingerprint[2], expected 102, is %d", - check_msg->fingerprint[2]); - ck_assert_msg(check_msg->fingerprint[3] == 103, - "incorrect value for fingerprint[3], expected 103, is %d", - check_msg->fingerprint[3]); - ck_assert_msg(check_msg->fingerprint[4] == 104, - "incorrect value for fingerprint[4], expected 104, is %d", - check_msg->fingerprint[4]); - ck_assert_msg(check_msg->fingerprint[5] == 105, - "incorrect value for fingerprint[5], expected 105, is %d", - check_msg->fingerprint[5]); - ck_assert_msg(check_msg->fingerprint[6] == 106, - "incorrect value for fingerprint[6], expected 106, is %d", - check_msg->fingerprint[6]); - ck_assert_msg(check_msg->fingerprint[7] == 107, - "incorrect value for fingerprint[7], expected 107, is %d", - check_msg->fingerprint[7]); - ck_assert_msg(check_msg->fingerprint[8] == 108, - "incorrect value for fingerprint[8], expected 108, is %d", - check_msg->fingerprint[8]); - ck_assert_msg(check_msg->fingerprint[9] == 109, - "incorrect value for fingerprint[9], expected 109, is %d", - check_msg->fingerprint[9]); - ck_assert_msg(check_msg->fingerprint[10] == 110, - "incorrect value for fingerprint[10], expected 110, is %d", - check_msg->fingerprint[10]); - ck_assert_msg(check_msg->fingerprint[11] == 111, - "incorrect value for fingerprint[11], expected 111, is %d", - check_msg->fingerprint[11]); - ck_assert_msg(check_msg->fingerprint[12] == 112, - "incorrect value for fingerprint[12], expected 112, is %d", - check_msg->fingerprint[12]); - ck_assert_msg(check_msg->fingerprint[13] == 113, - "incorrect value for fingerprint[13], expected 113, is %d", - check_msg->fingerprint[13]); - ck_assert_msg(check_msg->fingerprint[14] == 114, - "incorrect value for fingerprint[14], expected 114, is %d", - check_msg->fingerprint[14]); - ck_assert_msg(check_msg->fingerprint[15] == 115, - "incorrect value for fingerprint[15], expected 115, is %d", - check_msg->fingerprint[15]); - ck_assert_msg(check_msg->fingerprint[16] == 116, - "incorrect value for fingerprint[16], expected 116, is %d", - check_msg->fingerprint[16]); - ck_assert_msg(check_msg->fingerprint[17] == 117, - "incorrect value for fingerprint[17], expected 117, is %d", - check_msg->fingerprint[17]); - ck_assert_msg(check_msg->fingerprint[18] == 118, - "incorrect value for fingerprint[18], expected 118, is %d", - check_msg->fingerprint[18]); - ck_assert_msg(check_msg->fingerprint[19] == 119, - "incorrect value for fingerprint[19], expected 119, is %d", - check_msg->fingerprint[19]); - ck_assert_msg(check_msg->signature[0] == 0, - "incorrect value for signature[0], expected 0, is %d", - check_msg->signature[0]); - ck_assert_msg(check_msg->signature[1] == 1, - "incorrect value for signature[1], expected 1, is %d", - check_msg->signature[1]); - ck_assert_msg(check_msg->signature[2] == 2, - "incorrect value for signature[2], expected 2, is %d", - check_msg->signature[2]); - ck_assert_msg(check_msg->signature[3] == 3, - "incorrect value for signature[3], expected 3, is %d", - check_msg->signature[3]); - ck_assert_msg(check_msg->signature[4] == 4, - "incorrect value for signature[4], expected 4, is %d", - check_msg->signature[4]); - ck_assert_msg(check_msg->signature[5] == 5, - "incorrect value for signature[5], expected 5, is %d", - check_msg->signature[5]); - ck_assert_msg(check_msg->signature[6] == 6, - "incorrect value for signature[6], expected 6, is %d", - check_msg->signature[6]); - ck_assert_msg(check_msg->signature[7] == 7, - "incorrect value for signature[7], expected 7, is %d", - check_msg->signature[7]); - ck_assert_msg(check_msg->signature[8] == 8, - "incorrect value for signature[8], expected 8, is %d", - check_msg->signature[8]); - ck_assert_msg(check_msg->signature[9] == 9, - "incorrect value for signature[9], expected 9, is %d", - check_msg->signature[9]); - ck_assert_msg(check_msg->signature[10] == 10, - "incorrect value for signature[10], expected 10, is %d", - check_msg->signature[10]); - ck_assert_msg(check_msg->signature[11] == 11, - "incorrect value for signature[11], expected 11, is %d", - check_msg->signature[11]); - ck_assert_msg(check_msg->signature[12] == 12, - "incorrect value for signature[12], expected 12, is %d", - check_msg->signature[12]); - ck_assert_msg(check_msg->signature[13] == 13, - "incorrect value for signature[13], expected 13, is %d", - check_msg->signature[13]); - ck_assert_msg(check_msg->signature[14] == 14, - "incorrect value for signature[14], expected 14, is %d", - check_msg->signature[14]); - ck_assert_msg(check_msg->signature[15] == 15, - "incorrect value for signature[15], expected 15, is %d", - check_msg->signature[15]); - ck_assert_msg(check_msg->signature[16] == 16, - "incorrect value for signature[16], expected 16, is %d", - check_msg->signature[16]); - ck_assert_msg(check_msg->signature[17] == 17, - "incorrect value for signature[17], expected 17, is %d", - check_msg->signature[17]); - ck_assert_msg(check_msg->signature[18] == 18, - "incorrect value for signature[18], expected 18, is %d", - check_msg->signature[18]); - ck_assert_msg(check_msg->signature[19] == 19, - "incorrect value for signature[19], expected 19, is %d", - check_msg->signature[19]); - ck_assert_msg(check_msg->signature[20] == 20, - "incorrect value for signature[20], expected 20, is %d", - check_msg->signature[20]); - ck_assert_msg(check_msg->signature[21] == 21, - "incorrect value for signature[21], expected 21, is %d", - check_msg->signature[21]); - ck_assert_msg(check_msg->signature[22] == 22, - "incorrect value for signature[22], expected 22, is %d", - check_msg->signature[22]); - ck_assert_msg(check_msg->signature[23] == 23, - "incorrect value for signature[23], expected 23, is %d", - check_msg->signature[23]); - ck_assert_msg(check_msg->signature[24] == 24, - "incorrect value for signature[24], expected 24, is %d", - check_msg->signature[24]); - ck_assert_msg(check_msg->signature[25] == 25, - "incorrect value for signature[25], expected 25, is %d", - check_msg->signature[25]); - ck_assert_msg(check_msg->signature[26] == 26, - "incorrect value for signature[26], expected 26, is %d", - check_msg->signature[26]); - ck_assert_msg(check_msg->signature[27] == 27, - "incorrect value for signature[27], expected 27, is %d", - check_msg->signature[27]); - ck_assert_msg(check_msg->signature[28] == 28, - "incorrect value for signature[28], expected 28, is %d", - check_msg->signature[28]); - ck_assert_msg(check_msg->signature[29] == 29, - "incorrect value for signature[29], expected 29, is %d", - check_msg->signature[29]); - ck_assert_msg(check_msg->signature[30] == 30, - "incorrect value for signature[30], expected 30, is %d", - check_msg->signature[30]); - ck_assert_msg(check_msg->signature[31] == 31, - "incorrect value for signature[31], expected 31, is %d", - check_msg->signature[31]); - ck_assert_msg(check_msg->signature[32] == 32, - "incorrect value for signature[32], expected 32, is %d", - check_msg->signature[32]); - ck_assert_msg(check_msg->signature[33] == 33, - "incorrect value for signature[33], expected 33, is %d", - check_msg->signature[33]); - ck_assert_msg(check_msg->signature[34] == 34, - "incorrect value for signature[34], expected 34, is %d", - check_msg->signature[34]); - ck_assert_msg(check_msg->signature[35] == 35, - "incorrect value for signature[35], expected 35, is %d", - check_msg->signature[35]); - ck_assert_msg(check_msg->signature[36] == 36, - "incorrect value for signature[36], expected 36, is %d", - check_msg->signature[36]); - ck_assert_msg(check_msg->signature[37] == 37, - "incorrect value for signature[37], expected 37, is %d", - check_msg->signature[37]); - ck_assert_msg(check_msg->signature[38] == 38, - "incorrect value for signature[38], expected 38, is %d", - check_msg->signature[38]); - ck_assert_msg(check_msg->signature[39] == 39, - "incorrect value for signature[39], expected 39, is %d", - check_msg->signature[39]); - ck_assert_msg(check_msg->signature[40] == 40, - "incorrect value for signature[40], expected 40, is %d", - check_msg->signature[40]); - ck_assert_msg(check_msg->signature[41] == 41, - "incorrect value for signature[41], expected 41, is %d", - check_msg->signature[41]); - ck_assert_msg(check_msg->signature[42] == 42, - "incorrect value for signature[42], expected 42, is %d", - check_msg->signature[42]); - ck_assert_msg(check_msg->signature[43] == 43, - "incorrect value for signature[43], expected 43, is %d", - check_msg->signature[43]); - ck_assert_msg(check_msg->signature[44] == 44, - "incorrect value for signature[44], expected 44, is %d", - check_msg->signature[44]); - ck_assert_msg(check_msg->signature[45] == 45, - "incorrect value for signature[45], expected 45, is %d", - check_msg->signature[45]); - ck_assert_msg(check_msg->signature[46] == 46, - "incorrect value for signature[46], expected 46, is %d", - check_msg->signature[46]); - ck_assert_msg(check_msg->signature[47] == 47, - "incorrect value for signature[47], expected 47, is %d", - check_msg->signature[47]); - ck_assert_msg(check_msg->signature[48] == 48, - "incorrect value for signature[48], expected 48, is %d", - check_msg->signature[48]); - ck_assert_msg(check_msg->signature[49] == 49, - "incorrect value for signature[49], expected 49, is %d", - check_msg->signature[49]); - ck_assert_msg(check_msg->signature[50] == 50, - "incorrect value for signature[50], expected 50, is %d", - check_msg->signature[50]); - ck_assert_msg(check_msg->signature[51] == 51, - "incorrect value for signature[51], expected 51, is %d", - check_msg->signature[51]); - ck_assert_msg(check_msg->signature[52] == 52, - "incorrect value for signature[52], expected 52, is %d", - check_msg->signature[52]); - ck_assert_msg(check_msg->signature[53] == 53, - "incorrect value for signature[53], expected 53, is %d", - check_msg->signature[53]); - ck_assert_msg(check_msg->signature[54] == 54, - "incorrect value for signature[54], expected 54, is %d", - check_msg->signature[54]); - ck_assert_msg(check_msg->signature[55] == 55, - "incorrect value for signature[55], expected 55, is %d", - check_msg->signature[55]); - ck_assert_msg(check_msg->signature[56] == 56, - "incorrect value for signature[56], expected 56, is %d", - check_msg->signature[56]); - ck_assert_msg(check_msg->signature[57] == 57, - "incorrect value for signature[57], expected 57, is %d", - check_msg->signature[57]); - ck_assert_msg(check_msg->signature[58] == 58, - "incorrect value for signature[58], expected 58, is %d", - check_msg->signature[58]); - ck_assert_msg(check_msg->signature[59] == 59, - "incorrect value for signature[59], expected 59, is %d", - check_msg->signature[59]); - ck_assert_msg(check_msg->signature[60] == 60, - "incorrect value for signature[60], expected 60, is %d", - check_msg->signature[60]); - ck_assert_msg(check_msg->signature[61] == 61, - "incorrect value for signature[61], expected 61, is %d", - check_msg->signature[61]); - ck_assert_msg(check_msg->signature[62] == 62, - "incorrect value for signature[62], expected 62, is %d", - check_msg->signature[62]); - ck_assert_msg(check_msg->signature[63] == 63, - "incorrect value for signature[63], expected 63, is %d", - check_msg->signature[63]); - ck_assert_msg( - check_msg->signed_messages[0] == 5000, - "incorrect value for signed_messages[0], expected 5000, is %d", - check_msg->signed_messages[0]); - ck_assert_msg( - check_msg->signed_messages[1] == 5234, - "incorrect value for signed_messages[1], expected 5234, is %d", - check_msg->signed_messages[1]); - ck_assert_msg( - check_msg->signed_messages[2] == 5468, - "incorrect value for signed_messages[2], expected 5468, is %d", - check_msg->signed_messages[2]); - ck_assert_msg( - check_msg->signed_messages[3] == 5702, - "incorrect value for signed_messages[3], expected 5702, is %d", - check_msg->signed_messages[3]); - ck_assert_msg( - check_msg->signed_messages[4] == 5936, - "incorrect value for signed_messages[4], expected 5936, is %d", - check_msg->signed_messages[4]); - ck_assert_msg( - check_msg->signed_messages[5] == 6170, - "incorrect value for signed_messages[5], expected 6170, is %d", - check_msg->signed_messages[5]); - ck_assert_msg( - check_msg->signed_messages[6] == 6404, - "incorrect value for signed_messages[6], expected 6404, is %d", - check_msg->signed_messages[6]); - ck_assert_msg( - check_msg->signed_messages[7] == 6638, - "incorrect value for signed_messages[7], expected 6638, is %d", - check_msg->signed_messages[7]); - ck_assert_msg( - check_msg->signed_messages[8] == 6872, - "incorrect value for signed_messages[8], expected 6872, is %d", - check_msg->signed_messages[8]); - ck_assert_msg( - check_msg->signed_messages[9] == 7106, - "incorrect value for signed_messages[9], expected 7106, is %d", - check_msg->signed_messages[9]); - ck_assert_msg( - check_msg->signed_messages[10] == 7340, - "incorrect value for signed_messages[10], expected 7340, is %d", - check_msg->signed_messages[10]); - ck_assert_msg( - check_msg->signed_messages[11] == 7574, - "incorrect value for signed_messages[11], expected 7574, is %d", - check_msg->signed_messages[11]); - ck_assert_msg( - check_msg->signed_messages[12] == 7808, - "incorrect value for signed_messages[12], expected 7808, is %d", - check_msg->signed_messages[12]); - ck_assert_msg( - check_msg->signed_messages[13] == 8042, - "incorrect value for signed_messages[13], expected 8042, is %d", - check_msg->signed_messages[13]); - ck_assert_msg( - check_msg->signed_messages[14] == 8276, - "incorrect value for signed_messages[14], expected 8276, is %d", - check_msg->signed_messages[14]); - ck_assert_msg( - check_msg->signed_messages[15] == 8510, - "incorrect value for signed_messages[15], expected 8510, is %d", - check_msg->signed_messages[15]); - ck_assert_msg( - check_msg->signed_messages[16] == 8744, - "incorrect value for signed_messages[16], expected 8744, is %d", - check_msg->signed_messages[16]); - ck_assert_msg( - check_msg->signed_messages[17] == 8978, - "incorrect value for signed_messages[17], expected 8978, is %d", - check_msg->signed_messages[17]); - ck_assert_msg( - check_msg->signed_messages[18] == 9212, - "incorrect value for signed_messages[18], expected 9212, is %d", - check_msg->signed_messages[18]); - ck_assert_msg( - check_msg->signed_messages[19] == 9446, - "incorrect value for signed_messages[19], expected 9446, is %d", - check_msg->signed_messages[19]); - ck_assert_msg( - check_msg->signed_messages[20] == 9680, - "incorrect value for signed_messages[20], expected 9680, is %d", - check_msg->signed_messages[20]); - ck_assert_msg( - check_msg->signed_messages[21] == 9914, - "incorrect value for signed_messages[21], expected 9914, is %d", - check_msg->signed_messages[21]); - ck_assert_msg( - check_msg->signed_messages[22] == 10148, - "incorrect value for signed_messages[22], expected 10148, is %d", - check_msg->signed_messages[22]); - ck_assert_msg( - check_msg->signed_messages[23] == 10382, - "incorrect value for signed_messages[23], expected 10382, is %d", - check_msg->signed_messages[23]); - ck_assert_msg( - check_msg->signed_messages[24] == 10616, - "incorrect value for signed_messages[24], expected 10616, is %d", - check_msg->signed_messages[24]); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_signing_MsgEd25519SignatureDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_signing_MsgEd25519SignatureDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_signing_MsgEd25519SignatureDepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_signing_MsgEd25519SignatureDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_signing_MsgEd25519SignatureDepB.c b/c/test/legacy/auto_check_sbp_signing_MsgEd25519SignatureDepB.c deleted file mode 100644 index 6491f7f8cc..0000000000 --- a/c/test/legacy/auto_check_sbp_signing_MsgEd25519SignatureDepB.c +++ /dev/null @@ -1,1133 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgEd25519SignatureDepB.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_signing_MsgEd25519SignatureDepB) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xC03, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xC03, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 3, 12, 66, 0, 186, 1, 0, 0, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 136, 19, 0, 0, 114, 20, - 0, 0, 92, 21, 0, 0, 70, 22, 0, 0, 48, 23, 0, 0, - 26, 24, 0, 0, 4, 25, 0, 0, 238, 25, 0, 0, 216, 26, - 0, 0, 194, 27, 0, 0, 172, 28, 0, 0, 150, 29, 0, 0, - 128, 30, 0, 0, 106, 31, 0, 0, 84, 32, 0, 0, 62, 33, - 0, 0, 40, 34, 0, 0, 18, 35, 0, 0, 252, 35, 0, 0, - 230, 36, 0, 0, 208, 37, 0, 0, 186, 38, 0, 0, 164, 39, - 0, 0, 142, 40, 0, 0, 120, 41, 0, 0, 238, 145, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ed25519_signature_dep_b_t *test_msg = - (msg_ed25519_signature_dep_b_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[0] = 100; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[1] = 101; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[2] = 102; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[3] = 103; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[4] = 104; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[5] = 105; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[6] = 106; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[7] = 107; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[8] = 108; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[9] = 109; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[10] = 110; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[11] = 111; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[12] = 112; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[13] = 113; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[14] = 114; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[15] = 115; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[16] = 116; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[17] = 117; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[18] = 118; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->fingerprint[0]); - } - test_msg->fingerprint[19] = 119; - test_msg->on_demand_counter = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[0] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[1] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[2] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[3] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[4] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[5] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[6] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[7] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[8] = 8; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[9] = 9; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[10] = 10; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[11] = 11; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[12] = 12; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[13] = 13; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[14] = 14; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[15] = 15; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[16] = 16; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[17] = 17; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[18] = 18; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[19] = 19; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[20] = 20; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[21] = 21; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[22] = 22; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[23] = 23; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[24] = 24; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[25] = 25; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[26] = 26; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[27] = 27; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[28] = 28; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[29] = 29; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[30] = 30; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[31] = 31; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[32] = 32; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[33] = 33; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[34] = 34; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[35] = 35; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[36] = 36; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[37] = 37; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[38] = 38; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[39] = 39; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[40] = 40; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[41] = 41; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[42] = 42; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[43] = 43; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[44] = 44; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[45] = 45; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[46] = 46; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[47] = 47; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[48] = 48; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[49] = 49; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[50] = 50; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[51] = 51; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[52] = 52; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[53] = 53; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[54] = 54; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[55] = 55; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[56] = 56; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[57] = 57; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[58] = 58; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[59] = 59; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[60] = 60; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[61] = 61; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[62] = 62; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signature[0]); - } - test_msg->signature[63] = 63; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[0] = 5000; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[1] = 5234; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[2] = 5468; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[3] = 5702; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[4] = 5936; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[5] = 6170; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[6] = 6404; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[7] = 6638; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[8] = 6872; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[9] = 7106; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[10] = 7340; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[11] = 7574; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[12] = 7808; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[13] = 8042; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[14] = 8276; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[15] = 8510; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[16] = 8744; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[17] = 8978; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[18] = 9212; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[19] = 9446; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[20] = 9680; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[21] = 9914; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[22] = 10148; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[23] = 10382; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->signed_messages[0]); - } - test_msg->signed_messages[24] = 10616; - test_msg->stream_counter = 1; - sbp_payload_send(&sbp_state, 0xC03, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xC03, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ed25519_signature_dep_b_t *check_msg = - (msg_ed25519_signature_dep_b_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->fingerprint[0] == 100, - "incorrect value for fingerprint[0], expected 100, is %d", - check_msg->fingerprint[0]); - ck_assert_msg(check_msg->fingerprint[1] == 101, - "incorrect value for fingerprint[1], expected 101, is %d", - check_msg->fingerprint[1]); - ck_assert_msg(check_msg->fingerprint[2] == 102, - "incorrect value for fingerprint[2], expected 102, is %d", - check_msg->fingerprint[2]); - ck_assert_msg(check_msg->fingerprint[3] == 103, - "incorrect value for fingerprint[3], expected 103, is %d", - check_msg->fingerprint[3]); - ck_assert_msg(check_msg->fingerprint[4] == 104, - "incorrect value for fingerprint[4], expected 104, is %d", - check_msg->fingerprint[4]); - ck_assert_msg(check_msg->fingerprint[5] == 105, - "incorrect value for fingerprint[5], expected 105, is %d", - check_msg->fingerprint[5]); - ck_assert_msg(check_msg->fingerprint[6] == 106, - "incorrect value for fingerprint[6], expected 106, is %d", - check_msg->fingerprint[6]); - ck_assert_msg(check_msg->fingerprint[7] == 107, - "incorrect value for fingerprint[7], expected 107, is %d", - check_msg->fingerprint[7]); - ck_assert_msg(check_msg->fingerprint[8] == 108, - "incorrect value for fingerprint[8], expected 108, is %d", - check_msg->fingerprint[8]); - ck_assert_msg(check_msg->fingerprint[9] == 109, - "incorrect value for fingerprint[9], expected 109, is %d", - check_msg->fingerprint[9]); - ck_assert_msg(check_msg->fingerprint[10] == 110, - "incorrect value for fingerprint[10], expected 110, is %d", - check_msg->fingerprint[10]); - ck_assert_msg(check_msg->fingerprint[11] == 111, - "incorrect value for fingerprint[11], expected 111, is %d", - check_msg->fingerprint[11]); - ck_assert_msg(check_msg->fingerprint[12] == 112, - "incorrect value for fingerprint[12], expected 112, is %d", - check_msg->fingerprint[12]); - ck_assert_msg(check_msg->fingerprint[13] == 113, - "incorrect value for fingerprint[13], expected 113, is %d", - check_msg->fingerprint[13]); - ck_assert_msg(check_msg->fingerprint[14] == 114, - "incorrect value for fingerprint[14], expected 114, is %d", - check_msg->fingerprint[14]); - ck_assert_msg(check_msg->fingerprint[15] == 115, - "incorrect value for fingerprint[15], expected 115, is %d", - check_msg->fingerprint[15]); - ck_assert_msg(check_msg->fingerprint[16] == 116, - "incorrect value for fingerprint[16], expected 116, is %d", - check_msg->fingerprint[16]); - ck_assert_msg(check_msg->fingerprint[17] == 117, - "incorrect value for fingerprint[17], expected 117, is %d", - check_msg->fingerprint[17]); - ck_assert_msg(check_msg->fingerprint[18] == 118, - "incorrect value for fingerprint[18], expected 118, is %d", - check_msg->fingerprint[18]); - ck_assert_msg(check_msg->fingerprint[19] == 119, - "incorrect value for fingerprint[19], expected 119, is %d", - check_msg->fingerprint[19]); - ck_assert_msg(check_msg->on_demand_counter == 0, - "incorrect value for on_demand_counter, expected 0, is %d", - check_msg->on_demand_counter); - ck_assert_msg(check_msg->signature[0] == 0, - "incorrect value for signature[0], expected 0, is %d", - check_msg->signature[0]); - ck_assert_msg(check_msg->signature[1] == 1, - "incorrect value for signature[1], expected 1, is %d", - check_msg->signature[1]); - ck_assert_msg(check_msg->signature[2] == 2, - "incorrect value for signature[2], expected 2, is %d", - check_msg->signature[2]); - ck_assert_msg(check_msg->signature[3] == 3, - "incorrect value for signature[3], expected 3, is %d", - check_msg->signature[3]); - ck_assert_msg(check_msg->signature[4] == 4, - "incorrect value for signature[4], expected 4, is %d", - check_msg->signature[4]); - ck_assert_msg(check_msg->signature[5] == 5, - "incorrect value for signature[5], expected 5, is %d", - check_msg->signature[5]); - ck_assert_msg(check_msg->signature[6] == 6, - "incorrect value for signature[6], expected 6, is %d", - check_msg->signature[6]); - ck_assert_msg(check_msg->signature[7] == 7, - "incorrect value for signature[7], expected 7, is %d", - check_msg->signature[7]); - ck_assert_msg(check_msg->signature[8] == 8, - "incorrect value for signature[8], expected 8, is %d", - check_msg->signature[8]); - ck_assert_msg(check_msg->signature[9] == 9, - "incorrect value for signature[9], expected 9, is %d", - check_msg->signature[9]); - ck_assert_msg(check_msg->signature[10] == 10, - "incorrect value for signature[10], expected 10, is %d", - check_msg->signature[10]); - ck_assert_msg(check_msg->signature[11] == 11, - "incorrect value for signature[11], expected 11, is %d", - check_msg->signature[11]); - ck_assert_msg(check_msg->signature[12] == 12, - "incorrect value for signature[12], expected 12, is %d", - check_msg->signature[12]); - ck_assert_msg(check_msg->signature[13] == 13, - "incorrect value for signature[13], expected 13, is %d", - check_msg->signature[13]); - ck_assert_msg(check_msg->signature[14] == 14, - "incorrect value for signature[14], expected 14, is %d", - check_msg->signature[14]); - ck_assert_msg(check_msg->signature[15] == 15, - "incorrect value for signature[15], expected 15, is %d", - check_msg->signature[15]); - ck_assert_msg(check_msg->signature[16] == 16, - "incorrect value for signature[16], expected 16, is %d", - check_msg->signature[16]); - ck_assert_msg(check_msg->signature[17] == 17, - "incorrect value for signature[17], expected 17, is %d", - check_msg->signature[17]); - ck_assert_msg(check_msg->signature[18] == 18, - "incorrect value for signature[18], expected 18, is %d", - check_msg->signature[18]); - ck_assert_msg(check_msg->signature[19] == 19, - "incorrect value for signature[19], expected 19, is %d", - check_msg->signature[19]); - ck_assert_msg(check_msg->signature[20] == 20, - "incorrect value for signature[20], expected 20, is %d", - check_msg->signature[20]); - ck_assert_msg(check_msg->signature[21] == 21, - "incorrect value for signature[21], expected 21, is %d", - check_msg->signature[21]); - ck_assert_msg(check_msg->signature[22] == 22, - "incorrect value for signature[22], expected 22, is %d", - check_msg->signature[22]); - ck_assert_msg(check_msg->signature[23] == 23, - "incorrect value for signature[23], expected 23, is %d", - check_msg->signature[23]); - ck_assert_msg(check_msg->signature[24] == 24, - "incorrect value for signature[24], expected 24, is %d", - check_msg->signature[24]); - ck_assert_msg(check_msg->signature[25] == 25, - "incorrect value for signature[25], expected 25, is %d", - check_msg->signature[25]); - ck_assert_msg(check_msg->signature[26] == 26, - "incorrect value for signature[26], expected 26, is %d", - check_msg->signature[26]); - ck_assert_msg(check_msg->signature[27] == 27, - "incorrect value for signature[27], expected 27, is %d", - check_msg->signature[27]); - ck_assert_msg(check_msg->signature[28] == 28, - "incorrect value for signature[28], expected 28, is %d", - check_msg->signature[28]); - ck_assert_msg(check_msg->signature[29] == 29, - "incorrect value for signature[29], expected 29, is %d", - check_msg->signature[29]); - ck_assert_msg(check_msg->signature[30] == 30, - "incorrect value for signature[30], expected 30, is %d", - check_msg->signature[30]); - ck_assert_msg(check_msg->signature[31] == 31, - "incorrect value for signature[31], expected 31, is %d", - check_msg->signature[31]); - ck_assert_msg(check_msg->signature[32] == 32, - "incorrect value for signature[32], expected 32, is %d", - check_msg->signature[32]); - ck_assert_msg(check_msg->signature[33] == 33, - "incorrect value for signature[33], expected 33, is %d", - check_msg->signature[33]); - ck_assert_msg(check_msg->signature[34] == 34, - "incorrect value for signature[34], expected 34, is %d", - check_msg->signature[34]); - ck_assert_msg(check_msg->signature[35] == 35, - "incorrect value for signature[35], expected 35, is %d", - check_msg->signature[35]); - ck_assert_msg(check_msg->signature[36] == 36, - "incorrect value for signature[36], expected 36, is %d", - check_msg->signature[36]); - ck_assert_msg(check_msg->signature[37] == 37, - "incorrect value for signature[37], expected 37, is %d", - check_msg->signature[37]); - ck_assert_msg(check_msg->signature[38] == 38, - "incorrect value for signature[38], expected 38, is %d", - check_msg->signature[38]); - ck_assert_msg(check_msg->signature[39] == 39, - "incorrect value for signature[39], expected 39, is %d", - check_msg->signature[39]); - ck_assert_msg(check_msg->signature[40] == 40, - "incorrect value for signature[40], expected 40, is %d", - check_msg->signature[40]); - ck_assert_msg(check_msg->signature[41] == 41, - "incorrect value for signature[41], expected 41, is %d", - check_msg->signature[41]); - ck_assert_msg(check_msg->signature[42] == 42, - "incorrect value for signature[42], expected 42, is %d", - check_msg->signature[42]); - ck_assert_msg(check_msg->signature[43] == 43, - "incorrect value for signature[43], expected 43, is %d", - check_msg->signature[43]); - ck_assert_msg(check_msg->signature[44] == 44, - "incorrect value for signature[44], expected 44, is %d", - check_msg->signature[44]); - ck_assert_msg(check_msg->signature[45] == 45, - "incorrect value for signature[45], expected 45, is %d", - check_msg->signature[45]); - ck_assert_msg(check_msg->signature[46] == 46, - "incorrect value for signature[46], expected 46, is %d", - check_msg->signature[46]); - ck_assert_msg(check_msg->signature[47] == 47, - "incorrect value for signature[47], expected 47, is %d", - check_msg->signature[47]); - ck_assert_msg(check_msg->signature[48] == 48, - "incorrect value for signature[48], expected 48, is %d", - check_msg->signature[48]); - ck_assert_msg(check_msg->signature[49] == 49, - "incorrect value for signature[49], expected 49, is %d", - check_msg->signature[49]); - ck_assert_msg(check_msg->signature[50] == 50, - "incorrect value for signature[50], expected 50, is %d", - check_msg->signature[50]); - ck_assert_msg(check_msg->signature[51] == 51, - "incorrect value for signature[51], expected 51, is %d", - check_msg->signature[51]); - ck_assert_msg(check_msg->signature[52] == 52, - "incorrect value for signature[52], expected 52, is %d", - check_msg->signature[52]); - ck_assert_msg(check_msg->signature[53] == 53, - "incorrect value for signature[53], expected 53, is %d", - check_msg->signature[53]); - ck_assert_msg(check_msg->signature[54] == 54, - "incorrect value for signature[54], expected 54, is %d", - check_msg->signature[54]); - ck_assert_msg(check_msg->signature[55] == 55, - "incorrect value for signature[55], expected 55, is %d", - check_msg->signature[55]); - ck_assert_msg(check_msg->signature[56] == 56, - "incorrect value for signature[56], expected 56, is %d", - check_msg->signature[56]); - ck_assert_msg(check_msg->signature[57] == 57, - "incorrect value for signature[57], expected 57, is %d", - check_msg->signature[57]); - ck_assert_msg(check_msg->signature[58] == 58, - "incorrect value for signature[58], expected 58, is %d", - check_msg->signature[58]); - ck_assert_msg(check_msg->signature[59] == 59, - "incorrect value for signature[59], expected 59, is %d", - check_msg->signature[59]); - ck_assert_msg(check_msg->signature[60] == 60, - "incorrect value for signature[60], expected 60, is %d", - check_msg->signature[60]); - ck_assert_msg(check_msg->signature[61] == 61, - "incorrect value for signature[61], expected 61, is %d", - check_msg->signature[61]); - ck_assert_msg(check_msg->signature[62] == 62, - "incorrect value for signature[62], expected 62, is %d", - check_msg->signature[62]); - ck_assert_msg(check_msg->signature[63] == 63, - "incorrect value for signature[63], expected 63, is %d", - check_msg->signature[63]); - ck_assert_msg( - check_msg->signed_messages[0] == 5000, - "incorrect value for signed_messages[0], expected 5000, is %d", - check_msg->signed_messages[0]); - ck_assert_msg( - check_msg->signed_messages[1] == 5234, - "incorrect value for signed_messages[1], expected 5234, is %d", - check_msg->signed_messages[1]); - ck_assert_msg( - check_msg->signed_messages[2] == 5468, - "incorrect value for signed_messages[2], expected 5468, is %d", - check_msg->signed_messages[2]); - ck_assert_msg( - check_msg->signed_messages[3] == 5702, - "incorrect value for signed_messages[3], expected 5702, is %d", - check_msg->signed_messages[3]); - ck_assert_msg( - check_msg->signed_messages[4] == 5936, - "incorrect value for signed_messages[4], expected 5936, is %d", - check_msg->signed_messages[4]); - ck_assert_msg( - check_msg->signed_messages[5] == 6170, - "incorrect value for signed_messages[5], expected 6170, is %d", - check_msg->signed_messages[5]); - ck_assert_msg( - check_msg->signed_messages[6] == 6404, - "incorrect value for signed_messages[6], expected 6404, is %d", - check_msg->signed_messages[6]); - ck_assert_msg( - check_msg->signed_messages[7] == 6638, - "incorrect value for signed_messages[7], expected 6638, is %d", - check_msg->signed_messages[7]); - ck_assert_msg( - check_msg->signed_messages[8] == 6872, - "incorrect value for signed_messages[8], expected 6872, is %d", - check_msg->signed_messages[8]); - ck_assert_msg( - check_msg->signed_messages[9] == 7106, - "incorrect value for signed_messages[9], expected 7106, is %d", - check_msg->signed_messages[9]); - ck_assert_msg( - check_msg->signed_messages[10] == 7340, - "incorrect value for signed_messages[10], expected 7340, is %d", - check_msg->signed_messages[10]); - ck_assert_msg( - check_msg->signed_messages[11] == 7574, - "incorrect value for signed_messages[11], expected 7574, is %d", - check_msg->signed_messages[11]); - ck_assert_msg( - check_msg->signed_messages[12] == 7808, - "incorrect value for signed_messages[12], expected 7808, is %d", - check_msg->signed_messages[12]); - ck_assert_msg( - check_msg->signed_messages[13] == 8042, - "incorrect value for signed_messages[13], expected 8042, is %d", - check_msg->signed_messages[13]); - ck_assert_msg( - check_msg->signed_messages[14] == 8276, - "incorrect value for signed_messages[14], expected 8276, is %d", - check_msg->signed_messages[14]); - ck_assert_msg( - check_msg->signed_messages[15] == 8510, - "incorrect value for signed_messages[15], expected 8510, is %d", - check_msg->signed_messages[15]); - ck_assert_msg( - check_msg->signed_messages[16] == 8744, - "incorrect value for signed_messages[16], expected 8744, is %d", - check_msg->signed_messages[16]); - ck_assert_msg( - check_msg->signed_messages[17] == 8978, - "incorrect value for signed_messages[17], expected 8978, is %d", - check_msg->signed_messages[17]); - ck_assert_msg( - check_msg->signed_messages[18] == 9212, - "incorrect value for signed_messages[18], expected 9212, is %d", - check_msg->signed_messages[18]); - ck_assert_msg( - check_msg->signed_messages[19] == 9446, - "incorrect value for signed_messages[19], expected 9446, is %d", - check_msg->signed_messages[19]); - ck_assert_msg( - check_msg->signed_messages[20] == 9680, - "incorrect value for signed_messages[20], expected 9680, is %d", - check_msg->signed_messages[20]); - ck_assert_msg( - check_msg->signed_messages[21] == 9914, - "incorrect value for signed_messages[21], expected 9914, is %d", - check_msg->signed_messages[21]); - ck_assert_msg( - check_msg->signed_messages[22] == 10148, - "incorrect value for signed_messages[22], expected 10148, is %d", - check_msg->signed_messages[22]); - ck_assert_msg( - check_msg->signed_messages[23] == 10382, - "incorrect value for signed_messages[23], expected 10382, is %d", - check_msg->signed_messages[23]); - ck_assert_msg( - check_msg->signed_messages[24] == 10616, - "incorrect value for signed_messages[24], expected 10616, is %d", - check_msg->signed_messages[24]); - ck_assert_msg(check_msg->stream_counter == 1, - "incorrect value for stream_counter, expected 1, is %d", - check_msg->stream_counter); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_signing_MsgEd25519SignatureDepB_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_signing_MsgEd25519SignatureDepB"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_signing_MsgEd25519SignatureDepB"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_signing_MsgEd25519SignatureDepB); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_solution_meta_MsgSolnMeta.c b/c/test/legacy/auto_check_sbp_solution_meta_MsgSolnMeta.c deleted file mode 100644 index bb00129e1c..0000000000 --- a/c/test/legacy/auto_check_sbp_solution_meta_MsgSolnMeta.c +++ /dev/null @@ -1,1801 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/soln_meta/test_MsgSolnMeta.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_solution_meta_MsgSolnMeta) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xff0e, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xff0e, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 14, 255, 0, 60, 254, 48, 208, 65, 216, 122, 45, 196, 160, - 144, 228, 8, 83, 89, 87, 3, 213, 95, 109, 86, 131, 71, 70, - 84, 73, 131, 26, 82, 247, 140, 97, 115, 110, 118, 253, 2, 122, - 186, 148, 122, 148, 180, 231, 68, 46, 190, 102, 243, 48, 192, 15, - 208, 89, 56, 10, 245, 2, 254, 201, 120, 32, 126, 2, 83, 161, - 238, 123, 102, 230, 76, 190, 225, 182, 207, 228, 7, 218, 117, 89, - 29, 191, 56, 248, 185, 255, 46, 18, 72, 142, 82, 113, 26, 4, - 172, 254, 178, 136, 113, 115, 58, 193, 89, 227, 182, 246, 76, 77, - 108, 245, 41, 31, 70, 124, 249, 145, 15, 78, 228, 38, 241, 129, - 8, 176, 251, 72, 248, 80, 115, 244, 231, 145, 191, 190, 178, 168, - 89, 233, 69, 176, 174, 140, 182, 141, 81, 82, 92, 79, 101, 223, - 100, 64, 184, 215, 124, 37, 21, 227, 135, 102, 72, 36, 219, 56, - 146, 90, 219, 104, 227, 102, 83, 12, 41, 122, 173, 94, 1, 174, - 134, 130, 104, 237, 116, 249, 107, 230, 130, 123, 25, 162, 57, 223, - 193, 174, 146, 193, 239, 44, 246, 197, 214, 80, 83, 100, 66, 72, - 133, 137, 140, 82, 2, 2, 96, 9, 96, 158, 134, 97, 43, 129, - 141, 25, 183, 200, 214, 57, 248, 103, 222, 65, 195, 15, 244, 21, - 180, 46, 140, 130, 36, 17, 194, 209, 65, 254, 115, 103, 152, 129, - 234, 235, 194, 234, 170, 201, 210, 154, 150, 247, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_soln_meta_t *test_msg = (msg_soln_meta_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->age_corrections = 21256; - test_msg->age_gnss = 3573765977; - test_msg->hdop = 41156; - test_msg->pdop = 11642; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[0].flags = 109; - test_msg->sol_in[0].sensor_type = 95; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[1].flags = 131; - test_msg->sol_in[1].sensor_type = 86; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[2].flags = 70; - test_msg->sol_in[2].sensor_type = 71; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[3].flags = 73; - test_msg->sol_in[3].sensor_type = 84; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[4].flags = 26; - test_msg->sol_in[4].sensor_type = 131; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[5].flags = 247; - test_msg->sol_in[5].sensor_type = 82; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[6].flags = 97; - test_msg->sol_in[6].sensor_type = 140; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[7].flags = 110; - test_msg->sol_in[7].sensor_type = 115; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[8].flags = 253; - test_msg->sol_in[8].sensor_type = 118; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[9].flags = 122; - test_msg->sol_in[9].sensor_type = 2; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[10].flags = 148; - test_msg->sol_in[10].sensor_type = 186; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[11].flags = 148; - test_msg->sol_in[11].sensor_type = 122; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[12].flags = 231; - test_msg->sol_in[12].sensor_type = 180; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[13].flags = 46; - test_msg->sol_in[13].sensor_type = 68; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[14].flags = 102; - test_msg->sol_in[14].sensor_type = 190; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[15].flags = 48; - test_msg->sol_in[15].sensor_type = 243; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[16].flags = 15; - test_msg->sol_in[16].sensor_type = 192; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[17].flags = 89; - test_msg->sol_in[17].sensor_type = 208; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[18].flags = 10; - test_msg->sol_in[18].sensor_type = 56; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[19].flags = 2; - test_msg->sol_in[19].sensor_type = 245; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[20].flags = 201; - test_msg->sol_in[20].sensor_type = 254; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[21].flags = 32; - test_msg->sol_in[21].sensor_type = 120; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[22].flags = 2; - test_msg->sol_in[22].sensor_type = 126; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[23].flags = 161; - test_msg->sol_in[23].sensor_type = 83; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[24].flags = 123; - test_msg->sol_in[24].sensor_type = 238; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[25].flags = 230; - test_msg->sol_in[25].sensor_type = 102; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[26].flags = 190; - test_msg->sol_in[26].sensor_type = 76; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[27].flags = 182; - test_msg->sol_in[27].sensor_type = 225; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[28].flags = 228; - test_msg->sol_in[28].sensor_type = 207; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[29].flags = 218; - test_msg->sol_in[29].sensor_type = 7; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[30].flags = 89; - test_msg->sol_in[30].sensor_type = 117; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[31].flags = 191; - test_msg->sol_in[31].sensor_type = 29; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[32].flags = 248; - test_msg->sol_in[32].sensor_type = 56; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[33].flags = 255; - test_msg->sol_in[33].sensor_type = 185; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[34].flags = 18; - test_msg->sol_in[34].sensor_type = 46; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[35].flags = 142; - test_msg->sol_in[35].sensor_type = 72; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[36].flags = 113; - test_msg->sol_in[36].sensor_type = 82; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[37].flags = 4; - test_msg->sol_in[37].sensor_type = 26; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[38].flags = 254; - test_msg->sol_in[38].sensor_type = 172; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[39].flags = 136; - test_msg->sol_in[39].sensor_type = 178; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[40].flags = 115; - test_msg->sol_in[40].sensor_type = 113; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[41].flags = 193; - test_msg->sol_in[41].sensor_type = 58; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[42].flags = 227; - test_msg->sol_in[42].sensor_type = 89; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[43].flags = 246; - test_msg->sol_in[43].sensor_type = 182; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[44].flags = 77; - test_msg->sol_in[44].sensor_type = 76; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[45].flags = 245; - test_msg->sol_in[45].sensor_type = 108; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[46].flags = 31; - test_msg->sol_in[46].sensor_type = 41; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[47].flags = 124; - test_msg->sol_in[47].sensor_type = 70; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[48].flags = 145; - test_msg->sol_in[48].sensor_type = 249; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[49].flags = 78; - test_msg->sol_in[49].sensor_type = 15; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[50].flags = 38; - test_msg->sol_in[50].sensor_type = 228; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[51].flags = 129; - test_msg->sol_in[51].sensor_type = 241; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[52].flags = 176; - test_msg->sol_in[52].sensor_type = 8; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[53].flags = 72; - test_msg->sol_in[53].sensor_type = 251; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[54].flags = 80; - test_msg->sol_in[54].sensor_type = 248; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[55].flags = 244; - test_msg->sol_in[55].sensor_type = 115; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[56].flags = 145; - test_msg->sol_in[56].sensor_type = 231; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[57].flags = 190; - test_msg->sol_in[57].sensor_type = 191; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[58].flags = 168; - test_msg->sol_in[58].sensor_type = 178; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[59].flags = 233; - test_msg->sol_in[59].sensor_type = 89; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[60].flags = 176; - test_msg->sol_in[60].sensor_type = 69; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[61].flags = 140; - test_msg->sol_in[61].sensor_type = 174; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[62].flags = 141; - test_msg->sol_in[62].sensor_type = 182; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[63].flags = 82; - test_msg->sol_in[63].sensor_type = 81; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[64].flags = 79; - test_msg->sol_in[64].sensor_type = 92; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[65].flags = 223; - test_msg->sol_in[65].sensor_type = 101; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[66].flags = 64; - test_msg->sol_in[66].sensor_type = 100; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[67].flags = 215; - test_msg->sol_in[67].sensor_type = 184; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[68].flags = 37; - test_msg->sol_in[68].sensor_type = 124; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[69].flags = 227; - test_msg->sol_in[69].sensor_type = 21; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[70].flags = 102; - test_msg->sol_in[70].sensor_type = 135; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[71].flags = 36; - test_msg->sol_in[71].sensor_type = 72; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[72].flags = 56; - test_msg->sol_in[72].sensor_type = 219; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[73].flags = 90; - test_msg->sol_in[73].sensor_type = 146; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[74].flags = 104; - test_msg->sol_in[74].sensor_type = 219; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[75].flags = 102; - test_msg->sol_in[75].sensor_type = 227; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[76].flags = 12; - test_msg->sol_in[76].sensor_type = 83; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[77].flags = 122; - test_msg->sol_in[77].sensor_type = 41; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[78].flags = 94; - test_msg->sol_in[78].sensor_type = 173; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[79].flags = 174; - test_msg->sol_in[79].sensor_type = 1; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[80].flags = 130; - test_msg->sol_in[80].sensor_type = 134; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[81].flags = 237; - test_msg->sol_in[81].sensor_type = 104; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[82].flags = 249; - test_msg->sol_in[82].sensor_type = 116; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[83].flags = 230; - test_msg->sol_in[83].sensor_type = 107; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[84].flags = 123; - test_msg->sol_in[84].sensor_type = 130; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[85].flags = 162; - test_msg->sol_in[85].sensor_type = 25; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[86].flags = 223; - test_msg->sol_in[86].sensor_type = 57; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[87].flags = 174; - test_msg->sol_in[87].sensor_type = 193; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[88].flags = 193; - test_msg->sol_in[88].sensor_type = 146; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[89].flags = 44; - test_msg->sol_in[89].sensor_type = 239; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[90].flags = 197; - test_msg->sol_in[90].sensor_type = 246; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[91].flags = 80; - test_msg->sol_in[91].sensor_type = 214; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[92].flags = 100; - test_msg->sol_in[92].sensor_type = 83; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[93].flags = 72; - test_msg->sol_in[93].sensor_type = 66; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[94].flags = 137; - test_msg->sol_in[94].sensor_type = 133; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[95].flags = 82; - test_msg->sol_in[95].sensor_type = 140; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[96].flags = 2; - test_msg->sol_in[96].sensor_type = 2; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[97].flags = 9; - test_msg->sol_in[97].sensor_type = 96; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[98].flags = 158; - test_msg->sol_in[98].sensor_type = 96; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[99].flags = 97; - test_msg->sol_in[99].sensor_type = 134; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[100].flags = 129; - test_msg->sol_in[100].sensor_type = 43; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[101].flags = 25; - test_msg->sol_in[101].sensor_type = 141; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[102].flags = 200; - test_msg->sol_in[102].sensor_type = 183; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[103].flags = 57; - test_msg->sol_in[103].sensor_type = 214; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[104].flags = 103; - test_msg->sol_in[104].sensor_type = 248; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[105].flags = 65; - test_msg->sol_in[105].sensor_type = 222; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[106].flags = 15; - test_msg->sol_in[106].sensor_type = 195; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[107].flags = 21; - test_msg->sol_in[107].sensor_type = 244; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[108].flags = 46; - test_msg->sol_in[108].sensor_type = 180; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[109].flags = 130; - test_msg->sol_in[109].sensor_type = 140; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[110].flags = 17; - test_msg->sol_in[110].sensor_type = 36; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[111].flags = 209; - test_msg->sol_in[111].sensor_type = 194; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[112].flags = 254; - test_msg->sol_in[112].sensor_type = 65; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[113].flags = 103; - test_msg->sol_in[113].sensor_type = 115; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[114].flags = 129; - test_msg->sol_in[114].sensor_type = 152; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[115].flags = 235; - test_msg->sol_in[115].sensor_type = 234; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[116].flags = 234; - test_msg->sol_in[116].sensor_type = 194; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[117].flags = 201; - test_msg->sol_in[117].sensor_type = 170; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[118].flags = 154; - test_msg->sol_in[118].sensor_type = 210; - test_msg->tow = 3628191792; - test_msg->vdop = 58512; - sbp_payload_send(&sbp_state, 0xff0e, 15360, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 15360, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 15360, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xff0e, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_soln_meta_t *check_msg = (msg_soln_meta_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->age_corrections == 21256, - "incorrect value for age_corrections, expected 21256, is %d", - check_msg->age_corrections); - ck_assert_msg(check_msg->age_gnss == 3573765977, - "incorrect value for age_gnss, expected 3573765977, is %d", - check_msg->age_gnss); - ck_assert_msg(check_msg->hdop == 41156, - "incorrect value for hdop, expected 41156, is %d", - check_msg->hdop); - ck_assert_msg(check_msg->pdop == 11642, - "incorrect value for pdop, expected 11642, is %d", - check_msg->pdop); - ck_assert_msg(check_msg->sol_in[0].flags == 109, - "incorrect value for sol_in[0].flags, expected 109, is %d", - check_msg->sol_in[0].flags); - ck_assert_msg( - check_msg->sol_in[0].sensor_type == 95, - "incorrect value for sol_in[0].sensor_type, expected 95, is %d", - check_msg->sol_in[0].sensor_type); - ck_assert_msg(check_msg->sol_in[1].flags == 131, - "incorrect value for sol_in[1].flags, expected 131, is %d", - check_msg->sol_in[1].flags); - ck_assert_msg( - check_msg->sol_in[1].sensor_type == 86, - "incorrect value for sol_in[1].sensor_type, expected 86, is %d", - check_msg->sol_in[1].sensor_type); - ck_assert_msg(check_msg->sol_in[2].flags == 70, - "incorrect value for sol_in[2].flags, expected 70, is %d", - check_msg->sol_in[2].flags); - ck_assert_msg( - check_msg->sol_in[2].sensor_type == 71, - "incorrect value for sol_in[2].sensor_type, expected 71, is %d", - check_msg->sol_in[2].sensor_type); - ck_assert_msg(check_msg->sol_in[3].flags == 73, - "incorrect value for sol_in[3].flags, expected 73, is %d", - check_msg->sol_in[3].flags); - ck_assert_msg( - check_msg->sol_in[3].sensor_type == 84, - "incorrect value for sol_in[3].sensor_type, expected 84, is %d", - check_msg->sol_in[3].sensor_type); - ck_assert_msg(check_msg->sol_in[4].flags == 26, - "incorrect value for sol_in[4].flags, expected 26, is %d", - check_msg->sol_in[4].flags); - ck_assert_msg( - check_msg->sol_in[4].sensor_type == 131, - "incorrect value for sol_in[4].sensor_type, expected 131, is %d", - check_msg->sol_in[4].sensor_type); - ck_assert_msg(check_msg->sol_in[5].flags == 247, - "incorrect value for sol_in[5].flags, expected 247, is %d", - check_msg->sol_in[5].flags); - ck_assert_msg( - check_msg->sol_in[5].sensor_type == 82, - "incorrect value for sol_in[5].sensor_type, expected 82, is %d", - check_msg->sol_in[5].sensor_type); - ck_assert_msg(check_msg->sol_in[6].flags == 97, - "incorrect value for sol_in[6].flags, expected 97, is %d", - check_msg->sol_in[6].flags); - ck_assert_msg( - check_msg->sol_in[6].sensor_type == 140, - "incorrect value for sol_in[6].sensor_type, expected 140, is %d", - check_msg->sol_in[6].sensor_type); - ck_assert_msg(check_msg->sol_in[7].flags == 110, - "incorrect value for sol_in[7].flags, expected 110, is %d", - check_msg->sol_in[7].flags); - ck_assert_msg( - check_msg->sol_in[7].sensor_type == 115, - "incorrect value for sol_in[7].sensor_type, expected 115, is %d", - check_msg->sol_in[7].sensor_type); - ck_assert_msg(check_msg->sol_in[8].flags == 253, - "incorrect value for sol_in[8].flags, expected 253, is %d", - check_msg->sol_in[8].flags); - ck_assert_msg( - check_msg->sol_in[8].sensor_type == 118, - "incorrect value for sol_in[8].sensor_type, expected 118, is %d", - check_msg->sol_in[8].sensor_type); - ck_assert_msg(check_msg->sol_in[9].flags == 122, - "incorrect value for sol_in[9].flags, expected 122, is %d", - check_msg->sol_in[9].flags); - ck_assert_msg( - check_msg->sol_in[9].sensor_type == 2, - "incorrect value for sol_in[9].sensor_type, expected 2, is %d", - check_msg->sol_in[9].sensor_type); - ck_assert_msg(check_msg->sol_in[10].flags == 148, - "incorrect value for sol_in[10].flags, expected 148, is %d", - check_msg->sol_in[10].flags); - ck_assert_msg( - check_msg->sol_in[10].sensor_type == 186, - "incorrect value for sol_in[10].sensor_type, expected 186, is %d", - check_msg->sol_in[10].sensor_type); - ck_assert_msg(check_msg->sol_in[11].flags == 148, - "incorrect value for sol_in[11].flags, expected 148, is %d", - check_msg->sol_in[11].flags); - ck_assert_msg( - check_msg->sol_in[11].sensor_type == 122, - "incorrect value for sol_in[11].sensor_type, expected 122, is %d", - check_msg->sol_in[11].sensor_type); - ck_assert_msg(check_msg->sol_in[12].flags == 231, - "incorrect value for sol_in[12].flags, expected 231, is %d", - check_msg->sol_in[12].flags); - ck_assert_msg( - check_msg->sol_in[12].sensor_type == 180, - "incorrect value for sol_in[12].sensor_type, expected 180, is %d", - check_msg->sol_in[12].sensor_type); - ck_assert_msg(check_msg->sol_in[13].flags == 46, - "incorrect value for sol_in[13].flags, expected 46, is %d", - check_msg->sol_in[13].flags); - ck_assert_msg( - check_msg->sol_in[13].sensor_type == 68, - "incorrect value for sol_in[13].sensor_type, expected 68, is %d", - check_msg->sol_in[13].sensor_type); - ck_assert_msg(check_msg->sol_in[14].flags == 102, - "incorrect value for sol_in[14].flags, expected 102, is %d", - check_msg->sol_in[14].flags); - ck_assert_msg( - check_msg->sol_in[14].sensor_type == 190, - "incorrect value for sol_in[14].sensor_type, expected 190, is %d", - check_msg->sol_in[14].sensor_type); - ck_assert_msg(check_msg->sol_in[15].flags == 48, - "incorrect value for sol_in[15].flags, expected 48, is %d", - check_msg->sol_in[15].flags); - ck_assert_msg( - check_msg->sol_in[15].sensor_type == 243, - "incorrect value for sol_in[15].sensor_type, expected 243, is %d", - check_msg->sol_in[15].sensor_type); - ck_assert_msg(check_msg->sol_in[16].flags == 15, - "incorrect value for sol_in[16].flags, expected 15, is %d", - check_msg->sol_in[16].flags); - ck_assert_msg( - check_msg->sol_in[16].sensor_type == 192, - "incorrect value for sol_in[16].sensor_type, expected 192, is %d", - check_msg->sol_in[16].sensor_type); - ck_assert_msg(check_msg->sol_in[17].flags == 89, - "incorrect value for sol_in[17].flags, expected 89, is %d", - check_msg->sol_in[17].flags); - ck_assert_msg( - check_msg->sol_in[17].sensor_type == 208, - "incorrect value for sol_in[17].sensor_type, expected 208, is %d", - check_msg->sol_in[17].sensor_type); - ck_assert_msg(check_msg->sol_in[18].flags == 10, - "incorrect value for sol_in[18].flags, expected 10, is %d", - check_msg->sol_in[18].flags); - ck_assert_msg( - check_msg->sol_in[18].sensor_type == 56, - "incorrect value for sol_in[18].sensor_type, expected 56, is %d", - check_msg->sol_in[18].sensor_type); - ck_assert_msg(check_msg->sol_in[19].flags == 2, - "incorrect value for sol_in[19].flags, expected 2, is %d", - check_msg->sol_in[19].flags); - ck_assert_msg( - check_msg->sol_in[19].sensor_type == 245, - "incorrect value for sol_in[19].sensor_type, expected 245, is %d", - check_msg->sol_in[19].sensor_type); - ck_assert_msg(check_msg->sol_in[20].flags == 201, - "incorrect value for sol_in[20].flags, expected 201, is %d", - check_msg->sol_in[20].flags); - ck_assert_msg( - check_msg->sol_in[20].sensor_type == 254, - "incorrect value for sol_in[20].sensor_type, expected 254, is %d", - check_msg->sol_in[20].sensor_type); - ck_assert_msg(check_msg->sol_in[21].flags == 32, - "incorrect value for sol_in[21].flags, expected 32, is %d", - check_msg->sol_in[21].flags); - ck_assert_msg( - check_msg->sol_in[21].sensor_type == 120, - "incorrect value for sol_in[21].sensor_type, expected 120, is %d", - check_msg->sol_in[21].sensor_type); - ck_assert_msg(check_msg->sol_in[22].flags == 2, - "incorrect value for sol_in[22].flags, expected 2, is %d", - check_msg->sol_in[22].flags); - ck_assert_msg( - check_msg->sol_in[22].sensor_type == 126, - "incorrect value for sol_in[22].sensor_type, expected 126, is %d", - check_msg->sol_in[22].sensor_type); - ck_assert_msg(check_msg->sol_in[23].flags == 161, - "incorrect value for sol_in[23].flags, expected 161, is %d", - check_msg->sol_in[23].flags); - ck_assert_msg( - check_msg->sol_in[23].sensor_type == 83, - "incorrect value for sol_in[23].sensor_type, expected 83, is %d", - check_msg->sol_in[23].sensor_type); - ck_assert_msg(check_msg->sol_in[24].flags == 123, - "incorrect value for sol_in[24].flags, expected 123, is %d", - check_msg->sol_in[24].flags); - ck_assert_msg( - check_msg->sol_in[24].sensor_type == 238, - "incorrect value for sol_in[24].sensor_type, expected 238, is %d", - check_msg->sol_in[24].sensor_type); - ck_assert_msg(check_msg->sol_in[25].flags == 230, - "incorrect value for sol_in[25].flags, expected 230, is %d", - check_msg->sol_in[25].flags); - ck_assert_msg( - check_msg->sol_in[25].sensor_type == 102, - "incorrect value for sol_in[25].sensor_type, expected 102, is %d", - check_msg->sol_in[25].sensor_type); - ck_assert_msg(check_msg->sol_in[26].flags == 190, - "incorrect value for sol_in[26].flags, expected 190, is %d", - check_msg->sol_in[26].flags); - ck_assert_msg( - check_msg->sol_in[26].sensor_type == 76, - "incorrect value for sol_in[26].sensor_type, expected 76, is %d", - check_msg->sol_in[26].sensor_type); - ck_assert_msg(check_msg->sol_in[27].flags == 182, - "incorrect value for sol_in[27].flags, expected 182, is %d", - check_msg->sol_in[27].flags); - ck_assert_msg( - check_msg->sol_in[27].sensor_type == 225, - "incorrect value for sol_in[27].sensor_type, expected 225, is %d", - check_msg->sol_in[27].sensor_type); - ck_assert_msg(check_msg->sol_in[28].flags == 228, - "incorrect value for sol_in[28].flags, expected 228, is %d", - check_msg->sol_in[28].flags); - ck_assert_msg( - check_msg->sol_in[28].sensor_type == 207, - "incorrect value for sol_in[28].sensor_type, expected 207, is %d", - check_msg->sol_in[28].sensor_type); - ck_assert_msg(check_msg->sol_in[29].flags == 218, - "incorrect value for sol_in[29].flags, expected 218, is %d", - check_msg->sol_in[29].flags); - ck_assert_msg( - check_msg->sol_in[29].sensor_type == 7, - "incorrect value for sol_in[29].sensor_type, expected 7, is %d", - check_msg->sol_in[29].sensor_type); - ck_assert_msg(check_msg->sol_in[30].flags == 89, - "incorrect value for sol_in[30].flags, expected 89, is %d", - check_msg->sol_in[30].flags); - ck_assert_msg( - check_msg->sol_in[30].sensor_type == 117, - "incorrect value for sol_in[30].sensor_type, expected 117, is %d", - check_msg->sol_in[30].sensor_type); - ck_assert_msg(check_msg->sol_in[31].flags == 191, - "incorrect value for sol_in[31].flags, expected 191, is %d", - check_msg->sol_in[31].flags); - ck_assert_msg( - check_msg->sol_in[31].sensor_type == 29, - "incorrect value for sol_in[31].sensor_type, expected 29, is %d", - check_msg->sol_in[31].sensor_type); - ck_assert_msg(check_msg->sol_in[32].flags == 248, - "incorrect value for sol_in[32].flags, expected 248, is %d", - check_msg->sol_in[32].flags); - ck_assert_msg( - check_msg->sol_in[32].sensor_type == 56, - "incorrect value for sol_in[32].sensor_type, expected 56, is %d", - check_msg->sol_in[32].sensor_type); - ck_assert_msg(check_msg->sol_in[33].flags == 255, - "incorrect value for sol_in[33].flags, expected 255, is %d", - check_msg->sol_in[33].flags); - ck_assert_msg( - check_msg->sol_in[33].sensor_type == 185, - "incorrect value for sol_in[33].sensor_type, expected 185, is %d", - check_msg->sol_in[33].sensor_type); - ck_assert_msg(check_msg->sol_in[34].flags == 18, - "incorrect value for sol_in[34].flags, expected 18, is %d", - check_msg->sol_in[34].flags); - ck_assert_msg( - check_msg->sol_in[34].sensor_type == 46, - "incorrect value for sol_in[34].sensor_type, expected 46, is %d", - check_msg->sol_in[34].sensor_type); - ck_assert_msg(check_msg->sol_in[35].flags == 142, - "incorrect value for sol_in[35].flags, expected 142, is %d", - check_msg->sol_in[35].flags); - ck_assert_msg( - check_msg->sol_in[35].sensor_type == 72, - "incorrect value for sol_in[35].sensor_type, expected 72, is %d", - check_msg->sol_in[35].sensor_type); - ck_assert_msg(check_msg->sol_in[36].flags == 113, - "incorrect value for sol_in[36].flags, expected 113, is %d", - check_msg->sol_in[36].flags); - ck_assert_msg( - check_msg->sol_in[36].sensor_type == 82, - "incorrect value for sol_in[36].sensor_type, expected 82, is %d", - check_msg->sol_in[36].sensor_type); - ck_assert_msg(check_msg->sol_in[37].flags == 4, - "incorrect value for sol_in[37].flags, expected 4, is %d", - check_msg->sol_in[37].flags); - ck_assert_msg( - check_msg->sol_in[37].sensor_type == 26, - "incorrect value for sol_in[37].sensor_type, expected 26, is %d", - check_msg->sol_in[37].sensor_type); - ck_assert_msg(check_msg->sol_in[38].flags == 254, - "incorrect value for sol_in[38].flags, expected 254, is %d", - check_msg->sol_in[38].flags); - ck_assert_msg( - check_msg->sol_in[38].sensor_type == 172, - "incorrect value for sol_in[38].sensor_type, expected 172, is %d", - check_msg->sol_in[38].sensor_type); - ck_assert_msg(check_msg->sol_in[39].flags == 136, - "incorrect value for sol_in[39].flags, expected 136, is %d", - check_msg->sol_in[39].flags); - ck_assert_msg( - check_msg->sol_in[39].sensor_type == 178, - "incorrect value for sol_in[39].sensor_type, expected 178, is %d", - check_msg->sol_in[39].sensor_type); - ck_assert_msg(check_msg->sol_in[40].flags == 115, - "incorrect value for sol_in[40].flags, expected 115, is %d", - check_msg->sol_in[40].flags); - ck_assert_msg( - check_msg->sol_in[40].sensor_type == 113, - "incorrect value for sol_in[40].sensor_type, expected 113, is %d", - check_msg->sol_in[40].sensor_type); - ck_assert_msg(check_msg->sol_in[41].flags == 193, - "incorrect value for sol_in[41].flags, expected 193, is %d", - check_msg->sol_in[41].flags); - ck_assert_msg( - check_msg->sol_in[41].sensor_type == 58, - "incorrect value for sol_in[41].sensor_type, expected 58, is %d", - check_msg->sol_in[41].sensor_type); - ck_assert_msg(check_msg->sol_in[42].flags == 227, - "incorrect value for sol_in[42].flags, expected 227, is %d", - check_msg->sol_in[42].flags); - ck_assert_msg( - check_msg->sol_in[42].sensor_type == 89, - "incorrect value for sol_in[42].sensor_type, expected 89, is %d", - check_msg->sol_in[42].sensor_type); - ck_assert_msg(check_msg->sol_in[43].flags == 246, - "incorrect value for sol_in[43].flags, expected 246, is %d", - check_msg->sol_in[43].flags); - ck_assert_msg( - check_msg->sol_in[43].sensor_type == 182, - "incorrect value for sol_in[43].sensor_type, expected 182, is %d", - check_msg->sol_in[43].sensor_type); - ck_assert_msg(check_msg->sol_in[44].flags == 77, - "incorrect value for sol_in[44].flags, expected 77, is %d", - check_msg->sol_in[44].flags); - ck_assert_msg( - check_msg->sol_in[44].sensor_type == 76, - "incorrect value for sol_in[44].sensor_type, expected 76, is %d", - check_msg->sol_in[44].sensor_type); - ck_assert_msg(check_msg->sol_in[45].flags == 245, - "incorrect value for sol_in[45].flags, expected 245, is %d", - check_msg->sol_in[45].flags); - ck_assert_msg( - check_msg->sol_in[45].sensor_type == 108, - "incorrect value for sol_in[45].sensor_type, expected 108, is %d", - check_msg->sol_in[45].sensor_type); - ck_assert_msg(check_msg->sol_in[46].flags == 31, - "incorrect value for sol_in[46].flags, expected 31, is %d", - check_msg->sol_in[46].flags); - ck_assert_msg( - check_msg->sol_in[46].sensor_type == 41, - "incorrect value for sol_in[46].sensor_type, expected 41, is %d", - check_msg->sol_in[46].sensor_type); - ck_assert_msg(check_msg->sol_in[47].flags == 124, - "incorrect value for sol_in[47].flags, expected 124, is %d", - check_msg->sol_in[47].flags); - ck_assert_msg( - check_msg->sol_in[47].sensor_type == 70, - "incorrect value for sol_in[47].sensor_type, expected 70, is %d", - check_msg->sol_in[47].sensor_type); - ck_assert_msg(check_msg->sol_in[48].flags == 145, - "incorrect value for sol_in[48].flags, expected 145, is %d", - check_msg->sol_in[48].flags); - ck_assert_msg( - check_msg->sol_in[48].sensor_type == 249, - "incorrect value for sol_in[48].sensor_type, expected 249, is %d", - check_msg->sol_in[48].sensor_type); - ck_assert_msg(check_msg->sol_in[49].flags == 78, - "incorrect value for sol_in[49].flags, expected 78, is %d", - check_msg->sol_in[49].flags); - ck_assert_msg( - check_msg->sol_in[49].sensor_type == 15, - "incorrect value for sol_in[49].sensor_type, expected 15, is %d", - check_msg->sol_in[49].sensor_type); - ck_assert_msg(check_msg->sol_in[50].flags == 38, - "incorrect value for sol_in[50].flags, expected 38, is %d", - check_msg->sol_in[50].flags); - ck_assert_msg( - check_msg->sol_in[50].sensor_type == 228, - "incorrect value for sol_in[50].sensor_type, expected 228, is %d", - check_msg->sol_in[50].sensor_type); - ck_assert_msg(check_msg->sol_in[51].flags == 129, - "incorrect value for sol_in[51].flags, expected 129, is %d", - check_msg->sol_in[51].flags); - ck_assert_msg( - check_msg->sol_in[51].sensor_type == 241, - "incorrect value for sol_in[51].sensor_type, expected 241, is %d", - check_msg->sol_in[51].sensor_type); - ck_assert_msg(check_msg->sol_in[52].flags == 176, - "incorrect value for sol_in[52].flags, expected 176, is %d", - check_msg->sol_in[52].flags); - ck_assert_msg( - check_msg->sol_in[52].sensor_type == 8, - "incorrect value for sol_in[52].sensor_type, expected 8, is %d", - check_msg->sol_in[52].sensor_type); - ck_assert_msg(check_msg->sol_in[53].flags == 72, - "incorrect value for sol_in[53].flags, expected 72, is %d", - check_msg->sol_in[53].flags); - ck_assert_msg( - check_msg->sol_in[53].sensor_type == 251, - "incorrect value for sol_in[53].sensor_type, expected 251, is %d", - check_msg->sol_in[53].sensor_type); - ck_assert_msg(check_msg->sol_in[54].flags == 80, - "incorrect value for sol_in[54].flags, expected 80, is %d", - check_msg->sol_in[54].flags); - ck_assert_msg( - check_msg->sol_in[54].sensor_type == 248, - "incorrect value for sol_in[54].sensor_type, expected 248, is %d", - check_msg->sol_in[54].sensor_type); - ck_assert_msg(check_msg->sol_in[55].flags == 244, - "incorrect value for sol_in[55].flags, expected 244, is %d", - check_msg->sol_in[55].flags); - ck_assert_msg( - check_msg->sol_in[55].sensor_type == 115, - "incorrect value for sol_in[55].sensor_type, expected 115, is %d", - check_msg->sol_in[55].sensor_type); - ck_assert_msg(check_msg->sol_in[56].flags == 145, - "incorrect value for sol_in[56].flags, expected 145, is %d", - check_msg->sol_in[56].flags); - ck_assert_msg( - check_msg->sol_in[56].sensor_type == 231, - "incorrect value for sol_in[56].sensor_type, expected 231, is %d", - check_msg->sol_in[56].sensor_type); - ck_assert_msg(check_msg->sol_in[57].flags == 190, - "incorrect value for sol_in[57].flags, expected 190, is %d", - check_msg->sol_in[57].flags); - ck_assert_msg( - check_msg->sol_in[57].sensor_type == 191, - "incorrect value for sol_in[57].sensor_type, expected 191, is %d", - check_msg->sol_in[57].sensor_type); - ck_assert_msg(check_msg->sol_in[58].flags == 168, - "incorrect value for sol_in[58].flags, expected 168, is %d", - check_msg->sol_in[58].flags); - ck_assert_msg( - check_msg->sol_in[58].sensor_type == 178, - "incorrect value for sol_in[58].sensor_type, expected 178, is %d", - check_msg->sol_in[58].sensor_type); - ck_assert_msg(check_msg->sol_in[59].flags == 233, - "incorrect value for sol_in[59].flags, expected 233, is %d", - check_msg->sol_in[59].flags); - ck_assert_msg( - check_msg->sol_in[59].sensor_type == 89, - "incorrect value for sol_in[59].sensor_type, expected 89, is %d", - check_msg->sol_in[59].sensor_type); - ck_assert_msg(check_msg->sol_in[60].flags == 176, - "incorrect value for sol_in[60].flags, expected 176, is %d", - check_msg->sol_in[60].flags); - ck_assert_msg( - check_msg->sol_in[60].sensor_type == 69, - "incorrect value for sol_in[60].sensor_type, expected 69, is %d", - check_msg->sol_in[60].sensor_type); - ck_assert_msg(check_msg->sol_in[61].flags == 140, - "incorrect value for sol_in[61].flags, expected 140, is %d", - check_msg->sol_in[61].flags); - ck_assert_msg( - check_msg->sol_in[61].sensor_type == 174, - "incorrect value for sol_in[61].sensor_type, expected 174, is %d", - check_msg->sol_in[61].sensor_type); - ck_assert_msg(check_msg->sol_in[62].flags == 141, - "incorrect value for sol_in[62].flags, expected 141, is %d", - check_msg->sol_in[62].flags); - ck_assert_msg( - check_msg->sol_in[62].sensor_type == 182, - "incorrect value for sol_in[62].sensor_type, expected 182, is %d", - check_msg->sol_in[62].sensor_type); - ck_assert_msg(check_msg->sol_in[63].flags == 82, - "incorrect value for sol_in[63].flags, expected 82, is %d", - check_msg->sol_in[63].flags); - ck_assert_msg( - check_msg->sol_in[63].sensor_type == 81, - "incorrect value for sol_in[63].sensor_type, expected 81, is %d", - check_msg->sol_in[63].sensor_type); - ck_assert_msg(check_msg->sol_in[64].flags == 79, - "incorrect value for sol_in[64].flags, expected 79, is %d", - check_msg->sol_in[64].flags); - ck_assert_msg( - check_msg->sol_in[64].sensor_type == 92, - "incorrect value for sol_in[64].sensor_type, expected 92, is %d", - check_msg->sol_in[64].sensor_type); - ck_assert_msg(check_msg->sol_in[65].flags == 223, - "incorrect value for sol_in[65].flags, expected 223, is %d", - check_msg->sol_in[65].flags); - ck_assert_msg( - check_msg->sol_in[65].sensor_type == 101, - "incorrect value for sol_in[65].sensor_type, expected 101, is %d", - check_msg->sol_in[65].sensor_type); - ck_assert_msg(check_msg->sol_in[66].flags == 64, - "incorrect value for sol_in[66].flags, expected 64, is %d", - check_msg->sol_in[66].flags); - ck_assert_msg( - check_msg->sol_in[66].sensor_type == 100, - "incorrect value for sol_in[66].sensor_type, expected 100, is %d", - check_msg->sol_in[66].sensor_type); - ck_assert_msg(check_msg->sol_in[67].flags == 215, - "incorrect value for sol_in[67].flags, expected 215, is %d", - check_msg->sol_in[67].flags); - ck_assert_msg( - check_msg->sol_in[67].sensor_type == 184, - "incorrect value for sol_in[67].sensor_type, expected 184, is %d", - check_msg->sol_in[67].sensor_type); - ck_assert_msg(check_msg->sol_in[68].flags == 37, - "incorrect value for sol_in[68].flags, expected 37, is %d", - check_msg->sol_in[68].flags); - ck_assert_msg( - check_msg->sol_in[68].sensor_type == 124, - "incorrect value for sol_in[68].sensor_type, expected 124, is %d", - check_msg->sol_in[68].sensor_type); - ck_assert_msg(check_msg->sol_in[69].flags == 227, - "incorrect value for sol_in[69].flags, expected 227, is %d", - check_msg->sol_in[69].flags); - ck_assert_msg( - check_msg->sol_in[69].sensor_type == 21, - "incorrect value for sol_in[69].sensor_type, expected 21, is %d", - check_msg->sol_in[69].sensor_type); - ck_assert_msg(check_msg->sol_in[70].flags == 102, - "incorrect value for sol_in[70].flags, expected 102, is %d", - check_msg->sol_in[70].flags); - ck_assert_msg( - check_msg->sol_in[70].sensor_type == 135, - "incorrect value for sol_in[70].sensor_type, expected 135, is %d", - check_msg->sol_in[70].sensor_type); - ck_assert_msg(check_msg->sol_in[71].flags == 36, - "incorrect value for sol_in[71].flags, expected 36, is %d", - check_msg->sol_in[71].flags); - ck_assert_msg( - check_msg->sol_in[71].sensor_type == 72, - "incorrect value for sol_in[71].sensor_type, expected 72, is %d", - check_msg->sol_in[71].sensor_type); - ck_assert_msg(check_msg->sol_in[72].flags == 56, - "incorrect value for sol_in[72].flags, expected 56, is %d", - check_msg->sol_in[72].flags); - ck_assert_msg( - check_msg->sol_in[72].sensor_type == 219, - "incorrect value for sol_in[72].sensor_type, expected 219, is %d", - check_msg->sol_in[72].sensor_type); - ck_assert_msg(check_msg->sol_in[73].flags == 90, - "incorrect value for sol_in[73].flags, expected 90, is %d", - check_msg->sol_in[73].flags); - ck_assert_msg( - check_msg->sol_in[73].sensor_type == 146, - "incorrect value for sol_in[73].sensor_type, expected 146, is %d", - check_msg->sol_in[73].sensor_type); - ck_assert_msg(check_msg->sol_in[74].flags == 104, - "incorrect value for sol_in[74].flags, expected 104, is %d", - check_msg->sol_in[74].flags); - ck_assert_msg( - check_msg->sol_in[74].sensor_type == 219, - "incorrect value for sol_in[74].sensor_type, expected 219, is %d", - check_msg->sol_in[74].sensor_type); - ck_assert_msg(check_msg->sol_in[75].flags == 102, - "incorrect value for sol_in[75].flags, expected 102, is %d", - check_msg->sol_in[75].flags); - ck_assert_msg( - check_msg->sol_in[75].sensor_type == 227, - "incorrect value for sol_in[75].sensor_type, expected 227, is %d", - check_msg->sol_in[75].sensor_type); - ck_assert_msg(check_msg->sol_in[76].flags == 12, - "incorrect value for sol_in[76].flags, expected 12, is %d", - check_msg->sol_in[76].flags); - ck_assert_msg( - check_msg->sol_in[76].sensor_type == 83, - "incorrect value for sol_in[76].sensor_type, expected 83, is %d", - check_msg->sol_in[76].sensor_type); - ck_assert_msg(check_msg->sol_in[77].flags == 122, - "incorrect value for sol_in[77].flags, expected 122, is %d", - check_msg->sol_in[77].flags); - ck_assert_msg( - check_msg->sol_in[77].sensor_type == 41, - "incorrect value for sol_in[77].sensor_type, expected 41, is %d", - check_msg->sol_in[77].sensor_type); - ck_assert_msg(check_msg->sol_in[78].flags == 94, - "incorrect value for sol_in[78].flags, expected 94, is %d", - check_msg->sol_in[78].flags); - ck_assert_msg( - check_msg->sol_in[78].sensor_type == 173, - "incorrect value for sol_in[78].sensor_type, expected 173, is %d", - check_msg->sol_in[78].sensor_type); - ck_assert_msg(check_msg->sol_in[79].flags == 174, - "incorrect value for sol_in[79].flags, expected 174, is %d", - check_msg->sol_in[79].flags); - ck_assert_msg( - check_msg->sol_in[79].sensor_type == 1, - "incorrect value for sol_in[79].sensor_type, expected 1, is %d", - check_msg->sol_in[79].sensor_type); - ck_assert_msg(check_msg->sol_in[80].flags == 130, - "incorrect value for sol_in[80].flags, expected 130, is %d", - check_msg->sol_in[80].flags); - ck_assert_msg( - check_msg->sol_in[80].sensor_type == 134, - "incorrect value for sol_in[80].sensor_type, expected 134, is %d", - check_msg->sol_in[80].sensor_type); - ck_assert_msg(check_msg->sol_in[81].flags == 237, - "incorrect value for sol_in[81].flags, expected 237, is %d", - check_msg->sol_in[81].flags); - ck_assert_msg( - check_msg->sol_in[81].sensor_type == 104, - "incorrect value for sol_in[81].sensor_type, expected 104, is %d", - check_msg->sol_in[81].sensor_type); - ck_assert_msg(check_msg->sol_in[82].flags == 249, - "incorrect value for sol_in[82].flags, expected 249, is %d", - check_msg->sol_in[82].flags); - ck_assert_msg( - check_msg->sol_in[82].sensor_type == 116, - "incorrect value for sol_in[82].sensor_type, expected 116, is %d", - check_msg->sol_in[82].sensor_type); - ck_assert_msg(check_msg->sol_in[83].flags == 230, - "incorrect value for sol_in[83].flags, expected 230, is %d", - check_msg->sol_in[83].flags); - ck_assert_msg( - check_msg->sol_in[83].sensor_type == 107, - "incorrect value for sol_in[83].sensor_type, expected 107, is %d", - check_msg->sol_in[83].sensor_type); - ck_assert_msg(check_msg->sol_in[84].flags == 123, - "incorrect value for sol_in[84].flags, expected 123, is %d", - check_msg->sol_in[84].flags); - ck_assert_msg( - check_msg->sol_in[84].sensor_type == 130, - "incorrect value for sol_in[84].sensor_type, expected 130, is %d", - check_msg->sol_in[84].sensor_type); - ck_assert_msg(check_msg->sol_in[85].flags == 162, - "incorrect value for sol_in[85].flags, expected 162, is %d", - check_msg->sol_in[85].flags); - ck_assert_msg( - check_msg->sol_in[85].sensor_type == 25, - "incorrect value for sol_in[85].sensor_type, expected 25, is %d", - check_msg->sol_in[85].sensor_type); - ck_assert_msg(check_msg->sol_in[86].flags == 223, - "incorrect value for sol_in[86].flags, expected 223, is %d", - check_msg->sol_in[86].flags); - ck_assert_msg( - check_msg->sol_in[86].sensor_type == 57, - "incorrect value for sol_in[86].sensor_type, expected 57, is %d", - check_msg->sol_in[86].sensor_type); - ck_assert_msg(check_msg->sol_in[87].flags == 174, - "incorrect value for sol_in[87].flags, expected 174, is %d", - check_msg->sol_in[87].flags); - ck_assert_msg( - check_msg->sol_in[87].sensor_type == 193, - "incorrect value for sol_in[87].sensor_type, expected 193, is %d", - check_msg->sol_in[87].sensor_type); - ck_assert_msg(check_msg->sol_in[88].flags == 193, - "incorrect value for sol_in[88].flags, expected 193, is %d", - check_msg->sol_in[88].flags); - ck_assert_msg( - check_msg->sol_in[88].sensor_type == 146, - "incorrect value for sol_in[88].sensor_type, expected 146, is %d", - check_msg->sol_in[88].sensor_type); - ck_assert_msg(check_msg->sol_in[89].flags == 44, - "incorrect value for sol_in[89].flags, expected 44, is %d", - check_msg->sol_in[89].flags); - ck_assert_msg( - check_msg->sol_in[89].sensor_type == 239, - "incorrect value for sol_in[89].sensor_type, expected 239, is %d", - check_msg->sol_in[89].sensor_type); - ck_assert_msg(check_msg->sol_in[90].flags == 197, - "incorrect value for sol_in[90].flags, expected 197, is %d", - check_msg->sol_in[90].flags); - ck_assert_msg( - check_msg->sol_in[90].sensor_type == 246, - "incorrect value for sol_in[90].sensor_type, expected 246, is %d", - check_msg->sol_in[90].sensor_type); - ck_assert_msg(check_msg->sol_in[91].flags == 80, - "incorrect value for sol_in[91].flags, expected 80, is %d", - check_msg->sol_in[91].flags); - ck_assert_msg( - check_msg->sol_in[91].sensor_type == 214, - "incorrect value for sol_in[91].sensor_type, expected 214, is %d", - check_msg->sol_in[91].sensor_type); - ck_assert_msg(check_msg->sol_in[92].flags == 100, - "incorrect value for sol_in[92].flags, expected 100, is %d", - check_msg->sol_in[92].flags); - ck_assert_msg( - check_msg->sol_in[92].sensor_type == 83, - "incorrect value for sol_in[92].sensor_type, expected 83, is %d", - check_msg->sol_in[92].sensor_type); - ck_assert_msg(check_msg->sol_in[93].flags == 72, - "incorrect value for sol_in[93].flags, expected 72, is %d", - check_msg->sol_in[93].flags); - ck_assert_msg( - check_msg->sol_in[93].sensor_type == 66, - "incorrect value for sol_in[93].sensor_type, expected 66, is %d", - check_msg->sol_in[93].sensor_type); - ck_assert_msg(check_msg->sol_in[94].flags == 137, - "incorrect value for sol_in[94].flags, expected 137, is %d", - check_msg->sol_in[94].flags); - ck_assert_msg( - check_msg->sol_in[94].sensor_type == 133, - "incorrect value for sol_in[94].sensor_type, expected 133, is %d", - check_msg->sol_in[94].sensor_type); - ck_assert_msg(check_msg->sol_in[95].flags == 82, - "incorrect value for sol_in[95].flags, expected 82, is %d", - check_msg->sol_in[95].flags); - ck_assert_msg( - check_msg->sol_in[95].sensor_type == 140, - "incorrect value for sol_in[95].sensor_type, expected 140, is %d", - check_msg->sol_in[95].sensor_type); - ck_assert_msg(check_msg->sol_in[96].flags == 2, - "incorrect value for sol_in[96].flags, expected 2, is %d", - check_msg->sol_in[96].flags); - ck_assert_msg( - check_msg->sol_in[96].sensor_type == 2, - "incorrect value for sol_in[96].sensor_type, expected 2, is %d", - check_msg->sol_in[96].sensor_type); - ck_assert_msg(check_msg->sol_in[97].flags == 9, - "incorrect value for sol_in[97].flags, expected 9, is %d", - check_msg->sol_in[97].flags); - ck_assert_msg( - check_msg->sol_in[97].sensor_type == 96, - "incorrect value for sol_in[97].sensor_type, expected 96, is %d", - check_msg->sol_in[97].sensor_type); - ck_assert_msg(check_msg->sol_in[98].flags == 158, - "incorrect value for sol_in[98].flags, expected 158, is %d", - check_msg->sol_in[98].flags); - ck_assert_msg( - check_msg->sol_in[98].sensor_type == 96, - "incorrect value for sol_in[98].sensor_type, expected 96, is %d", - check_msg->sol_in[98].sensor_type); - ck_assert_msg(check_msg->sol_in[99].flags == 97, - "incorrect value for sol_in[99].flags, expected 97, is %d", - check_msg->sol_in[99].flags); - ck_assert_msg( - check_msg->sol_in[99].sensor_type == 134, - "incorrect value for sol_in[99].sensor_type, expected 134, is %d", - check_msg->sol_in[99].sensor_type); - ck_assert_msg(check_msg->sol_in[100].flags == 129, - "incorrect value for sol_in[100].flags, expected 129, is %d", - check_msg->sol_in[100].flags); - ck_assert_msg( - check_msg->sol_in[100].sensor_type == 43, - "incorrect value for sol_in[100].sensor_type, expected 43, is %d", - check_msg->sol_in[100].sensor_type); - ck_assert_msg(check_msg->sol_in[101].flags == 25, - "incorrect value for sol_in[101].flags, expected 25, is %d", - check_msg->sol_in[101].flags); - ck_assert_msg( - check_msg->sol_in[101].sensor_type == 141, - "incorrect value for sol_in[101].sensor_type, expected 141, is %d", - check_msg->sol_in[101].sensor_type); - ck_assert_msg(check_msg->sol_in[102].flags == 200, - "incorrect value for sol_in[102].flags, expected 200, is %d", - check_msg->sol_in[102].flags); - ck_assert_msg( - check_msg->sol_in[102].sensor_type == 183, - "incorrect value for sol_in[102].sensor_type, expected 183, is %d", - check_msg->sol_in[102].sensor_type); - ck_assert_msg(check_msg->sol_in[103].flags == 57, - "incorrect value for sol_in[103].flags, expected 57, is %d", - check_msg->sol_in[103].flags); - ck_assert_msg( - check_msg->sol_in[103].sensor_type == 214, - "incorrect value for sol_in[103].sensor_type, expected 214, is %d", - check_msg->sol_in[103].sensor_type); - ck_assert_msg(check_msg->sol_in[104].flags == 103, - "incorrect value for sol_in[104].flags, expected 103, is %d", - check_msg->sol_in[104].flags); - ck_assert_msg( - check_msg->sol_in[104].sensor_type == 248, - "incorrect value for sol_in[104].sensor_type, expected 248, is %d", - check_msg->sol_in[104].sensor_type); - ck_assert_msg(check_msg->sol_in[105].flags == 65, - "incorrect value for sol_in[105].flags, expected 65, is %d", - check_msg->sol_in[105].flags); - ck_assert_msg( - check_msg->sol_in[105].sensor_type == 222, - "incorrect value for sol_in[105].sensor_type, expected 222, is %d", - check_msg->sol_in[105].sensor_type); - ck_assert_msg(check_msg->sol_in[106].flags == 15, - "incorrect value for sol_in[106].flags, expected 15, is %d", - check_msg->sol_in[106].flags); - ck_assert_msg( - check_msg->sol_in[106].sensor_type == 195, - "incorrect value for sol_in[106].sensor_type, expected 195, is %d", - check_msg->sol_in[106].sensor_type); - ck_assert_msg(check_msg->sol_in[107].flags == 21, - "incorrect value for sol_in[107].flags, expected 21, is %d", - check_msg->sol_in[107].flags); - ck_assert_msg( - check_msg->sol_in[107].sensor_type == 244, - "incorrect value for sol_in[107].sensor_type, expected 244, is %d", - check_msg->sol_in[107].sensor_type); - ck_assert_msg(check_msg->sol_in[108].flags == 46, - "incorrect value for sol_in[108].flags, expected 46, is %d", - check_msg->sol_in[108].flags); - ck_assert_msg( - check_msg->sol_in[108].sensor_type == 180, - "incorrect value for sol_in[108].sensor_type, expected 180, is %d", - check_msg->sol_in[108].sensor_type); - ck_assert_msg(check_msg->sol_in[109].flags == 130, - "incorrect value for sol_in[109].flags, expected 130, is %d", - check_msg->sol_in[109].flags); - ck_assert_msg( - check_msg->sol_in[109].sensor_type == 140, - "incorrect value for sol_in[109].sensor_type, expected 140, is %d", - check_msg->sol_in[109].sensor_type); - ck_assert_msg(check_msg->sol_in[110].flags == 17, - "incorrect value for sol_in[110].flags, expected 17, is %d", - check_msg->sol_in[110].flags); - ck_assert_msg( - check_msg->sol_in[110].sensor_type == 36, - "incorrect value for sol_in[110].sensor_type, expected 36, is %d", - check_msg->sol_in[110].sensor_type); - ck_assert_msg(check_msg->sol_in[111].flags == 209, - "incorrect value for sol_in[111].flags, expected 209, is %d", - check_msg->sol_in[111].flags); - ck_assert_msg( - check_msg->sol_in[111].sensor_type == 194, - "incorrect value for sol_in[111].sensor_type, expected 194, is %d", - check_msg->sol_in[111].sensor_type); - ck_assert_msg(check_msg->sol_in[112].flags == 254, - "incorrect value for sol_in[112].flags, expected 254, is %d", - check_msg->sol_in[112].flags); - ck_assert_msg( - check_msg->sol_in[112].sensor_type == 65, - "incorrect value for sol_in[112].sensor_type, expected 65, is %d", - check_msg->sol_in[112].sensor_type); - ck_assert_msg(check_msg->sol_in[113].flags == 103, - "incorrect value for sol_in[113].flags, expected 103, is %d", - check_msg->sol_in[113].flags); - ck_assert_msg( - check_msg->sol_in[113].sensor_type == 115, - "incorrect value for sol_in[113].sensor_type, expected 115, is %d", - check_msg->sol_in[113].sensor_type); - ck_assert_msg(check_msg->sol_in[114].flags == 129, - "incorrect value for sol_in[114].flags, expected 129, is %d", - check_msg->sol_in[114].flags); - ck_assert_msg( - check_msg->sol_in[114].sensor_type == 152, - "incorrect value for sol_in[114].sensor_type, expected 152, is %d", - check_msg->sol_in[114].sensor_type); - ck_assert_msg(check_msg->sol_in[115].flags == 235, - "incorrect value for sol_in[115].flags, expected 235, is %d", - check_msg->sol_in[115].flags); - ck_assert_msg( - check_msg->sol_in[115].sensor_type == 234, - "incorrect value for sol_in[115].sensor_type, expected 234, is %d", - check_msg->sol_in[115].sensor_type); - ck_assert_msg(check_msg->sol_in[116].flags == 234, - "incorrect value for sol_in[116].flags, expected 234, is %d", - check_msg->sol_in[116].flags); - ck_assert_msg( - check_msg->sol_in[116].sensor_type == 194, - "incorrect value for sol_in[116].sensor_type, expected 194, is %d", - check_msg->sol_in[116].sensor_type); - ck_assert_msg(check_msg->sol_in[117].flags == 201, - "incorrect value for sol_in[117].flags, expected 201, is %d", - check_msg->sol_in[117].flags); - ck_assert_msg( - check_msg->sol_in[117].sensor_type == 170, - "incorrect value for sol_in[117].sensor_type, expected 170, is %d", - check_msg->sol_in[117].sensor_type); - ck_assert_msg(check_msg->sol_in[118].flags == 154, - "incorrect value for sol_in[118].flags, expected 154, is %d", - check_msg->sol_in[118].flags); - ck_assert_msg( - check_msg->sol_in[118].sensor_type == 210, - "incorrect value for sol_in[118].sensor_type, expected 210, is %d", - check_msg->sol_in[118].sensor_type); - ck_assert_msg(check_msg->tow == 3628191792, - "incorrect value for tow, expected 3628191792, is %d", - check_msg->tow); - ck_assert_msg(check_msg->vdop == 58512, - "incorrect value for vdop, expected 58512, is %d", - check_msg->vdop); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_solution_meta_MsgSolnMeta_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_solution_meta_MsgSolnMeta"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_solution_meta_MsgSolnMeta"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_solution_meta_MsgSolnMeta); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_solution_meta_MsgSolnMetaDepA.c b/c/test/legacy/auto_check_sbp_solution_meta_MsgSolnMetaDepA.c deleted file mode 100644 index 67421d6786..0000000000 --- a/c/test/legacy/auto_check_sbp_solution_meta_MsgSolnMetaDepA.c +++ /dev/null @@ -1,1800 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/soln_meta/test_MsgSolnMetaDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_solution_meta_MsgSolnMetaDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xff0f, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xff0f, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 15, 255, 84, 241, 254, 183, 222, 157, 121, 5, 164, 238, 31, - 190, 115, 93, 59, 103, 36, 83, 161, 156, 46, 253, 67, 87, 200, - 39, 250, 245, 242, 228, 72, 18, 222, 11, 88, 207, 218, 231, 13, - 226, 224, 22, 196, 21, 242, 12, 89, 71, 219, 182, 85, 145, 204, - 146, 40, 204, 51, 21, 153, 227, 44, 15, 28, 255, 39, 205, 216, - 240, 190, 93, 219, 103, 42, 41, 182, 76, 222, 17, 23, 125, 31, - 18, 229, 28, 47, 214, 25, 100, 84, 106, 72, 48, 10, 222, 232, - 235, 73, 109, 163, 51, 152, 133, 235, 87, 70, 2, 108, 91, 101, - 200, 55, 24, 156, 233, 73, 39, 66, 97, 140, 252, 227, 230, 237, - 135, 241, 245, 205, 70, 0, 219, 188, 107, 136, 178, 58, 1, 29, - 44, 213, 225, 147, 190, 96, 192, 108, 228, 15, 203, 18, 3, 222, - 180, 68, 101, 229, 223, 203, 243, 164, 92, 165, 220, 159, 174, 121, - 112, 167, 240, 40, 59, 3, 230, 52, 149, 148, 218, 142, 212, 109, - 176, 71, 179, 172, 77, 1, 193, 70, 147, 149, 23, 144, 148, 239, - 195, 186, 86, 30, 34, 143, 156, 207, 63, 55, 117, 255, 222, 222, - 219, 145, 224, 191, 210, 109, 86, 153, 21, 32, 226, 10, 60, 63, - 106, 236, 93, 96, 30, 163, 106, 238, 147, 133, 132, 107, 152, 214, - 221, 185, 202, 21, 252, 51, 130, 59, 166, 202, 127, 170, 58, 193, - 215, 125, 22, 58, 135, 47, 88, 142, 77, 211, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_soln_meta_dep_a_t *test_msg = (msg_soln_meta_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->age_corrections = 48671; - test_msg->alignment_status = 115; - test_msg->hdop = 31133; - test_msg->last_used_gnss_pos_tow = 610745181; - test_msg->last_used_gnss_vel_tow = 782016851; - test_msg->n_sats = 238; - test_msg->pdop = 57015; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[0].flags = 67; - test_msg->sol_in[0].sensor_type = 253; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[1].flags = 200; - test_msg->sol_in[1].sensor_type = 87; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[2].flags = 250; - test_msg->sol_in[2].sensor_type = 39; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[3].flags = 242; - test_msg->sol_in[3].sensor_type = 245; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[4].flags = 72; - test_msg->sol_in[4].sensor_type = 228; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[5].flags = 222; - test_msg->sol_in[5].sensor_type = 18; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[6].flags = 88; - test_msg->sol_in[6].sensor_type = 11; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[7].flags = 218; - test_msg->sol_in[7].sensor_type = 207; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[8].flags = 13; - test_msg->sol_in[8].sensor_type = 231; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[9].flags = 224; - test_msg->sol_in[9].sensor_type = 226; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[10].flags = 196; - test_msg->sol_in[10].sensor_type = 22; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[11].flags = 242; - test_msg->sol_in[11].sensor_type = 21; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[12].flags = 89; - test_msg->sol_in[12].sensor_type = 12; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[13].flags = 219; - test_msg->sol_in[13].sensor_type = 71; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[14].flags = 85; - test_msg->sol_in[14].sensor_type = 182; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[15].flags = 204; - test_msg->sol_in[15].sensor_type = 145; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[16].flags = 40; - test_msg->sol_in[16].sensor_type = 146; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[17].flags = 51; - test_msg->sol_in[17].sensor_type = 204; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[18].flags = 153; - test_msg->sol_in[18].sensor_type = 21; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[19].flags = 44; - test_msg->sol_in[19].sensor_type = 227; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[20].flags = 28; - test_msg->sol_in[20].sensor_type = 15; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[21].flags = 39; - test_msg->sol_in[21].sensor_type = 255; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[22].flags = 216; - test_msg->sol_in[22].sensor_type = 205; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[23].flags = 190; - test_msg->sol_in[23].sensor_type = 240; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[24].flags = 219; - test_msg->sol_in[24].sensor_type = 93; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[25].flags = 42; - test_msg->sol_in[25].sensor_type = 103; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[26].flags = 182; - test_msg->sol_in[26].sensor_type = 41; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[27].flags = 222; - test_msg->sol_in[27].sensor_type = 76; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[28].flags = 23; - test_msg->sol_in[28].sensor_type = 17; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[29].flags = 31; - test_msg->sol_in[29].sensor_type = 125; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[30].flags = 229; - test_msg->sol_in[30].sensor_type = 18; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[31].flags = 47; - test_msg->sol_in[31].sensor_type = 28; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[32].flags = 25; - test_msg->sol_in[32].sensor_type = 214; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[33].flags = 84; - test_msg->sol_in[33].sensor_type = 100; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[34].flags = 72; - test_msg->sol_in[34].sensor_type = 106; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[35].flags = 10; - test_msg->sol_in[35].sensor_type = 48; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[36].flags = 232; - test_msg->sol_in[36].sensor_type = 222; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[37].flags = 73; - test_msg->sol_in[37].sensor_type = 235; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[38].flags = 163; - test_msg->sol_in[38].sensor_type = 109; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[39].flags = 152; - test_msg->sol_in[39].sensor_type = 51; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[40].flags = 235; - test_msg->sol_in[40].sensor_type = 133; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[41].flags = 70; - test_msg->sol_in[41].sensor_type = 87; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[42].flags = 108; - test_msg->sol_in[42].sensor_type = 2; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[43].flags = 101; - test_msg->sol_in[43].sensor_type = 91; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[44].flags = 55; - test_msg->sol_in[44].sensor_type = 200; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[45].flags = 156; - test_msg->sol_in[45].sensor_type = 24; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[46].flags = 73; - test_msg->sol_in[46].sensor_type = 233; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[47].flags = 66; - test_msg->sol_in[47].sensor_type = 39; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[48].flags = 140; - test_msg->sol_in[48].sensor_type = 97; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[49].flags = 227; - test_msg->sol_in[49].sensor_type = 252; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[50].flags = 237; - test_msg->sol_in[50].sensor_type = 230; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[51].flags = 241; - test_msg->sol_in[51].sensor_type = 135; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[52].flags = 205; - test_msg->sol_in[52].sensor_type = 245; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[53].flags = 0; - test_msg->sol_in[53].sensor_type = 70; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[54].flags = 188; - test_msg->sol_in[54].sensor_type = 219; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[55].flags = 136; - test_msg->sol_in[55].sensor_type = 107; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[56].flags = 58; - test_msg->sol_in[56].sensor_type = 178; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[57].flags = 29; - test_msg->sol_in[57].sensor_type = 1; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[58].flags = 213; - test_msg->sol_in[58].sensor_type = 44; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[59].flags = 147; - test_msg->sol_in[59].sensor_type = 225; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[60].flags = 96; - test_msg->sol_in[60].sensor_type = 190; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[61].flags = 108; - test_msg->sol_in[61].sensor_type = 192; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[62].flags = 15; - test_msg->sol_in[62].sensor_type = 228; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[63].flags = 18; - test_msg->sol_in[63].sensor_type = 203; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[64].flags = 222; - test_msg->sol_in[64].sensor_type = 3; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[65].flags = 68; - test_msg->sol_in[65].sensor_type = 180; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[66].flags = 229; - test_msg->sol_in[66].sensor_type = 101; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[67].flags = 203; - test_msg->sol_in[67].sensor_type = 223; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[68].flags = 164; - test_msg->sol_in[68].sensor_type = 243; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[69].flags = 165; - test_msg->sol_in[69].sensor_type = 92; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[70].flags = 159; - test_msg->sol_in[70].sensor_type = 220; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[71].flags = 121; - test_msg->sol_in[71].sensor_type = 174; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[72].flags = 167; - test_msg->sol_in[72].sensor_type = 112; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[73].flags = 40; - test_msg->sol_in[73].sensor_type = 240; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[74].flags = 3; - test_msg->sol_in[74].sensor_type = 59; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[75].flags = 52; - test_msg->sol_in[75].sensor_type = 230; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[76].flags = 148; - test_msg->sol_in[76].sensor_type = 149; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[77].flags = 142; - test_msg->sol_in[77].sensor_type = 218; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[78].flags = 109; - test_msg->sol_in[78].sensor_type = 212; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[79].flags = 71; - test_msg->sol_in[79].sensor_type = 176; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[80].flags = 172; - test_msg->sol_in[80].sensor_type = 179; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[81].flags = 1; - test_msg->sol_in[81].sensor_type = 77; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[82].flags = 70; - test_msg->sol_in[82].sensor_type = 193; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[83].flags = 149; - test_msg->sol_in[83].sensor_type = 147; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[84].flags = 144; - test_msg->sol_in[84].sensor_type = 23; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[85].flags = 239; - test_msg->sol_in[85].sensor_type = 148; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[86].flags = 186; - test_msg->sol_in[86].sensor_type = 195; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[87].flags = 30; - test_msg->sol_in[87].sensor_type = 86; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[88].flags = 143; - test_msg->sol_in[88].sensor_type = 34; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[89].flags = 207; - test_msg->sol_in[89].sensor_type = 156; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[90].flags = 55; - test_msg->sol_in[90].sensor_type = 63; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[91].flags = 255; - test_msg->sol_in[91].sensor_type = 117; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[92].flags = 222; - test_msg->sol_in[92].sensor_type = 222; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[93].flags = 145; - test_msg->sol_in[93].sensor_type = 219; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[94].flags = 191; - test_msg->sol_in[94].sensor_type = 224; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[95].flags = 109; - test_msg->sol_in[95].sensor_type = 210; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[96].flags = 153; - test_msg->sol_in[96].sensor_type = 86; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[97].flags = 32; - test_msg->sol_in[97].sensor_type = 21; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[98].flags = 10; - test_msg->sol_in[98].sensor_type = 226; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[99].flags = 63; - test_msg->sol_in[99].sensor_type = 60; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[100].flags = 236; - test_msg->sol_in[100].sensor_type = 106; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[101].flags = 96; - test_msg->sol_in[101].sensor_type = 93; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[102].flags = 163; - test_msg->sol_in[102].sensor_type = 30; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[103].flags = 238; - test_msg->sol_in[103].sensor_type = 106; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[104].flags = 133; - test_msg->sol_in[104].sensor_type = 147; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[105].flags = 107; - test_msg->sol_in[105].sensor_type = 132; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[106].flags = 214; - test_msg->sol_in[106].sensor_type = 152; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[107].flags = 185; - test_msg->sol_in[107].sensor_type = 221; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[108].flags = 21; - test_msg->sol_in[108].sensor_type = 202; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[109].flags = 51; - test_msg->sol_in[109].sensor_type = 252; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[110].flags = 59; - test_msg->sol_in[110].sensor_type = 130; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[111].flags = 202; - test_msg->sol_in[111].sensor_type = 166; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[112].flags = 170; - test_msg->sol_in[112].sensor_type = 127; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[113].flags = 193; - test_msg->sol_in[113].sensor_type = 58; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[114].flags = 125; - test_msg->sol_in[114].sensor_type = 215; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[115].flags = 58; - test_msg->sol_in[115].sensor_type = 22; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[116].flags = 47; - test_msg->sol_in[116].sensor_type = 135; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sol_in[0]); - } - test_msg->sol_in[117].flags = 142; - test_msg->sol_in[117].sensor_type = 88; - test_msg->vdop = 41989; - sbp_payload_send(&sbp_state, 0xff0f, 61780, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 61780, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 61780, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xff0f, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_soln_meta_dep_a_t *check_msg = - (msg_soln_meta_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->age_corrections == 48671, - "incorrect value for age_corrections, expected 48671, is %d", - check_msg->age_corrections); - ck_assert_msg(check_msg->alignment_status == 115, - "incorrect value for alignment_status, expected 115, is %d", - check_msg->alignment_status); - ck_assert_msg(check_msg->hdop == 31133, - "incorrect value for hdop, expected 31133, is %d", - check_msg->hdop); - ck_assert_msg( - check_msg->last_used_gnss_pos_tow == 610745181, - "incorrect value for last_used_gnss_pos_tow, expected 610745181, is %d", - check_msg->last_used_gnss_pos_tow); - ck_assert_msg( - check_msg->last_used_gnss_vel_tow == 782016851, - "incorrect value for last_used_gnss_vel_tow, expected 782016851, is %d", - check_msg->last_used_gnss_vel_tow); - ck_assert_msg(check_msg->n_sats == 238, - "incorrect value for n_sats, expected 238, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->pdop == 57015, - "incorrect value for pdop, expected 57015, is %d", - check_msg->pdop); - ck_assert_msg(check_msg->sol_in[0].flags == 67, - "incorrect value for sol_in[0].flags, expected 67, is %d", - check_msg->sol_in[0].flags); - ck_assert_msg( - check_msg->sol_in[0].sensor_type == 253, - "incorrect value for sol_in[0].sensor_type, expected 253, is %d", - check_msg->sol_in[0].sensor_type); - ck_assert_msg(check_msg->sol_in[1].flags == 200, - "incorrect value for sol_in[1].flags, expected 200, is %d", - check_msg->sol_in[1].flags); - ck_assert_msg( - check_msg->sol_in[1].sensor_type == 87, - "incorrect value for sol_in[1].sensor_type, expected 87, is %d", - check_msg->sol_in[1].sensor_type); - ck_assert_msg(check_msg->sol_in[2].flags == 250, - "incorrect value for sol_in[2].flags, expected 250, is %d", - check_msg->sol_in[2].flags); - ck_assert_msg( - check_msg->sol_in[2].sensor_type == 39, - "incorrect value for sol_in[2].sensor_type, expected 39, is %d", - check_msg->sol_in[2].sensor_type); - ck_assert_msg(check_msg->sol_in[3].flags == 242, - "incorrect value for sol_in[3].flags, expected 242, is %d", - check_msg->sol_in[3].flags); - ck_assert_msg( - check_msg->sol_in[3].sensor_type == 245, - "incorrect value for sol_in[3].sensor_type, expected 245, is %d", - check_msg->sol_in[3].sensor_type); - ck_assert_msg(check_msg->sol_in[4].flags == 72, - "incorrect value for sol_in[4].flags, expected 72, is %d", - check_msg->sol_in[4].flags); - ck_assert_msg( - check_msg->sol_in[4].sensor_type == 228, - "incorrect value for sol_in[4].sensor_type, expected 228, is %d", - check_msg->sol_in[4].sensor_type); - ck_assert_msg(check_msg->sol_in[5].flags == 222, - "incorrect value for sol_in[5].flags, expected 222, is %d", - check_msg->sol_in[5].flags); - ck_assert_msg( - check_msg->sol_in[5].sensor_type == 18, - "incorrect value for sol_in[5].sensor_type, expected 18, is %d", - check_msg->sol_in[5].sensor_type); - ck_assert_msg(check_msg->sol_in[6].flags == 88, - "incorrect value for sol_in[6].flags, expected 88, is %d", - check_msg->sol_in[6].flags); - ck_assert_msg( - check_msg->sol_in[6].sensor_type == 11, - "incorrect value for sol_in[6].sensor_type, expected 11, is %d", - check_msg->sol_in[6].sensor_type); - ck_assert_msg(check_msg->sol_in[7].flags == 218, - "incorrect value for sol_in[7].flags, expected 218, is %d", - check_msg->sol_in[7].flags); - ck_assert_msg( - check_msg->sol_in[7].sensor_type == 207, - "incorrect value for sol_in[7].sensor_type, expected 207, is %d", - check_msg->sol_in[7].sensor_type); - ck_assert_msg(check_msg->sol_in[8].flags == 13, - "incorrect value for sol_in[8].flags, expected 13, is %d", - check_msg->sol_in[8].flags); - ck_assert_msg( - check_msg->sol_in[8].sensor_type == 231, - "incorrect value for sol_in[8].sensor_type, expected 231, is %d", - check_msg->sol_in[8].sensor_type); - ck_assert_msg(check_msg->sol_in[9].flags == 224, - "incorrect value for sol_in[9].flags, expected 224, is %d", - check_msg->sol_in[9].flags); - ck_assert_msg( - check_msg->sol_in[9].sensor_type == 226, - "incorrect value for sol_in[9].sensor_type, expected 226, is %d", - check_msg->sol_in[9].sensor_type); - ck_assert_msg(check_msg->sol_in[10].flags == 196, - "incorrect value for sol_in[10].flags, expected 196, is %d", - check_msg->sol_in[10].flags); - ck_assert_msg( - check_msg->sol_in[10].sensor_type == 22, - "incorrect value for sol_in[10].sensor_type, expected 22, is %d", - check_msg->sol_in[10].sensor_type); - ck_assert_msg(check_msg->sol_in[11].flags == 242, - "incorrect value for sol_in[11].flags, expected 242, is %d", - check_msg->sol_in[11].flags); - ck_assert_msg( - check_msg->sol_in[11].sensor_type == 21, - "incorrect value for sol_in[11].sensor_type, expected 21, is %d", - check_msg->sol_in[11].sensor_type); - ck_assert_msg(check_msg->sol_in[12].flags == 89, - "incorrect value for sol_in[12].flags, expected 89, is %d", - check_msg->sol_in[12].flags); - ck_assert_msg( - check_msg->sol_in[12].sensor_type == 12, - "incorrect value for sol_in[12].sensor_type, expected 12, is %d", - check_msg->sol_in[12].sensor_type); - ck_assert_msg(check_msg->sol_in[13].flags == 219, - "incorrect value for sol_in[13].flags, expected 219, is %d", - check_msg->sol_in[13].flags); - ck_assert_msg( - check_msg->sol_in[13].sensor_type == 71, - "incorrect value for sol_in[13].sensor_type, expected 71, is %d", - check_msg->sol_in[13].sensor_type); - ck_assert_msg(check_msg->sol_in[14].flags == 85, - "incorrect value for sol_in[14].flags, expected 85, is %d", - check_msg->sol_in[14].flags); - ck_assert_msg( - check_msg->sol_in[14].sensor_type == 182, - "incorrect value for sol_in[14].sensor_type, expected 182, is %d", - check_msg->sol_in[14].sensor_type); - ck_assert_msg(check_msg->sol_in[15].flags == 204, - "incorrect value for sol_in[15].flags, expected 204, is %d", - check_msg->sol_in[15].flags); - ck_assert_msg( - check_msg->sol_in[15].sensor_type == 145, - "incorrect value for sol_in[15].sensor_type, expected 145, is %d", - check_msg->sol_in[15].sensor_type); - ck_assert_msg(check_msg->sol_in[16].flags == 40, - "incorrect value for sol_in[16].flags, expected 40, is %d", - check_msg->sol_in[16].flags); - ck_assert_msg( - check_msg->sol_in[16].sensor_type == 146, - "incorrect value for sol_in[16].sensor_type, expected 146, is %d", - check_msg->sol_in[16].sensor_type); - ck_assert_msg(check_msg->sol_in[17].flags == 51, - "incorrect value for sol_in[17].flags, expected 51, is %d", - check_msg->sol_in[17].flags); - ck_assert_msg( - check_msg->sol_in[17].sensor_type == 204, - "incorrect value for sol_in[17].sensor_type, expected 204, is %d", - check_msg->sol_in[17].sensor_type); - ck_assert_msg(check_msg->sol_in[18].flags == 153, - "incorrect value for sol_in[18].flags, expected 153, is %d", - check_msg->sol_in[18].flags); - ck_assert_msg( - check_msg->sol_in[18].sensor_type == 21, - "incorrect value for sol_in[18].sensor_type, expected 21, is %d", - check_msg->sol_in[18].sensor_type); - ck_assert_msg(check_msg->sol_in[19].flags == 44, - "incorrect value for sol_in[19].flags, expected 44, is %d", - check_msg->sol_in[19].flags); - ck_assert_msg( - check_msg->sol_in[19].sensor_type == 227, - "incorrect value for sol_in[19].sensor_type, expected 227, is %d", - check_msg->sol_in[19].sensor_type); - ck_assert_msg(check_msg->sol_in[20].flags == 28, - "incorrect value for sol_in[20].flags, expected 28, is %d", - check_msg->sol_in[20].flags); - ck_assert_msg( - check_msg->sol_in[20].sensor_type == 15, - "incorrect value for sol_in[20].sensor_type, expected 15, is %d", - check_msg->sol_in[20].sensor_type); - ck_assert_msg(check_msg->sol_in[21].flags == 39, - "incorrect value for sol_in[21].flags, expected 39, is %d", - check_msg->sol_in[21].flags); - ck_assert_msg( - check_msg->sol_in[21].sensor_type == 255, - "incorrect value for sol_in[21].sensor_type, expected 255, is %d", - check_msg->sol_in[21].sensor_type); - ck_assert_msg(check_msg->sol_in[22].flags == 216, - "incorrect value for sol_in[22].flags, expected 216, is %d", - check_msg->sol_in[22].flags); - ck_assert_msg( - check_msg->sol_in[22].sensor_type == 205, - "incorrect value for sol_in[22].sensor_type, expected 205, is %d", - check_msg->sol_in[22].sensor_type); - ck_assert_msg(check_msg->sol_in[23].flags == 190, - "incorrect value for sol_in[23].flags, expected 190, is %d", - check_msg->sol_in[23].flags); - ck_assert_msg( - check_msg->sol_in[23].sensor_type == 240, - "incorrect value for sol_in[23].sensor_type, expected 240, is %d", - check_msg->sol_in[23].sensor_type); - ck_assert_msg(check_msg->sol_in[24].flags == 219, - "incorrect value for sol_in[24].flags, expected 219, is %d", - check_msg->sol_in[24].flags); - ck_assert_msg( - check_msg->sol_in[24].sensor_type == 93, - "incorrect value for sol_in[24].sensor_type, expected 93, is %d", - check_msg->sol_in[24].sensor_type); - ck_assert_msg(check_msg->sol_in[25].flags == 42, - "incorrect value for sol_in[25].flags, expected 42, is %d", - check_msg->sol_in[25].flags); - ck_assert_msg( - check_msg->sol_in[25].sensor_type == 103, - "incorrect value for sol_in[25].sensor_type, expected 103, is %d", - check_msg->sol_in[25].sensor_type); - ck_assert_msg(check_msg->sol_in[26].flags == 182, - "incorrect value for sol_in[26].flags, expected 182, is %d", - check_msg->sol_in[26].flags); - ck_assert_msg( - check_msg->sol_in[26].sensor_type == 41, - "incorrect value for sol_in[26].sensor_type, expected 41, is %d", - check_msg->sol_in[26].sensor_type); - ck_assert_msg(check_msg->sol_in[27].flags == 222, - "incorrect value for sol_in[27].flags, expected 222, is %d", - check_msg->sol_in[27].flags); - ck_assert_msg( - check_msg->sol_in[27].sensor_type == 76, - "incorrect value for sol_in[27].sensor_type, expected 76, is %d", - check_msg->sol_in[27].sensor_type); - ck_assert_msg(check_msg->sol_in[28].flags == 23, - "incorrect value for sol_in[28].flags, expected 23, is %d", - check_msg->sol_in[28].flags); - ck_assert_msg( - check_msg->sol_in[28].sensor_type == 17, - "incorrect value for sol_in[28].sensor_type, expected 17, is %d", - check_msg->sol_in[28].sensor_type); - ck_assert_msg(check_msg->sol_in[29].flags == 31, - "incorrect value for sol_in[29].flags, expected 31, is %d", - check_msg->sol_in[29].flags); - ck_assert_msg( - check_msg->sol_in[29].sensor_type == 125, - "incorrect value for sol_in[29].sensor_type, expected 125, is %d", - check_msg->sol_in[29].sensor_type); - ck_assert_msg(check_msg->sol_in[30].flags == 229, - "incorrect value for sol_in[30].flags, expected 229, is %d", - check_msg->sol_in[30].flags); - ck_assert_msg( - check_msg->sol_in[30].sensor_type == 18, - "incorrect value for sol_in[30].sensor_type, expected 18, is %d", - check_msg->sol_in[30].sensor_type); - ck_assert_msg(check_msg->sol_in[31].flags == 47, - "incorrect value for sol_in[31].flags, expected 47, is %d", - check_msg->sol_in[31].flags); - ck_assert_msg( - check_msg->sol_in[31].sensor_type == 28, - "incorrect value for sol_in[31].sensor_type, expected 28, is %d", - check_msg->sol_in[31].sensor_type); - ck_assert_msg(check_msg->sol_in[32].flags == 25, - "incorrect value for sol_in[32].flags, expected 25, is %d", - check_msg->sol_in[32].flags); - ck_assert_msg( - check_msg->sol_in[32].sensor_type == 214, - "incorrect value for sol_in[32].sensor_type, expected 214, is %d", - check_msg->sol_in[32].sensor_type); - ck_assert_msg(check_msg->sol_in[33].flags == 84, - "incorrect value for sol_in[33].flags, expected 84, is %d", - check_msg->sol_in[33].flags); - ck_assert_msg( - check_msg->sol_in[33].sensor_type == 100, - "incorrect value for sol_in[33].sensor_type, expected 100, is %d", - check_msg->sol_in[33].sensor_type); - ck_assert_msg(check_msg->sol_in[34].flags == 72, - "incorrect value for sol_in[34].flags, expected 72, is %d", - check_msg->sol_in[34].flags); - ck_assert_msg( - check_msg->sol_in[34].sensor_type == 106, - "incorrect value for sol_in[34].sensor_type, expected 106, is %d", - check_msg->sol_in[34].sensor_type); - ck_assert_msg(check_msg->sol_in[35].flags == 10, - "incorrect value for sol_in[35].flags, expected 10, is %d", - check_msg->sol_in[35].flags); - ck_assert_msg( - check_msg->sol_in[35].sensor_type == 48, - "incorrect value for sol_in[35].sensor_type, expected 48, is %d", - check_msg->sol_in[35].sensor_type); - ck_assert_msg(check_msg->sol_in[36].flags == 232, - "incorrect value for sol_in[36].flags, expected 232, is %d", - check_msg->sol_in[36].flags); - ck_assert_msg( - check_msg->sol_in[36].sensor_type == 222, - "incorrect value for sol_in[36].sensor_type, expected 222, is %d", - check_msg->sol_in[36].sensor_type); - ck_assert_msg(check_msg->sol_in[37].flags == 73, - "incorrect value for sol_in[37].flags, expected 73, is %d", - check_msg->sol_in[37].flags); - ck_assert_msg( - check_msg->sol_in[37].sensor_type == 235, - "incorrect value for sol_in[37].sensor_type, expected 235, is %d", - check_msg->sol_in[37].sensor_type); - ck_assert_msg(check_msg->sol_in[38].flags == 163, - "incorrect value for sol_in[38].flags, expected 163, is %d", - check_msg->sol_in[38].flags); - ck_assert_msg( - check_msg->sol_in[38].sensor_type == 109, - "incorrect value for sol_in[38].sensor_type, expected 109, is %d", - check_msg->sol_in[38].sensor_type); - ck_assert_msg(check_msg->sol_in[39].flags == 152, - "incorrect value for sol_in[39].flags, expected 152, is %d", - check_msg->sol_in[39].flags); - ck_assert_msg( - check_msg->sol_in[39].sensor_type == 51, - "incorrect value for sol_in[39].sensor_type, expected 51, is %d", - check_msg->sol_in[39].sensor_type); - ck_assert_msg(check_msg->sol_in[40].flags == 235, - "incorrect value for sol_in[40].flags, expected 235, is %d", - check_msg->sol_in[40].flags); - ck_assert_msg( - check_msg->sol_in[40].sensor_type == 133, - "incorrect value for sol_in[40].sensor_type, expected 133, is %d", - check_msg->sol_in[40].sensor_type); - ck_assert_msg(check_msg->sol_in[41].flags == 70, - "incorrect value for sol_in[41].flags, expected 70, is %d", - check_msg->sol_in[41].flags); - ck_assert_msg( - check_msg->sol_in[41].sensor_type == 87, - "incorrect value for sol_in[41].sensor_type, expected 87, is %d", - check_msg->sol_in[41].sensor_type); - ck_assert_msg(check_msg->sol_in[42].flags == 108, - "incorrect value for sol_in[42].flags, expected 108, is %d", - check_msg->sol_in[42].flags); - ck_assert_msg( - check_msg->sol_in[42].sensor_type == 2, - "incorrect value for sol_in[42].sensor_type, expected 2, is %d", - check_msg->sol_in[42].sensor_type); - ck_assert_msg(check_msg->sol_in[43].flags == 101, - "incorrect value for sol_in[43].flags, expected 101, is %d", - check_msg->sol_in[43].flags); - ck_assert_msg( - check_msg->sol_in[43].sensor_type == 91, - "incorrect value for sol_in[43].sensor_type, expected 91, is %d", - check_msg->sol_in[43].sensor_type); - ck_assert_msg(check_msg->sol_in[44].flags == 55, - "incorrect value for sol_in[44].flags, expected 55, is %d", - check_msg->sol_in[44].flags); - ck_assert_msg( - check_msg->sol_in[44].sensor_type == 200, - "incorrect value for sol_in[44].sensor_type, expected 200, is %d", - check_msg->sol_in[44].sensor_type); - ck_assert_msg(check_msg->sol_in[45].flags == 156, - "incorrect value for sol_in[45].flags, expected 156, is %d", - check_msg->sol_in[45].flags); - ck_assert_msg( - check_msg->sol_in[45].sensor_type == 24, - "incorrect value for sol_in[45].sensor_type, expected 24, is %d", - check_msg->sol_in[45].sensor_type); - ck_assert_msg(check_msg->sol_in[46].flags == 73, - "incorrect value for sol_in[46].flags, expected 73, is %d", - check_msg->sol_in[46].flags); - ck_assert_msg( - check_msg->sol_in[46].sensor_type == 233, - "incorrect value for sol_in[46].sensor_type, expected 233, is %d", - check_msg->sol_in[46].sensor_type); - ck_assert_msg(check_msg->sol_in[47].flags == 66, - "incorrect value for sol_in[47].flags, expected 66, is %d", - check_msg->sol_in[47].flags); - ck_assert_msg( - check_msg->sol_in[47].sensor_type == 39, - "incorrect value for sol_in[47].sensor_type, expected 39, is %d", - check_msg->sol_in[47].sensor_type); - ck_assert_msg(check_msg->sol_in[48].flags == 140, - "incorrect value for sol_in[48].flags, expected 140, is %d", - check_msg->sol_in[48].flags); - ck_assert_msg( - check_msg->sol_in[48].sensor_type == 97, - "incorrect value for sol_in[48].sensor_type, expected 97, is %d", - check_msg->sol_in[48].sensor_type); - ck_assert_msg(check_msg->sol_in[49].flags == 227, - "incorrect value for sol_in[49].flags, expected 227, is %d", - check_msg->sol_in[49].flags); - ck_assert_msg( - check_msg->sol_in[49].sensor_type == 252, - "incorrect value for sol_in[49].sensor_type, expected 252, is %d", - check_msg->sol_in[49].sensor_type); - ck_assert_msg(check_msg->sol_in[50].flags == 237, - "incorrect value for sol_in[50].flags, expected 237, is %d", - check_msg->sol_in[50].flags); - ck_assert_msg( - check_msg->sol_in[50].sensor_type == 230, - "incorrect value for sol_in[50].sensor_type, expected 230, is %d", - check_msg->sol_in[50].sensor_type); - ck_assert_msg(check_msg->sol_in[51].flags == 241, - "incorrect value for sol_in[51].flags, expected 241, is %d", - check_msg->sol_in[51].flags); - ck_assert_msg( - check_msg->sol_in[51].sensor_type == 135, - "incorrect value for sol_in[51].sensor_type, expected 135, is %d", - check_msg->sol_in[51].sensor_type); - ck_assert_msg(check_msg->sol_in[52].flags == 205, - "incorrect value for sol_in[52].flags, expected 205, is %d", - check_msg->sol_in[52].flags); - ck_assert_msg( - check_msg->sol_in[52].sensor_type == 245, - "incorrect value for sol_in[52].sensor_type, expected 245, is %d", - check_msg->sol_in[52].sensor_type); - ck_assert_msg(check_msg->sol_in[53].flags == 0, - "incorrect value for sol_in[53].flags, expected 0, is %d", - check_msg->sol_in[53].flags); - ck_assert_msg( - check_msg->sol_in[53].sensor_type == 70, - "incorrect value for sol_in[53].sensor_type, expected 70, is %d", - check_msg->sol_in[53].sensor_type); - ck_assert_msg(check_msg->sol_in[54].flags == 188, - "incorrect value for sol_in[54].flags, expected 188, is %d", - check_msg->sol_in[54].flags); - ck_assert_msg( - check_msg->sol_in[54].sensor_type == 219, - "incorrect value for sol_in[54].sensor_type, expected 219, is %d", - check_msg->sol_in[54].sensor_type); - ck_assert_msg(check_msg->sol_in[55].flags == 136, - "incorrect value for sol_in[55].flags, expected 136, is %d", - check_msg->sol_in[55].flags); - ck_assert_msg( - check_msg->sol_in[55].sensor_type == 107, - "incorrect value for sol_in[55].sensor_type, expected 107, is %d", - check_msg->sol_in[55].sensor_type); - ck_assert_msg(check_msg->sol_in[56].flags == 58, - "incorrect value for sol_in[56].flags, expected 58, is %d", - check_msg->sol_in[56].flags); - ck_assert_msg( - check_msg->sol_in[56].sensor_type == 178, - "incorrect value for sol_in[56].sensor_type, expected 178, is %d", - check_msg->sol_in[56].sensor_type); - ck_assert_msg(check_msg->sol_in[57].flags == 29, - "incorrect value for sol_in[57].flags, expected 29, is %d", - check_msg->sol_in[57].flags); - ck_assert_msg( - check_msg->sol_in[57].sensor_type == 1, - "incorrect value for sol_in[57].sensor_type, expected 1, is %d", - check_msg->sol_in[57].sensor_type); - ck_assert_msg(check_msg->sol_in[58].flags == 213, - "incorrect value for sol_in[58].flags, expected 213, is %d", - check_msg->sol_in[58].flags); - ck_assert_msg( - check_msg->sol_in[58].sensor_type == 44, - "incorrect value for sol_in[58].sensor_type, expected 44, is %d", - check_msg->sol_in[58].sensor_type); - ck_assert_msg(check_msg->sol_in[59].flags == 147, - "incorrect value for sol_in[59].flags, expected 147, is %d", - check_msg->sol_in[59].flags); - ck_assert_msg( - check_msg->sol_in[59].sensor_type == 225, - "incorrect value for sol_in[59].sensor_type, expected 225, is %d", - check_msg->sol_in[59].sensor_type); - ck_assert_msg(check_msg->sol_in[60].flags == 96, - "incorrect value for sol_in[60].flags, expected 96, is %d", - check_msg->sol_in[60].flags); - ck_assert_msg( - check_msg->sol_in[60].sensor_type == 190, - "incorrect value for sol_in[60].sensor_type, expected 190, is %d", - check_msg->sol_in[60].sensor_type); - ck_assert_msg(check_msg->sol_in[61].flags == 108, - "incorrect value for sol_in[61].flags, expected 108, is %d", - check_msg->sol_in[61].flags); - ck_assert_msg( - check_msg->sol_in[61].sensor_type == 192, - "incorrect value for sol_in[61].sensor_type, expected 192, is %d", - check_msg->sol_in[61].sensor_type); - ck_assert_msg(check_msg->sol_in[62].flags == 15, - "incorrect value for sol_in[62].flags, expected 15, is %d", - check_msg->sol_in[62].flags); - ck_assert_msg( - check_msg->sol_in[62].sensor_type == 228, - "incorrect value for sol_in[62].sensor_type, expected 228, is %d", - check_msg->sol_in[62].sensor_type); - ck_assert_msg(check_msg->sol_in[63].flags == 18, - "incorrect value for sol_in[63].flags, expected 18, is %d", - check_msg->sol_in[63].flags); - ck_assert_msg( - check_msg->sol_in[63].sensor_type == 203, - "incorrect value for sol_in[63].sensor_type, expected 203, is %d", - check_msg->sol_in[63].sensor_type); - ck_assert_msg(check_msg->sol_in[64].flags == 222, - "incorrect value for sol_in[64].flags, expected 222, is %d", - check_msg->sol_in[64].flags); - ck_assert_msg( - check_msg->sol_in[64].sensor_type == 3, - "incorrect value for sol_in[64].sensor_type, expected 3, is %d", - check_msg->sol_in[64].sensor_type); - ck_assert_msg(check_msg->sol_in[65].flags == 68, - "incorrect value for sol_in[65].flags, expected 68, is %d", - check_msg->sol_in[65].flags); - ck_assert_msg( - check_msg->sol_in[65].sensor_type == 180, - "incorrect value for sol_in[65].sensor_type, expected 180, is %d", - check_msg->sol_in[65].sensor_type); - ck_assert_msg(check_msg->sol_in[66].flags == 229, - "incorrect value for sol_in[66].flags, expected 229, is %d", - check_msg->sol_in[66].flags); - ck_assert_msg( - check_msg->sol_in[66].sensor_type == 101, - "incorrect value for sol_in[66].sensor_type, expected 101, is %d", - check_msg->sol_in[66].sensor_type); - ck_assert_msg(check_msg->sol_in[67].flags == 203, - "incorrect value for sol_in[67].flags, expected 203, is %d", - check_msg->sol_in[67].flags); - ck_assert_msg( - check_msg->sol_in[67].sensor_type == 223, - "incorrect value for sol_in[67].sensor_type, expected 223, is %d", - check_msg->sol_in[67].sensor_type); - ck_assert_msg(check_msg->sol_in[68].flags == 164, - "incorrect value for sol_in[68].flags, expected 164, is %d", - check_msg->sol_in[68].flags); - ck_assert_msg( - check_msg->sol_in[68].sensor_type == 243, - "incorrect value for sol_in[68].sensor_type, expected 243, is %d", - check_msg->sol_in[68].sensor_type); - ck_assert_msg(check_msg->sol_in[69].flags == 165, - "incorrect value for sol_in[69].flags, expected 165, is %d", - check_msg->sol_in[69].flags); - ck_assert_msg( - check_msg->sol_in[69].sensor_type == 92, - "incorrect value for sol_in[69].sensor_type, expected 92, is %d", - check_msg->sol_in[69].sensor_type); - ck_assert_msg(check_msg->sol_in[70].flags == 159, - "incorrect value for sol_in[70].flags, expected 159, is %d", - check_msg->sol_in[70].flags); - ck_assert_msg( - check_msg->sol_in[70].sensor_type == 220, - "incorrect value for sol_in[70].sensor_type, expected 220, is %d", - check_msg->sol_in[70].sensor_type); - ck_assert_msg(check_msg->sol_in[71].flags == 121, - "incorrect value for sol_in[71].flags, expected 121, is %d", - check_msg->sol_in[71].flags); - ck_assert_msg( - check_msg->sol_in[71].sensor_type == 174, - "incorrect value for sol_in[71].sensor_type, expected 174, is %d", - check_msg->sol_in[71].sensor_type); - ck_assert_msg(check_msg->sol_in[72].flags == 167, - "incorrect value for sol_in[72].flags, expected 167, is %d", - check_msg->sol_in[72].flags); - ck_assert_msg( - check_msg->sol_in[72].sensor_type == 112, - "incorrect value for sol_in[72].sensor_type, expected 112, is %d", - check_msg->sol_in[72].sensor_type); - ck_assert_msg(check_msg->sol_in[73].flags == 40, - "incorrect value for sol_in[73].flags, expected 40, is %d", - check_msg->sol_in[73].flags); - ck_assert_msg( - check_msg->sol_in[73].sensor_type == 240, - "incorrect value for sol_in[73].sensor_type, expected 240, is %d", - check_msg->sol_in[73].sensor_type); - ck_assert_msg(check_msg->sol_in[74].flags == 3, - "incorrect value for sol_in[74].flags, expected 3, is %d", - check_msg->sol_in[74].flags); - ck_assert_msg( - check_msg->sol_in[74].sensor_type == 59, - "incorrect value for sol_in[74].sensor_type, expected 59, is %d", - check_msg->sol_in[74].sensor_type); - ck_assert_msg(check_msg->sol_in[75].flags == 52, - "incorrect value for sol_in[75].flags, expected 52, is %d", - check_msg->sol_in[75].flags); - ck_assert_msg( - check_msg->sol_in[75].sensor_type == 230, - "incorrect value for sol_in[75].sensor_type, expected 230, is %d", - check_msg->sol_in[75].sensor_type); - ck_assert_msg(check_msg->sol_in[76].flags == 148, - "incorrect value for sol_in[76].flags, expected 148, is %d", - check_msg->sol_in[76].flags); - ck_assert_msg( - check_msg->sol_in[76].sensor_type == 149, - "incorrect value for sol_in[76].sensor_type, expected 149, is %d", - check_msg->sol_in[76].sensor_type); - ck_assert_msg(check_msg->sol_in[77].flags == 142, - "incorrect value for sol_in[77].flags, expected 142, is %d", - check_msg->sol_in[77].flags); - ck_assert_msg( - check_msg->sol_in[77].sensor_type == 218, - "incorrect value for sol_in[77].sensor_type, expected 218, is %d", - check_msg->sol_in[77].sensor_type); - ck_assert_msg(check_msg->sol_in[78].flags == 109, - "incorrect value for sol_in[78].flags, expected 109, is %d", - check_msg->sol_in[78].flags); - ck_assert_msg( - check_msg->sol_in[78].sensor_type == 212, - "incorrect value for sol_in[78].sensor_type, expected 212, is %d", - check_msg->sol_in[78].sensor_type); - ck_assert_msg(check_msg->sol_in[79].flags == 71, - "incorrect value for sol_in[79].flags, expected 71, is %d", - check_msg->sol_in[79].flags); - ck_assert_msg( - check_msg->sol_in[79].sensor_type == 176, - "incorrect value for sol_in[79].sensor_type, expected 176, is %d", - check_msg->sol_in[79].sensor_type); - ck_assert_msg(check_msg->sol_in[80].flags == 172, - "incorrect value for sol_in[80].flags, expected 172, is %d", - check_msg->sol_in[80].flags); - ck_assert_msg( - check_msg->sol_in[80].sensor_type == 179, - "incorrect value for sol_in[80].sensor_type, expected 179, is %d", - check_msg->sol_in[80].sensor_type); - ck_assert_msg(check_msg->sol_in[81].flags == 1, - "incorrect value for sol_in[81].flags, expected 1, is %d", - check_msg->sol_in[81].flags); - ck_assert_msg( - check_msg->sol_in[81].sensor_type == 77, - "incorrect value for sol_in[81].sensor_type, expected 77, is %d", - check_msg->sol_in[81].sensor_type); - ck_assert_msg(check_msg->sol_in[82].flags == 70, - "incorrect value for sol_in[82].flags, expected 70, is %d", - check_msg->sol_in[82].flags); - ck_assert_msg( - check_msg->sol_in[82].sensor_type == 193, - "incorrect value for sol_in[82].sensor_type, expected 193, is %d", - check_msg->sol_in[82].sensor_type); - ck_assert_msg(check_msg->sol_in[83].flags == 149, - "incorrect value for sol_in[83].flags, expected 149, is %d", - check_msg->sol_in[83].flags); - ck_assert_msg( - check_msg->sol_in[83].sensor_type == 147, - "incorrect value for sol_in[83].sensor_type, expected 147, is %d", - check_msg->sol_in[83].sensor_type); - ck_assert_msg(check_msg->sol_in[84].flags == 144, - "incorrect value for sol_in[84].flags, expected 144, is %d", - check_msg->sol_in[84].flags); - ck_assert_msg( - check_msg->sol_in[84].sensor_type == 23, - "incorrect value for sol_in[84].sensor_type, expected 23, is %d", - check_msg->sol_in[84].sensor_type); - ck_assert_msg(check_msg->sol_in[85].flags == 239, - "incorrect value for sol_in[85].flags, expected 239, is %d", - check_msg->sol_in[85].flags); - ck_assert_msg( - check_msg->sol_in[85].sensor_type == 148, - "incorrect value for sol_in[85].sensor_type, expected 148, is %d", - check_msg->sol_in[85].sensor_type); - ck_assert_msg(check_msg->sol_in[86].flags == 186, - "incorrect value for sol_in[86].flags, expected 186, is %d", - check_msg->sol_in[86].flags); - ck_assert_msg( - check_msg->sol_in[86].sensor_type == 195, - "incorrect value for sol_in[86].sensor_type, expected 195, is %d", - check_msg->sol_in[86].sensor_type); - ck_assert_msg(check_msg->sol_in[87].flags == 30, - "incorrect value for sol_in[87].flags, expected 30, is %d", - check_msg->sol_in[87].flags); - ck_assert_msg( - check_msg->sol_in[87].sensor_type == 86, - "incorrect value for sol_in[87].sensor_type, expected 86, is %d", - check_msg->sol_in[87].sensor_type); - ck_assert_msg(check_msg->sol_in[88].flags == 143, - "incorrect value for sol_in[88].flags, expected 143, is %d", - check_msg->sol_in[88].flags); - ck_assert_msg( - check_msg->sol_in[88].sensor_type == 34, - "incorrect value for sol_in[88].sensor_type, expected 34, is %d", - check_msg->sol_in[88].sensor_type); - ck_assert_msg(check_msg->sol_in[89].flags == 207, - "incorrect value for sol_in[89].flags, expected 207, is %d", - check_msg->sol_in[89].flags); - ck_assert_msg( - check_msg->sol_in[89].sensor_type == 156, - "incorrect value for sol_in[89].sensor_type, expected 156, is %d", - check_msg->sol_in[89].sensor_type); - ck_assert_msg(check_msg->sol_in[90].flags == 55, - "incorrect value for sol_in[90].flags, expected 55, is %d", - check_msg->sol_in[90].flags); - ck_assert_msg( - check_msg->sol_in[90].sensor_type == 63, - "incorrect value for sol_in[90].sensor_type, expected 63, is %d", - check_msg->sol_in[90].sensor_type); - ck_assert_msg(check_msg->sol_in[91].flags == 255, - "incorrect value for sol_in[91].flags, expected 255, is %d", - check_msg->sol_in[91].flags); - ck_assert_msg( - check_msg->sol_in[91].sensor_type == 117, - "incorrect value for sol_in[91].sensor_type, expected 117, is %d", - check_msg->sol_in[91].sensor_type); - ck_assert_msg(check_msg->sol_in[92].flags == 222, - "incorrect value for sol_in[92].flags, expected 222, is %d", - check_msg->sol_in[92].flags); - ck_assert_msg( - check_msg->sol_in[92].sensor_type == 222, - "incorrect value for sol_in[92].sensor_type, expected 222, is %d", - check_msg->sol_in[92].sensor_type); - ck_assert_msg(check_msg->sol_in[93].flags == 145, - "incorrect value for sol_in[93].flags, expected 145, is %d", - check_msg->sol_in[93].flags); - ck_assert_msg( - check_msg->sol_in[93].sensor_type == 219, - "incorrect value for sol_in[93].sensor_type, expected 219, is %d", - check_msg->sol_in[93].sensor_type); - ck_assert_msg(check_msg->sol_in[94].flags == 191, - "incorrect value for sol_in[94].flags, expected 191, is %d", - check_msg->sol_in[94].flags); - ck_assert_msg( - check_msg->sol_in[94].sensor_type == 224, - "incorrect value for sol_in[94].sensor_type, expected 224, is %d", - check_msg->sol_in[94].sensor_type); - ck_assert_msg(check_msg->sol_in[95].flags == 109, - "incorrect value for sol_in[95].flags, expected 109, is %d", - check_msg->sol_in[95].flags); - ck_assert_msg( - check_msg->sol_in[95].sensor_type == 210, - "incorrect value for sol_in[95].sensor_type, expected 210, is %d", - check_msg->sol_in[95].sensor_type); - ck_assert_msg(check_msg->sol_in[96].flags == 153, - "incorrect value for sol_in[96].flags, expected 153, is %d", - check_msg->sol_in[96].flags); - ck_assert_msg( - check_msg->sol_in[96].sensor_type == 86, - "incorrect value for sol_in[96].sensor_type, expected 86, is %d", - check_msg->sol_in[96].sensor_type); - ck_assert_msg(check_msg->sol_in[97].flags == 32, - "incorrect value for sol_in[97].flags, expected 32, is %d", - check_msg->sol_in[97].flags); - ck_assert_msg( - check_msg->sol_in[97].sensor_type == 21, - "incorrect value for sol_in[97].sensor_type, expected 21, is %d", - check_msg->sol_in[97].sensor_type); - ck_assert_msg(check_msg->sol_in[98].flags == 10, - "incorrect value for sol_in[98].flags, expected 10, is %d", - check_msg->sol_in[98].flags); - ck_assert_msg( - check_msg->sol_in[98].sensor_type == 226, - "incorrect value for sol_in[98].sensor_type, expected 226, is %d", - check_msg->sol_in[98].sensor_type); - ck_assert_msg(check_msg->sol_in[99].flags == 63, - "incorrect value for sol_in[99].flags, expected 63, is %d", - check_msg->sol_in[99].flags); - ck_assert_msg( - check_msg->sol_in[99].sensor_type == 60, - "incorrect value for sol_in[99].sensor_type, expected 60, is %d", - check_msg->sol_in[99].sensor_type); - ck_assert_msg(check_msg->sol_in[100].flags == 236, - "incorrect value for sol_in[100].flags, expected 236, is %d", - check_msg->sol_in[100].flags); - ck_assert_msg( - check_msg->sol_in[100].sensor_type == 106, - "incorrect value for sol_in[100].sensor_type, expected 106, is %d", - check_msg->sol_in[100].sensor_type); - ck_assert_msg(check_msg->sol_in[101].flags == 96, - "incorrect value for sol_in[101].flags, expected 96, is %d", - check_msg->sol_in[101].flags); - ck_assert_msg( - check_msg->sol_in[101].sensor_type == 93, - "incorrect value for sol_in[101].sensor_type, expected 93, is %d", - check_msg->sol_in[101].sensor_type); - ck_assert_msg(check_msg->sol_in[102].flags == 163, - "incorrect value for sol_in[102].flags, expected 163, is %d", - check_msg->sol_in[102].flags); - ck_assert_msg( - check_msg->sol_in[102].sensor_type == 30, - "incorrect value for sol_in[102].sensor_type, expected 30, is %d", - check_msg->sol_in[102].sensor_type); - ck_assert_msg(check_msg->sol_in[103].flags == 238, - "incorrect value for sol_in[103].flags, expected 238, is %d", - check_msg->sol_in[103].flags); - ck_assert_msg( - check_msg->sol_in[103].sensor_type == 106, - "incorrect value for sol_in[103].sensor_type, expected 106, is %d", - check_msg->sol_in[103].sensor_type); - ck_assert_msg(check_msg->sol_in[104].flags == 133, - "incorrect value for sol_in[104].flags, expected 133, is %d", - check_msg->sol_in[104].flags); - ck_assert_msg( - check_msg->sol_in[104].sensor_type == 147, - "incorrect value for sol_in[104].sensor_type, expected 147, is %d", - check_msg->sol_in[104].sensor_type); - ck_assert_msg(check_msg->sol_in[105].flags == 107, - "incorrect value for sol_in[105].flags, expected 107, is %d", - check_msg->sol_in[105].flags); - ck_assert_msg( - check_msg->sol_in[105].sensor_type == 132, - "incorrect value for sol_in[105].sensor_type, expected 132, is %d", - check_msg->sol_in[105].sensor_type); - ck_assert_msg(check_msg->sol_in[106].flags == 214, - "incorrect value for sol_in[106].flags, expected 214, is %d", - check_msg->sol_in[106].flags); - ck_assert_msg( - check_msg->sol_in[106].sensor_type == 152, - "incorrect value for sol_in[106].sensor_type, expected 152, is %d", - check_msg->sol_in[106].sensor_type); - ck_assert_msg(check_msg->sol_in[107].flags == 185, - "incorrect value for sol_in[107].flags, expected 185, is %d", - check_msg->sol_in[107].flags); - ck_assert_msg( - check_msg->sol_in[107].sensor_type == 221, - "incorrect value for sol_in[107].sensor_type, expected 221, is %d", - check_msg->sol_in[107].sensor_type); - ck_assert_msg(check_msg->sol_in[108].flags == 21, - "incorrect value for sol_in[108].flags, expected 21, is %d", - check_msg->sol_in[108].flags); - ck_assert_msg( - check_msg->sol_in[108].sensor_type == 202, - "incorrect value for sol_in[108].sensor_type, expected 202, is %d", - check_msg->sol_in[108].sensor_type); - ck_assert_msg(check_msg->sol_in[109].flags == 51, - "incorrect value for sol_in[109].flags, expected 51, is %d", - check_msg->sol_in[109].flags); - ck_assert_msg( - check_msg->sol_in[109].sensor_type == 252, - "incorrect value for sol_in[109].sensor_type, expected 252, is %d", - check_msg->sol_in[109].sensor_type); - ck_assert_msg(check_msg->sol_in[110].flags == 59, - "incorrect value for sol_in[110].flags, expected 59, is %d", - check_msg->sol_in[110].flags); - ck_assert_msg( - check_msg->sol_in[110].sensor_type == 130, - "incorrect value for sol_in[110].sensor_type, expected 130, is %d", - check_msg->sol_in[110].sensor_type); - ck_assert_msg(check_msg->sol_in[111].flags == 202, - "incorrect value for sol_in[111].flags, expected 202, is %d", - check_msg->sol_in[111].flags); - ck_assert_msg( - check_msg->sol_in[111].sensor_type == 166, - "incorrect value for sol_in[111].sensor_type, expected 166, is %d", - check_msg->sol_in[111].sensor_type); - ck_assert_msg(check_msg->sol_in[112].flags == 170, - "incorrect value for sol_in[112].flags, expected 170, is %d", - check_msg->sol_in[112].flags); - ck_assert_msg( - check_msg->sol_in[112].sensor_type == 127, - "incorrect value for sol_in[112].sensor_type, expected 127, is %d", - check_msg->sol_in[112].sensor_type); - ck_assert_msg(check_msg->sol_in[113].flags == 193, - "incorrect value for sol_in[113].flags, expected 193, is %d", - check_msg->sol_in[113].flags); - ck_assert_msg( - check_msg->sol_in[113].sensor_type == 58, - "incorrect value for sol_in[113].sensor_type, expected 58, is %d", - check_msg->sol_in[113].sensor_type); - ck_assert_msg(check_msg->sol_in[114].flags == 125, - "incorrect value for sol_in[114].flags, expected 125, is %d", - check_msg->sol_in[114].flags); - ck_assert_msg( - check_msg->sol_in[114].sensor_type == 215, - "incorrect value for sol_in[114].sensor_type, expected 215, is %d", - check_msg->sol_in[114].sensor_type); - ck_assert_msg(check_msg->sol_in[115].flags == 58, - "incorrect value for sol_in[115].flags, expected 58, is %d", - check_msg->sol_in[115].flags); - ck_assert_msg( - check_msg->sol_in[115].sensor_type == 22, - "incorrect value for sol_in[115].sensor_type, expected 22, is %d", - check_msg->sol_in[115].sensor_type); - ck_assert_msg(check_msg->sol_in[116].flags == 47, - "incorrect value for sol_in[116].flags, expected 47, is %d", - check_msg->sol_in[116].flags); - ck_assert_msg( - check_msg->sol_in[116].sensor_type == 135, - "incorrect value for sol_in[116].sensor_type, expected 135, is %d", - check_msg->sol_in[116].sensor_type); - ck_assert_msg(check_msg->sol_in[117].flags == 142, - "incorrect value for sol_in[117].flags, expected 142, is %d", - check_msg->sol_in[117].flags); - ck_assert_msg( - check_msg->sol_in[117].sensor_type == 88, - "incorrect value for sol_in[117].sensor_type, expected 88, is %d", - check_msg->sol_in[117].sensor_type); - ck_assert_msg(check_msg->vdop == 41989, - "incorrect value for vdop, expected 41989, is %d", - check_msg->vdop); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_solution_meta_MsgSolnMetaDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_solution_meta_MsgSolnMetaDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_solution_meta_MsgSolnMetaDepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_solution_meta_MsgSolnMetaDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrCodeBiases.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrCodeBiases.c deleted file mode 100644 index 7e0ce4c1bb..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrCodeBiases.c +++ /dev/null @@ -1,1250 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrCodeBiases.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrCodeBiases) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x5e1, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x5e1, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 225, 5, 39, 87, 253, 208, 90, 19, 23, 9, 66, 133, 241, - 254, 132, 51, 4, 131, 240, 120, 83, 148, 209, 213, 62, 228, 232, - 71, 66, 188, 210, 128, 54, 131, 152, 129, 111, 139, 242, 177, 145, - 44, 9, 245, 207, 241, 202, 150, 141, 50, 159, 220, 139, 37, 187, - 98, 191, 23, 128, 136, 167, 200, 6, 211, 90, 23, 244, 138, 215, - 209, 139, 13, 101, 32, 7, 18, 29, 70, 250, 109, 73, 202, 79, - 144, 9, 146, 69, 241, 52, 22, 99, 98, 204, 3, 171, 230, 180, - 75, 62, 145, 86, 130, 31, 30, 155, 37, 18, 55, 210, 39, 127, - 242, 66, 13, 237, 152, 170, 212, 15, 246, 59, 94, 180, 195, 157, - 69, 100, 119, 16, 68, 179, 175, 144, 113, 81, 82, 30, 151, 21, - 109, 41, 225, 8, 77, 164, 157, 0, 73, 30, 6, 78, 81, 143, - 116, 240, 151, 55, 185, 169, 254, 51, 39, 74, 175, 247, 34, 97, - 74, 97, 176, 48, 236, 173, 12, 174, 101, 130, 30, 169, 193, 190, - 204, 196, 123, 107, 25, 225, 74, 9, 10, 55, 3, 131, 246, 99, - 133, 34, 227, 203, 68, 18, 97, 223, 89, 192, 246, 50, 69, 91, - 10, 151, 74, 118, 110, 36, 168, 247, 160, 77, 179, 141, 178, 99, - 191, 120, 77, 192, 91, 224, 1, 226, 50, 87, 146, 148, 238, 100, - 179, 125, 227, 215, 104, 184, 31, 57, 90, 79, 21, 156, 245, 81, - 60, 93, 170, 60, 200, 167, 13, 125, 132, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_code_biases_t *test_msg = (msg_ssr_code_biases_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[0].code = 51; - test_msg->biases[0].value = -31996; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[1].code = 240; - test_msg->biases[1].value = 21368; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[2].code = 148; - test_msg->biases[2].value = -10799; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[3].code = 62; - test_msg->biases[3].value = -5916; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[4].code = 71; - test_msg->biases[4].value = -17342; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[5].code = 210; - test_msg->biases[5].value = 13952; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[6].code = 131; - test_msg->biases[6].value = -32360; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[7].code = 111; - test_msg->biases[7].value = -3445; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[8].code = 177; - test_msg->biases[8].value = 11409; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[9].code = 9; - test_msg->biases[9].value = -12299; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[10].code = 241; - test_msg->biases[10].value = -26934; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[11].code = 141; - test_msg->biases[11].value = -24782; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[12].code = 220; - test_msg->biases[12].value = 9611; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[13].code = 187; - test_msg->biases[13].value = -16542; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[14].code = 23; - test_msg->biases[14].value = -30592; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[15].code = 167; - test_msg->biases[15].value = 1736; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[16].code = 211; - test_msg->biases[16].value = 5978; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[17].code = 244; - test_msg->biases[17].value = -10358; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[18].code = 209; - test_msg->biases[18].value = 3467; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[19].code = 101; - test_msg->biases[19].value = 1824; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[20].code = 18; - test_msg->biases[20].value = 17949; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[21].code = 250; - test_msg->biases[21].value = 18797; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[22].code = 202; - test_msg->biases[22].value = -28593; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[23].code = 9; - test_msg->biases[23].value = 17810; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[24].code = 241; - test_msg->biases[24].value = 5684; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[25].code = 99; - test_msg->biases[25].value = -13214; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[26].code = 3; - test_msg->biases[26].value = -6485; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[27].code = 180; - test_msg->biases[27].value = 15947; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[28].code = 145; - test_msg->biases[28].value = -32170; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[29].code = 31; - test_msg->biases[29].value = -25826; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[30].code = 37; - test_msg->biases[30].value = 14098; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[31].code = 210; - test_msg->biases[31].value = 32551; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[32].code = 242; - test_msg->biases[32].value = 3394; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[33].code = 237; - test_msg->biases[33].value = -21864; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[34].code = 212; - test_msg->biases[34].value = -2545; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[35].code = 59; - test_msg->biases[35].value = -19362; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[36].code = 195; - test_msg->biases[36].value = 17821; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[37].code = 100; - test_msg->biases[37].value = 4215; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[38].code = 68; - test_msg->biases[38].value = -20557; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[39].code = 144; - test_msg->biases[39].value = 20849; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[40].code = 82; - test_msg->biases[40].value = -26850; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[41].code = 21; - test_msg->biases[41].value = 10605; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[42].code = 225; - test_msg->biases[42].value = 19720; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[43].code = 164; - test_msg->biases[43].value = 157; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[44].code = 73; - test_msg->biases[44].value = 1566; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[45].code = 78; - test_msg->biases[45].value = -28847; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[46].code = 116; - test_msg->biases[46].value = -26640; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[47].code = 55; - test_msg->biases[47].value = -22087; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[48].code = 254; - test_msg->biases[48].value = 10035; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[49].code = 74; - test_msg->biases[49].value = -2129; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[50].code = 34; - test_msg->biases[50].value = 19041; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[51].code = 97; - test_msg->biases[51].value = 12464; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[52].code = 236; - test_msg->biases[52].value = 3245; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[53].code = 174; - test_msg->biases[53].value = -32155; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[54].code = 30; - test_msg->biases[54].value = -15959; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[55].code = 190; - test_msg->biases[55].value = -15156; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[56].code = 123; - test_msg->biases[56].value = 6507; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[57].code = 225; - test_msg->biases[57].value = 2378; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[58].code = 10; - test_msg->biases[58].value = 823; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[59].code = 131; - test_msg->biases[59].value = 25590; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[60].code = 133; - test_msg->biases[60].value = -7390; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[61].code = 203; - test_msg->biases[61].value = 4676; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[62].code = 97; - test_msg->biases[62].value = 23007; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[63].code = 192; - test_msg->biases[63].value = 13046; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[64].code = 69; - test_msg->biases[64].value = 2651; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[65].code = 151; - test_msg->biases[65].value = 30282; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[66].code = 110; - test_msg->biases[66].value = -22492; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[67].code = 247; - test_msg->biases[67].value = 19872; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[68].code = 179; - test_msg->biases[68].value = -19827; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[69].code = 99; - test_msg->biases[69].value = 30911; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[70].code = 77; - test_msg->biases[70].value = 23488; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[71].code = 224; - test_msg->biases[71].value = -7679; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[72].code = 50; - test_msg->biases[72].value = -28073; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[73].code = 148; - test_msg->biases[73].value = 25838; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[74].code = 179; - test_msg->biases[74].value = -7299; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[75].code = 215; - test_msg->biases[75].value = -18328; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[76].code = 31; - test_msg->biases[76].value = 23097; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[77].code = 79; - test_msg->biases[77].value = -25579; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[78].code = 245; - test_msg->biases[78].value = 15441; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[79].code = 93; - test_msg->biases[79].value = 15530; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[80].code = 200; - test_msg->biases[80].value = 3495; - test_msg->iod_ssr = 132; - test_msg->sid.code = 241; - test_msg->sid.sat = 133; - test_msg->time.tow = 387144400; - test_msg->time.wn = 16905; - test_msg->update_interval = 254; - sbp_payload_send(&sbp_state, 0x5e1, 22311, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 22311, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 22311, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x5e1, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_code_biases_t *check_msg = - (msg_ssr_code_biases_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->biases[0].code == 51, - "incorrect value for biases[0].code, expected 51, is %d", - check_msg->biases[0].code); - ck_assert_msg(check_msg->biases[0].value == -31996, - "incorrect value for biases[0].value, expected -31996, is %d", - check_msg->biases[0].value); - ck_assert_msg(check_msg->biases[1].code == 240, - "incorrect value for biases[1].code, expected 240, is %d", - check_msg->biases[1].code); - ck_assert_msg(check_msg->biases[1].value == 21368, - "incorrect value for biases[1].value, expected 21368, is %d", - check_msg->biases[1].value); - ck_assert_msg(check_msg->biases[2].code == 148, - "incorrect value for biases[2].code, expected 148, is %d", - check_msg->biases[2].code); - ck_assert_msg(check_msg->biases[2].value == -10799, - "incorrect value for biases[2].value, expected -10799, is %d", - check_msg->biases[2].value); - ck_assert_msg(check_msg->biases[3].code == 62, - "incorrect value for biases[3].code, expected 62, is %d", - check_msg->biases[3].code); - ck_assert_msg(check_msg->biases[3].value == -5916, - "incorrect value for biases[3].value, expected -5916, is %d", - check_msg->biases[3].value); - ck_assert_msg(check_msg->biases[4].code == 71, - "incorrect value for biases[4].code, expected 71, is %d", - check_msg->biases[4].code); - ck_assert_msg(check_msg->biases[4].value == -17342, - "incorrect value for biases[4].value, expected -17342, is %d", - check_msg->biases[4].value); - ck_assert_msg(check_msg->biases[5].code == 210, - "incorrect value for biases[5].code, expected 210, is %d", - check_msg->biases[5].code); - ck_assert_msg(check_msg->biases[5].value == 13952, - "incorrect value for biases[5].value, expected 13952, is %d", - check_msg->biases[5].value); - ck_assert_msg(check_msg->biases[6].code == 131, - "incorrect value for biases[6].code, expected 131, is %d", - check_msg->biases[6].code); - ck_assert_msg(check_msg->biases[6].value == -32360, - "incorrect value for biases[6].value, expected -32360, is %d", - check_msg->biases[6].value); - ck_assert_msg(check_msg->biases[7].code == 111, - "incorrect value for biases[7].code, expected 111, is %d", - check_msg->biases[7].code); - ck_assert_msg(check_msg->biases[7].value == -3445, - "incorrect value for biases[7].value, expected -3445, is %d", - check_msg->biases[7].value); - ck_assert_msg(check_msg->biases[8].code == 177, - "incorrect value for biases[8].code, expected 177, is %d", - check_msg->biases[8].code); - ck_assert_msg(check_msg->biases[8].value == 11409, - "incorrect value for biases[8].value, expected 11409, is %d", - check_msg->biases[8].value); - ck_assert_msg(check_msg->biases[9].code == 9, - "incorrect value for biases[9].code, expected 9, is %d", - check_msg->biases[9].code); - ck_assert_msg(check_msg->biases[9].value == -12299, - "incorrect value for biases[9].value, expected -12299, is %d", - check_msg->biases[9].value); - ck_assert_msg(check_msg->biases[10].code == 241, - "incorrect value for biases[10].code, expected 241, is %d", - check_msg->biases[10].code); - ck_assert_msg( - check_msg->biases[10].value == -26934, - "incorrect value for biases[10].value, expected -26934, is %d", - check_msg->biases[10].value); - ck_assert_msg(check_msg->biases[11].code == 141, - "incorrect value for biases[11].code, expected 141, is %d", - check_msg->biases[11].code); - ck_assert_msg( - check_msg->biases[11].value == -24782, - "incorrect value for biases[11].value, expected -24782, is %d", - check_msg->biases[11].value); - ck_assert_msg(check_msg->biases[12].code == 220, - "incorrect value for biases[12].code, expected 220, is %d", - check_msg->biases[12].code); - ck_assert_msg(check_msg->biases[12].value == 9611, - "incorrect value for biases[12].value, expected 9611, is %d", - check_msg->biases[12].value); - ck_assert_msg(check_msg->biases[13].code == 187, - "incorrect value for biases[13].code, expected 187, is %d", - check_msg->biases[13].code); - ck_assert_msg( - check_msg->biases[13].value == -16542, - "incorrect value for biases[13].value, expected -16542, is %d", - check_msg->biases[13].value); - ck_assert_msg(check_msg->biases[14].code == 23, - "incorrect value for biases[14].code, expected 23, is %d", - check_msg->biases[14].code); - ck_assert_msg( - check_msg->biases[14].value == -30592, - "incorrect value for biases[14].value, expected -30592, is %d", - check_msg->biases[14].value); - ck_assert_msg(check_msg->biases[15].code == 167, - "incorrect value for biases[15].code, expected 167, is %d", - check_msg->biases[15].code); - ck_assert_msg(check_msg->biases[15].value == 1736, - "incorrect value for biases[15].value, expected 1736, is %d", - check_msg->biases[15].value); - ck_assert_msg(check_msg->biases[16].code == 211, - "incorrect value for biases[16].code, expected 211, is %d", - check_msg->biases[16].code); - ck_assert_msg(check_msg->biases[16].value == 5978, - "incorrect value for biases[16].value, expected 5978, is %d", - check_msg->biases[16].value); - ck_assert_msg(check_msg->biases[17].code == 244, - "incorrect value for biases[17].code, expected 244, is %d", - check_msg->biases[17].code); - ck_assert_msg( - check_msg->biases[17].value == -10358, - "incorrect value for biases[17].value, expected -10358, is %d", - check_msg->biases[17].value); - ck_assert_msg(check_msg->biases[18].code == 209, - "incorrect value for biases[18].code, expected 209, is %d", - check_msg->biases[18].code); - ck_assert_msg(check_msg->biases[18].value == 3467, - "incorrect value for biases[18].value, expected 3467, is %d", - check_msg->biases[18].value); - ck_assert_msg(check_msg->biases[19].code == 101, - "incorrect value for biases[19].code, expected 101, is %d", - check_msg->biases[19].code); - ck_assert_msg(check_msg->biases[19].value == 1824, - "incorrect value for biases[19].value, expected 1824, is %d", - check_msg->biases[19].value); - ck_assert_msg(check_msg->biases[20].code == 18, - "incorrect value for biases[20].code, expected 18, is %d", - check_msg->biases[20].code); - ck_assert_msg(check_msg->biases[20].value == 17949, - "incorrect value for biases[20].value, expected 17949, is %d", - check_msg->biases[20].value); - ck_assert_msg(check_msg->biases[21].code == 250, - "incorrect value for biases[21].code, expected 250, is %d", - check_msg->biases[21].code); - ck_assert_msg(check_msg->biases[21].value == 18797, - "incorrect value for biases[21].value, expected 18797, is %d", - check_msg->biases[21].value); - ck_assert_msg(check_msg->biases[22].code == 202, - "incorrect value for biases[22].code, expected 202, is %d", - check_msg->biases[22].code); - ck_assert_msg( - check_msg->biases[22].value == -28593, - "incorrect value for biases[22].value, expected -28593, is %d", - check_msg->biases[22].value); - ck_assert_msg(check_msg->biases[23].code == 9, - "incorrect value for biases[23].code, expected 9, is %d", - check_msg->biases[23].code); - ck_assert_msg(check_msg->biases[23].value == 17810, - "incorrect value for biases[23].value, expected 17810, is %d", - check_msg->biases[23].value); - ck_assert_msg(check_msg->biases[24].code == 241, - "incorrect value for biases[24].code, expected 241, is %d", - check_msg->biases[24].code); - ck_assert_msg(check_msg->biases[24].value == 5684, - "incorrect value for biases[24].value, expected 5684, is %d", - check_msg->biases[24].value); - ck_assert_msg(check_msg->biases[25].code == 99, - "incorrect value for biases[25].code, expected 99, is %d", - check_msg->biases[25].code); - ck_assert_msg( - check_msg->biases[25].value == -13214, - "incorrect value for biases[25].value, expected -13214, is %d", - check_msg->biases[25].value); - ck_assert_msg(check_msg->biases[26].code == 3, - "incorrect value for biases[26].code, expected 3, is %d", - check_msg->biases[26].code); - ck_assert_msg(check_msg->biases[26].value == -6485, - "incorrect value for biases[26].value, expected -6485, is %d", - check_msg->biases[26].value); - ck_assert_msg(check_msg->biases[27].code == 180, - "incorrect value for biases[27].code, expected 180, is %d", - check_msg->biases[27].code); - ck_assert_msg(check_msg->biases[27].value == 15947, - "incorrect value for biases[27].value, expected 15947, is %d", - check_msg->biases[27].value); - ck_assert_msg(check_msg->biases[28].code == 145, - "incorrect value for biases[28].code, expected 145, is %d", - check_msg->biases[28].code); - ck_assert_msg( - check_msg->biases[28].value == -32170, - "incorrect value for biases[28].value, expected -32170, is %d", - check_msg->biases[28].value); - ck_assert_msg(check_msg->biases[29].code == 31, - "incorrect value for biases[29].code, expected 31, is %d", - check_msg->biases[29].code); - ck_assert_msg( - check_msg->biases[29].value == -25826, - "incorrect value for biases[29].value, expected -25826, is %d", - check_msg->biases[29].value); - ck_assert_msg(check_msg->biases[30].code == 37, - "incorrect value for biases[30].code, expected 37, is %d", - check_msg->biases[30].code); - ck_assert_msg(check_msg->biases[30].value == 14098, - "incorrect value for biases[30].value, expected 14098, is %d", - check_msg->biases[30].value); - ck_assert_msg(check_msg->biases[31].code == 210, - "incorrect value for biases[31].code, expected 210, is %d", - check_msg->biases[31].code); - ck_assert_msg(check_msg->biases[31].value == 32551, - "incorrect value for biases[31].value, expected 32551, is %d", - check_msg->biases[31].value); - ck_assert_msg(check_msg->biases[32].code == 242, - "incorrect value for biases[32].code, expected 242, is %d", - check_msg->biases[32].code); - ck_assert_msg(check_msg->biases[32].value == 3394, - "incorrect value for biases[32].value, expected 3394, is %d", - check_msg->biases[32].value); - ck_assert_msg(check_msg->biases[33].code == 237, - "incorrect value for biases[33].code, expected 237, is %d", - check_msg->biases[33].code); - ck_assert_msg( - check_msg->biases[33].value == -21864, - "incorrect value for biases[33].value, expected -21864, is %d", - check_msg->biases[33].value); - ck_assert_msg(check_msg->biases[34].code == 212, - "incorrect value for biases[34].code, expected 212, is %d", - check_msg->biases[34].code); - ck_assert_msg(check_msg->biases[34].value == -2545, - "incorrect value for biases[34].value, expected -2545, is %d", - check_msg->biases[34].value); - ck_assert_msg(check_msg->biases[35].code == 59, - "incorrect value for biases[35].code, expected 59, is %d", - check_msg->biases[35].code); - ck_assert_msg( - check_msg->biases[35].value == -19362, - "incorrect value for biases[35].value, expected -19362, is %d", - check_msg->biases[35].value); - ck_assert_msg(check_msg->biases[36].code == 195, - "incorrect value for biases[36].code, expected 195, is %d", - check_msg->biases[36].code); - ck_assert_msg(check_msg->biases[36].value == 17821, - "incorrect value for biases[36].value, expected 17821, is %d", - check_msg->biases[36].value); - ck_assert_msg(check_msg->biases[37].code == 100, - "incorrect value for biases[37].code, expected 100, is %d", - check_msg->biases[37].code); - ck_assert_msg(check_msg->biases[37].value == 4215, - "incorrect value for biases[37].value, expected 4215, is %d", - check_msg->biases[37].value); - ck_assert_msg(check_msg->biases[38].code == 68, - "incorrect value for biases[38].code, expected 68, is %d", - check_msg->biases[38].code); - ck_assert_msg( - check_msg->biases[38].value == -20557, - "incorrect value for biases[38].value, expected -20557, is %d", - check_msg->biases[38].value); - ck_assert_msg(check_msg->biases[39].code == 144, - "incorrect value for biases[39].code, expected 144, is %d", - check_msg->biases[39].code); - ck_assert_msg(check_msg->biases[39].value == 20849, - "incorrect value for biases[39].value, expected 20849, is %d", - check_msg->biases[39].value); - ck_assert_msg(check_msg->biases[40].code == 82, - "incorrect value for biases[40].code, expected 82, is %d", - check_msg->biases[40].code); - ck_assert_msg( - check_msg->biases[40].value == -26850, - "incorrect value for biases[40].value, expected -26850, is %d", - check_msg->biases[40].value); - ck_assert_msg(check_msg->biases[41].code == 21, - "incorrect value for biases[41].code, expected 21, is %d", - check_msg->biases[41].code); - ck_assert_msg(check_msg->biases[41].value == 10605, - "incorrect value for biases[41].value, expected 10605, is %d", - check_msg->biases[41].value); - ck_assert_msg(check_msg->biases[42].code == 225, - "incorrect value for biases[42].code, expected 225, is %d", - check_msg->biases[42].code); - ck_assert_msg(check_msg->biases[42].value == 19720, - "incorrect value for biases[42].value, expected 19720, is %d", - check_msg->biases[42].value); - ck_assert_msg(check_msg->biases[43].code == 164, - "incorrect value for biases[43].code, expected 164, is %d", - check_msg->biases[43].code); - ck_assert_msg(check_msg->biases[43].value == 157, - "incorrect value for biases[43].value, expected 157, is %d", - check_msg->biases[43].value); - ck_assert_msg(check_msg->biases[44].code == 73, - "incorrect value for biases[44].code, expected 73, is %d", - check_msg->biases[44].code); - ck_assert_msg(check_msg->biases[44].value == 1566, - "incorrect value for biases[44].value, expected 1566, is %d", - check_msg->biases[44].value); - ck_assert_msg(check_msg->biases[45].code == 78, - "incorrect value for biases[45].code, expected 78, is %d", - check_msg->biases[45].code); - ck_assert_msg( - check_msg->biases[45].value == -28847, - "incorrect value for biases[45].value, expected -28847, is %d", - check_msg->biases[45].value); - ck_assert_msg(check_msg->biases[46].code == 116, - "incorrect value for biases[46].code, expected 116, is %d", - check_msg->biases[46].code); - ck_assert_msg( - check_msg->biases[46].value == -26640, - "incorrect value for biases[46].value, expected -26640, is %d", - check_msg->biases[46].value); - ck_assert_msg(check_msg->biases[47].code == 55, - "incorrect value for biases[47].code, expected 55, is %d", - check_msg->biases[47].code); - ck_assert_msg( - check_msg->biases[47].value == -22087, - "incorrect value for biases[47].value, expected -22087, is %d", - check_msg->biases[47].value); - ck_assert_msg(check_msg->biases[48].code == 254, - "incorrect value for biases[48].code, expected 254, is %d", - check_msg->biases[48].code); - ck_assert_msg(check_msg->biases[48].value == 10035, - "incorrect value for biases[48].value, expected 10035, is %d", - check_msg->biases[48].value); - ck_assert_msg(check_msg->biases[49].code == 74, - "incorrect value for biases[49].code, expected 74, is %d", - check_msg->biases[49].code); - ck_assert_msg(check_msg->biases[49].value == -2129, - "incorrect value for biases[49].value, expected -2129, is %d", - check_msg->biases[49].value); - ck_assert_msg(check_msg->biases[50].code == 34, - "incorrect value for biases[50].code, expected 34, is %d", - check_msg->biases[50].code); - ck_assert_msg(check_msg->biases[50].value == 19041, - "incorrect value for biases[50].value, expected 19041, is %d", - check_msg->biases[50].value); - ck_assert_msg(check_msg->biases[51].code == 97, - "incorrect value for biases[51].code, expected 97, is %d", - check_msg->biases[51].code); - ck_assert_msg(check_msg->biases[51].value == 12464, - "incorrect value for biases[51].value, expected 12464, is %d", - check_msg->biases[51].value); - ck_assert_msg(check_msg->biases[52].code == 236, - "incorrect value for biases[52].code, expected 236, is %d", - check_msg->biases[52].code); - ck_assert_msg(check_msg->biases[52].value == 3245, - "incorrect value for biases[52].value, expected 3245, is %d", - check_msg->biases[52].value); - ck_assert_msg(check_msg->biases[53].code == 174, - "incorrect value for biases[53].code, expected 174, is %d", - check_msg->biases[53].code); - ck_assert_msg( - check_msg->biases[53].value == -32155, - "incorrect value for biases[53].value, expected -32155, is %d", - check_msg->biases[53].value); - ck_assert_msg(check_msg->biases[54].code == 30, - "incorrect value for biases[54].code, expected 30, is %d", - check_msg->biases[54].code); - ck_assert_msg( - check_msg->biases[54].value == -15959, - "incorrect value for biases[54].value, expected -15959, is %d", - check_msg->biases[54].value); - ck_assert_msg(check_msg->biases[55].code == 190, - "incorrect value for biases[55].code, expected 190, is %d", - check_msg->biases[55].code); - ck_assert_msg( - check_msg->biases[55].value == -15156, - "incorrect value for biases[55].value, expected -15156, is %d", - check_msg->biases[55].value); - ck_assert_msg(check_msg->biases[56].code == 123, - "incorrect value for biases[56].code, expected 123, is %d", - check_msg->biases[56].code); - ck_assert_msg(check_msg->biases[56].value == 6507, - "incorrect value for biases[56].value, expected 6507, is %d", - check_msg->biases[56].value); - ck_assert_msg(check_msg->biases[57].code == 225, - "incorrect value for biases[57].code, expected 225, is %d", - check_msg->biases[57].code); - ck_assert_msg(check_msg->biases[57].value == 2378, - "incorrect value for biases[57].value, expected 2378, is %d", - check_msg->biases[57].value); - ck_assert_msg(check_msg->biases[58].code == 10, - "incorrect value for biases[58].code, expected 10, is %d", - check_msg->biases[58].code); - ck_assert_msg(check_msg->biases[58].value == 823, - "incorrect value for biases[58].value, expected 823, is %d", - check_msg->biases[58].value); - ck_assert_msg(check_msg->biases[59].code == 131, - "incorrect value for biases[59].code, expected 131, is %d", - check_msg->biases[59].code); - ck_assert_msg(check_msg->biases[59].value == 25590, - "incorrect value for biases[59].value, expected 25590, is %d", - check_msg->biases[59].value); - ck_assert_msg(check_msg->biases[60].code == 133, - "incorrect value for biases[60].code, expected 133, is %d", - check_msg->biases[60].code); - ck_assert_msg(check_msg->biases[60].value == -7390, - "incorrect value for biases[60].value, expected -7390, is %d", - check_msg->biases[60].value); - ck_assert_msg(check_msg->biases[61].code == 203, - "incorrect value for biases[61].code, expected 203, is %d", - check_msg->biases[61].code); - ck_assert_msg(check_msg->biases[61].value == 4676, - "incorrect value for biases[61].value, expected 4676, is %d", - check_msg->biases[61].value); - ck_assert_msg(check_msg->biases[62].code == 97, - "incorrect value for biases[62].code, expected 97, is %d", - check_msg->biases[62].code); - ck_assert_msg(check_msg->biases[62].value == 23007, - "incorrect value for biases[62].value, expected 23007, is %d", - check_msg->biases[62].value); - ck_assert_msg(check_msg->biases[63].code == 192, - "incorrect value for biases[63].code, expected 192, is %d", - check_msg->biases[63].code); - ck_assert_msg(check_msg->biases[63].value == 13046, - "incorrect value for biases[63].value, expected 13046, is %d", - check_msg->biases[63].value); - ck_assert_msg(check_msg->biases[64].code == 69, - "incorrect value for biases[64].code, expected 69, is %d", - check_msg->biases[64].code); - ck_assert_msg(check_msg->biases[64].value == 2651, - "incorrect value for biases[64].value, expected 2651, is %d", - check_msg->biases[64].value); - ck_assert_msg(check_msg->biases[65].code == 151, - "incorrect value for biases[65].code, expected 151, is %d", - check_msg->biases[65].code); - ck_assert_msg(check_msg->biases[65].value == 30282, - "incorrect value for biases[65].value, expected 30282, is %d", - check_msg->biases[65].value); - ck_assert_msg(check_msg->biases[66].code == 110, - "incorrect value for biases[66].code, expected 110, is %d", - check_msg->biases[66].code); - ck_assert_msg( - check_msg->biases[66].value == -22492, - "incorrect value for biases[66].value, expected -22492, is %d", - check_msg->biases[66].value); - ck_assert_msg(check_msg->biases[67].code == 247, - "incorrect value for biases[67].code, expected 247, is %d", - check_msg->biases[67].code); - ck_assert_msg(check_msg->biases[67].value == 19872, - "incorrect value for biases[67].value, expected 19872, is %d", - check_msg->biases[67].value); - ck_assert_msg(check_msg->biases[68].code == 179, - "incorrect value for biases[68].code, expected 179, is %d", - check_msg->biases[68].code); - ck_assert_msg( - check_msg->biases[68].value == -19827, - "incorrect value for biases[68].value, expected -19827, is %d", - check_msg->biases[68].value); - ck_assert_msg(check_msg->biases[69].code == 99, - "incorrect value for biases[69].code, expected 99, is %d", - check_msg->biases[69].code); - ck_assert_msg(check_msg->biases[69].value == 30911, - "incorrect value for biases[69].value, expected 30911, is %d", - check_msg->biases[69].value); - ck_assert_msg(check_msg->biases[70].code == 77, - "incorrect value for biases[70].code, expected 77, is %d", - check_msg->biases[70].code); - ck_assert_msg(check_msg->biases[70].value == 23488, - "incorrect value for biases[70].value, expected 23488, is %d", - check_msg->biases[70].value); - ck_assert_msg(check_msg->biases[71].code == 224, - "incorrect value for biases[71].code, expected 224, is %d", - check_msg->biases[71].code); - ck_assert_msg(check_msg->biases[71].value == -7679, - "incorrect value for biases[71].value, expected -7679, is %d", - check_msg->biases[71].value); - ck_assert_msg(check_msg->biases[72].code == 50, - "incorrect value for biases[72].code, expected 50, is %d", - check_msg->biases[72].code); - ck_assert_msg( - check_msg->biases[72].value == -28073, - "incorrect value for biases[72].value, expected -28073, is %d", - check_msg->biases[72].value); - ck_assert_msg(check_msg->biases[73].code == 148, - "incorrect value for biases[73].code, expected 148, is %d", - check_msg->biases[73].code); - ck_assert_msg(check_msg->biases[73].value == 25838, - "incorrect value for biases[73].value, expected 25838, is %d", - check_msg->biases[73].value); - ck_assert_msg(check_msg->biases[74].code == 179, - "incorrect value for biases[74].code, expected 179, is %d", - check_msg->biases[74].code); - ck_assert_msg(check_msg->biases[74].value == -7299, - "incorrect value for biases[74].value, expected -7299, is %d", - check_msg->biases[74].value); - ck_assert_msg(check_msg->biases[75].code == 215, - "incorrect value for biases[75].code, expected 215, is %d", - check_msg->biases[75].code); - ck_assert_msg( - check_msg->biases[75].value == -18328, - "incorrect value for biases[75].value, expected -18328, is %d", - check_msg->biases[75].value); - ck_assert_msg(check_msg->biases[76].code == 31, - "incorrect value for biases[76].code, expected 31, is %d", - check_msg->biases[76].code); - ck_assert_msg(check_msg->biases[76].value == 23097, - "incorrect value for biases[76].value, expected 23097, is %d", - check_msg->biases[76].value); - ck_assert_msg(check_msg->biases[77].code == 79, - "incorrect value for biases[77].code, expected 79, is %d", - check_msg->biases[77].code); - ck_assert_msg( - check_msg->biases[77].value == -25579, - "incorrect value for biases[77].value, expected -25579, is %d", - check_msg->biases[77].value); - ck_assert_msg(check_msg->biases[78].code == 245, - "incorrect value for biases[78].code, expected 245, is %d", - check_msg->biases[78].code); - ck_assert_msg(check_msg->biases[78].value == 15441, - "incorrect value for biases[78].value, expected 15441, is %d", - check_msg->biases[78].value); - ck_assert_msg(check_msg->biases[79].code == 93, - "incorrect value for biases[79].code, expected 93, is %d", - check_msg->biases[79].code); - ck_assert_msg(check_msg->biases[79].value == 15530, - "incorrect value for biases[79].value, expected 15530, is %d", - check_msg->biases[79].value); - ck_assert_msg(check_msg->biases[80].code == 200, - "incorrect value for biases[80].code, expected 200, is %d", - check_msg->biases[80].code); - ck_assert_msg(check_msg->biases[80].value == 3495, - "incorrect value for biases[80].value, expected 3495, is %d", - check_msg->biases[80].value); - ck_assert_msg(check_msg->iod_ssr == 132, - "incorrect value for iod_ssr, expected 132, is %d", - check_msg->iod_ssr); - ck_assert_msg(check_msg->sid.code == 241, - "incorrect value for sid.code, expected 241, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.sat == 133, - "incorrect value for sid.sat, expected 133, is %d", - check_msg->sid.sat); - ck_assert_msg(check_msg->time.tow == 387144400, - "incorrect value for time.tow, expected 387144400, is %d", - check_msg->time.tow); - ck_assert_msg(check_msg->time.wn == 16905, - "incorrect value for time.wn, expected 16905, is %d", - check_msg->time.wn); - ck_assert_msg(check_msg->update_interval == 254, - "incorrect value for update_interval, expected 254, is %d", - check_msg->update_interval); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrCodeBiases_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_ssr_MsgSsrCodeBiases"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_MsgSsrCodeBiases"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_ssr_MsgSsrCodeBiases); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds.c deleted file mode 100644 index e3c6bbea57..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds.c +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrCodePhaseBiasesBounds.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 1516, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 1516, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 236, 5, 66, 0, 31, 180, 0, 0, 0, 3, 0, 1, - 2, 1, 14, 15, 1, 3, 0, 3, 39, 1, 39, 1, 1, - 3, 39, 1, 39, 1, 1, 1, 39, 1, 39, 1, 23, 113, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_code_phase_biases_bounds_t *test_msg = - (msg_ssr_code_phase_biases_bounds_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->const_id = 1; - test_msg->header.num_msgs = 1; - test_msg->header.seq_num = 2; - test_msg->header.sol_id = 14; - test_msg->header.time.tow = 180; - test_msg->header.time.wn = 3; - test_msg->header.update_interval = 1; - test_msg->n_sats_signals = 3; - if (sizeof(test_msg->satellites_signals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->satellites_signals[0]); - } - test_msg->satellites_signals[0].code_bias_bound_mu = 39; - test_msg->satellites_signals[0].code_bias_bound_sig = 1; - test_msg->satellites_signals[0].phase_bias_bound_mu = 39; - test_msg->satellites_signals[0].phase_bias_bound_sig = 1; - test_msg->satellites_signals[0].sat_id = 0; - test_msg->satellites_signals[0].signal_id = 3; - if (sizeof(test_msg->satellites_signals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->satellites_signals[0]); - } - test_msg->satellites_signals[1].code_bias_bound_mu = 39; - test_msg->satellites_signals[1].code_bias_bound_sig = 1; - test_msg->satellites_signals[1].phase_bias_bound_mu = 39; - test_msg->satellites_signals[1].phase_bias_bound_sig = 1; - test_msg->satellites_signals[1].sat_id = 1; - test_msg->satellites_signals[1].signal_id = 3; - if (sizeof(test_msg->satellites_signals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->satellites_signals[0]); - } - test_msg->satellites_signals[2].code_bias_bound_mu = 39; - test_msg->satellites_signals[2].code_bias_bound_sig = 1; - test_msg->satellites_signals[2].phase_bias_bound_mu = 39; - test_msg->satellites_signals[2].phase_bias_bound_sig = 1; - test_msg->satellites_signals[2].sat_id = 1; - test_msg->satellites_signals[2].signal_id = 1; - test_msg->ssr_iod = 15; - sbp_payload_send(&sbp_state, 1516, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 1516, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_code_phase_biases_bounds_t *check_msg = - (msg_ssr_code_phase_biases_bounds_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->const_id == 1, - "incorrect value for const_id, expected 1, is %d", - check_msg->const_id); - ck_assert_msg(check_msg->header.num_msgs == 1, - "incorrect value for header.num_msgs, expected 1, is %d", - check_msg->header.num_msgs); - ck_assert_msg(check_msg->header.seq_num == 2, - "incorrect value for header.seq_num, expected 2, is %d", - check_msg->header.seq_num); - ck_assert_msg(check_msg->header.sol_id == 14, - "incorrect value for header.sol_id, expected 14, is %d", - check_msg->header.sol_id); - ck_assert_msg(check_msg->header.time.tow == 180, - "incorrect value for header.time.tow, expected 180, is %d", - check_msg->header.time.tow); - ck_assert_msg(check_msg->header.time.wn == 3, - "incorrect value for header.time.wn, expected 3, is %d", - check_msg->header.time.wn); - ck_assert_msg( - check_msg->header.update_interval == 1, - "incorrect value for header.update_interval, expected 1, is %d", - check_msg->header.update_interval); - ck_assert_msg(check_msg->n_sats_signals == 3, - "incorrect value for n_sats_signals, expected 3, is %d", - check_msg->n_sats_signals); - ck_assert_msg( - check_msg->satellites_signals[0].code_bias_bound_mu == 39, - "incorrect value for satellites_signals[0].code_bias_bound_mu, " - "expected 39, is %d", - check_msg->satellites_signals[0].code_bias_bound_mu); - ck_assert_msg( - check_msg->satellites_signals[0].code_bias_bound_sig == 1, - "incorrect value for satellites_signals[0].code_bias_bound_sig, " - "expected 1, is %d", - check_msg->satellites_signals[0].code_bias_bound_sig); - ck_assert_msg( - check_msg->satellites_signals[0].phase_bias_bound_mu == 39, - "incorrect value for satellites_signals[0].phase_bias_bound_mu, " - "expected 39, is %d", - check_msg->satellites_signals[0].phase_bias_bound_mu); - ck_assert_msg( - check_msg->satellites_signals[0].phase_bias_bound_sig == 1, - "incorrect value for satellites_signals[0].phase_bias_bound_sig, " - "expected 1, is %d", - check_msg->satellites_signals[0].phase_bias_bound_sig); - ck_assert_msg( - check_msg->satellites_signals[0].sat_id == 0, - "incorrect value for satellites_signals[0].sat_id, expected 0, is %d", - check_msg->satellites_signals[0].sat_id); - ck_assert_msg(check_msg->satellites_signals[0].signal_id == 3, - "incorrect value for satellites_signals[0].signal_id, " - "expected 3, is %d", - check_msg->satellites_signals[0].signal_id); - ck_assert_msg( - check_msg->satellites_signals[1].code_bias_bound_mu == 39, - "incorrect value for satellites_signals[1].code_bias_bound_mu, " - "expected 39, is %d", - check_msg->satellites_signals[1].code_bias_bound_mu); - ck_assert_msg( - check_msg->satellites_signals[1].code_bias_bound_sig == 1, - "incorrect value for satellites_signals[1].code_bias_bound_sig, " - "expected 1, is %d", - check_msg->satellites_signals[1].code_bias_bound_sig); - ck_assert_msg( - check_msg->satellites_signals[1].phase_bias_bound_mu == 39, - "incorrect value for satellites_signals[1].phase_bias_bound_mu, " - "expected 39, is %d", - check_msg->satellites_signals[1].phase_bias_bound_mu); - ck_assert_msg( - check_msg->satellites_signals[1].phase_bias_bound_sig == 1, - "incorrect value for satellites_signals[1].phase_bias_bound_sig, " - "expected 1, is %d", - check_msg->satellites_signals[1].phase_bias_bound_sig); - ck_assert_msg( - check_msg->satellites_signals[1].sat_id == 1, - "incorrect value for satellites_signals[1].sat_id, expected 1, is %d", - check_msg->satellites_signals[1].sat_id); - ck_assert_msg(check_msg->satellites_signals[1].signal_id == 3, - "incorrect value for satellites_signals[1].signal_id, " - "expected 3, is %d", - check_msg->satellites_signals[1].signal_id); - ck_assert_msg( - check_msg->satellites_signals[2].code_bias_bound_mu == 39, - "incorrect value for satellites_signals[2].code_bias_bound_mu, " - "expected 39, is %d", - check_msg->satellites_signals[2].code_bias_bound_mu); - ck_assert_msg( - check_msg->satellites_signals[2].code_bias_bound_sig == 1, - "incorrect value for satellites_signals[2].code_bias_bound_sig, " - "expected 1, is %d", - check_msg->satellites_signals[2].code_bias_bound_sig); - ck_assert_msg( - check_msg->satellites_signals[2].phase_bias_bound_mu == 39, - "incorrect value for satellites_signals[2].phase_bias_bound_mu, " - "expected 39, is %d", - check_msg->satellites_signals[2].phase_bias_bound_mu); - ck_assert_msg( - check_msg->satellites_signals[2].phase_bias_bound_sig == 1, - "incorrect value for satellites_signals[2].phase_bias_bound_sig, " - "expected 1, is %d", - check_msg->satellites_signals[2].phase_bias_bound_sig); - ck_assert_msg( - check_msg->satellites_signals[2].sat_id == 1, - "incorrect value for satellites_signals[2].sat_id, expected 1, is %d", - check_msg->satellites_signals[2].sat_id); - ck_assert_msg(check_msg->satellites_signals[2].signal_id == 1, - "incorrect value for satellites_signals[2].signal_id, " - "expected 1, is %d", - check_msg->satellites_signals[2].signal_id); - ck_assert_msg(check_msg->ssr_iod == 15, - "incorrect value for ssr_iod, expected 15, is %d", - check_msg->ssr_iod); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrGridDefinitionDepA.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrGridDefinitionDepA.c deleted file mode 100644 index 400c646d9f..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrGridDefinitionDepA.c +++ /dev/null @@ -1,2229 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrGridDefinitionDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrGridDefinitionDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x5f5, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x5f5, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 245, 5, 181, 247, 255, 11, 84, 171, 229, 132, 143, 46, 204, - 52, 92, 104, 25, 204, 182, 22, 98, 203, 123, 211, 38, 13, 253, - 129, 173, 171, 235, 253, 26, 203, 3, 120, 126, 42, 44, 39, 87, - 69, 154, 13, 28, 179, 32, 47, 36, 195, 39, 198, 134, 235, 134, - 57, 120, 243, 151, 35, 17, 201, 211, 125, 117, 164, 142, 101, 239, - 144, 158, 239, 90, 56, 71, 120, 67, 221, 114, 10, 190, 4, 230, - 164, 171, 78, 185, 90, 46, 177, 82, 228, 123, 222, 227, 145, 195, - 219, 27, 56, 227, 246, 215, 144, 158, 31, 214, 241, 254, 200, 86, - 142, 89, 12, 121, 29, 124, 9, 19, 153, 44, 35, 126, 14, 217, - 65, 116, 26, 139, 122, 114, 90, 124, 81, 0, 186, 246, 46, 98, - 179, 243, 198, 217, 36, 30, 202, 12, 135, 61, 42, 150, 221, 102, - 83, 179, 43, 252, 81, 62, 126, 204, 195, 238, 18, 128, 193, 53, - 94, 99, 63, 182, 2, 186, 220, 77, 186, 224, 220, 13, 212, 182, - 88, 15, 151, 5, 93, 251, 164, 18, 228, 168, 226, 195, 44, 170, - 145, 36, 58, 96, 107, 144, 11, 228, 12, 163, 238, 247, 159, 189, - 1, 115, 65, 202, 121, 47, 193, 11, 96, 93, 72, 81, 207, 121, - 19, 151, 136, 233, 51, 133, 195, 77, 44, 147, 206, 120, 252, 77, - 212, 68, 60, 206, 106, 207, 243, 158, 94, 6, 3, 205, 92, 84, - 2, 220, 50, 61, 38, 141, 117, 108, 101, 76, 139, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_grid_definition_dep_a_t *test_msg = - (msg_ssr_grid_definition_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.area_width = 43860; - test_msg->header.lat_nw_corner_enc = 34021; - test_msg->header.lon_nw_corner_enc = 11919; - test_msg->header.num_msgs = 204; - test_msg->header.region_size_inverse = 11; - test_msg->header.seq_num = 52; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[0] = 92; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[1] = 104; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[2] = 25; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[3] = 204; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[4] = 182; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[5] = 22; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[6] = 98; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[7] = 203; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[8] = 123; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[9] = 211; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[10] = 38; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[11] = 13; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[12] = 253; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[13] = 129; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[14] = 173; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[15] = 171; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[16] = 235; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[17] = 253; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[18] = 26; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[19] = 203; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[20] = 3; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[21] = 120; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[22] = 126; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[23] = 42; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[24] = 44; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[25] = 39; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[26] = 87; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[27] = 69; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[28] = 154; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[29] = 13; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[30] = 28; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[31] = 179; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[32] = 32; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[33] = 47; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[34] = 36; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[35] = 195; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[36] = 39; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[37] = 198; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[38] = 134; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[39] = 235; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[40] = 134; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[41] = 57; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[42] = 120; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[43] = 243; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[44] = 151; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[45] = 35; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[46] = 17; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[47] = 201; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[48] = 211; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[49] = 125; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[50] = 117; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[51] = 164; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[52] = 142; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[53] = 101; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[54] = 239; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[55] = 144; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[56] = 158; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[57] = 239; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[58] = 90; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[59] = 56; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[60] = 71; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[61] = 120; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[62] = 67; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[63] = 221; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[64] = 114; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[65] = 10; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[66] = 190; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[67] = 4; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[68] = 230; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[69] = 164; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[70] = 171; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[71] = 78; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[72] = 185; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[73] = 90; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[74] = 46; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[75] = 177; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[76] = 82; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[77] = 228; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[78] = 123; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[79] = 222; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[80] = 227; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[81] = 145; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[82] = 195; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[83] = 219; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[84] = 27; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[85] = 56; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[86] = 227; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[87] = 246; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[88] = 215; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[89] = 144; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[90] = 158; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[91] = 31; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[92] = 214; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[93] = 241; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[94] = 254; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[95] = 200; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[96] = 86; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[97] = 142; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[98] = 89; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[99] = 12; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[100] = 121; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[101] = 29; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[102] = 124; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[103] = 9; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[104] = 19; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[105] = 153; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[106] = 44; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[107] = 35; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[108] = 126; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[109] = 14; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[110] = 217; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[111] = 65; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[112] = 116; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[113] = 26; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[114] = 139; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[115] = 122; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[116] = 114; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[117] = 90; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[118] = 124; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[119] = 81; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[120] = 0; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[121] = 186; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[122] = 246; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[123] = 46; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[124] = 98; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[125] = 179; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[126] = 243; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[127] = 198; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[128] = 217; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[129] = 36; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[130] = 30; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[131] = 202; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[132] = 12; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[133] = 135; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[134] = 61; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[135] = 42; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[136] = 150; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[137] = 221; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[138] = 102; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[139] = 83; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[140] = 179; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[141] = 43; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[142] = 252; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[143] = 81; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[144] = 62; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[145] = 126; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[146] = 204; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[147] = 195; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[148] = 238; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[149] = 18; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[150] = 128; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[151] = 193; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[152] = 53; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[153] = 94; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[154] = 99; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[155] = 63; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[156] = 182; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[157] = 2; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[158] = 186; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[159] = 220; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[160] = 77; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[161] = 186; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[162] = 224; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[163] = 220; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[164] = 13; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[165] = 212; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[166] = 182; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[167] = 88; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[168] = 15; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[169] = 151; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[170] = 5; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[171] = 93; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[172] = 251; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[173] = 164; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[174] = 18; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[175] = 228; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[176] = 168; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[177] = 226; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[178] = 195; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[179] = 44; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[180] = 170; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[181] = 145; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[182] = 36; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[183] = 58; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[184] = 96; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[185] = 107; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[186] = 144; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[187] = 11; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[188] = 228; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[189] = 12; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[190] = 163; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[191] = 238; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[192] = 247; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[193] = 159; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[194] = 189; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[195] = 1; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[196] = 115; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[197] = 65; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[198] = 202; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[199] = 121; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[200] = 47; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[201] = 193; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[202] = 11; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[203] = 96; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[204] = 93; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[205] = 72; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[206] = 81; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[207] = 207; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[208] = 121; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[209] = 19; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[210] = 151; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[211] = 136; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[212] = 233; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[213] = 51; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[214] = 133; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[215] = 195; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[216] = 77; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[217] = 44; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[218] = 147; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[219] = 206; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[220] = 120; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[221] = 252; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[222] = 77; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[223] = 212; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[224] = 68; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[225] = 60; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[226] = 206; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[227] = 106; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[228] = 207; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[229] = 243; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[230] = 158; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[231] = 94; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[232] = 6; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[233] = 3; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[234] = 205; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[235] = 92; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[236] = 84; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[237] = 2; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[238] = 220; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[239] = 50; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[240] = 61; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[241] = 38; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[242] = 141; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[243] = 117; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[244] = 108; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->rle_list[0]); - } - test_msg->rle_list[245] = 101; - sbp_payload_send(&sbp_state, 0x5f5, 63413, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 63413, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 63413, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x5f5, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_grid_definition_dep_a_t *check_msg = - (msg_ssr_grid_definition_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - check_msg->header.area_width == 43860, - "incorrect value for header.area_width, expected 43860, is %d", - check_msg->header.area_width); - ck_assert_msg( - check_msg->header.lat_nw_corner_enc == 34021, - "incorrect value for header.lat_nw_corner_enc, expected 34021, is %d", - check_msg->header.lat_nw_corner_enc); - ck_assert_msg( - check_msg->header.lon_nw_corner_enc == 11919, - "incorrect value for header.lon_nw_corner_enc, expected 11919, is %d", - check_msg->header.lon_nw_corner_enc); - ck_assert_msg(check_msg->header.num_msgs == 204, - "incorrect value for header.num_msgs, expected 204, is %d", - check_msg->header.num_msgs); - ck_assert_msg( - check_msg->header.region_size_inverse == 11, - "incorrect value for header.region_size_inverse, expected 11, is %d", - check_msg->header.region_size_inverse); - ck_assert_msg(check_msg->header.seq_num == 52, - "incorrect value for header.seq_num, expected 52, is %d", - check_msg->header.seq_num); - ck_assert_msg(check_msg->rle_list[0] == 92, - "incorrect value for rle_list[0], expected 92, is %d", - check_msg->rle_list[0]); - ck_assert_msg(check_msg->rle_list[1] == 104, - "incorrect value for rle_list[1], expected 104, is %d", - check_msg->rle_list[1]); - ck_assert_msg(check_msg->rle_list[2] == 25, - "incorrect value for rle_list[2], expected 25, is %d", - check_msg->rle_list[2]); - ck_assert_msg(check_msg->rle_list[3] == 204, - "incorrect value for rle_list[3], expected 204, is %d", - check_msg->rle_list[3]); - ck_assert_msg(check_msg->rle_list[4] == 182, - "incorrect value for rle_list[4], expected 182, is %d", - check_msg->rle_list[4]); - ck_assert_msg(check_msg->rle_list[5] == 22, - "incorrect value for rle_list[5], expected 22, is %d", - check_msg->rle_list[5]); - ck_assert_msg(check_msg->rle_list[6] == 98, - "incorrect value for rle_list[6], expected 98, is %d", - check_msg->rle_list[6]); - ck_assert_msg(check_msg->rle_list[7] == 203, - "incorrect value for rle_list[7], expected 203, is %d", - check_msg->rle_list[7]); - ck_assert_msg(check_msg->rle_list[8] == 123, - "incorrect value for rle_list[8], expected 123, is %d", - check_msg->rle_list[8]); - ck_assert_msg(check_msg->rle_list[9] == 211, - "incorrect value for rle_list[9], expected 211, is %d", - check_msg->rle_list[9]); - ck_assert_msg(check_msg->rle_list[10] == 38, - "incorrect value for rle_list[10], expected 38, is %d", - check_msg->rle_list[10]); - ck_assert_msg(check_msg->rle_list[11] == 13, - "incorrect value for rle_list[11], expected 13, is %d", - check_msg->rle_list[11]); - ck_assert_msg(check_msg->rle_list[12] == 253, - "incorrect value for rle_list[12], expected 253, is %d", - check_msg->rle_list[12]); - ck_assert_msg(check_msg->rle_list[13] == 129, - "incorrect value for rle_list[13], expected 129, is %d", - check_msg->rle_list[13]); - ck_assert_msg(check_msg->rle_list[14] == 173, - "incorrect value for rle_list[14], expected 173, is %d", - check_msg->rle_list[14]); - ck_assert_msg(check_msg->rle_list[15] == 171, - "incorrect value for rle_list[15], expected 171, is %d", - check_msg->rle_list[15]); - ck_assert_msg(check_msg->rle_list[16] == 235, - "incorrect value for rle_list[16], expected 235, is %d", - check_msg->rle_list[16]); - ck_assert_msg(check_msg->rle_list[17] == 253, - "incorrect value for rle_list[17], expected 253, is %d", - check_msg->rle_list[17]); - ck_assert_msg(check_msg->rle_list[18] == 26, - "incorrect value for rle_list[18], expected 26, is %d", - check_msg->rle_list[18]); - ck_assert_msg(check_msg->rle_list[19] == 203, - "incorrect value for rle_list[19], expected 203, is %d", - check_msg->rle_list[19]); - ck_assert_msg(check_msg->rle_list[20] == 3, - "incorrect value for rle_list[20], expected 3, is %d", - check_msg->rle_list[20]); - ck_assert_msg(check_msg->rle_list[21] == 120, - "incorrect value for rle_list[21], expected 120, is %d", - check_msg->rle_list[21]); - ck_assert_msg(check_msg->rle_list[22] == 126, - "incorrect value for rle_list[22], expected 126, is %d", - check_msg->rle_list[22]); - ck_assert_msg(check_msg->rle_list[23] == 42, - "incorrect value for rle_list[23], expected 42, is %d", - check_msg->rle_list[23]); - ck_assert_msg(check_msg->rle_list[24] == 44, - "incorrect value for rle_list[24], expected 44, is %d", - check_msg->rle_list[24]); - ck_assert_msg(check_msg->rle_list[25] == 39, - "incorrect value for rle_list[25], expected 39, is %d", - check_msg->rle_list[25]); - ck_assert_msg(check_msg->rle_list[26] == 87, - "incorrect value for rle_list[26], expected 87, is %d", - check_msg->rle_list[26]); - ck_assert_msg(check_msg->rle_list[27] == 69, - "incorrect value for rle_list[27], expected 69, is %d", - check_msg->rle_list[27]); - ck_assert_msg(check_msg->rle_list[28] == 154, - "incorrect value for rle_list[28], expected 154, is %d", - check_msg->rle_list[28]); - ck_assert_msg(check_msg->rle_list[29] == 13, - "incorrect value for rle_list[29], expected 13, is %d", - check_msg->rle_list[29]); - ck_assert_msg(check_msg->rle_list[30] == 28, - "incorrect value for rle_list[30], expected 28, is %d", - check_msg->rle_list[30]); - ck_assert_msg(check_msg->rle_list[31] == 179, - "incorrect value for rle_list[31], expected 179, is %d", - check_msg->rle_list[31]); - ck_assert_msg(check_msg->rle_list[32] == 32, - "incorrect value for rle_list[32], expected 32, is %d", - check_msg->rle_list[32]); - ck_assert_msg(check_msg->rle_list[33] == 47, - "incorrect value for rle_list[33], expected 47, is %d", - check_msg->rle_list[33]); - ck_assert_msg(check_msg->rle_list[34] == 36, - "incorrect value for rle_list[34], expected 36, is %d", - check_msg->rle_list[34]); - ck_assert_msg(check_msg->rle_list[35] == 195, - "incorrect value for rle_list[35], expected 195, is %d", - check_msg->rle_list[35]); - ck_assert_msg(check_msg->rle_list[36] == 39, - "incorrect value for rle_list[36], expected 39, is %d", - check_msg->rle_list[36]); - ck_assert_msg(check_msg->rle_list[37] == 198, - "incorrect value for rle_list[37], expected 198, is %d", - check_msg->rle_list[37]); - ck_assert_msg(check_msg->rle_list[38] == 134, - "incorrect value for rle_list[38], expected 134, is %d", - check_msg->rle_list[38]); - ck_assert_msg(check_msg->rle_list[39] == 235, - "incorrect value for rle_list[39], expected 235, is %d", - check_msg->rle_list[39]); - ck_assert_msg(check_msg->rle_list[40] == 134, - "incorrect value for rle_list[40], expected 134, is %d", - check_msg->rle_list[40]); - ck_assert_msg(check_msg->rle_list[41] == 57, - "incorrect value for rle_list[41], expected 57, is %d", - check_msg->rle_list[41]); - ck_assert_msg(check_msg->rle_list[42] == 120, - "incorrect value for rle_list[42], expected 120, is %d", - check_msg->rle_list[42]); - ck_assert_msg(check_msg->rle_list[43] == 243, - "incorrect value for rle_list[43], expected 243, is %d", - check_msg->rle_list[43]); - ck_assert_msg(check_msg->rle_list[44] == 151, - "incorrect value for rle_list[44], expected 151, is %d", - check_msg->rle_list[44]); - ck_assert_msg(check_msg->rle_list[45] == 35, - "incorrect value for rle_list[45], expected 35, is %d", - check_msg->rle_list[45]); - ck_assert_msg(check_msg->rle_list[46] == 17, - "incorrect value for rle_list[46], expected 17, is %d", - check_msg->rle_list[46]); - ck_assert_msg(check_msg->rle_list[47] == 201, - "incorrect value for rle_list[47], expected 201, is %d", - check_msg->rle_list[47]); - ck_assert_msg(check_msg->rle_list[48] == 211, - "incorrect value for rle_list[48], expected 211, is %d", - check_msg->rle_list[48]); - ck_assert_msg(check_msg->rle_list[49] == 125, - "incorrect value for rle_list[49], expected 125, is %d", - check_msg->rle_list[49]); - ck_assert_msg(check_msg->rle_list[50] == 117, - "incorrect value for rle_list[50], expected 117, is %d", - check_msg->rle_list[50]); - ck_assert_msg(check_msg->rle_list[51] == 164, - "incorrect value for rle_list[51], expected 164, is %d", - check_msg->rle_list[51]); - ck_assert_msg(check_msg->rle_list[52] == 142, - "incorrect value for rle_list[52], expected 142, is %d", - check_msg->rle_list[52]); - ck_assert_msg(check_msg->rle_list[53] == 101, - "incorrect value for rle_list[53], expected 101, is %d", - check_msg->rle_list[53]); - ck_assert_msg(check_msg->rle_list[54] == 239, - "incorrect value for rle_list[54], expected 239, is %d", - check_msg->rle_list[54]); - ck_assert_msg(check_msg->rle_list[55] == 144, - "incorrect value for rle_list[55], expected 144, is %d", - check_msg->rle_list[55]); - ck_assert_msg(check_msg->rle_list[56] == 158, - "incorrect value for rle_list[56], expected 158, is %d", - check_msg->rle_list[56]); - ck_assert_msg(check_msg->rle_list[57] == 239, - "incorrect value for rle_list[57], expected 239, is %d", - check_msg->rle_list[57]); - ck_assert_msg(check_msg->rle_list[58] == 90, - "incorrect value for rle_list[58], expected 90, is %d", - check_msg->rle_list[58]); - ck_assert_msg(check_msg->rle_list[59] == 56, - "incorrect value for rle_list[59], expected 56, is %d", - check_msg->rle_list[59]); - ck_assert_msg(check_msg->rle_list[60] == 71, - "incorrect value for rle_list[60], expected 71, is %d", - check_msg->rle_list[60]); - ck_assert_msg(check_msg->rle_list[61] == 120, - "incorrect value for rle_list[61], expected 120, is %d", - check_msg->rle_list[61]); - ck_assert_msg(check_msg->rle_list[62] == 67, - "incorrect value for rle_list[62], expected 67, is %d", - check_msg->rle_list[62]); - ck_assert_msg(check_msg->rle_list[63] == 221, - "incorrect value for rle_list[63], expected 221, is %d", - check_msg->rle_list[63]); - ck_assert_msg(check_msg->rle_list[64] == 114, - "incorrect value for rle_list[64], expected 114, is %d", - check_msg->rle_list[64]); - ck_assert_msg(check_msg->rle_list[65] == 10, - "incorrect value for rle_list[65], expected 10, is %d", - check_msg->rle_list[65]); - ck_assert_msg(check_msg->rle_list[66] == 190, - "incorrect value for rle_list[66], expected 190, is %d", - check_msg->rle_list[66]); - ck_assert_msg(check_msg->rle_list[67] == 4, - "incorrect value for rle_list[67], expected 4, is %d", - check_msg->rle_list[67]); - ck_assert_msg(check_msg->rle_list[68] == 230, - "incorrect value for rle_list[68], expected 230, is %d", - check_msg->rle_list[68]); - ck_assert_msg(check_msg->rle_list[69] == 164, - "incorrect value for rle_list[69], expected 164, is %d", - check_msg->rle_list[69]); - ck_assert_msg(check_msg->rle_list[70] == 171, - "incorrect value for rle_list[70], expected 171, is %d", - check_msg->rle_list[70]); - ck_assert_msg(check_msg->rle_list[71] == 78, - "incorrect value for rle_list[71], expected 78, is %d", - check_msg->rle_list[71]); - ck_assert_msg(check_msg->rle_list[72] == 185, - "incorrect value for rle_list[72], expected 185, is %d", - check_msg->rle_list[72]); - ck_assert_msg(check_msg->rle_list[73] == 90, - "incorrect value for rle_list[73], expected 90, is %d", - check_msg->rle_list[73]); - ck_assert_msg(check_msg->rle_list[74] == 46, - "incorrect value for rle_list[74], expected 46, is %d", - check_msg->rle_list[74]); - ck_assert_msg(check_msg->rle_list[75] == 177, - "incorrect value for rle_list[75], expected 177, is %d", - check_msg->rle_list[75]); - ck_assert_msg(check_msg->rle_list[76] == 82, - "incorrect value for rle_list[76], expected 82, is %d", - check_msg->rle_list[76]); - ck_assert_msg(check_msg->rle_list[77] == 228, - "incorrect value for rle_list[77], expected 228, is %d", - check_msg->rle_list[77]); - ck_assert_msg(check_msg->rle_list[78] == 123, - "incorrect value for rle_list[78], expected 123, is %d", - check_msg->rle_list[78]); - ck_assert_msg(check_msg->rle_list[79] == 222, - "incorrect value for rle_list[79], expected 222, is %d", - check_msg->rle_list[79]); - ck_assert_msg(check_msg->rle_list[80] == 227, - "incorrect value for rle_list[80], expected 227, is %d", - check_msg->rle_list[80]); - ck_assert_msg(check_msg->rle_list[81] == 145, - "incorrect value for rle_list[81], expected 145, is %d", - check_msg->rle_list[81]); - ck_assert_msg(check_msg->rle_list[82] == 195, - "incorrect value for rle_list[82], expected 195, is %d", - check_msg->rle_list[82]); - ck_assert_msg(check_msg->rle_list[83] == 219, - "incorrect value for rle_list[83], expected 219, is %d", - check_msg->rle_list[83]); - ck_assert_msg(check_msg->rle_list[84] == 27, - "incorrect value for rle_list[84], expected 27, is %d", - check_msg->rle_list[84]); - ck_assert_msg(check_msg->rle_list[85] == 56, - "incorrect value for rle_list[85], expected 56, is %d", - check_msg->rle_list[85]); - ck_assert_msg(check_msg->rle_list[86] == 227, - "incorrect value for rle_list[86], expected 227, is %d", - check_msg->rle_list[86]); - ck_assert_msg(check_msg->rle_list[87] == 246, - "incorrect value for rle_list[87], expected 246, is %d", - check_msg->rle_list[87]); - ck_assert_msg(check_msg->rle_list[88] == 215, - "incorrect value for rle_list[88], expected 215, is %d", - check_msg->rle_list[88]); - ck_assert_msg(check_msg->rle_list[89] == 144, - "incorrect value for rle_list[89], expected 144, is %d", - check_msg->rle_list[89]); - ck_assert_msg(check_msg->rle_list[90] == 158, - "incorrect value for rle_list[90], expected 158, is %d", - check_msg->rle_list[90]); - ck_assert_msg(check_msg->rle_list[91] == 31, - "incorrect value for rle_list[91], expected 31, is %d", - check_msg->rle_list[91]); - ck_assert_msg(check_msg->rle_list[92] == 214, - "incorrect value for rle_list[92], expected 214, is %d", - check_msg->rle_list[92]); - ck_assert_msg(check_msg->rle_list[93] == 241, - "incorrect value for rle_list[93], expected 241, is %d", - check_msg->rle_list[93]); - ck_assert_msg(check_msg->rle_list[94] == 254, - "incorrect value for rle_list[94], expected 254, is %d", - check_msg->rle_list[94]); - ck_assert_msg(check_msg->rle_list[95] == 200, - "incorrect value for rle_list[95], expected 200, is %d", - check_msg->rle_list[95]); - ck_assert_msg(check_msg->rle_list[96] == 86, - "incorrect value for rle_list[96], expected 86, is %d", - check_msg->rle_list[96]); - ck_assert_msg(check_msg->rle_list[97] == 142, - "incorrect value for rle_list[97], expected 142, is %d", - check_msg->rle_list[97]); - ck_assert_msg(check_msg->rle_list[98] == 89, - "incorrect value for rle_list[98], expected 89, is %d", - check_msg->rle_list[98]); - ck_assert_msg(check_msg->rle_list[99] == 12, - "incorrect value for rle_list[99], expected 12, is %d", - check_msg->rle_list[99]); - ck_assert_msg(check_msg->rle_list[100] == 121, - "incorrect value for rle_list[100], expected 121, is %d", - check_msg->rle_list[100]); - ck_assert_msg(check_msg->rle_list[101] == 29, - "incorrect value for rle_list[101], expected 29, is %d", - check_msg->rle_list[101]); - ck_assert_msg(check_msg->rle_list[102] == 124, - "incorrect value for rle_list[102], expected 124, is %d", - check_msg->rle_list[102]); - ck_assert_msg(check_msg->rle_list[103] == 9, - "incorrect value for rle_list[103], expected 9, is %d", - check_msg->rle_list[103]); - ck_assert_msg(check_msg->rle_list[104] == 19, - "incorrect value for rle_list[104], expected 19, is %d", - check_msg->rle_list[104]); - ck_assert_msg(check_msg->rle_list[105] == 153, - "incorrect value for rle_list[105], expected 153, is %d", - check_msg->rle_list[105]); - ck_assert_msg(check_msg->rle_list[106] == 44, - "incorrect value for rle_list[106], expected 44, is %d", - check_msg->rle_list[106]); - ck_assert_msg(check_msg->rle_list[107] == 35, - "incorrect value for rle_list[107], expected 35, is %d", - check_msg->rle_list[107]); - ck_assert_msg(check_msg->rle_list[108] == 126, - "incorrect value for rle_list[108], expected 126, is %d", - check_msg->rle_list[108]); - ck_assert_msg(check_msg->rle_list[109] == 14, - "incorrect value for rle_list[109], expected 14, is %d", - check_msg->rle_list[109]); - ck_assert_msg(check_msg->rle_list[110] == 217, - "incorrect value for rle_list[110], expected 217, is %d", - check_msg->rle_list[110]); - ck_assert_msg(check_msg->rle_list[111] == 65, - "incorrect value for rle_list[111], expected 65, is %d", - check_msg->rle_list[111]); - ck_assert_msg(check_msg->rle_list[112] == 116, - "incorrect value for rle_list[112], expected 116, is %d", - check_msg->rle_list[112]); - ck_assert_msg(check_msg->rle_list[113] == 26, - "incorrect value for rle_list[113], expected 26, is %d", - check_msg->rle_list[113]); - ck_assert_msg(check_msg->rle_list[114] == 139, - "incorrect value for rle_list[114], expected 139, is %d", - check_msg->rle_list[114]); - ck_assert_msg(check_msg->rle_list[115] == 122, - "incorrect value for rle_list[115], expected 122, is %d", - check_msg->rle_list[115]); - ck_assert_msg(check_msg->rle_list[116] == 114, - "incorrect value for rle_list[116], expected 114, is %d", - check_msg->rle_list[116]); - ck_assert_msg(check_msg->rle_list[117] == 90, - "incorrect value for rle_list[117], expected 90, is %d", - check_msg->rle_list[117]); - ck_assert_msg(check_msg->rle_list[118] == 124, - "incorrect value for rle_list[118], expected 124, is %d", - check_msg->rle_list[118]); - ck_assert_msg(check_msg->rle_list[119] == 81, - "incorrect value for rle_list[119], expected 81, is %d", - check_msg->rle_list[119]); - ck_assert_msg(check_msg->rle_list[120] == 0, - "incorrect value for rle_list[120], expected 0, is %d", - check_msg->rle_list[120]); - ck_assert_msg(check_msg->rle_list[121] == 186, - "incorrect value for rle_list[121], expected 186, is %d", - check_msg->rle_list[121]); - ck_assert_msg(check_msg->rle_list[122] == 246, - "incorrect value for rle_list[122], expected 246, is %d", - check_msg->rle_list[122]); - ck_assert_msg(check_msg->rle_list[123] == 46, - "incorrect value for rle_list[123], expected 46, is %d", - check_msg->rle_list[123]); - ck_assert_msg(check_msg->rle_list[124] == 98, - "incorrect value for rle_list[124], expected 98, is %d", - check_msg->rle_list[124]); - ck_assert_msg(check_msg->rle_list[125] == 179, - "incorrect value for rle_list[125], expected 179, is %d", - check_msg->rle_list[125]); - ck_assert_msg(check_msg->rle_list[126] == 243, - "incorrect value for rle_list[126], expected 243, is %d", - check_msg->rle_list[126]); - ck_assert_msg(check_msg->rle_list[127] == 198, - "incorrect value for rle_list[127], expected 198, is %d", - check_msg->rle_list[127]); - ck_assert_msg(check_msg->rle_list[128] == 217, - "incorrect value for rle_list[128], expected 217, is %d", - check_msg->rle_list[128]); - ck_assert_msg(check_msg->rle_list[129] == 36, - "incorrect value for rle_list[129], expected 36, is %d", - check_msg->rle_list[129]); - ck_assert_msg(check_msg->rle_list[130] == 30, - "incorrect value for rle_list[130], expected 30, is %d", - check_msg->rle_list[130]); - ck_assert_msg(check_msg->rle_list[131] == 202, - "incorrect value for rle_list[131], expected 202, is %d", - check_msg->rle_list[131]); - ck_assert_msg(check_msg->rle_list[132] == 12, - "incorrect value for rle_list[132], expected 12, is %d", - check_msg->rle_list[132]); - ck_assert_msg(check_msg->rle_list[133] == 135, - "incorrect value for rle_list[133], expected 135, is %d", - check_msg->rle_list[133]); - ck_assert_msg(check_msg->rle_list[134] == 61, - "incorrect value for rle_list[134], expected 61, is %d", - check_msg->rle_list[134]); - ck_assert_msg(check_msg->rle_list[135] == 42, - "incorrect value for rle_list[135], expected 42, is %d", - check_msg->rle_list[135]); - ck_assert_msg(check_msg->rle_list[136] == 150, - "incorrect value for rle_list[136], expected 150, is %d", - check_msg->rle_list[136]); - ck_assert_msg(check_msg->rle_list[137] == 221, - "incorrect value for rle_list[137], expected 221, is %d", - check_msg->rle_list[137]); - ck_assert_msg(check_msg->rle_list[138] == 102, - "incorrect value for rle_list[138], expected 102, is %d", - check_msg->rle_list[138]); - ck_assert_msg(check_msg->rle_list[139] == 83, - "incorrect value for rle_list[139], expected 83, is %d", - check_msg->rle_list[139]); - ck_assert_msg(check_msg->rle_list[140] == 179, - "incorrect value for rle_list[140], expected 179, is %d", - check_msg->rle_list[140]); - ck_assert_msg(check_msg->rle_list[141] == 43, - "incorrect value for rle_list[141], expected 43, is %d", - check_msg->rle_list[141]); - ck_assert_msg(check_msg->rle_list[142] == 252, - "incorrect value for rle_list[142], expected 252, is %d", - check_msg->rle_list[142]); - ck_assert_msg(check_msg->rle_list[143] == 81, - "incorrect value for rle_list[143], expected 81, is %d", - check_msg->rle_list[143]); - ck_assert_msg(check_msg->rle_list[144] == 62, - "incorrect value for rle_list[144], expected 62, is %d", - check_msg->rle_list[144]); - ck_assert_msg(check_msg->rle_list[145] == 126, - "incorrect value for rle_list[145], expected 126, is %d", - check_msg->rle_list[145]); - ck_assert_msg(check_msg->rle_list[146] == 204, - "incorrect value for rle_list[146], expected 204, is %d", - check_msg->rle_list[146]); - ck_assert_msg(check_msg->rle_list[147] == 195, - "incorrect value for rle_list[147], expected 195, is %d", - check_msg->rle_list[147]); - ck_assert_msg(check_msg->rle_list[148] == 238, - "incorrect value for rle_list[148], expected 238, is %d", - check_msg->rle_list[148]); - ck_assert_msg(check_msg->rle_list[149] == 18, - "incorrect value for rle_list[149], expected 18, is %d", - check_msg->rle_list[149]); - ck_assert_msg(check_msg->rle_list[150] == 128, - "incorrect value for rle_list[150], expected 128, is %d", - check_msg->rle_list[150]); - ck_assert_msg(check_msg->rle_list[151] == 193, - "incorrect value for rle_list[151], expected 193, is %d", - check_msg->rle_list[151]); - ck_assert_msg(check_msg->rle_list[152] == 53, - "incorrect value for rle_list[152], expected 53, is %d", - check_msg->rle_list[152]); - ck_assert_msg(check_msg->rle_list[153] == 94, - "incorrect value for rle_list[153], expected 94, is %d", - check_msg->rle_list[153]); - ck_assert_msg(check_msg->rle_list[154] == 99, - "incorrect value for rle_list[154], expected 99, is %d", - check_msg->rle_list[154]); - ck_assert_msg(check_msg->rle_list[155] == 63, - "incorrect value for rle_list[155], expected 63, is %d", - check_msg->rle_list[155]); - ck_assert_msg(check_msg->rle_list[156] == 182, - "incorrect value for rle_list[156], expected 182, is %d", - check_msg->rle_list[156]); - ck_assert_msg(check_msg->rle_list[157] == 2, - "incorrect value for rle_list[157], expected 2, is %d", - check_msg->rle_list[157]); - ck_assert_msg(check_msg->rle_list[158] == 186, - "incorrect value for rle_list[158], expected 186, is %d", - check_msg->rle_list[158]); - ck_assert_msg(check_msg->rle_list[159] == 220, - "incorrect value for rle_list[159], expected 220, is %d", - check_msg->rle_list[159]); - ck_assert_msg(check_msg->rle_list[160] == 77, - "incorrect value for rle_list[160], expected 77, is %d", - check_msg->rle_list[160]); - ck_assert_msg(check_msg->rle_list[161] == 186, - "incorrect value for rle_list[161], expected 186, is %d", - check_msg->rle_list[161]); - ck_assert_msg(check_msg->rle_list[162] == 224, - "incorrect value for rle_list[162], expected 224, is %d", - check_msg->rle_list[162]); - ck_assert_msg(check_msg->rle_list[163] == 220, - "incorrect value for rle_list[163], expected 220, is %d", - check_msg->rle_list[163]); - ck_assert_msg(check_msg->rle_list[164] == 13, - "incorrect value for rle_list[164], expected 13, is %d", - check_msg->rle_list[164]); - ck_assert_msg(check_msg->rle_list[165] == 212, - "incorrect value for rle_list[165], expected 212, is %d", - check_msg->rle_list[165]); - ck_assert_msg(check_msg->rle_list[166] == 182, - "incorrect value for rle_list[166], expected 182, is %d", - check_msg->rle_list[166]); - ck_assert_msg(check_msg->rle_list[167] == 88, - "incorrect value for rle_list[167], expected 88, is %d", - check_msg->rle_list[167]); - ck_assert_msg(check_msg->rle_list[168] == 15, - "incorrect value for rle_list[168], expected 15, is %d", - check_msg->rle_list[168]); - ck_assert_msg(check_msg->rle_list[169] == 151, - "incorrect value for rle_list[169], expected 151, is %d", - check_msg->rle_list[169]); - ck_assert_msg(check_msg->rle_list[170] == 5, - "incorrect value for rle_list[170], expected 5, is %d", - check_msg->rle_list[170]); - ck_assert_msg(check_msg->rle_list[171] == 93, - "incorrect value for rle_list[171], expected 93, is %d", - check_msg->rle_list[171]); - ck_assert_msg(check_msg->rle_list[172] == 251, - "incorrect value for rle_list[172], expected 251, is %d", - check_msg->rle_list[172]); - ck_assert_msg(check_msg->rle_list[173] == 164, - "incorrect value for rle_list[173], expected 164, is %d", - check_msg->rle_list[173]); - ck_assert_msg(check_msg->rle_list[174] == 18, - "incorrect value for rle_list[174], expected 18, is %d", - check_msg->rle_list[174]); - ck_assert_msg(check_msg->rle_list[175] == 228, - "incorrect value for rle_list[175], expected 228, is %d", - check_msg->rle_list[175]); - ck_assert_msg(check_msg->rle_list[176] == 168, - "incorrect value for rle_list[176], expected 168, is %d", - check_msg->rle_list[176]); - ck_assert_msg(check_msg->rle_list[177] == 226, - "incorrect value for rle_list[177], expected 226, is %d", - check_msg->rle_list[177]); - ck_assert_msg(check_msg->rle_list[178] == 195, - "incorrect value for rle_list[178], expected 195, is %d", - check_msg->rle_list[178]); - ck_assert_msg(check_msg->rle_list[179] == 44, - "incorrect value for rle_list[179], expected 44, is %d", - check_msg->rle_list[179]); - ck_assert_msg(check_msg->rle_list[180] == 170, - "incorrect value for rle_list[180], expected 170, is %d", - check_msg->rle_list[180]); - ck_assert_msg(check_msg->rle_list[181] == 145, - "incorrect value for rle_list[181], expected 145, is %d", - check_msg->rle_list[181]); - ck_assert_msg(check_msg->rle_list[182] == 36, - "incorrect value for rle_list[182], expected 36, is %d", - check_msg->rle_list[182]); - ck_assert_msg(check_msg->rle_list[183] == 58, - "incorrect value for rle_list[183], expected 58, is %d", - check_msg->rle_list[183]); - ck_assert_msg(check_msg->rle_list[184] == 96, - "incorrect value for rle_list[184], expected 96, is %d", - check_msg->rle_list[184]); - ck_assert_msg(check_msg->rle_list[185] == 107, - "incorrect value for rle_list[185], expected 107, is %d", - check_msg->rle_list[185]); - ck_assert_msg(check_msg->rle_list[186] == 144, - "incorrect value for rle_list[186], expected 144, is %d", - check_msg->rle_list[186]); - ck_assert_msg(check_msg->rle_list[187] == 11, - "incorrect value for rle_list[187], expected 11, is %d", - check_msg->rle_list[187]); - ck_assert_msg(check_msg->rle_list[188] == 228, - "incorrect value for rle_list[188], expected 228, is %d", - check_msg->rle_list[188]); - ck_assert_msg(check_msg->rle_list[189] == 12, - "incorrect value for rle_list[189], expected 12, is %d", - check_msg->rle_list[189]); - ck_assert_msg(check_msg->rle_list[190] == 163, - "incorrect value for rle_list[190], expected 163, is %d", - check_msg->rle_list[190]); - ck_assert_msg(check_msg->rle_list[191] == 238, - "incorrect value for rle_list[191], expected 238, is %d", - check_msg->rle_list[191]); - ck_assert_msg(check_msg->rle_list[192] == 247, - "incorrect value for rle_list[192], expected 247, is %d", - check_msg->rle_list[192]); - ck_assert_msg(check_msg->rle_list[193] == 159, - "incorrect value for rle_list[193], expected 159, is %d", - check_msg->rle_list[193]); - ck_assert_msg(check_msg->rle_list[194] == 189, - "incorrect value for rle_list[194], expected 189, is %d", - check_msg->rle_list[194]); - ck_assert_msg(check_msg->rle_list[195] == 1, - "incorrect value for rle_list[195], expected 1, is %d", - check_msg->rle_list[195]); - ck_assert_msg(check_msg->rle_list[196] == 115, - "incorrect value for rle_list[196], expected 115, is %d", - check_msg->rle_list[196]); - ck_assert_msg(check_msg->rle_list[197] == 65, - "incorrect value for rle_list[197], expected 65, is %d", - check_msg->rle_list[197]); - ck_assert_msg(check_msg->rle_list[198] == 202, - "incorrect value for rle_list[198], expected 202, is %d", - check_msg->rle_list[198]); - ck_assert_msg(check_msg->rle_list[199] == 121, - "incorrect value for rle_list[199], expected 121, is %d", - check_msg->rle_list[199]); - ck_assert_msg(check_msg->rle_list[200] == 47, - "incorrect value for rle_list[200], expected 47, is %d", - check_msg->rle_list[200]); - ck_assert_msg(check_msg->rle_list[201] == 193, - "incorrect value for rle_list[201], expected 193, is %d", - check_msg->rle_list[201]); - ck_assert_msg(check_msg->rle_list[202] == 11, - "incorrect value for rle_list[202], expected 11, is %d", - check_msg->rle_list[202]); - ck_assert_msg(check_msg->rle_list[203] == 96, - "incorrect value for rle_list[203], expected 96, is %d", - check_msg->rle_list[203]); - ck_assert_msg(check_msg->rle_list[204] == 93, - "incorrect value for rle_list[204], expected 93, is %d", - check_msg->rle_list[204]); - ck_assert_msg(check_msg->rle_list[205] == 72, - "incorrect value for rle_list[205], expected 72, is %d", - check_msg->rle_list[205]); - ck_assert_msg(check_msg->rle_list[206] == 81, - "incorrect value for rle_list[206], expected 81, is %d", - check_msg->rle_list[206]); - ck_assert_msg(check_msg->rle_list[207] == 207, - "incorrect value for rle_list[207], expected 207, is %d", - check_msg->rle_list[207]); - ck_assert_msg(check_msg->rle_list[208] == 121, - "incorrect value for rle_list[208], expected 121, is %d", - check_msg->rle_list[208]); - ck_assert_msg(check_msg->rle_list[209] == 19, - "incorrect value for rle_list[209], expected 19, is %d", - check_msg->rle_list[209]); - ck_assert_msg(check_msg->rle_list[210] == 151, - "incorrect value for rle_list[210], expected 151, is %d", - check_msg->rle_list[210]); - ck_assert_msg(check_msg->rle_list[211] == 136, - "incorrect value for rle_list[211], expected 136, is %d", - check_msg->rle_list[211]); - ck_assert_msg(check_msg->rle_list[212] == 233, - "incorrect value for rle_list[212], expected 233, is %d", - check_msg->rle_list[212]); - ck_assert_msg(check_msg->rle_list[213] == 51, - "incorrect value for rle_list[213], expected 51, is %d", - check_msg->rle_list[213]); - ck_assert_msg(check_msg->rle_list[214] == 133, - "incorrect value for rle_list[214], expected 133, is %d", - check_msg->rle_list[214]); - ck_assert_msg(check_msg->rle_list[215] == 195, - "incorrect value for rle_list[215], expected 195, is %d", - check_msg->rle_list[215]); - ck_assert_msg(check_msg->rle_list[216] == 77, - "incorrect value for rle_list[216], expected 77, is %d", - check_msg->rle_list[216]); - ck_assert_msg(check_msg->rle_list[217] == 44, - "incorrect value for rle_list[217], expected 44, is %d", - check_msg->rle_list[217]); - ck_assert_msg(check_msg->rle_list[218] == 147, - "incorrect value for rle_list[218], expected 147, is %d", - check_msg->rle_list[218]); - ck_assert_msg(check_msg->rle_list[219] == 206, - "incorrect value for rle_list[219], expected 206, is %d", - check_msg->rle_list[219]); - ck_assert_msg(check_msg->rle_list[220] == 120, - "incorrect value for rle_list[220], expected 120, is %d", - check_msg->rle_list[220]); - ck_assert_msg(check_msg->rle_list[221] == 252, - "incorrect value for rle_list[221], expected 252, is %d", - check_msg->rle_list[221]); - ck_assert_msg(check_msg->rle_list[222] == 77, - "incorrect value for rle_list[222], expected 77, is %d", - check_msg->rle_list[222]); - ck_assert_msg(check_msg->rle_list[223] == 212, - "incorrect value for rle_list[223], expected 212, is %d", - check_msg->rle_list[223]); - ck_assert_msg(check_msg->rle_list[224] == 68, - "incorrect value for rle_list[224], expected 68, is %d", - check_msg->rle_list[224]); - ck_assert_msg(check_msg->rle_list[225] == 60, - "incorrect value for rle_list[225], expected 60, is %d", - check_msg->rle_list[225]); - ck_assert_msg(check_msg->rle_list[226] == 206, - "incorrect value for rle_list[226], expected 206, is %d", - check_msg->rle_list[226]); - ck_assert_msg(check_msg->rle_list[227] == 106, - "incorrect value for rle_list[227], expected 106, is %d", - check_msg->rle_list[227]); - ck_assert_msg(check_msg->rle_list[228] == 207, - "incorrect value for rle_list[228], expected 207, is %d", - check_msg->rle_list[228]); - ck_assert_msg(check_msg->rle_list[229] == 243, - "incorrect value for rle_list[229], expected 243, is %d", - check_msg->rle_list[229]); - ck_assert_msg(check_msg->rle_list[230] == 158, - "incorrect value for rle_list[230], expected 158, is %d", - check_msg->rle_list[230]); - ck_assert_msg(check_msg->rle_list[231] == 94, - "incorrect value for rle_list[231], expected 94, is %d", - check_msg->rle_list[231]); - ck_assert_msg(check_msg->rle_list[232] == 6, - "incorrect value for rle_list[232], expected 6, is %d", - check_msg->rle_list[232]); - ck_assert_msg(check_msg->rle_list[233] == 3, - "incorrect value for rle_list[233], expected 3, is %d", - check_msg->rle_list[233]); - ck_assert_msg(check_msg->rle_list[234] == 205, - "incorrect value for rle_list[234], expected 205, is %d", - check_msg->rle_list[234]); - ck_assert_msg(check_msg->rle_list[235] == 92, - "incorrect value for rle_list[235], expected 92, is %d", - check_msg->rle_list[235]); - ck_assert_msg(check_msg->rle_list[236] == 84, - "incorrect value for rle_list[236], expected 84, is %d", - check_msg->rle_list[236]); - ck_assert_msg(check_msg->rle_list[237] == 2, - "incorrect value for rle_list[237], expected 2, is %d", - check_msg->rle_list[237]); - ck_assert_msg(check_msg->rle_list[238] == 220, - "incorrect value for rle_list[238], expected 220, is %d", - check_msg->rle_list[238]); - ck_assert_msg(check_msg->rle_list[239] == 50, - "incorrect value for rle_list[239], expected 50, is %d", - check_msg->rle_list[239]); - ck_assert_msg(check_msg->rle_list[240] == 61, - "incorrect value for rle_list[240], expected 61, is %d", - check_msg->rle_list[240]); - ck_assert_msg(check_msg->rle_list[241] == 38, - "incorrect value for rle_list[241], expected 38, is %d", - check_msg->rle_list[241]); - ck_assert_msg(check_msg->rle_list[242] == 141, - "incorrect value for rle_list[242], expected 141, is %d", - check_msg->rle_list[242]); - ck_assert_msg(check_msg->rle_list[243] == 117, - "incorrect value for rle_list[243], expected 117, is %d", - check_msg->rle_list[243]); - ck_assert_msg(check_msg->rle_list[244] == 108, - "incorrect value for rle_list[244], expected 108, is %d", - check_msg->rle_list[244]); - ck_assert_msg(check_msg->rle_list[245] == 101, - "incorrect value for rle_list[245], expected 101, is %d", - check_msg->rle_list[245]); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrGridDefinitionDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_ssr_MsgSsrGridDefinitionDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_MsgSsrGridDefinitionDepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_ssr_MsgSsrGridDefinitionDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrGriddedCorrection.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrGriddedCorrection.c deleted file mode 100644 index 12ecfae70e..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrGriddedCorrection.c +++ /dev/null @@ -1,1396 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrGriddedCorrection.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrection) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x5fc, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x5fc, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 252, 5, 196, 249, 253, 21, 14, 151, 50, 120, 133, 29, 151, - 174, 229, 151, 189, 204, 196, 105, 170, 120, 149, 169, 37, 244, 78, - 72, 140, 101, 2, 173, 88, 70, 180, 54, 152, 115, 78, 201, 161, - 23, 135, 152, 98, 61, 75, 178, 120, 229, 146, 55, 58, 169, 234, - 230, 69, 172, 191, 127, 146, 89, 150, 91, 111, 225, 41, 17, 119, - 52, 166, 166, 120, 57, 221, 12, 3, 156, 70, 156, 35, 127, 8, - 127, 58, 128, 55, 115, 80, 157, 122, 153, 124, 27, 128, 98, 103, - 204, 75, 238, 128, 226, 148, 248, 61, 216, 208, 149, 167, 224, 40, - 144, 186, 157, 227, 72, 240, 100, 35, 12, 212, 7, 59, 176, 81, - 86, 27, 24, 155, 67, 43, 132, 45, 203, 44, 6, 112, 183, 231, - 176, 79, 194, 253, 247, 103, 91, 226, 116, 148, 23, 62, 227, 240, - 29, 219, 205, 18, 242, 207, 72, 71, 79, 37, 42, 176, 201, 202, - 91, 105, 115, 146, 59, 110, 44, 109, 128, 183, 185, 67, 31, 165, - 92, 79, 189, 180, 94, 7, 162, 121, 156, 210, 47, 7, 7, 205, - 174, 41, 241, 129, 210, 43, 101, 186, 208, 195, 226, 247, 187, 219, - 160, 120, 192, 102, 166, 42, 246, 173, 94, 102, 156, 222, 30, 35, - 247, 64, 189, 137, 204, 220, 32, 71, 222, 222, 201, 246, 3, 25, - 45, 251, 239, 115, 88, 218, 10, 209, 120, 65, 175, 131, 194, 41, - 174, 137, 17, 68, 28, 253, 42, 178, 35, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_gridded_correction_t *test_msg = - (msg_ssr_gridded_correction_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.iod_atmo = 170; - test_msg->header.num_msgs = 48535; - test_msg->header.seq_num = 50380; - test_msg->header.tile_id = 12951; - test_msg->header.tile_set_id = 3605; - test_msg->header.time.tow = 2535294328; - test_msg->header.time.wn = 58798; - test_msg->header.tropo_quality_indicator = 120; - test_msg->header.update_interval = 105; - test_msg->index = 43413; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[0].residual = -21246; - test_msg->stec_residuals[0].stddev = 88; - test_msg->stec_residuals[0].sv_id.constellation = 101; - test_msg->stec_residuals[0].sv_id.satId = 140; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[1].residual = -26570; - test_msg->stec_residuals[1].stddev = 115; - test_msg->stec_residuals[1].sv_id.constellation = 180; - test_msg->stec_residuals[1].sv_id.satId = 70; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[2].residual = 6049; - test_msg->stec_residuals[2].stddev = 135; - test_msg->stec_residuals[2].sv_id.constellation = 201; - test_msg->stec_residuals[2].sv_id.satId = 78; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[3].residual = 19261; - test_msg->stec_residuals[3].stddev = 178; - test_msg->stec_residuals[3].sv_id.constellation = 98; - test_msg->stec_residuals[3].sv_id.satId = 152; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[4].residual = 14226; - test_msg->stec_residuals[4].stddev = 58; - test_msg->stec_residuals[4].sv_id.constellation = 229; - test_msg->stec_residuals[4].sv_id.satId = 120; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[5].residual = 17894; - test_msg->stec_residuals[5].stddev = 172; - test_msg->stec_residuals[5].sv_id.constellation = 234; - test_msg->stec_residuals[5].sv_id.satId = 169; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[6].residual = 22930; - test_msg->stec_residuals[6].stddev = 150; - test_msg->stec_residuals[6].sv_id.constellation = 127; - test_msg->stec_residuals[6].sv_id.satId = 191; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[7].residual = 10721; - test_msg->stec_residuals[7].stddev = 17; - test_msg->stec_residuals[7].sv_id.constellation = 111; - test_msg->stec_residuals[7].sv_id.satId = 91; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[8].residual = -22874; - test_msg->stec_residuals[8].stddev = 120; - test_msg->stec_residuals[8].sv_id.constellation = 52; - test_msg->stec_residuals[8].sv_id.satId = 119; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[9].residual = 780; - test_msg->stec_residuals[9].stddev = 156; - test_msg->stec_residuals[9].sv_id.constellation = 221; - test_msg->stec_residuals[9].sv_id.satId = 57; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[10].residual = 32547; - test_msg->stec_residuals[10].stddev = 8; - test_msg->stec_residuals[10].sv_id.constellation = 156; - test_msg->stec_residuals[10].sv_id.satId = 70; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[11].residual = 14208; - test_msg->stec_residuals[11].stddev = 115; - test_msg->stec_residuals[11].sv_id.constellation = 58; - test_msg->stec_residuals[11].sv_id.satId = 127; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[12].residual = -26246; - test_msg->stec_residuals[12].stddev = 124; - test_msg->stec_residuals[12].sv_id.constellation = 157; - test_msg->stec_residuals[12].sv_id.satId = 80; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[13].residual = 26466; - test_msg->stec_residuals[13].stddev = 204; - test_msg->stec_residuals[13].sv_id.constellation = 128; - test_msg->stec_residuals[13].sv_id.satId = 27; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[14].residual = -7552; - test_msg->stec_residuals[14].stddev = 148; - test_msg->stec_residuals[14].sv_id.constellation = 238; - test_msg->stec_residuals[14].sv_id.satId = 75; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[15].residual = -12072; - test_msg->stec_residuals[15].stddev = 149; - test_msg->stec_residuals[15].sv_id.constellation = 61; - test_msg->stec_residuals[15].sv_id.satId = 248; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[16].residual = -28632; - test_msg->stec_residuals[16].stddev = 186; - test_msg->stec_residuals[16].sv_id.constellation = 224; - test_msg->stec_residuals[16].sv_id.satId = 167; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[17].residual = -4024; - test_msg->stec_residuals[17].stddev = 100; - test_msg->stec_residuals[17].sv_id.constellation = 227; - test_msg->stec_residuals[17].sv_id.satId = 157; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[18].residual = 2004; - test_msg->stec_residuals[18].stddev = 59; - test_msg->stec_residuals[18].sv_id.constellation = 12; - test_msg->stec_residuals[18].sv_id.satId = 35; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[19].residual = 6998; - test_msg->stec_residuals[19].stddev = 24; - test_msg->stec_residuals[19].sv_id.constellation = 81; - test_msg->stec_residuals[19].sv_id.satId = 176; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[20].residual = -31701; - test_msg->stec_residuals[20].stddev = 45; - test_msg->stec_residuals[20].sv_id.constellation = 67; - test_msg->stec_residuals[20].sv_id.satId = 155; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[21].residual = 28678; - test_msg->stec_residuals[21].stddev = 183; - test_msg->stec_residuals[21].sv_id.constellation = 44; - test_msg->stec_residuals[21].sv_id.satId = 203; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[22].residual = -15793; - test_msg->stec_residuals[22].stddev = 253; - test_msg->stec_residuals[22].sv_id.constellation = 176; - test_msg->stec_residuals[22].sv_id.satId = 231; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[23].residual = -7589; - test_msg->stec_residuals[23].stddev = 116; - test_msg->stec_residuals[23].sv_id.constellation = 103; - test_msg->stec_residuals[23].sv_id.satId = 247; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[24].residual = -7362; - test_msg->stec_residuals[24].stddev = 240; - test_msg->stec_residuals[24].sv_id.constellation = 23; - test_msg->stec_residuals[24].sv_id.satId = 148; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[25].residual = 4813; - test_msg->stec_residuals[25].stddev = 242; - test_msg->stec_residuals[25].sv_id.constellation = 219; - test_msg->stec_residuals[25].sv_id.satId = 29; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[26].residual = 20295; - test_msg->stec_residuals[26].stddev = 37; - test_msg->stec_residuals[26].sv_id.constellation = 72; - test_msg->stec_residuals[26].sv_id.satId = 207; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[27].residual = -13623; - test_msg->stec_residuals[27].stddev = 91; - test_msg->stec_residuals[27].sv_id.constellation = 176; - test_msg->stec_residuals[27].sv_id.satId = 42; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[28].residual = 15250; - test_msg->stec_residuals[28].stddev = 110; - test_msg->stec_residuals[28].sv_id.constellation = 115; - test_msg->stec_residuals[28].sv_id.satId = 105; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[29].residual = -18560; - test_msg->stec_residuals[29].stddev = 185; - test_msg->stec_residuals[29].sv_id.constellation = 109; - test_msg->stec_residuals[29].sv_id.satId = 44; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[30].residual = 23717; - test_msg->stec_residuals[30].stddev = 79; - test_msg->stec_residuals[30].sv_id.constellation = 31; - test_msg->stec_residuals[30].sv_id.satId = 67; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[31].residual = 1886; - test_msg->stec_residuals[31].stddev = 162; - test_msg->stec_residuals[31].sv_id.constellation = 180; - test_msg->stec_residuals[31].sv_id.satId = 189; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[32].residual = 12242; - test_msg->stec_residuals[32].stddev = 7; - test_msg->stec_residuals[32].sv_id.constellation = 156; - test_msg->stec_residuals[32].sv_id.satId = 121; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[33].residual = 10670; - test_msg->stec_residuals[33].stddev = 241; - test_msg->stec_residuals[33].sv_id.constellation = 205; - test_msg->stec_residuals[33].sv_id.satId = 7; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[34].residual = 25899; - test_msg->stec_residuals[34].stddev = 186; - test_msg->stec_residuals[34].sv_id.constellation = 210; - test_msg->stec_residuals[34].sv_id.satId = 129; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[35].residual = -2078; - test_msg->stec_residuals[35].stddev = 187; - test_msg->stec_residuals[35].sv_id.constellation = 195; - test_msg->stec_residuals[35].sv_id.satId = 208; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[36].residual = -16264; - test_msg->stec_residuals[36].stddev = 102; - test_msg->stec_residuals[36].sv_id.constellation = 160; - test_msg->stec_residuals[36].sv_id.satId = 219; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[37].residual = -21002; - test_msg->stec_residuals[37].stddev = 94; - test_msg->stec_residuals[37].sv_id.constellation = 42; - test_msg->stec_residuals[37].sv_id.satId = 166; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[38].residual = 7902; - test_msg->stec_residuals[38].stddev = 35; - test_msg->stec_residuals[38].sv_id.constellation = 156; - test_msg->stec_residuals[38].sv_id.satId = 102; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[39].residual = -30275; - test_msg->stec_residuals[39].stddev = 204; - test_msg->stec_residuals[39].sv_id.constellation = 64; - test_msg->stec_residuals[39].sv_id.satId = 247; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[40].residual = -8633; - test_msg->stec_residuals[40].stddev = 222; - test_msg->stec_residuals[40].sv_id.constellation = 32; - test_msg->stec_residuals[40].sv_id.satId = 220; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[41].residual = 6403; - test_msg->stec_residuals[41].stddev = 45; - test_msg->stec_residuals[41].sv_id.constellation = 246; - test_msg->stec_residuals[41].sv_id.satId = 201; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[42].residual = 22643; - test_msg->stec_residuals[42].stddev = 218; - test_msg->stec_residuals[42].sv_id.constellation = 239; - test_msg->stec_residuals[42].sv_id.satId = 251; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[43].residual = 16760; - test_msg->stec_residuals[43].stddev = 175; - test_msg->stec_residuals[43].sv_id.constellation = 209; - test_msg->stec_residuals[43].sv_id.satId = 10; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[44].residual = -20951; - test_msg->stec_residuals[44].stddev = 137; - test_msg->stec_residuals[44].sv_id.constellation = 194; - test_msg->stec_residuals[44].sv_id.satId = 131; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[45].residual = -740; - test_msg->stec_residuals[45].stddev = 42; - test_msg->stec_residuals[45].sv_id.constellation = 68; - test_msg->stec_residuals[45].sv_id.satId = 17; - test_msg->tropo_delay_correction.hydro = -3035; - test_msg->tropo_delay_correction.stddev = 72; - test_msg->tropo_delay_correction.wet = 78; - sbp_payload_send(&sbp_state, 0x5fc, 63940, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 63940, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 63940, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x5fc, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_gridded_correction_t *check_msg = - (msg_ssr_gridded_correction_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.iod_atmo == 170, - "incorrect value for header.iod_atmo, expected 170, is %d", - check_msg->header.iod_atmo); - ck_assert_msg(check_msg->header.num_msgs == 48535, - "incorrect value for header.num_msgs, expected 48535, is %d", - check_msg->header.num_msgs); - ck_assert_msg(check_msg->header.seq_num == 50380, - "incorrect value for header.seq_num, expected 50380, is %d", - check_msg->header.seq_num); - ck_assert_msg(check_msg->header.tile_id == 12951, - "incorrect value for header.tile_id, expected 12951, is %d", - check_msg->header.tile_id); - ck_assert_msg( - check_msg->header.tile_set_id == 3605, - "incorrect value for header.tile_set_id, expected 3605, is %d", - check_msg->header.tile_set_id); - ck_assert_msg( - check_msg->header.time.tow == 2535294328, - "incorrect value for header.time.tow, expected 2535294328, is %d", - check_msg->header.time.tow); - ck_assert_msg(check_msg->header.time.wn == 58798, - "incorrect value for header.time.wn, expected 58798, is %d", - check_msg->header.time.wn); - ck_assert_msg(check_msg->header.tropo_quality_indicator == 120, - "incorrect value for header.tropo_quality_indicator, " - "expected 120, is %d", - check_msg->header.tropo_quality_indicator); - ck_assert_msg( - check_msg->header.update_interval == 105, - "incorrect value for header.update_interval, expected 105, is %d", - check_msg->header.update_interval); - ck_assert_msg(check_msg->index == 43413, - "incorrect value for index, expected 43413, is %d", - check_msg->index); - ck_assert_msg(check_msg->stec_residuals[0].residual == -21246, - "incorrect value for stec_residuals[0].residual, expected " - "-21246, is %d", - check_msg->stec_residuals[0].residual); - ck_assert_msg( - check_msg->stec_residuals[0].stddev == 88, - "incorrect value for stec_residuals[0].stddev, expected 88, is %d", - check_msg->stec_residuals[0].stddev); - ck_assert_msg(check_msg->stec_residuals[0].sv_id.constellation == 101, - "incorrect value for stec_residuals[0].sv_id.constellation, " - "expected 101, is %d", - check_msg->stec_residuals[0].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[0].sv_id.satId == 140, - "incorrect value for stec_residuals[0].sv_id.satId, expected " - "140, is %d", - check_msg->stec_residuals[0].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[1].residual == -26570, - "incorrect value for stec_residuals[1].residual, expected " - "-26570, is %d", - check_msg->stec_residuals[1].residual); - ck_assert_msg( - check_msg->stec_residuals[1].stddev == 115, - "incorrect value for stec_residuals[1].stddev, expected 115, is %d", - check_msg->stec_residuals[1].stddev); - ck_assert_msg(check_msg->stec_residuals[1].sv_id.constellation == 180, - "incorrect value for stec_residuals[1].sv_id.constellation, " - "expected 180, is %d", - check_msg->stec_residuals[1].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[1].sv_id.satId == 70, - "incorrect value for stec_residuals[1].sv_id.satId, expected 70, is %d", - check_msg->stec_residuals[1].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[2].residual == 6049, - "incorrect value for stec_residuals[2].residual, expected 6049, is %d", - check_msg->stec_residuals[2].residual); - ck_assert_msg( - check_msg->stec_residuals[2].stddev == 135, - "incorrect value for stec_residuals[2].stddev, expected 135, is %d", - check_msg->stec_residuals[2].stddev); - ck_assert_msg(check_msg->stec_residuals[2].sv_id.constellation == 201, - "incorrect value for stec_residuals[2].sv_id.constellation, " - "expected 201, is %d", - check_msg->stec_residuals[2].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[2].sv_id.satId == 78, - "incorrect value for stec_residuals[2].sv_id.satId, expected 78, is %d", - check_msg->stec_residuals[2].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[3].residual == 19261, - "incorrect value for stec_residuals[3].residual, expected 19261, is %d", - check_msg->stec_residuals[3].residual); - ck_assert_msg( - check_msg->stec_residuals[3].stddev == 178, - "incorrect value for stec_residuals[3].stddev, expected 178, is %d", - check_msg->stec_residuals[3].stddev); - ck_assert_msg(check_msg->stec_residuals[3].sv_id.constellation == 98, - "incorrect value for stec_residuals[3].sv_id.constellation, " - "expected 98, is %d", - check_msg->stec_residuals[3].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[3].sv_id.satId == 152, - "incorrect value for stec_residuals[3].sv_id.satId, expected " - "152, is %d", - check_msg->stec_residuals[3].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[4].residual == 14226, - "incorrect value for stec_residuals[4].residual, expected 14226, is %d", - check_msg->stec_residuals[4].residual); - ck_assert_msg( - check_msg->stec_residuals[4].stddev == 58, - "incorrect value for stec_residuals[4].stddev, expected 58, is %d", - check_msg->stec_residuals[4].stddev); - ck_assert_msg(check_msg->stec_residuals[4].sv_id.constellation == 229, - "incorrect value for stec_residuals[4].sv_id.constellation, " - "expected 229, is %d", - check_msg->stec_residuals[4].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[4].sv_id.satId == 120, - "incorrect value for stec_residuals[4].sv_id.satId, expected " - "120, is %d", - check_msg->stec_residuals[4].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[5].residual == 17894, - "incorrect value for stec_residuals[5].residual, expected 17894, is %d", - check_msg->stec_residuals[5].residual); - ck_assert_msg( - check_msg->stec_residuals[5].stddev == 172, - "incorrect value for stec_residuals[5].stddev, expected 172, is %d", - check_msg->stec_residuals[5].stddev); - ck_assert_msg(check_msg->stec_residuals[5].sv_id.constellation == 234, - "incorrect value for stec_residuals[5].sv_id.constellation, " - "expected 234, is %d", - check_msg->stec_residuals[5].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[5].sv_id.satId == 169, - "incorrect value for stec_residuals[5].sv_id.satId, expected " - "169, is %d", - check_msg->stec_residuals[5].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[6].residual == 22930, - "incorrect value for stec_residuals[6].residual, expected 22930, is %d", - check_msg->stec_residuals[6].residual); - ck_assert_msg( - check_msg->stec_residuals[6].stddev == 150, - "incorrect value for stec_residuals[6].stddev, expected 150, is %d", - check_msg->stec_residuals[6].stddev); - ck_assert_msg(check_msg->stec_residuals[6].sv_id.constellation == 127, - "incorrect value for stec_residuals[6].sv_id.constellation, " - "expected 127, is %d", - check_msg->stec_residuals[6].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[6].sv_id.satId == 191, - "incorrect value for stec_residuals[6].sv_id.satId, expected " - "191, is %d", - check_msg->stec_residuals[6].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[7].residual == 10721, - "incorrect value for stec_residuals[7].residual, expected 10721, is %d", - check_msg->stec_residuals[7].residual); - ck_assert_msg( - check_msg->stec_residuals[7].stddev == 17, - "incorrect value for stec_residuals[7].stddev, expected 17, is %d", - check_msg->stec_residuals[7].stddev); - ck_assert_msg(check_msg->stec_residuals[7].sv_id.constellation == 111, - "incorrect value for stec_residuals[7].sv_id.constellation, " - "expected 111, is %d", - check_msg->stec_residuals[7].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[7].sv_id.satId == 91, - "incorrect value for stec_residuals[7].sv_id.satId, expected 91, is %d", - check_msg->stec_residuals[7].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[8].residual == -22874, - "incorrect value for stec_residuals[8].residual, expected " - "-22874, is %d", - check_msg->stec_residuals[8].residual); - ck_assert_msg( - check_msg->stec_residuals[8].stddev == 120, - "incorrect value for stec_residuals[8].stddev, expected 120, is %d", - check_msg->stec_residuals[8].stddev); - ck_assert_msg(check_msg->stec_residuals[8].sv_id.constellation == 52, - "incorrect value for stec_residuals[8].sv_id.constellation, " - "expected 52, is %d", - check_msg->stec_residuals[8].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[8].sv_id.satId == 119, - "incorrect value for stec_residuals[8].sv_id.satId, expected " - "119, is %d", - check_msg->stec_residuals[8].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[9].residual == 780, - "incorrect value for stec_residuals[9].residual, expected 780, is %d", - check_msg->stec_residuals[9].residual); - ck_assert_msg( - check_msg->stec_residuals[9].stddev == 156, - "incorrect value for stec_residuals[9].stddev, expected 156, is %d", - check_msg->stec_residuals[9].stddev); - ck_assert_msg(check_msg->stec_residuals[9].sv_id.constellation == 221, - "incorrect value for stec_residuals[9].sv_id.constellation, " - "expected 221, is %d", - check_msg->stec_residuals[9].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[9].sv_id.satId == 57, - "incorrect value for stec_residuals[9].sv_id.satId, expected 57, is %d", - check_msg->stec_residuals[9].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[10].residual == 32547, - "incorrect value for stec_residuals[10].residual, expected " - "32547, is %d", - check_msg->stec_residuals[10].residual); - ck_assert_msg( - check_msg->stec_residuals[10].stddev == 8, - "incorrect value for stec_residuals[10].stddev, expected 8, is %d", - check_msg->stec_residuals[10].stddev); - ck_assert_msg(check_msg->stec_residuals[10].sv_id.constellation == 156, - "incorrect value for stec_residuals[10].sv_id.constellation, " - "expected 156, is %d", - check_msg->stec_residuals[10].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[10].sv_id.satId == 70, - "incorrect value for stec_residuals[10].sv_id.satId, " - "expected 70, is %d", - check_msg->stec_residuals[10].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[11].residual == 14208, - "incorrect value for stec_residuals[11].residual, expected " - "14208, is %d", - check_msg->stec_residuals[11].residual); - ck_assert_msg( - check_msg->stec_residuals[11].stddev == 115, - "incorrect value for stec_residuals[11].stddev, expected 115, is %d", - check_msg->stec_residuals[11].stddev); - ck_assert_msg(check_msg->stec_residuals[11].sv_id.constellation == 58, - "incorrect value for stec_residuals[11].sv_id.constellation, " - "expected 58, is %d", - check_msg->stec_residuals[11].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[11].sv_id.satId == 127, - "incorrect value for stec_residuals[11].sv_id.satId, " - "expected 127, is %d", - check_msg->stec_residuals[11].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[12].residual == -26246, - "incorrect value for stec_residuals[12].residual, expected " - "-26246, is %d", - check_msg->stec_residuals[12].residual); - ck_assert_msg( - check_msg->stec_residuals[12].stddev == 124, - "incorrect value for stec_residuals[12].stddev, expected 124, is %d", - check_msg->stec_residuals[12].stddev); - ck_assert_msg(check_msg->stec_residuals[12].sv_id.constellation == 157, - "incorrect value for stec_residuals[12].sv_id.constellation, " - "expected 157, is %d", - check_msg->stec_residuals[12].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[12].sv_id.satId == 80, - "incorrect value for stec_residuals[12].sv_id.satId, " - "expected 80, is %d", - check_msg->stec_residuals[12].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[13].residual == 26466, - "incorrect value for stec_residuals[13].residual, expected " - "26466, is %d", - check_msg->stec_residuals[13].residual); - ck_assert_msg( - check_msg->stec_residuals[13].stddev == 204, - "incorrect value for stec_residuals[13].stddev, expected 204, is %d", - check_msg->stec_residuals[13].stddev); - ck_assert_msg(check_msg->stec_residuals[13].sv_id.constellation == 128, - "incorrect value for stec_residuals[13].sv_id.constellation, " - "expected 128, is %d", - check_msg->stec_residuals[13].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[13].sv_id.satId == 27, - "incorrect value for stec_residuals[13].sv_id.satId, " - "expected 27, is %d", - check_msg->stec_residuals[13].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[14].residual == -7552, - "incorrect value for stec_residuals[14].residual, expected " - "-7552, is %d", - check_msg->stec_residuals[14].residual); - ck_assert_msg( - check_msg->stec_residuals[14].stddev == 148, - "incorrect value for stec_residuals[14].stddev, expected 148, is %d", - check_msg->stec_residuals[14].stddev); - ck_assert_msg(check_msg->stec_residuals[14].sv_id.constellation == 238, - "incorrect value for stec_residuals[14].sv_id.constellation, " - "expected 238, is %d", - check_msg->stec_residuals[14].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[14].sv_id.satId == 75, - "incorrect value for stec_residuals[14].sv_id.satId, " - "expected 75, is %d", - check_msg->stec_residuals[14].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[15].residual == -12072, - "incorrect value for stec_residuals[15].residual, expected " - "-12072, is %d", - check_msg->stec_residuals[15].residual); - ck_assert_msg( - check_msg->stec_residuals[15].stddev == 149, - "incorrect value for stec_residuals[15].stddev, expected 149, is %d", - check_msg->stec_residuals[15].stddev); - ck_assert_msg(check_msg->stec_residuals[15].sv_id.constellation == 61, - "incorrect value for stec_residuals[15].sv_id.constellation, " - "expected 61, is %d", - check_msg->stec_residuals[15].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[15].sv_id.satId == 248, - "incorrect value for stec_residuals[15].sv_id.satId, " - "expected 248, is %d", - check_msg->stec_residuals[15].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[16].residual == -28632, - "incorrect value for stec_residuals[16].residual, expected " - "-28632, is %d", - check_msg->stec_residuals[16].residual); - ck_assert_msg( - check_msg->stec_residuals[16].stddev == 186, - "incorrect value for stec_residuals[16].stddev, expected 186, is %d", - check_msg->stec_residuals[16].stddev); - ck_assert_msg(check_msg->stec_residuals[16].sv_id.constellation == 224, - "incorrect value for stec_residuals[16].sv_id.constellation, " - "expected 224, is %d", - check_msg->stec_residuals[16].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[16].sv_id.satId == 167, - "incorrect value for stec_residuals[16].sv_id.satId, " - "expected 167, is %d", - check_msg->stec_residuals[16].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[17].residual == -4024, - "incorrect value for stec_residuals[17].residual, expected " - "-4024, is %d", - check_msg->stec_residuals[17].residual); - ck_assert_msg( - check_msg->stec_residuals[17].stddev == 100, - "incorrect value for stec_residuals[17].stddev, expected 100, is %d", - check_msg->stec_residuals[17].stddev); - ck_assert_msg(check_msg->stec_residuals[17].sv_id.constellation == 227, - "incorrect value for stec_residuals[17].sv_id.constellation, " - "expected 227, is %d", - check_msg->stec_residuals[17].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[17].sv_id.satId == 157, - "incorrect value for stec_residuals[17].sv_id.satId, " - "expected 157, is %d", - check_msg->stec_residuals[17].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[18].residual == 2004, - "incorrect value for stec_residuals[18].residual, expected 2004, is %d", - check_msg->stec_residuals[18].residual); - ck_assert_msg( - check_msg->stec_residuals[18].stddev == 59, - "incorrect value for stec_residuals[18].stddev, expected 59, is %d", - check_msg->stec_residuals[18].stddev); - ck_assert_msg(check_msg->stec_residuals[18].sv_id.constellation == 12, - "incorrect value for stec_residuals[18].sv_id.constellation, " - "expected 12, is %d", - check_msg->stec_residuals[18].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[18].sv_id.satId == 35, - "incorrect value for stec_residuals[18].sv_id.satId, " - "expected 35, is %d", - check_msg->stec_residuals[18].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[19].residual == 6998, - "incorrect value for stec_residuals[19].residual, expected 6998, is %d", - check_msg->stec_residuals[19].residual); - ck_assert_msg( - check_msg->stec_residuals[19].stddev == 24, - "incorrect value for stec_residuals[19].stddev, expected 24, is %d", - check_msg->stec_residuals[19].stddev); - ck_assert_msg(check_msg->stec_residuals[19].sv_id.constellation == 81, - "incorrect value for stec_residuals[19].sv_id.constellation, " - "expected 81, is %d", - check_msg->stec_residuals[19].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[19].sv_id.satId == 176, - "incorrect value for stec_residuals[19].sv_id.satId, " - "expected 176, is %d", - check_msg->stec_residuals[19].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[20].residual == -31701, - "incorrect value for stec_residuals[20].residual, expected " - "-31701, is %d", - check_msg->stec_residuals[20].residual); - ck_assert_msg( - check_msg->stec_residuals[20].stddev == 45, - "incorrect value for stec_residuals[20].stddev, expected 45, is %d", - check_msg->stec_residuals[20].stddev); - ck_assert_msg(check_msg->stec_residuals[20].sv_id.constellation == 67, - "incorrect value for stec_residuals[20].sv_id.constellation, " - "expected 67, is %d", - check_msg->stec_residuals[20].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[20].sv_id.satId == 155, - "incorrect value for stec_residuals[20].sv_id.satId, " - "expected 155, is %d", - check_msg->stec_residuals[20].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[21].residual == 28678, - "incorrect value for stec_residuals[21].residual, expected " - "28678, is %d", - check_msg->stec_residuals[21].residual); - ck_assert_msg( - check_msg->stec_residuals[21].stddev == 183, - "incorrect value for stec_residuals[21].stddev, expected 183, is %d", - check_msg->stec_residuals[21].stddev); - ck_assert_msg(check_msg->stec_residuals[21].sv_id.constellation == 44, - "incorrect value for stec_residuals[21].sv_id.constellation, " - "expected 44, is %d", - check_msg->stec_residuals[21].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[21].sv_id.satId == 203, - "incorrect value for stec_residuals[21].sv_id.satId, " - "expected 203, is %d", - check_msg->stec_residuals[21].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[22].residual == -15793, - "incorrect value for stec_residuals[22].residual, expected " - "-15793, is %d", - check_msg->stec_residuals[22].residual); - ck_assert_msg( - check_msg->stec_residuals[22].stddev == 253, - "incorrect value for stec_residuals[22].stddev, expected 253, is %d", - check_msg->stec_residuals[22].stddev); - ck_assert_msg(check_msg->stec_residuals[22].sv_id.constellation == 176, - "incorrect value for stec_residuals[22].sv_id.constellation, " - "expected 176, is %d", - check_msg->stec_residuals[22].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[22].sv_id.satId == 231, - "incorrect value for stec_residuals[22].sv_id.satId, " - "expected 231, is %d", - check_msg->stec_residuals[22].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[23].residual == -7589, - "incorrect value for stec_residuals[23].residual, expected " - "-7589, is %d", - check_msg->stec_residuals[23].residual); - ck_assert_msg( - check_msg->stec_residuals[23].stddev == 116, - "incorrect value for stec_residuals[23].stddev, expected 116, is %d", - check_msg->stec_residuals[23].stddev); - ck_assert_msg(check_msg->stec_residuals[23].sv_id.constellation == 103, - "incorrect value for stec_residuals[23].sv_id.constellation, " - "expected 103, is %d", - check_msg->stec_residuals[23].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[23].sv_id.satId == 247, - "incorrect value for stec_residuals[23].sv_id.satId, " - "expected 247, is %d", - check_msg->stec_residuals[23].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[24].residual == -7362, - "incorrect value for stec_residuals[24].residual, expected " - "-7362, is %d", - check_msg->stec_residuals[24].residual); - ck_assert_msg( - check_msg->stec_residuals[24].stddev == 240, - "incorrect value for stec_residuals[24].stddev, expected 240, is %d", - check_msg->stec_residuals[24].stddev); - ck_assert_msg(check_msg->stec_residuals[24].sv_id.constellation == 23, - "incorrect value for stec_residuals[24].sv_id.constellation, " - "expected 23, is %d", - check_msg->stec_residuals[24].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[24].sv_id.satId == 148, - "incorrect value for stec_residuals[24].sv_id.satId, " - "expected 148, is %d", - check_msg->stec_residuals[24].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[25].residual == 4813, - "incorrect value for stec_residuals[25].residual, expected 4813, is %d", - check_msg->stec_residuals[25].residual); - ck_assert_msg( - check_msg->stec_residuals[25].stddev == 242, - "incorrect value for stec_residuals[25].stddev, expected 242, is %d", - check_msg->stec_residuals[25].stddev); - ck_assert_msg(check_msg->stec_residuals[25].sv_id.constellation == 219, - "incorrect value for stec_residuals[25].sv_id.constellation, " - "expected 219, is %d", - check_msg->stec_residuals[25].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[25].sv_id.satId == 29, - "incorrect value for stec_residuals[25].sv_id.satId, " - "expected 29, is %d", - check_msg->stec_residuals[25].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[26].residual == 20295, - "incorrect value for stec_residuals[26].residual, expected " - "20295, is %d", - check_msg->stec_residuals[26].residual); - ck_assert_msg( - check_msg->stec_residuals[26].stddev == 37, - "incorrect value for stec_residuals[26].stddev, expected 37, is %d", - check_msg->stec_residuals[26].stddev); - ck_assert_msg(check_msg->stec_residuals[26].sv_id.constellation == 72, - "incorrect value for stec_residuals[26].sv_id.constellation, " - "expected 72, is %d", - check_msg->stec_residuals[26].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[26].sv_id.satId == 207, - "incorrect value for stec_residuals[26].sv_id.satId, " - "expected 207, is %d", - check_msg->stec_residuals[26].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[27].residual == -13623, - "incorrect value for stec_residuals[27].residual, expected " - "-13623, is %d", - check_msg->stec_residuals[27].residual); - ck_assert_msg( - check_msg->stec_residuals[27].stddev == 91, - "incorrect value for stec_residuals[27].stddev, expected 91, is %d", - check_msg->stec_residuals[27].stddev); - ck_assert_msg(check_msg->stec_residuals[27].sv_id.constellation == 176, - "incorrect value for stec_residuals[27].sv_id.constellation, " - "expected 176, is %d", - check_msg->stec_residuals[27].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[27].sv_id.satId == 42, - "incorrect value for stec_residuals[27].sv_id.satId, " - "expected 42, is %d", - check_msg->stec_residuals[27].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[28].residual == 15250, - "incorrect value for stec_residuals[28].residual, expected " - "15250, is %d", - check_msg->stec_residuals[28].residual); - ck_assert_msg( - check_msg->stec_residuals[28].stddev == 110, - "incorrect value for stec_residuals[28].stddev, expected 110, is %d", - check_msg->stec_residuals[28].stddev); - ck_assert_msg(check_msg->stec_residuals[28].sv_id.constellation == 115, - "incorrect value for stec_residuals[28].sv_id.constellation, " - "expected 115, is %d", - check_msg->stec_residuals[28].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[28].sv_id.satId == 105, - "incorrect value for stec_residuals[28].sv_id.satId, " - "expected 105, is %d", - check_msg->stec_residuals[28].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[29].residual == -18560, - "incorrect value for stec_residuals[29].residual, expected " - "-18560, is %d", - check_msg->stec_residuals[29].residual); - ck_assert_msg( - check_msg->stec_residuals[29].stddev == 185, - "incorrect value for stec_residuals[29].stddev, expected 185, is %d", - check_msg->stec_residuals[29].stddev); - ck_assert_msg(check_msg->stec_residuals[29].sv_id.constellation == 109, - "incorrect value for stec_residuals[29].sv_id.constellation, " - "expected 109, is %d", - check_msg->stec_residuals[29].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[29].sv_id.satId == 44, - "incorrect value for stec_residuals[29].sv_id.satId, " - "expected 44, is %d", - check_msg->stec_residuals[29].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[30].residual == 23717, - "incorrect value for stec_residuals[30].residual, expected " - "23717, is %d", - check_msg->stec_residuals[30].residual); - ck_assert_msg( - check_msg->stec_residuals[30].stddev == 79, - "incorrect value for stec_residuals[30].stddev, expected 79, is %d", - check_msg->stec_residuals[30].stddev); - ck_assert_msg(check_msg->stec_residuals[30].sv_id.constellation == 31, - "incorrect value for stec_residuals[30].sv_id.constellation, " - "expected 31, is %d", - check_msg->stec_residuals[30].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[30].sv_id.satId == 67, - "incorrect value for stec_residuals[30].sv_id.satId, " - "expected 67, is %d", - check_msg->stec_residuals[30].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[31].residual == 1886, - "incorrect value for stec_residuals[31].residual, expected 1886, is %d", - check_msg->stec_residuals[31].residual); - ck_assert_msg( - check_msg->stec_residuals[31].stddev == 162, - "incorrect value for stec_residuals[31].stddev, expected 162, is %d", - check_msg->stec_residuals[31].stddev); - ck_assert_msg(check_msg->stec_residuals[31].sv_id.constellation == 180, - "incorrect value for stec_residuals[31].sv_id.constellation, " - "expected 180, is %d", - check_msg->stec_residuals[31].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[31].sv_id.satId == 189, - "incorrect value for stec_residuals[31].sv_id.satId, " - "expected 189, is %d", - check_msg->stec_residuals[31].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[32].residual == 12242, - "incorrect value for stec_residuals[32].residual, expected " - "12242, is %d", - check_msg->stec_residuals[32].residual); - ck_assert_msg( - check_msg->stec_residuals[32].stddev == 7, - "incorrect value for stec_residuals[32].stddev, expected 7, is %d", - check_msg->stec_residuals[32].stddev); - ck_assert_msg(check_msg->stec_residuals[32].sv_id.constellation == 156, - "incorrect value for stec_residuals[32].sv_id.constellation, " - "expected 156, is %d", - check_msg->stec_residuals[32].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[32].sv_id.satId == 121, - "incorrect value for stec_residuals[32].sv_id.satId, " - "expected 121, is %d", - check_msg->stec_residuals[32].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[33].residual == 10670, - "incorrect value for stec_residuals[33].residual, expected " - "10670, is %d", - check_msg->stec_residuals[33].residual); - ck_assert_msg( - check_msg->stec_residuals[33].stddev == 241, - "incorrect value for stec_residuals[33].stddev, expected 241, is %d", - check_msg->stec_residuals[33].stddev); - ck_assert_msg(check_msg->stec_residuals[33].sv_id.constellation == 205, - "incorrect value for stec_residuals[33].sv_id.constellation, " - "expected 205, is %d", - check_msg->stec_residuals[33].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[33].sv_id.satId == 7, - "incorrect value for stec_residuals[33].sv_id.satId, expected 7, is %d", - check_msg->stec_residuals[33].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[34].residual == 25899, - "incorrect value for stec_residuals[34].residual, expected " - "25899, is %d", - check_msg->stec_residuals[34].residual); - ck_assert_msg( - check_msg->stec_residuals[34].stddev == 186, - "incorrect value for stec_residuals[34].stddev, expected 186, is %d", - check_msg->stec_residuals[34].stddev); - ck_assert_msg(check_msg->stec_residuals[34].sv_id.constellation == 210, - "incorrect value for stec_residuals[34].sv_id.constellation, " - "expected 210, is %d", - check_msg->stec_residuals[34].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[34].sv_id.satId == 129, - "incorrect value for stec_residuals[34].sv_id.satId, " - "expected 129, is %d", - check_msg->stec_residuals[34].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[35].residual == -2078, - "incorrect value for stec_residuals[35].residual, expected " - "-2078, is %d", - check_msg->stec_residuals[35].residual); - ck_assert_msg( - check_msg->stec_residuals[35].stddev == 187, - "incorrect value for stec_residuals[35].stddev, expected 187, is %d", - check_msg->stec_residuals[35].stddev); - ck_assert_msg(check_msg->stec_residuals[35].sv_id.constellation == 195, - "incorrect value for stec_residuals[35].sv_id.constellation, " - "expected 195, is %d", - check_msg->stec_residuals[35].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[35].sv_id.satId == 208, - "incorrect value for stec_residuals[35].sv_id.satId, " - "expected 208, is %d", - check_msg->stec_residuals[35].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[36].residual == -16264, - "incorrect value for stec_residuals[36].residual, expected " - "-16264, is %d", - check_msg->stec_residuals[36].residual); - ck_assert_msg( - check_msg->stec_residuals[36].stddev == 102, - "incorrect value for stec_residuals[36].stddev, expected 102, is %d", - check_msg->stec_residuals[36].stddev); - ck_assert_msg(check_msg->stec_residuals[36].sv_id.constellation == 160, - "incorrect value for stec_residuals[36].sv_id.constellation, " - "expected 160, is %d", - check_msg->stec_residuals[36].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[36].sv_id.satId == 219, - "incorrect value for stec_residuals[36].sv_id.satId, " - "expected 219, is %d", - check_msg->stec_residuals[36].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[37].residual == -21002, - "incorrect value for stec_residuals[37].residual, expected " - "-21002, is %d", - check_msg->stec_residuals[37].residual); - ck_assert_msg( - check_msg->stec_residuals[37].stddev == 94, - "incorrect value for stec_residuals[37].stddev, expected 94, is %d", - check_msg->stec_residuals[37].stddev); - ck_assert_msg(check_msg->stec_residuals[37].sv_id.constellation == 42, - "incorrect value for stec_residuals[37].sv_id.constellation, " - "expected 42, is %d", - check_msg->stec_residuals[37].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[37].sv_id.satId == 166, - "incorrect value for stec_residuals[37].sv_id.satId, " - "expected 166, is %d", - check_msg->stec_residuals[37].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[38].residual == 7902, - "incorrect value for stec_residuals[38].residual, expected 7902, is %d", - check_msg->stec_residuals[38].residual); - ck_assert_msg( - check_msg->stec_residuals[38].stddev == 35, - "incorrect value for stec_residuals[38].stddev, expected 35, is %d", - check_msg->stec_residuals[38].stddev); - ck_assert_msg(check_msg->stec_residuals[38].sv_id.constellation == 156, - "incorrect value for stec_residuals[38].sv_id.constellation, " - "expected 156, is %d", - check_msg->stec_residuals[38].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[38].sv_id.satId == 102, - "incorrect value for stec_residuals[38].sv_id.satId, " - "expected 102, is %d", - check_msg->stec_residuals[38].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[39].residual == -30275, - "incorrect value for stec_residuals[39].residual, expected " - "-30275, is %d", - check_msg->stec_residuals[39].residual); - ck_assert_msg( - check_msg->stec_residuals[39].stddev == 204, - "incorrect value for stec_residuals[39].stddev, expected 204, is %d", - check_msg->stec_residuals[39].stddev); - ck_assert_msg(check_msg->stec_residuals[39].sv_id.constellation == 64, - "incorrect value for stec_residuals[39].sv_id.constellation, " - "expected 64, is %d", - check_msg->stec_residuals[39].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[39].sv_id.satId == 247, - "incorrect value for stec_residuals[39].sv_id.satId, " - "expected 247, is %d", - check_msg->stec_residuals[39].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[40].residual == -8633, - "incorrect value for stec_residuals[40].residual, expected " - "-8633, is %d", - check_msg->stec_residuals[40].residual); - ck_assert_msg( - check_msg->stec_residuals[40].stddev == 222, - "incorrect value for stec_residuals[40].stddev, expected 222, is %d", - check_msg->stec_residuals[40].stddev); - ck_assert_msg(check_msg->stec_residuals[40].sv_id.constellation == 32, - "incorrect value for stec_residuals[40].sv_id.constellation, " - "expected 32, is %d", - check_msg->stec_residuals[40].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[40].sv_id.satId == 220, - "incorrect value for stec_residuals[40].sv_id.satId, " - "expected 220, is %d", - check_msg->stec_residuals[40].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[41].residual == 6403, - "incorrect value for stec_residuals[41].residual, expected 6403, is %d", - check_msg->stec_residuals[41].residual); - ck_assert_msg( - check_msg->stec_residuals[41].stddev == 45, - "incorrect value for stec_residuals[41].stddev, expected 45, is %d", - check_msg->stec_residuals[41].stddev); - ck_assert_msg(check_msg->stec_residuals[41].sv_id.constellation == 246, - "incorrect value for stec_residuals[41].sv_id.constellation, " - "expected 246, is %d", - check_msg->stec_residuals[41].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[41].sv_id.satId == 201, - "incorrect value for stec_residuals[41].sv_id.satId, " - "expected 201, is %d", - check_msg->stec_residuals[41].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[42].residual == 22643, - "incorrect value for stec_residuals[42].residual, expected " - "22643, is %d", - check_msg->stec_residuals[42].residual); - ck_assert_msg( - check_msg->stec_residuals[42].stddev == 218, - "incorrect value for stec_residuals[42].stddev, expected 218, is %d", - check_msg->stec_residuals[42].stddev); - ck_assert_msg(check_msg->stec_residuals[42].sv_id.constellation == 239, - "incorrect value for stec_residuals[42].sv_id.constellation, " - "expected 239, is %d", - check_msg->stec_residuals[42].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[42].sv_id.satId == 251, - "incorrect value for stec_residuals[42].sv_id.satId, " - "expected 251, is %d", - check_msg->stec_residuals[42].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[43].residual == 16760, - "incorrect value for stec_residuals[43].residual, expected " - "16760, is %d", - check_msg->stec_residuals[43].residual); - ck_assert_msg( - check_msg->stec_residuals[43].stddev == 175, - "incorrect value for stec_residuals[43].stddev, expected 175, is %d", - check_msg->stec_residuals[43].stddev); - ck_assert_msg(check_msg->stec_residuals[43].sv_id.constellation == 209, - "incorrect value for stec_residuals[43].sv_id.constellation, " - "expected 209, is %d", - check_msg->stec_residuals[43].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[43].sv_id.satId == 10, - "incorrect value for stec_residuals[43].sv_id.satId, " - "expected 10, is %d", - check_msg->stec_residuals[43].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[44].residual == -20951, - "incorrect value for stec_residuals[44].residual, expected " - "-20951, is %d", - check_msg->stec_residuals[44].residual); - ck_assert_msg( - check_msg->stec_residuals[44].stddev == 137, - "incorrect value for stec_residuals[44].stddev, expected 137, is %d", - check_msg->stec_residuals[44].stddev); - ck_assert_msg(check_msg->stec_residuals[44].sv_id.constellation == 194, - "incorrect value for stec_residuals[44].sv_id.constellation, " - "expected 194, is %d", - check_msg->stec_residuals[44].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[44].sv_id.satId == 131, - "incorrect value for stec_residuals[44].sv_id.satId, " - "expected 131, is %d", - check_msg->stec_residuals[44].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[45].residual == -740, - "incorrect value for stec_residuals[45].residual, expected -740, is %d", - check_msg->stec_residuals[45].residual); - ck_assert_msg( - check_msg->stec_residuals[45].stddev == 42, - "incorrect value for stec_residuals[45].stddev, expected 42, is %d", - check_msg->stec_residuals[45].stddev); - ck_assert_msg(check_msg->stec_residuals[45].sv_id.constellation == 68, - "incorrect value for stec_residuals[45].sv_id.constellation, " - "expected 68, is %d", - check_msg->stec_residuals[45].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[45].sv_id.satId == 17, - "incorrect value for stec_residuals[45].sv_id.satId, " - "expected 17, is %d", - check_msg->stec_residuals[45].sv_id.satId); - ck_assert_msg(check_msg->tropo_delay_correction.hydro == -3035, - "incorrect value for tropo_delay_correction.hydro, expected " - "-3035, is %d", - check_msg->tropo_delay_correction.hydro); - ck_assert_msg( - check_msg->tropo_delay_correction.stddev == 72, - "incorrect value for tropo_delay_correction.stddev, expected 72, is %d", - check_msg->tropo_delay_correction.stddev); - ck_assert_msg( - check_msg->tropo_delay_correction.wet == 78, - "incorrect value for tropo_delay_correction.wet, expected 78, is %d", - check_msg->tropo_delay_correction.wet); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrection_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrection"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrection"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrection); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds.c deleted file mode 100644 index f817ebff23..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds.c +++ /dev/null @@ -1,568 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrGriddedCorrectionBounds.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 1534, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 1534, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 254, 5, 66, 0, 45, 180, 0, 0, 0, 3, 0, 1, 0, - 10, 0, 15, 1, 0, 10, 0, 39, 232, 3, 244, 1, 100, 200, - 150, 100, 150, 100, 2, 5, 10, 16, 0, 17, 18, 19, 20, 21, - 6, 10, 22, 0, 23, 24, 25, 26, 27, 236, 182, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_gridded_correction_bounds_t* test_msg = - (msg_ssr_gridded_correction_bounds_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->grid_point_id = 1000; - test_msg->header.num_msgs = 1; - test_msg->header.seq_num = 0; - test_msg->header.sol_id = 0; - test_msg->header.time.tow = 180; - test_msg->header.time.wn = 3; - test_msg->header.update_interval = 10; - test_msg->n_sats = 2; - test_msg->ssr_iod_atmo = 15; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - test_msg->stec_sat_list[0].stec_bound_mu = 18; - test_msg->stec_sat_list[0].stec_bound_mu_dot = 20; - test_msg->stec_sat_list[0].stec_bound_sig = 19; - test_msg->stec_sat_list[0].stec_bound_sig_dot = 21; - test_msg->stec_sat_list[0].stec_residual.residual = 16; - test_msg->stec_sat_list[0].stec_residual.stddev = 17; - test_msg->stec_sat_list[0].stec_residual.sv_id.constellation = 10; - test_msg->stec_sat_list[0].stec_residual.sv_id.satId = 5; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - test_msg->stec_sat_list[1].stec_bound_mu = 24; - test_msg->stec_sat_list[1].stec_bound_mu_dot = 26; - test_msg->stec_sat_list[1].stec_bound_sig = 25; - test_msg->stec_sat_list[1].stec_bound_sig_dot = 27; - test_msg->stec_sat_list[1].stec_residual.residual = 22; - test_msg->stec_sat_list[1].stec_residual.stddev = 23; - test_msg->stec_sat_list[1].stec_residual.sv_id.constellation = 10; - test_msg->stec_sat_list[1].stec_residual.sv_id.satId = 6; - test_msg->tile_id = 10; - test_msg->tile_set_id = 1; - test_msg->tropo_delay_correction.hydro = 500; - test_msg->tropo_delay_correction.stddev = 200; - test_msg->tropo_delay_correction.wet = 100; - test_msg->tropo_qi = 39; - test_msg->tropo_v_hydro_bound_mu = 150; - test_msg->tropo_v_hydro_bound_sig = 100; - test_msg->tropo_v_wet_bound_mu = 150; - test_msg->tropo_v_wet_bound_sig = 100; - sbp_payload_send(&sbp_state, 1534, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 1534, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_gridded_correction_bounds_t* check_msg = - (msg_ssr_gridded_correction_bounds_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->grid_point_id == 1000, - "incorrect value for grid_point_id, expected 1000, is %d", - check_msg->grid_point_id); - ck_assert_msg(check_msg->header.num_msgs == 1, - "incorrect value for header.num_msgs, expected 1, is %d", - check_msg->header.num_msgs); - ck_assert_msg(check_msg->header.seq_num == 0, - "incorrect value for header.seq_num, expected 0, is %d", - check_msg->header.seq_num); - ck_assert_msg(check_msg->header.sol_id == 0, - "incorrect value for header.sol_id, expected 0, is %d", - check_msg->header.sol_id); - ck_assert_msg(check_msg->header.time.tow == 180, - "incorrect value for header.time.tow, expected 180, is %d", - check_msg->header.time.tow); - ck_assert_msg(check_msg->header.time.wn == 3, - "incorrect value for header.time.wn, expected 3, is %d", - check_msg->header.time.wn); - ck_assert_msg( - check_msg->header.update_interval == 10, - "incorrect value for header.update_interval, expected 10, is %d", - check_msg->header.update_interval); - ck_assert_msg(check_msg->n_sats == 2, - "incorrect value for n_sats, expected 2, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->ssr_iod_atmo == 15, - "incorrect value for ssr_iod_atmo, expected 15, is %d", - check_msg->ssr_iod_atmo); - ck_assert_msg(check_msg->stec_sat_list[0].stec_bound_mu == 18, - "incorrect value for stec_sat_list[0].stec_bound_mu, " - "expected 18, is %d", - check_msg->stec_sat_list[0].stec_bound_mu); - ck_assert_msg(check_msg->stec_sat_list[0].stec_bound_mu_dot == 20, - "incorrect value for stec_sat_list[0].stec_bound_mu_dot, " - "expected 20, is %d", - check_msg->stec_sat_list[0].stec_bound_mu_dot); - ck_assert_msg(check_msg->stec_sat_list[0].stec_bound_sig == 19, - "incorrect value for stec_sat_list[0].stec_bound_sig, " - "expected 19, is %d", - check_msg->stec_sat_list[0].stec_bound_sig); - ck_assert_msg(check_msg->stec_sat_list[0].stec_bound_sig_dot == 21, - "incorrect value for stec_sat_list[0].stec_bound_sig_dot, " - "expected 21, is %d", - check_msg->stec_sat_list[0].stec_bound_sig_dot); - ck_assert_msg(check_msg->stec_sat_list[0].stec_residual.residual == 16, - "incorrect value for " - "stec_sat_list[0].stec_residual.residual, expected 16, is %d", - check_msg->stec_sat_list[0].stec_residual.residual); - ck_assert_msg(check_msg->stec_sat_list[0].stec_residual.stddev == 17, - "incorrect value for stec_sat_list[0].stec_residual.stddev, " - "expected 17, is %d", - check_msg->stec_sat_list[0].stec_residual.stddev); - ck_assert_msg( - check_msg->stec_sat_list[0].stec_residual.sv_id.constellation == 10, - "incorrect value for " - "stec_sat_list[0].stec_residual.sv_id.constellation, expected 10, is " - "%d", - check_msg->stec_sat_list[0].stec_residual.sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[0].stec_residual.sv_id.satId == 5, - "incorrect value for stec_sat_list[0].stec_residual.sv_id.satId, " - "expected 5, is %d", - check_msg->stec_sat_list[0].stec_residual.sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[1].stec_bound_mu == 24, - "incorrect value for stec_sat_list[1].stec_bound_mu, " - "expected 24, is %d", - check_msg->stec_sat_list[1].stec_bound_mu); - ck_assert_msg(check_msg->stec_sat_list[1].stec_bound_mu_dot == 26, - "incorrect value for stec_sat_list[1].stec_bound_mu_dot, " - "expected 26, is %d", - check_msg->stec_sat_list[1].stec_bound_mu_dot); - ck_assert_msg(check_msg->stec_sat_list[1].stec_bound_sig == 25, - "incorrect value for stec_sat_list[1].stec_bound_sig, " - "expected 25, is %d", - check_msg->stec_sat_list[1].stec_bound_sig); - ck_assert_msg(check_msg->stec_sat_list[1].stec_bound_sig_dot == 27, - "incorrect value for stec_sat_list[1].stec_bound_sig_dot, " - "expected 27, is %d", - check_msg->stec_sat_list[1].stec_bound_sig_dot); - ck_assert_msg(check_msg->stec_sat_list[1].stec_residual.residual == 22, - "incorrect value for " - "stec_sat_list[1].stec_residual.residual, expected 22, is %d", - check_msg->stec_sat_list[1].stec_residual.residual); - ck_assert_msg(check_msg->stec_sat_list[1].stec_residual.stddev == 23, - "incorrect value for stec_sat_list[1].stec_residual.stddev, " - "expected 23, is %d", - check_msg->stec_sat_list[1].stec_residual.stddev); - ck_assert_msg( - check_msg->stec_sat_list[1].stec_residual.sv_id.constellation == 10, - "incorrect value for " - "stec_sat_list[1].stec_residual.sv_id.constellation, expected 10, is " - "%d", - check_msg->stec_sat_list[1].stec_residual.sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[1].stec_residual.sv_id.satId == 6, - "incorrect value for stec_sat_list[1].stec_residual.sv_id.satId, " - "expected 6, is %d", - check_msg->stec_sat_list[1].stec_residual.sv_id.satId); - ck_assert_msg(check_msg->tile_id == 10, - "incorrect value for tile_id, expected 10, is %d", - check_msg->tile_id); - ck_assert_msg(check_msg->tile_set_id == 1, - "incorrect value for tile_set_id, expected 1, is %d", - check_msg->tile_set_id); - ck_assert_msg( - check_msg->tropo_delay_correction.hydro == 500, - "incorrect value for tropo_delay_correction.hydro, expected 500, is %d", - check_msg->tropo_delay_correction.hydro); - ck_assert_msg(check_msg->tropo_delay_correction.stddev == 200, - "incorrect value for tropo_delay_correction.stddev, expected " - "200, is %d", - check_msg->tropo_delay_correction.stddev); - ck_assert_msg( - check_msg->tropo_delay_correction.wet == 100, - "incorrect value for tropo_delay_correction.wet, expected 100, is %d", - check_msg->tropo_delay_correction.wet); - ck_assert_msg(check_msg->tropo_qi == 39, - "incorrect value for tropo_qi, expected 39, is %d", - check_msg->tropo_qi); - ck_assert_msg( - check_msg->tropo_v_hydro_bound_mu == 150, - "incorrect value for tropo_v_hydro_bound_mu, expected 150, is %d", - check_msg->tropo_v_hydro_bound_mu); - ck_assert_msg( - check_msg->tropo_v_hydro_bound_sig == 100, - "incorrect value for tropo_v_hydro_bound_sig, expected 100, is %d", - check_msg->tropo_v_hydro_bound_sig); - ck_assert_msg( - check_msg->tropo_v_wet_bound_mu == 150, - "incorrect value for tropo_v_wet_bound_mu, expected 150, is %d", - check_msg->tropo_v_wet_bound_mu); - ck_assert_msg( - check_msg->tropo_v_wet_bound_sig == 100, - "incorrect value for tropo_v_wet_bound_sig, expected 100, is %d", - check_msg->tropo_v_wet_bound_sig); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 1534, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 1534, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 254, 5, 66, 0, 27, 180, 0, 0, 0, 3, 0, - 1, 0, 10, 0, 15, 1, 0, 10, 0, 39, 232, 3, - 244, 1, 100, 200, 150, 100, 150, 100, 0, 155, 36, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_gridded_correction_bounds_t* test_msg = - (msg_ssr_gridded_correction_bounds_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->grid_point_id = 1000; - test_msg->header.num_msgs = 1; - test_msg->header.seq_num = 0; - test_msg->header.sol_id = 0; - test_msg->header.time.tow = 180; - test_msg->header.time.wn = 3; - test_msg->header.update_interval = 10; - test_msg->n_sats = 0; - test_msg->ssr_iod_atmo = 15; - test_msg->tile_id = 10; - test_msg->tile_set_id = 1; - test_msg->tropo_delay_correction.hydro = 500; - test_msg->tropo_delay_correction.stddev = 200; - test_msg->tropo_delay_correction.wet = 100; - test_msg->tropo_qi = 39; - test_msg->tropo_v_hydro_bound_mu = 150; - test_msg->tropo_v_hydro_bound_sig = 100; - test_msg->tropo_v_wet_bound_mu = 150; - test_msg->tropo_v_wet_bound_sig = 100; - sbp_payload_send(&sbp_state, 1534, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 1534, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_gridded_correction_bounds_t* check_msg = - (msg_ssr_gridded_correction_bounds_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->grid_point_id == 1000, - "incorrect value for grid_point_id, expected 1000, is %d", - check_msg->grid_point_id); - ck_assert_msg(check_msg->header.num_msgs == 1, - "incorrect value for header.num_msgs, expected 1, is %d", - check_msg->header.num_msgs); - ck_assert_msg(check_msg->header.seq_num == 0, - "incorrect value for header.seq_num, expected 0, is %d", - check_msg->header.seq_num); - ck_assert_msg(check_msg->header.sol_id == 0, - "incorrect value for header.sol_id, expected 0, is %d", - check_msg->header.sol_id); - ck_assert_msg(check_msg->header.time.tow == 180, - "incorrect value for header.time.tow, expected 180, is %d", - check_msg->header.time.tow); - ck_assert_msg(check_msg->header.time.wn == 3, - "incorrect value for header.time.wn, expected 3, is %d", - check_msg->header.time.wn); - ck_assert_msg( - check_msg->header.update_interval == 10, - "incorrect value for header.update_interval, expected 10, is %d", - check_msg->header.update_interval); - ck_assert_msg(check_msg->n_sats == 0, - "incorrect value for n_sats, expected 0, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->ssr_iod_atmo == 15, - "incorrect value for ssr_iod_atmo, expected 15, is %d", - check_msg->ssr_iod_atmo); - ck_assert_msg(check_msg->tile_id == 10, - "incorrect value for tile_id, expected 10, is %d", - check_msg->tile_id); - ck_assert_msg(check_msg->tile_set_id == 1, - "incorrect value for tile_set_id, expected 1, is %d", - check_msg->tile_set_id); - ck_assert_msg( - check_msg->tropo_delay_correction.hydro == 500, - "incorrect value for tropo_delay_correction.hydro, expected 500, is %d", - check_msg->tropo_delay_correction.hydro); - ck_assert_msg(check_msg->tropo_delay_correction.stddev == 200, - "incorrect value for tropo_delay_correction.stddev, expected " - "200, is %d", - check_msg->tropo_delay_correction.stddev); - ck_assert_msg( - check_msg->tropo_delay_correction.wet == 100, - "incorrect value for tropo_delay_correction.wet, expected 100, is %d", - check_msg->tropo_delay_correction.wet); - ck_assert_msg(check_msg->tropo_qi == 39, - "incorrect value for tropo_qi, expected 39, is %d", - check_msg->tropo_qi); - ck_assert_msg( - check_msg->tropo_v_hydro_bound_mu == 150, - "incorrect value for tropo_v_hydro_bound_mu, expected 150, is %d", - check_msg->tropo_v_hydro_bound_mu); - ck_assert_msg( - check_msg->tropo_v_hydro_bound_sig == 100, - "incorrect value for tropo_v_hydro_bound_sig, expected 100, is %d", - check_msg->tropo_v_hydro_bound_sig); - ck_assert_msg( - check_msg->tropo_v_wet_bound_mu == 150, - "incorrect value for tropo_v_wet_bound_mu, expected 150, is %d", - check_msg->tropo_v_wet_bound_mu); - ck_assert_msg( - check_msg->tropo_v_wet_bound_sig == 100, - "incorrect value for tropo_v_wet_bound_sig, expected 100, is %d", - check_msg->tropo_v_wet_bound_sig); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_" - "MsgSsrGriddedCorrectionBounds"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA.c deleted file mode 100644 index 036bc7455b..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA.c +++ /dev/null @@ -1,1411 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrGriddedCorrectionDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x5fa, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x5fa, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 250, 5, 108, 106, 254, 164, 217, 44, 53, 98, 93, 63, 147, - 104, 252, 133, 245, 28, 95, 100, 147, 41, 33, 92, 87, 25, 142, - 151, 74, 151, 95, 94, 7, 146, 237, 45, 167, 86, 42, 116, 224, - 169, 234, 220, 23, 176, 18, 13, 178, 79, 160, 160, 110, 15, 53, - 206, 151, 158, 22, 117, 184, 48, 170, 82, 40, 53, 122, 69, 180, - 110, 38, 65, 104, 244, 19, 238, 227, 88, 169, 164, 146, 63, 37, - 183, 85, 71, 235, 168, 114, 211, 105, 221, 156, 60, 18, 230, 2, - 142, 172, 16, 39, 33, 126, 106, 99, 188, 234, 41, 162, 197, 138, - 227, 80, 12, 54, 67, 238, 5, 93, 1, 207, 129, 13, 46, 115, - 49, 58, 185, 127, 156, 200, 96, 217, 202, 15, 245, 55, 198, 81, - 218, 132, 70, 73, 82, 147, 26, 255, 14, 134, 96, 138, 55, 214, - 83, 156, 170, 163, 79, 173, 228, 115, 51, 241, 107, 245, 112, 168, - 210, 10, 5, 117, 1, 57, 108, 248, 212, 145, 119, 226, 165, 5, - 141, 202, 106, 0, 60, 36, 61, 243, 203, 216, 215, 12, 137, 16, - 28, 247, 115, 152, 181, 119, 208, 228, 203, 236, 34, 167, 196, 32, - 109, 1, 17, 101, 200, 25, 94, 125, 168, 137, 157, 4, 164, 29, - 31, 48, 132, 72, 229, 126, 186, 68, 76, 133, 21, 0, 180, 139, - 164, 148, 119, 149, 214, 120, 177, 201, 80, 80, 105, 10, 136, 118, - 77, 46, 233, 233, 227, 11, 158, 103, 167, 216, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_gridded_correction_dep_a_t *test_msg = - (msg_ssr_gridded_correction_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.iod_atmo = 245; - test_msg->header.num_msgs = 37695; - test_msg->header.seq_num = 64616; - test_msg->header.time.tow = 892131748; - test_msg->header.time.wn = 23906; - test_msg->header.tropo_quality_indicator = 28; - test_msg->header.update_interval = 133; - test_msg->index = 25695; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[0].residual = -26738; - test_msg->stec_residuals[0].stddev = 74; - test_msg->stec_residuals[0].sv_id.constellation = 25; - test_msg->stec_residuals[0].sv_id.satId = 87; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[1].residual = 1886; - test_msg->stec_residuals[1].stddev = 146; - test_msg->stec_residuals[1].sv_id.constellation = 95; - test_msg->stec_residuals[1].sv_id.satId = 151; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[2].residual = 22183; - test_msg->stec_residuals[2].stddev = 42; - test_msg->stec_residuals[2].sv_id.constellation = 45; - test_msg->stec_residuals[2].sv_id.satId = 237; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[3].residual = -5463; - test_msg->stec_residuals[3].stddev = 220; - test_msg->stec_residuals[3].sv_id.constellation = 224; - test_msg->stec_residuals[3].sv_id.satId = 116; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[4].residual = 3346; - test_msg->stec_residuals[4].stddev = 178; - test_msg->stec_residuals[4].sv_id.constellation = 176; - test_msg->stec_residuals[4].sv_id.satId = 23; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[5].residual = 28320; - test_msg->stec_residuals[5].stddev = 15; - test_msg->stec_residuals[5].sv_id.constellation = 160; - test_msg->stec_residuals[5].sv_id.satId = 79; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[6].residual = -24937; - test_msg->stec_residuals[6].stddev = 22; - test_msg->stec_residuals[6].sv_id.constellation = 206; - test_msg->stec_residuals[6].sv_id.satId = 53; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[7].residual = -21968; - test_msg->stec_residuals[7].stddev = 82; - test_msg->stec_residuals[7].sv_id.constellation = 184; - test_msg->stec_residuals[7].sv_id.satId = 117; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[8].residual = 17786; - test_msg->stec_residuals[8].stddev = 180; - test_msg->stec_residuals[8].sv_id.constellation = 53; - test_msg->stec_residuals[8].sv_id.satId = 40; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[9].residual = 26689; - test_msg->stec_residuals[9].stddev = 244; - test_msg->stec_residuals[9].sv_id.constellation = 38; - test_msg->stec_residuals[9].sv_id.satId = 110; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[10].residual = 22755; - test_msg->stec_residuals[10].stddev = 169; - test_msg->stec_residuals[10].sv_id.constellation = 238; - test_msg->stec_residuals[10].sv_id.satId = 19; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[11].residual = 9535; - test_msg->stec_residuals[11].stddev = 183; - test_msg->stec_residuals[11].sv_id.constellation = 146; - test_msg->stec_residuals[11].sv_id.satId = 164; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[12].residual = -22293; - test_msg->stec_residuals[12].stddev = 114; - test_msg->stec_residuals[12].sv_id.constellation = 71; - test_msg->stec_residuals[12].sv_id.satId = 85; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[13].residual = -25379; - test_msg->stec_residuals[13].stddev = 60; - test_msg->stec_residuals[13].sv_id.constellation = 105; - test_msg->stec_residuals[13].sv_id.satId = 211; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[14].residual = -29182; - test_msg->stec_residuals[14].stddev = 172; - test_msg->stec_residuals[14].sv_id.constellation = 230; - test_msg->stec_residuals[14].sv_id.satId = 18; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[15].residual = 32289; - test_msg->stec_residuals[15].stddev = 106; - test_msg->stec_residuals[15].sv_id.constellation = 39; - test_msg->stec_residuals[15].sv_id.satId = 16; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[16].residual = 10730; - test_msg->stec_residuals[16].stddev = 162; - test_msg->stec_residuals[16].sv_id.constellation = 188; - test_msg->stec_residuals[16].sv_id.satId = 99; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[17].residual = 20707; - test_msg->stec_residuals[17].stddev = 12; - test_msg->stec_residuals[17].sv_id.constellation = 138; - test_msg->stec_residuals[17].sv_id.satId = 197; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[18].residual = 1518; - test_msg->stec_residuals[18].stddev = 93; - test_msg->stec_residuals[18].sv_id.constellation = 67; - test_msg->stec_residuals[18].sv_id.satId = 54; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[19].residual = 3457; - test_msg->stec_residuals[19].stddev = 46; - test_msg->stec_residuals[19].sv_id.constellation = 207; - test_msg->stec_residuals[19].sv_id.satId = 1; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[20].residual = -18118; - test_msg->stec_residuals[20].stddev = 127; - test_msg->stec_residuals[20].sv_id.constellation = 49; - test_msg->stec_residuals[20].sv_id.satId = 115; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[21].residual = -9888; - test_msg->stec_residuals[21].stddev = 202; - test_msg->stec_residuals[21].sv_id.constellation = 200; - test_msg->stec_residuals[21].sv_id.satId = 156; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[22].residual = -14793; - test_msg->stec_residuals[22].stddev = 81; - test_msg->stec_residuals[22].sv_id.constellation = 245; - test_msg->stec_residuals[22].sv_id.satId = 15; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[23].residual = 18758; - test_msg->stec_residuals[23].stddev = 82; - test_msg->stec_residuals[23].sv_id.constellation = 132; - test_msg->stec_residuals[23].sv_id.satId = 218; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[24].residual = 3839; - test_msg->stec_residuals[24].stddev = 134; - test_msg->stec_residuals[24].sv_id.constellation = 26; - test_msg->stec_residuals[24].sv_id.satId = 147; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[25].residual = -10697; - test_msg->stec_residuals[25].stddev = 83; - test_msg->stec_residuals[25].sv_id.constellation = 138; - test_msg->stec_residuals[25].sv_id.satId = 96; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[26].residual = 20387; - test_msg->stec_residuals[26].stddev = 173; - test_msg->stec_residuals[26].sv_id.constellation = 170; - test_msg->stec_residuals[26].sv_id.satId = 156; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[27].residual = -3789; - test_msg->stec_residuals[27].stddev = 107; - test_msg->stec_residuals[27].sv_id.constellation = 115; - test_msg->stec_residuals[27].sv_id.satId = 228; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[28].residual = -11608; - test_msg->stec_residuals[28].stddev = 10; - test_msg->stec_residuals[28].sv_id.constellation = 112; - test_msg->stec_residuals[28].sv_id.satId = 245; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[29].residual = 14593; - test_msg->stec_residuals[29].stddev = 108; - test_msg->stec_residuals[29].sv_id.constellation = 117; - test_msg->stec_residuals[29].sv_id.satId = 5; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[30].residual = 30609; - test_msg->stec_residuals[30].stddev = 226; - test_msg->stec_residuals[30].sv_id.constellation = 212; - test_msg->stec_residuals[30].sv_id.satId = 248; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[31].residual = -13683; - test_msg->stec_residuals[31].stddev = 106; - test_msg->stec_residuals[31].sv_id.constellation = 5; - test_msg->stec_residuals[31].sv_id.satId = 165; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[32].residual = 15652; - test_msg->stec_residuals[32].stddev = 243; - test_msg->stec_residuals[32].sv_id.constellation = 60; - test_msg->stec_residuals[32].sv_id.satId = 0; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[33].residual = 3287; - test_msg->stec_residuals[33].stddev = 137; - test_msg->stec_residuals[33].sv_id.constellation = 216; - test_msg->stec_residuals[33].sv_id.satId = 203; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[34].residual = 29687; - test_msg->stec_residuals[34].stddev = 152; - test_msg->stec_residuals[34].sv_id.constellation = 28; - test_msg->stec_residuals[34].sv_id.satId = 16; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[35].residual = -6960; - test_msg->stec_residuals[35].stddev = 203; - test_msg->stec_residuals[35].sv_id.constellation = 119; - test_msg->stec_residuals[35].sv_id.satId = 181; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[36].residual = -15193; - test_msg->stec_residuals[36].stddev = 32; - test_msg->stec_residuals[36].sv_id.constellation = 34; - test_msg->stec_residuals[36].sv_id.satId = 236; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[37].residual = 25873; - test_msg->stec_residuals[37].stddev = 200; - test_msg->stec_residuals[37].sv_id.constellation = 1; - test_msg->stec_residuals[37].sv_id.satId = 109; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[38].residual = -22403; - test_msg->stec_residuals[38].stddev = 137; - test_msg->stec_residuals[38].sv_id.constellation = 94; - test_msg->stec_residuals[38].sv_id.satId = 25; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[39].residual = 7588; - test_msg->stec_residuals[39].stddev = 31; - test_msg->stec_residuals[39].sv_id.constellation = 4; - test_msg->stec_residuals[39].sv_id.satId = 157; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[40].residual = -6840; - test_msg->stec_residuals[40].stddev = 126; - test_msg->stec_residuals[40].sv_id.constellation = 132; - test_msg->stec_residuals[40].sv_id.satId = 48; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[41].residual = -31412; - test_msg->stec_residuals[41].stddev = 21; - test_msg->stec_residuals[41].sv_id.constellation = 68; - test_msg->stec_residuals[41].sv_id.satId = 186; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[42].residual = -23413; - test_msg->stec_residuals[42].stddev = 148; - test_msg->stec_residuals[42].sv_id.constellation = 180; - test_msg->stec_residuals[42].sv_id.satId = 0; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[43].residual = 30934; - test_msg->stec_residuals[43].stddev = 177; - test_msg->stec_residuals[43].sv_id.constellation = 149; - test_msg->stec_residuals[43].sv_id.satId = 119; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[44].residual = 26960; - test_msg->stec_residuals[44].stddev = 10; - test_msg->stec_residuals[44].sv_id.constellation = 80; - test_msg->stec_residuals[44].sv_id.satId = 201; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[45].residual = 11853; - test_msg->stec_residuals[45].stddev = 233; - test_msg->stec_residuals[45].sv_id.constellation = 118; - test_msg->stec_residuals[45].sv_id.satId = 136; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[46].residual = -25077; - test_msg->stec_residuals[46].stddev = 103; - test_msg->stec_residuals[46].sv_id.constellation = 227; - test_msg->stec_residuals[46].sv_id.satId = 233; - test_msg->tropo_delay_correction.hydro = 10643; - test_msg->tropo_delay_correction.stddev = 92; - test_msg->tropo_delay_correction.wet = 33; - sbp_payload_send(&sbp_state, 0x5fa, 27244, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 27244, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 27244, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x5fa, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_gridded_correction_dep_a_t *check_msg = - (msg_ssr_gridded_correction_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.iod_atmo == 245, - "incorrect value for header.iod_atmo, expected 245, is %d", - check_msg->header.iod_atmo); - ck_assert_msg(check_msg->header.num_msgs == 37695, - "incorrect value for header.num_msgs, expected 37695, is %d", - check_msg->header.num_msgs); - ck_assert_msg(check_msg->header.seq_num == 64616, - "incorrect value for header.seq_num, expected 64616, is %d", - check_msg->header.seq_num); - ck_assert_msg( - check_msg->header.time.tow == 892131748, - "incorrect value for header.time.tow, expected 892131748, is %d", - check_msg->header.time.tow); - ck_assert_msg(check_msg->header.time.wn == 23906, - "incorrect value for header.time.wn, expected 23906, is %d", - check_msg->header.time.wn); - ck_assert_msg(check_msg->header.tropo_quality_indicator == 28, - "incorrect value for header.tropo_quality_indicator, " - "expected 28, is %d", - check_msg->header.tropo_quality_indicator); - ck_assert_msg( - check_msg->header.update_interval == 133, - "incorrect value for header.update_interval, expected 133, is %d", - check_msg->header.update_interval); - ck_assert_msg(check_msg->index == 25695, - "incorrect value for index, expected 25695, is %d", - check_msg->index); - ck_assert_msg(check_msg->stec_residuals[0].residual == -26738, - "incorrect value for stec_residuals[0].residual, expected " - "-26738, is %d", - check_msg->stec_residuals[0].residual); - ck_assert_msg( - check_msg->stec_residuals[0].stddev == 74, - "incorrect value for stec_residuals[0].stddev, expected 74, is %d", - check_msg->stec_residuals[0].stddev); - ck_assert_msg(check_msg->stec_residuals[0].sv_id.constellation == 25, - "incorrect value for stec_residuals[0].sv_id.constellation, " - "expected 25, is %d", - check_msg->stec_residuals[0].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[0].sv_id.satId == 87, - "incorrect value for stec_residuals[0].sv_id.satId, expected 87, is %d", - check_msg->stec_residuals[0].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[1].residual == 1886, - "incorrect value for stec_residuals[1].residual, expected 1886, is %d", - check_msg->stec_residuals[1].residual); - ck_assert_msg( - check_msg->stec_residuals[1].stddev == 146, - "incorrect value for stec_residuals[1].stddev, expected 146, is %d", - check_msg->stec_residuals[1].stddev); - ck_assert_msg(check_msg->stec_residuals[1].sv_id.constellation == 95, - "incorrect value for stec_residuals[1].sv_id.constellation, " - "expected 95, is %d", - check_msg->stec_residuals[1].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[1].sv_id.satId == 151, - "incorrect value for stec_residuals[1].sv_id.satId, expected " - "151, is %d", - check_msg->stec_residuals[1].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[2].residual == 22183, - "incorrect value for stec_residuals[2].residual, expected 22183, is %d", - check_msg->stec_residuals[2].residual); - ck_assert_msg( - check_msg->stec_residuals[2].stddev == 42, - "incorrect value for stec_residuals[2].stddev, expected 42, is %d", - check_msg->stec_residuals[2].stddev); - ck_assert_msg(check_msg->stec_residuals[2].sv_id.constellation == 45, - "incorrect value for stec_residuals[2].sv_id.constellation, " - "expected 45, is %d", - check_msg->stec_residuals[2].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[2].sv_id.satId == 237, - "incorrect value for stec_residuals[2].sv_id.satId, expected " - "237, is %d", - check_msg->stec_residuals[2].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[3].residual == -5463, - "incorrect value for stec_residuals[3].residual, expected -5463, is %d", - check_msg->stec_residuals[3].residual); - ck_assert_msg( - check_msg->stec_residuals[3].stddev == 220, - "incorrect value for stec_residuals[3].stddev, expected 220, is %d", - check_msg->stec_residuals[3].stddev); - ck_assert_msg(check_msg->stec_residuals[3].sv_id.constellation == 224, - "incorrect value for stec_residuals[3].sv_id.constellation, " - "expected 224, is %d", - check_msg->stec_residuals[3].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[3].sv_id.satId == 116, - "incorrect value for stec_residuals[3].sv_id.satId, expected " - "116, is %d", - check_msg->stec_residuals[3].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[4].residual == 3346, - "incorrect value for stec_residuals[4].residual, expected 3346, is %d", - check_msg->stec_residuals[4].residual); - ck_assert_msg( - check_msg->stec_residuals[4].stddev == 178, - "incorrect value for stec_residuals[4].stddev, expected 178, is %d", - check_msg->stec_residuals[4].stddev); - ck_assert_msg(check_msg->stec_residuals[4].sv_id.constellation == 176, - "incorrect value for stec_residuals[4].sv_id.constellation, " - "expected 176, is %d", - check_msg->stec_residuals[4].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[4].sv_id.satId == 23, - "incorrect value for stec_residuals[4].sv_id.satId, expected 23, is %d", - check_msg->stec_residuals[4].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[5].residual == 28320, - "incorrect value for stec_residuals[5].residual, expected 28320, is %d", - check_msg->stec_residuals[5].residual); - ck_assert_msg( - check_msg->stec_residuals[5].stddev == 15, - "incorrect value for stec_residuals[5].stddev, expected 15, is %d", - check_msg->stec_residuals[5].stddev); - ck_assert_msg(check_msg->stec_residuals[5].sv_id.constellation == 160, - "incorrect value for stec_residuals[5].sv_id.constellation, " - "expected 160, is %d", - check_msg->stec_residuals[5].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[5].sv_id.satId == 79, - "incorrect value for stec_residuals[5].sv_id.satId, expected 79, is %d", - check_msg->stec_residuals[5].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[6].residual == -24937, - "incorrect value for stec_residuals[6].residual, expected " - "-24937, is %d", - check_msg->stec_residuals[6].residual); - ck_assert_msg( - check_msg->stec_residuals[6].stddev == 22, - "incorrect value for stec_residuals[6].stddev, expected 22, is %d", - check_msg->stec_residuals[6].stddev); - ck_assert_msg(check_msg->stec_residuals[6].sv_id.constellation == 206, - "incorrect value for stec_residuals[6].sv_id.constellation, " - "expected 206, is %d", - check_msg->stec_residuals[6].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[6].sv_id.satId == 53, - "incorrect value for stec_residuals[6].sv_id.satId, expected 53, is %d", - check_msg->stec_residuals[6].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[7].residual == -21968, - "incorrect value for stec_residuals[7].residual, expected " - "-21968, is %d", - check_msg->stec_residuals[7].residual); - ck_assert_msg( - check_msg->stec_residuals[7].stddev == 82, - "incorrect value for stec_residuals[7].stddev, expected 82, is %d", - check_msg->stec_residuals[7].stddev); - ck_assert_msg(check_msg->stec_residuals[7].sv_id.constellation == 184, - "incorrect value for stec_residuals[7].sv_id.constellation, " - "expected 184, is %d", - check_msg->stec_residuals[7].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[7].sv_id.satId == 117, - "incorrect value for stec_residuals[7].sv_id.satId, expected " - "117, is %d", - check_msg->stec_residuals[7].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[8].residual == 17786, - "incorrect value for stec_residuals[8].residual, expected 17786, is %d", - check_msg->stec_residuals[8].residual); - ck_assert_msg( - check_msg->stec_residuals[8].stddev == 180, - "incorrect value for stec_residuals[8].stddev, expected 180, is %d", - check_msg->stec_residuals[8].stddev); - ck_assert_msg(check_msg->stec_residuals[8].sv_id.constellation == 53, - "incorrect value for stec_residuals[8].sv_id.constellation, " - "expected 53, is %d", - check_msg->stec_residuals[8].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[8].sv_id.satId == 40, - "incorrect value for stec_residuals[8].sv_id.satId, expected 40, is %d", - check_msg->stec_residuals[8].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[9].residual == 26689, - "incorrect value for stec_residuals[9].residual, expected 26689, is %d", - check_msg->stec_residuals[9].residual); - ck_assert_msg( - check_msg->stec_residuals[9].stddev == 244, - "incorrect value for stec_residuals[9].stddev, expected 244, is %d", - check_msg->stec_residuals[9].stddev); - ck_assert_msg(check_msg->stec_residuals[9].sv_id.constellation == 38, - "incorrect value for stec_residuals[9].sv_id.constellation, " - "expected 38, is %d", - check_msg->stec_residuals[9].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[9].sv_id.satId == 110, - "incorrect value for stec_residuals[9].sv_id.satId, expected " - "110, is %d", - check_msg->stec_residuals[9].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[10].residual == 22755, - "incorrect value for stec_residuals[10].residual, expected " - "22755, is %d", - check_msg->stec_residuals[10].residual); - ck_assert_msg( - check_msg->stec_residuals[10].stddev == 169, - "incorrect value for stec_residuals[10].stddev, expected 169, is %d", - check_msg->stec_residuals[10].stddev); - ck_assert_msg(check_msg->stec_residuals[10].sv_id.constellation == 238, - "incorrect value for stec_residuals[10].sv_id.constellation, " - "expected 238, is %d", - check_msg->stec_residuals[10].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[10].sv_id.satId == 19, - "incorrect value for stec_residuals[10].sv_id.satId, " - "expected 19, is %d", - check_msg->stec_residuals[10].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[11].residual == 9535, - "incorrect value for stec_residuals[11].residual, expected 9535, is %d", - check_msg->stec_residuals[11].residual); - ck_assert_msg( - check_msg->stec_residuals[11].stddev == 183, - "incorrect value for stec_residuals[11].stddev, expected 183, is %d", - check_msg->stec_residuals[11].stddev); - ck_assert_msg(check_msg->stec_residuals[11].sv_id.constellation == 146, - "incorrect value for stec_residuals[11].sv_id.constellation, " - "expected 146, is %d", - check_msg->stec_residuals[11].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[11].sv_id.satId == 164, - "incorrect value for stec_residuals[11].sv_id.satId, " - "expected 164, is %d", - check_msg->stec_residuals[11].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[12].residual == -22293, - "incorrect value for stec_residuals[12].residual, expected " - "-22293, is %d", - check_msg->stec_residuals[12].residual); - ck_assert_msg( - check_msg->stec_residuals[12].stddev == 114, - "incorrect value for stec_residuals[12].stddev, expected 114, is %d", - check_msg->stec_residuals[12].stddev); - ck_assert_msg(check_msg->stec_residuals[12].sv_id.constellation == 71, - "incorrect value for stec_residuals[12].sv_id.constellation, " - "expected 71, is %d", - check_msg->stec_residuals[12].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[12].sv_id.satId == 85, - "incorrect value for stec_residuals[12].sv_id.satId, " - "expected 85, is %d", - check_msg->stec_residuals[12].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[13].residual == -25379, - "incorrect value for stec_residuals[13].residual, expected " - "-25379, is %d", - check_msg->stec_residuals[13].residual); - ck_assert_msg( - check_msg->stec_residuals[13].stddev == 60, - "incorrect value for stec_residuals[13].stddev, expected 60, is %d", - check_msg->stec_residuals[13].stddev); - ck_assert_msg(check_msg->stec_residuals[13].sv_id.constellation == 105, - "incorrect value for stec_residuals[13].sv_id.constellation, " - "expected 105, is %d", - check_msg->stec_residuals[13].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[13].sv_id.satId == 211, - "incorrect value for stec_residuals[13].sv_id.satId, " - "expected 211, is %d", - check_msg->stec_residuals[13].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[14].residual == -29182, - "incorrect value for stec_residuals[14].residual, expected " - "-29182, is %d", - check_msg->stec_residuals[14].residual); - ck_assert_msg( - check_msg->stec_residuals[14].stddev == 172, - "incorrect value for stec_residuals[14].stddev, expected 172, is %d", - check_msg->stec_residuals[14].stddev); - ck_assert_msg(check_msg->stec_residuals[14].sv_id.constellation == 230, - "incorrect value for stec_residuals[14].sv_id.constellation, " - "expected 230, is %d", - check_msg->stec_residuals[14].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[14].sv_id.satId == 18, - "incorrect value for stec_residuals[14].sv_id.satId, " - "expected 18, is %d", - check_msg->stec_residuals[14].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[15].residual == 32289, - "incorrect value for stec_residuals[15].residual, expected " - "32289, is %d", - check_msg->stec_residuals[15].residual); - ck_assert_msg( - check_msg->stec_residuals[15].stddev == 106, - "incorrect value for stec_residuals[15].stddev, expected 106, is %d", - check_msg->stec_residuals[15].stddev); - ck_assert_msg(check_msg->stec_residuals[15].sv_id.constellation == 39, - "incorrect value for stec_residuals[15].sv_id.constellation, " - "expected 39, is %d", - check_msg->stec_residuals[15].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[15].sv_id.satId == 16, - "incorrect value for stec_residuals[15].sv_id.satId, " - "expected 16, is %d", - check_msg->stec_residuals[15].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[16].residual == 10730, - "incorrect value for stec_residuals[16].residual, expected " - "10730, is %d", - check_msg->stec_residuals[16].residual); - ck_assert_msg( - check_msg->stec_residuals[16].stddev == 162, - "incorrect value for stec_residuals[16].stddev, expected 162, is %d", - check_msg->stec_residuals[16].stddev); - ck_assert_msg(check_msg->stec_residuals[16].sv_id.constellation == 188, - "incorrect value for stec_residuals[16].sv_id.constellation, " - "expected 188, is %d", - check_msg->stec_residuals[16].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[16].sv_id.satId == 99, - "incorrect value for stec_residuals[16].sv_id.satId, " - "expected 99, is %d", - check_msg->stec_residuals[16].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[17].residual == 20707, - "incorrect value for stec_residuals[17].residual, expected " - "20707, is %d", - check_msg->stec_residuals[17].residual); - ck_assert_msg( - check_msg->stec_residuals[17].stddev == 12, - "incorrect value for stec_residuals[17].stddev, expected 12, is %d", - check_msg->stec_residuals[17].stddev); - ck_assert_msg(check_msg->stec_residuals[17].sv_id.constellation == 138, - "incorrect value for stec_residuals[17].sv_id.constellation, " - "expected 138, is %d", - check_msg->stec_residuals[17].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[17].sv_id.satId == 197, - "incorrect value for stec_residuals[17].sv_id.satId, " - "expected 197, is %d", - check_msg->stec_residuals[17].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[18].residual == 1518, - "incorrect value for stec_residuals[18].residual, expected 1518, is %d", - check_msg->stec_residuals[18].residual); - ck_assert_msg( - check_msg->stec_residuals[18].stddev == 93, - "incorrect value for stec_residuals[18].stddev, expected 93, is %d", - check_msg->stec_residuals[18].stddev); - ck_assert_msg(check_msg->stec_residuals[18].sv_id.constellation == 67, - "incorrect value for stec_residuals[18].sv_id.constellation, " - "expected 67, is %d", - check_msg->stec_residuals[18].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[18].sv_id.satId == 54, - "incorrect value for stec_residuals[18].sv_id.satId, " - "expected 54, is %d", - check_msg->stec_residuals[18].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[19].residual == 3457, - "incorrect value for stec_residuals[19].residual, expected 3457, is %d", - check_msg->stec_residuals[19].residual); - ck_assert_msg( - check_msg->stec_residuals[19].stddev == 46, - "incorrect value for stec_residuals[19].stddev, expected 46, is %d", - check_msg->stec_residuals[19].stddev); - ck_assert_msg(check_msg->stec_residuals[19].sv_id.constellation == 207, - "incorrect value for stec_residuals[19].sv_id.constellation, " - "expected 207, is %d", - check_msg->stec_residuals[19].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[19].sv_id.satId == 1, - "incorrect value for stec_residuals[19].sv_id.satId, expected 1, is %d", - check_msg->stec_residuals[19].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[20].residual == -18118, - "incorrect value for stec_residuals[20].residual, expected " - "-18118, is %d", - check_msg->stec_residuals[20].residual); - ck_assert_msg( - check_msg->stec_residuals[20].stddev == 127, - "incorrect value for stec_residuals[20].stddev, expected 127, is %d", - check_msg->stec_residuals[20].stddev); - ck_assert_msg(check_msg->stec_residuals[20].sv_id.constellation == 49, - "incorrect value for stec_residuals[20].sv_id.constellation, " - "expected 49, is %d", - check_msg->stec_residuals[20].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[20].sv_id.satId == 115, - "incorrect value for stec_residuals[20].sv_id.satId, " - "expected 115, is %d", - check_msg->stec_residuals[20].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[21].residual == -9888, - "incorrect value for stec_residuals[21].residual, expected " - "-9888, is %d", - check_msg->stec_residuals[21].residual); - ck_assert_msg( - check_msg->stec_residuals[21].stddev == 202, - "incorrect value for stec_residuals[21].stddev, expected 202, is %d", - check_msg->stec_residuals[21].stddev); - ck_assert_msg(check_msg->stec_residuals[21].sv_id.constellation == 200, - "incorrect value for stec_residuals[21].sv_id.constellation, " - "expected 200, is %d", - check_msg->stec_residuals[21].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[21].sv_id.satId == 156, - "incorrect value for stec_residuals[21].sv_id.satId, " - "expected 156, is %d", - check_msg->stec_residuals[21].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[22].residual == -14793, - "incorrect value for stec_residuals[22].residual, expected " - "-14793, is %d", - check_msg->stec_residuals[22].residual); - ck_assert_msg( - check_msg->stec_residuals[22].stddev == 81, - "incorrect value for stec_residuals[22].stddev, expected 81, is %d", - check_msg->stec_residuals[22].stddev); - ck_assert_msg(check_msg->stec_residuals[22].sv_id.constellation == 245, - "incorrect value for stec_residuals[22].sv_id.constellation, " - "expected 245, is %d", - check_msg->stec_residuals[22].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[22].sv_id.satId == 15, - "incorrect value for stec_residuals[22].sv_id.satId, " - "expected 15, is %d", - check_msg->stec_residuals[22].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[23].residual == 18758, - "incorrect value for stec_residuals[23].residual, expected " - "18758, is %d", - check_msg->stec_residuals[23].residual); - ck_assert_msg( - check_msg->stec_residuals[23].stddev == 82, - "incorrect value for stec_residuals[23].stddev, expected 82, is %d", - check_msg->stec_residuals[23].stddev); - ck_assert_msg(check_msg->stec_residuals[23].sv_id.constellation == 132, - "incorrect value for stec_residuals[23].sv_id.constellation, " - "expected 132, is %d", - check_msg->stec_residuals[23].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[23].sv_id.satId == 218, - "incorrect value for stec_residuals[23].sv_id.satId, " - "expected 218, is %d", - check_msg->stec_residuals[23].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[24].residual == 3839, - "incorrect value for stec_residuals[24].residual, expected 3839, is %d", - check_msg->stec_residuals[24].residual); - ck_assert_msg( - check_msg->stec_residuals[24].stddev == 134, - "incorrect value for stec_residuals[24].stddev, expected 134, is %d", - check_msg->stec_residuals[24].stddev); - ck_assert_msg(check_msg->stec_residuals[24].sv_id.constellation == 26, - "incorrect value for stec_residuals[24].sv_id.constellation, " - "expected 26, is %d", - check_msg->stec_residuals[24].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[24].sv_id.satId == 147, - "incorrect value for stec_residuals[24].sv_id.satId, " - "expected 147, is %d", - check_msg->stec_residuals[24].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[25].residual == -10697, - "incorrect value for stec_residuals[25].residual, expected " - "-10697, is %d", - check_msg->stec_residuals[25].residual); - ck_assert_msg( - check_msg->stec_residuals[25].stddev == 83, - "incorrect value for stec_residuals[25].stddev, expected 83, is %d", - check_msg->stec_residuals[25].stddev); - ck_assert_msg(check_msg->stec_residuals[25].sv_id.constellation == 138, - "incorrect value for stec_residuals[25].sv_id.constellation, " - "expected 138, is %d", - check_msg->stec_residuals[25].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[25].sv_id.satId == 96, - "incorrect value for stec_residuals[25].sv_id.satId, " - "expected 96, is %d", - check_msg->stec_residuals[25].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[26].residual == 20387, - "incorrect value for stec_residuals[26].residual, expected " - "20387, is %d", - check_msg->stec_residuals[26].residual); - ck_assert_msg( - check_msg->stec_residuals[26].stddev == 173, - "incorrect value for stec_residuals[26].stddev, expected 173, is %d", - check_msg->stec_residuals[26].stddev); - ck_assert_msg(check_msg->stec_residuals[26].sv_id.constellation == 170, - "incorrect value for stec_residuals[26].sv_id.constellation, " - "expected 170, is %d", - check_msg->stec_residuals[26].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[26].sv_id.satId == 156, - "incorrect value for stec_residuals[26].sv_id.satId, " - "expected 156, is %d", - check_msg->stec_residuals[26].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[27].residual == -3789, - "incorrect value for stec_residuals[27].residual, expected " - "-3789, is %d", - check_msg->stec_residuals[27].residual); - ck_assert_msg( - check_msg->stec_residuals[27].stddev == 107, - "incorrect value for stec_residuals[27].stddev, expected 107, is %d", - check_msg->stec_residuals[27].stddev); - ck_assert_msg(check_msg->stec_residuals[27].sv_id.constellation == 115, - "incorrect value for stec_residuals[27].sv_id.constellation, " - "expected 115, is %d", - check_msg->stec_residuals[27].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[27].sv_id.satId == 228, - "incorrect value for stec_residuals[27].sv_id.satId, " - "expected 228, is %d", - check_msg->stec_residuals[27].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[28].residual == -11608, - "incorrect value for stec_residuals[28].residual, expected " - "-11608, is %d", - check_msg->stec_residuals[28].residual); - ck_assert_msg( - check_msg->stec_residuals[28].stddev == 10, - "incorrect value for stec_residuals[28].stddev, expected 10, is %d", - check_msg->stec_residuals[28].stddev); - ck_assert_msg(check_msg->stec_residuals[28].sv_id.constellation == 112, - "incorrect value for stec_residuals[28].sv_id.constellation, " - "expected 112, is %d", - check_msg->stec_residuals[28].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[28].sv_id.satId == 245, - "incorrect value for stec_residuals[28].sv_id.satId, " - "expected 245, is %d", - check_msg->stec_residuals[28].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[29].residual == 14593, - "incorrect value for stec_residuals[29].residual, expected " - "14593, is %d", - check_msg->stec_residuals[29].residual); - ck_assert_msg( - check_msg->stec_residuals[29].stddev == 108, - "incorrect value for stec_residuals[29].stddev, expected 108, is %d", - check_msg->stec_residuals[29].stddev); - ck_assert_msg(check_msg->stec_residuals[29].sv_id.constellation == 117, - "incorrect value for stec_residuals[29].sv_id.constellation, " - "expected 117, is %d", - check_msg->stec_residuals[29].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[29].sv_id.satId == 5, - "incorrect value for stec_residuals[29].sv_id.satId, expected 5, is %d", - check_msg->stec_residuals[29].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[30].residual == 30609, - "incorrect value for stec_residuals[30].residual, expected " - "30609, is %d", - check_msg->stec_residuals[30].residual); - ck_assert_msg( - check_msg->stec_residuals[30].stddev == 226, - "incorrect value for stec_residuals[30].stddev, expected 226, is %d", - check_msg->stec_residuals[30].stddev); - ck_assert_msg(check_msg->stec_residuals[30].sv_id.constellation == 212, - "incorrect value for stec_residuals[30].sv_id.constellation, " - "expected 212, is %d", - check_msg->stec_residuals[30].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[30].sv_id.satId == 248, - "incorrect value for stec_residuals[30].sv_id.satId, " - "expected 248, is %d", - check_msg->stec_residuals[30].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[31].residual == -13683, - "incorrect value for stec_residuals[31].residual, expected " - "-13683, is %d", - check_msg->stec_residuals[31].residual); - ck_assert_msg( - check_msg->stec_residuals[31].stddev == 106, - "incorrect value for stec_residuals[31].stddev, expected 106, is %d", - check_msg->stec_residuals[31].stddev); - ck_assert_msg(check_msg->stec_residuals[31].sv_id.constellation == 5, - "incorrect value for stec_residuals[31].sv_id.constellation, " - "expected 5, is %d", - check_msg->stec_residuals[31].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[31].sv_id.satId == 165, - "incorrect value for stec_residuals[31].sv_id.satId, " - "expected 165, is %d", - check_msg->stec_residuals[31].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[32].residual == 15652, - "incorrect value for stec_residuals[32].residual, expected " - "15652, is %d", - check_msg->stec_residuals[32].residual); - ck_assert_msg( - check_msg->stec_residuals[32].stddev == 243, - "incorrect value for stec_residuals[32].stddev, expected 243, is %d", - check_msg->stec_residuals[32].stddev); - ck_assert_msg(check_msg->stec_residuals[32].sv_id.constellation == 60, - "incorrect value for stec_residuals[32].sv_id.constellation, " - "expected 60, is %d", - check_msg->stec_residuals[32].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[32].sv_id.satId == 0, - "incorrect value for stec_residuals[32].sv_id.satId, expected 0, is %d", - check_msg->stec_residuals[32].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[33].residual == 3287, - "incorrect value for stec_residuals[33].residual, expected 3287, is %d", - check_msg->stec_residuals[33].residual); - ck_assert_msg( - check_msg->stec_residuals[33].stddev == 137, - "incorrect value for stec_residuals[33].stddev, expected 137, is %d", - check_msg->stec_residuals[33].stddev); - ck_assert_msg(check_msg->stec_residuals[33].sv_id.constellation == 216, - "incorrect value for stec_residuals[33].sv_id.constellation, " - "expected 216, is %d", - check_msg->stec_residuals[33].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[33].sv_id.satId == 203, - "incorrect value for stec_residuals[33].sv_id.satId, " - "expected 203, is %d", - check_msg->stec_residuals[33].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[34].residual == 29687, - "incorrect value for stec_residuals[34].residual, expected " - "29687, is %d", - check_msg->stec_residuals[34].residual); - ck_assert_msg( - check_msg->stec_residuals[34].stddev == 152, - "incorrect value for stec_residuals[34].stddev, expected 152, is %d", - check_msg->stec_residuals[34].stddev); - ck_assert_msg(check_msg->stec_residuals[34].sv_id.constellation == 28, - "incorrect value for stec_residuals[34].sv_id.constellation, " - "expected 28, is %d", - check_msg->stec_residuals[34].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[34].sv_id.satId == 16, - "incorrect value for stec_residuals[34].sv_id.satId, " - "expected 16, is %d", - check_msg->stec_residuals[34].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[35].residual == -6960, - "incorrect value for stec_residuals[35].residual, expected " - "-6960, is %d", - check_msg->stec_residuals[35].residual); - ck_assert_msg( - check_msg->stec_residuals[35].stddev == 203, - "incorrect value for stec_residuals[35].stddev, expected 203, is %d", - check_msg->stec_residuals[35].stddev); - ck_assert_msg(check_msg->stec_residuals[35].sv_id.constellation == 119, - "incorrect value for stec_residuals[35].sv_id.constellation, " - "expected 119, is %d", - check_msg->stec_residuals[35].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[35].sv_id.satId == 181, - "incorrect value for stec_residuals[35].sv_id.satId, " - "expected 181, is %d", - check_msg->stec_residuals[35].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[36].residual == -15193, - "incorrect value for stec_residuals[36].residual, expected " - "-15193, is %d", - check_msg->stec_residuals[36].residual); - ck_assert_msg( - check_msg->stec_residuals[36].stddev == 32, - "incorrect value for stec_residuals[36].stddev, expected 32, is %d", - check_msg->stec_residuals[36].stddev); - ck_assert_msg(check_msg->stec_residuals[36].sv_id.constellation == 34, - "incorrect value for stec_residuals[36].sv_id.constellation, " - "expected 34, is %d", - check_msg->stec_residuals[36].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[36].sv_id.satId == 236, - "incorrect value for stec_residuals[36].sv_id.satId, " - "expected 236, is %d", - check_msg->stec_residuals[36].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[37].residual == 25873, - "incorrect value for stec_residuals[37].residual, expected " - "25873, is %d", - check_msg->stec_residuals[37].residual); - ck_assert_msg( - check_msg->stec_residuals[37].stddev == 200, - "incorrect value for stec_residuals[37].stddev, expected 200, is %d", - check_msg->stec_residuals[37].stddev); - ck_assert_msg(check_msg->stec_residuals[37].sv_id.constellation == 1, - "incorrect value for stec_residuals[37].sv_id.constellation, " - "expected 1, is %d", - check_msg->stec_residuals[37].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[37].sv_id.satId == 109, - "incorrect value for stec_residuals[37].sv_id.satId, " - "expected 109, is %d", - check_msg->stec_residuals[37].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[38].residual == -22403, - "incorrect value for stec_residuals[38].residual, expected " - "-22403, is %d", - check_msg->stec_residuals[38].residual); - ck_assert_msg( - check_msg->stec_residuals[38].stddev == 137, - "incorrect value for stec_residuals[38].stddev, expected 137, is %d", - check_msg->stec_residuals[38].stddev); - ck_assert_msg(check_msg->stec_residuals[38].sv_id.constellation == 94, - "incorrect value for stec_residuals[38].sv_id.constellation, " - "expected 94, is %d", - check_msg->stec_residuals[38].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[38].sv_id.satId == 25, - "incorrect value for stec_residuals[38].sv_id.satId, " - "expected 25, is %d", - check_msg->stec_residuals[38].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[39].residual == 7588, - "incorrect value for stec_residuals[39].residual, expected 7588, is %d", - check_msg->stec_residuals[39].residual); - ck_assert_msg( - check_msg->stec_residuals[39].stddev == 31, - "incorrect value for stec_residuals[39].stddev, expected 31, is %d", - check_msg->stec_residuals[39].stddev); - ck_assert_msg(check_msg->stec_residuals[39].sv_id.constellation == 4, - "incorrect value for stec_residuals[39].sv_id.constellation, " - "expected 4, is %d", - check_msg->stec_residuals[39].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[39].sv_id.satId == 157, - "incorrect value for stec_residuals[39].sv_id.satId, " - "expected 157, is %d", - check_msg->stec_residuals[39].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[40].residual == -6840, - "incorrect value for stec_residuals[40].residual, expected " - "-6840, is %d", - check_msg->stec_residuals[40].residual); - ck_assert_msg( - check_msg->stec_residuals[40].stddev == 126, - "incorrect value for stec_residuals[40].stddev, expected 126, is %d", - check_msg->stec_residuals[40].stddev); - ck_assert_msg(check_msg->stec_residuals[40].sv_id.constellation == 132, - "incorrect value for stec_residuals[40].sv_id.constellation, " - "expected 132, is %d", - check_msg->stec_residuals[40].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[40].sv_id.satId == 48, - "incorrect value for stec_residuals[40].sv_id.satId, " - "expected 48, is %d", - check_msg->stec_residuals[40].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[41].residual == -31412, - "incorrect value for stec_residuals[41].residual, expected " - "-31412, is %d", - check_msg->stec_residuals[41].residual); - ck_assert_msg( - check_msg->stec_residuals[41].stddev == 21, - "incorrect value for stec_residuals[41].stddev, expected 21, is %d", - check_msg->stec_residuals[41].stddev); - ck_assert_msg(check_msg->stec_residuals[41].sv_id.constellation == 68, - "incorrect value for stec_residuals[41].sv_id.constellation, " - "expected 68, is %d", - check_msg->stec_residuals[41].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[41].sv_id.satId == 186, - "incorrect value for stec_residuals[41].sv_id.satId, " - "expected 186, is %d", - check_msg->stec_residuals[41].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[42].residual == -23413, - "incorrect value for stec_residuals[42].residual, expected " - "-23413, is %d", - check_msg->stec_residuals[42].residual); - ck_assert_msg( - check_msg->stec_residuals[42].stddev == 148, - "incorrect value for stec_residuals[42].stddev, expected 148, is %d", - check_msg->stec_residuals[42].stddev); - ck_assert_msg(check_msg->stec_residuals[42].sv_id.constellation == 180, - "incorrect value for stec_residuals[42].sv_id.constellation, " - "expected 180, is %d", - check_msg->stec_residuals[42].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[42].sv_id.satId == 0, - "incorrect value for stec_residuals[42].sv_id.satId, expected 0, is %d", - check_msg->stec_residuals[42].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[43].residual == 30934, - "incorrect value for stec_residuals[43].residual, expected " - "30934, is %d", - check_msg->stec_residuals[43].residual); - ck_assert_msg( - check_msg->stec_residuals[43].stddev == 177, - "incorrect value for stec_residuals[43].stddev, expected 177, is %d", - check_msg->stec_residuals[43].stddev); - ck_assert_msg(check_msg->stec_residuals[43].sv_id.constellation == 149, - "incorrect value for stec_residuals[43].sv_id.constellation, " - "expected 149, is %d", - check_msg->stec_residuals[43].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[43].sv_id.satId == 119, - "incorrect value for stec_residuals[43].sv_id.satId, " - "expected 119, is %d", - check_msg->stec_residuals[43].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[44].residual == 26960, - "incorrect value for stec_residuals[44].residual, expected " - "26960, is %d", - check_msg->stec_residuals[44].residual); - ck_assert_msg( - check_msg->stec_residuals[44].stddev == 10, - "incorrect value for stec_residuals[44].stddev, expected 10, is %d", - check_msg->stec_residuals[44].stddev); - ck_assert_msg(check_msg->stec_residuals[44].sv_id.constellation == 80, - "incorrect value for stec_residuals[44].sv_id.constellation, " - "expected 80, is %d", - check_msg->stec_residuals[44].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[44].sv_id.satId == 201, - "incorrect value for stec_residuals[44].sv_id.satId, " - "expected 201, is %d", - check_msg->stec_residuals[44].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[45].residual == 11853, - "incorrect value for stec_residuals[45].residual, expected " - "11853, is %d", - check_msg->stec_residuals[45].residual); - ck_assert_msg( - check_msg->stec_residuals[45].stddev == 233, - "incorrect value for stec_residuals[45].stddev, expected 233, is %d", - check_msg->stec_residuals[45].stddev); - ck_assert_msg(check_msg->stec_residuals[45].sv_id.constellation == 118, - "incorrect value for stec_residuals[45].sv_id.constellation, " - "expected 118, is %d", - check_msg->stec_residuals[45].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[45].sv_id.satId == 136, - "incorrect value for stec_residuals[45].sv_id.satId, " - "expected 136, is %d", - check_msg->stec_residuals[45].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[46].residual == -25077, - "incorrect value for stec_residuals[46].residual, expected " - "-25077, is %d", - check_msg->stec_residuals[46].residual); - ck_assert_msg( - check_msg->stec_residuals[46].stddev == 103, - "incorrect value for stec_residuals[46].stddev, expected 103, is %d", - check_msg->stec_residuals[46].stddev); - ck_assert_msg(check_msg->stec_residuals[46].sv_id.constellation == 227, - "incorrect value for stec_residuals[46].sv_id.constellation, " - "expected 227, is %d", - check_msg->stec_residuals[46].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[46].sv_id.satId == 233, - "incorrect value for stec_residuals[46].sv_id.satId, " - "expected 233, is %d", - check_msg->stec_residuals[46].sv_id.satId); - ck_assert_msg(check_msg->tropo_delay_correction.hydro == 10643, - "incorrect value for tropo_delay_correction.hydro, expected " - "10643, is %d", - check_msg->tropo_delay_correction.hydro); - ck_assert_msg( - check_msg->tropo_delay_correction.stddev == 92, - "incorrect value for tropo_delay_correction.stddev, expected 92, is %d", - check_msg->tropo_delay_correction.stddev); - ck_assert_msg( - check_msg->tropo_delay_correction.wet == 33, - "incorrect value for tropo_delay_correction.wet, expected 33, is %d", - check_msg->tropo_delay_correction.wet); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrGriddedCorrectionNoStdDepA.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrGriddedCorrectionNoStdDepA.c deleted file mode 100644 index bbf9c9d7b8..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrGriddedCorrectionNoStdDepA.c +++ /dev/null @@ -1,1400 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrGriddedCorrectionNoStdDepA.yaml -// by generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionNoStdDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x5f0, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x5f0, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 240, 5, 102, 28, 254, 179, 240, 33, 169, 236, 34, 117, 245, - 67, 248, 233, 236, 230, 230, 103, 122, 63, 101, 231, 157, 115, 162, - 197, 146, 35, 107, 222, 109, 52, 41, 86, 12, 237, 184, 65, 204, - 137, 148, 171, 183, 11, 0, 180, 203, 172, 53, 196, 85, 186, 115, - 203, 92, 166, 30, 42, 13, 200, 71, 98, 137, 219, 160, 95, 216, - 95, 250, 99, 196, 92, 214, 159, 253, 195, 222, 233, 146, 233, 63, - 76, 24, 106, 40, 253, 65, 9, 183, 40, 215, 188, 59, 117, 69, - 97, 115, 60, 56, 0, 141, 207, 171, 54, 161, 23, 61, 0, 87, - 230, 123, 87, 36, 184, 255, 14, 163, 187, 224, 43, 151, 151, 104, - 39, 57, 5, 54, 48, 224, 181, 129, 60, 92, 171, 114, 109, 109, - 12, 23, 118, 8, 64, 159, 54, 216, 33, 20, 24, 68, 160, 36, - 38, 222, 145, 190, 92, 99, 108, 159, 232, 240, 227, 221, 253, 15, - 62, 23, 121, 185, 168, 116, 4, 147, 123, 72, 223, 119, 226, 242, - 161, 204, 180, 202, 137, 166, 58, 24, 124, 19, 181, 188, 16, 107, - 66, 231, 63, 1, 64, 252, 115, 62, 233, 97, 250, 86, 156, 221, - 49, 178, 32, 73, 198, 67, 249, 253, 74, 56, 38, 165, 119, 92, - 99, 44, 95, 131, 89, 192, 225, 55, 95, 171, 88, 205, 21, 116, - 231, 83, 71, 71, 100, 110, 217, 254, 152, 212, 18, 8, 40, 157, - 244, 54, 72, 240, 231, 189, 111, 195, 205, 81, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_gridded_correction_no_std_dep_a_t *test_msg = - (msg_ssr_gridded_correction_no_std_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.iod_atmo = 236; - test_msg->header.num_msgs = 62837; - test_msg->header.seq_num = 63555; - test_msg->header.time.tow = 2837573811; - test_msg->header.time.wn = 8940; - test_msg->header.tropo_quality_indicator = 230; - test_msg->header.update_interval = 233; - test_msg->index = 26598; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[0].residual = -23949; - test_msg->stec_residuals[0].sv_id.constellation = 157; - test_msg->stec_residuals[0].sv_id.satId = 231; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[1].residual = 27427; - test_msg->stec_residuals[1].sv_id.constellation = 146; - test_msg->stec_residuals[1].sv_id.satId = 197; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[2].residual = 10548; - test_msg->stec_residuals[2].sv_id.constellation = 109; - test_msg->stec_residuals[2].sv_id.satId = 222; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[3].residual = -18195; - test_msg->stec_residuals[3].sv_id.constellation = 12; - test_msg->stec_residuals[3].sv_id.satId = 86; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[4].residual = -27511; - test_msg->stec_residuals[4].sv_id.constellation = 204; - test_msg->stec_residuals[4].sv_id.satId = 65; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[5].residual = 11; - test_msg->stec_residuals[5].sv_id.constellation = 183; - test_msg->stec_residuals[5].sv_id.satId = 171; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[6].residual = 13740; - test_msg->stec_residuals[6].sv_id.constellation = 203; - test_msg->stec_residuals[6].sv_id.satId = 180; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[7].residual = 29626; - test_msg->stec_residuals[7].sv_id.constellation = 85; - test_msg->stec_residuals[7].sv_id.satId = 196; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[8].residual = 7846; - test_msg->stec_residuals[8].sv_id.constellation = 92; - test_msg->stec_residuals[8].sv_id.satId = 203; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[9].residual = 18376; - test_msg->stec_residuals[9].sv_id.constellation = 13; - test_msg->stec_residuals[9].sv_id.satId = 42; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[10].residual = -24357; - test_msg->stec_residuals[10].sv_id.constellation = 137; - test_msg->stec_residuals[10].sv_id.satId = 98; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[11].residual = -1441; - test_msg->stec_residuals[11].sv_id.constellation = 216; - test_msg->stec_residuals[11].sv_id.satId = 95; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[12].residual = -10660; - test_msg->stec_residuals[12].sv_id.constellation = 196; - test_msg->stec_residuals[12].sv_id.satId = 99; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[13].residual = -8509; - test_msg->stec_residuals[13].sv_id.constellation = 253; - test_msg->stec_residuals[13].sv_id.satId = 159; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[14].residual = 16361; - test_msg->stec_residuals[14].sv_id.constellation = 146; - test_msg->stec_residuals[14].sv_id.satId = 233; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[15].residual = 10346; - test_msg->stec_residuals[15].sv_id.constellation = 24; - test_msg->stec_residuals[15].sv_id.satId = 76; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[16].residual = -18679; - test_msg->stec_residuals[16].sv_id.constellation = 65; - test_msg->stec_residuals[16].sv_id.satId = 253; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[17].residual = 15292; - test_msg->stec_residuals[17].sv_id.constellation = 215; - test_msg->stec_residuals[17].sv_id.satId = 40; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[18].residual = 29537; - test_msg->stec_residuals[18].sv_id.constellation = 69; - test_msg->stec_residuals[18].sv_id.satId = 117; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[19].residual = -29440; - test_msg->stec_residuals[19].sv_id.constellation = 56; - test_msg->stec_residuals[19].sv_id.satId = 60; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[20].residual = -24266; - test_msg->stec_residuals[20].sv_id.constellation = 171; - test_msg->stec_residuals[20].sv_id.satId = 207; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[21].residual = 22272; - test_msg->stec_residuals[21].sv_id.constellation = 61; - test_msg->stec_residuals[21].sv_id.satId = 23; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[22].residual = 9303; - test_msg->stec_residuals[22].sv_id.constellation = 123; - test_msg->stec_residuals[22].sv_id.satId = 230; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[23].residual = -23794; - test_msg->stec_residuals[23].sv_id.constellation = 255; - test_msg->stec_residuals[23].sv_id.satId = 184; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[24].residual = -26837; - test_msg->stec_residuals[24].sv_id.constellation = 224; - test_msg->stec_residuals[24].sv_id.satId = 187; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[25].residual = 14631; - test_msg->stec_residuals[25].sv_id.constellation = 104; - test_msg->stec_residuals[25].sv_id.satId = 151; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[26].residual = -8144; - test_msg->stec_residuals[26].sv_id.constellation = 54; - test_msg->stec_residuals[26].sv_id.satId = 5; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[27].residual = 23612; - test_msg->stec_residuals[27].sv_id.constellation = 129; - test_msg->stec_residuals[27].sv_id.satId = 181; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[28].residual = 28013; - test_msg->stec_residuals[28].sv_id.constellation = 114; - test_msg->stec_residuals[28].sv_id.satId = 171; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[29].residual = 2166; - test_msg->stec_residuals[29].sv_id.constellation = 23; - test_msg->stec_residuals[29].sv_id.satId = 12; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[30].residual = -10186; - test_msg->stec_residuals[30].sv_id.constellation = 159; - test_msg->stec_residuals[30].sv_id.satId = 64; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[31].residual = 17432; - test_msg->stec_residuals[31].sv_id.constellation = 20; - test_msg->stec_residuals[31].sv_id.satId = 33; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[32].residual = -8666; - test_msg->stec_residuals[32].sv_id.constellation = 36; - test_msg->stec_residuals[32].sv_id.satId = 160; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[33].residual = 25436; - test_msg->stec_residuals[33].sv_id.constellation = 190; - test_msg->stec_residuals[33].sv_id.satId = 145; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[34].residual = -3864; - test_msg->stec_residuals[34].sv_id.constellation = 159; - test_msg->stec_residuals[34].sv_id.satId = 108; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[35].residual = 4093; - test_msg->stec_residuals[35].sv_id.constellation = 221; - test_msg->stec_residuals[35].sv_id.satId = 227; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[36].residual = -18055; - test_msg->stec_residuals[36].sv_id.constellation = 23; - test_msg->stec_residuals[36].sv_id.satId = 62; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[37].residual = -27900; - test_msg->stec_residuals[37].sv_id.constellation = 116; - test_msg->stec_residuals[37].sv_id.satId = 168; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[38].residual = 30687; - test_msg->stec_residuals[38].sv_id.constellation = 72; - test_msg->stec_residuals[38].sv_id.satId = 123; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[39].residual = -13151; - test_msg->stec_residuals[39].sv_id.constellation = 242; - test_msg->stec_residuals[39].sv_id.satId = 226; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[40].residual = -22903; - test_msg->stec_residuals[40].sv_id.constellation = 202; - test_msg->stec_residuals[40].sv_id.satId = 180; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[41].residual = 4988; - test_msg->stec_residuals[41].sv_id.constellation = 24; - test_msg->stec_residuals[41].sv_id.satId = 58; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[42].residual = 27408; - test_msg->stec_residuals[42].sv_id.constellation = 188; - test_msg->stec_residuals[42].sv_id.satId = 181; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[43].residual = 319; - test_msg->stec_residuals[43].sv_id.constellation = 231; - test_msg->stec_residuals[43].sv_id.satId = 66; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[44].residual = 15987; - test_msg->stec_residuals[44].sv_id.constellation = 252; - test_msg->stec_residuals[44].sv_id.satId = 64; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[45].residual = 22266; - test_msg->stec_residuals[45].sv_id.constellation = 97; - test_msg->stec_residuals[45].sv_id.satId = 233; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[46].residual = -19919; - test_msg->stec_residuals[46].sv_id.constellation = 221; - test_msg->stec_residuals[46].sv_id.satId = 156; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[47].residual = 17350; - test_msg->stec_residuals[47].sv_id.constellation = 73; - test_msg->stec_residuals[47].sv_id.satId = 32; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[48].residual = 14410; - test_msg->stec_residuals[48].sv_id.constellation = 253; - test_msg->stec_residuals[48].sv_id.satId = 249; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[49].residual = 23671; - test_msg->stec_residuals[49].sv_id.constellation = 165; - test_msg->stec_residuals[49].sv_id.satId = 38; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[50].residual = -31905; - test_msg->stec_residuals[50].sv_id.constellation = 44; - test_msg->stec_residuals[50].sv_id.satId = 99; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[51].residual = 14305; - test_msg->stec_residuals[51].sv_id.constellation = 192; - test_msg->stec_residuals[51].sv_id.satId = 89; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[52].residual = -12968; - test_msg->stec_residuals[52].sv_id.constellation = 171; - test_msg->stec_residuals[52].sv_id.satId = 95; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[53].residual = 21479; - test_msg->stec_residuals[53].sv_id.constellation = 116; - test_msg->stec_residuals[53].sv_id.satId = 21; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[54].residual = 28260; - test_msg->stec_residuals[54].sv_id.constellation = 71; - test_msg->stec_residuals[54].sv_id.satId = 71; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[55].residual = -11112; - test_msg->stec_residuals[55].sv_id.constellation = 254; - test_msg->stec_residuals[55].sv_id.satId = 217; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[56].residual = -25304; - test_msg->stec_residuals[56].sv_id.constellation = 8; - test_msg->stec_residuals[56].sv_id.satId = 18; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[57].residual = -4024; - test_msg->stec_residuals[57].sv_id.constellation = 54; - test_msg->stec_residuals[57].sv_id.satId = 244; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_residuals[0]); - } - test_msg->stec_residuals[58].residual = -15505; - test_msg->stec_residuals[58].sv_id.constellation = 189; - test_msg->stec_residuals[58].sv_id.satId = 231; - test_msg->tropo_delay_correction.hydro = 16250; - test_msg->tropo_delay_correction.wet = 101; - sbp_payload_send(&sbp_state, 0x5f0, 7270, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 7270, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 7270, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x5f0, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_gridded_correction_no_std_dep_a_t *check_msg = - (msg_ssr_gridded_correction_no_std_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.iod_atmo == 236, - "incorrect value for header.iod_atmo, expected 236, is %d", - check_msg->header.iod_atmo); - ck_assert_msg(check_msg->header.num_msgs == 62837, - "incorrect value for header.num_msgs, expected 62837, is %d", - check_msg->header.num_msgs); - ck_assert_msg(check_msg->header.seq_num == 63555, - "incorrect value for header.seq_num, expected 63555, is %d", - check_msg->header.seq_num); - ck_assert_msg( - check_msg->header.time.tow == 2837573811, - "incorrect value for header.time.tow, expected 2837573811, is %d", - check_msg->header.time.tow); - ck_assert_msg(check_msg->header.time.wn == 8940, - "incorrect value for header.time.wn, expected 8940, is %d", - check_msg->header.time.wn); - ck_assert_msg(check_msg->header.tropo_quality_indicator == 230, - "incorrect value for header.tropo_quality_indicator, " - "expected 230, is %d", - check_msg->header.tropo_quality_indicator); - ck_assert_msg( - check_msg->header.update_interval == 233, - "incorrect value for header.update_interval, expected 233, is %d", - check_msg->header.update_interval); - ck_assert_msg(check_msg->index == 26598, - "incorrect value for index, expected 26598, is %d", - check_msg->index); - ck_assert_msg(check_msg->stec_residuals[0].residual == -23949, - "incorrect value for stec_residuals[0].residual, expected " - "-23949, is %d", - check_msg->stec_residuals[0].residual); - ck_assert_msg(check_msg->stec_residuals[0].sv_id.constellation == 157, - "incorrect value for stec_residuals[0].sv_id.constellation, " - "expected 157, is %d", - check_msg->stec_residuals[0].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[0].sv_id.satId == 231, - "incorrect value for stec_residuals[0].sv_id.satId, expected " - "231, is %d", - check_msg->stec_residuals[0].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[1].residual == 27427, - "incorrect value for stec_residuals[1].residual, expected 27427, is %d", - check_msg->stec_residuals[1].residual); - ck_assert_msg(check_msg->stec_residuals[1].sv_id.constellation == 146, - "incorrect value for stec_residuals[1].sv_id.constellation, " - "expected 146, is %d", - check_msg->stec_residuals[1].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[1].sv_id.satId == 197, - "incorrect value for stec_residuals[1].sv_id.satId, expected " - "197, is %d", - check_msg->stec_residuals[1].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[2].residual == 10548, - "incorrect value for stec_residuals[2].residual, expected 10548, is %d", - check_msg->stec_residuals[2].residual); - ck_assert_msg(check_msg->stec_residuals[2].sv_id.constellation == 109, - "incorrect value for stec_residuals[2].sv_id.constellation, " - "expected 109, is %d", - check_msg->stec_residuals[2].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[2].sv_id.satId == 222, - "incorrect value for stec_residuals[2].sv_id.satId, expected " - "222, is %d", - check_msg->stec_residuals[2].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[3].residual == -18195, - "incorrect value for stec_residuals[3].residual, expected " - "-18195, is %d", - check_msg->stec_residuals[3].residual); - ck_assert_msg(check_msg->stec_residuals[3].sv_id.constellation == 12, - "incorrect value for stec_residuals[3].sv_id.constellation, " - "expected 12, is %d", - check_msg->stec_residuals[3].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[3].sv_id.satId == 86, - "incorrect value for stec_residuals[3].sv_id.satId, expected 86, is %d", - check_msg->stec_residuals[3].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[4].residual == -27511, - "incorrect value for stec_residuals[4].residual, expected " - "-27511, is %d", - check_msg->stec_residuals[4].residual); - ck_assert_msg(check_msg->stec_residuals[4].sv_id.constellation == 204, - "incorrect value for stec_residuals[4].sv_id.constellation, " - "expected 204, is %d", - check_msg->stec_residuals[4].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[4].sv_id.satId == 65, - "incorrect value for stec_residuals[4].sv_id.satId, expected 65, is %d", - check_msg->stec_residuals[4].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[5].residual == 11, - "incorrect value for stec_residuals[5].residual, expected 11, is %d", - check_msg->stec_residuals[5].residual); - ck_assert_msg(check_msg->stec_residuals[5].sv_id.constellation == 183, - "incorrect value for stec_residuals[5].sv_id.constellation, " - "expected 183, is %d", - check_msg->stec_residuals[5].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[5].sv_id.satId == 171, - "incorrect value for stec_residuals[5].sv_id.satId, expected " - "171, is %d", - check_msg->stec_residuals[5].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[6].residual == 13740, - "incorrect value for stec_residuals[6].residual, expected 13740, is %d", - check_msg->stec_residuals[6].residual); - ck_assert_msg(check_msg->stec_residuals[6].sv_id.constellation == 203, - "incorrect value for stec_residuals[6].sv_id.constellation, " - "expected 203, is %d", - check_msg->stec_residuals[6].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[6].sv_id.satId == 180, - "incorrect value for stec_residuals[6].sv_id.satId, expected " - "180, is %d", - check_msg->stec_residuals[6].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[7].residual == 29626, - "incorrect value for stec_residuals[7].residual, expected 29626, is %d", - check_msg->stec_residuals[7].residual); - ck_assert_msg(check_msg->stec_residuals[7].sv_id.constellation == 85, - "incorrect value for stec_residuals[7].sv_id.constellation, " - "expected 85, is %d", - check_msg->stec_residuals[7].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[7].sv_id.satId == 196, - "incorrect value for stec_residuals[7].sv_id.satId, expected " - "196, is %d", - check_msg->stec_residuals[7].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[8].residual == 7846, - "incorrect value for stec_residuals[8].residual, expected 7846, is %d", - check_msg->stec_residuals[8].residual); - ck_assert_msg(check_msg->stec_residuals[8].sv_id.constellation == 92, - "incorrect value for stec_residuals[8].sv_id.constellation, " - "expected 92, is %d", - check_msg->stec_residuals[8].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[8].sv_id.satId == 203, - "incorrect value for stec_residuals[8].sv_id.satId, expected " - "203, is %d", - check_msg->stec_residuals[8].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[9].residual == 18376, - "incorrect value for stec_residuals[9].residual, expected 18376, is %d", - check_msg->stec_residuals[9].residual); - ck_assert_msg(check_msg->stec_residuals[9].sv_id.constellation == 13, - "incorrect value for stec_residuals[9].sv_id.constellation, " - "expected 13, is %d", - check_msg->stec_residuals[9].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[9].sv_id.satId == 42, - "incorrect value for stec_residuals[9].sv_id.satId, expected 42, is %d", - check_msg->stec_residuals[9].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[10].residual == -24357, - "incorrect value for stec_residuals[10].residual, expected " - "-24357, is %d", - check_msg->stec_residuals[10].residual); - ck_assert_msg(check_msg->stec_residuals[10].sv_id.constellation == 137, - "incorrect value for stec_residuals[10].sv_id.constellation, " - "expected 137, is %d", - check_msg->stec_residuals[10].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[10].sv_id.satId == 98, - "incorrect value for stec_residuals[10].sv_id.satId, " - "expected 98, is %d", - check_msg->stec_residuals[10].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[11].residual == -1441, - "incorrect value for stec_residuals[11].residual, expected " - "-1441, is %d", - check_msg->stec_residuals[11].residual); - ck_assert_msg(check_msg->stec_residuals[11].sv_id.constellation == 216, - "incorrect value for stec_residuals[11].sv_id.constellation, " - "expected 216, is %d", - check_msg->stec_residuals[11].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[11].sv_id.satId == 95, - "incorrect value for stec_residuals[11].sv_id.satId, " - "expected 95, is %d", - check_msg->stec_residuals[11].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[12].residual == -10660, - "incorrect value for stec_residuals[12].residual, expected " - "-10660, is %d", - check_msg->stec_residuals[12].residual); - ck_assert_msg(check_msg->stec_residuals[12].sv_id.constellation == 196, - "incorrect value for stec_residuals[12].sv_id.constellation, " - "expected 196, is %d", - check_msg->stec_residuals[12].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[12].sv_id.satId == 99, - "incorrect value for stec_residuals[12].sv_id.satId, " - "expected 99, is %d", - check_msg->stec_residuals[12].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[13].residual == -8509, - "incorrect value for stec_residuals[13].residual, expected " - "-8509, is %d", - check_msg->stec_residuals[13].residual); - ck_assert_msg(check_msg->stec_residuals[13].sv_id.constellation == 253, - "incorrect value for stec_residuals[13].sv_id.constellation, " - "expected 253, is %d", - check_msg->stec_residuals[13].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[13].sv_id.satId == 159, - "incorrect value for stec_residuals[13].sv_id.satId, " - "expected 159, is %d", - check_msg->stec_residuals[13].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[14].residual == 16361, - "incorrect value for stec_residuals[14].residual, expected " - "16361, is %d", - check_msg->stec_residuals[14].residual); - ck_assert_msg(check_msg->stec_residuals[14].sv_id.constellation == 146, - "incorrect value for stec_residuals[14].sv_id.constellation, " - "expected 146, is %d", - check_msg->stec_residuals[14].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[14].sv_id.satId == 233, - "incorrect value for stec_residuals[14].sv_id.satId, " - "expected 233, is %d", - check_msg->stec_residuals[14].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[15].residual == 10346, - "incorrect value for stec_residuals[15].residual, expected " - "10346, is %d", - check_msg->stec_residuals[15].residual); - ck_assert_msg(check_msg->stec_residuals[15].sv_id.constellation == 24, - "incorrect value for stec_residuals[15].sv_id.constellation, " - "expected 24, is %d", - check_msg->stec_residuals[15].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[15].sv_id.satId == 76, - "incorrect value for stec_residuals[15].sv_id.satId, " - "expected 76, is %d", - check_msg->stec_residuals[15].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[16].residual == -18679, - "incorrect value for stec_residuals[16].residual, expected " - "-18679, is %d", - check_msg->stec_residuals[16].residual); - ck_assert_msg(check_msg->stec_residuals[16].sv_id.constellation == 65, - "incorrect value for stec_residuals[16].sv_id.constellation, " - "expected 65, is %d", - check_msg->stec_residuals[16].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[16].sv_id.satId == 253, - "incorrect value for stec_residuals[16].sv_id.satId, " - "expected 253, is %d", - check_msg->stec_residuals[16].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[17].residual == 15292, - "incorrect value for stec_residuals[17].residual, expected " - "15292, is %d", - check_msg->stec_residuals[17].residual); - ck_assert_msg(check_msg->stec_residuals[17].sv_id.constellation == 215, - "incorrect value for stec_residuals[17].sv_id.constellation, " - "expected 215, is %d", - check_msg->stec_residuals[17].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[17].sv_id.satId == 40, - "incorrect value for stec_residuals[17].sv_id.satId, " - "expected 40, is %d", - check_msg->stec_residuals[17].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[18].residual == 29537, - "incorrect value for stec_residuals[18].residual, expected " - "29537, is %d", - check_msg->stec_residuals[18].residual); - ck_assert_msg(check_msg->stec_residuals[18].sv_id.constellation == 69, - "incorrect value for stec_residuals[18].sv_id.constellation, " - "expected 69, is %d", - check_msg->stec_residuals[18].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[18].sv_id.satId == 117, - "incorrect value for stec_residuals[18].sv_id.satId, " - "expected 117, is %d", - check_msg->stec_residuals[18].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[19].residual == -29440, - "incorrect value for stec_residuals[19].residual, expected " - "-29440, is %d", - check_msg->stec_residuals[19].residual); - ck_assert_msg(check_msg->stec_residuals[19].sv_id.constellation == 56, - "incorrect value for stec_residuals[19].sv_id.constellation, " - "expected 56, is %d", - check_msg->stec_residuals[19].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[19].sv_id.satId == 60, - "incorrect value for stec_residuals[19].sv_id.satId, " - "expected 60, is %d", - check_msg->stec_residuals[19].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[20].residual == -24266, - "incorrect value for stec_residuals[20].residual, expected " - "-24266, is %d", - check_msg->stec_residuals[20].residual); - ck_assert_msg(check_msg->stec_residuals[20].sv_id.constellation == 171, - "incorrect value for stec_residuals[20].sv_id.constellation, " - "expected 171, is %d", - check_msg->stec_residuals[20].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[20].sv_id.satId == 207, - "incorrect value for stec_residuals[20].sv_id.satId, " - "expected 207, is %d", - check_msg->stec_residuals[20].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[21].residual == 22272, - "incorrect value for stec_residuals[21].residual, expected " - "22272, is %d", - check_msg->stec_residuals[21].residual); - ck_assert_msg(check_msg->stec_residuals[21].sv_id.constellation == 61, - "incorrect value for stec_residuals[21].sv_id.constellation, " - "expected 61, is %d", - check_msg->stec_residuals[21].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[21].sv_id.satId == 23, - "incorrect value for stec_residuals[21].sv_id.satId, " - "expected 23, is %d", - check_msg->stec_residuals[21].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[22].residual == 9303, - "incorrect value for stec_residuals[22].residual, expected 9303, is %d", - check_msg->stec_residuals[22].residual); - ck_assert_msg(check_msg->stec_residuals[22].sv_id.constellation == 123, - "incorrect value for stec_residuals[22].sv_id.constellation, " - "expected 123, is %d", - check_msg->stec_residuals[22].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[22].sv_id.satId == 230, - "incorrect value for stec_residuals[22].sv_id.satId, " - "expected 230, is %d", - check_msg->stec_residuals[22].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[23].residual == -23794, - "incorrect value for stec_residuals[23].residual, expected " - "-23794, is %d", - check_msg->stec_residuals[23].residual); - ck_assert_msg(check_msg->stec_residuals[23].sv_id.constellation == 255, - "incorrect value for stec_residuals[23].sv_id.constellation, " - "expected 255, is %d", - check_msg->stec_residuals[23].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[23].sv_id.satId == 184, - "incorrect value for stec_residuals[23].sv_id.satId, " - "expected 184, is %d", - check_msg->stec_residuals[23].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[24].residual == -26837, - "incorrect value for stec_residuals[24].residual, expected " - "-26837, is %d", - check_msg->stec_residuals[24].residual); - ck_assert_msg(check_msg->stec_residuals[24].sv_id.constellation == 224, - "incorrect value for stec_residuals[24].sv_id.constellation, " - "expected 224, is %d", - check_msg->stec_residuals[24].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[24].sv_id.satId == 187, - "incorrect value for stec_residuals[24].sv_id.satId, " - "expected 187, is %d", - check_msg->stec_residuals[24].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[25].residual == 14631, - "incorrect value for stec_residuals[25].residual, expected " - "14631, is %d", - check_msg->stec_residuals[25].residual); - ck_assert_msg(check_msg->stec_residuals[25].sv_id.constellation == 104, - "incorrect value for stec_residuals[25].sv_id.constellation, " - "expected 104, is %d", - check_msg->stec_residuals[25].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[25].sv_id.satId == 151, - "incorrect value for stec_residuals[25].sv_id.satId, " - "expected 151, is %d", - check_msg->stec_residuals[25].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[26].residual == -8144, - "incorrect value for stec_residuals[26].residual, expected " - "-8144, is %d", - check_msg->stec_residuals[26].residual); - ck_assert_msg(check_msg->stec_residuals[26].sv_id.constellation == 54, - "incorrect value for stec_residuals[26].sv_id.constellation, " - "expected 54, is %d", - check_msg->stec_residuals[26].sv_id.constellation); - ck_assert_msg( - check_msg->stec_residuals[26].sv_id.satId == 5, - "incorrect value for stec_residuals[26].sv_id.satId, expected 5, is %d", - check_msg->stec_residuals[26].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[27].residual == 23612, - "incorrect value for stec_residuals[27].residual, expected " - "23612, is %d", - check_msg->stec_residuals[27].residual); - ck_assert_msg(check_msg->stec_residuals[27].sv_id.constellation == 129, - "incorrect value for stec_residuals[27].sv_id.constellation, " - "expected 129, is %d", - check_msg->stec_residuals[27].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[27].sv_id.satId == 181, - "incorrect value for stec_residuals[27].sv_id.satId, " - "expected 181, is %d", - check_msg->stec_residuals[27].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[28].residual == 28013, - "incorrect value for stec_residuals[28].residual, expected " - "28013, is %d", - check_msg->stec_residuals[28].residual); - ck_assert_msg(check_msg->stec_residuals[28].sv_id.constellation == 114, - "incorrect value for stec_residuals[28].sv_id.constellation, " - "expected 114, is %d", - check_msg->stec_residuals[28].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[28].sv_id.satId == 171, - "incorrect value for stec_residuals[28].sv_id.satId, " - "expected 171, is %d", - check_msg->stec_residuals[28].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[29].residual == 2166, - "incorrect value for stec_residuals[29].residual, expected 2166, is %d", - check_msg->stec_residuals[29].residual); - ck_assert_msg(check_msg->stec_residuals[29].sv_id.constellation == 23, - "incorrect value for stec_residuals[29].sv_id.constellation, " - "expected 23, is %d", - check_msg->stec_residuals[29].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[29].sv_id.satId == 12, - "incorrect value for stec_residuals[29].sv_id.satId, " - "expected 12, is %d", - check_msg->stec_residuals[29].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[30].residual == -10186, - "incorrect value for stec_residuals[30].residual, expected " - "-10186, is %d", - check_msg->stec_residuals[30].residual); - ck_assert_msg(check_msg->stec_residuals[30].sv_id.constellation == 159, - "incorrect value for stec_residuals[30].sv_id.constellation, " - "expected 159, is %d", - check_msg->stec_residuals[30].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[30].sv_id.satId == 64, - "incorrect value for stec_residuals[30].sv_id.satId, " - "expected 64, is %d", - check_msg->stec_residuals[30].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[31].residual == 17432, - "incorrect value for stec_residuals[31].residual, expected " - "17432, is %d", - check_msg->stec_residuals[31].residual); - ck_assert_msg(check_msg->stec_residuals[31].sv_id.constellation == 20, - "incorrect value for stec_residuals[31].sv_id.constellation, " - "expected 20, is %d", - check_msg->stec_residuals[31].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[31].sv_id.satId == 33, - "incorrect value for stec_residuals[31].sv_id.satId, " - "expected 33, is %d", - check_msg->stec_residuals[31].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[32].residual == -8666, - "incorrect value for stec_residuals[32].residual, expected " - "-8666, is %d", - check_msg->stec_residuals[32].residual); - ck_assert_msg(check_msg->stec_residuals[32].sv_id.constellation == 36, - "incorrect value for stec_residuals[32].sv_id.constellation, " - "expected 36, is %d", - check_msg->stec_residuals[32].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[32].sv_id.satId == 160, - "incorrect value for stec_residuals[32].sv_id.satId, " - "expected 160, is %d", - check_msg->stec_residuals[32].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[33].residual == 25436, - "incorrect value for stec_residuals[33].residual, expected " - "25436, is %d", - check_msg->stec_residuals[33].residual); - ck_assert_msg(check_msg->stec_residuals[33].sv_id.constellation == 190, - "incorrect value for stec_residuals[33].sv_id.constellation, " - "expected 190, is %d", - check_msg->stec_residuals[33].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[33].sv_id.satId == 145, - "incorrect value for stec_residuals[33].sv_id.satId, " - "expected 145, is %d", - check_msg->stec_residuals[33].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[34].residual == -3864, - "incorrect value for stec_residuals[34].residual, expected " - "-3864, is %d", - check_msg->stec_residuals[34].residual); - ck_assert_msg(check_msg->stec_residuals[34].sv_id.constellation == 159, - "incorrect value for stec_residuals[34].sv_id.constellation, " - "expected 159, is %d", - check_msg->stec_residuals[34].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[34].sv_id.satId == 108, - "incorrect value for stec_residuals[34].sv_id.satId, " - "expected 108, is %d", - check_msg->stec_residuals[34].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[35].residual == 4093, - "incorrect value for stec_residuals[35].residual, expected 4093, is %d", - check_msg->stec_residuals[35].residual); - ck_assert_msg(check_msg->stec_residuals[35].sv_id.constellation == 221, - "incorrect value for stec_residuals[35].sv_id.constellation, " - "expected 221, is %d", - check_msg->stec_residuals[35].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[35].sv_id.satId == 227, - "incorrect value for stec_residuals[35].sv_id.satId, " - "expected 227, is %d", - check_msg->stec_residuals[35].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[36].residual == -18055, - "incorrect value for stec_residuals[36].residual, expected " - "-18055, is %d", - check_msg->stec_residuals[36].residual); - ck_assert_msg(check_msg->stec_residuals[36].sv_id.constellation == 23, - "incorrect value for stec_residuals[36].sv_id.constellation, " - "expected 23, is %d", - check_msg->stec_residuals[36].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[36].sv_id.satId == 62, - "incorrect value for stec_residuals[36].sv_id.satId, " - "expected 62, is %d", - check_msg->stec_residuals[36].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[37].residual == -27900, - "incorrect value for stec_residuals[37].residual, expected " - "-27900, is %d", - check_msg->stec_residuals[37].residual); - ck_assert_msg(check_msg->stec_residuals[37].sv_id.constellation == 116, - "incorrect value for stec_residuals[37].sv_id.constellation, " - "expected 116, is %d", - check_msg->stec_residuals[37].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[37].sv_id.satId == 168, - "incorrect value for stec_residuals[37].sv_id.satId, " - "expected 168, is %d", - check_msg->stec_residuals[37].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[38].residual == 30687, - "incorrect value for stec_residuals[38].residual, expected " - "30687, is %d", - check_msg->stec_residuals[38].residual); - ck_assert_msg(check_msg->stec_residuals[38].sv_id.constellation == 72, - "incorrect value for stec_residuals[38].sv_id.constellation, " - "expected 72, is %d", - check_msg->stec_residuals[38].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[38].sv_id.satId == 123, - "incorrect value for stec_residuals[38].sv_id.satId, " - "expected 123, is %d", - check_msg->stec_residuals[38].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[39].residual == -13151, - "incorrect value for stec_residuals[39].residual, expected " - "-13151, is %d", - check_msg->stec_residuals[39].residual); - ck_assert_msg(check_msg->stec_residuals[39].sv_id.constellation == 242, - "incorrect value for stec_residuals[39].sv_id.constellation, " - "expected 242, is %d", - check_msg->stec_residuals[39].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[39].sv_id.satId == 226, - "incorrect value for stec_residuals[39].sv_id.satId, " - "expected 226, is %d", - check_msg->stec_residuals[39].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[40].residual == -22903, - "incorrect value for stec_residuals[40].residual, expected " - "-22903, is %d", - check_msg->stec_residuals[40].residual); - ck_assert_msg(check_msg->stec_residuals[40].sv_id.constellation == 202, - "incorrect value for stec_residuals[40].sv_id.constellation, " - "expected 202, is %d", - check_msg->stec_residuals[40].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[40].sv_id.satId == 180, - "incorrect value for stec_residuals[40].sv_id.satId, " - "expected 180, is %d", - check_msg->stec_residuals[40].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[41].residual == 4988, - "incorrect value for stec_residuals[41].residual, expected 4988, is %d", - check_msg->stec_residuals[41].residual); - ck_assert_msg(check_msg->stec_residuals[41].sv_id.constellation == 24, - "incorrect value for stec_residuals[41].sv_id.constellation, " - "expected 24, is %d", - check_msg->stec_residuals[41].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[41].sv_id.satId == 58, - "incorrect value for stec_residuals[41].sv_id.satId, " - "expected 58, is %d", - check_msg->stec_residuals[41].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[42].residual == 27408, - "incorrect value for stec_residuals[42].residual, expected " - "27408, is %d", - check_msg->stec_residuals[42].residual); - ck_assert_msg(check_msg->stec_residuals[42].sv_id.constellation == 188, - "incorrect value for stec_residuals[42].sv_id.constellation, " - "expected 188, is %d", - check_msg->stec_residuals[42].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[42].sv_id.satId == 181, - "incorrect value for stec_residuals[42].sv_id.satId, " - "expected 181, is %d", - check_msg->stec_residuals[42].sv_id.satId); - ck_assert_msg( - check_msg->stec_residuals[43].residual == 319, - "incorrect value for stec_residuals[43].residual, expected 319, is %d", - check_msg->stec_residuals[43].residual); - ck_assert_msg(check_msg->stec_residuals[43].sv_id.constellation == 231, - "incorrect value for stec_residuals[43].sv_id.constellation, " - "expected 231, is %d", - check_msg->stec_residuals[43].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[43].sv_id.satId == 66, - "incorrect value for stec_residuals[43].sv_id.satId, " - "expected 66, is %d", - check_msg->stec_residuals[43].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[44].residual == 15987, - "incorrect value for stec_residuals[44].residual, expected " - "15987, is %d", - check_msg->stec_residuals[44].residual); - ck_assert_msg(check_msg->stec_residuals[44].sv_id.constellation == 252, - "incorrect value for stec_residuals[44].sv_id.constellation, " - "expected 252, is %d", - check_msg->stec_residuals[44].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[44].sv_id.satId == 64, - "incorrect value for stec_residuals[44].sv_id.satId, " - "expected 64, is %d", - check_msg->stec_residuals[44].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[45].residual == 22266, - "incorrect value for stec_residuals[45].residual, expected " - "22266, is %d", - check_msg->stec_residuals[45].residual); - ck_assert_msg(check_msg->stec_residuals[45].sv_id.constellation == 97, - "incorrect value for stec_residuals[45].sv_id.constellation, " - "expected 97, is %d", - check_msg->stec_residuals[45].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[45].sv_id.satId == 233, - "incorrect value for stec_residuals[45].sv_id.satId, " - "expected 233, is %d", - check_msg->stec_residuals[45].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[46].residual == -19919, - "incorrect value for stec_residuals[46].residual, expected " - "-19919, is %d", - check_msg->stec_residuals[46].residual); - ck_assert_msg(check_msg->stec_residuals[46].sv_id.constellation == 221, - "incorrect value for stec_residuals[46].sv_id.constellation, " - "expected 221, is %d", - check_msg->stec_residuals[46].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[46].sv_id.satId == 156, - "incorrect value for stec_residuals[46].sv_id.satId, " - "expected 156, is %d", - check_msg->stec_residuals[46].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[47].residual == 17350, - "incorrect value for stec_residuals[47].residual, expected " - "17350, is %d", - check_msg->stec_residuals[47].residual); - ck_assert_msg(check_msg->stec_residuals[47].sv_id.constellation == 73, - "incorrect value for stec_residuals[47].sv_id.constellation, " - "expected 73, is %d", - check_msg->stec_residuals[47].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[47].sv_id.satId == 32, - "incorrect value for stec_residuals[47].sv_id.satId, " - "expected 32, is %d", - check_msg->stec_residuals[47].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[48].residual == 14410, - "incorrect value for stec_residuals[48].residual, expected " - "14410, is %d", - check_msg->stec_residuals[48].residual); - ck_assert_msg(check_msg->stec_residuals[48].sv_id.constellation == 253, - "incorrect value for stec_residuals[48].sv_id.constellation, " - "expected 253, is %d", - check_msg->stec_residuals[48].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[48].sv_id.satId == 249, - "incorrect value for stec_residuals[48].sv_id.satId, " - "expected 249, is %d", - check_msg->stec_residuals[48].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[49].residual == 23671, - "incorrect value for stec_residuals[49].residual, expected " - "23671, is %d", - check_msg->stec_residuals[49].residual); - ck_assert_msg(check_msg->stec_residuals[49].sv_id.constellation == 165, - "incorrect value for stec_residuals[49].sv_id.constellation, " - "expected 165, is %d", - check_msg->stec_residuals[49].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[49].sv_id.satId == 38, - "incorrect value for stec_residuals[49].sv_id.satId, " - "expected 38, is %d", - check_msg->stec_residuals[49].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[50].residual == -31905, - "incorrect value for stec_residuals[50].residual, expected " - "-31905, is %d", - check_msg->stec_residuals[50].residual); - ck_assert_msg(check_msg->stec_residuals[50].sv_id.constellation == 44, - "incorrect value for stec_residuals[50].sv_id.constellation, " - "expected 44, is %d", - check_msg->stec_residuals[50].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[50].sv_id.satId == 99, - "incorrect value for stec_residuals[50].sv_id.satId, " - "expected 99, is %d", - check_msg->stec_residuals[50].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[51].residual == 14305, - "incorrect value for stec_residuals[51].residual, expected " - "14305, is %d", - check_msg->stec_residuals[51].residual); - ck_assert_msg(check_msg->stec_residuals[51].sv_id.constellation == 192, - "incorrect value for stec_residuals[51].sv_id.constellation, " - "expected 192, is %d", - check_msg->stec_residuals[51].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[51].sv_id.satId == 89, - "incorrect value for stec_residuals[51].sv_id.satId, " - "expected 89, is %d", - check_msg->stec_residuals[51].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[52].residual == -12968, - "incorrect value for stec_residuals[52].residual, expected " - "-12968, is %d", - check_msg->stec_residuals[52].residual); - ck_assert_msg(check_msg->stec_residuals[52].sv_id.constellation == 171, - "incorrect value for stec_residuals[52].sv_id.constellation, " - "expected 171, is %d", - check_msg->stec_residuals[52].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[52].sv_id.satId == 95, - "incorrect value for stec_residuals[52].sv_id.satId, " - "expected 95, is %d", - check_msg->stec_residuals[52].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[53].residual == 21479, - "incorrect value for stec_residuals[53].residual, expected " - "21479, is %d", - check_msg->stec_residuals[53].residual); - ck_assert_msg(check_msg->stec_residuals[53].sv_id.constellation == 116, - "incorrect value for stec_residuals[53].sv_id.constellation, " - "expected 116, is %d", - check_msg->stec_residuals[53].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[53].sv_id.satId == 21, - "incorrect value for stec_residuals[53].sv_id.satId, " - "expected 21, is %d", - check_msg->stec_residuals[53].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[54].residual == 28260, - "incorrect value for stec_residuals[54].residual, expected " - "28260, is %d", - check_msg->stec_residuals[54].residual); - ck_assert_msg(check_msg->stec_residuals[54].sv_id.constellation == 71, - "incorrect value for stec_residuals[54].sv_id.constellation, " - "expected 71, is %d", - check_msg->stec_residuals[54].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[54].sv_id.satId == 71, - "incorrect value for stec_residuals[54].sv_id.satId, " - "expected 71, is %d", - check_msg->stec_residuals[54].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[55].residual == -11112, - "incorrect value for stec_residuals[55].residual, expected " - "-11112, is %d", - check_msg->stec_residuals[55].residual); - ck_assert_msg(check_msg->stec_residuals[55].sv_id.constellation == 254, - "incorrect value for stec_residuals[55].sv_id.constellation, " - "expected 254, is %d", - check_msg->stec_residuals[55].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[55].sv_id.satId == 217, - "incorrect value for stec_residuals[55].sv_id.satId, " - "expected 217, is %d", - check_msg->stec_residuals[55].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[56].residual == -25304, - "incorrect value for stec_residuals[56].residual, expected " - "-25304, is %d", - check_msg->stec_residuals[56].residual); - ck_assert_msg(check_msg->stec_residuals[56].sv_id.constellation == 8, - "incorrect value for stec_residuals[56].sv_id.constellation, " - "expected 8, is %d", - check_msg->stec_residuals[56].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[56].sv_id.satId == 18, - "incorrect value for stec_residuals[56].sv_id.satId, " - "expected 18, is %d", - check_msg->stec_residuals[56].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[57].residual == -4024, - "incorrect value for stec_residuals[57].residual, expected " - "-4024, is %d", - check_msg->stec_residuals[57].residual); - ck_assert_msg(check_msg->stec_residuals[57].sv_id.constellation == 54, - "incorrect value for stec_residuals[57].sv_id.constellation, " - "expected 54, is %d", - check_msg->stec_residuals[57].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[57].sv_id.satId == 244, - "incorrect value for stec_residuals[57].sv_id.satId, " - "expected 244, is %d", - check_msg->stec_residuals[57].sv_id.satId); - ck_assert_msg(check_msg->stec_residuals[58].residual == -15505, - "incorrect value for stec_residuals[58].residual, expected " - "-15505, is %d", - check_msg->stec_residuals[58].residual); - ck_assert_msg(check_msg->stec_residuals[58].sv_id.constellation == 189, - "incorrect value for stec_residuals[58].sv_id.constellation, " - "expected 189, is %d", - check_msg->stec_residuals[58].sv_id.constellation); - ck_assert_msg(check_msg->stec_residuals[58].sv_id.satId == 231, - "incorrect value for stec_residuals[58].sv_id.satId, " - "expected 231, is %d", - check_msg->stec_residuals[58].sv_id.satId); - ck_assert_msg(check_msg->tropo_delay_correction.hydro == 16250, - "incorrect value for tropo_delay_correction.hydro, expected " - "16250, is %d", - check_msg->tropo_delay_correction.hydro); - ck_assert_msg( - check_msg->tropo_delay_correction.wet == 101, - "incorrect value for tropo_delay_correction.wet, expected 101, is %d", - check_msg->tropo_delay_correction.wet); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionNoStdDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionNoStdDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_" - "MsgSsrGriddedCorrectionNoStdDepA"); - tcase_add_test( - tc_acq, test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionNoStdDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrOrbitClock.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrOrbitClock.c deleted file mode 100644 index 17fb6d5001..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrOrbitClock.c +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrOrbitClock.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClock) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x5dd, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x5dd, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 221, 5, 53, 229, 50, 83, 208, 102, 207, 164, 29, - 203, 212, 236, 255, 152, 233, 207, 55, 94, 54, 58, 128, - 68, 27, 117, 176, 110, 251, 61, 244, 122, 50, 95, 52, - 144, 232, 24, 10, 37, 127, 163, 66, 177, 105, 156, 245, - 10, 249, 107, 218, 17, 186, 56, 72, 14, 22, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_orbit_clock_t *test_msg = (msg_ssr_orbit_clock_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->along = -1334502588; - test_msg->c0 = -174298703; - test_msg->c1 = -630458102; - test_msg->c2 = 1211677201; - test_msg->cross = -197264530; - test_msg->dot_along = 169404560; - test_msg->dot_cross = 1118011173; - test_msg->dot_radial = 878654074; - test_msg->iod = 936372632; - test_msg->iod_ssr = 255; - test_msg->radial = -2143668642; - test_msg->sid.code = 212; - test_msg->sid.sat = 203; - test_msg->time.tow = 3479621715; - test_msg->time.wn = 7588; - test_msg->update_interval = 236; - sbp_payload_send(&sbp_state, 0x5dd, 58677, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 58677, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 58677, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x5dd, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_orbit_clock_t *check_msg = - (msg_ssr_orbit_clock_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->along == -1334502588, - "incorrect value for along, expected -1334502588, is %d", - check_msg->along); - ck_assert_msg(check_msg->c0 == -174298703, - "incorrect value for c0, expected -174298703, is %d", - check_msg->c0); - ck_assert_msg(check_msg->c1 == -630458102, - "incorrect value for c1, expected -630458102, is %d", - check_msg->c1); - ck_assert_msg(check_msg->c2 == 1211677201, - "incorrect value for c2, expected 1211677201, is %d", - check_msg->c2); - ck_assert_msg(check_msg->cross == -197264530, - "incorrect value for cross, expected -197264530, is %d", - check_msg->cross); - ck_assert_msg(check_msg->dot_along == 169404560, - "incorrect value for dot_along, expected 169404560, is %d", - check_msg->dot_along); - ck_assert_msg(check_msg->dot_cross == 1118011173, - "incorrect value for dot_cross, expected 1118011173, is %d", - check_msg->dot_cross); - ck_assert_msg(check_msg->dot_radial == 878654074, - "incorrect value for dot_radial, expected 878654074, is %d", - check_msg->dot_radial); - ck_assert_msg(check_msg->iod == 936372632, - "incorrect value for iod, expected 936372632, is %d", - check_msg->iod); - ck_assert_msg(check_msg->iod_ssr == 255, - "incorrect value for iod_ssr, expected 255, is %d", - check_msg->iod_ssr); - ck_assert_msg(check_msg->radial == -2143668642, - "incorrect value for radial, expected -2143668642, is %d", - check_msg->radial); - ck_assert_msg(check_msg->sid.code == 212, - "incorrect value for sid.code, expected 212, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.sat == 203, - "incorrect value for sid.sat, expected 203, is %d", - check_msg->sid.sat); - ck_assert_msg(check_msg->time.tow == 3479621715, - "incorrect value for time.tow, expected 3479621715, is %d", - check_msg->time.tow); - ck_assert_msg(check_msg->time.wn == 7588, - "incorrect value for time.wn, expected 7588, is %d", - check_msg->time.wn); - ck_assert_msg(check_msg->update_interval == 236, - "incorrect value for update_interval, expected 236, is %d", - check_msg->update_interval); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrOrbitClock_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_ssr_MsgSsrOrbitClock"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_MsgSsrOrbitClock"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClock); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrOrbitClockBounds.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrOrbitClockBounds.c deleted file mode 100644 index 3253cd18fc..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrOrbitClockBounds.c +++ /dev/null @@ -1,363 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrOrbitClockBounds.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBounds) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 1502, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 1502, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 222, 5, 66, 0, 31, 180, 0, 0, 0, 3, 0, 1, - 2, 3, 48, 15, 1, 2, 24, 39, 38, 37, 1, 2, 3, - 39, 1, 3, 39, 38, 37, 1, 2, 3, 39, 1, 21, 85, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_orbit_clock_bounds_t *test_msg = - (msg_ssr_orbit_clock_bounds_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->const_id = 1; - test_msg->header.num_msgs = 1; - test_msg->header.seq_num = 2; - test_msg->header.sol_id = 48; - test_msg->header.time.tow = 180; - test_msg->header.time.wn = 3; - test_msg->header.update_interval = 3; - test_msg->n_sats = 2; - if (sizeof(test_msg->orbit_clock_bounds) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->orbit_clock_bounds[0]); - } - test_msg->orbit_clock_bounds[0].clock_bound_mu = 39; - test_msg->orbit_clock_bounds[0].clock_bound_sig = 1; - test_msg->orbit_clock_bounds[0].orb_along_bound_mu = 38; - test_msg->orbit_clock_bounds[0].orb_along_bound_sig = 2; - test_msg->orbit_clock_bounds[0].orb_cross_bound_mu = 37; - test_msg->orbit_clock_bounds[0].orb_cross_bound_sig = 3; - test_msg->orbit_clock_bounds[0].orb_radial_bound_mu = 39; - test_msg->orbit_clock_bounds[0].orb_radial_bound_sig = 1; - test_msg->orbit_clock_bounds[0].sat_id = 24; - if (sizeof(test_msg->orbit_clock_bounds) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->orbit_clock_bounds[0]); - } - test_msg->orbit_clock_bounds[1].clock_bound_mu = 39; - test_msg->orbit_clock_bounds[1].clock_bound_sig = 1; - test_msg->orbit_clock_bounds[1].orb_along_bound_mu = 38; - test_msg->orbit_clock_bounds[1].orb_along_bound_sig = 2; - test_msg->orbit_clock_bounds[1].orb_cross_bound_mu = 37; - test_msg->orbit_clock_bounds[1].orb_cross_bound_sig = 3; - test_msg->orbit_clock_bounds[1].orb_radial_bound_mu = 39; - test_msg->orbit_clock_bounds[1].orb_radial_bound_sig = 1; - test_msg->orbit_clock_bounds[1].sat_id = 3; - test_msg->ssr_iod = 15; - sbp_payload_send(&sbp_state, 1502, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 1502, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_orbit_clock_bounds_t *check_msg = - (msg_ssr_orbit_clock_bounds_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->const_id == 1, - "incorrect value for const_id, expected 1, is %d", - check_msg->const_id); - ck_assert_msg(check_msg->header.num_msgs == 1, - "incorrect value for header.num_msgs, expected 1, is %d", - check_msg->header.num_msgs); - ck_assert_msg(check_msg->header.seq_num == 2, - "incorrect value for header.seq_num, expected 2, is %d", - check_msg->header.seq_num); - ck_assert_msg(check_msg->header.sol_id == 48, - "incorrect value for header.sol_id, expected 48, is %d", - check_msg->header.sol_id); - ck_assert_msg(check_msg->header.time.tow == 180, - "incorrect value for header.time.tow, expected 180, is %d", - check_msg->header.time.tow); - ck_assert_msg(check_msg->header.time.wn == 3, - "incorrect value for header.time.wn, expected 3, is %d", - check_msg->header.time.wn); - ck_assert_msg( - check_msg->header.update_interval == 3, - "incorrect value for header.update_interval, expected 3, is %d", - check_msg->header.update_interval); - ck_assert_msg(check_msg->n_sats == 2, - "incorrect value for n_sats, expected 2, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->orbit_clock_bounds[0].clock_bound_mu == 39, - "incorrect value for orbit_clock_bounds[0].clock_bound_mu, " - "expected 39, is %d", - check_msg->orbit_clock_bounds[0].clock_bound_mu); - ck_assert_msg(check_msg->orbit_clock_bounds[0].clock_bound_sig == 1, - "incorrect value for orbit_clock_bounds[0].clock_bound_sig, " - "expected 1, is %d", - check_msg->orbit_clock_bounds[0].clock_bound_sig); - ck_assert_msg( - check_msg->orbit_clock_bounds[0].orb_along_bound_mu == 38, - "incorrect value for orbit_clock_bounds[0].orb_along_bound_mu, " - "expected 38, is %d", - check_msg->orbit_clock_bounds[0].orb_along_bound_mu); - ck_assert_msg( - check_msg->orbit_clock_bounds[0].orb_along_bound_sig == 2, - "incorrect value for orbit_clock_bounds[0].orb_along_bound_sig, " - "expected 2, is %d", - check_msg->orbit_clock_bounds[0].orb_along_bound_sig); - ck_assert_msg( - check_msg->orbit_clock_bounds[0].orb_cross_bound_mu == 37, - "incorrect value for orbit_clock_bounds[0].orb_cross_bound_mu, " - "expected 37, is %d", - check_msg->orbit_clock_bounds[0].orb_cross_bound_mu); - ck_assert_msg( - check_msg->orbit_clock_bounds[0].orb_cross_bound_sig == 3, - "incorrect value for orbit_clock_bounds[0].orb_cross_bound_sig, " - "expected 3, is %d", - check_msg->orbit_clock_bounds[0].orb_cross_bound_sig); - ck_assert_msg( - check_msg->orbit_clock_bounds[0].orb_radial_bound_mu == 39, - "incorrect value for orbit_clock_bounds[0].orb_radial_bound_mu, " - "expected 39, is %d", - check_msg->orbit_clock_bounds[0].orb_radial_bound_mu); - ck_assert_msg( - check_msg->orbit_clock_bounds[0].orb_radial_bound_sig == 1, - "incorrect value for orbit_clock_bounds[0].orb_radial_bound_sig, " - "expected 1, is %d", - check_msg->orbit_clock_bounds[0].orb_radial_bound_sig); - ck_assert_msg( - check_msg->orbit_clock_bounds[0].sat_id == 24, - "incorrect value for orbit_clock_bounds[0].sat_id, expected 24, is %d", - check_msg->orbit_clock_bounds[0].sat_id); - ck_assert_msg(check_msg->orbit_clock_bounds[1].clock_bound_mu == 39, - "incorrect value for orbit_clock_bounds[1].clock_bound_mu, " - "expected 39, is %d", - check_msg->orbit_clock_bounds[1].clock_bound_mu); - ck_assert_msg(check_msg->orbit_clock_bounds[1].clock_bound_sig == 1, - "incorrect value for orbit_clock_bounds[1].clock_bound_sig, " - "expected 1, is %d", - check_msg->orbit_clock_bounds[1].clock_bound_sig); - ck_assert_msg( - check_msg->orbit_clock_bounds[1].orb_along_bound_mu == 38, - "incorrect value for orbit_clock_bounds[1].orb_along_bound_mu, " - "expected 38, is %d", - check_msg->orbit_clock_bounds[1].orb_along_bound_mu); - ck_assert_msg( - check_msg->orbit_clock_bounds[1].orb_along_bound_sig == 2, - "incorrect value for orbit_clock_bounds[1].orb_along_bound_sig, " - "expected 2, is %d", - check_msg->orbit_clock_bounds[1].orb_along_bound_sig); - ck_assert_msg( - check_msg->orbit_clock_bounds[1].orb_cross_bound_mu == 37, - "incorrect value for orbit_clock_bounds[1].orb_cross_bound_mu, " - "expected 37, is %d", - check_msg->orbit_clock_bounds[1].orb_cross_bound_mu); - ck_assert_msg( - check_msg->orbit_clock_bounds[1].orb_cross_bound_sig == 3, - "incorrect value for orbit_clock_bounds[1].orb_cross_bound_sig, " - "expected 3, is %d", - check_msg->orbit_clock_bounds[1].orb_cross_bound_sig); - ck_assert_msg( - check_msg->orbit_clock_bounds[1].orb_radial_bound_mu == 39, - "incorrect value for orbit_clock_bounds[1].orb_radial_bound_mu, " - "expected 39, is %d", - check_msg->orbit_clock_bounds[1].orb_radial_bound_mu); - ck_assert_msg( - check_msg->orbit_clock_bounds[1].orb_radial_bound_sig == 1, - "incorrect value for orbit_clock_bounds[1].orb_radial_bound_sig, " - "expected 1, is %d", - check_msg->orbit_clock_bounds[1].orb_radial_bound_sig); - ck_assert_msg( - check_msg->orbit_clock_bounds[1].sat_id == 3, - "incorrect value for orbit_clock_bounds[1].sat_id, expected 3, is %d", - check_msg->orbit_clock_bounds[1].sat_id); - ck_assert_msg(check_msg->ssr_iod == 15, - "incorrect value for ssr_iod, expected 15, is %d", - check_msg->ssr_iod); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBounds_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBounds"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBounds"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBounds); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrOrbitClockBoundsDegradation.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrOrbitClockBoundsDegradation.c deleted file mode 100644 index 74c56fd7b0..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrOrbitClockBoundsDegradation.c +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrOrbitClockBoundsDegradation.yaml -// by generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBoundsDegradation) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 1503, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 1503, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 223, 5, 66, 0, 28, 180, 0, 0, 0, 3, 0, - 1, 2, 3, 48, 15, 1, 10, 0, 0, 0, 0, 0, - 0, 0, 200, 199, 198, 197, 196, 195, 194, 193, 200, 117, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_orbit_clock_bounds_degradation_t *test_msg = - (msg_ssr_orbit_clock_bounds_degradation_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->const_id = 1; - test_msg->header.num_msgs = 1; - test_msg->header.seq_num = 2; - test_msg->header.sol_id = 48; - test_msg->header.time.tow = 180; - test_msg->header.time.wn = 3; - test_msg->header.update_interval = 3; - test_msg->orbit_clock_bounds_degradation.clock_bound_mu_dot = 194; - test_msg->orbit_clock_bounds_degradation.clock_bound_sig_dot = 193; - test_msg->orbit_clock_bounds_degradation.orb_along_bound_mu_dot = 199; - test_msg->orbit_clock_bounds_degradation.orb_along_bound_sig_dot = 196; - test_msg->orbit_clock_bounds_degradation.orb_cross_bound_mu_dot = 198; - test_msg->orbit_clock_bounds_degradation.orb_cross_bound_sig_dot = 195; - test_msg->orbit_clock_bounds_degradation.orb_radial_bound_mu_dot = 200; - test_msg->orbit_clock_bounds_degradation.orb_radial_bound_sig_dot = 197; - test_msg->sat_bitmask = 10; - test_msg->ssr_iod = 15; - sbp_payload_send(&sbp_state, 1503, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 1503, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_orbit_clock_bounds_degradation_t *check_msg = - (msg_ssr_orbit_clock_bounds_degradation_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->const_id == 1, - "incorrect value for const_id, expected 1, is %d", - check_msg->const_id); - ck_assert_msg(check_msg->header.num_msgs == 1, - "incorrect value for header.num_msgs, expected 1, is %d", - check_msg->header.num_msgs); - ck_assert_msg(check_msg->header.seq_num == 2, - "incorrect value for header.seq_num, expected 2, is %d", - check_msg->header.seq_num); - ck_assert_msg(check_msg->header.sol_id == 48, - "incorrect value for header.sol_id, expected 48, is %d", - check_msg->header.sol_id); - ck_assert_msg(check_msg->header.time.tow == 180, - "incorrect value for header.time.tow, expected 180, is %d", - check_msg->header.time.tow); - ck_assert_msg(check_msg->header.time.wn == 3, - "incorrect value for header.time.wn, expected 3, is %d", - check_msg->header.time.wn); - ck_assert_msg( - check_msg->header.update_interval == 3, - "incorrect value for header.update_interval, expected 3, is %d", - check_msg->header.update_interval); - ck_assert_msg( - check_msg->orbit_clock_bounds_degradation.clock_bound_mu_dot == 194, - "incorrect value for " - "orbit_clock_bounds_degradation.clock_bound_mu_dot, expected 194, is " - "%d", - check_msg->orbit_clock_bounds_degradation.clock_bound_mu_dot); - ck_assert_msg( - check_msg->orbit_clock_bounds_degradation.clock_bound_sig_dot == 193, - "incorrect value for " - "orbit_clock_bounds_degradation.clock_bound_sig_dot, expected 193, is " - "%d", - check_msg->orbit_clock_bounds_degradation.clock_bound_sig_dot); - ck_assert_msg( - check_msg->orbit_clock_bounds_degradation.orb_along_bound_mu_dot == 199, - "incorrect value for " - "orbit_clock_bounds_degradation.orb_along_bound_mu_dot, expected 199, " - "is %d", - check_msg->orbit_clock_bounds_degradation.orb_along_bound_mu_dot); - ck_assert_msg( - check_msg->orbit_clock_bounds_degradation.orb_along_bound_sig_dot == - 196, - "incorrect value for " - "orbit_clock_bounds_degradation.orb_along_bound_sig_dot, expected 196, " - "is %d", - check_msg->orbit_clock_bounds_degradation.orb_along_bound_sig_dot); - ck_assert_msg( - check_msg->orbit_clock_bounds_degradation.orb_cross_bound_mu_dot == 198, - "incorrect value for " - "orbit_clock_bounds_degradation.orb_cross_bound_mu_dot, expected 198, " - "is %d", - check_msg->orbit_clock_bounds_degradation.orb_cross_bound_mu_dot); - ck_assert_msg( - check_msg->orbit_clock_bounds_degradation.orb_cross_bound_sig_dot == - 195, - "incorrect value for " - "orbit_clock_bounds_degradation.orb_cross_bound_sig_dot, expected 195, " - "is %d", - check_msg->orbit_clock_bounds_degradation.orb_cross_bound_sig_dot); - ck_assert_msg( - check_msg->orbit_clock_bounds_degradation.orb_radial_bound_mu_dot == - 200, - "incorrect value for " - "orbit_clock_bounds_degradation.orb_radial_bound_mu_dot, expected 200, " - "is %d", - check_msg->orbit_clock_bounds_degradation.orb_radial_bound_mu_dot); - ck_assert_msg( - check_msg->orbit_clock_bounds_degradation.orb_radial_bound_sig_dot == - 197, - "incorrect value for " - "orbit_clock_bounds_degradation.orb_radial_bound_sig_dot, expected " - "197, is %d", - check_msg->orbit_clock_bounds_degradation.orb_radial_bound_sig_dot); - ck_assert_msg(check_msg->sat_bitmask == 10, - "incorrect value for sat_bitmask, expected 10, is %d", - check_msg->sat_bitmask); - ck_assert_msg(check_msg->ssr_iod == 15, - "incorrect value for ssr_iod, expected 15, is %d", - check_msg->ssr_iod); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBoundsDegradation_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBoundsDegradation"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_" - "MsgSsrOrbitClockBoundsDegradation"); - tcase_add_test( - tc_acq, test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBoundsDegradation); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrOrbitClockDepA.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrOrbitClockDepA.c deleted file mode 100644 index d85b2b4c15..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrOrbitClockDepA.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrOrbitClockDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClockDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x5dc, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x5dc, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 220, 5, 33, 166, 47, 225, 114, 31, 189, 43, 30, 1, 30, - 194, 211, 193, 175, 161, 143, 254, 56, 63, 232, 7, 216, 69, 1, - 110, 165, 124, 196, 189, 27, 116, 88, 4, 61, 3, 151, 18, 171, - 147, 46, 198, 85, 243, 245, 225, 235, 123, 181, 210, 157, 252, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_orbit_clock_dep_a_t *test_msg = - (msg_ssr_orbit_clock_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->along = 132661048; - test_msg->c0 = -970026069; - test_msg->c1 = -503975083; - test_msg->c2 = -759858197; - test_msg->cross = 1845577176; - test_msg->dot_along = 72905755; - test_msg->dot_cross = 311886653; - test_msg->dot_radial = -1111196507; - test_msg->iod = 193; - test_msg->iod_ssr = 211; - test_msg->radial = -24141393; - test_msg->sid.code = 30; - test_msg->sid.sat = 1; - test_msg->time.tow = 3172954849; - test_msg->time.wn = 7723; - test_msg->update_interval = 194; - sbp_payload_send(&sbp_state, 0x5dc, 42529, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 42529, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 42529, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x5dc, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_orbit_clock_dep_a_t *check_msg = - (msg_ssr_orbit_clock_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->along == 132661048, - "incorrect value for along, expected 132661048, is %d", - check_msg->along); - ck_assert_msg(check_msg->c0 == -970026069, - "incorrect value for c0, expected -970026069, is %d", - check_msg->c0); - ck_assert_msg(check_msg->c1 == -503975083, - "incorrect value for c1, expected -503975083, is %d", - check_msg->c1); - ck_assert_msg(check_msg->c2 == -759858197, - "incorrect value for c2, expected -759858197, is %d", - check_msg->c2); - ck_assert_msg(check_msg->cross == 1845577176, - "incorrect value for cross, expected 1845577176, is %d", - check_msg->cross); - ck_assert_msg(check_msg->dot_along == 72905755, - "incorrect value for dot_along, expected 72905755, is %d", - check_msg->dot_along); - ck_assert_msg(check_msg->dot_cross == 311886653, - "incorrect value for dot_cross, expected 311886653, is %d", - check_msg->dot_cross); - ck_assert_msg(check_msg->dot_radial == -1111196507, - "incorrect value for dot_radial, expected -1111196507, is %d", - check_msg->dot_radial); - ck_assert_msg(check_msg->iod == 193, - "incorrect value for iod, expected 193, is %d", - check_msg->iod); - ck_assert_msg(check_msg->iod_ssr == 211, - "incorrect value for iod_ssr, expected 211, is %d", - check_msg->iod_ssr); - ck_assert_msg(check_msg->radial == -24141393, - "incorrect value for radial, expected -24141393, is %d", - check_msg->radial); - ck_assert_msg(check_msg->sid.code == 30, - "incorrect value for sid.code, expected 30, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.sat == 1, - "incorrect value for sid.sat, expected 1, is %d", - check_msg->sid.sat); - ck_assert_msg(check_msg->time.tow == 3172954849, - "incorrect value for time.tow, expected 3172954849, is %d", - check_msg->time.tow); - ck_assert_msg(check_msg->time.wn == 7723, - "incorrect value for time.wn, expected 7723, is %d", - check_msg->time.wn); - ck_assert_msg(check_msg->update_interval == 194, - "incorrect value for update_interval, expected 194, is %d", - check_msg->update_interval); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrOrbitClockDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_ssr_MsgSsrOrbitClockDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_MsgSsrOrbitClockDepA"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClockDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrPhaseBiases.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrPhaseBiases.c deleted file mode 100644 index 8d4ed9935f..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrPhaseBiases.c +++ /dev/null @@ -1,1111 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrPhaseBiases.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrPhaseBiases) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x5e6, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x5e6, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 230, 5, 219, 206, 255, 209, 154, 144, 12, 213, 164, 169, 82, - 177, 230, 98, 209, 249, 22, 17, 29, 250, 245, 193, 219, 30, 212, - 177, 207, 187, 33, 146, 58, 204, 164, 65, 114, 49, 248, 52, 8, - 161, 44, 252, 166, 168, 232, 124, 134, 86, 173, 241, 174, 44, 142, - 155, 129, 143, 184, 161, 211, 15, 36, 189, 208, 194, 221, 152, 16, - 203, 87, 34, 188, 141, 104, 189, 102, 156, 252, 22, 251, 136, 49, - 188, 157, 222, 245, 49, 132, 16, 34, 142, 228, 85, 139, 221, 197, - 235, 98, 74, 107, 70, 36, 38, 239, 251, 112, 188, 124, 246, 141, - 164, 150, 104, 7, 213, 44, 21, 244, 192, 4, 143, 24, 42, 21, - 84, 136, 7, 42, 118, 45, 23, 174, 175, 129, 54, 169, 14, 213, - 2, 197, 98, 60, 13, 207, 105, 100, 129, 72, 136, 240, 140, 129, - 9, 114, 172, 151, 150, 17, 210, 127, 115, 151, 3, 242, 254, 215, - 14, 5, 34, 126, 2, 215, 65, 38, 176, 23, 210, 201, 97, 36, - 207, 92, 224, 26, 116, 155, 211, 165, 47, 102, 38, 67, 199, 55, - 117, 36, 169, 33, 1, 230, 201, 183, 21, 42, 62, 147, 173, 173, - 155, 98, 146, 231, 167, 138, 82, 167, 127, 229, 1, 2, 127, 237, - 207, 116, 90, 115, 159, 3, 42, 66, 145, 250, 201, 7, 251, 2, - 75, 230, 26, 213, 181, 56, 64, 97, 88, 255, 6, 147, 16, 89, - 203, 27, 68, 243, 230, 55, 242, 167, 169, 219, 240, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_phase_biases_t *test_msg = - (msg_ssr_phase_biases_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[0].bias = -1311498533; - test_msg->biases[0].code = 29; - test_msg->biases[0].discontinuity_counter = 193; - test_msg->biases[0].integer_indicator = 250; - test_msg->biases[0].widelane_integer_indicator = 245; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[1].bias = 1101319226; - test_msg->biases[1].code = 207; - test_msg->biases[1].discontinuity_counter = 146; - test_msg->biases[1].integer_indicator = 187; - test_msg->biases[1].widelane_integer_indicator = 33; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[2].bias = -64184056; - test_msg->biases[2].code = 114; - test_msg->biases[2].discontinuity_counter = 52; - test_msg->biases[2].integer_indicator = 49; - test_msg->biases[2].widelane_integer_indicator = 248; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[3].bias = -240298362; - test_msg->biases[3].code = 166; - test_msg->biases[3].discontinuity_counter = 124; - test_msg->biases[3].integer_indicator = 168; - test_msg->biases[3].widelane_integer_indicator = 232; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[4].bias = -1581740159; - test_msg->biases[4].code = 174; - test_msg->biases[4].discontinuity_counter = 155; - test_msg->biases[4].integer_indicator = 44; - test_msg->biases[4].widelane_integer_indicator = 142; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[5].bias = -1730297136; - test_msg->biases[5].code = 211; - test_msg->biases[5].discontinuity_counter = 189; - test_msg->biases[5].integer_indicator = 15; - test_msg->biases[5].widelane_integer_indicator = 36; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[6].bias = -1117221444; - test_msg->biases[6].code = 16; - test_msg->biases[6].discontinuity_counter = 34; - test_msg->biases[6].integer_indicator = 203; - test_msg->biases[6].widelane_integer_indicator = 87; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[7].bias = -1137604357; - test_msg->biases[7].code = 102; - test_msg->biases[7].discontinuity_counter = 22; - test_msg->biases[7].integer_indicator = 156; - test_msg->biases[7].widelane_integer_indicator = 252; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[8].bias = -1910370172; - test_msg->biases[8].code = 157; - test_msg->biases[8].discontinuity_counter = 49; - test_msg->biases[8].integer_indicator = 222; - test_msg->biases[8].widelane_integer_indicator = 245; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[9].bias = 1247996869; - test_msg->biases[9].code = 228; - test_msg->biases[9].discontinuity_counter = 221; - test_msg->biases[9].integer_indicator = 85; - test_msg->biases[9].widelane_integer_indicator = 139; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[10].bias = -1133446161; - test_msg->biases[10].code = 107; - test_msg->biases[10].discontinuity_counter = 38; - test_msg->biases[10].integer_indicator = 70; - test_msg->biases[10].widelane_integer_indicator = 36; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[11].bias = -720934762; - test_msg->biases[11].code = 124; - test_msg->biases[11].discontinuity_counter = 164; - test_msg->biases[11].integer_indicator = 246; - test_msg->biases[11].widelane_integer_indicator = 141; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[12].bias = 706252548; - test_msg->biases[12].code = 44; - test_msg->biases[12].discontinuity_counter = 192; - test_msg->biases[12].integer_indicator = 21; - test_msg->biases[12].widelane_integer_indicator = 244; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[13].bias = 388855338; - test_msg->biases[13].code = 21; - test_msg->biases[13].discontinuity_counter = 7; - test_msg->biases[13].integer_indicator = 84; - test_msg->biases[13].widelane_integer_indicator = 136; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[14].bias = 47517353; - test_msg->biases[14].code = 174; - test_msg->biases[14].discontinuity_counter = 54; - test_msg->biases[14].integer_indicator = 175; - test_msg->biases[14].widelane_integer_indicator = 129; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[15].bias = -2124125745; - test_msg->biases[15].code = 197; - test_msg->biases[15].discontinuity_counter = 13; - test_msg->biases[15].integer_indicator = 98; - test_msg->biases[15].widelane_integer_indicator = 60; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[16].bias = -1401812607; - test_msg->biases[16].code = 72; - test_msg->biases[16].discontinuity_counter = 140; - test_msg->biases[16].integer_indicator = 136; - test_msg->biases[16].widelane_integer_indicator = 240; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[17].bias = 60257151; - test_msg->biases[17].code = 151; - test_msg->biases[17].discontinuity_counter = 210; - test_msg->biases[17].integer_indicator = 150; - test_msg->biases[17].widelane_integer_indicator = 17; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[18].bias = 41820677; - test_msg->biases[18].code = 242; - test_msg->biases[18].discontinuity_counter = 14; - test_msg->biases[18].integer_indicator = 254; - test_msg->biases[18].widelane_integer_indicator = 215; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[19].bias = 1640616471; - test_msg->biases[19].code = 215; - test_msg->biases[19].discontinuity_counter = 176; - test_msg->biases[19].integer_indicator = 65; - test_msg->biases[19].widelane_integer_indicator = 38; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[20].bias = -744786918; - test_msg->biases[20].code = 36; - test_msg->biases[20].discontinuity_counter = 224; - test_msg->biases[20].integer_indicator = 207; - test_msg->biases[20].widelane_integer_indicator = 92; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[21].bias = 1966589763; - test_msg->biases[21].code = 165; - test_msg->biases[21].discontinuity_counter = 38; - test_msg->biases[21].integer_indicator = 47; - test_msg->biases[21].widelane_integer_indicator = 102; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[22].bias = 364366310; - test_msg->biases[22].code = 36; - test_msg->biases[22].discontinuity_counter = 1; - test_msg->biases[22].integer_indicator = 169; - test_msg->biases[22].widelane_integer_indicator = 33; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[23].bias = -1839031379; - test_msg->biases[23].code = 42; - test_msg->biases[23].discontinuity_counter = 173; - test_msg->biases[23].integer_indicator = 62; - test_msg->biases[23].widelane_integer_indicator = 147; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[24].bias = 31817639; - test_msg->biases[24].code = 231; - test_msg->biases[24].discontinuity_counter = 82; - test_msg->biases[24].integer_indicator = 167; - test_msg->biases[24].widelane_integer_indicator = 138; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[25].bias = -1619830156; - test_msg->biases[25].code = 2; - test_msg->biases[25].discontinuity_counter = 207; - test_msg->biases[25].integer_indicator = 127; - test_msg->biases[25].widelane_integer_indicator = 237; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[26].bias = -83375622; - test_msg->biases[26].code = 3; - test_msg->biases[26].discontinuity_counter = 145; - test_msg->biases[26].integer_indicator = 42; - test_msg->biases[26].widelane_integer_indicator = 66; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[27].bias = 1077458389; - test_msg->biases[27].code = 2; - test_msg->biases[27].discontinuity_counter = 26; - test_msg->biases[27].integer_indicator = 75; - test_msg->biases[27].widelane_integer_indicator = 230; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[28].bias = -883355501; - test_msg->biases[28].code = 97; - test_msg->biases[28].discontinuity_counter = 6; - test_msg->biases[28].integer_indicator = 88; - test_msg->biases[28].widelane_integer_indicator = 255; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->biases[0]); - } - test_msg->biases[29].bias = -1448611273; - test_msg->biases[29].code = 27; - test_msg->biases[29].discontinuity_counter = 230; - test_msg->biases[29].integer_indicator = 68; - test_msg->biases[29].widelane_integer_indicator = 243; - test_msg->dispersive_bias = 98; - test_msg->iod_ssr = 230; - test_msg->mw_consistency = 209; - test_msg->sid.code = 82; - test_msg->sid.sat = 169; - test_msg->time.tow = 210803409; - test_msg->time.wn = 42197; - test_msg->update_interval = 177; - test_msg->yaw = 5881; - test_msg->yaw_rate = 17; - sbp_payload_send(&sbp_state, 0x5e6, 52955, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 52955, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 52955, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x5e6, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_phase_biases_t *check_msg = - (msg_ssr_phase_biases_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - check_msg->biases[0].bias == -1311498533, - "incorrect value for biases[0].bias, expected -1311498533, is %d", - check_msg->biases[0].bias); - ck_assert_msg(check_msg->biases[0].code == 29, - "incorrect value for biases[0].code, expected 29, is %d", - check_msg->biases[0].code); - ck_assert_msg(check_msg->biases[0].discontinuity_counter == 193, - "incorrect value for biases[0].discontinuity_counter, " - "expected 193, is %d", - check_msg->biases[0].discontinuity_counter); - ck_assert_msg( - check_msg->biases[0].integer_indicator == 250, - "incorrect value for biases[0].integer_indicator, expected 250, is %d", - check_msg->biases[0].integer_indicator); - ck_assert_msg(check_msg->biases[0].widelane_integer_indicator == 245, - "incorrect value for biases[0].widelane_integer_indicator, " - "expected 245, is %d", - check_msg->biases[0].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[1].bias == 1101319226, - "incorrect value for biases[1].bias, expected 1101319226, is %d", - check_msg->biases[1].bias); - ck_assert_msg(check_msg->biases[1].code == 207, - "incorrect value for biases[1].code, expected 207, is %d", - check_msg->biases[1].code); - ck_assert_msg(check_msg->biases[1].discontinuity_counter == 146, - "incorrect value for biases[1].discontinuity_counter, " - "expected 146, is %d", - check_msg->biases[1].discontinuity_counter); - ck_assert_msg( - check_msg->biases[1].integer_indicator == 187, - "incorrect value for biases[1].integer_indicator, expected 187, is %d", - check_msg->biases[1].integer_indicator); - ck_assert_msg(check_msg->biases[1].widelane_integer_indicator == 33, - "incorrect value for biases[1].widelane_integer_indicator, " - "expected 33, is %d", - check_msg->biases[1].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[2].bias == -64184056, - "incorrect value for biases[2].bias, expected -64184056, is %d", - check_msg->biases[2].bias); - ck_assert_msg(check_msg->biases[2].code == 114, - "incorrect value for biases[2].code, expected 114, is %d", - check_msg->biases[2].code); - ck_assert_msg(check_msg->biases[2].discontinuity_counter == 52, - "incorrect value for biases[2].discontinuity_counter, " - "expected 52, is %d", - check_msg->biases[2].discontinuity_counter); - ck_assert_msg( - check_msg->biases[2].integer_indicator == 49, - "incorrect value for biases[2].integer_indicator, expected 49, is %d", - check_msg->biases[2].integer_indicator); - ck_assert_msg(check_msg->biases[2].widelane_integer_indicator == 248, - "incorrect value for biases[2].widelane_integer_indicator, " - "expected 248, is %d", - check_msg->biases[2].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[3].bias == -240298362, - "incorrect value for biases[3].bias, expected -240298362, is %d", - check_msg->biases[3].bias); - ck_assert_msg(check_msg->biases[3].code == 166, - "incorrect value for biases[3].code, expected 166, is %d", - check_msg->biases[3].code); - ck_assert_msg(check_msg->biases[3].discontinuity_counter == 124, - "incorrect value for biases[3].discontinuity_counter, " - "expected 124, is %d", - check_msg->biases[3].discontinuity_counter); - ck_assert_msg( - check_msg->biases[3].integer_indicator == 168, - "incorrect value for biases[3].integer_indicator, expected 168, is %d", - check_msg->biases[3].integer_indicator); - ck_assert_msg(check_msg->biases[3].widelane_integer_indicator == 232, - "incorrect value for biases[3].widelane_integer_indicator, " - "expected 232, is %d", - check_msg->biases[3].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[4].bias == -1581740159, - "incorrect value for biases[4].bias, expected -1581740159, is %d", - check_msg->biases[4].bias); - ck_assert_msg(check_msg->biases[4].code == 174, - "incorrect value for biases[4].code, expected 174, is %d", - check_msg->biases[4].code); - ck_assert_msg(check_msg->biases[4].discontinuity_counter == 155, - "incorrect value for biases[4].discontinuity_counter, " - "expected 155, is %d", - check_msg->biases[4].discontinuity_counter); - ck_assert_msg( - check_msg->biases[4].integer_indicator == 44, - "incorrect value for biases[4].integer_indicator, expected 44, is %d", - check_msg->biases[4].integer_indicator); - ck_assert_msg(check_msg->biases[4].widelane_integer_indicator == 142, - "incorrect value for biases[4].widelane_integer_indicator, " - "expected 142, is %d", - check_msg->biases[4].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[5].bias == -1730297136, - "incorrect value for biases[5].bias, expected -1730297136, is %d", - check_msg->biases[5].bias); - ck_assert_msg(check_msg->biases[5].code == 211, - "incorrect value for biases[5].code, expected 211, is %d", - check_msg->biases[5].code); - ck_assert_msg(check_msg->biases[5].discontinuity_counter == 189, - "incorrect value for biases[5].discontinuity_counter, " - "expected 189, is %d", - check_msg->biases[5].discontinuity_counter); - ck_assert_msg( - check_msg->biases[5].integer_indicator == 15, - "incorrect value for biases[5].integer_indicator, expected 15, is %d", - check_msg->biases[5].integer_indicator); - ck_assert_msg(check_msg->biases[5].widelane_integer_indicator == 36, - "incorrect value for biases[5].widelane_integer_indicator, " - "expected 36, is %d", - check_msg->biases[5].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[6].bias == -1117221444, - "incorrect value for biases[6].bias, expected -1117221444, is %d", - check_msg->biases[6].bias); - ck_assert_msg(check_msg->biases[6].code == 16, - "incorrect value for biases[6].code, expected 16, is %d", - check_msg->biases[6].code); - ck_assert_msg(check_msg->biases[6].discontinuity_counter == 34, - "incorrect value for biases[6].discontinuity_counter, " - "expected 34, is %d", - check_msg->biases[6].discontinuity_counter); - ck_assert_msg( - check_msg->biases[6].integer_indicator == 203, - "incorrect value for biases[6].integer_indicator, expected 203, is %d", - check_msg->biases[6].integer_indicator); - ck_assert_msg(check_msg->biases[6].widelane_integer_indicator == 87, - "incorrect value for biases[6].widelane_integer_indicator, " - "expected 87, is %d", - check_msg->biases[6].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[7].bias == -1137604357, - "incorrect value for biases[7].bias, expected -1137604357, is %d", - check_msg->biases[7].bias); - ck_assert_msg(check_msg->biases[7].code == 102, - "incorrect value for biases[7].code, expected 102, is %d", - check_msg->biases[7].code); - ck_assert_msg(check_msg->biases[7].discontinuity_counter == 22, - "incorrect value for biases[7].discontinuity_counter, " - "expected 22, is %d", - check_msg->biases[7].discontinuity_counter); - ck_assert_msg( - check_msg->biases[7].integer_indicator == 156, - "incorrect value for biases[7].integer_indicator, expected 156, is %d", - check_msg->biases[7].integer_indicator); - ck_assert_msg(check_msg->biases[7].widelane_integer_indicator == 252, - "incorrect value for biases[7].widelane_integer_indicator, " - "expected 252, is %d", - check_msg->biases[7].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[8].bias == -1910370172, - "incorrect value for biases[8].bias, expected -1910370172, is %d", - check_msg->biases[8].bias); - ck_assert_msg(check_msg->biases[8].code == 157, - "incorrect value for biases[8].code, expected 157, is %d", - check_msg->biases[8].code); - ck_assert_msg(check_msg->biases[8].discontinuity_counter == 49, - "incorrect value for biases[8].discontinuity_counter, " - "expected 49, is %d", - check_msg->biases[8].discontinuity_counter); - ck_assert_msg( - check_msg->biases[8].integer_indicator == 222, - "incorrect value for biases[8].integer_indicator, expected 222, is %d", - check_msg->biases[8].integer_indicator); - ck_assert_msg(check_msg->biases[8].widelane_integer_indicator == 245, - "incorrect value for biases[8].widelane_integer_indicator, " - "expected 245, is %d", - check_msg->biases[8].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[9].bias == 1247996869, - "incorrect value for biases[9].bias, expected 1247996869, is %d", - check_msg->biases[9].bias); - ck_assert_msg(check_msg->biases[9].code == 228, - "incorrect value for biases[9].code, expected 228, is %d", - check_msg->biases[9].code); - ck_assert_msg(check_msg->biases[9].discontinuity_counter == 221, - "incorrect value for biases[9].discontinuity_counter, " - "expected 221, is %d", - check_msg->biases[9].discontinuity_counter); - ck_assert_msg( - check_msg->biases[9].integer_indicator == 85, - "incorrect value for biases[9].integer_indicator, expected 85, is %d", - check_msg->biases[9].integer_indicator); - ck_assert_msg(check_msg->biases[9].widelane_integer_indicator == 139, - "incorrect value for biases[9].widelane_integer_indicator, " - "expected 139, is %d", - check_msg->biases[9].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[10].bias == -1133446161, - "incorrect value for biases[10].bias, expected -1133446161, is %d", - check_msg->biases[10].bias); - ck_assert_msg(check_msg->biases[10].code == 107, - "incorrect value for biases[10].code, expected 107, is %d", - check_msg->biases[10].code); - ck_assert_msg(check_msg->biases[10].discontinuity_counter == 38, - "incorrect value for biases[10].discontinuity_counter, " - "expected 38, is %d", - check_msg->biases[10].discontinuity_counter); - ck_assert_msg( - check_msg->biases[10].integer_indicator == 70, - "incorrect value for biases[10].integer_indicator, expected 70, is %d", - check_msg->biases[10].integer_indicator); - ck_assert_msg(check_msg->biases[10].widelane_integer_indicator == 36, - "incorrect value for biases[10].widelane_integer_indicator, " - "expected 36, is %d", - check_msg->biases[10].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[11].bias == -720934762, - "incorrect value for biases[11].bias, expected -720934762, is %d", - check_msg->biases[11].bias); - ck_assert_msg(check_msg->biases[11].code == 124, - "incorrect value for biases[11].code, expected 124, is %d", - check_msg->biases[11].code); - ck_assert_msg(check_msg->biases[11].discontinuity_counter == 164, - "incorrect value for biases[11].discontinuity_counter, " - "expected 164, is %d", - check_msg->biases[11].discontinuity_counter); - ck_assert_msg( - check_msg->biases[11].integer_indicator == 246, - "incorrect value for biases[11].integer_indicator, expected 246, is %d", - check_msg->biases[11].integer_indicator); - ck_assert_msg(check_msg->biases[11].widelane_integer_indicator == 141, - "incorrect value for biases[11].widelane_integer_indicator, " - "expected 141, is %d", - check_msg->biases[11].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[12].bias == 706252548, - "incorrect value for biases[12].bias, expected 706252548, is %d", - check_msg->biases[12].bias); - ck_assert_msg(check_msg->biases[12].code == 44, - "incorrect value for biases[12].code, expected 44, is %d", - check_msg->biases[12].code); - ck_assert_msg(check_msg->biases[12].discontinuity_counter == 192, - "incorrect value for biases[12].discontinuity_counter, " - "expected 192, is %d", - check_msg->biases[12].discontinuity_counter); - ck_assert_msg( - check_msg->biases[12].integer_indicator == 21, - "incorrect value for biases[12].integer_indicator, expected 21, is %d", - check_msg->biases[12].integer_indicator); - ck_assert_msg(check_msg->biases[12].widelane_integer_indicator == 244, - "incorrect value for biases[12].widelane_integer_indicator, " - "expected 244, is %d", - check_msg->biases[12].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[13].bias == 388855338, - "incorrect value for biases[13].bias, expected 388855338, is %d", - check_msg->biases[13].bias); - ck_assert_msg(check_msg->biases[13].code == 21, - "incorrect value for biases[13].code, expected 21, is %d", - check_msg->biases[13].code); - ck_assert_msg(check_msg->biases[13].discontinuity_counter == 7, - "incorrect value for biases[13].discontinuity_counter, " - "expected 7, is %d", - check_msg->biases[13].discontinuity_counter); - ck_assert_msg( - check_msg->biases[13].integer_indicator == 84, - "incorrect value for biases[13].integer_indicator, expected 84, is %d", - check_msg->biases[13].integer_indicator); - ck_assert_msg(check_msg->biases[13].widelane_integer_indicator == 136, - "incorrect value for biases[13].widelane_integer_indicator, " - "expected 136, is %d", - check_msg->biases[13].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[14].bias == 47517353, - "incorrect value for biases[14].bias, expected 47517353, is %d", - check_msg->biases[14].bias); - ck_assert_msg(check_msg->biases[14].code == 174, - "incorrect value for biases[14].code, expected 174, is %d", - check_msg->biases[14].code); - ck_assert_msg(check_msg->biases[14].discontinuity_counter == 54, - "incorrect value for biases[14].discontinuity_counter, " - "expected 54, is %d", - check_msg->biases[14].discontinuity_counter); - ck_assert_msg( - check_msg->biases[14].integer_indicator == 175, - "incorrect value for biases[14].integer_indicator, expected 175, is %d", - check_msg->biases[14].integer_indicator); - ck_assert_msg(check_msg->biases[14].widelane_integer_indicator == 129, - "incorrect value for biases[14].widelane_integer_indicator, " - "expected 129, is %d", - check_msg->biases[14].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[15].bias == -2124125745, - "incorrect value for biases[15].bias, expected -2124125745, is %d", - check_msg->biases[15].bias); - ck_assert_msg(check_msg->biases[15].code == 197, - "incorrect value for biases[15].code, expected 197, is %d", - check_msg->biases[15].code); - ck_assert_msg(check_msg->biases[15].discontinuity_counter == 13, - "incorrect value for biases[15].discontinuity_counter, " - "expected 13, is %d", - check_msg->biases[15].discontinuity_counter); - ck_assert_msg( - check_msg->biases[15].integer_indicator == 98, - "incorrect value for biases[15].integer_indicator, expected 98, is %d", - check_msg->biases[15].integer_indicator); - ck_assert_msg(check_msg->biases[15].widelane_integer_indicator == 60, - "incorrect value for biases[15].widelane_integer_indicator, " - "expected 60, is %d", - check_msg->biases[15].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[16].bias == -1401812607, - "incorrect value for biases[16].bias, expected -1401812607, is %d", - check_msg->biases[16].bias); - ck_assert_msg(check_msg->biases[16].code == 72, - "incorrect value for biases[16].code, expected 72, is %d", - check_msg->biases[16].code); - ck_assert_msg(check_msg->biases[16].discontinuity_counter == 140, - "incorrect value for biases[16].discontinuity_counter, " - "expected 140, is %d", - check_msg->biases[16].discontinuity_counter); - ck_assert_msg( - check_msg->biases[16].integer_indicator == 136, - "incorrect value for biases[16].integer_indicator, expected 136, is %d", - check_msg->biases[16].integer_indicator); - ck_assert_msg(check_msg->biases[16].widelane_integer_indicator == 240, - "incorrect value for biases[16].widelane_integer_indicator, " - "expected 240, is %d", - check_msg->biases[16].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[17].bias == 60257151, - "incorrect value for biases[17].bias, expected 60257151, is %d", - check_msg->biases[17].bias); - ck_assert_msg(check_msg->biases[17].code == 151, - "incorrect value for biases[17].code, expected 151, is %d", - check_msg->biases[17].code); - ck_assert_msg(check_msg->biases[17].discontinuity_counter == 210, - "incorrect value for biases[17].discontinuity_counter, " - "expected 210, is %d", - check_msg->biases[17].discontinuity_counter); - ck_assert_msg( - check_msg->biases[17].integer_indicator == 150, - "incorrect value for biases[17].integer_indicator, expected 150, is %d", - check_msg->biases[17].integer_indicator); - ck_assert_msg(check_msg->biases[17].widelane_integer_indicator == 17, - "incorrect value for biases[17].widelane_integer_indicator, " - "expected 17, is %d", - check_msg->biases[17].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[18].bias == 41820677, - "incorrect value for biases[18].bias, expected 41820677, is %d", - check_msg->biases[18].bias); - ck_assert_msg(check_msg->biases[18].code == 242, - "incorrect value for biases[18].code, expected 242, is %d", - check_msg->biases[18].code); - ck_assert_msg(check_msg->biases[18].discontinuity_counter == 14, - "incorrect value for biases[18].discontinuity_counter, " - "expected 14, is %d", - check_msg->biases[18].discontinuity_counter); - ck_assert_msg( - check_msg->biases[18].integer_indicator == 254, - "incorrect value for biases[18].integer_indicator, expected 254, is %d", - check_msg->biases[18].integer_indicator); - ck_assert_msg(check_msg->biases[18].widelane_integer_indicator == 215, - "incorrect value for biases[18].widelane_integer_indicator, " - "expected 215, is %d", - check_msg->biases[18].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[19].bias == 1640616471, - "incorrect value for biases[19].bias, expected 1640616471, is %d", - check_msg->biases[19].bias); - ck_assert_msg(check_msg->biases[19].code == 215, - "incorrect value for biases[19].code, expected 215, is %d", - check_msg->biases[19].code); - ck_assert_msg(check_msg->biases[19].discontinuity_counter == 176, - "incorrect value for biases[19].discontinuity_counter, " - "expected 176, is %d", - check_msg->biases[19].discontinuity_counter); - ck_assert_msg( - check_msg->biases[19].integer_indicator == 65, - "incorrect value for biases[19].integer_indicator, expected 65, is %d", - check_msg->biases[19].integer_indicator); - ck_assert_msg(check_msg->biases[19].widelane_integer_indicator == 38, - "incorrect value for biases[19].widelane_integer_indicator, " - "expected 38, is %d", - check_msg->biases[19].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[20].bias == -744786918, - "incorrect value for biases[20].bias, expected -744786918, is %d", - check_msg->biases[20].bias); - ck_assert_msg(check_msg->biases[20].code == 36, - "incorrect value for biases[20].code, expected 36, is %d", - check_msg->biases[20].code); - ck_assert_msg(check_msg->biases[20].discontinuity_counter == 224, - "incorrect value for biases[20].discontinuity_counter, " - "expected 224, is %d", - check_msg->biases[20].discontinuity_counter); - ck_assert_msg( - check_msg->biases[20].integer_indicator == 207, - "incorrect value for biases[20].integer_indicator, expected 207, is %d", - check_msg->biases[20].integer_indicator); - ck_assert_msg(check_msg->biases[20].widelane_integer_indicator == 92, - "incorrect value for biases[20].widelane_integer_indicator, " - "expected 92, is %d", - check_msg->biases[20].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[21].bias == 1966589763, - "incorrect value for biases[21].bias, expected 1966589763, is %d", - check_msg->biases[21].bias); - ck_assert_msg(check_msg->biases[21].code == 165, - "incorrect value for biases[21].code, expected 165, is %d", - check_msg->biases[21].code); - ck_assert_msg(check_msg->biases[21].discontinuity_counter == 38, - "incorrect value for biases[21].discontinuity_counter, " - "expected 38, is %d", - check_msg->biases[21].discontinuity_counter); - ck_assert_msg( - check_msg->biases[21].integer_indicator == 47, - "incorrect value for biases[21].integer_indicator, expected 47, is %d", - check_msg->biases[21].integer_indicator); - ck_assert_msg(check_msg->biases[21].widelane_integer_indicator == 102, - "incorrect value for biases[21].widelane_integer_indicator, " - "expected 102, is %d", - check_msg->biases[21].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[22].bias == 364366310, - "incorrect value for biases[22].bias, expected 364366310, is %d", - check_msg->biases[22].bias); - ck_assert_msg(check_msg->biases[22].code == 36, - "incorrect value for biases[22].code, expected 36, is %d", - check_msg->biases[22].code); - ck_assert_msg(check_msg->biases[22].discontinuity_counter == 1, - "incorrect value for biases[22].discontinuity_counter, " - "expected 1, is %d", - check_msg->biases[22].discontinuity_counter); - ck_assert_msg( - check_msg->biases[22].integer_indicator == 169, - "incorrect value for biases[22].integer_indicator, expected 169, is %d", - check_msg->biases[22].integer_indicator); - ck_assert_msg(check_msg->biases[22].widelane_integer_indicator == 33, - "incorrect value for biases[22].widelane_integer_indicator, " - "expected 33, is %d", - check_msg->biases[22].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[23].bias == -1839031379, - "incorrect value for biases[23].bias, expected -1839031379, is %d", - check_msg->biases[23].bias); - ck_assert_msg(check_msg->biases[23].code == 42, - "incorrect value for biases[23].code, expected 42, is %d", - check_msg->biases[23].code); - ck_assert_msg(check_msg->biases[23].discontinuity_counter == 173, - "incorrect value for biases[23].discontinuity_counter, " - "expected 173, is %d", - check_msg->biases[23].discontinuity_counter); - ck_assert_msg( - check_msg->biases[23].integer_indicator == 62, - "incorrect value for biases[23].integer_indicator, expected 62, is %d", - check_msg->biases[23].integer_indicator); - ck_assert_msg(check_msg->biases[23].widelane_integer_indicator == 147, - "incorrect value for biases[23].widelane_integer_indicator, " - "expected 147, is %d", - check_msg->biases[23].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[24].bias == 31817639, - "incorrect value for biases[24].bias, expected 31817639, is %d", - check_msg->biases[24].bias); - ck_assert_msg(check_msg->biases[24].code == 231, - "incorrect value for biases[24].code, expected 231, is %d", - check_msg->biases[24].code); - ck_assert_msg(check_msg->biases[24].discontinuity_counter == 82, - "incorrect value for biases[24].discontinuity_counter, " - "expected 82, is %d", - check_msg->biases[24].discontinuity_counter); - ck_assert_msg( - check_msg->biases[24].integer_indicator == 167, - "incorrect value for biases[24].integer_indicator, expected 167, is %d", - check_msg->biases[24].integer_indicator); - ck_assert_msg(check_msg->biases[24].widelane_integer_indicator == 138, - "incorrect value for biases[24].widelane_integer_indicator, " - "expected 138, is %d", - check_msg->biases[24].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[25].bias == -1619830156, - "incorrect value for biases[25].bias, expected -1619830156, is %d", - check_msg->biases[25].bias); - ck_assert_msg(check_msg->biases[25].code == 2, - "incorrect value for biases[25].code, expected 2, is %d", - check_msg->biases[25].code); - ck_assert_msg(check_msg->biases[25].discontinuity_counter == 207, - "incorrect value for biases[25].discontinuity_counter, " - "expected 207, is %d", - check_msg->biases[25].discontinuity_counter); - ck_assert_msg( - check_msg->biases[25].integer_indicator == 127, - "incorrect value for biases[25].integer_indicator, expected 127, is %d", - check_msg->biases[25].integer_indicator); - ck_assert_msg(check_msg->biases[25].widelane_integer_indicator == 237, - "incorrect value for biases[25].widelane_integer_indicator, " - "expected 237, is %d", - check_msg->biases[25].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[26].bias == -83375622, - "incorrect value for biases[26].bias, expected -83375622, is %d", - check_msg->biases[26].bias); - ck_assert_msg(check_msg->biases[26].code == 3, - "incorrect value for biases[26].code, expected 3, is %d", - check_msg->biases[26].code); - ck_assert_msg(check_msg->biases[26].discontinuity_counter == 145, - "incorrect value for biases[26].discontinuity_counter, " - "expected 145, is %d", - check_msg->biases[26].discontinuity_counter); - ck_assert_msg( - check_msg->biases[26].integer_indicator == 42, - "incorrect value for biases[26].integer_indicator, expected 42, is %d", - check_msg->biases[26].integer_indicator); - ck_assert_msg(check_msg->biases[26].widelane_integer_indicator == 66, - "incorrect value for biases[26].widelane_integer_indicator, " - "expected 66, is %d", - check_msg->biases[26].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[27].bias == 1077458389, - "incorrect value for biases[27].bias, expected 1077458389, is %d", - check_msg->biases[27].bias); - ck_assert_msg(check_msg->biases[27].code == 2, - "incorrect value for biases[27].code, expected 2, is %d", - check_msg->biases[27].code); - ck_assert_msg(check_msg->biases[27].discontinuity_counter == 26, - "incorrect value for biases[27].discontinuity_counter, " - "expected 26, is %d", - check_msg->biases[27].discontinuity_counter); - ck_assert_msg( - check_msg->biases[27].integer_indicator == 75, - "incorrect value for biases[27].integer_indicator, expected 75, is %d", - check_msg->biases[27].integer_indicator); - ck_assert_msg(check_msg->biases[27].widelane_integer_indicator == 230, - "incorrect value for biases[27].widelane_integer_indicator, " - "expected 230, is %d", - check_msg->biases[27].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[28].bias == -883355501, - "incorrect value for biases[28].bias, expected -883355501, is %d", - check_msg->biases[28].bias); - ck_assert_msg(check_msg->biases[28].code == 97, - "incorrect value for biases[28].code, expected 97, is %d", - check_msg->biases[28].code); - ck_assert_msg(check_msg->biases[28].discontinuity_counter == 6, - "incorrect value for biases[28].discontinuity_counter, " - "expected 6, is %d", - check_msg->biases[28].discontinuity_counter); - ck_assert_msg( - check_msg->biases[28].integer_indicator == 88, - "incorrect value for biases[28].integer_indicator, expected 88, is %d", - check_msg->biases[28].integer_indicator); - ck_assert_msg(check_msg->biases[28].widelane_integer_indicator == 255, - "incorrect value for biases[28].widelane_integer_indicator, " - "expected 255, is %d", - check_msg->biases[28].widelane_integer_indicator); - ck_assert_msg( - check_msg->biases[29].bias == -1448611273, - "incorrect value for biases[29].bias, expected -1448611273, is %d", - check_msg->biases[29].bias); - ck_assert_msg(check_msg->biases[29].code == 27, - "incorrect value for biases[29].code, expected 27, is %d", - check_msg->biases[29].code); - ck_assert_msg(check_msg->biases[29].discontinuity_counter == 230, - "incorrect value for biases[29].discontinuity_counter, " - "expected 230, is %d", - check_msg->biases[29].discontinuity_counter); - ck_assert_msg( - check_msg->biases[29].integer_indicator == 68, - "incorrect value for biases[29].integer_indicator, expected 68, is %d", - check_msg->biases[29].integer_indicator); - ck_assert_msg(check_msg->biases[29].widelane_integer_indicator == 243, - "incorrect value for biases[29].widelane_integer_indicator, " - "expected 243, is %d", - check_msg->biases[29].widelane_integer_indicator); - ck_assert_msg(check_msg->dispersive_bias == 98, - "incorrect value for dispersive_bias, expected 98, is %d", - check_msg->dispersive_bias); - ck_assert_msg(check_msg->iod_ssr == 230, - "incorrect value for iod_ssr, expected 230, is %d", - check_msg->iod_ssr); - ck_assert_msg(check_msg->mw_consistency == 209, - "incorrect value for mw_consistency, expected 209, is %d", - check_msg->mw_consistency); - ck_assert_msg(check_msg->sid.code == 82, - "incorrect value for sid.code, expected 82, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.sat == 169, - "incorrect value for sid.sat, expected 169, is %d", - check_msg->sid.sat); - ck_assert_msg(check_msg->time.tow == 210803409, - "incorrect value for time.tow, expected 210803409, is %d", - check_msg->time.tow); - ck_assert_msg(check_msg->time.wn == 42197, - "incorrect value for time.wn, expected 42197, is %d", - check_msg->time.wn); - ck_assert_msg(check_msg->update_interval == 177, - "incorrect value for update_interval, expected 177, is %d", - check_msg->update_interval); - ck_assert_msg(check_msg->yaw == 5881, - "incorrect value for yaw, expected 5881, is %d", - check_msg->yaw); - ck_assert_msg(check_msg->yaw_rate == 17, - "incorrect value for yaw_rate, expected 17, is %d", - check_msg->yaw_rate); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrPhaseBiases_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_ssr_MsgSsrPhaseBiases"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_MsgSsrPhaseBiases"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_ssr_MsgSsrPhaseBiases); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrSatelliteApc.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrSatelliteApc.c deleted file mode 100644 index c8c0535b7b..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrSatelliteApc.c +++ /dev/null @@ -1,448 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrSatelliteApc.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrSatelliteApc) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x605, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x605, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 5, 6, 0, 0, 41, 127, 58, 9, 0, 174, 8, 1, - 2, 3, 2, 0, 4, 61, 0, 1, 0, 255, 255, 217, 2, - 11, 10, 8, 5, 1, 252, 248, 246, 246, 246, 249, 252, 0, - 6, 12, 22, 30, 41, 41, 41, 41, 144, 161, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_satellite_apc_t *test_msg = - (msg_ssr_satellite_apc_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->apc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0]); - } - if (sizeof(test_msg->apc[0].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pco[0]); - } - test_msg->apc[0].pco[0] = 1; - if (sizeof(test_msg->apc[0].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pco[0]); - } - test_msg->apc[0].pco[1] = -1; - if (sizeof(test_msg->apc[0].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pco[0]); - } - test_msg->apc[0].pco[2] = 729; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[0] = 11; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[1] = 10; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[2] = 8; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[3] = 5; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[4] = 1; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[5] = -4; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[6] = -8; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[7] = -10; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[8] = -10; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[9] = -10; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[10] = -7; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[11] = -4; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[12] = 0; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[13] = 6; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[14] = 12; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[15] = 22; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[16] = 30; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[17] = 41; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[18] = 41; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[19] = 41; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[20] = 41; - test_msg->apc[0].sat_info = 4; - test_msg->apc[0].sid.code = 0; - test_msg->apc[0].sid.sat = 2; - test_msg->apc[0].svn = 61; - test_msg->iod_ssr = 3; - test_msg->sol_id = 2; - test_msg->time.tow = 604799; - test_msg->time.wn = 2222; - test_msg->update_interval = 1; - sbp_payload_send(&sbp_state, 0x605, 0, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 0, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 0, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x605, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_satellite_apc_t *check_msg = - (msg_ssr_satellite_apc_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->apc[0].pco[0] == 1, - "incorrect value for apc[0].pco[0], expected 1, is %d", - check_msg->apc[0].pco[0]); - ck_assert_msg(check_msg->apc[0].pco[1] == -1, - "incorrect value for apc[0].pco[1], expected -1, is %d", - check_msg->apc[0].pco[1]); - ck_assert_msg(check_msg->apc[0].pco[2] == 729, - "incorrect value for apc[0].pco[2], expected 729, is %d", - check_msg->apc[0].pco[2]); - ck_assert_msg(check_msg->apc[0].pcv[0] == 11, - "incorrect value for apc[0].pcv[0], expected 11, is %d", - check_msg->apc[0].pcv[0]); - ck_assert_msg(check_msg->apc[0].pcv[1] == 10, - "incorrect value for apc[0].pcv[1], expected 10, is %d", - check_msg->apc[0].pcv[1]); - ck_assert_msg(check_msg->apc[0].pcv[2] == 8, - "incorrect value for apc[0].pcv[2], expected 8, is %d", - check_msg->apc[0].pcv[2]); - ck_assert_msg(check_msg->apc[0].pcv[3] == 5, - "incorrect value for apc[0].pcv[3], expected 5, is %d", - check_msg->apc[0].pcv[3]); - ck_assert_msg(check_msg->apc[0].pcv[4] == 1, - "incorrect value for apc[0].pcv[4], expected 1, is %d", - check_msg->apc[0].pcv[4]); - ck_assert_msg(check_msg->apc[0].pcv[5] == -4, - "incorrect value for apc[0].pcv[5], expected -4, is %d", - check_msg->apc[0].pcv[5]); - ck_assert_msg(check_msg->apc[0].pcv[6] == -8, - "incorrect value for apc[0].pcv[6], expected -8, is %d", - check_msg->apc[0].pcv[6]); - ck_assert_msg(check_msg->apc[0].pcv[7] == -10, - "incorrect value for apc[0].pcv[7], expected -10, is %d", - check_msg->apc[0].pcv[7]); - ck_assert_msg(check_msg->apc[0].pcv[8] == -10, - "incorrect value for apc[0].pcv[8], expected -10, is %d", - check_msg->apc[0].pcv[8]); - ck_assert_msg(check_msg->apc[0].pcv[9] == -10, - "incorrect value for apc[0].pcv[9], expected -10, is %d", - check_msg->apc[0].pcv[9]); - ck_assert_msg(check_msg->apc[0].pcv[10] == -7, - "incorrect value for apc[0].pcv[10], expected -7, is %d", - check_msg->apc[0].pcv[10]); - ck_assert_msg(check_msg->apc[0].pcv[11] == -4, - "incorrect value for apc[0].pcv[11], expected -4, is %d", - check_msg->apc[0].pcv[11]); - ck_assert_msg(check_msg->apc[0].pcv[12] == 0, - "incorrect value for apc[0].pcv[12], expected 0, is %d", - check_msg->apc[0].pcv[12]); - ck_assert_msg(check_msg->apc[0].pcv[13] == 6, - "incorrect value for apc[0].pcv[13], expected 6, is %d", - check_msg->apc[0].pcv[13]); - ck_assert_msg(check_msg->apc[0].pcv[14] == 12, - "incorrect value for apc[0].pcv[14], expected 12, is %d", - check_msg->apc[0].pcv[14]); - ck_assert_msg(check_msg->apc[0].pcv[15] == 22, - "incorrect value for apc[0].pcv[15], expected 22, is %d", - check_msg->apc[0].pcv[15]); - ck_assert_msg(check_msg->apc[0].pcv[16] == 30, - "incorrect value for apc[0].pcv[16], expected 30, is %d", - check_msg->apc[0].pcv[16]); - ck_assert_msg(check_msg->apc[0].pcv[17] == 41, - "incorrect value for apc[0].pcv[17], expected 41, is %d", - check_msg->apc[0].pcv[17]); - ck_assert_msg(check_msg->apc[0].pcv[18] == 41, - "incorrect value for apc[0].pcv[18], expected 41, is %d", - check_msg->apc[0].pcv[18]); - ck_assert_msg(check_msg->apc[0].pcv[19] == 41, - "incorrect value for apc[0].pcv[19], expected 41, is %d", - check_msg->apc[0].pcv[19]); - ck_assert_msg(check_msg->apc[0].pcv[20] == 41, - "incorrect value for apc[0].pcv[20], expected 41, is %d", - check_msg->apc[0].pcv[20]); - ck_assert_msg(check_msg->apc[0].sat_info == 4, - "incorrect value for apc[0].sat_info, expected 4, is %d", - check_msg->apc[0].sat_info); - ck_assert_msg(check_msg->apc[0].sid.code == 0, - "incorrect value for apc[0].sid.code, expected 0, is %d", - check_msg->apc[0].sid.code); - ck_assert_msg(check_msg->apc[0].sid.sat == 2, - "incorrect value for apc[0].sid.sat, expected 2, is %d", - check_msg->apc[0].sid.sat); - ck_assert_msg(check_msg->apc[0].svn == 61, - "incorrect value for apc[0].svn, expected 61, is %d", - check_msg->apc[0].svn); - ck_assert_msg(check_msg->iod_ssr == 3, - "incorrect value for iod_ssr, expected 3, is %d", - check_msg->iod_ssr); - ck_assert_msg(check_msg->sol_id == 2, - "incorrect value for sol_id, expected 2, is %d", - check_msg->sol_id); - ck_assert_msg(check_msg->time.tow == 604799, - "incorrect value for time.tow, expected 604799, is %d", - check_msg->time.tow); - ck_assert_msg(check_msg->time.wn == 2222, - "incorrect value for time.wn, expected 2222, is %d", - check_msg->time.wn); - ck_assert_msg(check_msg->update_interval == 1, - "incorrect value for update_interval, expected 1, is %d", - check_msg->update_interval); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrSatelliteApc_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_ssr_MsgSsrSatelliteApc"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_MsgSsrSatelliteApc"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_ssr_MsgSsrSatelliteApc); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrSatelliteApcDepA.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrSatelliteApcDepA.c deleted file mode 100644 index f82804897c..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrSatelliteApcDepA.c +++ /dev/null @@ -1,1714 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrSatelliteApcDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrSatelliteApcDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x604, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x604, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 6, 56, 19, 224, 203, 169, 240, 78, 4, 213, 171, 254, - 214, 212, 4, 8, 33, 31, 80, 21, 4, 105, 225, 39, 139, 124, - 149, 48, 15, 214, 197, 141, 32, 33, 135, 150, 148, 123, 49, 135, - 97, 39, 90, 20, 169, 239, 47, 153, 175, 35, 145, 145, 123, 194, - 2, 102, 74, 149, 95, 171, 238, 249, 7, 237, 170, 125, 106, 158, - 83, 188, 181, 194, 27, 84, 226, 142, 123, 77, 217, 248, 67, 215, - 129, 114, 138, 25, 240, 10, 56, 76, 61, 161, 216, 22, 181, 174, - 33, 13, 252, 236, 230, 196, 128, 215, 239, 234, 179, 220, 44, 212, - 57, 44, 173, 49, 36, 137, 248, 235, 97, 112, 157, 139, 26, 115, - 192, 31, 85, 127, 228, 81, 252, 219, 249, 110, 147, 8, 161, 215, - 212, 180, 25, 83, 144, 247, 12, 27, 199, 173, 74, 23, 4, 239, - 103, 223, 220, 139, 91, 127, 214, 86, 48, 203, 228, 99, 45, 83, - 159, 11, 250, 135, 170, 42, 217, 199, 233, 42, 170, 78, 206, 41, - 43, 81, 247, 99, 198, 144, 2, 132, 2, 224, 220, 148, 58, 85, - 138, 210, 200, 158, 7, 158, 67, 46, 200, 132, 118, 241, 13, 37, - 62, 107, 253, 190, 136, 66, 9, 84, 155, 86, 180, 41, 196, 40, - 119, 101, 252, 223, 144, 153, 50, 13, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_satellite_apc_dep_t *test_msg = - (msg_ssr_satellite_apc_dep_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->apc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0]); - } - if (sizeof(test_msg->apc[0].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pco[0]); - } - test_msg->apc[0].pco[0] = -21547; - if (sizeof(test_msg->apc[0].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pco[0]); - } - test_msg->apc[0].pco[1] = -10498; - if (sizeof(test_msg->apc[0].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pco[0]); - } - test_msg->apc[0].pco[2] = 1236; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[0] = 8; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[1] = 33; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[2] = 31; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[3] = 80; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[4] = 21; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[5] = 4; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[6] = 105; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[7] = -31; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[8] = 39; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[9] = -117; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[10] = 124; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[11] = -107; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[12] = 48; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[13] = 15; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[14] = -42; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[15] = -59; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[16] = -115; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[17] = 32; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[18] = 33; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[19] = -121; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0].pcv[0]); - } - test_msg->apc[0].pcv[20] = -106; - test_msg->apc[0].sat_info = 240; - test_msg->apc[0].sid.code = 169; - test_msg->apc[0].sid.sat = 203; - test_msg->apc[0].svn = 1102; - if (sizeof(test_msg->apc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0]); - } - if (sizeof(test_msg->apc[1].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pco[0]); - } - test_msg->apc[1].pco[0] = 23079; - if (sizeof(test_msg->apc[1].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pco[0]); - } - test_msg->apc[1].pco[1] = -22252; - if (sizeof(test_msg->apc[1].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pco[0]); - } - test_msg->apc[1].pco[2] = 12271; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[0] = -103; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[1] = -81; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[2] = 35; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[3] = -111; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[4] = -111; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[5] = 123; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[6] = -62; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[7] = 2; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[8] = 102; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[9] = 74; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[10] = -107; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[11] = 95; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[12] = -85; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[13] = -18; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[14] = -7; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[15] = 7; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[16] = -19; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[17] = -86; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[18] = 125; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[19] = 106; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[1].pcv[0]); - } - test_msg->apc[1].pcv[20] = -98; - test_msg->apc[1].sat_info = 49; - test_msg->apc[1].sid.code = 123; - test_msg->apc[1].sid.sat = 148; - test_msg->apc[1].svn = 24967; - if (sizeof(test_msg->apc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0]); - } - if (sizeof(test_msg->apc[2].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pco[0]); - } - test_msg->apc[2].pco[0] = -7596; - if (sizeof(test_msg->apc[2].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pco[0]); - } - test_msg->apc[2].pco[1] = 31630; - if (sizeof(test_msg->apc[2].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pco[0]); - } - test_msg->apc[2].pco[2] = -9907; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[0] = -8; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[1] = 67; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[2] = -41; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[3] = -127; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[4] = 114; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[5] = -118; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[6] = 25; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[7] = -16; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[8] = 10; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[9] = 56; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[10] = 76; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[11] = 61; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[12] = -95; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[13] = -40; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[14] = 22; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[15] = -75; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[16] = -82; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[17] = 33; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[18] = 13; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[19] = -4; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[2].pcv[0]); - } - test_msg->apc[2].pcv[20] = -20; - test_msg->apc[2].sat_info = 181; - test_msg->apc[2].sid.code = 188; - test_msg->apc[2].sid.sat = 83; - test_msg->apc[2].svn = 7106; - if (sizeof(test_msg->apc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0]); - } - if (sizeof(test_msg->apc[3].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pco[0]); - } - test_msg->apc[3].pco[0] = -19478; - if (sizeof(test_msg->apc[3].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pco[0]); - } - test_msg->apc[3].pco[1] = 11484; - if (sizeof(test_msg->apc[3].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pco[0]); - } - test_msg->apc[3].pco[2] = 14804; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[0] = 44; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[1] = -83; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[2] = 49; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[3] = 36; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[4] = -119; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[5] = -8; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[6] = -21; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[7] = 97; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[8] = 112; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[9] = -99; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[10] = -117; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[11] = 26; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[12] = 115; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[13] = -64; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[14] = 31; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[15] = 85; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[16] = 127; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[17] = -28; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[18] = 81; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[19] = -4; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[3].pcv[0]); - } - test_msg->apc[3].pcv[20] = -37; - test_msg->apc[3].sat_info = 128; - test_msg->apc[3].sid.code = 196; - test_msg->apc[3].sid.sat = 230; - test_msg->apc[3].svn = 61399; - if (sizeof(test_msg->apc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0]); - } - if (sizeof(test_msg->apc[4].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pco[0]); - } - test_msg->apc[4].pco[0] = -11049; - if (sizeof(test_msg->apc[4].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pco[0]); - } - test_msg->apc[4].pco[1] = 6580; - if (sizeof(test_msg->apc[4].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pco[0]); - } - test_msg->apc[4].pco[2] = -28589; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[0] = -9; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[1] = 12; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[2] = 27; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[3] = -57; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[4] = -83; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[5] = 74; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[6] = 23; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[7] = 4; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[8] = -17; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[9] = 103; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[10] = -33; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[11] = -36; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[12] = -117; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[13] = 91; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[14] = 127; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[15] = -42; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[16] = 86; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[17] = 48; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[18] = -53; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[19] = -28; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[4].pcv[0]); - } - test_msg->apc[4].pcv[20] = 99; - test_msg->apc[4].sat_info = 147; - test_msg->apc[4].sid.code = 110; - test_msg->apc[4].sid.sat = 249; - test_msg->apc[4].svn = 41224; - if (sizeof(test_msg->apc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0]); - } - if (sizeof(test_msg->apc[5].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pco[0]); - } - test_msg->apc[5].pco[0] = -21881; - if (sizeof(test_msg->apc[5].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pco[0]); - } - test_msg->apc[5].pco[1] = -9942; - if (sizeof(test_msg->apc[5].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pco[0]); - } - test_msg->apc[5].pco[2] = -5689; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[0] = 42; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[1] = -86; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[2] = 78; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[3] = -50; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[4] = 41; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[5] = 43; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[6] = 81; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[7] = -9; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[8] = 99; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[9] = -58; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[10] = -112; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[11] = 2; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[12] = -124; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[13] = 2; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[14] = -32; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[15] = -36; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[16] = -108; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[17] = 58; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[18] = 85; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[19] = -118; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[5].pcv[0]); - } - test_msg->apc[5].pcv[20] = -46; - test_msg->apc[5].sat_info = 159; - test_msg->apc[5].sid.code = 83; - test_msg->apc[5].sid.sat = 45; - test_msg->apc[5].svn = 64011; - if (sizeof(test_msg->apc) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[0]); - } - if (sizeof(test_msg->apc[6].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pco[0]); - } - test_msg->apc[6].pco[0] = -14290; - if (sizeof(test_msg->apc[6].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pco[0]); - } - test_msg->apc[6].pco[1] = 30340; - if (sizeof(test_msg->apc[6].pco) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pco[0]); - } - test_msg->apc[6].pco[2] = 3569; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[0] = 37; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[1] = 62; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[2] = 107; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[3] = -3; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[4] = -66; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[5] = -120; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[6] = 66; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[7] = 9; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[8] = 84; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[9] = -101; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[10] = 86; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[11] = -76; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[12] = 41; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[13] = -60; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[14] = 40; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[15] = 119; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[16] = 101; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[17] = -4; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[18] = -33; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[19] = -112; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->apc[6].pcv[0]); - } - test_msg->apc[6].pcv[20] = -103; - test_msg->apc[6].sat_info = 7; - test_msg->apc[6].sid.code = 158; - test_msg->apc[6].sid.sat = 200; - test_msg->apc[6].svn = 17310; - sbp_payload_send(&sbp_state, 0x604, 4920, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 4920, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 4920, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x604, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_satellite_apc_dep_t *check_msg = - (msg_ssr_satellite_apc_dep_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->apc[0].pco[0] == -21547, - "incorrect value for apc[0].pco[0], expected -21547, is %d", - check_msg->apc[0].pco[0]); - ck_assert_msg(check_msg->apc[0].pco[1] == -10498, - "incorrect value for apc[0].pco[1], expected -10498, is %d", - check_msg->apc[0].pco[1]); - ck_assert_msg(check_msg->apc[0].pco[2] == 1236, - "incorrect value for apc[0].pco[2], expected 1236, is %d", - check_msg->apc[0].pco[2]); - ck_assert_msg(check_msg->apc[0].pcv[0] == 8, - "incorrect value for apc[0].pcv[0], expected 8, is %d", - check_msg->apc[0].pcv[0]); - ck_assert_msg(check_msg->apc[0].pcv[1] == 33, - "incorrect value for apc[0].pcv[1], expected 33, is %d", - check_msg->apc[0].pcv[1]); - ck_assert_msg(check_msg->apc[0].pcv[2] == 31, - "incorrect value for apc[0].pcv[2], expected 31, is %d", - check_msg->apc[0].pcv[2]); - ck_assert_msg(check_msg->apc[0].pcv[3] == 80, - "incorrect value for apc[0].pcv[3], expected 80, is %d", - check_msg->apc[0].pcv[3]); - ck_assert_msg(check_msg->apc[0].pcv[4] == 21, - "incorrect value for apc[0].pcv[4], expected 21, is %d", - check_msg->apc[0].pcv[4]); - ck_assert_msg(check_msg->apc[0].pcv[5] == 4, - "incorrect value for apc[0].pcv[5], expected 4, is %d", - check_msg->apc[0].pcv[5]); - ck_assert_msg(check_msg->apc[0].pcv[6] == 105, - "incorrect value for apc[0].pcv[6], expected 105, is %d", - check_msg->apc[0].pcv[6]); - ck_assert_msg(check_msg->apc[0].pcv[7] == -31, - "incorrect value for apc[0].pcv[7], expected -31, is %d", - check_msg->apc[0].pcv[7]); - ck_assert_msg(check_msg->apc[0].pcv[8] == 39, - "incorrect value for apc[0].pcv[8], expected 39, is %d", - check_msg->apc[0].pcv[8]); - ck_assert_msg(check_msg->apc[0].pcv[9] == -117, - "incorrect value for apc[0].pcv[9], expected -117, is %d", - check_msg->apc[0].pcv[9]); - ck_assert_msg(check_msg->apc[0].pcv[10] == 124, - "incorrect value for apc[0].pcv[10], expected 124, is %d", - check_msg->apc[0].pcv[10]); - ck_assert_msg(check_msg->apc[0].pcv[11] == -107, - "incorrect value for apc[0].pcv[11], expected -107, is %d", - check_msg->apc[0].pcv[11]); - ck_assert_msg(check_msg->apc[0].pcv[12] == 48, - "incorrect value for apc[0].pcv[12], expected 48, is %d", - check_msg->apc[0].pcv[12]); - ck_assert_msg(check_msg->apc[0].pcv[13] == 15, - "incorrect value for apc[0].pcv[13], expected 15, is %d", - check_msg->apc[0].pcv[13]); - ck_assert_msg(check_msg->apc[0].pcv[14] == -42, - "incorrect value for apc[0].pcv[14], expected -42, is %d", - check_msg->apc[0].pcv[14]); - ck_assert_msg(check_msg->apc[0].pcv[15] == -59, - "incorrect value for apc[0].pcv[15], expected -59, is %d", - check_msg->apc[0].pcv[15]); - ck_assert_msg(check_msg->apc[0].pcv[16] == -115, - "incorrect value for apc[0].pcv[16], expected -115, is %d", - check_msg->apc[0].pcv[16]); - ck_assert_msg(check_msg->apc[0].pcv[17] == 32, - "incorrect value for apc[0].pcv[17], expected 32, is %d", - check_msg->apc[0].pcv[17]); - ck_assert_msg(check_msg->apc[0].pcv[18] == 33, - "incorrect value for apc[0].pcv[18], expected 33, is %d", - check_msg->apc[0].pcv[18]); - ck_assert_msg(check_msg->apc[0].pcv[19] == -121, - "incorrect value for apc[0].pcv[19], expected -121, is %d", - check_msg->apc[0].pcv[19]); - ck_assert_msg(check_msg->apc[0].pcv[20] == -106, - "incorrect value for apc[0].pcv[20], expected -106, is %d", - check_msg->apc[0].pcv[20]); - ck_assert_msg(check_msg->apc[0].sat_info == 240, - "incorrect value for apc[0].sat_info, expected 240, is %d", - check_msg->apc[0].sat_info); - ck_assert_msg(check_msg->apc[0].sid.code == 169, - "incorrect value for apc[0].sid.code, expected 169, is %d", - check_msg->apc[0].sid.code); - ck_assert_msg(check_msg->apc[0].sid.sat == 203, - "incorrect value for apc[0].sid.sat, expected 203, is %d", - check_msg->apc[0].sid.sat); - ck_assert_msg(check_msg->apc[0].svn == 1102, - "incorrect value for apc[0].svn, expected 1102, is %d", - check_msg->apc[0].svn); - ck_assert_msg(check_msg->apc[1].pco[0] == 23079, - "incorrect value for apc[1].pco[0], expected 23079, is %d", - check_msg->apc[1].pco[0]); - ck_assert_msg(check_msg->apc[1].pco[1] == -22252, - "incorrect value for apc[1].pco[1], expected -22252, is %d", - check_msg->apc[1].pco[1]); - ck_assert_msg(check_msg->apc[1].pco[2] == 12271, - "incorrect value for apc[1].pco[2], expected 12271, is %d", - check_msg->apc[1].pco[2]); - ck_assert_msg(check_msg->apc[1].pcv[0] == -103, - "incorrect value for apc[1].pcv[0], expected -103, is %d", - check_msg->apc[1].pcv[0]); - ck_assert_msg(check_msg->apc[1].pcv[1] == -81, - "incorrect value for apc[1].pcv[1], expected -81, is %d", - check_msg->apc[1].pcv[1]); - ck_assert_msg(check_msg->apc[1].pcv[2] == 35, - "incorrect value for apc[1].pcv[2], expected 35, is %d", - check_msg->apc[1].pcv[2]); - ck_assert_msg(check_msg->apc[1].pcv[3] == -111, - "incorrect value for apc[1].pcv[3], expected -111, is %d", - check_msg->apc[1].pcv[3]); - ck_assert_msg(check_msg->apc[1].pcv[4] == -111, - "incorrect value for apc[1].pcv[4], expected -111, is %d", - check_msg->apc[1].pcv[4]); - ck_assert_msg(check_msg->apc[1].pcv[5] == 123, - "incorrect value for apc[1].pcv[5], expected 123, is %d", - check_msg->apc[1].pcv[5]); - ck_assert_msg(check_msg->apc[1].pcv[6] == -62, - "incorrect value for apc[1].pcv[6], expected -62, is %d", - check_msg->apc[1].pcv[6]); - ck_assert_msg(check_msg->apc[1].pcv[7] == 2, - "incorrect value for apc[1].pcv[7], expected 2, is %d", - check_msg->apc[1].pcv[7]); - ck_assert_msg(check_msg->apc[1].pcv[8] == 102, - "incorrect value for apc[1].pcv[8], expected 102, is %d", - check_msg->apc[1].pcv[8]); - ck_assert_msg(check_msg->apc[1].pcv[9] == 74, - "incorrect value for apc[1].pcv[9], expected 74, is %d", - check_msg->apc[1].pcv[9]); - ck_assert_msg(check_msg->apc[1].pcv[10] == -107, - "incorrect value for apc[1].pcv[10], expected -107, is %d", - check_msg->apc[1].pcv[10]); - ck_assert_msg(check_msg->apc[1].pcv[11] == 95, - "incorrect value for apc[1].pcv[11], expected 95, is %d", - check_msg->apc[1].pcv[11]); - ck_assert_msg(check_msg->apc[1].pcv[12] == -85, - "incorrect value for apc[1].pcv[12], expected -85, is %d", - check_msg->apc[1].pcv[12]); - ck_assert_msg(check_msg->apc[1].pcv[13] == -18, - "incorrect value for apc[1].pcv[13], expected -18, is %d", - check_msg->apc[1].pcv[13]); - ck_assert_msg(check_msg->apc[1].pcv[14] == -7, - "incorrect value for apc[1].pcv[14], expected -7, is %d", - check_msg->apc[1].pcv[14]); - ck_assert_msg(check_msg->apc[1].pcv[15] == 7, - "incorrect value for apc[1].pcv[15], expected 7, is %d", - check_msg->apc[1].pcv[15]); - ck_assert_msg(check_msg->apc[1].pcv[16] == -19, - "incorrect value for apc[1].pcv[16], expected -19, is %d", - check_msg->apc[1].pcv[16]); - ck_assert_msg(check_msg->apc[1].pcv[17] == -86, - "incorrect value for apc[1].pcv[17], expected -86, is %d", - check_msg->apc[1].pcv[17]); - ck_assert_msg(check_msg->apc[1].pcv[18] == 125, - "incorrect value for apc[1].pcv[18], expected 125, is %d", - check_msg->apc[1].pcv[18]); - ck_assert_msg(check_msg->apc[1].pcv[19] == 106, - "incorrect value for apc[1].pcv[19], expected 106, is %d", - check_msg->apc[1].pcv[19]); - ck_assert_msg(check_msg->apc[1].pcv[20] == -98, - "incorrect value for apc[1].pcv[20], expected -98, is %d", - check_msg->apc[1].pcv[20]); - ck_assert_msg(check_msg->apc[1].sat_info == 49, - "incorrect value for apc[1].sat_info, expected 49, is %d", - check_msg->apc[1].sat_info); - ck_assert_msg(check_msg->apc[1].sid.code == 123, - "incorrect value for apc[1].sid.code, expected 123, is %d", - check_msg->apc[1].sid.code); - ck_assert_msg(check_msg->apc[1].sid.sat == 148, - "incorrect value for apc[1].sid.sat, expected 148, is %d", - check_msg->apc[1].sid.sat); - ck_assert_msg(check_msg->apc[1].svn == 24967, - "incorrect value for apc[1].svn, expected 24967, is %d", - check_msg->apc[1].svn); - ck_assert_msg(check_msg->apc[2].pco[0] == -7596, - "incorrect value for apc[2].pco[0], expected -7596, is %d", - check_msg->apc[2].pco[0]); - ck_assert_msg(check_msg->apc[2].pco[1] == 31630, - "incorrect value for apc[2].pco[1], expected 31630, is %d", - check_msg->apc[2].pco[1]); - ck_assert_msg(check_msg->apc[2].pco[2] == -9907, - "incorrect value for apc[2].pco[2], expected -9907, is %d", - check_msg->apc[2].pco[2]); - ck_assert_msg(check_msg->apc[2].pcv[0] == -8, - "incorrect value for apc[2].pcv[0], expected -8, is %d", - check_msg->apc[2].pcv[0]); - ck_assert_msg(check_msg->apc[2].pcv[1] == 67, - "incorrect value for apc[2].pcv[1], expected 67, is %d", - check_msg->apc[2].pcv[1]); - ck_assert_msg(check_msg->apc[2].pcv[2] == -41, - "incorrect value for apc[2].pcv[2], expected -41, is %d", - check_msg->apc[2].pcv[2]); - ck_assert_msg(check_msg->apc[2].pcv[3] == -127, - "incorrect value for apc[2].pcv[3], expected -127, is %d", - check_msg->apc[2].pcv[3]); - ck_assert_msg(check_msg->apc[2].pcv[4] == 114, - "incorrect value for apc[2].pcv[4], expected 114, is %d", - check_msg->apc[2].pcv[4]); - ck_assert_msg(check_msg->apc[2].pcv[5] == -118, - "incorrect value for apc[2].pcv[5], expected -118, is %d", - check_msg->apc[2].pcv[5]); - ck_assert_msg(check_msg->apc[2].pcv[6] == 25, - "incorrect value for apc[2].pcv[6], expected 25, is %d", - check_msg->apc[2].pcv[6]); - ck_assert_msg(check_msg->apc[2].pcv[7] == -16, - "incorrect value for apc[2].pcv[7], expected -16, is %d", - check_msg->apc[2].pcv[7]); - ck_assert_msg(check_msg->apc[2].pcv[8] == 10, - "incorrect value for apc[2].pcv[8], expected 10, is %d", - check_msg->apc[2].pcv[8]); - ck_assert_msg(check_msg->apc[2].pcv[9] == 56, - "incorrect value for apc[2].pcv[9], expected 56, is %d", - check_msg->apc[2].pcv[9]); - ck_assert_msg(check_msg->apc[2].pcv[10] == 76, - "incorrect value for apc[2].pcv[10], expected 76, is %d", - check_msg->apc[2].pcv[10]); - ck_assert_msg(check_msg->apc[2].pcv[11] == 61, - "incorrect value for apc[2].pcv[11], expected 61, is %d", - check_msg->apc[2].pcv[11]); - ck_assert_msg(check_msg->apc[2].pcv[12] == -95, - "incorrect value for apc[2].pcv[12], expected -95, is %d", - check_msg->apc[2].pcv[12]); - ck_assert_msg(check_msg->apc[2].pcv[13] == -40, - "incorrect value for apc[2].pcv[13], expected -40, is %d", - check_msg->apc[2].pcv[13]); - ck_assert_msg(check_msg->apc[2].pcv[14] == 22, - "incorrect value for apc[2].pcv[14], expected 22, is %d", - check_msg->apc[2].pcv[14]); - ck_assert_msg(check_msg->apc[2].pcv[15] == -75, - "incorrect value for apc[2].pcv[15], expected -75, is %d", - check_msg->apc[2].pcv[15]); - ck_assert_msg(check_msg->apc[2].pcv[16] == -82, - "incorrect value for apc[2].pcv[16], expected -82, is %d", - check_msg->apc[2].pcv[16]); - ck_assert_msg(check_msg->apc[2].pcv[17] == 33, - "incorrect value for apc[2].pcv[17], expected 33, is %d", - check_msg->apc[2].pcv[17]); - ck_assert_msg(check_msg->apc[2].pcv[18] == 13, - "incorrect value for apc[2].pcv[18], expected 13, is %d", - check_msg->apc[2].pcv[18]); - ck_assert_msg(check_msg->apc[2].pcv[19] == -4, - "incorrect value for apc[2].pcv[19], expected -4, is %d", - check_msg->apc[2].pcv[19]); - ck_assert_msg(check_msg->apc[2].pcv[20] == -20, - "incorrect value for apc[2].pcv[20], expected -20, is %d", - check_msg->apc[2].pcv[20]); - ck_assert_msg(check_msg->apc[2].sat_info == 181, - "incorrect value for apc[2].sat_info, expected 181, is %d", - check_msg->apc[2].sat_info); - ck_assert_msg(check_msg->apc[2].sid.code == 188, - "incorrect value for apc[2].sid.code, expected 188, is %d", - check_msg->apc[2].sid.code); - ck_assert_msg(check_msg->apc[2].sid.sat == 83, - "incorrect value for apc[2].sid.sat, expected 83, is %d", - check_msg->apc[2].sid.sat); - ck_assert_msg(check_msg->apc[2].svn == 7106, - "incorrect value for apc[2].svn, expected 7106, is %d", - check_msg->apc[2].svn); - ck_assert_msg(check_msg->apc[3].pco[0] == -19478, - "incorrect value for apc[3].pco[0], expected -19478, is %d", - check_msg->apc[3].pco[0]); - ck_assert_msg(check_msg->apc[3].pco[1] == 11484, - "incorrect value for apc[3].pco[1], expected 11484, is %d", - check_msg->apc[3].pco[1]); - ck_assert_msg(check_msg->apc[3].pco[2] == 14804, - "incorrect value for apc[3].pco[2], expected 14804, is %d", - check_msg->apc[3].pco[2]); - ck_assert_msg(check_msg->apc[3].pcv[0] == 44, - "incorrect value for apc[3].pcv[0], expected 44, is %d", - check_msg->apc[3].pcv[0]); - ck_assert_msg(check_msg->apc[3].pcv[1] == -83, - "incorrect value for apc[3].pcv[1], expected -83, is %d", - check_msg->apc[3].pcv[1]); - ck_assert_msg(check_msg->apc[3].pcv[2] == 49, - "incorrect value for apc[3].pcv[2], expected 49, is %d", - check_msg->apc[3].pcv[2]); - ck_assert_msg(check_msg->apc[3].pcv[3] == 36, - "incorrect value for apc[3].pcv[3], expected 36, is %d", - check_msg->apc[3].pcv[3]); - ck_assert_msg(check_msg->apc[3].pcv[4] == -119, - "incorrect value for apc[3].pcv[4], expected -119, is %d", - check_msg->apc[3].pcv[4]); - ck_assert_msg(check_msg->apc[3].pcv[5] == -8, - "incorrect value for apc[3].pcv[5], expected -8, is %d", - check_msg->apc[3].pcv[5]); - ck_assert_msg(check_msg->apc[3].pcv[6] == -21, - "incorrect value for apc[3].pcv[6], expected -21, is %d", - check_msg->apc[3].pcv[6]); - ck_assert_msg(check_msg->apc[3].pcv[7] == 97, - "incorrect value for apc[3].pcv[7], expected 97, is %d", - check_msg->apc[3].pcv[7]); - ck_assert_msg(check_msg->apc[3].pcv[8] == 112, - "incorrect value for apc[3].pcv[8], expected 112, is %d", - check_msg->apc[3].pcv[8]); - ck_assert_msg(check_msg->apc[3].pcv[9] == -99, - "incorrect value for apc[3].pcv[9], expected -99, is %d", - check_msg->apc[3].pcv[9]); - ck_assert_msg(check_msg->apc[3].pcv[10] == -117, - "incorrect value for apc[3].pcv[10], expected -117, is %d", - check_msg->apc[3].pcv[10]); - ck_assert_msg(check_msg->apc[3].pcv[11] == 26, - "incorrect value for apc[3].pcv[11], expected 26, is %d", - check_msg->apc[3].pcv[11]); - ck_assert_msg(check_msg->apc[3].pcv[12] == 115, - "incorrect value for apc[3].pcv[12], expected 115, is %d", - check_msg->apc[3].pcv[12]); - ck_assert_msg(check_msg->apc[3].pcv[13] == -64, - "incorrect value for apc[3].pcv[13], expected -64, is %d", - check_msg->apc[3].pcv[13]); - ck_assert_msg(check_msg->apc[3].pcv[14] == 31, - "incorrect value for apc[3].pcv[14], expected 31, is %d", - check_msg->apc[3].pcv[14]); - ck_assert_msg(check_msg->apc[3].pcv[15] == 85, - "incorrect value for apc[3].pcv[15], expected 85, is %d", - check_msg->apc[3].pcv[15]); - ck_assert_msg(check_msg->apc[3].pcv[16] == 127, - "incorrect value for apc[3].pcv[16], expected 127, is %d", - check_msg->apc[3].pcv[16]); - ck_assert_msg(check_msg->apc[3].pcv[17] == -28, - "incorrect value for apc[3].pcv[17], expected -28, is %d", - check_msg->apc[3].pcv[17]); - ck_assert_msg(check_msg->apc[3].pcv[18] == 81, - "incorrect value for apc[3].pcv[18], expected 81, is %d", - check_msg->apc[3].pcv[18]); - ck_assert_msg(check_msg->apc[3].pcv[19] == -4, - "incorrect value for apc[3].pcv[19], expected -4, is %d", - check_msg->apc[3].pcv[19]); - ck_assert_msg(check_msg->apc[3].pcv[20] == -37, - "incorrect value for apc[3].pcv[20], expected -37, is %d", - check_msg->apc[3].pcv[20]); - ck_assert_msg(check_msg->apc[3].sat_info == 128, - "incorrect value for apc[3].sat_info, expected 128, is %d", - check_msg->apc[3].sat_info); - ck_assert_msg(check_msg->apc[3].sid.code == 196, - "incorrect value for apc[3].sid.code, expected 196, is %d", - check_msg->apc[3].sid.code); - ck_assert_msg(check_msg->apc[3].sid.sat == 230, - "incorrect value for apc[3].sid.sat, expected 230, is %d", - check_msg->apc[3].sid.sat); - ck_assert_msg(check_msg->apc[3].svn == 61399, - "incorrect value for apc[3].svn, expected 61399, is %d", - check_msg->apc[3].svn); - ck_assert_msg(check_msg->apc[4].pco[0] == -11049, - "incorrect value for apc[4].pco[0], expected -11049, is %d", - check_msg->apc[4].pco[0]); - ck_assert_msg(check_msg->apc[4].pco[1] == 6580, - "incorrect value for apc[4].pco[1], expected 6580, is %d", - check_msg->apc[4].pco[1]); - ck_assert_msg(check_msg->apc[4].pco[2] == -28589, - "incorrect value for apc[4].pco[2], expected -28589, is %d", - check_msg->apc[4].pco[2]); - ck_assert_msg(check_msg->apc[4].pcv[0] == -9, - "incorrect value for apc[4].pcv[0], expected -9, is %d", - check_msg->apc[4].pcv[0]); - ck_assert_msg(check_msg->apc[4].pcv[1] == 12, - "incorrect value for apc[4].pcv[1], expected 12, is %d", - check_msg->apc[4].pcv[1]); - ck_assert_msg(check_msg->apc[4].pcv[2] == 27, - "incorrect value for apc[4].pcv[2], expected 27, is %d", - check_msg->apc[4].pcv[2]); - ck_assert_msg(check_msg->apc[4].pcv[3] == -57, - "incorrect value for apc[4].pcv[3], expected -57, is %d", - check_msg->apc[4].pcv[3]); - ck_assert_msg(check_msg->apc[4].pcv[4] == -83, - "incorrect value for apc[4].pcv[4], expected -83, is %d", - check_msg->apc[4].pcv[4]); - ck_assert_msg(check_msg->apc[4].pcv[5] == 74, - "incorrect value for apc[4].pcv[5], expected 74, is %d", - check_msg->apc[4].pcv[5]); - ck_assert_msg(check_msg->apc[4].pcv[6] == 23, - "incorrect value for apc[4].pcv[6], expected 23, is %d", - check_msg->apc[4].pcv[6]); - ck_assert_msg(check_msg->apc[4].pcv[7] == 4, - "incorrect value for apc[4].pcv[7], expected 4, is %d", - check_msg->apc[4].pcv[7]); - ck_assert_msg(check_msg->apc[4].pcv[8] == -17, - "incorrect value for apc[4].pcv[8], expected -17, is %d", - check_msg->apc[4].pcv[8]); - ck_assert_msg(check_msg->apc[4].pcv[9] == 103, - "incorrect value for apc[4].pcv[9], expected 103, is %d", - check_msg->apc[4].pcv[9]); - ck_assert_msg(check_msg->apc[4].pcv[10] == -33, - "incorrect value for apc[4].pcv[10], expected -33, is %d", - check_msg->apc[4].pcv[10]); - ck_assert_msg(check_msg->apc[4].pcv[11] == -36, - "incorrect value for apc[4].pcv[11], expected -36, is %d", - check_msg->apc[4].pcv[11]); - ck_assert_msg(check_msg->apc[4].pcv[12] == -117, - "incorrect value for apc[4].pcv[12], expected -117, is %d", - check_msg->apc[4].pcv[12]); - ck_assert_msg(check_msg->apc[4].pcv[13] == 91, - "incorrect value for apc[4].pcv[13], expected 91, is %d", - check_msg->apc[4].pcv[13]); - ck_assert_msg(check_msg->apc[4].pcv[14] == 127, - "incorrect value for apc[4].pcv[14], expected 127, is %d", - check_msg->apc[4].pcv[14]); - ck_assert_msg(check_msg->apc[4].pcv[15] == -42, - "incorrect value for apc[4].pcv[15], expected -42, is %d", - check_msg->apc[4].pcv[15]); - ck_assert_msg(check_msg->apc[4].pcv[16] == 86, - "incorrect value for apc[4].pcv[16], expected 86, is %d", - check_msg->apc[4].pcv[16]); - ck_assert_msg(check_msg->apc[4].pcv[17] == 48, - "incorrect value for apc[4].pcv[17], expected 48, is %d", - check_msg->apc[4].pcv[17]); - ck_assert_msg(check_msg->apc[4].pcv[18] == -53, - "incorrect value for apc[4].pcv[18], expected -53, is %d", - check_msg->apc[4].pcv[18]); - ck_assert_msg(check_msg->apc[4].pcv[19] == -28, - "incorrect value for apc[4].pcv[19], expected -28, is %d", - check_msg->apc[4].pcv[19]); - ck_assert_msg(check_msg->apc[4].pcv[20] == 99, - "incorrect value for apc[4].pcv[20], expected 99, is %d", - check_msg->apc[4].pcv[20]); - ck_assert_msg(check_msg->apc[4].sat_info == 147, - "incorrect value for apc[4].sat_info, expected 147, is %d", - check_msg->apc[4].sat_info); - ck_assert_msg(check_msg->apc[4].sid.code == 110, - "incorrect value for apc[4].sid.code, expected 110, is %d", - check_msg->apc[4].sid.code); - ck_assert_msg(check_msg->apc[4].sid.sat == 249, - "incorrect value for apc[4].sid.sat, expected 249, is %d", - check_msg->apc[4].sid.sat); - ck_assert_msg(check_msg->apc[4].svn == 41224, - "incorrect value for apc[4].svn, expected 41224, is %d", - check_msg->apc[4].svn); - ck_assert_msg(check_msg->apc[5].pco[0] == -21881, - "incorrect value for apc[5].pco[0], expected -21881, is %d", - check_msg->apc[5].pco[0]); - ck_assert_msg(check_msg->apc[5].pco[1] == -9942, - "incorrect value for apc[5].pco[1], expected -9942, is %d", - check_msg->apc[5].pco[1]); - ck_assert_msg(check_msg->apc[5].pco[2] == -5689, - "incorrect value for apc[5].pco[2], expected -5689, is %d", - check_msg->apc[5].pco[2]); - ck_assert_msg(check_msg->apc[5].pcv[0] == 42, - "incorrect value for apc[5].pcv[0], expected 42, is %d", - check_msg->apc[5].pcv[0]); - ck_assert_msg(check_msg->apc[5].pcv[1] == -86, - "incorrect value for apc[5].pcv[1], expected -86, is %d", - check_msg->apc[5].pcv[1]); - ck_assert_msg(check_msg->apc[5].pcv[2] == 78, - "incorrect value for apc[5].pcv[2], expected 78, is %d", - check_msg->apc[5].pcv[2]); - ck_assert_msg(check_msg->apc[5].pcv[3] == -50, - "incorrect value for apc[5].pcv[3], expected -50, is %d", - check_msg->apc[5].pcv[3]); - ck_assert_msg(check_msg->apc[5].pcv[4] == 41, - "incorrect value for apc[5].pcv[4], expected 41, is %d", - check_msg->apc[5].pcv[4]); - ck_assert_msg(check_msg->apc[5].pcv[5] == 43, - "incorrect value for apc[5].pcv[5], expected 43, is %d", - check_msg->apc[5].pcv[5]); - ck_assert_msg(check_msg->apc[5].pcv[6] == 81, - "incorrect value for apc[5].pcv[6], expected 81, is %d", - check_msg->apc[5].pcv[6]); - ck_assert_msg(check_msg->apc[5].pcv[7] == -9, - "incorrect value for apc[5].pcv[7], expected -9, is %d", - check_msg->apc[5].pcv[7]); - ck_assert_msg(check_msg->apc[5].pcv[8] == 99, - "incorrect value for apc[5].pcv[8], expected 99, is %d", - check_msg->apc[5].pcv[8]); - ck_assert_msg(check_msg->apc[5].pcv[9] == -58, - "incorrect value for apc[5].pcv[9], expected -58, is %d", - check_msg->apc[5].pcv[9]); - ck_assert_msg(check_msg->apc[5].pcv[10] == -112, - "incorrect value for apc[5].pcv[10], expected -112, is %d", - check_msg->apc[5].pcv[10]); - ck_assert_msg(check_msg->apc[5].pcv[11] == 2, - "incorrect value for apc[5].pcv[11], expected 2, is %d", - check_msg->apc[5].pcv[11]); - ck_assert_msg(check_msg->apc[5].pcv[12] == -124, - "incorrect value for apc[5].pcv[12], expected -124, is %d", - check_msg->apc[5].pcv[12]); - ck_assert_msg(check_msg->apc[5].pcv[13] == 2, - "incorrect value for apc[5].pcv[13], expected 2, is %d", - check_msg->apc[5].pcv[13]); - ck_assert_msg(check_msg->apc[5].pcv[14] == -32, - "incorrect value for apc[5].pcv[14], expected -32, is %d", - check_msg->apc[5].pcv[14]); - ck_assert_msg(check_msg->apc[5].pcv[15] == -36, - "incorrect value for apc[5].pcv[15], expected -36, is %d", - check_msg->apc[5].pcv[15]); - ck_assert_msg(check_msg->apc[5].pcv[16] == -108, - "incorrect value for apc[5].pcv[16], expected -108, is %d", - check_msg->apc[5].pcv[16]); - ck_assert_msg(check_msg->apc[5].pcv[17] == 58, - "incorrect value for apc[5].pcv[17], expected 58, is %d", - check_msg->apc[5].pcv[17]); - ck_assert_msg(check_msg->apc[5].pcv[18] == 85, - "incorrect value for apc[5].pcv[18], expected 85, is %d", - check_msg->apc[5].pcv[18]); - ck_assert_msg(check_msg->apc[5].pcv[19] == -118, - "incorrect value for apc[5].pcv[19], expected -118, is %d", - check_msg->apc[5].pcv[19]); - ck_assert_msg(check_msg->apc[5].pcv[20] == -46, - "incorrect value for apc[5].pcv[20], expected -46, is %d", - check_msg->apc[5].pcv[20]); - ck_assert_msg(check_msg->apc[5].sat_info == 159, - "incorrect value for apc[5].sat_info, expected 159, is %d", - check_msg->apc[5].sat_info); - ck_assert_msg(check_msg->apc[5].sid.code == 83, - "incorrect value for apc[5].sid.code, expected 83, is %d", - check_msg->apc[5].sid.code); - ck_assert_msg(check_msg->apc[5].sid.sat == 45, - "incorrect value for apc[5].sid.sat, expected 45, is %d", - check_msg->apc[5].sid.sat); - ck_assert_msg(check_msg->apc[5].svn == 64011, - "incorrect value for apc[5].svn, expected 64011, is %d", - check_msg->apc[5].svn); - ck_assert_msg(check_msg->apc[6].pco[0] == -14290, - "incorrect value for apc[6].pco[0], expected -14290, is %d", - check_msg->apc[6].pco[0]); - ck_assert_msg(check_msg->apc[6].pco[1] == 30340, - "incorrect value for apc[6].pco[1], expected 30340, is %d", - check_msg->apc[6].pco[1]); - ck_assert_msg(check_msg->apc[6].pco[2] == 3569, - "incorrect value for apc[6].pco[2], expected 3569, is %d", - check_msg->apc[6].pco[2]); - ck_assert_msg(check_msg->apc[6].pcv[0] == 37, - "incorrect value for apc[6].pcv[0], expected 37, is %d", - check_msg->apc[6].pcv[0]); - ck_assert_msg(check_msg->apc[6].pcv[1] == 62, - "incorrect value for apc[6].pcv[1], expected 62, is %d", - check_msg->apc[6].pcv[1]); - ck_assert_msg(check_msg->apc[6].pcv[2] == 107, - "incorrect value for apc[6].pcv[2], expected 107, is %d", - check_msg->apc[6].pcv[2]); - ck_assert_msg(check_msg->apc[6].pcv[3] == -3, - "incorrect value for apc[6].pcv[3], expected -3, is %d", - check_msg->apc[6].pcv[3]); - ck_assert_msg(check_msg->apc[6].pcv[4] == -66, - "incorrect value for apc[6].pcv[4], expected -66, is %d", - check_msg->apc[6].pcv[4]); - ck_assert_msg(check_msg->apc[6].pcv[5] == -120, - "incorrect value for apc[6].pcv[5], expected -120, is %d", - check_msg->apc[6].pcv[5]); - ck_assert_msg(check_msg->apc[6].pcv[6] == 66, - "incorrect value for apc[6].pcv[6], expected 66, is %d", - check_msg->apc[6].pcv[6]); - ck_assert_msg(check_msg->apc[6].pcv[7] == 9, - "incorrect value for apc[6].pcv[7], expected 9, is %d", - check_msg->apc[6].pcv[7]); - ck_assert_msg(check_msg->apc[6].pcv[8] == 84, - "incorrect value for apc[6].pcv[8], expected 84, is %d", - check_msg->apc[6].pcv[8]); - ck_assert_msg(check_msg->apc[6].pcv[9] == -101, - "incorrect value for apc[6].pcv[9], expected -101, is %d", - check_msg->apc[6].pcv[9]); - ck_assert_msg(check_msg->apc[6].pcv[10] == 86, - "incorrect value for apc[6].pcv[10], expected 86, is %d", - check_msg->apc[6].pcv[10]); - ck_assert_msg(check_msg->apc[6].pcv[11] == -76, - "incorrect value for apc[6].pcv[11], expected -76, is %d", - check_msg->apc[6].pcv[11]); - ck_assert_msg(check_msg->apc[6].pcv[12] == 41, - "incorrect value for apc[6].pcv[12], expected 41, is %d", - check_msg->apc[6].pcv[12]); - ck_assert_msg(check_msg->apc[6].pcv[13] == -60, - "incorrect value for apc[6].pcv[13], expected -60, is %d", - check_msg->apc[6].pcv[13]); - ck_assert_msg(check_msg->apc[6].pcv[14] == 40, - "incorrect value for apc[6].pcv[14], expected 40, is %d", - check_msg->apc[6].pcv[14]); - ck_assert_msg(check_msg->apc[6].pcv[15] == 119, - "incorrect value for apc[6].pcv[15], expected 119, is %d", - check_msg->apc[6].pcv[15]); - ck_assert_msg(check_msg->apc[6].pcv[16] == 101, - "incorrect value for apc[6].pcv[16], expected 101, is %d", - check_msg->apc[6].pcv[16]); - ck_assert_msg(check_msg->apc[6].pcv[17] == -4, - "incorrect value for apc[6].pcv[17], expected -4, is %d", - check_msg->apc[6].pcv[17]); - ck_assert_msg(check_msg->apc[6].pcv[18] == -33, - "incorrect value for apc[6].pcv[18], expected -33, is %d", - check_msg->apc[6].pcv[18]); - ck_assert_msg(check_msg->apc[6].pcv[19] == -112, - "incorrect value for apc[6].pcv[19], expected -112, is %d", - check_msg->apc[6].pcv[19]); - ck_assert_msg(check_msg->apc[6].pcv[20] == -103, - "incorrect value for apc[6].pcv[20], expected -103, is %d", - check_msg->apc[6].pcv[20]); - ck_assert_msg(check_msg->apc[6].sat_info == 7, - "incorrect value for apc[6].sat_info, expected 7, is %d", - check_msg->apc[6].sat_info); - ck_assert_msg(check_msg->apc[6].sid.code == 158, - "incorrect value for apc[6].sid.code, expected 158, is %d", - check_msg->apc[6].sid.code); - ck_assert_msg(check_msg->apc[6].sid.sat == 200, - "incorrect value for apc[6].sid.sat, expected 200, is %d", - check_msg->apc[6].sid.sat); - ck_assert_msg(check_msg->apc[6].svn == 17310, - "incorrect value for apc[6].svn, expected 17310, is %d", - check_msg->apc[6].svn); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrSatelliteApcDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_ssr_MsgSsrSatelliteApcDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_MsgSsrSatelliteApcDepA"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_ssr_MsgSsrSatelliteApcDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrStecCorrection.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrStecCorrection.c deleted file mode 100644 index 146104a186..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrStecCorrection.c +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrStecCorrection.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrStecCorrection) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 1533, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 1533, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 253, 5, 66, 0, 38, 180, 0, 0, 0, 3, 0, 1, 1, 10, 0, - 15, 1, 0, 10, 0, 2, 1, 1, 1, 63, 0, 62, 0, 61, 0, 60, - 0, 31, 15, 5, 63, 0, 64, 0, 65, 0, 66, 0, 119, 50, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_stec_correction_t *test_msg = - (msg_ssr_stec_correction_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.num_msgs = 1; - test_msg->header.seq_num = 1; - test_msg->header.sol_id = 0; - test_msg->header.time.tow = 180; - test_msg->header.time.wn = 3; - test_msg->header.update_interval = 10; - test_msg->n_sats = 2; - test_msg->ssr_iod_atmo = 15; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0].stec_coeff[0]); - } - test_msg->stec_sat_list[0].stec_coeff[0] = 63; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0].stec_coeff[0]); - } - test_msg->stec_sat_list[0].stec_coeff[1] = 62; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0].stec_coeff[0]); - } - test_msg->stec_sat_list[0].stec_coeff[2] = 61; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0].stec_coeff[0]); - } - test_msg->stec_sat_list[0].stec_coeff[3] = 60; - test_msg->stec_sat_list[0].stec_quality_indicator = 1; - test_msg->stec_sat_list[0].sv_id.constellation = 1; - test_msg->stec_sat_list[0].sv_id.satId = 1; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[1].stec_coeff[0]); - } - test_msg->stec_sat_list[1].stec_coeff[0] = 63; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[1].stec_coeff[0]); - } - test_msg->stec_sat_list[1].stec_coeff[1] = 64; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[1].stec_coeff[0]); - } - test_msg->stec_sat_list[1].stec_coeff[2] = 65; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[1].stec_coeff[0]); - } - test_msg->stec_sat_list[1].stec_coeff[3] = 66; - test_msg->stec_sat_list[1].stec_quality_indicator = 5; - test_msg->stec_sat_list[1].sv_id.constellation = 15; - test_msg->stec_sat_list[1].sv_id.satId = 31; - test_msg->tile_id = 10; - test_msg->tile_set_id = 1; - sbp_payload_send(&sbp_state, 1533, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 1533, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_stec_correction_t *check_msg = - (msg_ssr_stec_correction_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.num_msgs == 1, - "incorrect value for header.num_msgs, expected 1, is %d", - check_msg->header.num_msgs); - ck_assert_msg(check_msg->header.seq_num == 1, - "incorrect value for header.seq_num, expected 1, is %d", - check_msg->header.seq_num); - ck_assert_msg(check_msg->header.sol_id == 0, - "incorrect value for header.sol_id, expected 0, is %d", - check_msg->header.sol_id); - ck_assert_msg(check_msg->header.time.tow == 180, - "incorrect value for header.time.tow, expected 180, is %d", - check_msg->header.time.tow); - ck_assert_msg(check_msg->header.time.wn == 3, - "incorrect value for header.time.wn, expected 3, is %d", - check_msg->header.time.wn); - ck_assert_msg( - check_msg->header.update_interval == 10, - "incorrect value for header.update_interval, expected 10, is %d", - check_msg->header.update_interval); - ck_assert_msg(check_msg->n_sats == 2, - "incorrect value for n_sats, expected 2, is %d", - check_msg->n_sats); - ck_assert_msg(check_msg->ssr_iod_atmo == 15, - "incorrect value for ssr_iod_atmo, expected 15, is %d", - check_msg->ssr_iod_atmo); - ck_assert_msg(check_msg->stec_sat_list[0].stec_coeff[0] == 63, - "incorrect value for stec_sat_list[0].stec_coeff[0], " - "expected 63, is %d", - check_msg->stec_sat_list[0].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[0].stec_coeff[1] == 62, - "incorrect value for stec_sat_list[0].stec_coeff[1], " - "expected 62, is %d", - check_msg->stec_sat_list[0].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[0].stec_coeff[2] == 61, - "incorrect value for stec_sat_list[0].stec_coeff[2], " - "expected 61, is %d", - check_msg->stec_sat_list[0].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[0].stec_coeff[3] == 60, - "incorrect value for stec_sat_list[0].stec_coeff[3], " - "expected 60, is %d", - check_msg->stec_sat_list[0].stec_coeff[3]); - ck_assert_msg(check_msg->stec_sat_list[0].stec_quality_indicator == 1, - "incorrect value for " - "stec_sat_list[0].stec_quality_indicator, expected 1, is %d", - check_msg->stec_sat_list[0].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[0].sv_id.constellation == 1, - "incorrect value for stec_sat_list[0].sv_id.constellation, " - "expected 1, is %d", - check_msg->stec_sat_list[0].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[0].sv_id.satId == 1, - "incorrect value for stec_sat_list[0].sv_id.satId, expected 1, is %d", - check_msg->stec_sat_list[0].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[1].stec_coeff[0] == 63, - "incorrect value for stec_sat_list[1].stec_coeff[0], " - "expected 63, is %d", - check_msg->stec_sat_list[1].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[1].stec_coeff[1] == 64, - "incorrect value for stec_sat_list[1].stec_coeff[1], " - "expected 64, is %d", - check_msg->stec_sat_list[1].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[1].stec_coeff[2] == 65, - "incorrect value for stec_sat_list[1].stec_coeff[2], " - "expected 65, is %d", - check_msg->stec_sat_list[1].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[1].stec_coeff[3] == 66, - "incorrect value for stec_sat_list[1].stec_coeff[3], " - "expected 66, is %d", - check_msg->stec_sat_list[1].stec_coeff[3]); - ck_assert_msg(check_msg->stec_sat_list[1].stec_quality_indicator == 5, - "incorrect value for " - "stec_sat_list[1].stec_quality_indicator, expected 5, is %d", - check_msg->stec_sat_list[1].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[1].sv_id.constellation == 15, - "incorrect value for stec_sat_list[1].sv_id.constellation, " - "expected 15, is %d", - check_msg->stec_sat_list[1].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[1].sv_id.satId == 31, - "incorrect value for stec_sat_list[1].sv_id.satId, expected 31, is %d", - check_msg->stec_sat_list[1].sv_id.satId); - ck_assert_msg(check_msg->tile_id == 10, - "incorrect value for tile_id, expected 10, is %d", - check_msg->tile_id); - ck_assert_msg(check_msg->tile_set_id == 1, - "incorrect value for tile_set_id, expected 1, is %d", - check_msg->tile_set_id); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrStecCorrection_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_ssr_MsgSsrStecCorrection"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_MsgSsrStecCorrection"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_ssr_MsgSsrStecCorrection); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrStecCorrectionDep.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrStecCorrectionDep.c deleted file mode 100644 index 08c4c63d30..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrStecCorrectionDep.c +++ /dev/null @@ -1,1438 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrStecCorrectionDep.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDep) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x5fb, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x5fb, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 251, 5, 204, 151, 245, 158, 228, 114, 117, 50, 158, 156, 42, - 119, 156, 157, 112, 47, 60, 132, 40, 70, 87, 235, 83, 177, 198, - 3, 14, 8, 70, 12, 44, 53, 181, 90, 174, 247, 150, 58, 172, - 247, 179, 119, 176, 125, 4, 177, 229, 113, 14, 77, 153, 185, 23, - 53, 222, 187, 146, 250, 91, 212, 215, 14, 107, 250, 94, 107, 33, - 91, 234, 0, 213, 139, 95, 179, 50, 21, 74, 174, 169, 61, 86, - 91, 142, 51, 108, 9, 38, 225, 146, 101, 73, 139, 56, 117, 82, - 37, 213, 108, 205, 93, 18, 19, 195, 33, 202, 87, 206, 178, 125, - 188, 119, 56, 69, 150, 150, 76, 3, 131, 18, 73, 208, 72, 232, - 8, 250, 203, 178, 170, 163, 252, 86, 49, 247, 178, 166, 56, 31, - 10, 119, 213, 241, 212, 164, 1, 162, 42, 18, 124, 169, 121, 158, - 26, 56, 23, 142, 125, 40, 120, 67, 45, 126, 235, 110, 23, 12, - 241, 88, 69, 239, 252, 57, 93, 44, 201, 216, 173, 242, 178, 17, - 5, 223, 169, 192, 3, 77, 107, 2, 144, 233, 14, 88, 32, 209, - 1, 17, 123, 155, 41, 183, 244, 158, 82, 53, 103, 14, 202, 185, - 35, 181, 21, 118, 254, 250, 50, 184, 50, 31, 45, 56, 163, 177, - 126, 217, 79, 171, 239, 237, 188, 238, 112, 201, 118, 141, 18, 163, - 103, 35, 63, 21, 82, 129, 18, 117, 85, 190, 79, 210, 215, 227, - 177, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_stec_correction_dep_t *test_msg = - (msg_ssr_stec_correction_dep_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.iod_atmo = 60; - test_msg->header.num_msgs = 157; - test_msg->header.seq_num = 112; - test_msg->header.tile_id = 30066; - test_msg->header.tile_set_id = 58526; - test_msg->header.time.tow = 714907186; - test_msg->header.time.wn = 40055; - test_msg->header.update_interval = 47; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0].stec_coeff[0]); - } - test_msg->stec_sat_list[0].stec_coeff[0] = -5289; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0].stec_coeff[0]); - } - test_msg->stec_sat_list[0].stec_coeff[1] = -20141; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0].stec_coeff[0]); - } - test_msg->stec_sat_list[0].stec_coeff[2] = 966; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0].stec_coeff[0]); - } - test_msg->stec_sat_list[0].stec_coeff[3] = 2062; - test_msg->stec_sat_list[0].stec_quality_indicator = 70; - test_msg->stec_sat_list[0].sv_id.constellation = 40; - test_msg->stec_sat_list[0].sv_id.satId = 132; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[1].stec_coeff[0]); - } - test_msg->stec_sat_list[1].stec_coeff[0] = -19147; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[1].stec_coeff[0]); - } - test_msg->stec_sat_list[1].stec_coeff[1] = -20902; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[1].stec_coeff[0]); - } - test_msg->stec_sat_list[1].stec_coeff[2] = -26889; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[1].stec_coeff[0]); - } - test_msg->stec_sat_list[1].stec_coeff[3] = -21446; - test_msg->stec_sat_list[1].stec_quality_indicator = 44; - test_msg->stec_sat_list[1].sv_id.constellation = 12; - test_msg->stec_sat_list[1].sv_id.satId = 70; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[2].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[2].stec_coeff[0]); - } - test_msg->stec_sat_list[2].stec_coeff[0] = 32176; - if (sizeof(test_msg->stec_sat_list[2].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[2].stec_coeff[0]); - } - test_msg->stec_sat_list[2].stec_coeff[1] = -20220; - if (sizeof(test_msg->stec_sat_list[2].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[2].stec_coeff[0]); - } - test_msg->stec_sat_list[2].stec_coeff[2] = 29157; - if (sizeof(test_msg->stec_sat_list[2].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[2].stec_coeff[0]); - } - test_msg->stec_sat_list[2].stec_coeff[3] = 19726; - test_msg->stec_sat_list[2].stec_quality_indicator = 119; - test_msg->stec_sat_list[2].sv_id.constellation = 179; - test_msg->stec_sat_list[2].sv_id.satId = 247; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[3].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[3].stec_coeff[0]); - } - test_msg->stec_sat_list[3].stec_coeff[0] = -8651; - if (sizeof(test_msg->stec_sat_list[3].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[3].stec_coeff[0]); - } - test_msg->stec_sat_list[3].stec_coeff[1] = -27973; - if (sizeof(test_msg->stec_sat_list[3].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[3].stec_coeff[0]); - } - test_msg->stec_sat_list[3].stec_coeff[2] = 23546; - if (sizeof(test_msg->stec_sat_list[3].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[3].stec_coeff[0]); - } - test_msg->stec_sat_list[3].stec_coeff[3] = -10284; - test_msg->stec_sat_list[3].stec_quality_indicator = 23; - test_msg->stec_sat_list[3].sv_id.constellation = 185; - test_msg->stec_sat_list[3].sv_id.satId = 153; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[4].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[4].stec_coeff[0]); - } - test_msg->stec_sat_list[4].stec_coeff[0] = 27486; - if (sizeof(test_msg->stec_sat_list[4].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[4].stec_coeff[0]); - } - test_msg->stec_sat_list[4].stec_coeff[1] = 23329; - if (sizeof(test_msg->stec_sat_list[4].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[4].stec_coeff[0]); - } - test_msg->stec_sat_list[4].stec_coeff[2] = 234; - if (sizeof(test_msg->stec_sat_list[4].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[4].stec_coeff[0]); - } - test_msg->stec_sat_list[4].stec_coeff[3] = -29739; - test_msg->stec_sat_list[4].stec_quality_indicator = 250; - test_msg->stec_sat_list[4].sv_id.constellation = 107; - test_msg->stec_sat_list[4].sv_id.satId = 14; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[5].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[5].stec_coeff[0]); - } - test_msg->stec_sat_list[5].stec_coeff[0] = 18965; - if (sizeof(test_msg->stec_sat_list[5].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[5].stec_coeff[0]); - } - test_msg->stec_sat_list[5].stec_coeff[1] = -22098; - if (sizeof(test_msg->stec_sat_list[5].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[5].stec_coeff[0]); - } - test_msg->stec_sat_list[5].stec_coeff[2] = 22077; - if (sizeof(test_msg->stec_sat_list[5].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[5].stec_coeff[0]); - } - test_msg->stec_sat_list[5].stec_coeff[3] = -29093; - test_msg->stec_sat_list[5].stec_quality_indicator = 50; - test_msg->stec_sat_list[5].sv_id.constellation = 179; - test_msg->stec_sat_list[5].sv_id.satId = 95; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[6].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[6].stec_coeff[0]); - } - test_msg->stec_sat_list[6].stec_coeff[0] = -7898; - if (sizeof(test_msg->stec_sat_list[6].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[6].stec_coeff[0]); - } - test_msg->stec_sat_list[6].stec_coeff[1] = 26002; - if (sizeof(test_msg->stec_sat_list[6].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[6].stec_coeff[0]); - } - test_msg->stec_sat_list[6].stec_coeff[2] = -29879; - if (sizeof(test_msg->stec_sat_list[6].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[6].stec_coeff[0]); - } - test_msg->stec_sat_list[6].stec_coeff[3] = 30008; - test_msg->stec_sat_list[6].stec_quality_indicator = 9; - test_msg->stec_sat_list[6].sv_id.constellation = 108; - test_msg->stec_sat_list[6].sv_id.satId = 51; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[7].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[7].stec_coeff[0]); - } - test_msg->stec_sat_list[7].stec_coeff[0] = -12948; - if (sizeof(test_msg->stec_sat_list[7].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[7].stec_coeff[0]); - } - test_msg->stec_sat_list[7].stec_coeff[1] = 4701; - if (sizeof(test_msg->stec_sat_list[7].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[7].stec_coeff[0]); - } - test_msg->stec_sat_list[7].stec_coeff[2] = -15597; - if (sizeof(test_msg->stec_sat_list[7].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[7].stec_coeff[0]); - } - test_msg->stec_sat_list[7].stec_coeff[3] = -13791; - test_msg->stec_sat_list[7].stec_quality_indicator = 213; - test_msg->stec_sat_list[7].sv_id.constellation = 37; - test_msg->stec_sat_list[7].sv_id.satId = 82; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[8].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[8].stec_coeff[0]); - } - test_msg->stec_sat_list[8].stec_coeff[0] = -17283; - if (sizeof(test_msg->stec_sat_list[8].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[8].stec_coeff[0]); - } - test_msg->stec_sat_list[8].stec_coeff[1] = 14455; - if (sizeof(test_msg->stec_sat_list[8].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[8].stec_coeff[0]); - } - test_msg->stec_sat_list[8].stec_coeff[2] = -27067; - if (sizeof(test_msg->stec_sat_list[8].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[8].stec_coeff[0]); - } - test_msg->stec_sat_list[8].stec_coeff[3] = 19606; - test_msg->stec_sat_list[8].stec_quality_indicator = 178; - test_msg->stec_sat_list[8].sv_id.constellation = 206; - test_msg->stec_sat_list[8].sv_id.satId = 87; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[9].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[9].stec_coeff[0]); - } - test_msg->stec_sat_list[9].stec_coeff[0] = -12215; - if (sizeof(test_msg->stec_sat_list[9].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[9].stec_coeff[0]); - } - test_msg->stec_sat_list[9].stec_coeff[1] = -6072; - if (sizeof(test_msg->stec_sat_list[9].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[9].stec_coeff[0]); - } - test_msg->stec_sat_list[9].stec_coeff[2] = -1528; - if (sizeof(test_msg->stec_sat_list[9].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[9].stec_coeff[0]); - } - test_msg->stec_sat_list[9].stec_coeff[3] = -19765; - test_msg->stec_sat_list[9].stec_quality_indicator = 18; - test_msg->stec_sat_list[9].sv_id.constellation = 131; - test_msg->stec_sat_list[9].sv_id.satId = 3; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[10].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[10].stec_coeff[0]); - } - test_msg->stec_sat_list[10].stec_coeff[0] = 12630; - if (sizeof(test_msg->stec_sat_list[10].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[10].stec_coeff[0]); - } - test_msg->stec_sat_list[10].stec_coeff[1] = -19721; - if (sizeof(test_msg->stec_sat_list[10].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[10].stec_coeff[0]); - } - test_msg->stec_sat_list[10].stec_coeff[2] = 14502; - if (sizeof(test_msg->stec_sat_list[10].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[10].stec_coeff[0]); - } - test_msg->stec_sat_list[10].stec_coeff[3] = 2591; - test_msg->stec_sat_list[10].stec_quality_indicator = 252; - test_msg->stec_sat_list[10].sv_id.constellation = 163; - test_msg->stec_sat_list[10].sv_id.satId = 170; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[11].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[11].stec_coeff[0]); - } - test_msg->stec_sat_list[11].stec_coeff[0] = -23340; - if (sizeof(test_msg->stec_sat_list[11].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[11].stec_coeff[0]); - } - test_msg->stec_sat_list[11].stec_coeff[1] = -24063; - if (sizeof(test_msg->stec_sat_list[11].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[11].stec_coeff[0]); - } - test_msg->stec_sat_list[11].stec_coeff[2] = 4650; - if (sizeof(test_msg->stec_sat_list[11].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[11].stec_coeff[0]); - } - test_msg->stec_sat_list[11].stec_coeff[3] = -22148; - test_msg->stec_sat_list[11].stec_quality_indicator = 241; - test_msg->stec_sat_list[11].sv_id.constellation = 213; - test_msg->stec_sat_list[11].sv_id.satId = 119; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[12].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[12].stec_coeff[0]); - } - test_msg->stec_sat_list[12].stec_coeff[0] = 5944; - if (sizeof(test_msg->stec_sat_list[12].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[12].stec_coeff[0]); - } - test_msg->stec_sat_list[12].stec_coeff[1] = 32142; - if (sizeof(test_msg->stec_sat_list[12].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[12].stec_coeff[0]); - } - test_msg->stec_sat_list[12].stec_coeff[2] = 30760; - if (sizeof(test_msg->stec_sat_list[12].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[12].stec_coeff[0]); - } - test_msg->stec_sat_list[12].stec_coeff[3] = 11587; - test_msg->stec_sat_list[12].stec_quality_indicator = 26; - test_msg->stec_sat_list[12].sv_id.constellation = 158; - test_msg->stec_sat_list[12].sv_id.satId = 121; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[13].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[13].stec_coeff[0]); - } - test_msg->stec_sat_list[13].stec_coeff[0] = 3095; - if (sizeof(test_msg->stec_sat_list[13].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[13].stec_coeff[0]); - } - test_msg->stec_sat_list[13].stec_coeff[1] = 22769; - if (sizeof(test_msg->stec_sat_list[13].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[13].stec_coeff[0]); - } - test_msg->stec_sat_list[13].stec_coeff[2] = -4283; - if (sizeof(test_msg->stec_sat_list[13].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[13].stec_coeff[0]); - } - test_msg->stec_sat_list[13].stec_coeff[3] = 14844; - test_msg->stec_sat_list[13].stec_quality_indicator = 110; - test_msg->stec_sat_list[13].sv_id.constellation = 235; - test_msg->stec_sat_list[13].sv_id.satId = 126; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[14].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[14].stec_coeff[0]); - } - test_msg->stec_sat_list[14].stec_coeff[0] = -21032; - if (sizeof(test_msg->stec_sat_list[14].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[14].stec_coeff[0]); - } - test_msg->stec_sat_list[14].stec_coeff[1] = -19726; - if (sizeof(test_msg->stec_sat_list[14].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[14].stec_coeff[0]); - } - test_msg->stec_sat_list[14].stec_coeff[2] = 1297; - if (sizeof(test_msg->stec_sat_list[14].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[14].stec_coeff[0]); - } - test_msg->stec_sat_list[14].stec_coeff[3] = -22049; - test_msg->stec_sat_list[14].stec_quality_indicator = 201; - test_msg->stec_sat_list[14].sv_id.constellation = 44; - test_msg->stec_sat_list[14].sv_id.satId = 93; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[15].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[15].stec_coeff[0]); - } - test_msg->stec_sat_list[15].stec_coeff[0] = 619; - if (sizeof(test_msg->stec_sat_list[15].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[15].stec_coeff[0]); - } - test_msg->stec_sat_list[15].stec_coeff[1] = -5744; - if (sizeof(test_msg->stec_sat_list[15].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[15].stec_coeff[0]); - } - test_msg->stec_sat_list[15].stec_coeff[2] = 22542; - if (sizeof(test_msg->stec_sat_list[15].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[15].stec_coeff[0]); - } - test_msg->stec_sat_list[15].stec_coeff[3] = -12000; - test_msg->stec_sat_list[15].stec_quality_indicator = 77; - test_msg->stec_sat_list[15].sv_id.constellation = 3; - test_msg->stec_sat_list[15].sv_id.satId = 192; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[16].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[16].stec_coeff[0]); - } - test_msg->stec_sat_list[16].stec_coeff[0] = 10651; - if (sizeof(test_msg->stec_sat_list[16].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[16].stec_coeff[0]); - } - test_msg->stec_sat_list[16].stec_coeff[1] = -2889; - if (sizeof(test_msg->stec_sat_list[16].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[16].stec_coeff[0]); - } - test_msg->stec_sat_list[16].stec_coeff[2] = 21150; - if (sizeof(test_msg->stec_sat_list[16].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[16].stec_coeff[0]); - } - test_msg->stec_sat_list[16].stec_coeff[3] = 26421; - test_msg->stec_sat_list[16].stec_quality_indicator = 123; - test_msg->stec_sat_list[16].sv_id.constellation = 17; - test_msg->stec_sat_list[16].sv_id.satId = 1; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[17].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[17].stec_coeff[0]); - } - test_msg->stec_sat_list[17].stec_coeff[0] = -19165; - if (sizeof(test_msg->stec_sat_list[17].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[17].stec_coeff[0]); - } - test_msg->stec_sat_list[17].stec_coeff[1] = 30229; - if (sizeof(test_msg->stec_sat_list[17].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[17].stec_coeff[0]); - } - test_msg->stec_sat_list[17].stec_coeff[2] = -1282; - if (sizeof(test_msg->stec_sat_list[17].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[17].stec_coeff[0]); - } - test_msg->stec_sat_list[17].stec_coeff[3] = -18382; - test_msg->stec_sat_list[17].stec_quality_indicator = 185; - test_msg->stec_sat_list[17].sv_id.constellation = 202; - test_msg->stec_sat_list[17].sv_id.satId = 14; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[18].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[18].stec_coeff[0]); - } - test_msg->stec_sat_list[18].stec_coeff[0] = -23752; - if (sizeof(test_msg->stec_sat_list[18].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[18].stec_coeff[0]); - } - test_msg->stec_sat_list[18].stec_coeff[1] = 32433; - if (sizeof(test_msg->stec_sat_list[18].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[18].stec_coeff[0]); - } - test_msg->stec_sat_list[18].stec_coeff[2] = 20441; - if (sizeof(test_msg->stec_sat_list[18].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[18].stec_coeff[0]); - } - test_msg->stec_sat_list[18].stec_coeff[3] = -4181; - test_msg->stec_sat_list[18].stec_quality_indicator = 45; - test_msg->stec_sat_list[18].sv_id.constellation = 31; - test_msg->stec_sat_list[18].sv_id.satId = 50; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[19].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[19].stec_coeff[0]); - } - test_msg->stec_sat_list[19].stec_coeff[0] = -13968; - if (sizeof(test_msg->stec_sat_list[19].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[19].stec_coeff[0]); - } - test_msg->stec_sat_list[19].stec_coeff[1] = -29322; - if (sizeof(test_msg->stec_sat_list[19].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[19].stec_coeff[0]); - } - test_msg->stec_sat_list[19].stec_coeff[2] = -23790; - if (sizeof(test_msg->stec_sat_list[19].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[19].stec_coeff[0]); - } - test_msg->stec_sat_list[19].stec_coeff[3] = 9063; - test_msg->stec_sat_list[19].stec_quality_indicator = 238; - test_msg->stec_sat_list[19].sv_id.constellation = 188; - test_msg->stec_sat_list[19].sv_id.satId = 237; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[20].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[20].stec_coeff[0]); - } - test_msg->stec_sat_list[20].stec_coeff[0] = 4737; - if (sizeof(test_msg->stec_sat_list[20].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[20].stec_coeff[0]); - } - test_msg->stec_sat_list[20].stec_coeff[1] = 21877; - if (sizeof(test_msg->stec_sat_list[20].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[20].stec_coeff[0]); - } - test_msg->stec_sat_list[20].stec_coeff[2] = 20414; - if (sizeof(test_msg->stec_sat_list[20].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[20].stec_coeff[0]); - } - test_msg->stec_sat_list[20].stec_coeff[3] = -10286; - test_msg->stec_sat_list[20].stec_quality_indicator = 82; - test_msg->stec_sat_list[20].sv_id.constellation = 21; - test_msg->stec_sat_list[20].sv_id.satId = 63; - sbp_payload_send(&sbp_state, 0x5fb, 38860, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 38860, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 38860, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x5fb, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_stec_correction_dep_t *check_msg = - (msg_ssr_stec_correction_dep_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.iod_atmo == 60, - "incorrect value for header.iod_atmo, expected 60, is %d", - check_msg->header.iod_atmo); - ck_assert_msg(check_msg->header.num_msgs == 157, - "incorrect value for header.num_msgs, expected 157, is %d", - check_msg->header.num_msgs); - ck_assert_msg(check_msg->header.seq_num == 112, - "incorrect value for header.seq_num, expected 112, is %d", - check_msg->header.seq_num); - ck_assert_msg(check_msg->header.tile_id == 30066, - "incorrect value for header.tile_id, expected 30066, is %d", - check_msg->header.tile_id); - ck_assert_msg( - check_msg->header.tile_set_id == 58526, - "incorrect value for header.tile_set_id, expected 58526, is %d", - check_msg->header.tile_set_id); - ck_assert_msg( - check_msg->header.time.tow == 714907186, - "incorrect value for header.time.tow, expected 714907186, is %d", - check_msg->header.time.tow); - ck_assert_msg(check_msg->header.time.wn == 40055, - "incorrect value for header.time.wn, expected 40055, is %d", - check_msg->header.time.wn); - ck_assert_msg( - check_msg->header.update_interval == 47, - "incorrect value for header.update_interval, expected 47, is %d", - check_msg->header.update_interval); - ck_assert_msg(check_msg->stec_sat_list[0].stec_coeff[0] == -5289, - "incorrect value for stec_sat_list[0].stec_coeff[0], " - "expected -5289, is %d", - check_msg->stec_sat_list[0].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[0].stec_coeff[1] == -20141, - "incorrect value for stec_sat_list[0].stec_coeff[1], " - "expected -20141, is %d", - check_msg->stec_sat_list[0].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[0].stec_coeff[2] == 966, - "incorrect value for stec_sat_list[0].stec_coeff[2], " - "expected 966, is %d", - check_msg->stec_sat_list[0].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[0].stec_coeff[3] == 2062, - "incorrect value for stec_sat_list[0].stec_coeff[3], " - "expected 2062, is %d", - check_msg->stec_sat_list[0].stec_coeff[3]); - ck_assert_msg(check_msg->stec_sat_list[0].stec_quality_indicator == 70, - "incorrect value for " - "stec_sat_list[0].stec_quality_indicator, expected 70, is %d", - check_msg->stec_sat_list[0].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[0].sv_id.constellation == 40, - "incorrect value for stec_sat_list[0].sv_id.constellation, " - "expected 40, is %d", - check_msg->stec_sat_list[0].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[0].sv_id.satId == 132, - "incorrect value for stec_sat_list[0].sv_id.satId, expected 132, is %d", - check_msg->stec_sat_list[0].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[1].stec_coeff[0] == -19147, - "incorrect value for stec_sat_list[1].stec_coeff[0], " - "expected -19147, is %d", - check_msg->stec_sat_list[1].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[1].stec_coeff[1] == -20902, - "incorrect value for stec_sat_list[1].stec_coeff[1], " - "expected -20902, is %d", - check_msg->stec_sat_list[1].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[1].stec_coeff[2] == -26889, - "incorrect value for stec_sat_list[1].stec_coeff[2], " - "expected -26889, is %d", - check_msg->stec_sat_list[1].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[1].stec_coeff[3] == -21446, - "incorrect value for stec_sat_list[1].stec_coeff[3], " - "expected -21446, is %d", - check_msg->stec_sat_list[1].stec_coeff[3]); - ck_assert_msg(check_msg->stec_sat_list[1].stec_quality_indicator == 44, - "incorrect value for " - "stec_sat_list[1].stec_quality_indicator, expected 44, is %d", - check_msg->stec_sat_list[1].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[1].sv_id.constellation == 12, - "incorrect value for stec_sat_list[1].sv_id.constellation, " - "expected 12, is %d", - check_msg->stec_sat_list[1].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[1].sv_id.satId == 70, - "incorrect value for stec_sat_list[1].sv_id.satId, expected 70, is %d", - check_msg->stec_sat_list[1].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[2].stec_coeff[0] == 32176, - "incorrect value for stec_sat_list[2].stec_coeff[0], " - "expected 32176, is %d", - check_msg->stec_sat_list[2].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[2].stec_coeff[1] == -20220, - "incorrect value for stec_sat_list[2].stec_coeff[1], " - "expected -20220, is %d", - check_msg->stec_sat_list[2].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[2].stec_coeff[2] == 29157, - "incorrect value for stec_sat_list[2].stec_coeff[2], " - "expected 29157, is %d", - check_msg->stec_sat_list[2].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[2].stec_coeff[3] == 19726, - "incorrect value for stec_sat_list[2].stec_coeff[3], " - "expected 19726, is %d", - check_msg->stec_sat_list[2].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[2].stec_quality_indicator == 119, - "incorrect value for stec_sat_list[2].stec_quality_indicator, expected " - "119, is %d", - check_msg->stec_sat_list[2].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[2].sv_id.constellation == 179, - "incorrect value for stec_sat_list[2].sv_id.constellation, " - "expected 179, is %d", - check_msg->stec_sat_list[2].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[2].sv_id.satId == 247, - "incorrect value for stec_sat_list[2].sv_id.satId, expected 247, is %d", - check_msg->stec_sat_list[2].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[3].stec_coeff[0] == -8651, - "incorrect value for stec_sat_list[3].stec_coeff[0], " - "expected -8651, is %d", - check_msg->stec_sat_list[3].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[3].stec_coeff[1] == -27973, - "incorrect value for stec_sat_list[3].stec_coeff[1], " - "expected -27973, is %d", - check_msg->stec_sat_list[3].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[3].stec_coeff[2] == 23546, - "incorrect value for stec_sat_list[3].stec_coeff[2], " - "expected 23546, is %d", - check_msg->stec_sat_list[3].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[3].stec_coeff[3] == -10284, - "incorrect value for stec_sat_list[3].stec_coeff[3], " - "expected -10284, is %d", - check_msg->stec_sat_list[3].stec_coeff[3]); - ck_assert_msg(check_msg->stec_sat_list[3].stec_quality_indicator == 23, - "incorrect value for " - "stec_sat_list[3].stec_quality_indicator, expected 23, is %d", - check_msg->stec_sat_list[3].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[3].sv_id.constellation == 185, - "incorrect value for stec_sat_list[3].sv_id.constellation, " - "expected 185, is %d", - check_msg->stec_sat_list[3].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[3].sv_id.satId == 153, - "incorrect value for stec_sat_list[3].sv_id.satId, expected 153, is %d", - check_msg->stec_sat_list[3].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[4].stec_coeff[0] == 27486, - "incorrect value for stec_sat_list[4].stec_coeff[0], " - "expected 27486, is %d", - check_msg->stec_sat_list[4].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[4].stec_coeff[1] == 23329, - "incorrect value for stec_sat_list[4].stec_coeff[1], " - "expected 23329, is %d", - check_msg->stec_sat_list[4].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[4].stec_coeff[2] == 234, - "incorrect value for stec_sat_list[4].stec_coeff[2], " - "expected 234, is %d", - check_msg->stec_sat_list[4].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[4].stec_coeff[3] == -29739, - "incorrect value for stec_sat_list[4].stec_coeff[3], " - "expected -29739, is %d", - check_msg->stec_sat_list[4].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[4].stec_quality_indicator == 250, - "incorrect value for stec_sat_list[4].stec_quality_indicator, expected " - "250, is %d", - check_msg->stec_sat_list[4].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[4].sv_id.constellation == 107, - "incorrect value for stec_sat_list[4].sv_id.constellation, " - "expected 107, is %d", - check_msg->stec_sat_list[4].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[4].sv_id.satId == 14, - "incorrect value for stec_sat_list[4].sv_id.satId, expected 14, is %d", - check_msg->stec_sat_list[4].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[5].stec_coeff[0] == 18965, - "incorrect value for stec_sat_list[5].stec_coeff[0], " - "expected 18965, is %d", - check_msg->stec_sat_list[5].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[5].stec_coeff[1] == -22098, - "incorrect value for stec_sat_list[5].stec_coeff[1], " - "expected -22098, is %d", - check_msg->stec_sat_list[5].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[5].stec_coeff[2] == 22077, - "incorrect value for stec_sat_list[5].stec_coeff[2], " - "expected 22077, is %d", - check_msg->stec_sat_list[5].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[5].stec_coeff[3] == -29093, - "incorrect value for stec_sat_list[5].stec_coeff[3], " - "expected -29093, is %d", - check_msg->stec_sat_list[5].stec_coeff[3]); - ck_assert_msg(check_msg->stec_sat_list[5].stec_quality_indicator == 50, - "incorrect value for " - "stec_sat_list[5].stec_quality_indicator, expected 50, is %d", - check_msg->stec_sat_list[5].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[5].sv_id.constellation == 179, - "incorrect value for stec_sat_list[5].sv_id.constellation, " - "expected 179, is %d", - check_msg->stec_sat_list[5].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[5].sv_id.satId == 95, - "incorrect value for stec_sat_list[5].sv_id.satId, expected 95, is %d", - check_msg->stec_sat_list[5].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[6].stec_coeff[0] == -7898, - "incorrect value for stec_sat_list[6].stec_coeff[0], " - "expected -7898, is %d", - check_msg->stec_sat_list[6].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[6].stec_coeff[1] == 26002, - "incorrect value for stec_sat_list[6].stec_coeff[1], " - "expected 26002, is %d", - check_msg->stec_sat_list[6].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[6].stec_coeff[2] == -29879, - "incorrect value for stec_sat_list[6].stec_coeff[2], " - "expected -29879, is %d", - check_msg->stec_sat_list[6].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[6].stec_coeff[3] == 30008, - "incorrect value for stec_sat_list[6].stec_coeff[3], " - "expected 30008, is %d", - check_msg->stec_sat_list[6].stec_coeff[3]); - ck_assert_msg(check_msg->stec_sat_list[6].stec_quality_indicator == 9, - "incorrect value for " - "stec_sat_list[6].stec_quality_indicator, expected 9, is %d", - check_msg->stec_sat_list[6].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[6].sv_id.constellation == 108, - "incorrect value for stec_sat_list[6].sv_id.constellation, " - "expected 108, is %d", - check_msg->stec_sat_list[6].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[6].sv_id.satId == 51, - "incorrect value for stec_sat_list[6].sv_id.satId, expected 51, is %d", - check_msg->stec_sat_list[6].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[7].stec_coeff[0] == -12948, - "incorrect value for stec_sat_list[7].stec_coeff[0], " - "expected -12948, is %d", - check_msg->stec_sat_list[7].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[7].stec_coeff[1] == 4701, - "incorrect value for stec_sat_list[7].stec_coeff[1], " - "expected 4701, is %d", - check_msg->stec_sat_list[7].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[7].stec_coeff[2] == -15597, - "incorrect value for stec_sat_list[7].stec_coeff[2], " - "expected -15597, is %d", - check_msg->stec_sat_list[7].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[7].stec_coeff[3] == -13791, - "incorrect value for stec_sat_list[7].stec_coeff[3], " - "expected -13791, is %d", - check_msg->stec_sat_list[7].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[7].stec_quality_indicator == 213, - "incorrect value for stec_sat_list[7].stec_quality_indicator, expected " - "213, is %d", - check_msg->stec_sat_list[7].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[7].sv_id.constellation == 37, - "incorrect value for stec_sat_list[7].sv_id.constellation, " - "expected 37, is %d", - check_msg->stec_sat_list[7].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[7].sv_id.satId == 82, - "incorrect value for stec_sat_list[7].sv_id.satId, expected 82, is %d", - check_msg->stec_sat_list[7].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[8].stec_coeff[0] == -17283, - "incorrect value for stec_sat_list[8].stec_coeff[0], " - "expected -17283, is %d", - check_msg->stec_sat_list[8].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[8].stec_coeff[1] == 14455, - "incorrect value for stec_sat_list[8].stec_coeff[1], " - "expected 14455, is %d", - check_msg->stec_sat_list[8].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[8].stec_coeff[2] == -27067, - "incorrect value for stec_sat_list[8].stec_coeff[2], " - "expected -27067, is %d", - check_msg->stec_sat_list[8].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[8].stec_coeff[3] == 19606, - "incorrect value for stec_sat_list[8].stec_coeff[3], " - "expected 19606, is %d", - check_msg->stec_sat_list[8].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[8].stec_quality_indicator == 178, - "incorrect value for stec_sat_list[8].stec_quality_indicator, expected " - "178, is %d", - check_msg->stec_sat_list[8].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[8].sv_id.constellation == 206, - "incorrect value for stec_sat_list[8].sv_id.constellation, " - "expected 206, is %d", - check_msg->stec_sat_list[8].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[8].sv_id.satId == 87, - "incorrect value for stec_sat_list[8].sv_id.satId, expected 87, is %d", - check_msg->stec_sat_list[8].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[9].stec_coeff[0] == -12215, - "incorrect value for stec_sat_list[9].stec_coeff[0], " - "expected -12215, is %d", - check_msg->stec_sat_list[9].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[9].stec_coeff[1] == -6072, - "incorrect value for stec_sat_list[9].stec_coeff[1], " - "expected -6072, is %d", - check_msg->stec_sat_list[9].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[9].stec_coeff[2] == -1528, - "incorrect value for stec_sat_list[9].stec_coeff[2], " - "expected -1528, is %d", - check_msg->stec_sat_list[9].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[9].stec_coeff[3] == -19765, - "incorrect value for stec_sat_list[9].stec_coeff[3], " - "expected -19765, is %d", - check_msg->stec_sat_list[9].stec_coeff[3]); - ck_assert_msg(check_msg->stec_sat_list[9].stec_quality_indicator == 18, - "incorrect value for " - "stec_sat_list[9].stec_quality_indicator, expected 18, is %d", - check_msg->stec_sat_list[9].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[9].sv_id.constellation == 131, - "incorrect value for stec_sat_list[9].sv_id.constellation, " - "expected 131, is %d", - check_msg->stec_sat_list[9].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[9].sv_id.satId == 3, - "incorrect value for stec_sat_list[9].sv_id.satId, expected 3, is %d", - check_msg->stec_sat_list[9].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[10].stec_coeff[0] == 12630, - "incorrect value for stec_sat_list[10].stec_coeff[0], " - "expected 12630, is %d", - check_msg->stec_sat_list[10].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[10].stec_coeff[1] == -19721, - "incorrect value for stec_sat_list[10].stec_coeff[1], " - "expected -19721, is %d", - check_msg->stec_sat_list[10].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[10].stec_coeff[2] == 14502, - "incorrect value for stec_sat_list[10].stec_coeff[2], " - "expected 14502, is %d", - check_msg->stec_sat_list[10].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[10].stec_coeff[3] == 2591, - "incorrect value for stec_sat_list[10].stec_coeff[3], " - "expected 2591, is %d", - check_msg->stec_sat_list[10].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[10].stec_quality_indicator == 252, - "incorrect value for stec_sat_list[10].stec_quality_indicator, " - "expected 252, is %d", - check_msg->stec_sat_list[10].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[10].sv_id.constellation == 163, - "incorrect value for stec_sat_list[10].sv_id.constellation, " - "expected 163, is %d", - check_msg->stec_sat_list[10].sv_id.constellation); - ck_assert_msg(check_msg->stec_sat_list[10].sv_id.satId == 170, - "incorrect value for stec_sat_list[10].sv_id.satId, expected " - "170, is %d", - check_msg->stec_sat_list[10].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[11].stec_coeff[0] == -23340, - "incorrect value for stec_sat_list[11].stec_coeff[0], " - "expected -23340, is %d", - check_msg->stec_sat_list[11].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[11].stec_coeff[1] == -24063, - "incorrect value for stec_sat_list[11].stec_coeff[1], " - "expected -24063, is %d", - check_msg->stec_sat_list[11].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[11].stec_coeff[2] == 4650, - "incorrect value for stec_sat_list[11].stec_coeff[2], " - "expected 4650, is %d", - check_msg->stec_sat_list[11].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[11].stec_coeff[3] == -22148, - "incorrect value for stec_sat_list[11].stec_coeff[3], " - "expected -22148, is %d", - check_msg->stec_sat_list[11].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[11].stec_quality_indicator == 241, - "incorrect value for stec_sat_list[11].stec_quality_indicator, " - "expected 241, is %d", - check_msg->stec_sat_list[11].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[11].sv_id.constellation == 213, - "incorrect value for stec_sat_list[11].sv_id.constellation, " - "expected 213, is %d", - check_msg->stec_sat_list[11].sv_id.constellation); - ck_assert_msg(check_msg->stec_sat_list[11].sv_id.satId == 119, - "incorrect value for stec_sat_list[11].sv_id.satId, expected " - "119, is %d", - check_msg->stec_sat_list[11].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[12].stec_coeff[0] == 5944, - "incorrect value for stec_sat_list[12].stec_coeff[0], " - "expected 5944, is %d", - check_msg->stec_sat_list[12].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[12].stec_coeff[1] == 32142, - "incorrect value for stec_sat_list[12].stec_coeff[1], " - "expected 32142, is %d", - check_msg->stec_sat_list[12].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[12].stec_coeff[2] == 30760, - "incorrect value for stec_sat_list[12].stec_coeff[2], " - "expected 30760, is %d", - check_msg->stec_sat_list[12].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[12].stec_coeff[3] == 11587, - "incorrect value for stec_sat_list[12].stec_coeff[3], " - "expected 11587, is %d", - check_msg->stec_sat_list[12].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[12].stec_quality_indicator == 26, - "incorrect value for stec_sat_list[12].stec_quality_indicator, " - "expected 26, is %d", - check_msg->stec_sat_list[12].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[12].sv_id.constellation == 158, - "incorrect value for stec_sat_list[12].sv_id.constellation, " - "expected 158, is %d", - check_msg->stec_sat_list[12].sv_id.constellation); - ck_assert_msg(check_msg->stec_sat_list[12].sv_id.satId == 121, - "incorrect value for stec_sat_list[12].sv_id.satId, expected " - "121, is %d", - check_msg->stec_sat_list[12].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[13].stec_coeff[0] == 3095, - "incorrect value for stec_sat_list[13].stec_coeff[0], " - "expected 3095, is %d", - check_msg->stec_sat_list[13].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[13].stec_coeff[1] == 22769, - "incorrect value for stec_sat_list[13].stec_coeff[1], " - "expected 22769, is %d", - check_msg->stec_sat_list[13].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[13].stec_coeff[2] == -4283, - "incorrect value for stec_sat_list[13].stec_coeff[2], " - "expected -4283, is %d", - check_msg->stec_sat_list[13].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[13].stec_coeff[3] == 14844, - "incorrect value for stec_sat_list[13].stec_coeff[3], " - "expected 14844, is %d", - check_msg->stec_sat_list[13].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[13].stec_quality_indicator == 110, - "incorrect value for stec_sat_list[13].stec_quality_indicator, " - "expected 110, is %d", - check_msg->stec_sat_list[13].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[13].sv_id.constellation == 235, - "incorrect value for stec_sat_list[13].sv_id.constellation, " - "expected 235, is %d", - check_msg->stec_sat_list[13].sv_id.constellation); - ck_assert_msg(check_msg->stec_sat_list[13].sv_id.satId == 126, - "incorrect value for stec_sat_list[13].sv_id.satId, expected " - "126, is %d", - check_msg->stec_sat_list[13].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[14].stec_coeff[0] == -21032, - "incorrect value for stec_sat_list[14].stec_coeff[0], " - "expected -21032, is %d", - check_msg->stec_sat_list[14].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[14].stec_coeff[1] == -19726, - "incorrect value for stec_sat_list[14].stec_coeff[1], " - "expected -19726, is %d", - check_msg->stec_sat_list[14].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[14].stec_coeff[2] == 1297, - "incorrect value for stec_sat_list[14].stec_coeff[2], " - "expected 1297, is %d", - check_msg->stec_sat_list[14].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[14].stec_coeff[3] == -22049, - "incorrect value for stec_sat_list[14].stec_coeff[3], " - "expected -22049, is %d", - check_msg->stec_sat_list[14].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[14].stec_quality_indicator == 201, - "incorrect value for stec_sat_list[14].stec_quality_indicator, " - "expected 201, is %d", - check_msg->stec_sat_list[14].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[14].sv_id.constellation == 44, - "incorrect value for stec_sat_list[14].sv_id.constellation, " - "expected 44, is %d", - check_msg->stec_sat_list[14].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[14].sv_id.satId == 93, - "incorrect value for stec_sat_list[14].sv_id.satId, expected 93, is %d", - check_msg->stec_sat_list[14].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[15].stec_coeff[0] == 619, - "incorrect value for stec_sat_list[15].stec_coeff[0], " - "expected 619, is %d", - check_msg->stec_sat_list[15].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[15].stec_coeff[1] == -5744, - "incorrect value for stec_sat_list[15].stec_coeff[1], " - "expected -5744, is %d", - check_msg->stec_sat_list[15].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[15].stec_coeff[2] == 22542, - "incorrect value for stec_sat_list[15].stec_coeff[2], " - "expected 22542, is %d", - check_msg->stec_sat_list[15].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[15].stec_coeff[3] == -12000, - "incorrect value for stec_sat_list[15].stec_coeff[3], " - "expected -12000, is %d", - check_msg->stec_sat_list[15].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[15].stec_quality_indicator == 77, - "incorrect value for stec_sat_list[15].stec_quality_indicator, " - "expected 77, is %d", - check_msg->stec_sat_list[15].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[15].sv_id.constellation == 3, - "incorrect value for stec_sat_list[15].sv_id.constellation, " - "expected 3, is %d", - check_msg->stec_sat_list[15].sv_id.constellation); - ck_assert_msg(check_msg->stec_sat_list[15].sv_id.satId == 192, - "incorrect value for stec_sat_list[15].sv_id.satId, expected " - "192, is %d", - check_msg->stec_sat_list[15].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[16].stec_coeff[0] == 10651, - "incorrect value for stec_sat_list[16].stec_coeff[0], " - "expected 10651, is %d", - check_msg->stec_sat_list[16].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[16].stec_coeff[1] == -2889, - "incorrect value for stec_sat_list[16].stec_coeff[1], " - "expected -2889, is %d", - check_msg->stec_sat_list[16].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[16].stec_coeff[2] == 21150, - "incorrect value for stec_sat_list[16].stec_coeff[2], " - "expected 21150, is %d", - check_msg->stec_sat_list[16].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[16].stec_coeff[3] == 26421, - "incorrect value for stec_sat_list[16].stec_coeff[3], " - "expected 26421, is %d", - check_msg->stec_sat_list[16].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[16].stec_quality_indicator == 123, - "incorrect value for stec_sat_list[16].stec_quality_indicator, " - "expected 123, is %d", - check_msg->stec_sat_list[16].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[16].sv_id.constellation == 17, - "incorrect value for stec_sat_list[16].sv_id.constellation, " - "expected 17, is %d", - check_msg->stec_sat_list[16].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[16].sv_id.satId == 1, - "incorrect value for stec_sat_list[16].sv_id.satId, expected 1, is %d", - check_msg->stec_sat_list[16].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[17].stec_coeff[0] == -19165, - "incorrect value for stec_sat_list[17].stec_coeff[0], " - "expected -19165, is %d", - check_msg->stec_sat_list[17].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[17].stec_coeff[1] == 30229, - "incorrect value for stec_sat_list[17].stec_coeff[1], " - "expected 30229, is %d", - check_msg->stec_sat_list[17].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[17].stec_coeff[2] == -1282, - "incorrect value for stec_sat_list[17].stec_coeff[2], " - "expected -1282, is %d", - check_msg->stec_sat_list[17].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[17].stec_coeff[3] == -18382, - "incorrect value for stec_sat_list[17].stec_coeff[3], " - "expected -18382, is %d", - check_msg->stec_sat_list[17].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[17].stec_quality_indicator == 185, - "incorrect value for stec_sat_list[17].stec_quality_indicator, " - "expected 185, is %d", - check_msg->stec_sat_list[17].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[17].sv_id.constellation == 202, - "incorrect value for stec_sat_list[17].sv_id.constellation, " - "expected 202, is %d", - check_msg->stec_sat_list[17].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[17].sv_id.satId == 14, - "incorrect value for stec_sat_list[17].sv_id.satId, expected 14, is %d", - check_msg->stec_sat_list[17].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[18].stec_coeff[0] == -23752, - "incorrect value for stec_sat_list[18].stec_coeff[0], " - "expected -23752, is %d", - check_msg->stec_sat_list[18].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[18].stec_coeff[1] == 32433, - "incorrect value for stec_sat_list[18].stec_coeff[1], " - "expected 32433, is %d", - check_msg->stec_sat_list[18].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[18].stec_coeff[2] == 20441, - "incorrect value for stec_sat_list[18].stec_coeff[2], " - "expected 20441, is %d", - check_msg->stec_sat_list[18].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[18].stec_coeff[3] == -4181, - "incorrect value for stec_sat_list[18].stec_coeff[3], " - "expected -4181, is %d", - check_msg->stec_sat_list[18].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[18].stec_quality_indicator == 45, - "incorrect value for stec_sat_list[18].stec_quality_indicator, " - "expected 45, is %d", - check_msg->stec_sat_list[18].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[18].sv_id.constellation == 31, - "incorrect value for stec_sat_list[18].sv_id.constellation, " - "expected 31, is %d", - check_msg->stec_sat_list[18].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[18].sv_id.satId == 50, - "incorrect value for stec_sat_list[18].sv_id.satId, expected 50, is %d", - check_msg->stec_sat_list[18].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[19].stec_coeff[0] == -13968, - "incorrect value for stec_sat_list[19].stec_coeff[0], " - "expected -13968, is %d", - check_msg->stec_sat_list[19].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[19].stec_coeff[1] == -29322, - "incorrect value for stec_sat_list[19].stec_coeff[1], " - "expected -29322, is %d", - check_msg->stec_sat_list[19].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[19].stec_coeff[2] == -23790, - "incorrect value for stec_sat_list[19].stec_coeff[2], " - "expected -23790, is %d", - check_msg->stec_sat_list[19].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[19].stec_coeff[3] == 9063, - "incorrect value for stec_sat_list[19].stec_coeff[3], " - "expected 9063, is %d", - check_msg->stec_sat_list[19].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[19].stec_quality_indicator == 238, - "incorrect value for stec_sat_list[19].stec_quality_indicator, " - "expected 238, is %d", - check_msg->stec_sat_list[19].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[19].sv_id.constellation == 188, - "incorrect value for stec_sat_list[19].sv_id.constellation, " - "expected 188, is %d", - check_msg->stec_sat_list[19].sv_id.constellation); - ck_assert_msg(check_msg->stec_sat_list[19].sv_id.satId == 237, - "incorrect value for stec_sat_list[19].sv_id.satId, expected " - "237, is %d", - check_msg->stec_sat_list[19].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[20].stec_coeff[0] == 4737, - "incorrect value for stec_sat_list[20].stec_coeff[0], " - "expected 4737, is %d", - check_msg->stec_sat_list[20].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[20].stec_coeff[1] == 21877, - "incorrect value for stec_sat_list[20].stec_coeff[1], " - "expected 21877, is %d", - check_msg->stec_sat_list[20].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[20].stec_coeff[2] == 20414, - "incorrect value for stec_sat_list[20].stec_coeff[2], " - "expected 20414, is %d", - check_msg->stec_sat_list[20].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[20].stec_coeff[3] == -10286, - "incorrect value for stec_sat_list[20].stec_coeff[3], " - "expected -10286, is %d", - check_msg->stec_sat_list[20].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[20].stec_quality_indicator == 82, - "incorrect value for stec_sat_list[20].stec_quality_indicator, " - "expected 82, is %d", - check_msg->stec_sat_list[20].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[20].sv_id.constellation == 21, - "incorrect value for stec_sat_list[20].sv_id.constellation, " - "expected 21, is %d", - check_msg->stec_sat_list[20].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[20].sv_id.satId == 63, - "incorrect value for stec_sat_list[20].sv_id.satId, expected 63, is %d", - check_msg->stec_sat_list[20].sv_id.satId); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDep_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDep"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDep"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDep); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrStecCorrectionDepA.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrStecCorrectionDepA.c deleted file mode 100644 index 75bb8f5364..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrStecCorrectionDepA.c +++ /dev/null @@ -1,1488 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrStecCorrectionDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x5eb, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x5eb, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 235, 5, 39, 7, 252, 70, 81, 196, 232, 185, 43, 147, 123, - 39, 4, 126, 19, 111, 97, 248, 130, 217, 217, 106, 58, 12, 65, - 230, 171, 81, 95, 86, 16, 39, 84, 228, 208, 201, 81, 219, 99, - 203, 61, 182, 66, 125, 203, 3, 193, 44, 100, 220, 125, 60, 21, - 93, 218, 247, 158, 207, 93, 129, 134, 14, 209, 48, 14, 215, 153, - 148, 147, 72, 225, 180, 236, 205, 201, 33, 3, 246, 204, 19, 3, - 98, 4, 194, 191, 246, 76, 219, 31, 191, 113, 79, 177, 15, 251, - 33, 19, 96, 54, 58, 146, 210, 100, 249, 72, 21, 161, 211, 198, - 21, 238, 111, 107, 36, 227, 225, 213, 3, 71, 243, 63, 65, 236, - 92, 77, 0, 169, 15, 182, 5, 240, 180, 9, 122, 86, 232, 6, - 103, 104, 254, 189, 81, 110, 2, 49, 202, 84, 216, 55, 50, 181, - 5, 123, 80, 49, 244, 224, 188, 125, 164, 230, 56, 66, 124, 168, - 59, 139, 106, 118, 51, 187, 216, 191, 158, 77, 92, 58, 253, 132, - 150, 165, 9, 154, 189, 218, 61, 209, 1, 82, 181, 196, 23, 53, - 182, 112, 192, 206, 167, 157, 244, 35, 1, 189, 217, 61, 88, 97, - 201, 201, 74, 251, 217, 14, 104, 184, 54, 52, 74, 238, 10, 129, - 22, 178, 226, 109, 88, 157, 30, 196, 175, 26, 76, 34, 116, 220, - 154, 232, 12, 179, 244, 15, 155, 196, 202, 72, 70, 115, 10, 214, - 114, 39, 245, 28, 237, 68, 136, 155, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_stec_correction_dep_a_t *test_msg = - (msg_ssr_stec_correction_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->header.iod_atmo = 4; - test_msg->header.num_msgs = 147; - test_msg->header.seq_num = 123; - test_msg->header.time.tow = 3905179974; - test_msg->header.time.wn = 11193; - test_msg->header.update_interval = 39; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0].stec_coeff[0]); - } - test_msg->stec_sat_list[0].stec_coeff[0] = -1951; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0].stec_coeff[0]); - } - test_msg->stec_sat_list[0].stec_coeff[1] = -9854; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0].stec_coeff[0]); - } - test_msg->stec_sat_list[0].stec_coeff[2] = 27353; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0].stec_coeff[0]); - } - test_msg->stec_sat_list[0].stec_coeff[3] = 3130; - test_msg->stec_sat_list[0].stec_quality_indicator = 111; - test_msg->stec_sat_list[0].sv_id.constellation = 19; - test_msg->stec_sat_list[0].sv_id.satId = 126; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[1].stec_coeff[0]); - } - test_msg->stec_sat_list[1].stec_coeff[0] = 24401; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[1].stec_coeff[0]); - } - test_msg->stec_sat_list[1].stec_coeff[1] = 4182; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[1].stec_coeff[0]); - } - test_msg->stec_sat_list[1].stec_coeff[2] = 21543; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[1].stec_coeff[0]); - } - test_msg->stec_sat_list[1].stec_coeff[3] = -12060; - test_msg->stec_sat_list[1].stec_quality_indicator = 171; - test_msg->stec_sat_list[1].sv_id.constellation = 230; - test_msg->stec_sat_list[1].sv_id.satId = 65; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[2].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[2].stec_coeff[0]); - } - test_msg->stec_sat_list[2].stec_coeff[0] = -13469; - if (sizeof(test_msg->stec_sat_list[2].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[2].stec_coeff[0]); - } - test_msg->stec_sat_list[2].stec_coeff[1] = -18883; - if (sizeof(test_msg->stec_sat_list[2].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[2].stec_coeff[0]); - } - test_msg->stec_sat_list[2].stec_coeff[2] = 32066; - if (sizeof(test_msg->stec_sat_list[2].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[2].stec_coeff[0]); - } - test_msg->stec_sat_list[2].stec_coeff[3] = 971; - test_msg->stec_sat_list[2].stec_quality_indicator = 219; - test_msg->stec_sat_list[2].sv_id.constellation = 81; - test_msg->stec_sat_list[2].sv_id.satId = 201; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[3].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[3].stec_coeff[0]); - } - test_msg->stec_sat_list[3].stec_coeff[0] = 32220; - if (sizeof(test_msg->stec_sat_list[3].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[3].stec_coeff[0]); - } - test_msg->stec_sat_list[3].stec_coeff[1] = 5436; - if (sizeof(test_msg->stec_sat_list[3].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[3].stec_coeff[0]); - } - test_msg->stec_sat_list[3].stec_coeff[2] = -9635; - if (sizeof(test_msg->stec_sat_list[3].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[3].stec_coeff[0]); - } - test_msg->stec_sat_list[3].stec_coeff[3] = -24841; - test_msg->stec_sat_list[3].stec_quality_indicator = 100; - test_msg->stec_sat_list[3].sv_id.constellation = 44; - test_msg->stec_sat_list[3].sv_id.satId = 193; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[4].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[4].stec_coeff[0]); - } - test_msg->stec_sat_list[4].stec_coeff[0] = 3718; - if (sizeof(test_msg->stec_sat_list[4].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[4].stec_coeff[0]); - } - test_msg->stec_sat_list[4].stec_coeff[1] = 12497; - if (sizeof(test_msg->stec_sat_list[4].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[4].stec_coeff[0]); - } - test_msg->stec_sat_list[4].stec_coeff[2] = -10482; - if (sizeof(test_msg->stec_sat_list[4].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[4].stec_coeff[0]); - } - test_msg->stec_sat_list[4].stec_coeff[3] = -27495; - test_msg->stec_sat_list[4].stec_quality_indicator = 129; - test_msg->stec_sat_list[4].sv_id.constellation = 93; - test_msg->stec_sat_list[4].sv_id.satId = 207; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[5].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[5].stec_coeff[0]); - } - test_msg->stec_sat_list[5].stec_coeff[0] = -4940; - if (sizeof(test_msg->stec_sat_list[5].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[5].stec_coeff[0]); - } - test_msg->stec_sat_list[5].stec_coeff[1] = -13875; - if (sizeof(test_msg->stec_sat_list[5].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[5].stec_coeff[0]); - } - test_msg->stec_sat_list[5].stec_coeff[2] = 801; - if (sizeof(test_msg->stec_sat_list[5].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[5].stec_coeff[0]); - } - test_msg->stec_sat_list[5].stec_coeff[3] = -13066; - test_msg->stec_sat_list[5].stec_quality_indicator = 225; - test_msg->stec_sat_list[5].sv_id.constellation = 72; - test_msg->stec_sat_list[5].sv_id.satId = 147; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[6].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[6].stec_coeff[0]); - } - test_msg->stec_sat_list[6].stec_coeff[0] = -15868; - if (sizeof(test_msg->stec_sat_list[6].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[6].stec_coeff[0]); - } - test_msg->stec_sat_list[6].stec_coeff[1] = -2369; - if (sizeof(test_msg->stec_sat_list[6].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[6].stec_coeff[0]); - } - test_msg->stec_sat_list[6].stec_coeff[2] = -9396; - if (sizeof(test_msg->stec_sat_list[6].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[6].stec_coeff[0]); - } - test_msg->stec_sat_list[6].stec_coeff[3] = -16609; - test_msg->stec_sat_list[6].stec_quality_indicator = 98; - test_msg->stec_sat_list[6].sv_id.constellation = 3; - test_msg->stec_sat_list[6].sv_id.satId = 19; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[7].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[7].stec_coeff[0]); - } - test_msg->stec_sat_list[7].stec_coeff[0] = -1265; - if (sizeof(test_msg->stec_sat_list[7].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[7].stec_coeff[0]); - } - test_msg->stec_sat_list[7].stec_coeff[1] = 4897; - if (sizeof(test_msg->stec_sat_list[7].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[7].stec_coeff[0]); - } - test_msg->stec_sat_list[7].stec_coeff[2] = 13920; - if (sizeof(test_msg->stec_sat_list[7].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[7].stec_coeff[0]); - } - test_msg->stec_sat_list[7].stec_coeff[3] = -28102; - test_msg->stec_sat_list[7].stec_quality_indicator = 177; - test_msg->stec_sat_list[7].sv_id.constellation = 79; - test_msg->stec_sat_list[7].sv_id.satId = 113; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[8].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[8].stec_coeff[0]); - } - test_msg->stec_sat_list[8].stec_coeff[0] = 5448; - if (sizeof(test_msg->stec_sat_list[8].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[8].stec_coeff[0]); - } - test_msg->stec_sat_list[8].stec_coeff[1] = -11359; - if (sizeof(test_msg->stec_sat_list[8].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[8].stec_coeff[0]); - } - test_msg->stec_sat_list[8].stec_coeff[2] = 5574; - if (sizeof(test_msg->stec_sat_list[8].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[8].stec_coeff[0]); - } - test_msg->stec_sat_list[8].stec_coeff[3] = 28654; - test_msg->stec_sat_list[8].stec_quality_indicator = 249; - test_msg->stec_sat_list[8].sv_id.constellation = 100; - test_msg->stec_sat_list[8].sv_id.satId = 210; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[9].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[9].stec_coeff[0]); - } - test_msg->stec_sat_list[9].stec_coeff[0] = -10783; - if (sizeof(test_msg->stec_sat_list[9].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[9].stec_coeff[0]); - } - test_msg->stec_sat_list[9].stec_coeff[1] = 18179; - if (sizeof(test_msg->stec_sat_list[9].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[9].stec_coeff[0]); - } - test_msg->stec_sat_list[9].stec_coeff[2] = 16371; - if (sizeof(test_msg->stec_sat_list[9].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[9].stec_coeff[0]); - } - test_msg->stec_sat_list[9].stec_coeff[3] = -5055; - test_msg->stec_sat_list[9].stec_quality_indicator = 227; - test_msg->stec_sat_list[9].sv_id.constellation = 36; - test_msg->stec_sat_list[9].sv_id.satId = 107; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[10].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[10].stec_coeff[0]); - } - test_msg->stec_sat_list[10].stec_coeff[0] = 4009; - if (sizeof(test_msg->stec_sat_list[10].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[10].stec_coeff[0]); - } - test_msg->stec_sat_list[10].stec_coeff[1] = 1462; - if (sizeof(test_msg->stec_sat_list[10].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[10].stec_coeff[0]); - } - test_msg->stec_sat_list[10].stec_coeff[2] = -19216; - if (sizeof(test_msg->stec_sat_list[10].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[10].stec_coeff[0]); - } - test_msg->stec_sat_list[10].stec_coeff[3] = 31241; - test_msg->stec_sat_list[10].stec_quality_indicator = 0; - test_msg->stec_sat_list[10].sv_id.constellation = 77; - test_msg->stec_sat_list[10].sv_id.satId = 92; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[11].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[11].stec_coeff[0]); - } - test_msg->stec_sat_list[11].stec_coeff[0] = 26727; - if (sizeof(test_msg->stec_sat_list[11].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[11].stec_coeff[0]); - } - test_msg->stec_sat_list[11].stec_coeff[1] = -16898; - if (sizeof(test_msg->stec_sat_list[11].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[11].stec_coeff[0]); - } - test_msg->stec_sat_list[11].stec_coeff[2] = 28241; - if (sizeof(test_msg->stec_sat_list[11].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[11].stec_coeff[0]); - } - test_msg->stec_sat_list[11].stec_coeff[3] = 12546; - test_msg->stec_sat_list[11].stec_quality_indicator = 6; - test_msg->stec_sat_list[11].sv_id.constellation = 232; - test_msg->stec_sat_list[11].sv_id.satId = 86; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[12].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[12].stec_coeff[0]); - } - test_msg->stec_sat_list[12].stec_coeff[0] = 12855; - if (sizeof(test_msg->stec_sat_list[12].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[12].stec_coeff[0]); - } - test_msg->stec_sat_list[12].stec_coeff[1] = 1461; - if (sizeof(test_msg->stec_sat_list[12].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[12].stec_coeff[0]); - } - test_msg->stec_sat_list[12].stec_coeff[2] = 20603; - if (sizeof(test_msg->stec_sat_list[12].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[12].stec_coeff[0]); - } - test_msg->stec_sat_list[12].stec_coeff[3] = -3023; - test_msg->stec_sat_list[12].stec_quality_indicator = 216; - test_msg->stec_sat_list[12].sv_id.constellation = 84; - test_msg->stec_sat_list[12].sv_id.satId = 202; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[13].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[13].stec_coeff[0]); - } - test_msg->stec_sat_list[13].stec_coeff[0] = -6492; - if (sizeof(test_msg->stec_sat_list[13].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[13].stec_coeff[0]); - } - test_msg->stec_sat_list[13].stec_coeff[1] = 16952; - if (sizeof(test_msg->stec_sat_list[13].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[13].stec_coeff[0]); - } - test_msg->stec_sat_list[13].stec_coeff[2] = -22404; - if (sizeof(test_msg->stec_sat_list[13].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[13].stec_coeff[0]); - } - test_msg->stec_sat_list[13].stec_coeff[3] = -29893; - test_msg->stec_sat_list[13].stec_quality_indicator = 125; - test_msg->stec_sat_list[13].sv_id.constellation = 188; - test_msg->stec_sat_list[13].sv_id.satId = 224; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[14].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[14].stec_coeff[0]); - } - test_msg->stec_sat_list[14].stec_coeff[0] = -10053; - if (sizeof(test_msg->stec_sat_list[14].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[14].stec_coeff[0]); - } - test_msg->stec_sat_list[14].stec_coeff[1] = -24897; - if (sizeof(test_msg->stec_sat_list[14].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[14].stec_coeff[0]); - } - test_msg->stec_sat_list[14].stec_coeff[2] = 23629; - if (sizeof(test_msg->stec_sat_list[14].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[14].stec_coeff[0]); - } - test_msg->stec_sat_list[14].stec_coeff[3] = -710; - test_msg->stec_sat_list[14].stec_quality_indicator = 51; - test_msg->stec_sat_list[14].sv_id.constellation = 118; - test_msg->stec_sat_list[14].sv_id.satId = 106; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[15].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[15].stec_coeff[0]); - } - test_msg->stec_sat_list[15].stec_coeff[0] = -26103; - if (sizeof(test_msg->stec_sat_list[15].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[15].stec_coeff[0]); - } - test_msg->stec_sat_list[15].stec_coeff[1] = -9539; - if (sizeof(test_msg->stec_sat_list[15].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[15].stec_coeff[0]); - } - test_msg->stec_sat_list[15].stec_coeff[2] = -11971; - if (sizeof(test_msg->stec_sat_list[15].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[15].stec_coeff[0]); - } - test_msg->stec_sat_list[15].stec_coeff[3] = 20993; - test_msg->stec_sat_list[15].stec_quality_indicator = 165; - test_msg->stec_sat_list[15].sv_id.constellation = 150; - test_msg->stec_sat_list[15].sv_id.satId = 132; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[16].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[16].stec_coeff[0]); - } - test_msg->stec_sat_list[16].stec_coeff[0] = -18891; - if (sizeof(test_msg->stec_sat_list[16].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[16].stec_coeff[0]); - } - test_msg->stec_sat_list[16].stec_coeff[1] = -16272; - if (sizeof(test_msg->stec_sat_list[16].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[16].stec_coeff[0]); - } - test_msg->stec_sat_list[16].stec_coeff[2] = -22578; - if (sizeof(test_msg->stec_sat_list[16].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[16].stec_coeff[0]); - } - test_msg->stec_sat_list[16].stec_coeff[3] = -2915; - test_msg->stec_sat_list[16].stec_quality_indicator = 23; - test_msg->stec_sat_list[16].sv_id.constellation = 196; - test_msg->stec_sat_list[16].sv_id.satId = 181; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[17].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[17].stec_coeff[0]); - } - test_msg->stec_sat_list[17].stec_coeff[0] = 15833; - if (sizeof(test_msg->stec_sat_list[17].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[17].stec_coeff[0]); - } - test_msg->stec_sat_list[17].stec_coeff[1] = 24920; - if (sizeof(test_msg->stec_sat_list[17].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[17].stec_coeff[0]); - } - test_msg->stec_sat_list[17].stec_coeff[2] = -13879; - if (sizeof(test_msg->stec_sat_list[17].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[17].stec_coeff[0]); - } - test_msg->stec_sat_list[17].stec_coeff[3] = -1206; - test_msg->stec_sat_list[17].stec_quality_indicator = 189; - test_msg->stec_sat_list[17].sv_id.constellation = 1; - test_msg->stec_sat_list[17].sv_id.satId = 35; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[18].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[18].stec_coeff[0]); - } - test_msg->stec_sat_list[18].stec_coeff[0] = 14008; - if (sizeof(test_msg->stec_sat_list[18].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[18].stec_coeff[0]); - } - test_msg->stec_sat_list[18].stec_coeff[1] = 18996; - if (sizeof(test_msg->stec_sat_list[18].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[18].stec_coeff[0]); - } - test_msg->stec_sat_list[18].stec_coeff[2] = 2798; - if (sizeof(test_msg->stec_sat_list[18].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[18].stec_coeff[0]); - } - test_msg->stec_sat_list[18].stec_coeff[3] = 5761; - test_msg->stec_sat_list[18].stec_quality_indicator = 104; - test_msg->stec_sat_list[18].sv_id.constellation = 14; - test_msg->stec_sat_list[18].sv_id.satId = 217; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[19].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[19].stec_coeff[0]); - } - test_msg->stec_sat_list[19].stec_coeff[0] = -25256; - if (sizeof(test_msg->stec_sat_list[19].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[19].stec_coeff[0]); - } - test_msg->stec_sat_list[19].stec_coeff[1] = -15330; - if (sizeof(test_msg->stec_sat_list[19].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[19].stec_coeff[0]); - } - test_msg->stec_sat_list[19].stec_coeff[2] = 6831; - if (sizeof(test_msg->stec_sat_list[19].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[19].stec_coeff[0]); - } - test_msg->stec_sat_list[19].stec_coeff[3] = 8780; - test_msg->stec_sat_list[19].stec_quality_indicator = 109; - test_msg->stec_sat_list[19].sv_id.constellation = 226; - test_msg->stec_sat_list[19].sv_id.satId = 178; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[20].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[20].stec_coeff[0]); - } - test_msg->stec_sat_list[20].stec_coeff[0] = 3304; - if (sizeof(test_msg->stec_sat_list[20].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[20].stec_coeff[0]); - } - test_msg->stec_sat_list[20].stec_coeff[1] = -2893; - if (sizeof(test_msg->stec_sat_list[20].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[20].stec_coeff[0]); - } - test_msg->stec_sat_list[20].stec_coeff[2] = -25841; - if (sizeof(test_msg->stec_sat_list[20].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[20].stec_coeff[0]); - } - test_msg->stec_sat_list[20].stec_coeff[3] = -13628; - test_msg->stec_sat_list[20].stec_quality_indicator = 154; - test_msg->stec_sat_list[20].sv_id.constellation = 220; - test_msg->stec_sat_list[20].sv_id.satId = 116; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[0]); - } - if (sizeof(test_msg->stec_sat_list[21].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[21].stec_coeff[0]); - } - test_msg->stec_sat_list[21].stec_coeff[0] = -10742; - if (sizeof(test_msg->stec_sat_list[21].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[21].stec_coeff[0]); - } - test_msg->stec_sat_list[21].stec_coeff[1] = 10098; - if (sizeof(test_msg->stec_sat_list[21].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[21].stec_coeff[0]); - } - test_msg->stec_sat_list[21].stec_coeff[2] = 7413; - if (sizeof(test_msg->stec_sat_list[21].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->stec_sat_list[21].stec_coeff[0]); - } - test_msg->stec_sat_list[21].stec_coeff[3] = 17645; - test_msg->stec_sat_list[21].stec_quality_indicator = 115; - test_msg->stec_sat_list[21].sv_id.constellation = 70; - test_msg->stec_sat_list[21].sv_id.satId = 72; - sbp_payload_send(&sbp_state, 0x5eb, 1831, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1831, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1831, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x5eb, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_stec_correction_dep_a_t *check_msg = - (msg_ssr_stec_correction_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->header.iod_atmo == 4, - "incorrect value for header.iod_atmo, expected 4, is %d", - check_msg->header.iod_atmo); - ck_assert_msg(check_msg->header.num_msgs == 147, - "incorrect value for header.num_msgs, expected 147, is %d", - check_msg->header.num_msgs); - ck_assert_msg(check_msg->header.seq_num == 123, - "incorrect value for header.seq_num, expected 123, is %d", - check_msg->header.seq_num); - ck_assert_msg( - check_msg->header.time.tow == 3905179974, - "incorrect value for header.time.tow, expected 3905179974, is %d", - check_msg->header.time.tow); - ck_assert_msg(check_msg->header.time.wn == 11193, - "incorrect value for header.time.wn, expected 11193, is %d", - check_msg->header.time.wn); - ck_assert_msg( - check_msg->header.update_interval == 39, - "incorrect value for header.update_interval, expected 39, is %d", - check_msg->header.update_interval); - ck_assert_msg(check_msg->stec_sat_list[0].stec_coeff[0] == -1951, - "incorrect value for stec_sat_list[0].stec_coeff[0], " - "expected -1951, is %d", - check_msg->stec_sat_list[0].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[0].stec_coeff[1] == -9854, - "incorrect value for stec_sat_list[0].stec_coeff[1], " - "expected -9854, is %d", - check_msg->stec_sat_list[0].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[0].stec_coeff[2] == 27353, - "incorrect value for stec_sat_list[0].stec_coeff[2], " - "expected 27353, is %d", - check_msg->stec_sat_list[0].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[0].stec_coeff[3] == 3130, - "incorrect value for stec_sat_list[0].stec_coeff[3], " - "expected 3130, is %d", - check_msg->stec_sat_list[0].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[0].stec_quality_indicator == 111, - "incorrect value for stec_sat_list[0].stec_quality_indicator, expected " - "111, is %d", - check_msg->stec_sat_list[0].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[0].sv_id.constellation == 19, - "incorrect value for stec_sat_list[0].sv_id.constellation, " - "expected 19, is %d", - check_msg->stec_sat_list[0].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[0].sv_id.satId == 126, - "incorrect value for stec_sat_list[0].sv_id.satId, expected 126, is %d", - check_msg->stec_sat_list[0].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[1].stec_coeff[0] == 24401, - "incorrect value for stec_sat_list[1].stec_coeff[0], " - "expected 24401, is %d", - check_msg->stec_sat_list[1].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[1].stec_coeff[1] == 4182, - "incorrect value for stec_sat_list[1].stec_coeff[1], " - "expected 4182, is %d", - check_msg->stec_sat_list[1].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[1].stec_coeff[2] == 21543, - "incorrect value for stec_sat_list[1].stec_coeff[2], " - "expected 21543, is %d", - check_msg->stec_sat_list[1].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[1].stec_coeff[3] == -12060, - "incorrect value for stec_sat_list[1].stec_coeff[3], " - "expected -12060, is %d", - check_msg->stec_sat_list[1].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[1].stec_quality_indicator == 171, - "incorrect value for stec_sat_list[1].stec_quality_indicator, expected " - "171, is %d", - check_msg->stec_sat_list[1].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[1].sv_id.constellation == 230, - "incorrect value for stec_sat_list[1].sv_id.constellation, " - "expected 230, is %d", - check_msg->stec_sat_list[1].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[1].sv_id.satId == 65, - "incorrect value for stec_sat_list[1].sv_id.satId, expected 65, is %d", - check_msg->stec_sat_list[1].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[2].stec_coeff[0] == -13469, - "incorrect value for stec_sat_list[2].stec_coeff[0], " - "expected -13469, is %d", - check_msg->stec_sat_list[2].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[2].stec_coeff[1] == -18883, - "incorrect value for stec_sat_list[2].stec_coeff[1], " - "expected -18883, is %d", - check_msg->stec_sat_list[2].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[2].stec_coeff[2] == 32066, - "incorrect value for stec_sat_list[2].stec_coeff[2], " - "expected 32066, is %d", - check_msg->stec_sat_list[2].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[2].stec_coeff[3] == 971, - "incorrect value for stec_sat_list[2].stec_coeff[3], " - "expected 971, is %d", - check_msg->stec_sat_list[2].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[2].stec_quality_indicator == 219, - "incorrect value for stec_sat_list[2].stec_quality_indicator, expected " - "219, is %d", - check_msg->stec_sat_list[2].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[2].sv_id.constellation == 81, - "incorrect value for stec_sat_list[2].sv_id.constellation, " - "expected 81, is %d", - check_msg->stec_sat_list[2].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[2].sv_id.satId == 201, - "incorrect value for stec_sat_list[2].sv_id.satId, expected 201, is %d", - check_msg->stec_sat_list[2].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[3].stec_coeff[0] == 32220, - "incorrect value for stec_sat_list[3].stec_coeff[0], " - "expected 32220, is %d", - check_msg->stec_sat_list[3].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[3].stec_coeff[1] == 5436, - "incorrect value for stec_sat_list[3].stec_coeff[1], " - "expected 5436, is %d", - check_msg->stec_sat_list[3].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[3].stec_coeff[2] == -9635, - "incorrect value for stec_sat_list[3].stec_coeff[2], " - "expected -9635, is %d", - check_msg->stec_sat_list[3].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[3].stec_coeff[3] == -24841, - "incorrect value for stec_sat_list[3].stec_coeff[3], " - "expected -24841, is %d", - check_msg->stec_sat_list[3].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[3].stec_quality_indicator == 100, - "incorrect value for stec_sat_list[3].stec_quality_indicator, expected " - "100, is %d", - check_msg->stec_sat_list[3].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[3].sv_id.constellation == 44, - "incorrect value for stec_sat_list[3].sv_id.constellation, " - "expected 44, is %d", - check_msg->stec_sat_list[3].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[3].sv_id.satId == 193, - "incorrect value for stec_sat_list[3].sv_id.satId, expected 193, is %d", - check_msg->stec_sat_list[3].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[4].stec_coeff[0] == 3718, - "incorrect value for stec_sat_list[4].stec_coeff[0], " - "expected 3718, is %d", - check_msg->stec_sat_list[4].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[4].stec_coeff[1] == 12497, - "incorrect value for stec_sat_list[4].stec_coeff[1], " - "expected 12497, is %d", - check_msg->stec_sat_list[4].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[4].stec_coeff[2] == -10482, - "incorrect value for stec_sat_list[4].stec_coeff[2], " - "expected -10482, is %d", - check_msg->stec_sat_list[4].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[4].stec_coeff[3] == -27495, - "incorrect value for stec_sat_list[4].stec_coeff[3], " - "expected -27495, is %d", - check_msg->stec_sat_list[4].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[4].stec_quality_indicator == 129, - "incorrect value for stec_sat_list[4].stec_quality_indicator, expected " - "129, is %d", - check_msg->stec_sat_list[4].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[4].sv_id.constellation == 93, - "incorrect value for stec_sat_list[4].sv_id.constellation, " - "expected 93, is %d", - check_msg->stec_sat_list[4].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[4].sv_id.satId == 207, - "incorrect value for stec_sat_list[4].sv_id.satId, expected 207, is %d", - check_msg->stec_sat_list[4].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[5].stec_coeff[0] == -4940, - "incorrect value for stec_sat_list[5].stec_coeff[0], " - "expected -4940, is %d", - check_msg->stec_sat_list[5].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[5].stec_coeff[1] == -13875, - "incorrect value for stec_sat_list[5].stec_coeff[1], " - "expected -13875, is %d", - check_msg->stec_sat_list[5].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[5].stec_coeff[2] == 801, - "incorrect value for stec_sat_list[5].stec_coeff[2], " - "expected 801, is %d", - check_msg->stec_sat_list[5].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[5].stec_coeff[3] == -13066, - "incorrect value for stec_sat_list[5].stec_coeff[3], " - "expected -13066, is %d", - check_msg->stec_sat_list[5].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[5].stec_quality_indicator == 225, - "incorrect value for stec_sat_list[5].stec_quality_indicator, expected " - "225, is %d", - check_msg->stec_sat_list[5].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[5].sv_id.constellation == 72, - "incorrect value for stec_sat_list[5].sv_id.constellation, " - "expected 72, is %d", - check_msg->stec_sat_list[5].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[5].sv_id.satId == 147, - "incorrect value for stec_sat_list[5].sv_id.satId, expected 147, is %d", - check_msg->stec_sat_list[5].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[6].stec_coeff[0] == -15868, - "incorrect value for stec_sat_list[6].stec_coeff[0], " - "expected -15868, is %d", - check_msg->stec_sat_list[6].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[6].stec_coeff[1] == -2369, - "incorrect value for stec_sat_list[6].stec_coeff[1], " - "expected -2369, is %d", - check_msg->stec_sat_list[6].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[6].stec_coeff[2] == -9396, - "incorrect value for stec_sat_list[6].stec_coeff[2], " - "expected -9396, is %d", - check_msg->stec_sat_list[6].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[6].stec_coeff[3] == -16609, - "incorrect value for stec_sat_list[6].stec_coeff[3], " - "expected -16609, is %d", - check_msg->stec_sat_list[6].stec_coeff[3]); - ck_assert_msg(check_msg->stec_sat_list[6].stec_quality_indicator == 98, - "incorrect value for " - "stec_sat_list[6].stec_quality_indicator, expected 98, is %d", - check_msg->stec_sat_list[6].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[6].sv_id.constellation == 3, - "incorrect value for stec_sat_list[6].sv_id.constellation, " - "expected 3, is %d", - check_msg->stec_sat_list[6].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[6].sv_id.satId == 19, - "incorrect value for stec_sat_list[6].sv_id.satId, expected 19, is %d", - check_msg->stec_sat_list[6].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[7].stec_coeff[0] == -1265, - "incorrect value for stec_sat_list[7].stec_coeff[0], " - "expected -1265, is %d", - check_msg->stec_sat_list[7].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[7].stec_coeff[1] == 4897, - "incorrect value for stec_sat_list[7].stec_coeff[1], " - "expected 4897, is %d", - check_msg->stec_sat_list[7].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[7].stec_coeff[2] == 13920, - "incorrect value for stec_sat_list[7].stec_coeff[2], " - "expected 13920, is %d", - check_msg->stec_sat_list[7].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[7].stec_coeff[3] == -28102, - "incorrect value for stec_sat_list[7].stec_coeff[3], " - "expected -28102, is %d", - check_msg->stec_sat_list[7].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[7].stec_quality_indicator == 177, - "incorrect value for stec_sat_list[7].stec_quality_indicator, expected " - "177, is %d", - check_msg->stec_sat_list[7].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[7].sv_id.constellation == 79, - "incorrect value for stec_sat_list[7].sv_id.constellation, " - "expected 79, is %d", - check_msg->stec_sat_list[7].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[7].sv_id.satId == 113, - "incorrect value for stec_sat_list[7].sv_id.satId, expected 113, is %d", - check_msg->stec_sat_list[7].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[8].stec_coeff[0] == 5448, - "incorrect value for stec_sat_list[8].stec_coeff[0], " - "expected 5448, is %d", - check_msg->stec_sat_list[8].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[8].stec_coeff[1] == -11359, - "incorrect value for stec_sat_list[8].stec_coeff[1], " - "expected -11359, is %d", - check_msg->stec_sat_list[8].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[8].stec_coeff[2] == 5574, - "incorrect value for stec_sat_list[8].stec_coeff[2], " - "expected 5574, is %d", - check_msg->stec_sat_list[8].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[8].stec_coeff[3] == 28654, - "incorrect value for stec_sat_list[8].stec_coeff[3], " - "expected 28654, is %d", - check_msg->stec_sat_list[8].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[8].stec_quality_indicator == 249, - "incorrect value for stec_sat_list[8].stec_quality_indicator, expected " - "249, is %d", - check_msg->stec_sat_list[8].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[8].sv_id.constellation == 100, - "incorrect value for stec_sat_list[8].sv_id.constellation, " - "expected 100, is %d", - check_msg->stec_sat_list[8].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[8].sv_id.satId == 210, - "incorrect value for stec_sat_list[8].sv_id.satId, expected 210, is %d", - check_msg->stec_sat_list[8].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[9].stec_coeff[0] == -10783, - "incorrect value for stec_sat_list[9].stec_coeff[0], " - "expected -10783, is %d", - check_msg->stec_sat_list[9].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[9].stec_coeff[1] == 18179, - "incorrect value for stec_sat_list[9].stec_coeff[1], " - "expected 18179, is %d", - check_msg->stec_sat_list[9].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[9].stec_coeff[2] == 16371, - "incorrect value for stec_sat_list[9].stec_coeff[2], " - "expected 16371, is %d", - check_msg->stec_sat_list[9].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[9].stec_coeff[3] == -5055, - "incorrect value for stec_sat_list[9].stec_coeff[3], " - "expected -5055, is %d", - check_msg->stec_sat_list[9].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[9].stec_quality_indicator == 227, - "incorrect value for stec_sat_list[9].stec_quality_indicator, expected " - "227, is %d", - check_msg->stec_sat_list[9].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[9].sv_id.constellation == 36, - "incorrect value for stec_sat_list[9].sv_id.constellation, " - "expected 36, is %d", - check_msg->stec_sat_list[9].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[9].sv_id.satId == 107, - "incorrect value for stec_sat_list[9].sv_id.satId, expected 107, is %d", - check_msg->stec_sat_list[9].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[10].stec_coeff[0] == 4009, - "incorrect value for stec_sat_list[10].stec_coeff[0], " - "expected 4009, is %d", - check_msg->stec_sat_list[10].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[10].stec_coeff[1] == 1462, - "incorrect value for stec_sat_list[10].stec_coeff[1], " - "expected 1462, is %d", - check_msg->stec_sat_list[10].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[10].stec_coeff[2] == -19216, - "incorrect value for stec_sat_list[10].stec_coeff[2], " - "expected -19216, is %d", - check_msg->stec_sat_list[10].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[10].stec_coeff[3] == 31241, - "incorrect value for stec_sat_list[10].stec_coeff[3], " - "expected 31241, is %d", - check_msg->stec_sat_list[10].stec_coeff[3]); - ck_assert_msg(check_msg->stec_sat_list[10].stec_quality_indicator == 0, - "incorrect value for " - "stec_sat_list[10].stec_quality_indicator, expected 0, is %d", - check_msg->stec_sat_list[10].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[10].sv_id.constellation == 77, - "incorrect value for stec_sat_list[10].sv_id.constellation, " - "expected 77, is %d", - check_msg->stec_sat_list[10].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[10].sv_id.satId == 92, - "incorrect value for stec_sat_list[10].sv_id.satId, expected 92, is %d", - check_msg->stec_sat_list[10].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[11].stec_coeff[0] == 26727, - "incorrect value for stec_sat_list[11].stec_coeff[0], " - "expected 26727, is %d", - check_msg->stec_sat_list[11].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[11].stec_coeff[1] == -16898, - "incorrect value for stec_sat_list[11].stec_coeff[1], " - "expected -16898, is %d", - check_msg->stec_sat_list[11].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[11].stec_coeff[2] == 28241, - "incorrect value for stec_sat_list[11].stec_coeff[2], " - "expected 28241, is %d", - check_msg->stec_sat_list[11].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[11].stec_coeff[3] == 12546, - "incorrect value for stec_sat_list[11].stec_coeff[3], " - "expected 12546, is %d", - check_msg->stec_sat_list[11].stec_coeff[3]); - ck_assert_msg(check_msg->stec_sat_list[11].stec_quality_indicator == 6, - "incorrect value for " - "stec_sat_list[11].stec_quality_indicator, expected 6, is %d", - check_msg->stec_sat_list[11].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[11].sv_id.constellation == 232, - "incorrect value for stec_sat_list[11].sv_id.constellation, " - "expected 232, is %d", - check_msg->stec_sat_list[11].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[11].sv_id.satId == 86, - "incorrect value for stec_sat_list[11].sv_id.satId, expected 86, is %d", - check_msg->stec_sat_list[11].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[12].stec_coeff[0] == 12855, - "incorrect value for stec_sat_list[12].stec_coeff[0], " - "expected 12855, is %d", - check_msg->stec_sat_list[12].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[12].stec_coeff[1] == 1461, - "incorrect value for stec_sat_list[12].stec_coeff[1], " - "expected 1461, is %d", - check_msg->stec_sat_list[12].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[12].stec_coeff[2] == 20603, - "incorrect value for stec_sat_list[12].stec_coeff[2], " - "expected 20603, is %d", - check_msg->stec_sat_list[12].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[12].stec_coeff[3] == -3023, - "incorrect value for stec_sat_list[12].stec_coeff[3], " - "expected -3023, is %d", - check_msg->stec_sat_list[12].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[12].stec_quality_indicator == 216, - "incorrect value for stec_sat_list[12].stec_quality_indicator, " - "expected 216, is %d", - check_msg->stec_sat_list[12].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[12].sv_id.constellation == 84, - "incorrect value for stec_sat_list[12].sv_id.constellation, " - "expected 84, is %d", - check_msg->stec_sat_list[12].sv_id.constellation); - ck_assert_msg(check_msg->stec_sat_list[12].sv_id.satId == 202, - "incorrect value for stec_sat_list[12].sv_id.satId, expected " - "202, is %d", - check_msg->stec_sat_list[12].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[13].stec_coeff[0] == -6492, - "incorrect value for stec_sat_list[13].stec_coeff[0], " - "expected -6492, is %d", - check_msg->stec_sat_list[13].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[13].stec_coeff[1] == 16952, - "incorrect value for stec_sat_list[13].stec_coeff[1], " - "expected 16952, is %d", - check_msg->stec_sat_list[13].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[13].stec_coeff[2] == -22404, - "incorrect value for stec_sat_list[13].stec_coeff[2], " - "expected -22404, is %d", - check_msg->stec_sat_list[13].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[13].stec_coeff[3] == -29893, - "incorrect value for stec_sat_list[13].stec_coeff[3], " - "expected -29893, is %d", - check_msg->stec_sat_list[13].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[13].stec_quality_indicator == 125, - "incorrect value for stec_sat_list[13].stec_quality_indicator, " - "expected 125, is %d", - check_msg->stec_sat_list[13].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[13].sv_id.constellation == 188, - "incorrect value for stec_sat_list[13].sv_id.constellation, " - "expected 188, is %d", - check_msg->stec_sat_list[13].sv_id.constellation); - ck_assert_msg(check_msg->stec_sat_list[13].sv_id.satId == 224, - "incorrect value for stec_sat_list[13].sv_id.satId, expected " - "224, is %d", - check_msg->stec_sat_list[13].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[14].stec_coeff[0] == -10053, - "incorrect value for stec_sat_list[14].stec_coeff[0], " - "expected -10053, is %d", - check_msg->stec_sat_list[14].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[14].stec_coeff[1] == -24897, - "incorrect value for stec_sat_list[14].stec_coeff[1], " - "expected -24897, is %d", - check_msg->stec_sat_list[14].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[14].stec_coeff[2] == 23629, - "incorrect value for stec_sat_list[14].stec_coeff[2], " - "expected 23629, is %d", - check_msg->stec_sat_list[14].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[14].stec_coeff[3] == -710, - "incorrect value for stec_sat_list[14].stec_coeff[3], " - "expected -710, is %d", - check_msg->stec_sat_list[14].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[14].stec_quality_indicator == 51, - "incorrect value for stec_sat_list[14].stec_quality_indicator, " - "expected 51, is %d", - check_msg->stec_sat_list[14].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[14].sv_id.constellation == 118, - "incorrect value for stec_sat_list[14].sv_id.constellation, " - "expected 118, is %d", - check_msg->stec_sat_list[14].sv_id.constellation); - ck_assert_msg(check_msg->stec_sat_list[14].sv_id.satId == 106, - "incorrect value for stec_sat_list[14].sv_id.satId, expected " - "106, is %d", - check_msg->stec_sat_list[14].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[15].stec_coeff[0] == -26103, - "incorrect value for stec_sat_list[15].stec_coeff[0], " - "expected -26103, is %d", - check_msg->stec_sat_list[15].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[15].stec_coeff[1] == -9539, - "incorrect value for stec_sat_list[15].stec_coeff[1], " - "expected -9539, is %d", - check_msg->stec_sat_list[15].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[15].stec_coeff[2] == -11971, - "incorrect value for stec_sat_list[15].stec_coeff[2], " - "expected -11971, is %d", - check_msg->stec_sat_list[15].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[15].stec_coeff[3] == 20993, - "incorrect value for stec_sat_list[15].stec_coeff[3], " - "expected 20993, is %d", - check_msg->stec_sat_list[15].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[15].stec_quality_indicator == 165, - "incorrect value for stec_sat_list[15].stec_quality_indicator, " - "expected 165, is %d", - check_msg->stec_sat_list[15].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[15].sv_id.constellation == 150, - "incorrect value for stec_sat_list[15].sv_id.constellation, " - "expected 150, is %d", - check_msg->stec_sat_list[15].sv_id.constellation); - ck_assert_msg(check_msg->stec_sat_list[15].sv_id.satId == 132, - "incorrect value for stec_sat_list[15].sv_id.satId, expected " - "132, is %d", - check_msg->stec_sat_list[15].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[16].stec_coeff[0] == -18891, - "incorrect value for stec_sat_list[16].stec_coeff[0], " - "expected -18891, is %d", - check_msg->stec_sat_list[16].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[16].stec_coeff[1] == -16272, - "incorrect value for stec_sat_list[16].stec_coeff[1], " - "expected -16272, is %d", - check_msg->stec_sat_list[16].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[16].stec_coeff[2] == -22578, - "incorrect value for stec_sat_list[16].stec_coeff[2], " - "expected -22578, is %d", - check_msg->stec_sat_list[16].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[16].stec_coeff[3] == -2915, - "incorrect value for stec_sat_list[16].stec_coeff[3], " - "expected -2915, is %d", - check_msg->stec_sat_list[16].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[16].stec_quality_indicator == 23, - "incorrect value for stec_sat_list[16].stec_quality_indicator, " - "expected 23, is %d", - check_msg->stec_sat_list[16].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[16].sv_id.constellation == 196, - "incorrect value for stec_sat_list[16].sv_id.constellation, " - "expected 196, is %d", - check_msg->stec_sat_list[16].sv_id.constellation); - ck_assert_msg(check_msg->stec_sat_list[16].sv_id.satId == 181, - "incorrect value for stec_sat_list[16].sv_id.satId, expected " - "181, is %d", - check_msg->stec_sat_list[16].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[17].stec_coeff[0] == 15833, - "incorrect value for stec_sat_list[17].stec_coeff[0], " - "expected 15833, is %d", - check_msg->stec_sat_list[17].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[17].stec_coeff[1] == 24920, - "incorrect value for stec_sat_list[17].stec_coeff[1], " - "expected 24920, is %d", - check_msg->stec_sat_list[17].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[17].stec_coeff[2] == -13879, - "incorrect value for stec_sat_list[17].stec_coeff[2], " - "expected -13879, is %d", - check_msg->stec_sat_list[17].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[17].stec_coeff[3] == -1206, - "incorrect value for stec_sat_list[17].stec_coeff[3], " - "expected -1206, is %d", - check_msg->stec_sat_list[17].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[17].stec_quality_indicator == 189, - "incorrect value for stec_sat_list[17].stec_quality_indicator, " - "expected 189, is %d", - check_msg->stec_sat_list[17].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[17].sv_id.constellation == 1, - "incorrect value for stec_sat_list[17].sv_id.constellation, " - "expected 1, is %d", - check_msg->stec_sat_list[17].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[17].sv_id.satId == 35, - "incorrect value for stec_sat_list[17].sv_id.satId, expected 35, is %d", - check_msg->stec_sat_list[17].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[18].stec_coeff[0] == 14008, - "incorrect value for stec_sat_list[18].stec_coeff[0], " - "expected 14008, is %d", - check_msg->stec_sat_list[18].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[18].stec_coeff[1] == 18996, - "incorrect value for stec_sat_list[18].stec_coeff[1], " - "expected 18996, is %d", - check_msg->stec_sat_list[18].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[18].stec_coeff[2] == 2798, - "incorrect value for stec_sat_list[18].stec_coeff[2], " - "expected 2798, is %d", - check_msg->stec_sat_list[18].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[18].stec_coeff[3] == 5761, - "incorrect value for stec_sat_list[18].stec_coeff[3], " - "expected 5761, is %d", - check_msg->stec_sat_list[18].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[18].stec_quality_indicator == 104, - "incorrect value for stec_sat_list[18].stec_quality_indicator, " - "expected 104, is %d", - check_msg->stec_sat_list[18].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[18].sv_id.constellation == 14, - "incorrect value for stec_sat_list[18].sv_id.constellation, " - "expected 14, is %d", - check_msg->stec_sat_list[18].sv_id.constellation); - ck_assert_msg(check_msg->stec_sat_list[18].sv_id.satId == 217, - "incorrect value for stec_sat_list[18].sv_id.satId, expected " - "217, is %d", - check_msg->stec_sat_list[18].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[19].stec_coeff[0] == -25256, - "incorrect value for stec_sat_list[19].stec_coeff[0], " - "expected -25256, is %d", - check_msg->stec_sat_list[19].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[19].stec_coeff[1] == -15330, - "incorrect value for stec_sat_list[19].stec_coeff[1], " - "expected -15330, is %d", - check_msg->stec_sat_list[19].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[19].stec_coeff[2] == 6831, - "incorrect value for stec_sat_list[19].stec_coeff[2], " - "expected 6831, is %d", - check_msg->stec_sat_list[19].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[19].stec_coeff[3] == 8780, - "incorrect value for stec_sat_list[19].stec_coeff[3], " - "expected 8780, is %d", - check_msg->stec_sat_list[19].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[19].stec_quality_indicator == 109, - "incorrect value for stec_sat_list[19].stec_quality_indicator, " - "expected 109, is %d", - check_msg->stec_sat_list[19].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[19].sv_id.constellation == 226, - "incorrect value for stec_sat_list[19].sv_id.constellation, " - "expected 226, is %d", - check_msg->stec_sat_list[19].sv_id.constellation); - ck_assert_msg(check_msg->stec_sat_list[19].sv_id.satId == 178, - "incorrect value for stec_sat_list[19].sv_id.satId, expected " - "178, is %d", - check_msg->stec_sat_list[19].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[20].stec_coeff[0] == 3304, - "incorrect value for stec_sat_list[20].stec_coeff[0], " - "expected 3304, is %d", - check_msg->stec_sat_list[20].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[20].stec_coeff[1] == -2893, - "incorrect value for stec_sat_list[20].stec_coeff[1], " - "expected -2893, is %d", - check_msg->stec_sat_list[20].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[20].stec_coeff[2] == -25841, - "incorrect value for stec_sat_list[20].stec_coeff[2], " - "expected -25841, is %d", - check_msg->stec_sat_list[20].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[20].stec_coeff[3] == -13628, - "incorrect value for stec_sat_list[20].stec_coeff[3], " - "expected -13628, is %d", - check_msg->stec_sat_list[20].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[20].stec_quality_indicator == 154, - "incorrect value for stec_sat_list[20].stec_quality_indicator, " - "expected 154, is %d", - check_msg->stec_sat_list[20].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[20].sv_id.constellation == 220, - "incorrect value for stec_sat_list[20].sv_id.constellation, " - "expected 220, is %d", - check_msg->stec_sat_list[20].sv_id.constellation); - ck_assert_msg(check_msg->stec_sat_list[20].sv_id.satId == 116, - "incorrect value for stec_sat_list[20].sv_id.satId, expected " - "116, is %d", - check_msg->stec_sat_list[20].sv_id.satId); - ck_assert_msg(check_msg->stec_sat_list[21].stec_coeff[0] == -10742, - "incorrect value for stec_sat_list[21].stec_coeff[0], " - "expected -10742, is %d", - check_msg->stec_sat_list[21].stec_coeff[0]); - ck_assert_msg(check_msg->stec_sat_list[21].stec_coeff[1] == 10098, - "incorrect value for stec_sat_list[21].stec_coeff[1], " - "expected 10098, is %d", - check_msg->stec_sat_list[21].stec_coeff[1]); - ck_assert_msg(check_msg->stec_sat_list[21].stec_coeff[2] == 7413, - "incorrect value for stec_sat_list[21].stec_coeff[2], " - "expected 7413, is %d", - check_msg->stec_sat_list[21].stec_coeff[2]); - ck_assert_msg(check_msg->stec_sat_list[21].stec_coeff[3] == 17645, - "incorrect value for stec_sat_list[21].stec_coeff[3], " - "expected 17645, is %d", - check_msg->stec_sat_list[21].stec_coeff[3]); - ck_assert_msg( - check_msg->stec_sat_list[21].stec_quality_indicator == 115, - "incorrect value for stec_sat_list[21].stec_quality_indicator, " - "expected 115, is %d", - check_msg->stec_sat_list[21].stec_quality_indicator); - ck_assert_msg(check_msg->stec_sat_list[21].sv_id.constellation == 70, - "incorrect value for stec_sat_list[21].sv_id.constellation, " - "expected 70, is %d", - check_msg->stec_sat_list[21].sv_id.constellation); - ck_assert_msg( - check_msg->stec_sat_list[21].sv_id.satId == 72, - "incorrect value for stec_sat_list[21].sv_id.satId, expected 72, is %d", - check_msg->stec_sat_list[21].sv_id.satId); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrTileDefinition.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrTileDefinition.c deleted file mode 100644 index de97f71cd8..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrTileDefinition.c +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrTileDefinition.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrTileDefinition) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x5F8, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x5F8, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 248, 5, 0, 0, 33, 127, 58, 9, 0, 174, 8, 1, 2, - 3, 4, 0, 5, 0, 186, 28, 59, 167, 100, 0, 100, 0, 6, - 0, 6, 0, 210, 2, 150, 73, 0, 0, 0, 0, 204, 94, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_tile_definition_t *test_msg = - (msg_ssr_tile_definition_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->bitmask = 1234567890; - test_msg->cols = 6; - test_msg->corner_nw_lat = 7354; - test_msg->corner_nw_lon = -22725; - test_msg->iod_atmo = 3; - test_msg->rows = 6; - test_msg->sol_id = 2; - test_msg->spacing_lat = 100; - test_msg->spacing_lon = 100; - test_msg->tile_id = 5; - test_msg->tile_set_id = 4; - test_msg->time.tow = 604799; - test_msg->time.wn = 2222; - test_msg->update_interval = 1; - sbp_payload_send(&sbp_state, 0x5F8, 0, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 0, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 0, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x5F8, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_tile_definition_t *check_msg = - (msg_ssr_tile_definition_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->bitmask == 1234567890, - "incorrect value for bitmask, expected 1234567890, is %d", - check_msg->bitmask); - ck_assert_msg(check_msg->cols == 6, - "incorrect value for cols, expected 6, is %d", - check_msg->cols); - ck_assert_msg(check_msg->corner_nw_lat == 7354, - "incorrect value for corner_nw_lat, expected 7354, is %d", - check_msg->corner_nw_lat); - ck_assert_msg(check_msg->corner_nw_lon == -22725, - "incorrect value for corner_nw_lon, expected -22725, is %d", - check_msg->corner_nw_lon); - ck_assert_msg(check_msg->iod_atmo == 3, - "incorrect value for iod_atmo, expected 3, is %d", - check_msg->iod_atmo); - ck_assert_msg(check_msg->rows == 6, - "incorrect value for rows, expected 6, is %d", - check_msg->rows); - ck_assert_msg(check_msg->sol_id == 2, - "incorrect value for sol_id, expected 2, is %d", - check_msg->sol_id); - ck_assert_msg(check_msg->spacing_lat == 100, - "incorrect value for spacing_lat, expected 100, is %d", - check_msg->spacing_lat); - ck_assert_msg(check_msg->spacing_lon == 100, - "incorrect value for spacing_lon, expected 100, is %d", - check_msg->spacing_lon); - ck_assert_msg(check_msg->tile_id == 5, - "incorrect value for tile_id, expected 5, is %d", - check_msg->tile_id); - ck_assert_msg(check_msg->tile_set_id == 4, - "incorrect value for tile_set_id, expected 4, is %d", - check_msg->tile_set_id); - ck_assert_msg(check_msg->time.tow == 604799, - "incorrect value for time.tow, expected 604799, is %d", - check_msg->time.tow); - ck_assert_msg(check_msg->time.wn == 2222, - "incorrect value for time.wn, expected 2222, is %d", - check_msg->time.wn); - ck_assert_msg(check_msg->update_interval == 1, - "incorrect value for update_interval, expected 1, is %d", - check_msg->update_interval); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrTileDefinition_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_ssr_MsgSsrTileDefinition"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_MsgSsrTileDefinition"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_ssr_MsgSsrTileDefinition); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrTileDefinitionDepA.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrTileDefinitionDepA.c deleted file mode 100644 index e5660c075a..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrTileDefinitionDepA.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrTileDefinitionDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x5f6, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x5f6, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 246, 5, 200, 133, 24, 57, 190, 178, 247, 8, - 185, 9, 181, 162, 240, 65, 19, 255, 143, 21, 191, - 239, 205, 171, 0, 0, 0, 0, 0, 65, 154, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_tile_definition_dep_a_t *test_msg = - (msg_ssr_tile_definition_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->bitmask = 11259375; - test_msg->cols = 48917; - test_msg->corner_nw_lat = -18168; - test_msg->corner_nw_lon = -19191; - test_msg->rows = 36863; - test_msg->spacing_lat = 61602; - test_msg->spacing_lon = 4929; - test_msg->tile_id = 63410; - test_msg->tile_set_id = 48697; - sbp_payload_send(&sbp_state, 0x5f6, 34248, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 34248, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 34248, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x5f6, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_tile_definition_dep_a_t *check_msg = - (msg_ssr_tile_definition_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->bitmask == 11259375, - "incorrect value for bitmask, expected 11259375, is %d", - check_msg->bitmask); - ck_assert_msg(check_msg->cols == 48917, - "incorrect value for cols, expected 48917, is %d", - check_msg->cols); - ck_assert_msg(check_msg->corner_nw_lat == -18168, - "incorrect value for corner_nw_lat, expected -18168, is %d", - check_msg->corner_nw_lat); - ck_assert_msg(check_msg->corner_nw_lon == -19191, - "incorrect value for corner_nw_lon, expected -19191, is %d", - check_msg->corner_nw_lon); - ck_assert_msg(check_msg->rows == 36863, - "incorrect value for rows, expected 36863, is %d", - check_msg->rows); - ck_assert_msg(check_msg->spacing_lat == 61602, - "incorrect value for spacing_lat, expected 61602, is %d", - check_msg->spacing_lat); - ck_assert_msg(check_msg->spacing_lon == 4929, - "incorrect value for spacing_lon, expected 4929, is %d", - check_msg->spacing_lon); - ck_assert_msg(check_msg->tile_id == 63410, - "incorrect value for tile_id, expected 63410, is %d", - check_msg->tile_id); - ck_assert_msg(check_msg->tile_set_id == 48697, - "incorrect value for tile_set_id, expected 48697, is %d", - check_msg->tile_set_id); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_ssr_MsgSsrTileDefinitionDepB.c b/c/test/legacy/auto_check_sbp_ssr_MsgSsrTileDefinitionDepB.c deleted file mode 100644 index b5d655d2f1..0000000000 --- a/c/test/legacy/auto_check_sbp_ssr_MsgSsrTileDefinitionDepB.c +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrTileDefinitionDepB.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepB) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 1527, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 1527, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 247, 5, 66, 0, 25, 31, 0, 1, 0, 2, 0, 4, 0, 8, 0, 16, - 0, 32, 0, 64, 0, 128, 210, 2, 150, 73, 0, 0, 0, 0, 214, 71, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ssr_tile_definition_dep_b_t *test_msg = - (msg_ssr_tile_definition_dep_b_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->bitmask = 1234567890; - test_msg->cols = 32768; - test_msg->corner_nw_lat = 1024; - test_msg->corner_nw_lon = 2048; - test_msg->rows = 16384; - test_msg->spacing_lat = 4096; - test_msg->spacing_lon = 8192; - test_msg->ssr_sol_id = 31; - test_msg->tile_id = 512; - test_msg->tile_set_id = 256; - sbp_payload_send(&sbp_state, 1527, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 1527, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ssr_tile_definition_dep_b_t *check_msg = - (msg_ssr_tile_definition_dep_b_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->bitmask == 1234567890, - "incorrect value for bitmask, expected 1234567890, is %d", - check_msg->bitmask); - ck_assert_msg(check_msg->cols == 32768, - "incorrect value for cols, expected 32768, is %d", - check_msg->cols); - ck_assert_msg(check_msg->corner_nw_lat == 1024, - "incorrect value for corner_nw_lat, expected 1024, is %d", - check_msg->corner_nw_lat); - ck_assert_msg(check_msg->corner_nw_lon == 2048, - "incorrect value for corner_nw_lon, expected 2048, is %d", - check_msg->corner_nw_lon); - ck_assert_msg(check_msg->rows == 16384, - "incorrect value for rows, expected 16384, is %d", - check_msg->rows); - ck_assert_msg(check_msg->spacing_lat == 4096, - "incorrect value for spacing_lat, expected 4096, is %d", - check_msg->spacing_lat); - ck_assert_msg(check_msg->spacing_lon == 8192, - "incorrect value for spacing_lon, expected 8192, is %d", - check_msg->spacing_lon); - ck_assert_msg(check_msg->ssr_sol_id == 31, - "incorrect value for ssr_sol_id, expected 31, is %d", - check_msg->ssr_sol_id); - ck_assert_msg(check_msg->tile_id == 512, - "incorrect value for tile_id, expected 512, is %d", - check_msg->tile_id); - ck_assert_msg(check_msg->tile_set_id == 256, - "incorrect value for tile_set_id, expected 256, is %d", - check_msg->tile_set_id); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepB_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepB"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepB"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepB); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_system_MsgCsacTelemetry.c b/c/test/legacy/auto_check_sbp_system_MsgCsacTelemetry.c deleted file mode 100644 index 1451f40f22..0000000000 --- a/c/test/legacy/auto_check_sbp_system_MsgCsacTelemetry.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgCsacTelemetry.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_system_MsgCsacTelemetry) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xff04, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xff04, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 255, 244, 169, 10, 105, 115, 111, - 109, 101, 32, 100, 97, 116, 97, 229, 94, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_csac_telemetry_t *test_msg = (msg_csac_telemetry_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->id = 105; - { - const char assign_string[] = {(char)115, (char)111, (char)109, - (char)101, (char)32, (char)100, - (char)97, (char)116, (char)97}; - memcpy(test_msg->telemetry, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->telemetry) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0xff04, 43508, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 43508, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 43508, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xff04, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_csac_telemetry_t *check_msg = - (msg_csac_telemetry_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->id == 105, - "incorrect value for id, expected 105, is %d", check_msg->id); - { - const char check_string[] = {(char)115, (char)111, (char)109, - (char)101, (char)32, (char)100, - (char)97, (char)116, (char)97}; - ck_assert_msg( - memcmp(check_msg->telemetry, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->telemetry, expected string '%s', is " - "'%s'", - check_string, check_msg->telemetry); - } - } -} -END_TEST - -Suite *legacy_auto_check_sbp_system_MsgCsacTelemetry_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_system_MsgCsacTelemetry"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_system_MsgCsacTelemetry"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_system_MsgCsacTelemetry); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_system_MsgCsacTelemetryLabels.c b/c/test/legacy/auto_check_sbp_system_MsgCsacTelemetryLabels.c deleted file mode 100644 index 38d5e65ba9..0000000000 --- a/c/test/legacy/auto_check_sbp_system_MsgCsacTelemetryLabels.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgCsacTelemetryLabels.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_system_MsgCsacTelemetryLabels) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xff05, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xff05, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 5, 255, 91, 200, 12, 186, 115, 111, 109, - 101, 32, 108, 97, 98, 101, 108, 115, 86, 236, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_csac_telemetry_labels_t *test_msg = - (msg_csac_telemetry_labels_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->id = 186; - { - const char assign_string[] = {(char)115, (char)111, (char)109, (char)101, - (char)32, (char)108, (char)97, (char)98, - (char)101, (char)108, (char)115}; - memcpy(test_msg->telemetry_labels, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->telemetry_labels) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0xff05, 51291, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 51291, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 51291, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xff05, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_csac_telemetry_labels_t *check_msg = - (msg_csac_telemetry_labels_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->id == 186, - "incorrect value for id, expected 186, is %d", check_msg->id); - { - const char check_string[] = {(char)115, (char)111, (char)109, (char)101, - (char)32, (char)108, (char)97, (char)98, - (char)101, (char)108, (char)115}; - ck_assert_msg(memcmp(check_msg->telemetry_labels, check_string, - sizeof(check_string)) == 0, - "incorrect value for check_msg->telemetry_labels, expected " - "string '%s', is '%s'", - check_string, check_msg->telemetry_labels); - } - } -} -END_TEST - -Suite *legacy_auto_check_sbp_system_MsgCsacTelemetryLabels_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_system_MsgCsacTelemetryLabels"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_system_MsgCsacTelemetryLabels"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_system_MsgCsacTelemetryLabels); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_system_MsgDgnssStatus.c b/c/test/legacy/auto_check_sbp_system_MsgDgnssStatus.c deleted file mode 100644 index 65072ece7f..0000000000 --- a/c/test/legacy/auto_check_sbp_system_MsgDgnssStatus.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgDgnssStatus.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_system_MsgDgnssStatus) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xff02, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xff02, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 2, 255, 66, 0, 11, 0, 50, 0, 12, - 83, 107, 121, 108, 97, 114, 107, 202, 1, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_dgnss_status_t *test_msg = (msg_dgnss_status_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->latency = 50; - test_msg->num_signals = 12; - { - const char assign_string[] = {(char)83, (char)107, (char)121, (char)108, - (char)97, (char)114, (char)107}; - memcpy(test_msg->source, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->source) == 0) { - test_msg_len += sizeof(assign_string); - } - } - sbp_payload_send(&sbp_state, 0xff02, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xff02, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_dgnss_status_t *check_msg = - (msg_dgnss_status_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->latency == 50, - "incorrect value for latency, expected 50, is %d", - check_msg->latency); - ck_assert_msg(check_msg->num_signals == 12, - "incorrect value for num_signals, expected 12, is %d", - check_msg->num_signals); - { - const char check_string[] = {(char)83, (char)107, (char)121, (char)108, - (char)97, (char)114, (char)107}; - ck_assert_msg( - memcmp(check_msg->source, check_string, sizeof(check_string)) == 0, - "incorrect value for check_msg->source, expected string '%s', is " - "'%s'", - check_string, check_msg->source); - } - } -} -END_TEST - -Suite *legacy_auto_check_sbp_system_MsgDgnssStatus_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_system_MsgDgnssStatus"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_system_MsgDgnssStatus"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_system_MsgDgnssStatus); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_system_MsgGnssTimeOffset.c b/c/test/legacy/auto_check_sbp_system_MsgGnssTimeOffset.c deleted file mode 100644 index 92bfc1c633..0000000000 --- a/c/test/legacy/auto_check_sbp_system_MsgGnssTimeOffset.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgGnssTimeOffset.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_system_MsgGnssTimeOffset) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xff07, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xff07, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 7, 255, 22, 15, 9, 9, 58, 82, 83, 9, 103, 22, 37, 221, 84, 100, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_gnss_time_offset_t *test_msg = - (msg_gnss_time_offset_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 221; - test_msg->microseconds = 9494; - test_msg->milliseconds = 1728664402; - test_msg->weeks = 14857; - sbp_payload_send(&sbp_state, 0xff07, 3862, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 3862, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 3862, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xff07, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_gnss_time_offset_t *check_msg = - (msg_gnss_time_offset_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 221, - "incorrect value for flags, expected 221, is %d", - check_msg->flags); - ck_assert_msg(check_msg->microseconds == 9494, - "incorrect value for microseconds, expected 9494, is %d", - check_msg->microseconds); - ck_assert_msg( - check_msg->milliseconds == 1728664402, - "incorrect value for milliseconds, expected 1728664402, is %d", - check_msg->milliseconds); - ck_assert_msg(check_msg->weeks == 14857, - "incorrect value for weeks, expected 14857, is %d", - check_msg->weeks); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_system_MsgGnssTimeOffset_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_system_MsgGnssTimeOffset"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_system_MsgGnssTimeOffset"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_system_MsgGnssTimeOffset); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_system_MsgGroupMeta.c b/c/test/legacy/auto_check_sbp_system_MsgGroupMeta.c deleted file mode 100644 index 66339ba33c..0000000000 --- a/c/test/legacy/auto_check_sbp_system_MsgGroupMeta.c +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgGroupMeta.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_system_MsgGroupMeta) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xFF0A, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xFF0A, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 10, 255, 238, 238, 9, 1, 2, 3, 10, 255, 10, 2, 2, 255, 2, 14, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_group_meta_t* test_msg = (msg_group_meta_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 2; - test_msg->group_id = 1; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->group_msgs[0]); - } - test_msg->group_msgs[0] = 65290; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->group_msgs[0]); - } - test_msg->group_msgs[1] = 522; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->group_msgs[0]); - } - test_msg->group_msgs[2] = 65282; - test_msg->n_group_msgs = 3; - sbp_payload_send(&sbp_state, 0xFF0A, 61166, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 61166, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 61166, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xFF0A, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_group_meta_t* check_msg = (msg_group_meta_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 2, - "incorrect value for flags, expected 2, is %d", - check_msg->flags); - ck_assert_msg(check_msg->group_id == 1, - "incorrect value for group_id, expected 1, is %d", - check_msg->group_id); - ck_assert_msg(check_msg->group_msgs[0] == 65290, - "incorrect value for group_msgs[0], expected 65290, is %d", - check_msg->group_msgs[0]); - ck_assert_msg(check_msg->group_msgs[1] == 522, - "incorrect value for group_msgs[1], expected 522, is %d", - check_msg->group_msgs[1]); - ck_assert_msg(check_msg->group_msgs[2] == 65282, - "incorrect value for group_msgs[2], expected 65282, is %d", - check_msg->group_msgs[2]); - ck_assert_msg(check_msg->n_group_msgs == 3, - "incorrect value for n_group_msgs, expected 3, is %d", - check_msg->n_group_msgs); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xFF0A, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xFF0A, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 10, 255, 21, 3, 31, 1, 1, 14, 2, 1, 3, 1, - 10, 2, 17, 2, 9, 2, 20, 2, 14, 2, 18, 2, 13, - 2, 21, 2, 33, 2, 3, 255, 6, 255, 14, 255, 82, 154, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_group_meta_t* test_msg = (msg_group_meta_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 1; - test_msg->group_id = 1; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->group_msgs[0]); - } - test_msg->group_msgs[0] = 258; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->group_msgs[0]); - } - test_msg->group_msgs[1] = 259; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->group_msgs[0]); - } - test_msg->group_msgs[2] = 522; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->group_msgs[0]); - } - test_msg->group_msgs[3] = 529; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->group_msgs[0]); - } - test_msg->group_msgs[4] = 521; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->group_msgs[0]); - } - test_msg->group_msgs[5] = 532; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->group_msgs[0]); - } - test_msg->group_msgs[6] = 526; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->group_msgs[0]); - } - test_msg->group_msgs[7] = 530; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->group_msgs[0]); - } - test_msg->group_msgs[8] = 525; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->group_msgs[0]); - } - test_msg->group_msgs[9] = 533; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->group_msgs[0]); - } - test_msg->group_msgs[10] = 545; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->group_msgs[0]); - } - test_msg->group_msgs[11] = 65283; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->group_msgs[0]); - } - test_msg->group_msgs[12] = 65286; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->group_msgs[0]); - } - test_msg->group_msgs[13] = 65294; - test_msg->n_group_msgs = 14; - sbp_payload_send(&sbp_state, 0xFF0A, 789, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 789, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 789, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xFF0A, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_group_meta_t* check_msg = (msg_group_meta_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->group_id == 1, - "incorrect value for group_id, expected 1, is %d", - check_msg->group_id); - ck_assert_msg(check_msg->group_msgs[0] == 258, - "incorrect value for group_msgs[0], expected 258, is %d", - check_msg->group_msgs[0]); - ck_assert_msg(check_msg->group_msgs[1] == 259, - "incorrect value for group_msgs[1], expected 259, is %d", - check_msg->group_msgs[1]); - ck_assert_msg(check_msg->group_msgs[2] == 522, - "incorrect value for group_msgs[2], expected 522, is %d", - check_msg->group_msgs[2]); - ck_assert_msg(check_msg->group_msgs[3] == 529, - "incorrect value for group_msgs[3], expected 529, is %d", - check_msg->group_msgs[3]); - ck_assert_msg(check_msg->group_msgs[4] == 521, - "incorrect value for group_msgs[4], expected 521, is %d", - check_msg->group_msgs[4]); - ck_assert_msg(check_msg->group_msgs[5] == 532, - "incorrect value for group_msgs[5], expected 532, is %d", - check_msg->group_msgs[5]); - ck_assert_msg(check_msg->group_msgs[6] == 526, - "incorrect value for group_msgs[6], expected 526, is %d", - check_msg->group_msgs[6]); - ck_assert_msg(check_msg->group_msgs[7] == 530, - "incorrect value for group_msgs[7], expected 530, is %d", - check_msg->group_msgs[7]); - ck_assert_msg(check_msg->group_msgs[8] == 525, - "incorrect value for group_msgs[8], expected 525, is %d", - check_msg->group_msgs[8]); - ck_assert_msg(check_msg->group_msgs[9] == 533, - "incorrect value for group_msgs[9], expected 533, is %d", - check_msg->group_msgs[9]); - ck_assert_msg(check_msg->group_msgs[10] == 545, - "incorrect value for group_msgs[10], expected 545, is %d", - check_msg->group_msgs[10]); - ck_assert_msg(check_msg->group_msgs[11] == 65283, - "incorrect value for group_msgs[11], expected 65283, is %d", - check_msg->group_msgs[11]); - ck_assert_msg(check_msg->group_msgs[12] == 65286, - "incorrect value for group_msgs[12], expected 65286, is %d", - check_msg->group_msgs[12]); - ck_assert_msg(check_msg->group_msgs[13] == 65294, - "incorrect value for group_msgs[13], expected 65294, is %d", - check_msg->group_msgs[13]); - ck_assert_msg(check_msg->n_group_msgs == 14, - "incorrect value for n_group_msgs, expected 14, is %d", - check_msg->n_group_msgs); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_system_MsgGroupMeta_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_system_MsgGroupMeta"); - TCase* tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_system_MsgGroupMeta"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_system_MsgGroupMeta); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_system_MsgHeartbeat.c b/c/test/legacy/auto_check_sbp_system_MsgHeartbeat.c deleted file mode 100644 index 09ae9bfbdf..0000000000 --- a/c/test/legacy/auto_check_sbp_system_MsgHeartbeat.c +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgHeartbeat.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_system_MsgHeartbeat) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xffff, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xffff, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 255, 255, 246, 215, 4, 0, 50, 0, 0, 249, 216, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_heartbeat_t* test_msg = (msg_heartbeat_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 12800; - sbp_payload_send(&sbp_state, 0xffff, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xffff, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_heartbeat_t* check_msg = (msg_heartbeat_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 12800, - "incorrect value for flags, expected 12800, is %d", - check_msg->flags); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xffff, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xffff, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 255, 255, 195, 4, 4, 0, 0, 0, 0, 66, 57, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_heartbeat_t* test_msg = (msg_heartbeat_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - sbp_payload_send(&sbp_state, 0xffff, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xffff, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_heartbeat_t* check_msg = (msg_heartbeat_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_system_MsgHeartbeat_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_system_MsgHeartbeat"); - TCase* tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_system_MsgHeartbeat"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_system_MsgHeartbeat); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_system_MsgInsStatus.c b/c/test/legacy/auto_check_sbp_system_MsgInsStatus.c deleted file mode 100644 index 2543725b4f..0000000000 --- a/c/test/legacy/auto_check_sbp_system_MsgInsStatus.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgInsStatus.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_system_MsgInsStatus) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xff03, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xff03, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 3, 255, 21, 3, 4, 9, 0, 0, 32, 36, 103, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ins_status_t *test_msg = (msg_ins_status_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 536870921; - sbp_payload_send(&sbp_state, 0xff03, 789, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 789, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 789, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xff03, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ins_status_t *check_msg = (msg_ins_status_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 536870921, - "incorrect value for flags, expected 536870921, is %d", - check_msg->flags); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_system_MsgInsStatus_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_system_MsgInsStatus"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_system_MsgInsStatus"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_system_MsgInsStatus); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_system_MsgInsUpdates.c b/c/test/legacy/auto_check_sbp_system_MsgInsUpdates.c deleted file mode 100644 index ea53cfb853..0000000000 --- a/c/test/legacy/auto_check_sbp_system_MsgInsUpdates.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgInsUpdates.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_system_MsgInsUpdates) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xff06, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xff06, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 6, 255, 21, 3, 10, 84, 229, 17, 30, 0, 0, 0, 0, 0, 0, 81, 63, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_ins_updates_t *test_msg = (msg_ins_updates_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->gnsspos = 0; - test_msg->gnssvel = 0; - test_msg->nhc = 0; - test_msg->speed = 0; - test_msg->tow = 504489300; - test_msg->wheelticks = 0; - test_msg->zerovel = 0; - sbp_payload_send(&sbp_state, 0xff06, 789, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 789, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 789, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xff06, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_ins_updates_t *check_msg = (msg_ins_updates_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->gnsspos == 0, - "incorrect value for gnsspos, expected 0, is %d", - check_msg->gnsspos); - ck_assert_msg(check_msg->gnssvel == 0, - "incorrect value for gnssvel, expected 0, is %d", - check_msg->gnssvel); - ck_assert_msg(check_msg->nhc == 0, - "incorrect value for nhc, expected 0, is %d", check_msg->nhc); - ck_assert_msg(check_msg->speed == 0, - "incorrect value for speed, expected 0, is %d", - check_msg->speed); - ck_assert_msg(check_msg->tow == 504489300, - "incorrect value for tow, expected 504489300, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wheelticks == 0, - "incorrect value for wheelticks, expected 0, is %d", - check_msg->wheelticks); - ck_assert_msg(check_msg->zerovel == 0, - "incorrect value for zerovel, expected 0, is %d", - check_msg->zerovel); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_system_MsgInsUpdates_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_system_MsgInsUpdates"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_system_MsgInsUpdates"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_system_MsgInsUpdates); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_system_MsgPpsTime.c b/c/test/legacy/auto_check_sbp_system_MsgPpsTime.c deleted file mode 100644 index 72dccdbf99..0000000000 --- a/c/test/legacy/auto_check_sbp_system_MsgPpsTime.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgPpsTime.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_system_MsgPpsTime) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xff08, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xff08, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 8, 255, 222, 209, 9, 140, 146, 133, - 197, 160, 0, 0, 0, 255, 125, 149, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_pps_time_t *test_msg = (msg_pps_time_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 255; - test_msg->time = 690508632716; - sbp_payload_send(&sbp_state, 0xff08, 53726, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 53726, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 53726, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xff08, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_pps_time_t *check_msg = (msg_pps_time_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 255, - "incorrect value for flags, expected 255, is %d", - check_msg->flags); - ck_assert_msg(check_msg->time == 690508632716, - "incorrect value for time, expected 690508632716, is %d", - check_msg->time); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_system_MsgPpsTime_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_system_MsgPpsTime"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_system_MsgPpsTime"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_system_MsgPpsTime); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_system_MsgSensorAidEvent.c b/c/test/legacy/auto_check_sbp_system_MsgSensorAidEvent.c deleted file mode 100644 index 91e2b72373..0000000000 --- a/c/test/legacy/auto_check_sbp_system_MsgSensorAidEvent.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgSensorAidEvent.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_system_MsgSensorAidEvent) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xFF09, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xFF09, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 9, 255, 211, 136, 15, 48, 246, 122, 19, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 236, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_sensor_aid_event_t *test_msg = - (msg_sensor_aid_event_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 0; - test_msg->n_accepted_meas = 0; - test_msg->n_attempted_meas = 0; - test_msg->n_available_meas = 0; - test_msg->sensor_id = 0; - test_msg->sensor_state = 0; - test_msg->sensor_type = 0; - test_msg->time = 326825520; - sbp_payload_send(&sbp_state, 0xFF09, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xFF09, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_sensor_aid_event_t *check_msg = - (msg_sensor_aid_event_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 0, - "incorrect value for flags, expected 0, is %d", - check_msg->flags); - ck_assert_msg(check_msg->n_accepted_meas == 0, - "incorrect value for n_accepted_meas, expected 0, is %d", - check_msg->n_accepted_meas); - ck_assert_msg(check_msg->n_attempted_meas == 0, - "incorrect value for n_attempted_meas, expected 0, is %d", - check_msg->n_attempted_meas); - ck_assert_msg(check_msg->n_available_meas == 0, - "incorrect value for n_available_meas, expected 0, is %d", - check_msg->n_available_meas); - ck_assert_msg(check_msg->sensor_id == 0, - "incorrect value for sensor_id, expected 0, is %d", - check_msg->sensor_id); - ck_assert_msg(check_msg->sensor_state == 0, - "incorrect value for sensor_state, expected 0, is %d", - check_msg->sensor_state); - ck_assert_msg(check_msg->sensor_type == 0, - "incorrect value for sensor_type, expected 0, is %d", - check_msg->sensor_type); - ck_assert_msg(check_msg->time == 326825520, - "incorrect value for time, expected 326825520, is %d", - check_msg->time); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_system_MsgSensorAidEvent_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_system_MsgSensorAidEvent"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_system_MsgSensorAidEvent"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_system_MsgSensorAidEvent); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_system_MsgStartup.c b/c/test/legacy/auto_check_sbp_system_MsgStartup.c deleted file mode 100644 index 27d09507a4..0000000000 --- a/c/test/legacy/auto_check_sbp_system_MsgStartup.c +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgStartup.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_system_MsgStartup) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xff00, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xff00, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 255, 66, 0, 4, 0, 0, 0, 0, 70, 160, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_startup_t* test_msg = (msg_startup_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cause = 0; - test_msg->reserved = 0; - test_msg->startup_type = 0; - sbp_payload_send(&sbp_state, 0xff00, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xff00, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_startup_t* check_msg = (msg_startup_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cause == 0, - "incorrect value for cause, expected 0, is %d", - check_msg->cause); - ck_assert_msg(check_msg->reserved == 0, - "incorrect value for reserved, expected 0, is %d", - check_msg->reserved); - ck_assert_msg(check_msg->startup_type == 0, - "incorrect value for startup_type, expected 0, is %d", - check_msg->startup_type); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xff00, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xff00, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 255, 195, 4, 4, 0, 0, 0, 0, 127, 181, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_startup_t* test_msg = (msg_startup_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->cause = 0; - test_msg->reserved = 0; - test_msg->startup_type = 0; - sbp_payload_send(&sbp_state, 0xff00, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xff00, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_startup_t* check_msg = (msg_startup_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->cause == 0, - "incorrect value for cause, expected 0, is %d", - check_msg->cause); - ck_assert_msg(check_msg->reserved == 0, - "incorrect value for reserved, expected 0, is %d", - check_msg->reserved); - ck_assert_msg(check_msg->startup_type == 0, - "incorrect value for startup_type, expected 0, is %d", - check_msg->startup_type); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_system_MsgStartup_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_system_MsgStartup"); - TCase* tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_system_MsgStartup"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_system_MsgStartup); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_system_MsgStatusJournal.c b/c/test/legacy/auto_check_sbp_system_MsgStatusJournal.c deleted file mode 100644 index 231a020c9d..0000000000 --- a/c/test/legacy/auto_check_sbp_system_MsgStatusJournal.c +++ /dev/null @@ -1,426 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgStatusJournal.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_system_MsgStatusJournal) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xFFFD, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xFFFD, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 253, 255, 211, 136, 33, 1, 0, 1, 4, 100, 0, 0, 0, - 16, 146, 16, 0, 0, 6, 0, 1, 13, 186, 19, 0, 0, 6, - 0, 1, 14, 184, 34, 0, 0, 6, 0, 1, 15, 113, 119, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_status_journal_t* test_msg = (msg_status_journal_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->journal) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->journal[0]); - } - test_msg->journal[0].report.component = 6; - test_msg->journal[0].report.generic = 1; - test_msg->journal[0].report.specific = 13; - test_msg->journal[0].uptime = 4242; - if (sizeof(test_msg->journal) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->journal[0]); - } - test_msg->journal[1].report.component = 6; - test_msg->journal[1].report.generic = 1; - test_msg->journal[1].report.specific = 14; - test_msg->journal[1].uptime = 5050; - if (sizeof(test_msg->journal) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->journal[0]); - } - test_msg->journal[2].report.component = 6; - test_msg->journal[2].report.generic = 1; - test_msg->journal[2].report.specific = 15; - test_msg->journal[2].uptime = 8888; - test_msg->reporting_system = 1; - test_msg->sbp_version = 1025; - test_msg->sequence_descriptor = 16; - test_msg->total_status_reports = 100; - sbp_payload_send(&sbp_state, 0xFFFD, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xFFFD, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_status_journal_t* check_msg = - (msg_status_journal_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - check_msg->journal[0].report.component == 6, - "incorrect value for journal[0].report.component, expected 6, is %d", - check_msg->journal[0].report.component); - ck_assert_msg( - check_msg->journal[0].report.generic == 1, - "incorrect value for journal[0].report.generic, expected 1, is %d", - check_msg->journal[0].report.generic); - ck_assert_msg( - check_msg->journal[0].report.specific == 13, - "incorrect value for journal[0].report.specific, expected 13, is %d", - check_msg->journal[0].report.specific); - ck_assert_msg(check_msg->journal[0].uptime == 4242, - "incorrect value for journal[0].uptime, expected 4242, is %d", - check_msg->journal[0].uptime); - ck_assert_msg( - check_msg->journal[1].report.component == 6, - "incorrect value for journal[1].report.component, expected 6, is %d", - check_msg->journal[1].report.component); - ck_assert_msg( - check_msg->journal[1].report.generic == 1, - "incorrect value for journal[1].report.generic, expected 1, is %d", - check_msg->journal[1].report.generic); - ck_assert_msg( - check_msg->journal[1].report.specific == 14, - "incorrect value for journal[1].report.specific, expected 14, is %d", - check_msg->journal[1].report.specific); - ck_assert_msg(check_msg->journal[1].uptime == 5050, - "incorrect value for journal[1].uptime, expected 5050, is %d", - check_msg->journal[1].uptime); - ck_assert_msg( - check_msg->journal[2].report.component == 6, - "incorrect value for journal[2].report.component, expected 6, is %d", - check_msg->journal[2].report.component); - ck_assert_msg( - check_msg->journal[2].report.generic == 1, - "incorrect value for journal[2].report.generic, expected 1, is %d", - check_msg->journal[2].report.generic); - ck_assert_msg( - check_msg->journal[2].report.specific == 15, - "incorrect value for journal[2].report.specific, expected 15, is %d", - check_msg->journal[2].report.specific); - ck_assert_msg(check_msg->journal[2].uptime == 8888, - "incorrect value for journal[2].uptime, expected 8888, is %d", - check_msg->journal[2].uptime); - ck_assert_msg(check_msg->reporting_system == 1, - "incorrect value for reporting_system, expected 1, is %d", - check_msg->reporting_system); - ck_assert_msg(check_msg->sbp_version == 1025, - "incorrect value for sbp_version, expected 1025, is %d", - check_msg->sbp_version); - ck_assert_msg(check_msg->sequence_descriptor == 16, - "incorrect value for sequence_descriptor, expected 16, is %d", - check_msg->sequence_descriptor); - ck_assert_msg( - check_msg->total_status_reports == 100, - "incorrect value for total_status_reports, expected 100, is %d", - check_msg->total_status_reports); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xFFFD, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xFFFD, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 253, 255, 211, 136, 17, 1, 0, 1, 4, 100, 0, 0, - 0, 16, 146, 16, 0, 0, 6, 0, 1, 13, 144, 121, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_status_journal_t* test_msg = (msg_status_journal_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->journal) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->journal[0]); - } - test_msg->journal[0].report.component = 6; - test_msg->journal[0].report.generic = 1; - test_msg->journal[0].report.specific = 13; - test_msg->journal[0].uptime = 4242; - test_msg->reporting_system = 1; - test_msg->sbp_version = 1025; - test_msg->sequence_descriptor = 16; - test_msg->total_status_reports = 100; - sbp_payload_send(&sbp_state, 0xFFFD, 35027, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 35027, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 35027, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xFFFD, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_status_journal_t* check_msg = - (msg_status_journal_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - check_msg->journal[0].report.component == 6, - "incorrect value for journal[0].report.component, expected 6, is %d", - check_msg->journal[0].report.component); - ck_assert_msg( - check_msg->journal[0].report.generic == 1, - "incorrect value for journal[0].report.generic, expected 1, is %d", - check_msg->journal[0].report.generic); - ck_assert_msg( - check_msg->journal[0].report.specific == 13, - "incorrect value for journal[0].report.specific, expected 13, is %d", - check_msg->journal[0].report.specific); - ck_assert_msg(check_msg->journal[0].uptime == 4242, - "incorrect value for journal[0].uptime, expected 4242, is %d", - check_msg->journal[0].uptime); - ck_assert_msg(check_msg->reporting_system == 1, - "incorrect value for reporting_system, expected 1, is %d", - check_msg->reporting_system); - ck_assert_msg(check_msg->sbp_version == 1025, - "incorrect value for sbp_version, expected 1025, is %d", - check_msg->sbp_version); - ck_assert_msg(check_msg->sequence_descriptor == 16, - "incorrect value for sequence_descriptor, expected 16, is %d", - check_msg->sequence_descriptor); - ck_assert_msg( - check_msg->total_status_reports == 100, - "incorrect value for total_status_reports, expected 100, is %d", - check_msg->total_status_reports); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_system_MsgStatusJournal_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_system_MsgStatusJournal"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_system_MsgStatusJournal"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_system_MsgStatusJournal); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_system_MsgStatusReport.c b/c/test/legacy/auto_check_sbp_system_MsgStatusReport.c deleted file mode 100644 index 1bbbb31a52..0000000000 --- a/c/test/legacy/auto_check_sbp_system_MsgStatusReport.c +++ /dev/null @@ -1,1294 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgStatusReport.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_system_MsgStatusReport) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0xfffe, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0xfffe, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 254, 255, 6, 84, 252, 82, 253, 177, 95, 3, 60, 143, 90, - 233, 21, 208, 98, 247, 203, 221, 198, 156, 207, 217, 238, 162, 136, - 154, 11, 114, 236, 134, 235, 12, 133, 9, 30, 175, 145, 26, 114, - 215, 20, 146, 249, 54, 54, 133, 193, 106, 186, 210, 183, 0, 129, - 5, 248, 225, 149, 135, 127, 2, 26, 88, 92, 10, 103, 73, 3, - 103, 68, 76, 184, 33, 206, 194, 163, 123, 30, 151, 176, 149, 172, - 184, 231, 118, 230, 200, 168, 100, 109, 10, 233, 4, 60, 247, 82, - 215, 166, 28, 138, 110, 45, 98, 218, 244, 179, 126, 107, 92, 124, - 94, 157, 42, 187, 124, 6, 97, 247, 160, 188, 110, 120, 254, 214, - 110, 51, 240, 164, 147, 18, 74, 178, 67, 4, 27, 73, 190, 64, - 179, 146, 125, 153, 192, 46, 202, 66, 248, 46, 40, 161, 173, 242, - 214, 3, 11, 1, 118, 70, 162, 61, 178, 27, 156, 40, 191, 113, - 230, 200, 72, 8, 215, 245, 78, 59, 222, 250, 115, 32, 33, 30, - 211, 170, 145, 92, 157, 75, 24, 169, 6, 55, 62, 8, 107, 82, - 140, 49, 179, 122, 90, 71, 28, 88, 103, 51, 177, 72, 93, 39, - 148, 11, 202, 42, 34, 92, 204, 102, 29, 98, 249, 91, 134, 95, - 23, 248, 192, 20, 83, 195, 95, 180, 54, 36, 186, 75, 64, 20, - 157, 133, 12, 149, 28, 14, 185, 129, 101, 239, 74, 248, 245, 30, - 228, 88, 142, 212, 53, 224, 158, 166, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_status_report_t *test_msg = (msg_status_report_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->reporting_system = 64850; - test_msg->sbp_version = 24497; - test_msg->sequence = 1519336451; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[0].component = 52215; - test_msg->status[0].generic = 221; - test_msg->status[0].specific = 198; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[1].component = 53148; - test_msg->status[1].generic = 217; - test_msg->status[1].specific = 238; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[2].component = 34978; - test_msg->status[2].generic = 154; - test_msg->status[2].specific = 11; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[3].component = 60530; - test_msg->status[3].generic = 134; - test_msg->status[3].specific = 235; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[4].component = 34060; - test_msg->status[4].generic = 9; - test_msg->status[4].specific = 30; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[5].component = 37295; - test_msg->status[5].generic = 26; - test_msg->status[5].specific = 114; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[6].component = 5335; - test_msg->status[6].generic = 146; - test_msg->status[6].specific = 249; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[7].component = 13878; - test_msg->status[7].generic = 133; - test_msg->status[7].specific = 193; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[8].component = 47722; - test_msg->status[8].generic = 210; - test_msg->status[8].specific = 183; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[9].component = 33024; - test_msg->status[9].generic = 5; - test_msg->status[9].specific = 248; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[10].component = 38369; - test_msg->status[10].generic = 135; - test_msg->status[10].specific = 127; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[11].component = 6658; - test_msg->status[11].generic = 88; - test_msg->status[11].specific = 92; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[12].component = 26378; - test_msg->status[12].generic = 73; - test_msg->status[12].specific = 3; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[13].component = 17511; - test_msg->status[13].generic = 76; - test_msg->status[13].specific = 184; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[14].component = 52769; - test_msg->status[14].generic = 194; - test_msg->status[14].specific = 163; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[15].component = 7803; - test_msg->status[15].generic = 151; - test_msg->status[15].specific = 176; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[16].component = 44181; - test_msg->status[16].generic = 184; - test_msg->status[16].specific = 231; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[17].component = 58998; - test_msg->status[17].generic = 200; - test_msg->status[17].specific = 168; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[18].component = 28004; - test_msg->status[18].generic = 10; - test_msg->status[18].specific = 233; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[19].component = 15364; - test_msg->status[19].generic = 247; - test_msg->status[19].specific = 82; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[20].component = 42711; - test_msg->status[20].generic = 28; - test_msg->status[20].specific = 138; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[21].component = 11630; - test_msg->status[21].generic = 98; - test_msg->status[21].specific = 218; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[22].component = 46068; - test_msg->status[22].generic = 126; - test_msg->status[22].specific = 107; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[23].component = 31836; - test_msg->status[23].generic = 94; - test_msg->status[23].specific = 157; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[24].component = 47914; - test_msg->status[24].generic = 124; - test_msg->status[24].specific = 6; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[25].component = 63329; - test_msg->status[25].generic = 160; - test_msg->status[25].specific = 188; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[26].component = 30830; - test_msg->status[26].generic = 254; - test_msg->status[26].specific = 214; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[27].component = 13166; - test_msg->status[27].generic = 240; - test_msg->status[27].specific = 164; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[28].component = 4755; - test_msg->status[28].generic = 74; - test_msg->status[28].specific = 178; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[29].component = 1091; - test_msg->status[29].generic = 27; - test_msg->status[29].specific = 73; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[30].component = 16574; - test_msg->status[30].generic = 179; - test_msg->status[30].specific = 146; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[31].component = 39293; - test_msg->status[31].generic = 192; - test_msg->status[31].specific = 46; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[32].component = 17098; - test_msg->status[32].generic = 248; - test_msg->status[32].specific = 46; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[33].component = 41256; - test_msg->status[33].generic = 173; - test_msg->status[33].specific = 242; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[34].component = 982; - test_msg->status[34].generic = 11; - test_msg->status[34].specific = 1; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[35].component = 18038; - test_msg->status[35].generic = 162; - test_msg->status[35].specific = 61; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[36].component = 7090; - test_msg->status[36].generic = 156; - test_msg->status[36].specific = 40; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[37].component = 29119; - test_msg->status[37].generic = 230; - test_msg->status[37].specific = 200; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[38].component = 2120; - test_msg->status[38].generic = 215; - test_msg->status[38].specific = 245; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[39].component = 15182; - test_msg->status[39].generic = 222; - test_msg->status[39].specific = 250; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[40].component = 8307; - test_msg->status[40].generic = 33; - test_msg->status[40].specific = 30; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[41].component = 43731; - test_msg->status[41].generic = 145; - test_msg->status[41].specific = 92; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[42].component = 19357; - test_msg->status[42].generic = 24; - test_msg->status[42].specific = 169; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[43].component = 14086; - test_msg->status[43].generic = 62; - test_msg->status[43].specific = 8; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[44].component = 21099; - test_msg->status[44].generic = 140; - test_msg->status[44].specific = 49; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[45].component = 31411; - test_msg->status[45].generic = 90; - test_msg->status[45].specific = 71; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[46].component = 22556; - test_msg->status[46].generic = 103; - test_msg->status[46].specific = 51; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[47].component = 18609; - test_msg->status[47].generic = 93; - test_msg->status[47].specific = 39; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[48].component = 2964; - test_msg->status[48].generic = 202; - test_msg->status[48].specific = 42; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[49].component = 23586; - test_msg->status[49].generic = 204; - test_msg->status[49].specific = 102; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[50].component = 25117; - test_msg->status[50].generic = 249; - test_msg->status[50].specific = 91; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[51].component = 24454; - test_msg->status[51].generic = 23; - test_msg->status[51].specific = 248; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[52].component = 5312; - test_msg->status[52].generic = 83; - test_msg->status[52].specific = 195; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[53].component = 46175; - test_msg->status[53].generic = 54; - test_msg->status[53].specific = 36; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[54].component = 19386; - test_msg->status[54].generic = 64; - test_msg->status[54].specific = 20; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[55].component = 34205; - test_msg->status[55].generic = 12; - test_msg->status[55].specific = 149; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[56].component = 3612; - test_msg->status[56].generic = 185; - test_msg->status[56].specific = 129; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[57].component = 61285; - test_msg->status[57].generic = 74; - test_msg->status[57].specific = 248; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[58].component = 7925; - test_msg->status[58].generic = 228; - test_msg->status[58].specific = 88; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->status[0]); - } - test_msg->status[59].component = 54414; - test_msg->status[59].generic = 53; - test_msg->status[59].specific = 224; - test_msg->uptime = 1657804265; - sbp_payload_send(&sbp_state, 0xfffe, 21510, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 21510, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 21510, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0xfffe, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_status_report_t *check_msg = - (msg_status_report_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->reporting_system == 64850, - "incorrect value for reporting_system, expected 64850, is %d", - check_msg->reporting_system); - ck_assert_msg(check_msg->sbp_version == 24497, - "incorrect value for sbp_version, expected 24497, is %d", - check_msg->sbp_version); - ck_assert_msg(check_msg->sequence == 1519336451, - "incorrect value for sequence, expected 1519336451, is %d", - check_msg->sequence); - ck_assert_msg( - check_msg->status[0].component == 52215, - "incorrect value for status[0].component, expected 52215, is %d", - check_msg->status[0].component); - ck_assert_msg(check_msg->status[0].generic == 221, - "incorrect value for status[0].generic, expected 221, is %d", - check_msg->status[0].generic); - ck_assert_msg(check_msg->status[0].specific == 198, - "incorrect value for status[0].specific, expected 198, is %d", - check_msg->status[0].specific); - ck_assert_msg( - check_msg->status[1].component == 53148, - "incorrect value for status[1].component, expected 53148, is %d", - check_msg->status[1].component); - ck_assert_msg(check_msg->status[1].generic == 217, - "incorrect value for status[1].generic, expected 217, is %d", - check_msg->status[1].generic); - ck_assert_msg(check_msg->status[1].specific == 238, - "incorrect value for status[1].specific, expected 238, is %d", - check_msg->status[1].specific); - ck_assert_msg( - check_msg->status[2].component == 34978, - "incorrect value for status[2].component, expected 34978, is %d", - check_msg->status[2].component); - ck_assert_msg(check_msg->status[2].generic == 154, - "incorrect value for status[2].generic, expected 154, is %d", - check_msg->status[2].generic); - ck_assert_msg(check_msg->status[2].specific == 11, - "incorrect value for status[2].specific, expected 11, is %d", - check_msg->status[2].specific); - ck_assert_msg( - check_msg->status[3].component == 60530, - "incorrect value for status[3].component, expected 60530, is %d", - check_msg->status[3].component); - ck_assert_msg(check_msg->status[3].generic == 134, - "incorrect value for status[3].generic, expected 134, is %d", - check_msg->status[3].generic); - ck_assert_msg(check_msg->status[3].specific == 235, - "incorrect value for status[3].specific, expected 235, is %d", - check_msg->status[3].specific); - ck_assert_msg( - check_msg->status[4].component == 34060, - "incorrect value for status[4].component, expected 34060, is %d", - check_msg->status[4].component); - ck_assert_msg(check_msg->status[4].generic == 9, - "incorrect value for status[4].generic, expected 9, is %d", - check_msg->status[4].generic); - ck_assert_msg(check_msg->status[4].specific == 30, - "incorrect value for status[4].specific, expected 30, is %d", - check_msg->status[4].specific); - ck_assert_msg( - check_msg->status[5].component == 37295, - "incorrect value for status[5].component, expected 37295, is %d", - check_msg->status[5].component); - ck_assert_msg(check_msg->status[5].generic == 26, - "incorrect value for status[5].generic, expected 26, is %d", - check_msg->status[5].generic); - ck_assert_msg(check_msg->status[5].specific == 114, - "incorrect value for status[5].specific, expected 114, is %d", - check_msg->status[5].specific); - ck_assert_msg( - check_msg->status[6].component == 5335, - "incorrect value for status[6].component, expected 5335, is %d", - check_msg->status[6].component); - ck_assert_msg(check_msg->status[6].generic == 146, - "incorrect value for status[6].generic, expected 146, is %d", - check_msg->status[6].generic); - ck_assert_msg(check_msg->status[6].specific == 249, - "incorrect value for status[6].specific, expected 249, is %d", - check_msg->status[6].specific); - ck_assert_msg( - check_msg->status[7].component == 13878, - "incorrect value for status[7].component, expected 13878, is %d", - check_msg->status[7].component); - ck_assert_msg(check_msg->status[7].generic == 133, - "incorrect value for status[7].generic, expected 133, is %d", - check_msg->status[7].generic); - ck_assert_msg(check_msg->status[7].specific == 193, - "incorrect value for status[7].specific, expected 193, is %d", - check_msg->status[7].specific); - ck_assert_msg( - check_msg->status[8].component == 47722, - "incorrect value for status[8].component, expected 47722, is %d", - check_msg->status[8].component); - ck_assert_msg(check_msg->status[8].generic == 210, - "incorrect value for status[8].generic, expected 210, is %d", - check_msg->status[8].generic); - ck_assert_msg(check_msg->status[8].specific == 183, - "incorrect value for status[8].specific, expected 183, is %d", - check_msg->status[8].specific); - ck_assert_msg( - check_msg->status[9].component == 33024, - "incorrect value for status[9].component, expected 33024, is %d", - check_msg->status[9].component); - ck_assert_msg(check_msg->status[9].generic == 5, - "incorrect value for status[9].generic, expected 5, is %d", - check_msg->status[9].generic); - ck_assert_msg(check_msg->status[9].specific == 248, - "incorrect value for status[9].specific, expected 248, is %d", - check_msg->status[9].specific); - ck_assert_msg( - check_msg->status[10].component == 38369, - "incorrect value for status[10].component, expected 38369, is %d", - check_msg->status[10].component); - ck_assert_msg(check_msg->status[10].generic == 135, - "incorrect value for status[10].generic, expected 135, is %d", - check_msg->status[10].generic); - ck_assert_msg( - check_msg->status[10].specific == 127, - "incorrect value for status[10].specific, expected 127, is %d", - check_msg->status[10].specific); - ck_assert_msg( - check_msg->status[11].component == 6658, - "incorrect value for status[11].component, expected 6658, is %d", - check_msg->status[11].component); - ck_assert_msg(check_msg->status[11].generic == 88, - "incorrect value for status[11].generic, expected 88, is %d", - check_msg->status[11].generic); - ck_assert_msg(check_msg->status[11].specific == 92, - "incorrect value for status[11].specific, expected 92, is %d", - check_msg->status[11].specific); - ck_assert_msg( - check_msg->status[12].component == 26378, - "incorrect value for status[12].component, expected 26378, is %d", - check_msg->status[12].component); - ck_assert_msg(check_msg->status[12].generic == 73, - "incorrect value for status[12].generic, expected 73, is %d", - check_msg->status[12].generic); - ck_assert_msg(check_msg->status[12].specific == 3, - "incorrect value for status[12].specific, expected 3, is %d", - check_msg->status[12].specific); - ck_assert_msg( - check_msg->status[13].component == 17511, - "incorrect value for status[13].component, expected 17511, is %d", - check_msg->status[13].component); - ck_assert_msg(check_msg->status[13].generic == 76, - "incorrect value for status[13].generic, expected 76, is %d", - check_msg->status[13].generic); - ck_assert_msg( - check_msg->status[13].specific == 184, - "incorrect value for status[13].specific, expected 184, is %d", - check_msg->status[13].specific); - ck_assert_msg( - check_msg->status[14].component == 52769, - "incorrect value for status[14].component, expected 52769, is %d", - check_msg->status[14].component); - ck_assert_msg(check_msg->status[14].generic == 194, - "incorrect value for status[14].generic, expected 194, is %d", - check_msg->status[14].generic); - ck_assert_msg( - check_msg->status[14].specific == 163, - "incorrect value for status[14].specific, expected 163, is %d", - check_msg->status[14].specific); - ck_assert_msg( - check_msg->status[15].component == 7803, - "incorrect value for status[15].component, expected 7803, is %d", - check_msg->status[15].component); - ck_assert_msg(check_msg->status[15].generic == 151, - "incorrect value for status[15].generic, expected 151, is %d", - check_msg->status[15].generic); - ck_assert_msg( - check_msg->status[15].specific == 176, - "incorrect value for status[15].specific, expected 176, is %d", - check_msg->status[15].specific); - ck_assert_msg( - check_msg->status[16].component == 44181, - "incorrect value for status[16].component, expected 44181, is %d", - check_msg->status[16].component); - ck_assert_msg(check_msg->status[16].generic == 184, - "incorrect value for status[16].generic, expected 184, is %d", - check_msg->status[16].generic); - ck_assert_msg( - check_msg->status[16].specific == 231, - "incorrect value for status[16].specific, expected 231, is %d", - check_msg->status[16].specific); - ck_assert_msg( - check_msg->status[17].component == 58998, - "incorrect value for status[17].component, expected 58998, is %d", - check_msg->status[17].component); - ck_assert_msg(check_msg->status[17].generic == 200, - "incorrect value for status[17].generic, expected 200, is %d", - check_msg->status[17].generic); - ck_assert_msg( - check_msg->status[17].specific == 168, - "incorrect value for status[17].specific, expected 168, is %d", - check_msg->status[17].specific); - ck_assert_msg( - check_msg->status[18].component == 28004, - "incorrect value for status[18].component, expected 28004, is %d", - check_msg->status[18].component); - ck_assert_msg(check_msg->status[18].generic == 10, - "incorrect value for status[18].generic, expected 10, is %d", - check_msg->status[18].generic); - ck_assert_msg( - check_msg->status[18].specific == 233, - "incorrect value for status[18].specific, expected 233, is %d", - check_msg->status[18].specific); - ck_assert_msg( - check_msg->status[19].component == 15364, - "incorrect value for status[19].component, expected 15364, is %d", - check_msg->status[19].component); - ck_assert_msg(check_msg->status[19].generic == 247, - "incorrect value for status[19].generic, expected 247, is %d", - check_msg->status[19].generic); - ck_assert_msg(check_msg->status[19].specific == 82, - "incorrect value for status[19].specific, expected 82, is %d", - check_msg->status[19].specific); - ck_assert_msg( - check_msg->status[20].component == 42711, - "incorrect value for status[20].component, expected 42711, is %d", - check_msg->status[20].component); - ck_assert_msg(check_msg->status[20].generic == 28, - "incorrect value for status[20].generic, expected 28, is %d", - check_msg->status[20].generic); - ck_assert_msg( - check_msg->status[20].specific == 138, - "incorrect value for status[20].specific, expected 138, is %d", - check_msg->status[20].specific); - ck_assert_msg( - check_msg->status[21].component == 11630, - "incorrect value for status[21].component, expected 11630, is %d", - check_msg->status[21].component); - ck_assert_msg(check_msg->status[21].generic == 98, - "incorrect value for status[21].generic, expected 98, is %d", - check_msg->status[21].generic); - ck_assert_msg( - check_msg->status[21].specific == 218, - "incorrect value for status[21].specific, expected 218, is %d", - check_msg->status[21].specific); - ck_assert_msg( - check_msg->status[22].component == 46068, - "incorrect value for status[22].component, expected 46068, is %d", - check_msg->status[22].component); - ck_assert_msg(check_msg->status[22].generic == 126, - "incorrect value for status[22].generic, expected 126, is %d", - check_msg->status[22].generic); - ck_assert_msg( - check_msg->status[22].specific == 107, - "incorrect value for status[22].specific, expected 107, is %d", - check_msg->status[22].specific); - ck_assert_msg( - check_msg->status[23].component == 31836, - "incorrect value for status[23].component, expected 31836, is %d", - check_msg->status[23].component); - ck_assert_msg(check_msg->status[23].generic == 94, - "incorrect value for status[23].generic, expected 94, is %d", - check_msg->status[23].generic); - ck_assert_msg( - check_msg->status[23].specific == 157, - "incorrect value for status[23].specific, expected 157, is %d", - check_msg->status[23].specific); - ck_assert_msg( - check_msg->status[24].component == 47914, - "incorrect value for status[24].component, expected 47914, is %d", - check_msg->status[24].component); - ck_assert_msg(check_msg->status[24].generic == 124, - "incorrect value for status[24].generic, expected 124, is %d", - check_msg->status[24].generic); - ck_assert_msg(check_msg->status[24].specific == 6, - "incorrect value for status[24].specific, expected 6, is %d", - check_msg->status[24].specific); - ck_assert_msg( - check_msg->status[25].component == 63329, - "incorrect value for status[25].component, expected 63329, is %d", - check_msg->status[25].component); - ck_assert_msg(check_msg->status[25].generic == 160, - "incorrect value for status[25].generic, expected 160, is %d", - check_msg->status[25].generic); - ck_assert_msg( - check_msg->status[25].specific == 188, - "incorrect value for status[25].specific, expected 188, is %d", - check_msg->status[25].specific); - ck_assert_msg( - check_msg->status[26].component == 30830, - "incorrect value for status[26].component, expected 30830, is %d", - check_msg->status[26].component); - ck_assert_msg(check_msg->status[26].generic == 254, - "incorrect value for status[26].generic, expected 254, is %d", - check_msg->status[26].generic); - ck_assert_msg( - check_msg->status[26].specific == 214, - "incorrect value for status[26].specific, expected 214, is %d", - check_msg->status[26].specific); - ck_assert_msg( - check_msg->status[27].component == 13166, - "incorrect value for status[27].component, expected 13166, is %d", - check_msg->status[27].component); - ck_assert_msg(check_msg->status[27].generic == 240, - "incorrect value for status[27].generic, expected 240, is %d", - check_msg->status[27].generic); - ck_assert_msg( - check_msg->status[27].specific == 164, - "incorrect value for status[27].specific, expected 164, is %d", - check_msg->status[27].specific); - ck_assert_msg( - check_msg->status[28].component == 4755, - "incorrect value for status[28].component, expected 4755, is %d", - check_msg->status[28].component); - ck_assert_msg(check_msg->status[28].generic == 74, - "incorrect value for status[28].generic, expected 74, is %d", - check_msg->status[28].generic); - ck_assert_msg( - check_msg->status[28].specific == 178, - "incorrect value for status[28].specific, expected 178, is %d", - check_msg->status[28].specific); - ck_assert_msg( - check_msg->status[29].component == 1091, - "incorrect value for status[29].component, expected 1091, is %d", - check_msg->status[29].component); - ck_assert_msg(check_msg->status[29].generic == 27, - "incorrect value for status[29].generic, expected 27, is %d", - check_msg->status[29].generic); - ck_assert_msg(check_msg->status[29].specific == 73, - "incorrect value for status[29].specific, expected 73, is %d", - check_msg->status[29].specific); - ck_assert_msg( - check_msg->status[30].component == 16574, - "incorrect value for status[30].component, expected 16574, is %d", - check_msg->status[30].component); - ck_assert_msg(check_msg->status[30].generic == 179, - "incorrect value for status[30].generic, expected 179, is %d", - check_msg->status[30].generic); - ck_assert_msg( - check_msg->status[30].specific == 146, - "incorrect value for status[30].specific, expected 146, is %d", - check_msg->status[30].specific); - ck_assert_msg( - check_msg->status[31].component == 39293, - "incorrect value for status[31].component, expected 39293, is %d", - check_msg->status[31].component); - ck_assert_msg(check_msg->status[31].generic == 192, - "incorrect value for status[31].generic, expected 192, is %d", - check_msg->status[31].generic); - ck_assert_msg(check_msg->status[31].specific == 46, - "incorrect value for status[31].specific, expected 46, is %d", - check_msg->status[31].specific); - ck_assert_msg( - check_msg->status[32].component == 17098, - "incorrect value for status[32].component, expected 17098, is %d", - check_msg->status[32].component); - ck_assert_msg(check_msg->status[32].generic == 248, - "incorrect value for status[32].generic, expected 248, is %d", - check_msg->status[32].generic); - ck_assert_msg(check_msg->status[32].specific == 46, - "incorrect value for status[32].specific, expected 46, is %d", - check_msg->status[32].specific); - ck_assert_msg( - check_msg->status[33].component == 41256, - "incorrect value for status[33].component, expected 41256, is %d", - check_msg->status[33].component); - ck_assert_msg(check_msg->status[33].generic == 173, - "incorrect value for status[33].generic, expected 173, is %d", - check_msg->status[33].generic); - ck_assert_msg( - check_msg->status[33].specific == 242, - "incorrect value for status[33].specific, expected 242, is %d", - check_msg->status[33].specific); - ck_assert_msg( - check_msg->status[34].component == 982, - "incorrect value for status[34].component, expected 982, is %d", - check_msg->status[34].component); - ck_assert_msg(check_msg->status[34].generic == 11, - "incorrect value for status[34].generic, expected 11, is %d", - check_msg->status[34].generic); - ck_assert_msg(check_msg->status[34].specific == 1, - "incorrect value for status[34].specific, expected 1, is %d", - check_msg->status[34].specific); - ck_assert_msg( - check_msg->status[35].component == 18038, - "incorrect value for status[35].component, expected 18038, is %d", - check_msg->status[35].component); - ck_assert_msg(check_msg->status[35].generic == 162, - "incorrect value for status[35].generic, expected 162, is %d", - check_msg->status[35].generic); - ck_assert_msg(check_msg->status[35].specific == 61, - "incorrect value for status[35].specific, expected 61, is %d", - check_msg->status[35].specific); - ck_assert_msg( - check_msg->status[36].component == 7090, - "incorrect value for status[36].component, expected 7090, is %d", - check_msg->status[36].component); - ck_assert_msg(check_msg->status[36].generic == 156, - "incorrect value for status[36].generic, expected 156, is %d", - check_msg->status[36].generic); - ck_assert_msg(check_msg->status[36].specific == 40, - "incorrect value for status[36].specific, expected 40, is %d", - check_msg->status[36].specific); - ck_assert_msg( - check_msg->status[37].component == 29119, - "incorrect value for status[37].component, expected 29119, is %d", - check_msg->status[37].component); - ck_assert_msg(check_msg->status[37].generic == 230, - "incorrect value for status[37].generic, expected 230, is %d", - check_msg->status[37].generic); - ck_assert_msg( - check_msg->status[37].specific == 200, - "incorrect value for status[37].specific, expected 200, is %d", - check_msg->status[37].specific); - ck_assert_msg( - check_msg->status[38].component == 2120, - "incorrect value for status[38].component, expected 2120, is %d", - check_msg->status[38].component); - ck_assert_msg(check_msg->status[38].generic == 215, - "incorrect value for status[38].generic, expected 215, is %d", - check_msg->status[38].generic); - ck_assert_msg( - check_msg->status[38].specific == 245, - "incorrect value for status[38].specific, expected 245, is %d", - check_msg->status[38].specific); - ck_assert_msg( - check_msg->status[39].component == 15182, - "incorrect value for status[39].component, expected 15182, is %d", - check_msg->status[39].component); - ck_assert_msg(check_msg->status[39].generic == 222, - "incorrect value for status[39].generic, expected 222, is %d", - check_msg->status[39].generic); - ck_assert_msg( - check_msg->status[39].specific == 250, - "incorrect value for status[39].specific, expected 250, is %d", - check_msg->status[39].specific); - ck_assert_msg( - check_msg->status[40].component == 8307, - "incorrect value for status[40].component, expected 8307, is %d", - check_msg->status[40].component); - ck_assert_msg(check_msg->status[40].generic == 33, - "incorrect value for status[40].generic, expected 33, is %d", - check_msg->status[40].generic); - ck_assert_msg(check_msg->status[40].specific == 30, - "incorrect value for status[40].specific, expected 30, is %d", - check_msg->status[40].specific); - ck_assert_msg( - check_msg->status[41].component == 43731, - "incorrect value for status[41].component, expected 43731, is %d", - check_msg->status[41].component); - ck_assert_msg(check_msg->status[41].generic == 145, - "incorrect value for status[41].generic, expected 145, is %d", - check_msg->status[41].generic); - ck_assert_msg(check_msg->status[41].specific == 92, - "incorrect value for status[41].specific, expected 92, is %d", - check_msg->status[41].specific); - ck_assert_msg( - check_msg->status[42].component == 19357, - "incorrect value for status[42].component, expected 19357, is %d", - check_msg->status[42].component); - ck_assert_msg(check_msg->status[42].generic == 24, - "incorrect value for status[42].generic, expected 24, is %d", - check_msg->status[42].generic); - ck_assert_msg( - check_msg->status[42].specific == 169, - "incorrect value for status[42].specific, expected 169, is %d", - check_msg->status[42].specific); - ck_assert_msg( - check_msg->status[43].component == 14086, - "incorrect value for status[43].component, expected 14086, is %d", - check_msg->status[43].component); - ck_assert_msg(check_msg->status[43].generic == 62, - "incorrect value for status[43].generic, expected 62, is %d", - check_msg->status[43].generic); - ck_assert_msg(check_msg->status[43].specific == 8, - "incorrect value for status[43].specific, expected 8, is %d", - check_msg->status[43].specific); - ck_assert_msg( - check_msg->status[44].component == 21099, - "incorrect value for status[44].component, expected 21099, is %d", - check_msg->status[44].component); - ck_assert_msg(check_msg->status[44].generic == 140, - "incorrect value for status[44].generic, expected 140, is %d", - check_msg->status[44].generic); - ck_assert_msg(check_msg->status[44].specific == 49, - "incorrect value for status[44].specific, expected 49, is %d", - check_msg->status[44].specific); - ck_assert_msg( - check_msg->status[45].component == 31411, - "incorrect value for status[45].component, expected 31411, is %d", - check_msg->status[45].component); - ck_assert_msg(check_msg->status[45].generic == 90, - "incorrect value for status[45].generic, expected 90, is %d", - check_msg->status[45].generic); - ck_assert_msg(check_msg->status[45].specific == 71, - "incorrect value for status[45].specific, expected 71, is %d", - check_msg->status[45].specific); - ck_assert_msg( - check_msg->status[46].component == 22556, - "incorrect value for status[46].component, expected 22556, is %d", - check_msg->status[46].component); - ck_assert_msg(check_msg->status[46].generic == 103, - "incorrect value for status[46].generic, expected 103, is %d", - check_msg->status[46].generic); - ck_assert_msg(check_msg->status[46].specific == 51, - "incorrect value for status[46].specific, expected 51, is %d", - check_msg->status[46].specific); - ck_assert_msg( - check_msg->status[47].component == 18609, - "incorrect value for status[47].component, expected 18609, is %d", - check_msg->status[47].component); - ck_assert_msg(check_msg->status[47].generic == 93, - "incorrect value for status[47].generic, expected 93, is %d", - check_msg->status[47].generic); - ck_assert_msg(check_msg->status[47].specific == 39, - "incorrect value for status[47].specific, expected 39, is %d", - check_msg->status[47].specific); - ck_assert_msg( - check_msg->status[48].component == 2964, - "incorrect value for status[48].component, expected 2964, is %d", - check_msg->status[48].component); - ck_assert_msg(check_msg->status[48].generic == 202, - "incorrect value for status[48].generic, expected 202, is %d", - check_msg->status[48].generic); - ck_assert_msg(check_msg->status[48].specific == 42, - "incorrect value for status[48].specific, expected 42, is %d", - check_msg->status[48].specific); - ck_assert_msg( - check_msg->status[49].component == 23586, - "incorrect value for status[49].component, expected 23586, is %d", - check_msg->status[49].component); - ck_assert_msg(check_msg->status[49].generic == 204, - "incorrect value for status[49].generic, expected 204, is %d", - check_msg->status[49].generic); - ck_assert_msg( - check_msg->status[49].specific == 102, - "incorrect value for status[49].specific, expected 102, is %d", - check_msg->status[49].specific); - ck_assert_msg( - check_msg->status[50].component == 25117, - "incorrect value for status[50].component, expected 25117, is %d", - check_msg->status[50].component); - ck_assert_msg(check_msg->status[50].generic == 249, - "incorrect value for status[50].generic, expected 249, is %d", - check_msg->status[50].generic); - ck_assert_msg(check_msg->status[50].specific == 91, - "incorrect value for status[50].specific, expected 91, is %d", - check_msg->status[50].specific); - ck_assert_msg( - check_msg->status[51].component == 24454, - "incorrect value for status[51].component, expected 24454, is %d", - check_msg->status[51].component); - ck_assert_msg(check_msg->status[51].generic == 23, - "incorrect value for status[51].generic, expected 23, is %d", - check_msg->status[51].generic); - ck_assert_msg( - check_msg->status[51].specific == 248, - "incorrect value for status[51].specific, expected 248, is %d", - check_msg->status[51].specific); - ck_assert_msg( - check_msg->status[52].component == 5312, - "incorrect value for status[52].component, expected 5312, is %d", - check_msg->status[52].component); - ck_assert_msg(check_msg->status[52].generic == 83, - "incorrect value for status[52].generic, expected 83, is %d", - check_msg->status[52].generic); - ck_assert_msg( - check_msg->status[52].specific == 195, - "incorrect value for status[52].specific, expected 195, is %d", - check_msg->status[52].specific); - ck_assert_msg( - check_msg->status[53].component == 46175, - "incorrect value for status[53].component, expected 46175, is %d", - check_msg->status[53].component); - ck_assert_msg(check_msg->status[53].generic == 54, - "incorrect value for status[53].generic, expected 54, is %d", - check_msg->status[53].generic); - ck_assert_msg(check_msg->status[53].specific == 36, - "incorrect value for status[53].specific, expected 36, is %d", - check_msg->status[53].specific); - ck_assert_msg( - check_msg->status[54].component == 19386, - "incorrect value for status[54].component, expected 19386, is %d", - check_msg->status[54].component); - ck_assert_msg(check_msg->status[54].generic == 64, - "incorrect value for status[54].generic, expected 64, is %d", - check_msg->status[54].generic); - ck_assert_msg(check_msg->status[54].specific == 20, - "incorrect value for status[54].specific, expected 20, is %d", - check_msg->status[54].specific); - ck_assert_msg( - check_msg->status[55].component == 34205, - "incorrect value for status[55].component, expected 34205, is %d", - check_msg->status[55].component); - ck_assert_msg(check_msg->status[55].generic == 12, - "incorrect value for status[55].generic, expected 12, is %d", - check_msg->status[55].generic); - ck_assert_msg( - check_msg->status[55].specific == 149, - "incorrect value for status[55].specific, expected 149, is %d", - check_msg->status[55].specific); - ck_assert_msg( - check_msg->status[56].component == 3612, - "incorrect value for status[56].component, expected 3612, is %d", - check_msg->status[56].component); - ck_assert_msg(check_msg->status[56].generic == 185, - "incorrect value for status[56].generic, expected 185, is %d", - check_msg->status[56].generic); - ck_assert_msg( - check_msg->status[56].specific == 129, - "incorrect value for status[56].specific, expected 129, is %d", - check_msg->status[56].specific); - ck_assert_msg( - check_msg->status[57].component == 61285, - "incorrect value for status[57].component, expected 61285, is %d", - check_msg->status[57].component); - ck_assert_msg(check_msg->status[57].generic == 74, - "incorrect value for status[57].generic, expected 74, is %d", - check_msg->status[57].generic); - ck_assert_msg( - check_msg->status[57].specific == 248, - "incorrect value for status[57].specific, expected 248, is %d", - check_msg->status[57].specific); - ck_assert_msg( - check_msg->status[58].component == 7925, - "incorrect value for status[58].component, expected 7925, is %d", - check_msg->status[58].component); - ck_assert_msg(check_msg->status[58].generic == 228, - "incorrect value for status[58].generic, expected 228, is %d", - check_msg->status[58].generic); - ck_assert_msg(check_msg->status[58].specific == 88, - "incorrect value for status[58].specific, expected 88, is %d", - check_msg->status[58].specific); - ck_assert_msg( - check_msg->status[59].component == 54414, - "incorrect value for status[59].component, expected 54414, is %d", - check_msg->status[59].component); - ck_assert_msg(check_msg->status[59].generic == 53, - "incorrect value for status[59].generic, expected 53, is %d", - check_msg->status[59].generic); - ck_assert_msg( - check_msg->status[59].specific == 224, - "incorrect value for status[59].specific, expected 224, is %d", - check_msg->status[59].specific); - ck_assert_msg(check_msg->uptime == 1657804265, - "incorrect value for uptime, expected 1657804265, is %d", - check_msg->uptime); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_system_MsgStatusReport_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_system_MsgStatusReport"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_system_MsgStatusReport"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_system_MsgStatusReport); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_telemetry_MsgTelSv.c b/c/test/legacy/auto_check_sbp_telemetry_MsgTelSv.c deleted file mode 100644 index f1b0f2ed7e..0000000000 --- a/c/test/legacy/auto_check_sbp_telemetry_MsgTelSv.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/telemetry/test_MsgTelSv.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_telemetry_MsgTelSv) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x120, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x120, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 32, 1, 148, 38, 20, 175, 8, 208, 221, 62, 24, 16, 1, - 40, 50, 5, 226, 255, 1, 0, 1, 1, 1, 33, 12, 39, 105, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tel_sv_t *test_msg = (msg_tel_sv_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->n_obs = 16; - test_msg->origin_flags = 1; - if (sizeof(test_msg->sv_tel) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->sv_tel[0]); - } - test_msg->sv_tel[0].availability_flags = 5; - test_msg->sv_tel[0].az = 40; - test_msg->sv_tel[0].correction_flags = 1; - test_msg->sv_tel[0].el = 50; - test_msg->sv_tel[0].ephemeris_flags = 1; - test_msg->sv_tel[0].outlier_flags = 1; - test_msg->sv_tel[0].phase_residual = 1; - test_msg->sv_tel[0].pseudorange_residual = -30; - test_msg->sv_tel[0].sid.code = 12; - test_msg->sv_tel[0].sid.sat = 33; - test_msg->tow = 406773200; - test_msg->wn = 2223; - sbp_payload_send(&sbp_state, 0x120, 9876, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 9876, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 9876, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x120, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tel_sv_t *check_msg = (msg_tel_sv_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->n_obs == 16, - "incorrect value for n_obs, expected 16, is %d", - check_msg->n_obs); - ck_assert_msg(check_msg->origin_flags == 1, - "incorrect value for origin_flags, expected 1, is %d", - check_msg->origin_flags); - ck_assert_msg( - check_msg->sv_tel[0].availability_flags == 5, - "incorrect value for sv_tel[0].availability_flags, expected 5, is %d", - check_msg->sv_tel[0].availability_flags); - ck_assert_msg(check_msg->sv_tel[0].az == 40, - "incorrect value for sv_tel[0].az, expected 40, is %d", - check_msg->sv_tel[0].az); - ck_assert_msg( - check_msg->sv_tel[0].correction_flags == 1, - "incorrect value for sv_tel[0].correction_flags, expected 1, is %d", - check_msg->sv_tel[0].correction_flags); - ck_assert_msg(check_msg->sv_tel[0].el == 50, - "incorrect value for sv_tel[0].el, expected 50, is %d", - check_msg->sv_tel[0].el); - ck_assert_msg( - check_msg->sv_tel[0].ephemeris_flags == 1, - "incorrect value for sv_tel[0].ephemeris_flags, expected 1, is %d", - check_msg->sv_tel[0].ephemeris_flags); - ck_assert_msg( - check_msg->sv_tel[0].outlier_flags == 1, - "incorrect value for sv_tel[0].outlier_flags, expected 1, is %d", - check_msg->sv_tel[0].outlier_flags); - ck_assert_msg( - check_msg->sv_tel[0].phase_residual == 1, - "incorrect value for sv_tel[0].phase_residual, expected 1, is %d", - check_msg->sv_tel[0].phase_residual); - ck_assert_msg(check_msg->sv_tel[0].pseudorange_residual == -30, - "incorrect value for sv_tel[0].pseudorange_residual, " - "expected -30, is %d", - check_msg->sv_tel[0].pseudorange_residual); - ck_assert_msg(check_msg->sv_tel[0].sid.code == 12, - "incorrect value for sv_tel[0].sid.code, expected 12, is %d", - check_msg->sv_tel[0].sid.code); - ck_assert_msg(check_msg->sv_tel[0].sid.sat == 33, - "incorrect value for sv_tel[0].sid.sat, expected 33, is %d", - check_msg->sv_tel[0].sid.sat); - ck_assert_msg(check_msg->tow == 406773200, - "incorrect value for tow, expected 406773200, is %d", - check_msg->tow); - ck_assert_msg(check_msg->wn == 2223, - "incorrect value for wn, expected 2223, is %d", - check_msg->wn); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_telemetry_MsgTelSv_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_telemetry_MsgTelSv"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_telemetry_MsgTelSv"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_telemetry_MsgTelSv); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_tracking_MsgMeasurementState.c b/c/test/legacy/auto_check_sbp_tracking_MsgMeasurementState.c deleted file mode 100644 index 4ab093573d..0000000000 --- a/c/test/legacy/auto_check_sbp_tracking_MsgMeasurementState.c +++ /dev/null @@ -1,1594 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgMeasurementState.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_tracking_MsgMeasurementState) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x61, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x61, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 97, 0, 207, 121, 237, 29, 0, 162, 0, 0, 0, 0, 0, 0, - 27, 0, 201, 20, 0, 168, 32, 0, 184, 15, 0, 187, 0, 0, 0, - 18, 0, 210, 16, 0, 167, 0, 0, 0, 23, 0, 213, 10, 0, 223, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 2, 202, - 27, 1, 192, 15, 1, 165, 29, 1, 146, 32, 1, 170, 18, 1, 201, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 1, 212, 10, 1, 205, - 0, 0, 0, 96, 3, 230, 0, 0, 0, 101, 3, 214, 103, 3, 212, - 104, 3, 209, 106, 3, 157, 102, 3, 230, 0, 0, 0, 0, 0, 0, - 101, 4, 189, 96, 4, 207, 106, 4, 164, 104, 4, 193, 0, 0, 0, - 102, 4, 208, 0, 0, 0, 27, 12, 212, 29, 12, 161, 32, 12, 216, - 30, 12, 216, 20, 12, 178, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 36, 14, 203, 0, 0, 0, 5, 14, 158, 4, 14, 194, 11, 14, 192, - 9, 14, 207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 20, 218, - 5, 20, 176, 36, 20, 217, 11, 20, 200, 4, 20, 205, 0, 0, 0, - 0, 0, 0, 35, 54, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_measurement_state_t *test_msg = - (msg_measurement_state_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[0].cn0 = 162; - test_msg->states[0].mesid.code = 0; - test_msg->states[0].mesid.sat = 29; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[1].cn0 = 0; - test_msg->states[1].mesid.code = 0; - test_msg->states[1].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[2].cn0 = 0; - test_msg->states[2].mesid.code = 0; - test_msg->states[2].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[3].cn0 = 201; - test_msg->states[3].mesid.code = 0; - test_msg->states[3].mesid.sat = 27; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[4].cn0 = 168; - test_msg->states[4].mesid.code = 0; - test_msg->states[4].mesid.sat = 20; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[5].cn0 = 184; - test_msg->states[5].mesid.code = 0; - test_msg->states[5].mesid.sat = 32; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[6].cn0 = 187; - test_msg->states[6].mesid.code = 0; - test_msg->states[6].mesid.sat = 15; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[7].cn0 = 0; - test_msg->states[7].mesid.code = 0; - test_msg->states[7].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[8].cn0 = 210; - test_msg->states[8].mesid.code = 0; - test_msg->states[8].mesid.sat = 18; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[9].cn0 = 167; - test_msg->states[9].mesid.code = 0; - test_msg->states[9].mesid.sat = 16; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[10].cn0 = 0; - test_msg->states[10].mesid.code = 0; - test_msg->states[10].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[11].cn0 = 213; - test_msg->states[11].mesid.code = 0; - test_msg->states[11].mesid.sat = 23; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[12].cn0 = 223; - test_msg->states[12].mesid.code = 0; - test_msg->states[12].mesid.sat = 10; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[13].cn0 = 0; - test_msg->states[13].mesid.code = 0; - test_msg->states[13].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[14].cn0 = 0; - test_msg->states[14].mesid.code = 0; - test_msg->states[14].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[15].cn0 = 0; - test_msg->states[15].mesid.code = 0; - test_msg->states[15].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[16].cn0 = 0; - test_msg->states[16].mesid.code = 0; - test_msg->states[16].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[17].cn0 = 202; - test_msg->states[17].mesid.code = 2; - test_msg->states[17].mesid.sat = 131; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[18].cn0 = 192; - test_msg->states[18].mesid.code = 1; - test_msg->states[18].mesid.sat = 27; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[19].cn0 = 165; - test_msg->states[19].mesid.code = 1; - test_msg->states[19].mesid.sat = 15; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[20].cn0 = 146; - test_msg->states[20].mesid.code = 1; - test_msg->states[20].mesid.sat = 29; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[21].cn0 = 170; - test_msg->states[21].mesid.code = 1; - test_msg->states[21].mesid.sat = 32; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[22].cn0 = 201; - test_msg->states[22].mesid.code = 1; - test_msg->states[22].mesid.sat = 18; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[23].cn0 = 0; - test_msg->states[23].mesid.code = 0; - test_msg->states[23].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[24].cn0 = 0; - test_msg->states[24].mesid.code = 0; - test_msg->states[24].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[25].cn0 = 0; - test_msg->states[25].mesid.code = 0; - test_msg->states[25].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[26].cn0 = 212; - test_msg->states[26].mesid.code = 1; - test_msg->states[26].mesid.sat = 23; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[27].cn0 = 205; - test_msg->states[27].mesid.code = 1; - test_msg->states[27].mesid.sat = 10; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[28].cn0 = 0; - test_msg->states[28].mesid.code = 0; - test_msg->states[28].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[29].cn0 = 230; - test_msg->states[29].mesid.code = 3; - test_msg->states[29].mesid.sat = 96; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[30].cn0 = 0; - test_msg->states[30].mesid.code = 0; - test_msg->states[30].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[31].cn0 = 214; - test_msg->states[31].mesid.code = 3; - test_msg->states[31].mesid.sat = 101; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[32].cn0 = 212; - test_msg->states[32].mesid.code = 3; - test_msg->states[32].mesid.sat = 103; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[33].cn0 = 209; - test_msg->states[33].mesid.code = 3; - test_msg->states[33].mesid.sat = 104; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[34].cn0 = 157; - test_msg->states[34].mesid.code = 3; - test_msg->states[34].mesid.sat = 106; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[35].cn0 = 230; - test_msg->states[35].mesid.code = 3; - test_msg->states[35].mesid.sat = 102; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[36].cn0 = 0; - test_msg->states[36].mesid.code = 0; - test_msg->states[36].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[37].cn0 = 0; - test_msg->states[37].mesid.code = 0; - test_msg->states[37].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[38].cn0 = 189; - test_msg->states[38].mesid.code = 4; - test_msg->states[38].mesid.sat = 101; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[39].cn0 = 207; - test_msg->states[39].mesid.code = 4; - test_msg->states[39].mesid.sat = 96; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[40].cn0 = 164; - test_msg->states[40].mesid.code = 4; - test_msg->states[40].mesid.sat = 106; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[41].cn0 = 193; - test_msg->states[41].mesid.code = 4; - test_msg->states[41].mesid.sat = 104; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[42].cn0 = 0; - test_msg->states[42].mesid.code = 0; - test_msg->states[42].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[43].cn0 = 208; - test_msg->states[43].mesid.code = 4; - test_msg->states[43].mesid.sat = 102; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[44].cn0 = 0; - test_msg->states[44].mesid.code = 0; - test_msg->states[44].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[45].cn0 = 212; - test_msg->states[45].mesid.code = 12; - test_msg->states[45].mesid.sat = 27; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[46].cn0 = 161; - test_msg->states[46].mesid.code = 12; - test_msg->states[46].mesid.sat = 29; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[47].cn0 = 216; - test_msg->states[47].mesid.code = 12; - test_msg->states[47].mesid.sat = 32; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[48].cn0 = 216; - test_msg->states[48].mesid.code = 12; - test_msg->states[48].mesid.sat = 30; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[49].cn0 = 178; - test_msg->states[49].mesid.code = 12; - test_msg->states[49].mesid.sat = 20; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[50].cn0 = 0; - test_msg->states[50].mesid.code = 0; - test_msg->states[50].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[51].cn0 = 0; - test_msg->states[51].mesid.code = 0; - test_msg->states[51].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[52].cn0 = 0; - test_msg->states[52].mesid.code = 0; - test_msg->states[52].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[53].cn0 = 0; - test_msg->states[53].mesid.code = 0; - test_msg->states[53].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[54].cn0 = 0; - test_msg->states[54].mesid.code = 0; - test_msg->states[54].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[55].cn0 = 0; - test_msg->states[55].mesid.code = 0; - test_msg->states[55].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[56].cn0 = 0; - test_msg->states[56].mesid.code = 0; - test_msg->states[56].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[57].cn0 = 0; - test_msg->states[57].mesid.code = 0; - test_msg->states[57].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[58].cn0 = 0; - test_msg->states[58].mesid.code = 0; - test_msg->states[58].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[59].cn0 = 0; - test_msg->states[59].mesid.code = 0; - test_msg->states[59].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[60].cn0 = 0; - test_msg->states[60].mesid.code = 0; - test_msg->states[60].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[61].cn0 = 0; - test_msg->states[61].mesid.code = 0; - test_msg->states[61].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[62].cn0 = 0; - test_msg->states[62].mesid.code = 0; - test_msg->states[62].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[63].cn0 = 203; - test_msg->states[63].mesid.code = 14; - test_msg->states[63].mesid.sat = 36; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[64].cn0 = 0; - test_msg->states[64].mesid.code = 0; - test_msg->states[64].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[65].cn0 = 158; - test_msg->states[65].mesid.code = 14; - test_msg->states[65].mesid.sat = 5; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[66].cn0 = 194; - test_msg->states[66].mesid.code = 14; - test_msg->states[66].mesid.sat = 4; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[67].cn0 = 192; - test_msg->states[67].mesid.code = 14; - test_msg->states[67].mesid.sat = 11; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[68].cn0 = 207; - test_msg->states[68].mesid.code = 14; - test_msg->states[68].mesid.sat = 9; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[69].cn0 = 0; - test_msg->states[69].mesid.code = 0; - test_msg->states[69].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[70].cn0 = 0; - test_msg->states[70].mesid.code = 0; - test_msg->states[70].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[71].cn0 = 0; - test_msg->states[71].mesid.code = 0; - test_msg->states[71].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[72].cn0 = 218; - test_msg->states[72].mesid.code = 20; - test_msg->states[72].mesid.sat = 9; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[73].cn0 = 176; - test_msg->states[73].mesid.code = 20; - test_msg->states[73].mesid.sat = 5; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[74].cn0 = 217; - test_msg->states[74].mesid.code = 20; - test_msg->states[74].mesid.sat = 36; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[75].cn0 = 200; - test_msg->states[75].mesid.code = 20; - test_msg->states[75].mesid.sat = 11; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[76].cn0 = 205; - test_msg->states[76].mesid.code = 20; - test_msg->states[76].mesid.sat = 4; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[77].cn0 = 0; - test_msg->states[77].mesid.code = 0; - test_msg->states[77].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[78].cn0 = 0; - test_msg->states[78].mesid.code = 0; - test_msg->states[78].mesid.sat = 0; - sbp_payload_send(&sbp_state, 0x61, 31183, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 31183, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 31183, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x61, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_measurement_state_t *check_msg = - (msg_measurement_state_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->states[0].cn0 == 162, - "incorrect value for states[0].cn0, expected 162, is %d", - check_msg->states[0].cn0); - ck_assert_msg(check_msg->states[0].mesid.code == 0, - "incorrect value for states[0].mesid.code, expected 0, is %d", - check_msg->states[0].mesid.code); - ck_assert_msg(check_msg->states[0].mesid.sat == 29, - "incorrect value for states[0].mesid.sat, expected 29, is %d", - check_msg->states[0].mesid.sat); - ck_assert_msg(check_msg->states[1].cn0 == 0, - "incorrect value for states[1].cn0, expected 0, is %d", - check_msg->states[1].cn0); - ck_assert_msg(check_msg->states[1].mesid.code == 0, - "incorrect value for states[1].mesid.code, expected 0, is %d", - check_msg->states[1].mesid.code); - ck_assert_msg(check_msg->states[1].mesid.sat == 0, - "incorrect value for states[1].mesid.sat, expected 0, is %d", - check_msg->states[1].mesid.sat); - ck_assert_msg(check_msg->states[2].cn0 == 0, - "incorrect value for states[2].cn0, expected 0, is %d", - check_msg->states[2].cn0); - ck_assert_msg(check_msg->states[2].mesid.code == 0, - "incorrect value for states[2].mesid.code, expected 0, is %d", - check_msg->states[2].mesid.code); - ck_assert_msg(check_msg->states[2].mesid.sat == 0, - "incorrect value for states[2].mesid.sat, expected 0, is %d", - check_msg->states[2].mesid.sat); - ck_assert_msg(check_msg->states[3].cn0 == 201, - "incorrect value for states[3].cn0, expected 201, is %d", - check_msg->states[3].cn0); - ck_assert_msg(check_msg->states[3].mesid.code == 0, - "incorrect value for states[3].mesid.code, expected 0, is %d", - check_msg->states[3].mesid.code); - ck_assert_msg(check_msg->states[3].mesid.sat == 27, - "incorrect value for states[3].mesid.sat, expected 27, is %d", - check_msg->states[3].mesid.sat); - ck_assert_msg(check_msg->states[4].cn0 == 168, - "incorrect value for states[4].cn0, expected 168, is %d", - check_msg->states[4].cn0); - ck_assert_msg(check_msg->states[4].mesid.code == 0, - "incorrect value for states[4].mesid.code, expected 0, is %d", - check_msg->states[4].mesid.code); - ck_assert_msg(check_msg->states[4].mesid.sat == 20, - "incorrect value for states[4].mesid.sat, expected 20, is %d", - check_msg->states[4].mesid.sat); - ck_assert_msg(check_msg->states[5].cn0 == 184, - "incorrect value for states[5].cn0, expected 184, is %d", - check_msg->states[5].cn0); - ck_assert_msg(check_msg->states[5].mesid.code == 0, - "incorrect value for states[5].mesid.code, expected 0, is %d", - check_msg->states[5].mesid.code); - ck_assert_msg(check_msg->states[5].mesid.sat == 32, - "incorrect value for states[5].mesid.sat, expected 32, is %d", - check_msg->states[5].mesid.sat); - ck_assert_msg(check_msg->states[6].cn0 == 187, - "incorrect value for states[6].cn0, expected 187, is %d", - check_msg->states[6].cn0); - ck_assert_msg(check_msg->states[6].mesid.code == 0, - "incorrect value for states[6].mesid.code, expected 0, is %d", - check_msg->states[6].mesid.code); - ck_assert_msg(check_msg->states[6].mesid.sat == 15, - "incorrect value for states[6].mesid.sat, expected 15, is %d", - check_msg->states[6].mesid.sat); - ck_assert_msg(check_msg->states[7].cn0 == 0, - "incorrect value for states[7].cn0, expected 0, is %d", - check_msg->states[7].cn0); - ck_assert_msg(check_msg->states[7].mesid.code == 0, - "incorrect value for states[7].mesid.code, expected 0, is %d", - check_msg->states[7].mesid.code); - ck_assert_msg(check_msg->states[7].mesid.sat == 0, - "incorrect value for states[7].mesid.sat, expected 0, is %d", - check_msg->states[7].mesid.sat); - ck_assert_msg(check_msg->states[8].cn0 == 210, - "incorrect value for states[8].cn0, expected 210, is %d", - check_msg->states[8].cn0); - ck_assert_msg(check_msg->states[8].mesid.code == 0, - "incorrect value for states[8].mesid.code, expected 0, is %d", - check_msg->states[8].mesid.code); - ck_assert_msg(check_msg->states[8].mesid.sat == 18, - "incorrect value for states[8].mesid.sat, expected 18, is %d", - check_msg->states[8].mesid.sat); - ck_assert_msg(check_msg->states[9].cn0 == 167, - "incorrect value for states[9].cn0, expected 167, is %d", - check_msg->states[9].cn0); - ck_assert_msg(check_msg->states[9].mesid.code == 0, - "incorrect value for states[9].mesid.code, expected 0, is %d", - check_msg->states[9].mesid.code); - ck_assert_msg(check_msg->states[9].mesid.sat == 16, - "incorrect value for states[9].mesid.sat, expected 16, is %d", - check_msg->states[9].mesid.sat); - ck_assert_msg(check_msg->states[10].cn0 == 0, - "incorrect value for states[10].cn0, expected 0, is %d", - check_msg->states[10].cn0); - ck_assert_msg( - check_msg->states[10].mesid.code == 0, - "incorrect value for states[10].mesid.code, expected 0, is %d", - check_msg->states[10].mesid.code); - ck_assert_msg(check_msg->states[10].mesid.sat == 0, - "incorrect value for states[10].mesid.sat, expected 0, is %d", - check_msg->states[10].mesid.sat); - ck_assert_msg(check_msg->states[11].cn0 == 213, - "incorrect value for states[11].cn0, expected 213, is %d", - check_msg->states[11].cn0); - ck_assert_msg( - check_msg->states[11].mesid.code == 0, - "incorrect value for states[11].mesid.code, expected 0, is %d", - check_msg->states[11].mesid.code); - ck_assert_msg( - check_msg->states[11].mesid.sat == 23, - "incorrect value for states[11].mesid.sat, expected 23, is %d", - check_msg->states[11].mesid.sat); - ck_assert_msg(check_msg->states[12].cn0 == 223, - "incorrect value for states[12].cn0, expected 223, is %d", - check_msg->states[12].cn0); - ck_assert_msg( - check_msg->states[12].mesid.code == 0, - "incorrect value for states[12].mesid.code, expected 0, is %d", - check_msg->states[12].mesid.code); - ck_assert_msg( - check_msg->states[12].mesid.sat == 10, - "incorrect value for states[12].mesid.sat, expected 10, is %d", - check_msg->states[12].mesid.sat); - ck_assert_msg(check_msg->states[13].cn0 == 0, - "incorrect value for states[13].cn0, expected 0, is %d", - check_msg->states[13].cn0); - ck_assert_msg( - check_msg->states[13].mesid.code == 0, - "incorrect value for states[13].mesid.code, expected 0, is %d", - check_msg->states[13].mesid.code); - ck_assert_msg(check_msg->states[13].mesid.sat == 0, - "incorrect value for states[13].mesid.sat, expected 0, is %d", - check_msg->states[13].mesid.sat); - ck_assert_msg(check_msg->states[14].cn0 == 0, - "incorrect value for states[14].cn0, expected 0, is %d", - check_msg->states[14].cn0); - ck_assert_msg( - check_msg->states[14].mesid.code == 0, - "incorrect value for states[14].mesid.code, expected 0, is %d", - check_msg->states[14].mesid.code); - ck_assert_msg(check_msg->states[14].mesid.sat == 0, - "incorrect value for states[14].mesid.sat, expected 0, is %d", - check_msg->states[14].mesid.sat); - ck_assert_msg(check_msg->states[15].cn0 == 0, - "incorrect value for states[15].cn0, expected 0, is %d", - check_msg->states[15].cn0); - ck_assert_msg( - check_msg->states[15].mesid.code == 0, - "incorrect value for states[15].mesid.code, expected 0, is %d", - check_msg->states[15].mesid.code); - ck_assert_msg(check_msg->states[15].mesid.sat == 0, - "incorrect value for states[15].mesid.sat, expected 0, is %d", - check_msg->states[15].mesid.sat); - ck_assert_msg(check_msg->states[16].cn0 == 0, - "incorrect value for states[16].cn0, expected 0, is %d", - check_msg->states[16].cn0); - ck_assert_msg( - check_msg->states[16].mesid.code == 0, - "incorrect value for states[16].mesid.code, expected 0, is %d", - check_msg->states[16].mesid.code); - ck_assert_msg(check_msg->states[16].mesid.sat == 0, - "incorrect value for states[16].mesid.sat, expected 0, is %d", - check_msg->states[16].mesid.sat); - ck_assert_msg(check_msg->states[17].cn0 == 202, - "incorrect value for states[17].cn0, expected 202, is %d", - check_msg->states[17].cn0); - ck_assert_msg( - check_msg->states[17].mesid.code == 2, - "incorrect value for states[17].mesid.code, expected 2, is %d", - check_msg->states[17].mesid.code); - ck_assert_msg( - check_msg->states[17].mesid.sat == 131, - "incorrect value for states[17].mesid.sat, expected 131, is %d", - check_msg->states[17].mesid.sat); - ck_assert_msg(check_msg->states[18].cn0 == 192, - "incorrect value for states[18].cn0, expected 192, is %d", - check_msg->states[18].cn0); - ck_assert_msg( - check_msg->states[18].mesid.code == 1, - "incorrect value for states[18].mesid.code, expected 1, is %d", - check_msg->states[18].mesid.code); - ck_assert_msg( - check_msg->states[18].mesid.sat == 27, - "incorrect value for states[18].mesid.sat, expected 27, is %d", - check_msg->states[18].mesid.sat); - ck_assert_msg(check_msg->states[19].cn0 == 165, - "incorrect value for states[19].cn0, expected 165, is %d", - check_msg->states[19].cn0); - ck_assert_msg( - check_msg->states[19].mesid.code == 1, - "incorrect value for states[19].mesid.code, expected 1, is %d", - check_msg->states[19].mesid.code); - ck_assert_msg( - check_msg->states[19].mesid.sat == 15, - "incorrect value for states[19].mesid.sat, expected 15, is %d", - check_msg->states[19].mesid.sat); - ck_assert_msg(check_msg->states[20].cn0 == 146, - "incorrect value for states[20].cn0, expected 146, is %d", - check_msg->states[20].cn0); - ck_assert_msg( - check_msg->states[20].mesid.code == 1, - "incorrect value for states[20].mesid.code, expected 1, is %d", - check_msg->states[20].mesid.code); - ck_assert_msg( - check_msg->states[20].mesid.sat == 29, - "incorrect value for states[20].mesid.sat, expected 29, is %d", - check_msg->states[20].mesid.sat); - ck_assert_msg(check_msg->states[21].cn0 == 170, - "incorrect value for states[21].cn0, expected 170, is %d", - check_msg->states[21].cn0); - ck_assert_msg( - check_msg->states[21].mesid.code == 1, - "incorrect value for states[21].mesid.code, expected 1, is %d", - check_msg->states[21].mesid.code); - ck_assert_msg( - check_msg->states[21].mesid.sat == 32, - "incorrect value for states[21].mesid.sat, expected 32, is %d", - check_msg->states[21].mesid.sat); - ck_assert_msg(check_msg->states[22].cn0 == 201, - "incorrect value for states[22].cn0, expected 201, is %d", - check_msg->states[22].cn0); - ck_assert_msg( - check_msg->states[22].mesid.code == 1, - "incorrect value for states[22].mesid.code, expected 1, is %d", - check_msg->states[22].mesid.code); - ck_assert_msg( - check_msg->states[22].mesid.sat == 18, - "incorrect value for states[22].mesid.sat, expected 18, is %d", - check_msg->states[22].mesid.sat); - ck_assert_msg(check_msg->states[23].cn0 == 0, - "incorrect value for states[23].cn0, expected 0, is %d", - check_msg->states[23].cn0); - ck_assert_msg( - check_msg->states[23].mesid.code == 0, - "incorrect value for states[23].mesid.code, expected 0, is %d", - check_msg->states[23].mesid.code); - ck_assert_msg(check_msg->states[23].mesid.sat == 0, - "incorrect value for states[23].mesid.sat, expected 0, is %d", - check_msg->states[23].mesid.sat); - ck_assert_msg(check_msg->states[24].cn0 == 0, - "incorrect value for states[24].cn0, expected 0, is %d", - check_msg->states[24].cn0); - ck_assert_msg( - check_msg->states[24].mesid.code == 0, - "incorrect value for states[24].mesid.code, expected 0, is %d", - check_msg->states[24].mesid.code); - ck_assert_msg(check_msg->states[24].mesid.sat == 0, - "incorrect value for states[24].mesid.sat, expected 0, is %d", - check_msg->states[24].mesid.sat); - ck_assert_msg(check_msg->states[25].cn0 == 0, - "incorrect value for states[25].cn0, expected 0, is %d", - check_msg->states[25].cn0); - ck_assert_msg( - check_msg->states[25].mesid.code == 0, - "incorrect value for states[25].mesid.code, expected 0, is %d", - check_msg->states[25].mesid.code); - ck_assert_msg(check_msg->states[25].mesid.sat == 0, - "incorrect value for states[25].mesid.sat, expected 0, is %d", - check_msg->states[25].mesid.sat); - ck_assert_msg(check_msg->states[26].cn0 == 212, - "incorrect value for states[26].cn0, expected 212, is %d", - check_msg->states[26].cn0); - ck_assert_msg( - check_msg->states[26].mesid.code == 1, - "incorrect value for states[26].mesid.code, expected 1, is %d", - check_msg->states[26].mesid.code); - ck_assert_msg( - check_msg->states[26].mesid.sat == 23, - "incorrect value for states[26].mesid.sat, expected 23, is %d", - check_msg->states[26].mesid.sat); - ck_assert_msg(check_msg->states[27].cn0 == 205, - "incorrect value for states[27].cn0, expected 205, is %d", - check_msg->states[27].cn0); - ck_assert_msg( - check_msg->states[27].mesid.code == 1, - "incorrect value for states[27].mesid.code, expected 1, is %d", - check_msg->states[27].mesid.code); - ck_assert_msg( - check_msg->states[27].mesid.sat == 10, - "incorrect value for states[27].mesid.sat, expected 10, is %d", - check_msg->states[27].mesid.sat); - ck_assert_msg(check_msg->states[28].cn0 == 0, - "incorrect value for states[28].cn0, expected 0, is %d", - check_msg->states[28].cn0); - ck_assert_msg( - check_msg->states[28].mesid.code == 0, - "incorrect value for states[28].mesid.code, expected 0, is %d", - check_msg->states[28].mesid.code); - ck_assert_msg(check_msg->states[28].mesid.sat == 0, - "incorrect value for states[28].mesid.sat, expected 0, is %d", - check_msg->states[28].mesid.sat); - ck_assert_msg(check_msg->states[29].cn0 == 230, - "incorrect value for states[29].cn0, expected 230, is %d", - check_msg->states[29].cn0); - ck_assert_msg( - check_msg->states[29].mesid.code == 3, - "incorrect value for states[29].mesid.code, expected 3, is %d", - check_msg->states[29].mesid.code); - ck_assert_msg( - check_msg->states[29].mesid.sat == 96, - "incorrect value for states[29].mesid.sat, expected 96, is %d", - check_msg->states[29].mesid.sat); - ck_assert_msg(check_msg->states[30].cn0 == 0, - "incorrect value for states[30].cn0, expected 0, is %d", - check_msg->states[30].cn0); - ck_assert_msg( - check_msg->states[30].mesid.code == 0, - "incorrect value for states[30].mesid.code, expected 0, is %d", - check_msg->states[30].mesid.code); - ck_assert_msg(check_msg->states[30].mesid.sat == 0, - "incorrect value for states[30].mesid.sat, expected 0, is %d", - check_msg->states[30].mesid.sat); - ck_assert_msg(check_msg->states[31].cn0 == 214, - "incorrect value for states[31].cn0, expected 214, is %d", - check_msg->states[31].cn0); - ck_assert_msg( - check_msg->states[31].mesid.code == 3, - "incorrect value for states[31].mesid.code, expected 3, is %d", - check_msg->states[31].mesid.code); - ck_assert_msg( - check_msg->states[31].mesid.sat == 101, - "incorrect value for states[31].mesid.sat, expected 101, is %d", - check_msg->states[31].mesid.sat); - ck_assert_msg(check_msg->states[32].cn0 == 212, - "incorrect value for states[32].cn0, expected 212, is %d", - check_msg->states[32].cn0); - ck_assert_msg( - check_msg->states[32].mesid.code == 3, - "incorrect value for states[32].mesid.code, expected 3, is %d", - check_msg->states[32].mesid.code); - ck_assert_msg( - check_msg->states[32].mesid.sat == 103, - "incorrect value for states[32].mesid.sat, expected 103, is %d", - check_msg->states[32].mesid.sat); - ck_assert_msg(check_msg->states[33].cn0 == 209, - "incorrect value for states[33].cn0, expected 209, is %d", - check_msg->states[33].cn0); - ck_assert_msg( - check_msg->states[33].mesid.code == 3, - "incorrect value for states[33].mesid.code, expected 3, is %d", - check_msg->states[33].mesid.code); - ck_assert_msg( - check_msg->states[33].mesid.sat == 104, - "incorrect value for states[33].mesid.sat, expected 104, is %d", - check_msg->states[33].mesid.sat); - ck_assert_msg(check_msg->states[34].cn0 == 157, - "incorrect value for states[34].cn0, expected 157, is %d", - check_msg->states[34].cn0); - ck_assert_msg( - check_msg->states[34].mesid.code == 3, - "incorrect value for states[34].mesid.code, expected 3, is %d", - check_msg->states[34].mesid.code); - ck_assert_msg( - check_msg->states[34].mesid.sat == 106, - "incorrect value for states[34].mesid.sat, expected 106, is %d", - check_msg->states[34].mesid.sat); - ck_assert_msg(check_msg->states[35].cn0 == 230, - "incorrect value for states[35].cn0, expected 230, is %d", - check_msg->states[35].cn0); - ck_assert_msg( - check_msg->states[35].mesid.code == 3, - "incorrect value for states[35].mesid.code, expected 3, is %d", - check_msg->states[35].mesid.code); - ck_assert_msg( - check_msg->states[35].mesid.sat == 102, - "incorrect value for states[35].mesid.sat, expected 102, is %d", - check_msg->states[35].mesid.sat); - ck_assert_msg(check_msg->states[36].cn0 == 0, - "incorrect value for states[36].cn0, expected 0, is %d", - check_msg->states[36].cn0); - ck_assert_msg( - check_msg->states[36].mesid.code == 0, - "incorrect value for states[36].mesid.code, expected 0, is %d", - check_msg->states[36].mesid.code); - ck_assert_msg(check_msg->states[36].mesid.sat == 0, - "incorrect value for states[36].mesid.sat, expected 0, is %d", - check_msg->states[36].mesid.sat); - ck_assert_msg(check_msg->states[37].cn0 == 0, - "incorrect value for states[37].cn0, expected 0, is %d", - check_msg->states[37].cn0); - ck_assert_msg( - check_msg->states[37].mesid.code == 0, - "incorrect value for states[37].mesid.code, expected 0, is %d", - check_msg->states[37].mesid.code); - ck_assert_msg(check_msg->states[37].mesid.sat == 0, - "incorrect value for states[37].mesid.sat, expected 0, is %d", - check_msg->states[37].mesid.sat); - ck_assert_msg(check_msg->states[38].cn0 == 189, - "incorrect value for states[38].cn0, expected 189, is %d", - check_msg->states[38].cn0); - ck_assert_msg( - check_msg->states[38].mesid.code == 4, - "incorrect value for states[38].mesid.code, expected 4, is %d", - check_msg->states[38].mesid.code); - ck_assert_msg( - check_msg->states[38].mesid.sat == 101, - "incorrect value for states[38].mesid.sat, expected 101, is %d", - check_msg->states[38].mesid.sat); - ck_assert_msg(check_msg->states[39].cn0 == 207, - "incorrect value for states[39].cn0, expected 207, is %d", - check_msg->states[39].cn0); - ck_assert_msg( - check_msg->states[39].mesid.code == 4, - "incorrect value for states[39].mesid.code, expected 4, is %d", - check_msg->states[39].mesid.code); - ck_assert_msg( - check_msg->states[39].mesid.sat == 96, - "incorrect value for states[39].mesid.sat, expected 96, is %d", - check_msg->states[39].mesid.sat); - ck_assert_msg(check_msg->states[40].cn0 == 164, - "incorrect value for states[40].cn0, expected 164, is %d", - check_msg->states[40].cn0); - ck_assert_msg( - check_msg->states[40].mesid.code == 4, - "incorrect value for states[40].mesid.code, expected 4, is %d", - check_msg->states[40].mesid.code); - ck_assert_msg( - check_msg->states[40].mesid.sat == 106, - "incorrect value for states[40].mesid.sat, expected 106, is %d", - check_msg->states[40].mesid.sat); - ck_assert_msg(check_msg->states[41].cn0 == 193, - "incorrect value for states[41].cn0, expected 193, is %d", - check_msg->states[41].cn0); - ck_assert_msg( - check_msg->states[41].mesid.code == 4, - "incorrect value for states[41].mesid.code, expected 4, is %d", - check_msg->states[41].mesid.code); - ck_assert_msg( - check_msg->states[41].mesid.sat == 104, - "incorrect value for states[41].mesid.sat, expected 104, is %d", - check_msg->states[41].mesid.sat); - ck_assert_msg(check_msg->states[42].cn0 == 0, - "incorrect value for states[42].cn0, expected 0, is %d", - check_msg->states[42].cn0); - ck_assert_msg( - check_msg->states[42].mesid.code == 0, - "incorrect value for states[42].mesid.code, expected 0, is %d", - check_msg->states[42].mesid.code); - ck_assert_msg(check_msg->states[42].mesid.sat == 0, - "incorrect value for states[42].mesid.sat, expected 0, is %d", - check_msg->states[42].mesid.sat); - ck_assert_msg(check_msg->states[43].cn0 == 208, - "incorrect value for states[43].cn0, expected 208, is %d", - check_msg->states[43].cn0); - ck_assert_msg( - check_msg->states[43].mesid.code == 4, - "incorrect value for states[43].mesid.code, expected 4, is %d", - check_msg->states[43].mesid.code); - ck_assert_msg( - check_msg->states[43].mesid.sat == 102, - "incorrect value for states[43].mesid.sat, expected 102, is %d", - check_msg->states[43].mesid.sat); - ck_assert_msg(check_msg->states[44].cn0 == 0, - "incorrect value for states[44].cn0, expected 0, is %d", - check_msg->states[44].cn0); - ck_assert_msg( - check_msg->states[44].mesid.code == 0, - "incorrect value for states[44].mesid.code, expected 0, is %d", - check_msg->states[44].mesid.code); - ck_assert_msg(check_msg->states[44].mesid.sat == 0, - "incorrect value for states[44].mesid.sat, expected 0, is %d", - check_msg->states[44].mesid.sat); - ck_assert_msg(check_msg->states[45].cn0 == 212, - "incorrect value for states[45].cn0, expected 212, is %d", - check_msg->states[45].cn0); - ck_assert_msg( - check_msg->states[45].mesid.code == 12, - "incorrect value for states[45].mesid.code, expected 12, is %d", - check_msg->states[45].mesid.code); - ck_assert_msg( - check_msg->states[45].mesid.sat == 27, - "incorrect value for states[45].mesid.sat, expected 27, is %d", - check_msg->states[45].mesid.sat); - ck_assert_msg(check_msg->states[46].cn0 == 161, - "incorrect value for states[46].cn0, expected 161, is %d", - check_msg->states[46].cn0); - ck_assert_msg( - check_msg->states[46].mesid.code == 12, - "incorrect value for states[46].mesid.code, expected 12, is %d", - check_msg->states[46].mesid.code); - ck_assert_msg( - check_msg->states[46].mesid.sat == 29, - "incorrect value for states[46].mesid.sat, expected 29, is %d", - check_msg->states[46].mesid.sat); - ck_assert_msg(check_msg->states[47].cn0 == 216, - "incorrect value for states[47].cn0, expected 216, is %d", - check_msg->states[47].cn0); - ck_assert_msg( - check_msg->states[47].mesid.code == 12, - "incorrect value for states[47].mesid.code, expected 12, is %d", - check_msg->states[47].mesid.code); - ck_assert_msg( - check_msg->states[47].mesid.sat == 32, - "incorrect value for states[47].mesid.sat, expected 32, is %d", - check_msg->states[47].mesid.sat); - ck_assert_msg(check_msg->states[48].cn0 == 216, - "incorrect value for states[48].cn0, expected 216, is %d", - check_msg->states[48].cn0); - ck_assert_msg( - check_msg->states[48].mesid.code == 12, - "incorrect value for states[48].mesid.code, expected 12, is %d", - check_msg->states[48].mesid.code); - ck_assert_msg( - check_msg->states[48].mesid.sat == 30, - "incorrect value for states[48].mesid.sat, expected 30, is %d", - check_msg->states[48].mesid.sat); - ck_assert_msg(check_msg->states[49].cn0 == 178, - "incorrect value for states[49].cn0, expected 178, is %d", - check_msg->states[49].cn0); - ck_assert_msg( - check_msg->states[49].mesid.code == 12, - "incorrect value for states[49].mesid.code, expected 12, is %d", - check_msg->states[49].mesid.code); - ck_assert_msg( - check_msg->states[49].mesid.sat == 20, - "incorrect value for states[49].mesid.sat, expected 20, is %d", - check_msg->states[49].mesid.sat); - ck_assert_msg(check_msg->states[50].cn0 == 0, - "incorrect value for states[50].cn0, expected 0, is %d", - check_msg->states[50].cn0); - ck_assert_msg( - check_msg->states[50].mesid.code == 0, - "incorrect value for states[50].mesid.code, expected 0, is %d", - check_msg->states[50].mesid.code); - ck_assert_msg(check_msg->states[50].mesid.sat == 0, - "incorrect value for states[50].mesid.sat, expected 0, is %d", - check_msg->states[50].mesid.sat); - ck_assert_msg(check_msg->states[51].cn0 == 0, - "incorrect value for states[51].cn0, expected 0, is %d", - check_msg->states[51].cn0); - ck_assert_msg( - check_msg->states[51].mesid.code == 0, - "incorrect value for states[51].mesid.code, expected 0, is %d", - check_msg->states[51].mesid.code); - ck_assert_msg(check_msg->states[51].mesid.sat == 0, - "incorrect value for states[51].mesid.sat, expected 0, is %d", - check_msg->states[51].mesid.sat); - ck_assert_msg(check_msg->states[52].cn0 == 0, - "incorrect value for states[52].cn0, expected 0, is %d", - check_msg->states[52].cn0); - ck_assert_msg( - check_msg->states[52].mesid.code == 0, - "incorrect value for states[52].mesid.code, expected 0, is %d", - check_msg->states[52].mesid.code); - ck_assert_msg(check_msg->states[52].mesid.sat == 0, - "incorrect value for states[52].mesid.sat, expected 0, is %d", - check_msg->states[52].mesid.sat); - ck_assert_msg(check_msg->states[53].cn0 == 0, - "incorrect value for states[53].cn0, expected 0, is %d", - check_msg->states[53].cn0); - ck_assert_msg( - check_msg->states[53].mesid.code == 0, - "incorrect value for states[53].mesid.code, expected 0, is %d", - check_msg->states[53].mesid.code); - ck_assert_msg(check_msg->states[53].mesid.sat == 0, - "incorrect value for states[53].mesid.sat, expected 0, is %d", - check_msg->states[53].mesid.sat); - ck_assert_msg(check_msg->states[54].cn0 == 0, - "incorrect value for states[54].cn0, expected 0, is %d", - check_msg->states[54].cn0); - ck_assert_msg( - check_msg->states[54].mesid.code == 0, - "incorrect value for states[54].mesid.code, expected 0, is %d", - check_msg->states[54].mesid.code); - ck_assert_msg(check_msg->states[54].mesid.sat == 0, - "incorrect value for states[54].mesid.sat, expected 0, is %d", - check_msg->states[54].mesid.sat); - ck_assert_msg(check_msg->states[55].cn0 == 0, - "incorrect value for states[55].cn0, expected 0, is %d", - check_msg->states[55].cn0); - ck_assert_msg( - check_msg->states[55].mesid.code == 0, - "incorrect value for states[55].mesid.code, expected 0, is %d", - check_msg->states[55].mesid.code); - ck_assert_msg(check_msg->states[55].mesid.sat == 0, - "incorrect value for states[55].mesid.sat, expected 0, is %d", - check_msg->states[55].mesid.sat); - ck_assert_msg(check_msg->states[56].cn0 == 0, - "incorrect value for states[56].cn0, expected 0, is %d", - check_msg->states[56].cn0); - ck_assert_msg( - check_msg->states[56].mesid.code == 0, - "incorrect value for states[56].mesid.code, expected 0, is %d", - check_msg->states[56].mesid.code); - ck_assert_msg(check_msg->states[56].mesid.sat == 0, - "incorrect value for states[56].mesid.sat, expected 0, is %d", - check_msg->states[56].mesid.sat); - ck_assert_msg(check_msg->states[57].cn0 == 0, - "incorrect value for states[57].cn0, expected 0, is %d", - check_msg->states[57].cn0); - ck_assert_msg( - check_msg->states[57].mesid.code == 0, - "incorrect value for states[57].mesid.code, expected 0, is %d", - check_msg->states[57].mesid.code); - ck_assert_msg(check_msg->states[57].mesid.sat == 0, - "incorrect value for states[57].mesid.sat, expected 0, is %d", - check_msg->states[57].mesid.sat); - ck_assert_msg(check_msg->states[58].cn0 == 0, - "incorrect value for states[58].cn0, expected 0, is %d", - check_msg->states[58].cn0); - ck_assert_msg( - check_msg->states[58].mesid.code == 0, - "incorrect value for states[58].mesid.code, expected 0, is %d", - check_msg->states[58].mesid.code); - ck_assert_msg(check_msg->states[58].mesid.sat == 0, - "incorrect value for states[58].mesid.sat, expected 0, is %d", - check_msg->states[58].mesid.sat); - ck_assert_msg(check_msg->states[59].cn0 == 0, - "incorrect value for states[59].cn0, expected 0, is %d", - check_msg->states[59].cn0); - ck_assert_msg( - check_msg->states[59].mesid.code == 0, - "incorrect value for states[59].mesid.code, expected 0, is %d", - check_msg->states[59].mesid.code); - ck_assert_msg(check_msg->states[59].mesid.sat == 0, - "incorrect value for states[59].mesid.sat, expected 0, is %d", - check_msg->states[59].mesid.sat); - ck_assert_msg(check_msg->states[60].cn0 == 0, - "incorrect value for states[60].cn0, expected 0, is %d", - check_msg->states[60].cn0); - ck_assert_msg( - check_msg->states[60].mesid.code == 0, - "incorrect value for states[60].mesid.code, expected 0, is %d", - check_msg->states[60].mesid.code); - ck_assert_msg(check_msg->states[60].mesid.sat == 0, - "incorrect value for states[60].mesid.sat, expected 0, is %d", - check_msg->states[60].mesid.sat); - ck_assert_msg(check_msg->states[61].cn0 == 0, - "incorrect value for states[61].cn0, expected 0, is %d", - check_msg->states[61].cn0); - ck_assert_msg( - check_msg->states[61].mesid.code == 0, - "incorrect value for states[61].mesid.code, expected 0, is %d", - check_msg->states[61].mesid.code); - ck_assert_msg(check_msg->states[61].mesid.sat == 0, - "incorrect value for states[61].mesid.sat, expected 0, is %d", - check_msg->states[61].mesid.sat); - ck_assert_msg(check_msg->states[62].cn0 == 0, - "incorrect value for states[62].cn0, expected 0, is %d", - check_msg->states[62].cn0); - ck_assert_msg( - check_msg->states[62].mesid.code == 0, - "incorrect value for states[62].mesid.code, expected 0, is %d", - check_msg->states[62].mesid.code); - ck_assert_msg(check_msg->states[62].mesid.sat == 0, - "incorrect value for states[62].mesid.sat, expected 0, is %d", - check_msg->states[62].mesid.sat); - ck_assert_msg(check_msg->states[63].cn0 == 203, - "incorrect value for states[63].cn0, expected 203, is %d", - check_msg->states[63].cn0); - ck_assert_msg( - check_msg->states[63].mesid.code == 14, - "incorrect value for states[63].mesid.code, expected 14, is %d", - check_msg->states[63].mesid.code); - ck_assert_msg( - check_msg->states[63].mesid.sat == 36, - "incorrect value for states[63].mesid.sat, expected 36, is %d", - check_msg->states[63].mesid.sat); - ck_assert_msg(check_msg->states[64].cn0 == 0, - "incorrect value for states[64].cn0, expected 0, is %d", - check_msg->states[64].cn0); - ck_assert_msg( - check_msg->states[64].mesid.code == 0, - "incorrect value for states[64].mesid.code, expected 0, is %d", - check_msg->states[64].mesid.code); - ck_assert_msg(check_msg->states[64].mesid.sat == 0, - "incorrect value for states[64].mesid.sat, expected 0, is %d", - check_msg->states[64].mesid.sat); - ck_assert_msg(check_msg->states[65].cn0 == 158, - "incorrect value for states[65].cn0, expected 158, is %d", - check_msg->states[65].cn0); - ck_assert_msg( - check_msg->states[65].mesid.code == 14, - "incorrect value for states[65].mesid.code, expected 14, is %d", - check_msg->states[65].mesid.code); - ck_assert_msg(check_msg->states[65].mesid.sat == 5, - "incorrect value for states[65].mesid.sat, expected 5, is %d", - check_msg->states[65].mesid.sat); - ck_assert_msg(check_msg->states[66].cn0 == 194, - "incorrect value for states[66].cn0, expected 194, is %d", - check_msg->states[66].cn0); - ck_assert_msg( - check_msg->states[66].mesid.code == 14, - "incorrect value for states[66].mesid.code, expected 14, is %d", - check_msg->states[66].mesid.code); - ck_assert_msg(check_msg->states[66].mesid.sat == 4, - "incorrect value for states[66].mesid.sat, expected 4, is %d", - check_msg->states[66].mesid.sat); - ck_assert_msg(check_msg->states[67].cn0 == 192, - "incorrect value for states[67].cn0, expected 192, is %d", - check_msg->states[67].cn0); - ck_assert_msg( - check_msg->states[67].mesid.code == 14, - "incorrect value for states[67].mesid.code, expected 14, is %d", - check_msg->states[67].mesid.code); - ck_assert_msg( - check_msg->states[67].mesid.sat == 11, - "incorrect value for states[67].mesid.sat, expected 11, is %d", - check_msg->states[67].mesid.sat); - ck_assert_msg(check_msg->states[68].cn0 == 207, - "incorrect value for states[68].cn0, expected 207, is %d", - check_msg->states[68].cn0); - ck_assert_msg( - check_msg->states[68].mesid.code == 14, - "incorrect value for states[68].mesid.code, expected 14, is %d", - check_msg->states[68].mesid.code); - ck_assert_msg(check_msg->states[68].mesid.sat == 9, - "incorrect value for states[68].mesid.sat, expected 9, is %d", - check_msg->states[68].mesid.sat); - ck_assert_msg(check_msg->states[69].cn0 == 0, - "incorrect value for states[69].cn0, expected 0, is %d", - check_msg->states[69].cn0); - ck_assert_msg( - check_msg->states[69].mesid.code == 0, - "incorrect value for states[69].mesid.code, expected 0, is %d", - check_msg->states[69].mesid.code); - ck_assert_msg(check_msg->states[69].mesid.sat == 0, - "incorrect value for states[69].mesid.sat, expected 0, is %d", - check_msg->states[69].mesid.sat); - ck_assert_msg(check_msg->states[70].cn0 == 0, - "incorrect value for states[70].cn0, expected 0, is %d", - check_msg->states[70].cn0); - ck_assert_msg( - check_msg->states[70].mesid.code == 0, - "incorrect value for states[70].mesid.code, expected 0, is %d", - check_msg->states[70].mesid.code); - ck_assert_msg(check_msg->states[70].mesid.sat == 0, - "incorrect value for states[70].mesid.sat, expected 0, is %d", - check_msg->states[70].mesid.sat); - ck_assert_msg(check_msg->states[71].cn0 == 0, - "incorrect value for states[71].cn0, expected 0, is %d", - check_msg->states[71].cn0); - ck_assert_msg( - check_msg->states[71].mesid.code == 0, - "incorrect value for states[71].mesid.code, expected 0, is %d", - check_msg->states[71].mesid.code); - ck_assert_msg(check_msg->states[71].mesid.sat == 0, - "incorrect value for states[71].mesid.sat, expected 0, is %d", - check_msg->states[71].mesid.sat); - ck_assert_msg(check_msg->states[72].cn0 == 218, - "incorrect value for states[72].cn0, expected 218, is %d", - check_msg->states[72].cn0); - ck_assert_msg( - check_msg->states[72].mesid.code == 20, - "incorrect value for states[72].mesid.code, expected 20, is %d", - check_msg->states[72].mesid.code); - ck_assert_msg(check_msg->states[72].mesid.sat == 9, - "incorrect value for states[72].mesid.sat, expected 9, is %d", - check_msg->states[72].mesid.sat); - ck_assert_msg(check_msg->states[73].cn0 == 176, - "incorrect value for states[73].cn0, expected 176, is %d", - check_msg->states[73].cn0); - ck_assert_msg( - check_msg->states[73].mesid.code == 20, - "incorrect value for states[73].mesid.code, expected 20, is %d", - check_msg->states[73].mesid.code); - ck_assert_msg(check_msg->states[73].mesid.sat == 5, - "incorrect value for states[73].mesid.sat, expected 5, is %d", - check_msg->states[73].mesid.sat); - ck_assert_msg(check_msg->states[74].cn0 == 217, - "incorrect value for states[74].cn0, expected 217, is %d", - check_msg->states[74].cn0); - ck_assert_msg( - check_msg->states[74].mesid.code == 20, - "incorrect value for states[74].mesid.code, expected 20, is %d", - check_msg->states[74].mesid.code); - ck_assert_msg( - check_msg->states[74].mesid.sat == 36, - "incorrect value for states[74].mesid.sat, expected 36, is %d", - check_msg->states[74].mesid.sat); - ck_assert_msg(check_msg->states[75].cn0 == 200, - "incorrect value for states[75].cn0, expected 200, is %d", - check_msg->states[75].cn0); - ck_assert_msg( - check_msg->states[75].mesid.code == 20, - "incorrect value for states[75].mesid.code, expected 20, is %d", - check_msg->states[75].mesid.code); - ck_assert_msg( - check_msg->states[75].mesid.sat == 11, - "incorrect value for states[75].mesid.sat, expected 11, is %d", - check_msg->states[75].mesid.sat); - ck_assert_msg(check_msg->states[76].cn0 == 205, - "incorrect value for states[76].cn0, expected 205, is %d", - check_msg->states[76].cn0); - ck_assert_msg( - check_msg->states[76].mesid.code == 20, - "incorrect value for states[76].mesid.code, expected 20, is %d", - check_msg->states[76].mesid.code); - ck_assert_msg(check_msg->states[76].mesid.sat == 4, - "incorrect value for states[76].mesid.sat, expected 4, is %d", - check_msg->states[76].mesid.sat); - ck_assert_msg(check_msg->states[77].cn0 == 0, - "incorrect value for states[77].cn0, expected 0, is %d", - check_msg->states[77].cn0); - ck_assert_msg( - check_msg->states[77].mesid.code == 0, - "incorrect value for states[77].mesid.code, expected 0, is %d", - check_msg->states[77].mesid.code); - ck_assert_msg(check_msg->states[77].mesid.sat == 0, - "incorrect value for states[77].mesid.sat, expected 0, is %d", - check_msg->states[77].mesid.sat); - ck_assert_msg(check_msg->states[78].cn0 == 0, - "incorrect value for states[78].cn0, expected 0, is %d", - check_msg->states[78].cn0); - ck_assert_msg( - check_msg->states[78].mesid.code == 0, - "incorrect value for states[78].mesid.code, expected 0, is %d", - check_msg->states[78].mesid.code); - ck_assert_msg(check_msg->states[78].mesid.sat == 0, - "incorrect value for states[78].mesid.sat, expected 0, is %d", - check_msg->states[78].mesid.sat); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_tracking_MsgMeasurementState_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_tracking_MsgMeasurementState"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_tracking_MsgMeasurementState"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_tracking_MsgMeasurementState); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_tracking_MsgTrackingIq.c b/c/test/legacy/auto_check_sbp_tracking_MsgTrackingIq.c deleted file mode 100644 index 419ca07c77..0000000000 --- a/c/test/legacy/auto_check_sbp_tracking_MsgTrackingIq.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgTrackingIq.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_tracking_MsgTrackingIq) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x2d, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x2d, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 45, 0, 2, 80, 15, 145, 121, 203, 47, 217, 239, - 55, 45, 38, 189, 88, 159, 19, 208, 12, 97, 167, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_iq_t *test_msg = (msg_tracking_iq_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->channel = 145; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrs[0]); - } - test_msg->corrs[0].I = -9937; - test_msg->corrs[0].Q = 14319; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrs[0]); - } - test_msg->corrs[1].I = 9773; - test_msg->corrs[1].Q = 22717; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrs[0]); - } - test_msg->corrs[2].I = 5023; - test_msg->corrs[2].Q = 3280; - test_msg->sid.code = 203; - test_msg->sid.sat = 121; - sbp_payload_send(&sbp_state, 0x2d, 20482, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 20482, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 20482, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x2d, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_iq_t *check_msg = (msg_tracking_iq_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->channel == 145, - "incorrect value for channel, expected 145, is %d", - check_msg->channel); - ck_assert_msg(check_msg->corrs[0].I == -9937, - "incorrect value for corrs[0].I, expected -9937, is %d", - check_msg->corrs[0].I); - ck_assert_msg(check_msg->corrs[0].Q == 14319, - "incorrect value for corrs[0].Q, expected 14319, is %d", - check_msg->corrs[0].Q); - ck_assert_msg(check_msg->corrs[1].I == 9773, - "incorrect value for corrs[1].I, expected 9773, is %d", - check_msg->corrs[1].I); - ck_assert_msg(check_msg->corrs[1].Q == 22717, - "incorrect value for corrs[1].Q, expected 22717, is %d", - check_msg->corrs[1].Q); - ck_assert_msg(check_msg->corrs[2].I == 5023, - "incorrect value for corrs[2].I, expected 5023, is %d", - check_msg->corrs[2].I); - ck_assert_msg(check_msg->corrs[2].Q == 3280, - "incorrect value for corrs[2].Q, expected 3280, is %d", - check_msg->corrs[2].Q); - ck_assert_msg(check_msg->sid.code == 203, - "incorrect value for sid.code, expected 203, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.sat == 121, - "incorrect value for sid.sat, expected 121, is %d", - check_msg->sid.sat); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_tracking_MsgTrackingIq_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_tracking_MsgTrackingIq"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_tracking_MsgTrackingIq"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_tracking_MsgTrackingIq); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_tracking_MsgTrackingIqDepA.c b/c/test/legacy/auto_check_sbp_tracking_MsgTrackingIqDepA.c deleted file mode 100644 index b77d6c032c..0000000000 --- a/c/test/legacy/auto_check_sbp_tracking_MsgTrackingIqDepA.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgTrackingIqDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_tracking_MsgTrackingIqDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x1c, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x1c, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 28, 0, 184, 67, 29, 139, 28, 250, 15, 0, 99, 90, - 170, 96, 71, 121, 33, 161, 52, 211, 162, 101, 41, 36, 226, - 99, 71, 75, 14, 240, 134, 82, 175, 83, 17, 34, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_iq_dep_a_t *test_msg = - (msg_tracking_iq_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->channel = 139; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrs[0]); - } - test_msg->corrs[0].I = 1621776995; - test_msg->corrs[0].Q = -1591641785; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrs[0]); - } - test_msg->corrs[1].I = 1705169716; - test_msg->corrs[1].Q = 1675764777; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrs[0]); - } - test_msg->corrs[2].I = -267498681; - test_msg->corrs[2].Q = 1403998854; - test_msg->sid.code = 15; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 64028; - sbp_payload_send(&sbp_state, 0x1c, 17336, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 17336, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 17336, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x1c, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_iq_dep_a_t *check_msg = - (msg_tracking_iq_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->channel == 139, - "incorrect value for channel, expected 139, is %d", - check_msg->channel); - ck_assert_msg(check_msg->corrs[0].I == 1621776995, - "incorrect value for corrs[0].I, expected 1621776995, is %d", - check_msg->corrs[0].I); - ck_assert_msg(check_msg->corrs[0].Q == -1591641785, - "incorrect value for corrs[0].Q, expected -1591641785, is %d", - check_msg->corrs[0].Q); - ck_assert_msg(check_msg->corrs[1].I == 1705169716, - "incorrect value for corrs[1].I, expected 1705169716, is %d", - check_msg->corrs[1].I); - ck_assert_msg(check_msg->corrs[1].Q == 1675764777, - "incorrect value for corrs[1].Q, expected 1675764777, is %d", - check_msg->corrs[1].Q); - ck_assert_msg(check_msg->corrs[2].I == -267498681, - "incorrect value for corrs[2].I, expected -267498681, is %d", - check_msg->corrs[2].I); - ck_assert_msg(check_msg->corrs[2].Q == 1403998854, - "incorrect value for corrs[2].Q, expected 1403998854, is %d", - check_msg->corrs[2].Q); - ck_assert_msg(check_msg->sid.code == 15, - "incorrect value for sid.code, expected 15, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 64028, - "incorrect value for sid.sat, expected 64028, is %d", - check_msg->sid.sat); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_tracking_MsgTrackingIqDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_tracking_MsgTrackingIqDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_tracking_MsgTrackingIqDepA"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_tracking_MsgTrackingIqDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_tracking_MsgTrackingIqDepB.c b/c/test/legacy/auto_check_sbp_tracking_MsgTrackingIqDepB.c deleted file mode 100644 index a7e84372c4..0000000000 --- a/c/test/legacy/auto_check_sbp_tracking_MsgTrackingIqDepB.c +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgTrackingIqDepB.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_tracking_MsgTrackingIqDepB) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x2c, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x2c, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 44, 0, 39, 101, 27, 45, 188, 183, 72, 185, 157, - 15, 187, 249, 101, 24, 135, 146, 180, 224, 123, 235, 142, - 208, 102, 112, 25, 21, 177, 96, 116, 68, 246, 153, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_iq_dep_b_t *test_msg = - (msg_tracking_iq_dep_b_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->channel = 45; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrs[0]); - } - test_msg->corrs[0].I = 261994824; - test_msg->corrs[0].Q = 409336251; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrs[0]); - } - test_msg->corrs[1].I = -525036921; - test_msg->corrs[1].Q = -795939973; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->corrs[0]); - } - test_msg->corrs[2].I = 353988710; - test_msg->corrs[2].Q = 1148477617; - test_msg->sid.code = 183; - test_msg->sid.sat = 188; - sbp_payload_send(&sbp_state, 0x2c, 25895, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 25895, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 25895, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x2c, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_iq_dep_b_t *check_msg = - (msg_tracking_iq_dep_b_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->channel == 45, - "incorrect value for channel, expected 45, is %d", - check_msg->channel); - ck_assert_msg(check_msg->corrs[0].I == 261994824, - "incorrect value for corrs[0].I, expected 261994824, is %d", - check_msg->corrs[0].I); - ck_assert_msg(check_msg->corrs[0].Q == 409336251, - "incorrect value for corrs[0].Q, expected 409336251, is %d", - check_msg->corrs[0].Q); - ck_assert_msg(check_msg->corrs[1].I == -525036921, - "incorrect value for corrs[1].I, expected -525036921, is %d", - check_msg->corrs[1].I); - ck_assert_msg(check_msg->corrs[1].Q == -795939973, - "incorrect value for corrs[1].Q, expected -795939973, is %d", - check_msg->corrs[1].Q); - ck_assert_msg(check_msg->corrs[2].I == 353988710, - "incorrect value for corrs[2].I, expected 353988710, is %d", - check_msg->corrs[2].I); - ck_assert_msg(check_msg->corrs[2].Q == 1148477617, - "incorrect value for corrs[2].Q, expected 1148477617, is %d", - check_msg->corrs[2].Q); - ck_assert_msg(check_msg->sid.code == 183, - "incorrect value for sid.code, expected 183, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.sat == 188, - "incorrect value for sid.sat, expected 188, is %d", - check_msg->sid.sat); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_tracking_MsgTrackingIqDepB_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_tracking_MsgTrackingIqDepB"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_tracking_MsgTrackingIqDepB"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_tracking_MsgTrackingIqDepB); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_tracking_MsgTrackingState.c b/c/test/legacy/auto_check_sbp_tracking_MsgTrackingState.c deleted file mode 100644 index 7a1d48fa8d..0000000000 --- a/c/test/legacy/auto_check_sbp_tracking_MsgTrackingState.c +++ /dev/null @@ -1,3398 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgTrackingState.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_tracking_MsgTrackingState) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x41, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x41, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 65, 0, 55, 129, 252, 117, 184, 3, 102, 38, 106, 140, 141, - 25, 4, 90, 195, 246, 108, 75, 82, 137, 127, 45, 163, 32, 46, - 187, 93, 153, 60, 201, 147, 23, 29, 5, 208, 181, 30, 219, 69, - 254, 136, 3, 121, 33, 98, 144, 215, 133, 182, 14, 56, 169, 77, - 218, 62, 242, 84, 171, 249, 152, 137, 131, 130, 193, 21, 42, 68, - 253, 227, 216, 227, 24, 26, 210, 179, 19, 15, 227, 255, 122, 75, - 187, 200, 217, 48, 218, 122, 187, 238, 142, 149, 238, 55, 251, 212, - 128, 160, 194, 104, 113, 255, 141, 62, 43, 69, 245, 39, 100, 230, - 108, 56, 247, 68, 149, 143, 137, 101, 233, 70, 49, 165, 38, 110, - 218, 230, 80, 213, 196, 179, 139, 128, 15, 178, 196, 171, 8, 212, - 97, 194, 83, 233, 79, 99, 55, 90, 31, 180, 5, 25, 105, 186, - 22, 224, 80, 111, 8, 48, 106, 166, 4, 48, 156, 49, 86, 19, - 142, 146, 91, 124, 115, 64, 28, 230, 115, 178, 190, 131, 16, 242, - 105, 59, 182, 113, 192, 180, 48, 179, 166, 31, 172, 211, 77, 228, - 140, 49, 128, 77, 240, 194, 134, 194, 41, 58, 18, 53, 129, 55, - 91, 72, 134, 92, 33, 224, 157, 56, 186, 54, 224, 174, 82, 84, - 148, 190, 236, 54, 62, 67, 52, 215, 57, 254, 16, 133, 36, 174, - 219, 172, 145, 17, 192, 179, 111, 97, 207, 56, 208, 134, 180, 17, - 43, 226, 255, 182, 140, 113, 141, 111, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_t* test_msg = (msg_tracking_state_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[0].cn0 = 102; - test_msg->states[0].fcn = 3; - test_msg->states[0].sid.code = 184; - test_msg->states[0].sid.sat = 117; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[1].cn0 = 141; - test_msg->states[1].fcn = 140; - test_msg->states[1].sid.code = 106; - test_msg->states[1].sid.sat = 38; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[2].cn0 = 195; - test_msg->states[2].fcn = 90; - test_msg->states[2].sid.code = 4; - test_msg->states[2].sid.sat = 25; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[3].cn0 = 82; - test_msg->states[3].fcn = 75; - test_msg->states[3].sid.code = 108; - test_msg->states[3].sid.sat = 246; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[4].cn0 = 163; - test_msg->states[4].fcn = 45; - test_msg->states[4].sid.code = 127; - test_msg->states[4].sid.sat = 137; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[5].cn0 = 93; - test_msg->states[5].fcn = 187; - test_msg->states[5].sid.code = 46; - test_msg->states[5].sid.sat = 32; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[6].cn0 = 147; - test_msg->states[6].fcn = 201; - test_msg->states[6].sid.code = 60; - test_msg->states[6].sid.sat = 153; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[7].cn0 = 208; - test_msg->states[7].fcn = 5; - test_msg->states[7].sid.code = 29; - test_msg->states[7].sid.sat = 23; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[8].cn0 = 69; - test_msg->states[8].fcn = 219; - test_msg->states[8].sid.code = 30; - test_msg->states[8].sid.sat = 181; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[9].cn0 = 121; - test_msg->states[9].fcn = 3; - test_msg->states[9].sid.code = 136; - test_msg->states[9].sid.sat = 254; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[10].cn0 = 215; - test_msg->states[10].fcn = 144; - test_msg->states[10].sid.code = 98; - test_msg->states[10].sid.sat = 33; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[11].cn0 = 56; - test_msg->states[11].fcn = 14; - test_msg->states[11].sid.code = 182; - test_msg->states[11].sid.sat = 133; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[12].cn0 = 62; - test_msg->states[12].fcn = 218; - test_msg->states[12].sid.code = 77; - test_msg->states[12].sid.sat = 169; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[13].cn0 = 249; - test_msg->states[13].fcn = 171; - test_msg->states[13].sid.code = 84; - test_msg->states[13].sid.sat = 242; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[14].cn0 = 130; - test_msg->states[14].fcn = 131; - test_msg->states[14].sid.code = 137; - test_msg->states[14].sid.sat = 152; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[15].cn0 = 68; - test_msg->states[15].fcn = 42; - test_msg->states[15].sid.code = 21; - test_msg->states[15].sid.sat = 193; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[16].cn0 = 227; - test_msg->states[16].fcn = 216; - test_msg->states[16].sid.code = 227; - test_msg->states[16].sid.sat = 253; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[17].cn0 = 179; - test_msg->states[17].fcn = 210; - test_msg->states[17].sid.code = 26; - test_msg->states[17].sid.sat = 24; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[18].cn0 = 255; - test_msg->states[18].fcn = 227; - test_msg->states[18].sid.code = 15; - test_msg->states[18].sid.sat = 19; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[19].cn0 = 200; - test_msg->states[19].fcn = 187; - test_msg->states[19].sid.code = 75; - test_msg->states[19].sid.sat = 122; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[20].cn0 = 122; - test_msg->states[20].fcn = 218; - test_msg->states[20].sid.code = 48; - test_msg->states[20].sid.sat = 217; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[21].cn0 = 149; - test_msg->states[21].fcn = 142; - test_msg->states[21].sid.code = 238; - test_msg->states[21].sid.sat = 187; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[22].cn0 = 212; - test_msg->states[22].fcn = 251; - test_msg->states[22].sid.code = 55; - test_msg->states[22].sid.sat = 238; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[23].cn0 = 104; - test_msg->states[23].fcn = 194; - test_msg->states[23].sid.code = 160; - test_msg->states[23].sid.sat = 128; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[24].cn0 = 62; - test_msg->states[24].fcn = 141; - test_msg->states[24].sid.code = 255; - test_msg->states[24].sid.sat = 113; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[25].cn0 = 39; - test_msg->states[25].fcn = 245; - test_msg->states[25].sid.code = 69; - test_msg->states[25].sid.sat = 43; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[26].cn0 = 56; - test_msg->states[26].fcn = 108; - test_msg->states[26].sid.code = 230; - test_msg->states[26].sid.sat = 100; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[27].cn0 = 143; - test_msg->states[27].fcn = 149; - test_msg->states[27].sid.code = 68; - test_msg->states[27].sid.sat = 247; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[28].cn0 = 70; - test_msg->states[28].fcn = 233; - test_msg->states[28].sid.code = 101; - test_msg->states[28].sid.sat = 137; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[29].cn0 = 110; - test_msg->states[29].fcn = 38; - test_msg->states[29].sid.code = 165; - test_msg->states[29].sid.sat = 49; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[30].cn0 = 213; - test_msg->states[30].fcn = 80; - test_msg->states[30].sid.code = 230; - test_msg->states[30].sid.sat = 218; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[31].cn0 = 128; - test_msg->states[31].fcn = 139; - test_msg->states[31].sid.code = 179; - test_msg->states[31].sid.sat = 196; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[32].cn0 = 171; - test_msg->states[32].fcn = 196; - test_msg->states[32].sid.code = 178; - test_msg->states[32].sid.sat = 15; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[33].cn0 = 194; - test_msg->states[33].fcn = 97; - test_msg->states[33].sid.code = 212; - test_msg->states[33].sid.sat = 8; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[34].cn0 = 99; - test_msg->states[34].fcn = 79; - test_msg->states[34].sid.code = 233; - test_msg->states[34].sid.sat = 83; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[35].cn0 = 180; - test_msg->states[35].fcn = 31; - test_msg->states[35].sid.code = 90; - test_msg->states[35].sid.sat = 55; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[36].cn0 = 186; - test_msg->states[36].fcn = 105; - test_msg->states[36].sid.code = 25; - test_msg->states[36].sid.sat = 5; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[37].cn0 = 111; - test_msg->states[37].fcn = 80; - test_msg->states[37].sid.code = 224; - test_msg->states[37].sid.sat = 22; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[38].cn0 = 166; - test_msg->states[38].fcn = 106; - test_msg->states[38].sid.code = 48; - test_msg->states[38].sid.sat = 8; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[39].cn0 = 49; - test_msg->states[39].fcn = 156; - test_msg->states[39].sid.code = 48; - test_msg->states[39].sid.sat = 4; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[40].cn0 = 146; - test_msg->states[40].fcn = 142; - test_msg->states[40].sid.code = 19; - test_msg->states[40].sid.sat = 86; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[41].cn0 = 64; - test_msg->states[41].fcn = 115; - test_msg->states[41].sid.code = 124; - test_msg->states[41].sid.sat = 91; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[42].cn0 = 178; - test_msg->states[42].fcn = 115; - test_msg->states[42].sid.code = 230; - test_msg->states[42].sid.sat = 28; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[43].cn0 = 242; - test_msg->states[43].fcn = 16; - test_msg->states[43].sid.code = 131; - test_msg->states[43].sid.sat = 190; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[44].cn0 = 113; - test_msg->states[44].fcn = 182; - test_msg->states[44].sid.code = 59; - test_msg->states[44].sid.sat = 105; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[45].cn0 = 179; - test_msg->states[45].fcn = 48; - test_msg->states[45].sid.code = 180; - test_msg->states[45].sid.sat = 192; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[46].cn0 = 211; - test_msg->states[46].fcn = 172; - test_msg->states[46].sid.code = 31; - test_msg->states[46].sid.sat = 166; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[47].cn0 = 49; - test_msg->states[47].fcn = 140; - test_msg->states[47].sid.code = 228; - test_msg->states[47].sid.sat = 77; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[48].cn0 = 194; - test_msg->states[48].fcn = 240; - test_msg->states[48].sid.code = 77; - test_msg->states[48].sid.sat = 128; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[49].cn0 = 58; - test_msg->states[49].fcn = 41; - test_msg->states[49].sid.code = 194; - test_msg->states[49].sid.sat = 134; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[50].cn0 = 55; - test_msg->states[50].fcn = 129; - test_msg->states[50].sid.code = 53; - test_msg->states[50].sid.sat = 18; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[51].cn0 = 92; - test_msg->states[51].fcn = 134; - test_msg->states[51].sid.code = 72; - test_msg->states[51].sid.sat = 91; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[52].cn0 = 56; - test_msg->states[52].fcn = 157; - test_msg->states[52].sid.code = 224; - test_msg->states[52].sid.sat = 33; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[53].cn0 = 174; - test_msg->states[53].fcn = 224; - test_msg->states[53].sid.code = 54; - test_msg->states[53].sid.sat = 186; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[54].cn0 = 190; - test_msg->states[54].fcn = 148; - test_msg->states[54].sid.code = 84; - test_msg->states[54].sid.sat = 82; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[55].cn0 = 67; - test_msg->states[55].fcn = 62; - test_msg->states[55].sid.code = 54; - test_msg->states[55].sid.sat = 236; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[56].cn0 = 254; - test_msg->states[56].fcn = 57; - test_msg->states[56].sid.code = 215; - test_msg->states[56].sid.sat = 52; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[57].cn0 = 174; - test_msg->states[57].fcn = 36; - test_msg->states[57].sid.code = 133; - test_msg->states[57].sid.sat = 16; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[58].cn0 = 17; - test_msg->states[58].fcn = 145; - test_msg->states[58].sid.code = 172; - test_msg->states[58].sid.sat = 219; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[59].cn0 = 97; - test_msg->states[59].fcn = 111; - test_msg->states[59].sid.code = 179; - test_msg->states[59].sid.sat = 192; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[60].cn0 = 134; - test_msg->states[60].fcn = 208; - test_msg->states[60].sid.code = 56; - test_msg->states[60].sid.sat = 207; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[61].cn0 = 226; - test_msg->states[61].fcn = 43; - test_msg->states[61].sid.code = 17; - test_msg->states[61].sid.sat = 180; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[62].cn0 = 113; - test_msg->states[62].fcn = 140; - test_msg->states[62].sid.code = 182; - test_msg->states[62].sid.sat = 255; - sbp_payload_send(&sbp_state, 0x41, 33079, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 33079, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 33079, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x41, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_t* check_msg = - (msg_tracking_state_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->states[0].cn0 == 102, - "incorrect value for states[0].cn0, expected 102, is %d", - check_msg->states[0].cn0); - ck_assert_msg(check_msg->states[0].fcn == 3, - "incorrect value for states[0].fcn, expected 3, is %d", - check_msg->states[0].fcn); - ck_assert_msg(check_msg->states[0].sid.code == 184, - "incorrect value for states[0].sid.code, expected 184, is %d", - check_msg->states[0].sid.code); - ck_assert_msg(check_msg->states[0].sid.sat == 117, - "incorrect value for states[0].sid.sat, expected 117, is %d", - check_msg->states[0].sid.sat); - ck_assert_msg(check_msg->states[1].cn0 == 141, - "incorrect value for states[1].cn0, expected 141, is %d", - check_msg->states[1].cn0); - ck_assert_msg(check_msg->states[1].fcn == 140, - "incorrect value for states[1].fcn, expected 140, is %d", - check_msg->states[1].fcn); - ck_assert_msg(check_msg->states[1].sid.code == 106, - "incorrect value for states[1].sid.code, expected 106, is %d", - check_msg->states[1].sid.code); - ck_assert_msg(check_msg->states[1].sid.sat == 38, - "incorrect value for states[1].sid.sat, expected 38, is %d", - check_msg->states[1].sid.sat); - ck_assert_msg(check_msg->states[2].cn0 == 195, - "incorrect value for states[2].cn0, expected 195, is %d", - check_msg->states[2].cn0); - ck_assert_msg(check_msg->states[2].fcn == 90, - "incorrect value for states[2].fcn, expected 90, is %d", - check_msg->states[2].fcn); - ck_assert_msg(check_msg->states[2].sid.code == 4, - "incorrect value for states[2].sid.code, expected 4, is %d", - check_msg->states[2].sid.code); - ck_assert_msg(check_msg->states[2].sid.sat == 25, - "incorrect value for states[2].sid.sat, expected 25, is %d", - check_msg->states[2].sid.sat); - ck_assert_msg(check_msg->states[3].cn0 == 82, - "incorrect value for states[3].cn0, expected 82, is %d", - check_msg->states[3].cn0); - ck_assert_msg(check_msg->states[3].fcn == 75, - "incorrect value for states[3].fcn, expected 75, is %d", - check_msg->states[3].fcn); - ck_assert_msg(check_msg->states[3].sid.code == 108, - "incorrect value for states[3].sid.code, expected 108, is %d", - check_msg->states[3].sid.code); - ck_assert_msg(check_msg->states[3].sid.sat == 246, - "incorrect value for states[3].sid.sat, expected 246, is %d", - check_msg->states[3].sid.sat); - ck_assert_msg(check_msg->states[4].cn0 == 163, - "incorrect value for states[4].cn0, expected 163, is %d", - check_msg->states[4].cn0); - ck_assert_msg(check_msg->states[4].fcn == 45, - "incorrect value for states[4].fcn, expected 45, is %d", - check_msg->states[4].fcn); - ck_assert_msg(check_msg->states[4].sid.code == 127, - "incorrect value for states[4].sid.code, expected 127, is %d", - check_msg->states[4].sid.code); - ck_assert_msg(check_msg->states[4].sid.sat == 137, - "incorrect value for states[4].sid.sat, expected 137, is %d", - check_msg->states[4].sid.sat); - ck_assert_msg(check_msg->states[5].cn0 == 93, - "incorrect value for states[5].cn0, expected 93, is %d", - check_msg->states[5].cn0); - ck_assert_msg(check_msg->states[5].fcn == 187, - "incorrect value for states[5].fcn, expected 187, is %d", - check_msg->states[5].fcn); - ck_assert_msg(check_msg->states[5].sid.code == 46, - "incorrect value for states[5].sid.code, expected 46, is %d", - check_msg->states[5].sid.code); - ck_assert_msg(check_msg->states[5].sid.sat == 32, - "incorrect value for states[5].sid.sat, expected 32, is %d", - check_msg->states[5].sid.sat); - ck_assert_msg(check_msg->states[6].cn0 == 147, - "incorrect value for states[6].cn0, expected 147, is %d", - check_msg->states[6].cn0); - ck_assert_msg(check_msg->states[6].fcn == 201, - "incorrect value for states[6].fcn, expected 201, is %d", - check_msg->states[6].fcn); - ck_assert_msg(check_msg->states[6].sid.code == 60, - "incorrect value for states[6].sid.code, expected 60, is %d", - check_msg->states[6].sid.code); - ck_assert_msg(check_msg->states[6].sid.sat == 153, - "incorrect value for states[6].sid.sat, expected 153, is %d", - check_msg->states[6].sid.sat); - ck_assert_msg(check_msg->states[7].cn0 == 208, - "incorrect value for states[7].cn0, expected 208, is %d", - check_msg->states[7].cn0); - ck_assert_msg(check_msg->states[7].fcn == 5, - "incorrect value for states[7].fcn, expected 5, is %d", - check_msg->states[7].fcn); - ck_assert_msg(check_msg->states[7].sid.code == 29, - "incorrect value for states[7].sid.code, expected 29, is %d", - check_msg->states[7].sid.code); - ck_assert_msg(check_msg->states[7].sid.sat == 23, - "incorrect value for states[7].sid.sat, expected 23, is %d", - check_msg->states[7].sid.sat); - ck_assert_msg(check_msg->states[8].cn0 == 69, - "incorrect value for states[8].cn0, expected 69, is %d", - check_msg->states[8].cn0); - ck_assert_msg(check_msg->states[8].fcn == 219, - "incorrect value for states[8].fcn, expected 219, is %d", - check_msg->states[8].fcn); - ck_assert_msg(check_msg->states[8].sid.code == 30, - "incorrect value for states[8].sid.code, expected 30, is %d", - check_msg->states[8].sid.code); - ck_assert_msg(check_msg->states[8].sid.sat == 181, - "incorrect value for states[8].sid.sat, expected 181, is %d", - check_msg->states[8].sid.sat); - ck_assert_msg(check_msg->states[9].cn0 == 121, - "incorrect value for states[9].cn0, expected 121, is %d", - check_msg->states[9].cn0); - ck_assert_msg(check_msg->states[9].fcn == 3, - "incorrect value for states[9].fcn, expected 3, is %d", - check_msg->states[9].fcn); - ck_assert_msg(check_msg->states[9].sid.code == 136, - "incorrect value for states[9].sid.code, expected 136, is %d", - check_msg->states[9].sid.code); - ck_assert_msg(check_msg->states[9].sid.sat == 254, - "incorrect value for states[9].sid.sat, expected 254, is %d", - check_msg->states[9].sid.sat); - ck_assert_msg(check_msg->states[10].cn0 == 215, - "incorrect value for states[10].cn0, expected 215, is %d", - check_msg->states[10].cn0); - ck_assert_msg(check_msg->states[10].fcn == 144, - "incorrect value for states[10].fcn, expected 144, is %d", - check_msg->states[10].fcn); - ck_assert_msg(check_msg->states[10].sid.code == 98, - "incorrect value for states[10].sid.code, expected 98, is %d", - check_msg->states[10].sid.code); - ck_assert_msg(check_msg->states[10].sid.sat == 33, - "incorrect value for states[10].sid.sat, expected 33, is %d", - check_msg->states[10].sid.sat); - ck_assert_msg(check_msg->states[11].cn0 == 56, - "incorrect value for states[11].cn0, expected 56, is %d", - check_msg->states[11].cn0); - ck_assert_msg(check_msg->states[11].fcn == 14, - "incorrect value for states[11].fcn, expected 14, is %d", - check_msg->states[11].fcn); - ck_assert_msg( - check_msg->states[11].sid.code == 182, - "incorrect value for states[11].sid.code, expected 182, is %d", - check_msg->states[11].sid.code); - ck_assert_msg(check_msg->states[11].sid.sat == 133, - "incorrect value for states[11].sid.sat, expected 133, is %d", - check_msg->states[11].sid.sat); - ck_assert_msg(check_msg->states[12].cn0 == 62, - "incorrect value for states[12].cn0, expected 62, is %d", - check_msg->states[12].cn0); - ck_assert_msg(check_msg->states[12].fcn == 218, - "incorrect value for states[12].fcn, expected 218, is %d", - check_msg->states[12].fcn); - ck_assert_msg(check_msg->states[12].sid.code == 77, - "incorrect value for states[12].sid.code, expected 77, is %d", - check_msg->states[12].sid.code); - ck_assert_msg(check_msg->states[12].sid.sat == 169, - "incorrect value for states[12].sid.sat, expected 169, is %d", - check_msg->states[12].sid.sat); - ck_assert_msg(check_msg->states[13].cn0 == 249, - "incorrect value for states[13].cn0, expected 249, is %d", - check_msg->states[13].cn0); - ck_assert_msg(check_msg->states[13].fcn == 171, - "incorrect value for states[13].fcn, expected 171, is %d", - check_msg->states[13].fcn); - ck_assert_msg(check_msg->states[13].sid.code == 84, - "incorrect value for states[13].sid.code, expected 84, is %d", - check_msg->states[13].sid.code); - ck_assert_msg(check_msg->states[13].sid.sat == 242, - "incorrect value for states[13].sid.sat, expected 242, is %d", - check_msg->states[13].sid.sat); - ck_assert_msg(check_msg->states[14].cn0 == 130, - "incorrect value for states[14].cn0, expected 130, is %d", - check_msg->states[14].cn0); - ck_assert_msg(check_msg->states[14].fcn == 131, - "incorrect value for states[14].fcn, expected 131, is %d", - check_msg->states[14].fcn); - ck_assert_msg( - check_msg->states[14].sid.code == 137, - "incorrect value for states[14].sid.code, expected 137, is %d", - check_msg->states[14].sid.code); - ck_assert_msg(check_msg->states[14].sid.sat == 152, - "incorrect value for states[14].sid.sat, expected 152, is %d", - check_msg->states[14].sid.sat); - ck_assert_msg(check_msg->states[15].cn0 == 68, - "incorrect value for states[15].cn0, expected 68, is %d", - check_msg->states[15].cn0); - ck_assert_msg(check_msg->states[15].fcn == 42, - "incorrect value for states[15].fcn, expected 42, is %d", - check_msg->states[15].fcn); - ck_assert_msg(check_msg->states[15].sid.code == 21, - "incorrect value for states[15].sid.code, expected 21, is %d", - check_msg->states[15].sid.code); - ck_assert_msg(check_msg->states[15].sid.sat == 193, - "incorrect value for states[15].sid.sat, expected 193, is %d", - check_msg->states[15].sid.sat); - ck_assert_msg(check_msg->states[16].cn0 == 227, - "incorrect value for states[16].cn0, expected 227, is %d", - check_msg->states[16].cn0); - ck_assert_msg(check_msg->states[16].fcn == 216, - "incorrect value for states[16].fcn, expected 216, is %d", - check_msg->states[16].fcn); - ck_assert_msg( - check_msg->states[16].sid.code == 227, - "incorrect value for states[16].sid.code, expected 227, is %d", - check_msg->states[16].sid.code); - ck_assert_msg(check_msg->states[16].sid.sat == 253, - "incorrect value for states[16].sid.sat, expected 253, is %d", - check_msg->states[16].sid.sat); - ck_assert_msg(check_msg->states[17].cn0 == 179, - "incorrect value for states[17].cn0, expected 179, is %d", - check_msg->states[17].cn0); - ck_assert_msg(check_msg->states[17].fcn == 210, - "incorrect value for states[17].fcn, expected 210, is %d", - check_msg->states[17].fcn); - ck_assert_msg(check_msg->states[17].sid.code == 26, - "incorrect value for states[17].sid.code, expected 26, is %d", - check_msg->states[17].sid.code); - ck_assert_msg(check_msg->states[17].sid.sat == 24, - "incorrect value for states[17].sid.sat, expected 24, is %d", - check_msg->states[17].sid.sat); - ck_assert_msg(check_msg->states[18].cn0 == 255, - "incorrect value for states[18].cn0, expected 255, is %d", - check_msg->states[18].cn0); - ck_assert_msg(check_msg->states[18].fcn == 227, - "incorrect value for states[18].fcn, expected 227, is %d", - check_msg->states[18].fcn); - ck_assert_msg(check_msg->states[18].sid.code == 15, - "incorrect value for states[18].sid.code, expected 15, is %d", - check_msg->states[18].sid.code); - ck_assert_msg(check_msg->states[18].sid.sat == 19, - "incorrect value for states[18].sid.sat, expected 19, is %d", - check_msg->states[18].sid.sat); - ck_assert_msg(check_msg->states[19].cn0 == 200, - "incorrect value for states[19].cn0, expected 200, is %d", - check_msg->states[19].cn0); - ck_assert_msg(check_msg->states[19].fcn == 187, - "incorrect value for states[19].fcn, expected 187, is %d", - check_msg->states[19].fcn); - ck_assert_msg(check_msg->states[19].sid.code == 75, - "incorrect value for states[19].sid.code, expected 75, is %d", - check_msg->states[19].sid.code); - ck_assert_msg(check_msg->states[19].sid.sat == 122, - "incorrect value for states[19].sid.sat, expected 122, is %d", - check_msg->states[19].sid.sat); - ck_assert_msg(check_msg->states[20].cn0 == 122, - "incorrect value for states[20].cn0, expected 122, is %d", - check_msg->states[20].cn0); - ck_assert_msg(check_msg->states[20].fcn == 218, - "incorrect value for states[20].fcn, expected 218, is %d", - check_msg->states[20].fcn); - ck_assert_msg(check_msg->states[20].sid.code == 48, - "incorrect value for states[20].sid.code, expected 48, is %d", - check_msg->states[20].sid.code); - ck_assert_msg(check_msg->states[20].sid.sat == 217, - "incorrect value for states[20].sid.sat, expected 217, is %d", - check_msg->states[20].sid.sat); - ck_assert_msg(check_msg->states[21].cn0 == 149, - "incorrect value for states[21].cn0, expected 149, is %d", - check_msg->states[21].cn0); - ck_assert_msg(check_msg->states[21].fcn == 142, - "incorrect value for states[21].fcn, expected 142, is %d", - check_msg->states[21].fcn); - ck_assert_msg( - check_msg->states[21].sid.code == 238, - "incorrect value for states[21].sid.code, expected 238, is %d", - check_msg->states[21].sid.code); - ck_assert_msg(check_msg->states[21].sid.sat == 187, - "incorrect value for states[21].sid.sat, expected 187, is %d", - check_msg->states[21].sid.sat); - ck_assert_msg(check_msg->states[22].cn0 == 212, - "incorrect value for states[22].cn0, expected 212, is %d", - check_msg->states[22].cn0); - ck_assert_msg(check_msg->states[22].fcn == 251, - "incorrect value for states[22].fcn, expected 251, is %d", - check_msg->states[22].fcn); - ck_assert_msg(check_msg->states[22].sid.code == 55, - "incorrect value for states[22].sid.code, expected 55, is %d", - check_msg->states[22].sid.code); - ck_assert_msg(check_msg->states[22].sid.sat == 238, - "incorrect value for states[22].sid.sat, expected 238, is %d", - check_msg->states[22].sid.sat); - ck_assert_msg(check_msg->states[23].cn0 == 104, - "incorrect value for states[23].cn0, expected 104, is %d", - check_msg->states[23].cn0); - ck_assert_msg(check_msg->states[23].fcn == 194, - "incorrect value for states[23].fcn, expected 194, is %d", - check_msg->states[23].fcn); - ck_assert_msg( - check_msg->states[23].sid.code == 160, - "incorrect value for states[23].sid.code, expected 160, is %d", - check_msg->states[23].sid.code); - ck_assert_msg(check_msg->states[23].sid.sat == 128, - "incorrect value for states[23].sid.sat, expected 128, is %d", - check_msg->states[23].sid.sat); - ck_assert_msg(check_msg->states[24].cn0 == 62, - "incorrect value for states[24].cn0, expected 62, is %d", - check_msg->states[24].cn0); - ck_assert_msg(check_msg->states[24].fcn == 141, - "incorrect value for states[24].fcn, expected 141, is %d", - check_msg->states[24].fcn); - ck_assert_msg( - check_msg->states[24].sid.code == 255, - "incorrect value for states[24].sid.code, expected 255, is %d", - check_msg->states[24].sid.code); - ck_assert_msg(check_msg->states[24].sid.sat == 113, - "incorrect value for states[24].sid.sat, expected 113, is %d", - check_msg->states[24].sid.sat); - ck_assert_msg(check_msg->states[25].cn0 == 39, - "incorrect value for states[25].cn0, expected 39, is %d", - check_msg->states[25].cn0); - ck_assert_msg(check_msg->states[25].fcn == 245, - "incorrect value for states[25].fcn, expected 245, is %d", - check_msg->states[25].fcn); - ck_assert_msg(check_msg->states[25].sid.code == 69, - "incorrect value for states[25].sid.code, expected 69, is %d", - check_msg->states[25].sid.code); - ck_assert_msg(check_msg->states[25].sid.sat == 43, - "incorrect value for states[25].sid.sat, expected 43, is %d", - check_msg->states[25].sid.sat); - ck_assert_msg(check_msg->states[26].cn0 == 56, - "incorrect value for states[26].cn0, expected 56, is %d", - check_msg->states[26].cn0); - ck_assert_msg(check_msg->states[26].fcn == 108, - "incorrect value for states[26].fcn, expected 108, is %d", - check_msg->states[26].fcn); - ck_assert_msg( - check_msg->states[26].sid.code == 230, - "incorrect value for states[26].sid.code, expected 230, is %d", - check_msg->states[26].sid.code); - ck_assert_msg(check_msg->states[26].sid.sat == 100, - "incorrect value for states[26].sid.sat, expected 100, is %d", - check_msg->states[26].sid.sat); - ck_assert_msg(check_msg->states[27].cn0 == 143, - "incorrect value for states[27].cn0, expected 143, is %d", - check_msg->states[27].cn0); - ck_assert_msg(check_msg->states[27].fcn == 149, - "incorrect value for states[27].fcn, expected 149, is %d", - check_msg->states[27].fcn); - ck_assert_msg(check_msg->states[27].sid.code == 68, - "incorrect value for states[27].sid.code, expected 68, is %d", - check_msg->states[27].sid.code); - ck_assert_msg(check_msg->states[27].sid.sat == 247, - "incorrect value for states[27].sid.sat, expected 247, is %d", - check_msg->states[27].sid.sat); - ck_assert_msg(check_msg->states[28].cn0 == 70, - "incorrect value for states[28].cn0, expected 70, is %d", - check_msg->states[28].cn0); - ck_assert_msg(check_msg->states[28].fcn == 233, - "incorrect value for states[28].fcn, expected 233, is %d", - check_msg->states[28].fcn); - ck_assert_msg( - check_msg->states[28].sid.code == 101, - "incorrect value for states[28].sid.code, expected 101, is %d", - check_msg->states[28].sid.code); - ck_assert_msg(check_msg->states[28].sid.sat == 137, - "incorrect value for states[28].sid.sat, expected 137, is %d", - check_msg->states[28].sid.sat); - ck_assert_msg(check_msg->states[29].cn0 == 110, - "incorrect value for states[29].cn0, expected 110, is %d", - check_msg->states[29].cn0); - ck_assert_msg(check_msg->states[29].fcn == 38, - "incorrect value for states[29].fcn, expected 38, is %d", - check_msg->states[29].fcn); - ck_assert_msg( - check_msg->states[29].sid.code == 165, - "incorrect value for states[29].sid.code, expected 165, is %d", - check_msg->states[29].sid.code); - ck_assert_msg(check_msg->states[29].sid.sat == 49, - "incorrect value for states[29].sid.sat, expected 49, is %d", - check_msg->states[29].sid.sat); - ck_assert_msg(check_msg->states[30].cn0 == 213, - "incorrect value for states[30].cn0, expected 213, is %d", - check_msg->states[30].cn0); - ck_assert_msg(check_msg->states[30].fcn == 80, - "incorrect value for states[30].fcn, expected 80, is %d", - check_msg->states[30].fcn); - ck_assert_msg( - check_msg->states[30].sid.code == 230, - "incorrect value for states[30].sid.code, expected 230, is %d", - check_msg->states[30].sid.code); - ck_assert_msg(check_msg->states[30].sid.sat == 218, - "incorrect value for states[30].sid.sat, expected 218, is %d", - check_msg->states[30].sid.sat); - ck_assert_msg(check_msg->states[31].cn0 == 128, - "incorrect value for states[31].cn0, expected 128, is %d", - check_msg->states[31].cn0); - ck_assert_msg(check_msg->states[31].fcn == 139, - "incorrect value for states[31].fcn, expected 139, is %d", - check_msg->states[31].fcn); - ck_assert_msg( - check_msg->states[31].sid.code == 179, - "incorrect value for states[31].sid.code, expected 179, is %d", - check_msg->states[31].sid.code); - ck_assert_msg(check_msg->states[31].sid.sat == 196, - "incorrect value for states[31].sid.sat, expected 196, is %d", - check_msg->states[31].sid.sat); - ck_assert_msg(check_msg->states[32].cn0 == 171, - "incorrect value for states[32].cn0, expected 171, is %d", - check_msg->states[32].cn0); - ck_assert_msg(check_msg->states[32].fcn == 196, - "incorrect value for states[32].fcn, expected 196, is %d", - check_msg->states[32].fcn); - ck_assert_msg( - check_msg->states[32].sid.code == 178, - "incorrect value for states[32].sid.code, expected 178, is %d", - check_msg->states[32].sid.code); - ck_assert_msg(check_msg->states[32].sid.sat == 15, - "incorrect value for states[32].sid.sat, expected 15, is %d", - check_msg->states[32].sid.sat); - ck_assert_msg(check_msg->states[33].cn0 == 194, - "incorrect value for states[33].cn0, expected 194, is %d", - check_msg->states[33].cn0); - ck_assert_msg(check_msg->states[33].fcn == 97, - "incorrect value for states[33].fcn, expected 97, is %d", - check_msg->states[33].fcn); - ck_assert_msg( - check_msg->states[33].sid.code == 212, - "incorrect value for states[33].sid.code, expected 212, is %d", - check_msg->states[33].sid.code); - ck_assert_msg(check_msg->states[33].sid.sat == 8, - "incorrect value for states[33].sid.sat, expected 8, is %d", - check_msg->states[33].sid.sat); - ck_assert_msg(check_msg->states[34].cn0 == 99, - "incorrect value for states[34].cn0, expected 99, is %d", - check_msg->states[34].cn0); - ck_assert_msg(check_msg->states[34].fcn == 79, - "incorrect value for states[34].fcn, expected 79, is %d", - check_msg->states[34].fcn); - ck_assert_msg( - check_msg->states[34].sid.code == 233, - "incorrect value for states[34].sid.code, expected 233, is %d", - check_msg->states[34].sid.code); - ck_assert_msg(check_msg->states[34].sid.sat == 83, - "incorrect value for states[34].sid.sat, expected 83, is %d", - check_msg->states[34].sid.sat); - ck_assert_msg(check_msg->states[35].cn0 == 180, - "incorrect value for states[35].cn0, expected 180, is %d", - check_msg->states[35].cn0); - ck_assert_msg(check_msg->states[35].fcn == 31, - "incorrect value for states[35].fcn, expected 31, is %d", - check_msg->states[35].fcn); - ck_assert_msg(check_msg->states[35].sid.code == 90, - "incorrect value for states[35].sid.code, expected 90, is %d", - check_msg->states[35].sid.code); - ck_assert_msg(check_msg->states[35].sid.sat == 55, - "incorrect value for states[35].sid.sat, expected 55, is %d", - check_msg->states[35].sid.sat); - ck_assert_msg(check_msg->states[36].cn0 == 186, - "incorrect value for states[36].cn0, expected 186, is %d", - check_msg->states[36].cn0); - ck_assert_msg(check_msg->states[36].fcn == 105, - "incorrect value for states[36].fcn, expected 105, is %d", - check_msg->states[36].fcn); - ck_assert_msg(check_msg->states[36].sid.code == 25, - "incorrect value for states[36].sid.code, expected 25, is %d", - check_msg->states[36].sid.code); - ck_assert_msg(check_msg->states[36].sid.sat == 5, - "incorrect value for states[36].sid.sat, expected 5, is %d", - check_msg->states[36].sid.sat); - ck_assert_msg(check_msg->states[37].cn0 == 111, - "incorrect value for states[37].cn0, expected 111, is %d", - check_msg->states[37].cn0); - ck_assert_msg(check_msg->states[37].fcn == 80, - "incorrect value for states[37].fcn, expected 80, is %d", - check_msg->states[37].fcn); - ck_assert_msg( - check_msg->states[37].sid.code == 224, - "incorrect value for states[37].sid.code, expected 224, is %d", - check_msg->states[37].sid.code); - ck_assert_msg(check_msg->states[37].sid.sat == 22, - "incorrect value for states[37].sid.sat, expected 22, is %d", - check_msg->states[37].sid.sat); - ck_assert_msg(check_msg->states[38].cn0 == 166, - "incorrect value for states[38].cn0, expected 166, is %d", - check_msg->states[38].cn0); - ck_assert_msg(check_msg->states[38].fcn == 106, - "incorrect value for states[38].fcn, expected 106, is %d", - check_msg->states[38].fcn); - ck_assert_msg(check_msg->states[38].sid.code == 48, - "incorrect value for states[38].sid.code, expected 48, is %d", - check_msg->states[38].sid.code); - ck_assert_msg(check_msg->states[38].sid.sat == 8, - "incorrect value for states[38].sid.sat, expected 8, is %d", - check_msg->states[38].sid.sat); - ck_assert_msg(check_msg->states[39].cn0 == 49, - "incorrect value for states[39].cn0, expected 49, is %d", - check_msg->states[39].cn0); - ck_assert_msg(check_msg->states[39].fcn == 156, - "incorrect value for states[39].fcn, expected 156, is %d", - check_msg->states[39].fcn); - ck_assert_msg(check_msg->states[39].sid.code == 48, - "incorrect value for states[39].sid.code, expected 48, is %d", - check_msg->states[39].sid.code); - ck_assert_msg(check_msg->states[39].sid.sat == 4, - "incorrect value for states[39].sid.sat, expected 4, is %d", - check_msg->states[39].sid.sat); - ck_assert_msg(check_msg->states[40].cn0 == 146, - "incorrect value for states[40].cn0, expected 146, is %d", - check_msg->states[40].cn0); - ck_assert_msg(check_msg->states[40].fcn == 142, - "incorrect value for states[40].fcn, expected 142, is %d", - check_msg->states[40].fcn); - ck_assert_msg(check_msg->states[40].sid.code == 19, - "incorrect value for states[40].sid.code, expected 19, is %d", - check_msg->states[40].sid.code); - ck_assert_msg(check_msg->states[40].sid.sat == 86, - "incorrect value for states[40].sid.sat, expected 86, is %d", - check_msg->states[40].sid.sat); - ck_assert_msg(check_msg->states[41].cn0 == 64, - "incorrect value for states[41].cn0, expected 64, is %d", - check_msg->states[41].cn0); - ck_assert_msg(check_msg->states[41].fcn == 115, - "incorrect value for states[41].fcn, expected 115, is %d", - check_msg->states[41].fcn); - ck_assert_msg( - check_msg->states[41].sid.code == 124, - "incorrect value for states[41].sid.code, expected 124, is %d", - check_msg->states[41].sid.code); - ck_assert_msg(check_msg->states[41].sid.sat == 91, - "incorrect value for states[41].sid.sat, expected 91, is %d", - check_msg->states[41].sid.sat); - ck_assert_msg(check_msg->states[42].cn0 == 178, - "incorrect value for states[42].cn0, expected 178, is %d", - check_msg->states[42].cn0); - ck_assert_msg(check_msg->states[42].fcn == 115, - "incorrect value for states[42].fcn, expected 115, is %d", - check_msg->states[42].fcn); - ck_assert_msg( - check_msg->states[42].sid.code == 230, - "incorrect value for states[42].sid.code, expected 230, is %d", - check_msg->states[42].sid.code); - ck_assert_msg(check_msg->states[42].sid.sat == 28, - "incorrect value for states[42].sid.sat, expected 28, is %d", - check_msg->states[42].sid.sat); - ck_assert_msg(check_msg->states[43].cn0 == 242, - "incorrect value for states[43].cn0, expected 242, is %d", - check_msg->states[43].cn0); - ck_assert_msg(check_msg->states[43].fcn == 16, - "incorrect value for states[43].fcn, expected 16, is %d", - check_msg->states[43].fcn); - ck_assert_msg( - check_msg->states[43].sid.code == 131, - "incorrect value for states[43].sid.code, expected 131, is %d", - check_msg->states[43].sid.code); - ck_assert_msg(check_msg->states[43].sid.sat == 190, - "incorrect value for states[43].sid.sat, expected 190, is %d", - check_msg->states[43].sid.sat); - ck_assert_msg(check_msg->states[44].cn0 == 113, - "incorrect value for states[44].cn0, expected 113, is %d", - check_msg->states[44].cn0); - ck_assert_msg(check_msg->states[44].fcn == 182, - "incorrect value for states[44].fcn, expected 182, is %d", - check_msg->states[44].fcn); - ck_assert_msg(check_msg->states[44].sid.code == 59, - "incorrect value for states[44].sid.code, expected 59, is %d", - check_msg->states[44].sid.code); - ck_assert_msg(check_msg->states[44].sid.sat == 105, - "incorrect value for states[44].sid.sat, expected 105, is %d", - check_msg->states[44].sid.sat); - ck_assert_msg(check_msg->states[45].cn0 == 179, - "incorrect value for states[45].cn0, expected 179, is %d", - check_msg->states[45].cn0); - ck_assert_msg(check_msg->states[45].fcn == 48, - "incorrect value for states[45].fcn, expected 48, is %d", - check_msg->states[45].fcn); - ck_assert_msg( - check_msg->states[45].sid.code == 180, - "incorrect value for states[45].sid.code, expected 180, is %d", - check_msg->states[45].sid.code); - ck_assert_msg(check_msg->states[45].sid.sat == 192, - "incorrect value for states[45].sid.sat, expected 192, is %d", - check_msg->states[45].sid.sat); - ck_assert_msg(check_msg->states[46].cn0 == 211, - "incorrect value for states[46].cn0, expected 211, is %d", - check_msg->states[46].cn0); - ck_assert_msg(check_msg->states[46].fcn == 172, - "incorrect value for states[46].fcn, expected 172, is %d", - check_msg->states[46].fcn); - ck_assert_msg(check_msg->states[46].sid.code == 31, - "incorrect value for states[46].sid.code, expected 31, is %d", - check_msg->states[46].sid.code); - ck_assert_msg(check_msg->states[46].sid.sat == 166, - "incorrect value for states[46].sid.sat, expected 166, is %d", - check_msg->states[46].sid.sat); - ck_assert_msg(check_msg->states[47].cn0 == 49, - "incorrect value for states[47].cn0, expected 49, is %d", - check_msg->states[47].cn0); - ck_assert_msg(check_msg->states[47].fcn == 140, - "incorrect value for states[47].fcn, expected 140, is %d", - check_msg->states[47].fcn); - ck_assert_msg( - check_msg->states[47].sid.code == 228, - "incorrect value for states[47].sid.code, expected 228, is %d", - check_msg->states[47].sid.code); - ck_assert_msg(check_msg->states[47].sid.sat == 77, - "incorrect value for states[47].sid.sat, expected 77, is %d", - check_msg->states[47].sid.sat); - ck_assert_msg(check_msg->states[48].cn0 == 194, - "incorrect value for states[48].cn0, expected 194, is %d", - check_msg->states[48].cn0); - ck_assert_msg(check_msg->states[48].fcn == 240, - "incorrect value for states[48].fcn, expected 240, is %d", - check_msg->states[48].fcn); - ck_assert_msg(check_msg->states[48].sid.code == 77, - "incorrect value for states[48].sid.code, expected 77, is %d", - check_msg->states[48].sid.code); - ck_assert_msg(check_msg->states[48].sid.sat == 128, - "incorrect value for states[48].sid.sat, expected 128, is %d", - check_msg->states[48].sid.sat); - ck_assert_msg(check_msg->states[49].cn0 == 58, - "incorrect value for states[49].cn0, expected 58, is %d", - check_msg->states[49].cn0); - ck_assert_msg(check_msg->states[49].fcn == 41, - "incorrect value for states[49].fcn, expected 41, is %d", - check_msg->states[49].fcn); - ck_assert_msg( - check_msg->states[49].sid.code == 194, - "incorrect value for states[49].sid.code, expected 194, is %d", - check_msg->states[49].sid.code); - ck_assert_msg(check_msg->states[49].sid.sat == 134, - "incorrect value for states[49].sid.sat, expected 134, is %d", - check_msg->states[49].sid.sat); - ck_assert_msg(check_msg->states[50].cn0 == 55, - "incorrect value for states[50].cn0, expected 55, is %d", - check_msg->states[50].cn0); - ck_assert_msg(check_msg->states[50].fcn == 129, - "incorrect value for states[50].fcn, expected 129, is %d", - check_msg->states[50].fcn); - ck_assert_msg(check_msg->states[50].sid.code == 53, - "incorrect value for states[50].sid.code, expected 53, is %d", - check_msg->states[50].sid.code); - ck_assert_msg(check_msg->states[50].sid.sat == 18, - "incorrect value for states[50].sid.sat, expected 18, is %d", - check_msg->states[50].sid.sat); - ck_assert_msg(check_msg->states[51].cn0 == 92, - "incorrect value for states[51].cn0, expected 92, is %d", - check_msg->states[51].cn0); - ck_assert_msg(check_msg->states[51].fcn == 134, - "incorrect value for states[51].fcn, expected 134, is %d", - check_msg->states[51].fcn); - ck_assert_msg(check_msg->states[51].sid.code == 72, - "incorrect value for states[51].sid.code, expected 72, is %d", - check_msg->states[51].sid.code); - ck_assert_msg(check_msg->states[51].sid.sat == 91, - "incorrect value for states[51].sid.sat, expected 91, is %d", - check_msg->states[51].sid.sat); - ck_assert_msg(check_msg->states[52].cn0 == 56, - "incorrect value for states[52].cn0, expected 56, is %d", - check_msg->states[52].cn0); - ck_assert_msg(check_msg->states[52].fcn == 157, - "incorrect value for states[52].fcn, expected 157, is %d", - check_msg->states[52].fcn); - ck_assert_msg( - check_msg->states[52].sid.code == 224, - "incorrect value for states[52].sid.code, expected 224, is %d", - check_msg->states[52].sid.code); - ck_assert_msg(check_msg->states[52].sid.sat == 33, - "incorrect value for states[52].sid.sat, expected 33, is %d", - check_msg->states[52].sid.sat); - ck_assert_msg(check_msg->states[53].cn0 == 174, - "incorrect value for states[53].cn0, expected 174, is %d", - check_msg->states[53].cn0); - ck_assert_msg(check_msg->states[53].fcn == 224, - "incorrect value for states[53].fcn, expected 224, is %d", - check_msg->states[53].fcn); - ck_assert_msg(check_msg->states[53].sid.code == 54, - "incorrect value for states[53].sid.code, expected 54, is %d", - check_msg->states[53].sid.code); - ck_assert_msg(check_msg->states[53].sid.sat == 186, - "incorrect value for states[53].sid.sat, expected 186, is %d", - check_msg->states[53].sid.sat); - ck_assert_msg(check_msg->states[54].cn0 == 190, - "incorrect value for states[54].cn0, expected 190, is %d", - check_msg->states[54].cn0); - ck_assert_msg(check_msg->states[54].fcn == 148, - "incorrect value for states[54].fcn, expected 148, is %d", - check_msg->states[54].fcn); - ck_assert_msg(check_msg->states[54].sid.code == 84, - "incorrect value for states[54].sid.code, expected 84, is %d", - check_msg->states[54].sid.code); - ck_assert_msg(check_msg->states[54].sid.sat == 82, - "incorrect value for states[54].sid.sat, expected 82, is %d", - check_msg->states[54].sid.sat); - ck_assert_msg(check_msg->states[55].cn0 == 67, - "incorrect value for states[55].cn0, expected 67, is %d", - check_msg->states[55].cn0); - ck_assert_msg(check_msg->states[55].fcn == 62, - "incorrect value for states[55].fcn, expected 62, is %d", - check_msg->states[55].fcn); - ck_assert_msg(check_msg->states[55].sid.code == 54, - "incorrect value for states[55].sid.code, expected 54, is %d", - check_msg->states[55].sid.code); - ck_assert_msg(check_msg->states[55].sid.sat == 236, - "incorrect value for states[55].sid.sat, expected 236, is %d", - check_msg->states[55].sid.sat); - ck_assert_msg(check_msg->states[56].cn0 == 254, - "incorrect value for states[56].cn0, expected 254, is %d", - check_msg->states[56].cn0); - ck_assert_msg(check_msg->states[56].fcn == 57, - "incorrect value for states[56].fcn, expected 57, is %d", - check_msg->states[56].fcn); - ck_assert_msg( - check_msg->states[56].sid.code == 215, - "incorrect value for states[56].sid.code, expected 215, is %d", - check_msg->states[56].sid.code); - ck_assert_msg(check_msg->states[56].sid.sat == 52, - "incorrect value for states[56].sid.sat, expected 52, is %d", - check_msg->states[56].sid.sat); - ck_assert_msg(check_msg->states[57].cn0 == 174, - "incorrect value for states[57].cn0, expected 174, is %d", - check_msg->states[57].cn0); - ck_assert_msg(check_msg->states[57].fcn == 36, - "incorrect value for states[57].fcn, expected 36, is %d", - check_msg->states[57].fcn); - ck_assert_msg( - check_msg->states[57].sid.code == 133, - "incorrect value for states[57].sid.code, expected 133, is %d", - check_msg->states[57].sid.code); - ck_assert_msg(check_msg->states[57].sid.sat == 16, - "incorrect value for states[57].sid.sat, expected 16, is %d", - check_msg->states[57].sid.sat); - ck_assert_msg(check_msg->states[58].cn0 == 17, - "incorrect value for states[58].cn0, expected 17, is %d", - check_msg->states[58].cn0); - ck_assert_msg(check_msg->states[58].fcn == 145, - "incorrect value for states[58].fcn, expected 145, is %d", - check_msg->states[58].fcn); - ck_assert_msg( - check_msg->states[58].sid.code == 172, - "incorrect value for states[58].sid.code, expected 172, is %d", - check_msg->states[58].sid.code); - ck_assert_msg(check_msg->states[58].sid.sat == 219, - "incorrect value for states[58].sid.sat, expected 219, is %d", - check_msg->states[58].sid.sat); - ck_assert_msg(check_msg->states[59].cn0 == 97, - "incorrect value for states[59].cn0, expected 97, is %d", - check_msg->states[59].cn0); - ck_assert_msg(check_msg->states[59].fcn == 111, - "incorrect value for states[59].fcn, expected 111, is %d", - check_msg->states[59].fcn); - ck_assert_msg( - check_msg->states[59].sid.code == 179, - "incorrect value for states[59].sid.code, expected 179, is %d", - check_msg->states[59].sid.code); - ck_assert_msg(check_msg->states[59].sid.sat == 192, - "incorrect value for states[59].sid.sat, expected 192, is %d", - check_msg->states[59].sid.sat); - ck_assert_msg(check_msg->states[60].cn0 == 134, - "incorrect value for states[60].cn0, expected 134, is %d", - check_msg->states[60].cn0); - ck_assert_msg(check_msg->states[60].fcn == 208, - "incorrect value for states[60].fcn, expected 208, is %d", - check_msg->states[60].fcn); - ck_assert_msg(check_msg->states[60].sid.code == 56, - "incorrect value for states[60].sid.code, expected 56, is %d", - check_msg->states[60].sid.code); - ck_assert_msg(check_msg->states[60].sid.sat == 207, - "incorrect value for states[60].sid.sat, expected 207, is %d", - check_msg->states[60].sid.sat); - ck_assert_msg(check_msg->states[61].cn0 == 226, - "incorrect value for states[61].cn0, expected 226, is %d", - check_msg->states[61].cn0); - ck_assert_msg(check_msg->states[61].fcn == 43, - "incorrect value for states[61].fcn, expected 43, is %d", - check_msg->states[61].fcn); - ck_assert_msg(check_msg->states[61].sid.code == 17, - "incorrect value for states[61].sid.code, expected 17, is %d", - check_msg->states[61].sid.code); - ck_assert_msg(check_msg->states[61].sid.sat == 180, - "incorrect value for states[61].sid.sat, expected 180, is %d", - check_msg->states[61].sid.sat); - ck_assert_msg(check_msg->states[62].cn0 == 113, - "incorrect value for states[62].cn0, expected 113, is %d", - check_msg->states[62].cn0); - ck_assert_msg(check_msg->states[62].fcn == 140, - "incorrect value for states[62].fcn, expected 140, is %d", - check_msg->states[62].fcn); - ck_assert_msg( - check_msg->states[62].sid.code == 182, - "incorrect value for states[62].sid.code, expected 182, is %d", - check_msg->states[62].sid.code); - ck_assert_msg(check_msg->states[62].sid.sat == 255, - "incorrect value for states[62].sid.sat, expected 255, is %d", - check_msg->states[62].sid.sat); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x13, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x13, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 19, 0, 246, 215, 99, 1, 202, 0, 0, 0, 197, 253, 28, - 66, 1, 203, 0, 0, 0, 231, 99, 16, 66, 1, 208, 0, 0, - 0, 212, 129, 22, 66, 1, 212, 0, 0, 0, 58, 21, 28, 66, - 1, 217, 0, 0, 0, 178, 33, 40, 66, 1, 218, 0, 0, 0, - 235, 189, 21, 66, 1, 220, 0, 0, 0, 29, 177, 25, 66, 1, - 222, 0, 0, 0, 43, 169, 27, 66, 1, 225, 0, 0, 0, 137, - 125, 42, 66, 0, 0, 0, 0, 0, 0, 0, 128, 191, 0, 0, - 0, 0, 0, 0, 0, 128, 191, 222, 97, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_dep_b_t* test_msg = - (msg_tracking_state_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[0].cn0 = 39.24782180786133; - test_msg->states[0].sid.code = 0; - test_msg->states[0].sid.reserved = 0; - test_msg->states[0].sid.sat = 202; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[1].cn0 = 36.09756088256836; - test_msg->states[1].sid.code = 0; - test_msg->states[1].sid.reserved = 0; - test_msg->states[1].sid.sat = 203; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[2].cn0 = 37.62678527832031; - test_msg->states[2].sid.code = 0; - test_msg->states[2].sid.reserved = 0; - test_msg->states[2].sid.sat = 208; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[3].cn0 = 39.020729064941406; - test_msg->states[3].sid.code = 0; - test_msg->states[3].sid.reserved = 0; - test_msg->states[3].sid.sat = 212; - test_msg->states[3].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[4].cn0 = 42.03290557861328; - test_msg->states[4].sid.code = 0; - test_msg->states[4].sid.reserved = 0; - test_msg->states[4].sid.sat = 217; - test_msg->states[4].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[5].cn0 = 37.43546676635742; - test_msg->states[5].sid.code = 0; - test_msg->states[5].sid.reserved = 0; - test_msg->states[5].sid.sat = 218; - test_msg->states[5].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[6].cn0 = 38.4229621887207; - test_msg->states[6].sid.code = 0; - test_msg->states[6].sid.reserved = 0; - test_msg->states[6].sid.sat = 220; - test_msg->states[6].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[7].cn0 = 38.91520309448242; - test_msg->states[7].sid.code = 0; - test_msg->states[7].sid.reserved = 0; - test_msg->states[7].sid.sat = 222; - test_msg->states[7].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[8].cn0 = 42.62259292602539; - test_msg->states[8].sid.code = 0; - test_msg->states[8].sid.reserved = 0; - test_msg->states[8].sid.sat = 225; - test_msg->states[8].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[9].cn0 = -1.0; - test_msg->states[9].sid.code = 0; - test_msg->states[9].sid.reserved = 0; - test_msg->states[9].sid.sat = 0; - test_msg->states[9].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[10].cn0 = -1.0; - test_msg->states[10].sid.code = 0; - test_msg->states[10].sid.reserved = 0; - test_msg->states[10].sid.sat = 0; - test_msg->states[10].state = 0; - sbp_payload_send(&sbp_state, 0x13, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x13, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_dep_b_t* check_msg = - (msg_tracking_state_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->states[0].cn0 * 100 - 39.2478218079 * 100) < 0.05, - "incorrect value for states[0].cn0, expected 39.2478218079, is %f", - check_msg->states[0].cn0); - ck_assert_msg(check_msg->states[0].sid.code == 0, - "incorrect value for states[0].sid.code, expected 0, is %d", - check_msg->states[0].sid.code); - ck_assert_msg( - check_msg->states[0].sid.reserved == 0, - "incorrect value for states[0].sid.reserved, expected 0, is %d", - check_msg->states[0].sid.reserved); - ck_assert_msg(check_msg->states[0].sid.sat == 202, - "incorrect value for states[0].sid.sat, expected 202, is %d", - check_msg->states[0].sid.sat); - ck_assert_msg(check_msg->states[0].state == 1, - "incorrect value for states[0].state, expected 1, is %d", - check_msg->states[0].state); - ck_assert_msg( - (check_msg->states[1].cn0 * 100 - 36.0975608826 * 100) < 0.05, - "incorrect value for states[1].cn0, expected 36.0975608826, is %f", - check_msg->states[1].cn0); - ck_assert_msg(check_msg->states[1].sid.code == 0, - "incorrect value for states[1].sid.code, expected 0, is %d", - check_msg->states[1].sid.code); - ck_assert_msg( - check_msg->states[1].sid.reserved == 0, - "incorrect value for states[1].sid.reserved, expected 0, is %d", - check_msg->states[1].sid.reserved); - ck_assert_msg(check_msg->states[1].sid.sat == 203, - "incorrect value for states[1].sid.sat, expected 203, is %d", - check_msg->states[1].sid.sat); - ck_assert_msg(check_msg->states[1].state == 1, - "incorrect value for states[1].state, expected 1, is %d", - check_msg->states[1].state); - ck_assert_msg( - (check_msg->states[2].cn0 * 100 - 37.6267852783 * 100) < 0.05, - "incorrect value for states[2].cn0, expected 37.6267852783, is %f", - check_msg->states[2].cn0); - ck_assert_msg(check_msg->states[2].sid.code == 0, - "incorrect value for states[2].sid.code, expected 0, is %d", - check_msg->states[2].sid.code); - ck_assert_msg( - check_msg->states[2].sid.reserved == 0, - "incorrect value for states[2].sid.reserved, expected 0, is %d", - check_msg->states[2].sid.reserved); - ck_assert_msg(check_msg->states[2].sid.sat == 208, - "incorrect value for states[2].sid.sat, expected 208, is %d", - check_msg->states[2].sid.sat); - ck_assert_msg(check_msg->states[2].state == 1, - "incorrect value for states[2].state, expected 1, is %d", - check_msg->states[2].state); - ck_assert_msg( - (check_msg->states[3].cn0 * 100 - 39.0207290649 * 100) < 0.05, - "incorrect value for states[3].cn0, expected 39.0207290649, is %f", - check_msg->states[3].cn0); - ck_assert_msg(check_msg->states[3].sid.code == 0, - "incorrect value for states[3].sid.code, expected 0, is %d", - check_msg->states[3].sid.code); - ck_assert_msg( - check_msg->states[3].sid.reserved == 0, - "incorrect value for states[3].sid.reserved, expected 0, is %d", - check_msg->states[3].sid.reserved); - ck_assert_msg(check_msg->states[3].sid.sat == 212, - "incorrect value for states[3].sid.sat, expected 212, is %d", - check_msg->states[3].sid.sat); - ck_assert_msg(check_msg->states[3].state == 1, - "incorrect value for states[3].state, expected 1, is %d", - check_msg->states[3].state); - ck_assert_msg( - (check_msg->states[4].cn0 * 100 - 42.0329055786 * 100) < 0.05, - "incorrect value for states[4].cn0, expected 42.0329055786, is %f", - check_msg->states[4].cn0); - ck_assert_msg(check_msg->states[4].sid.code == 0, - "incorrect value for states[4].sid.code, expected 0, is %d", - check_msg->states[4].sid.code); - ck_assert_msg( - check_msg->states[4].sid.reserved == 0, - "incorrect value for states[4].sid.reserved, expected 0, is %d", - check_msg->states[4].sid.reserved); - ck_assert_msg(check_msg->states[4].sid.sat == 217, - "incorrect value for states[4].sid.sat, expected 217, is %d", - check_msg->states[4].sid.sat); - ck_assert_msg(check_msg->states[4].state == 1, - "incorrect value for states[4].state, expected 1, is %d", - check_msg->states[4].state); - ck_assert_msg( - (check_msg->states[5].cn0 * 100 - 37.4354667664 * 100) < 0.05, - "incorrect value for states[5].cn0, expected 37.4354667664, is %f", - check_msg->states[5].cn0); - ck_assert_msg(check_msg->states[5].sid.code == 0, - "incorrect value for states[5].sid.code, expected 0, is %d", - check_msg->states[5].sid.code); - ck_assert_msg( - check_msg->states[5].sid.reserved == 0, - "incorrect value for states[5].sid.reserved, expected 0, is %d", - check_msg->states[5].sid.reserved); - ck_assert_msg(check_msg->states[5].sid.sat == 218, - "incorrect value for states[5].sid.sat, expected 218, is %d", - check_msg->states[5].sid.sat); - ck_assert_msg(check_msg->states[5].state == 1, - "incorrect value for states[5].state, expected 1, is %d", - check_msg->states[5].state); - ck_assert_msg( - (check_msg->states[6].cn0 * 100 - 38.4229621887 * 100) < 0.05, - "incorrect value for states[6].cn0, expected 38.4229621887, is %f", - check_msg->states[6].cn0); - ck_assert_msg(check_msg->states[6].sid.code == 0, - "incorrect value for states[6].sid.code, expected 0, is %d", - check_msg->states[6].sid.code); - ck_assert_msg( - check_msg->states[6].sid.reserved == 0, - "incorrect value for states[6].sid.reserved, expected 0, is %d", - check_msg->states[6].sid.reserved); - ck_assert_msg(check_msg->states[6].sid.sat == 220, - "incorrect value for states[6].sid.sat, expected 220, is %d", - check_msg->states[6].sid.sat); - ck_assert_msg(check_msg->states[6].state == 1, - "incorrect value for states[6].state, expected 1, is %d", - check_msg->states[6].state); - ck_assert_msg( - (check_msg->states[7].cn0 * 100 - 38.9152030945 * 100) < 0.05, - "incorrect value for states[7].cn0, expected 38.9152030945, is %f", - check_msg->states[7].cn0); - ck_assert_msg(check_msg->states[7].sid.code == 0, - "incorrect value for states[7].sid.code, expected 0, is %d", - check_msg->states[7].sid.code); - ck_assert_msg( - check_msg->states[7].sid.reserved == 0, - "incorrect value for states[7].sid.reserved, expected 0, is %d", - check_msg->states[7].sid.reserved); - ck_assert_msg(check_msg->states[7].sid.sat == 222, - "incorrect value for states[7].sid.sat, expected 222, is %d", - check_msg->states[7].sid.sat); - ck_assert_msg(check_msg->states[7].state == 1, - "incorrect value for states[7].state, expected 1, is %d", - check_msg->states[7].state); - ck_assert_msg( - (check_msg->states[8].cn0 * 100 - 42.622592926 * 100) < 0.05, - "incorrect value for states[8].cn0, expected 42.622592926, is %f", - check_msg->states[8].cn0); - ck_assert_msg(check_msg->states[8].sid.code == 0, - "incorrect value for states[8].sid.code, expected 0, is %d", - check_msg->states[8].sid.code); - ck_assert_msg( - check_msg->states[8].sid.reserved == 0, - "incorrect value for states[8].sid.reserved, expected 0, is %d", - check_msg->states[8].sid.reserved); - ck_assert_msg(check_msg->states[8].sid.sat == 225, - "incorrect value for states[8].sid.sat, expected 225, is %d", - check_msg->states[8].sid.sat); - ck_assert_msg(check_msg->states[8].state == 1, - "incorrect value for states[8].state, expected 1, is %d", - check_msg->states[8].state); - ck_assert_msg((check_msg->states[9].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[9].cn0, expected -1.0, is %f", - check_msg->states[9].cn0); - ck_assert_msg(check_msg->states[9].sid.code == 0, - "incorrect value for states[9].sid.code, expected 0, is %d", - check_msg->states[9].sid.code); - ck_assert_msg( - check_msg->states[9].sid.reserved == 0, - "incorrect value for states[9].sid.reserved, expected 0, is %d", - check_msg->states[9].sid.reserved); - ck_assert_msg(check_msg->states[9].sid.sat == 0, - "incorrect value for states[9].sid.sat, expected 0, is %d", - check_msg->states[9].sid.sat); - ck_assert_msg(check_msg->states[9].state == 0, - "incorrect value for states[9].state, expected 0, is %d", - check_msg->states[9].state); - ck_assert_msg((check_msg->states[10].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[10].cn0, expected -1.0, is %f", - check_msg->states[10].cn0); - ck_assert_msg(check_msg->states[10].sid.code == 0, - "incorrect value for states[10].sid.code, expected 0, is %d", - check_msg->states[10].sid.code); - ck_assert_msg( - check_msg->states[10].sid.reserved == 0, - "incorrect value for states[10].sid.reserved, expected 0, is %d", - check_msg->states[10].sid.reserved); - ck_assert_msg(check_msg->states[10].sid.sat == 0, - "incorrect value for states[10].sid.sat, expected 0, is %d", - check_msg->states[10].sid.sat); - ck_assert_msg(check_msg->states[10].state == 0, - "incorrect value for states[10].state, expected 0, is %d", - check_msg->states[10].state); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x13, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x13, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 19, 0, 246, 215, 99, 1, 202, 0, 0, 0, 250, 249, 27, - 66, 1, 203, 0, 0, 0, 40, 143, 11, 66, 1, 208, 0, 0, - 0, 190, 200, 21, 66, 1, 212, 0, 0, 0, 251, 233, 26, 66, - 1, 217, 0, 0, 0, 209, 238, 39, 66, 1, 218, 0, 0, 0, - 162, 219, 21, 66, 1, 220, 0, 0, 0, 162, 197, 25, 66, 1, - 222, 0, 0, 0, 14, 35, 28, 66, 1, 225, 0, 0, 0, 9, - 153, 43, 66, 0, 0, 0, 0, 0, 0, 0, 128, 191, 0, 0, - 0, 0, 0, 0, 0, 128, 191, 20, 31, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_dep_b_t* test_msg = - (msg_tracking_state_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[0].cn0 = 38.994117736816406; - test_msg->states[0].sid.code = 0; - test_msg->states[0].sid.reserved = 0; - test_msg->states[0].sid.sat = 202; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[1].cn0 = 34.889801025390625; - test_msg->states[1].sid.code = 0; - test_msg->states[1].sid.reserved = 0; - test_msg->states[1].sid.sat = 203; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[2].cn0 = 37.44603729248047; - test_msg->states[2].sid.code = 0; - test_msg->states[2].sid.reserved = 0; - test_msg->states[2].sid.sat = 208; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[3].cn0 = 38.72849655151367; - test_msg->states[3].sid.code = 0; - test_msg->states[3].sid.reserved = 0; - test_msg->states[3].sid.sat = 212; - test_msg->states[3].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[4].cn0 = 41.983219146728516; - test_msg->states[4].sid.code = 0; - test_msg->states[4].sid.reserved = 0; - test_msg->states[4].sid.sat = 217; - test_msg->states[4].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[5].cn0 = 37.46448516845703; - test_msg->states[5].sid.code = 0; - test_msg->states[5].sid.reserved = 0; - test_msg->states[5].sid.sat = 218; - test_msg->states[5].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[6].cn0 = 38.44300079345703; - test_msg->states[6].sid.code = 0; - test_msg->states[6].sid.reserved = 0; - test_msg->states[6].sid.sat = 220; - test_msg->states[6].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[7].cn0 = 39.03423309326172; - test_msg->states[7].sid.code = 0; - test_msg->states[7].sid.reserved = 0; - test_msg->states[7].sid.sat = 222; - test_msg->states[7].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[8].cn0 = 42.89944839477539; - test_msg->states[8].sid.code = 0; - test_msg->states[8].sid.reserved = 0; - test_msg->states[8].sid.sat = 225; - test_msg->states[8].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[9].cn0 = -1.0; - test_msg->states[9].sid.code = 0; - test_msg->states[9].sid.reserved = 0; - test_msg->states[9].sid.sat = 0; - test_msg->states[9].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[10].cn0 = -1.0; - test_msg->states[10].sid.code = 0; - test_msg->states[10].sid.reserved = 0; - test_msg->states[10].sid.sat = 0; - test_msg->states[10].state = 0; - sbp_payload_send(&sbp_state, 0x13, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x13, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_dep_b_t* check_msg = - (msg_tracking_state_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->states[0].cn0 * 100 - 38.9941177368 * 100) < 0.05, - "incorrect value for states[0].cn0, expected 38.9941177368, is %f", - check_msg->states[0].cn0); - ck_assert_msg(check_msg->states[0].sid.code == 0, - "incorrect value for states[0].sid.code, expected 0, is %d", - check_msg->states[0].sid.code); - ck_assert_msg( - check_msg->states[0].sid.reserved == 0, - "incorrect value for states[0].sid.reserved, expected 0, is %d", - check_msg->states[0].sid.reserved); - ck_assert_msg(check_msg->states[0].sid.sat == 202, - "incorrect value for states[0].sid.sat, expected 202, is %d", - check_msg->states[0].sid.sat); - ck_assert_msg(check_msg->states[0].state == 1, - "incorrect value for states[0].state, expected 1, is %d", - check_msg->states[0].state); - ck_assert_msg( - (check_msg->states[1].cn0 * 100 - 34.8898010254 * 100) < 0.05, - "incorrect value for states[1].cn0, expected 34.8898010254, is %f", - check_msg->states[1].cn0); - ck_assert_msg(check_msg->states[1].sid.code == 0, - "incorrect value for states[1].sid.code, expected 0, is %d", - check_msg->states[1].sid.code); - ck_assert_msg( - check_msg->states[1].sid.reserved == 0, - "incorrect value for states[1].sid.reserved, expected 0, is %d", - check_msg->states[1].sid.reserved); - ck_assert_msg(check_msg->states[1].sid.sat == 203, - "incorrect value for states[1].sid.sat, expected 203, is %d", - check_msg->states[1].sid.sat); - ck_assert_msg(check_msg->states[1].state == 1, - "incorrect value for states[1].state, expected 1, is %d", - check_msg->states[1].state); - ck_assert_msg( - (check_msg->states[2].cn0 * 100 - 37.4460372925 * 100) < 0.05, - "incorrect value for states[2].cn0, expected 37.4460372925, is %f", - check_msg->states[2].cn0); - ck_assert_msg(check_msg->states[2].sid.code == 0, - "incorrect value for states[2].sid.code, expected 0, is %d", - check_msg->states[2].sid.code); - ck_assert_msg( - check_msg->states[2].sid.reserved == 0, - "incorrect value for states[2].sid.reserved, expected 0, is %d", - check_msg->states[2].sid.reserved); - ck_assert_msg(check_msg->states[2].sid.sat == 208, - "incorrect value for states[2].sid.sat, expected 208, is %d", - check_msg->states[2].sid.sat); - ck_assert_msg(check_msg->states[2].state == 1, - "incorrect value for states[2].state, expected 1, is %d", - check_msg->states[2].state); - ck_assert_msg( - (check_msg->states[3].cn0 * 100 - 38.7284965515 * 100) < 0.05, - "incorrect value for states[3].cn0, expected 38.7284965515, is %f", - check_msg->states[3].cn0); - ck_assert_msg(check_msg->states[3].sid.code == 0, - "incorrect value for states[3].sid.code, expected 0, is %d", - check_msg->states[3].sid.code); - ck_assert_msg( - check_msg->states[3].sid.reserved == 0, - "incorrect value for states[3].sid.reserved, expected 0, is %d", - check_msg->states[3].sid.reserved); - ck_assert_msg(check_msg->states[3].sid.sat == 212, - "incorrect value for states[3].sid.sat, expected 212, is %d", - check_msg->states[3].sid.sat); - ck_assert_msg(check_msg->states[3].state == 1, - "incorrect value for states[3].state, expected 1, is %d", - check_msg->states[3].state); - ck_assert_msg( - (check_msg->states[4].cn0 * 100 - 41.9832191467 * 100) < 0.05, - "incorrect value for states[4].cn0, expected 41.9832191467, is %f", - check_msg->states[4].cn0); - ck_assert_msg(check_msg->states[4].sid.code == 0, - "incorrect value for states[4].sid.code, expected 0, is %d", - check_msg->states[4].sid.code); - ck_assert_msg( - check_msg->states[4].sid.reserved == 0, - "incorrect value for states[4].sid.reserved, expected 0, is %d", - check_msg->states[4].sid.reserved); - ck_assert_msg(check_msg->states[4].sid.sat == 217, - "incorrect value for states[4].sid.sat, expected 217, is %d", - check_msg->states[4].sid.sat); - ck_assert_msg(check_msg->states[4].state == 1, - "incorrect value for states[4].state, expected 1, is %d", - check_msg->states[4].state); - ck_assert_msg( - (check_msg->states[5].cn0 * 100 - 37.4644851685 * 100) < 0.05, - "incorrect value for states[5].cn0, expected 37.4644851685, is %f", - check_msg->states[5].cn0); - ck_assert_msg(check_msg->states[5].sid.code == 0, - "incorrect value for states[5].sid.code, expected 0, is %d", - check_msg->states[5].sid.code); - ck_assert_msg( - check_msg->states[5].sid.reserved == 0, - "incorrect value for states[5].sid.reserved, expected 0, is %d", - check_msg->states[5].sid.reserved); - ck_assert_msg(check_msg->states[5].sid.sat == 218, - "incorrect value for states[5].sid.sat, expected 218, is %d", - check_msg->states[5].sid.sat); - ck_assert_msg(check_msg->states[5].state == 1, - "incorrect value for states[5].state, expected 1, is %d", - check_msg->states[5].state); - ck_assert_msg( - (check_msg->states[6].cn0 * 100 - 38.4430007935 * 100) < 0.05, - "incorrect value for states[6].cn0, expected 38.4430007935, is %f", - check_msg->states[6].cn0); - ck_assert_msg(check_msg->states[6].sid.code == 0, - "incorrect value for states[6].sid.code, expected 0, is %d", - check_msg->states[6].sid.code); - ck_assert_msg( - check_msg->states[6].sid.reserved == 0, - "incorrect value for states[6].sid.reserved, expected 0, is %d", - check_msg->states[6].sid.reserved); - ck_assert_msg(check_msg->states[6].sid.sat == 220, - "incorrect value for states[6].sid.sat, expected 220, is %d", - check_msg->states[6].sid.sat); - ck_assert_msg(check_msg->states[6].state == 1, - "incorrect value for states[6].state, expected 1, is %d", - check_msg->states[6].state); - ck_assert_msg( - (check_msg->states[7].cn0 * 100 - 39.0342330933 * 100) < 0.05, - "incorrect value for states[7].cn0, expected 39.0342330933, is %f", - check_msg->states[7].cn0); - ck_assert_msg(check_msg->states[7].sid.code == 0, - "incorrect value for states[7].sid.code, expected 0, is %d", - check_msg->states[7].sid.code); - ck_assert_msg( - check_msg->states[7].sid.reserved == 0, - "incorrect value for states[7].sid.reserved, expected 0, is %d", - check_msg->states[7].sid.reserved); - ck_assert_msg(check_msg->states[7].sid.sat == 222, - "incorrect value for states[7].sid.sat, expected 222, is %d", - check_msg->states[7].sid.sat); - ck_assert_msg(check_msg->states[7].state == 1, - "incorrect value for states[7].state, expected 1, is %d", - check_msg->states[7].state); - ck_assert_msg( - (check_msg->states[8].cn0 * 100 - 42.8994483948 * 100) < 0.05, - "incorrect value for states[8].cn0, expected 42.8994483948, is %f", - check_msg->states[8].cn0); - ck_assert_msg(check_msg->states[8].sid.code == 0, - "incorrect value for states[8].sid.code, expected 0, is %d", - check_msg->states[8].sid.code); - ck_assert_msg( - check_msg->states[8].sid.reserved == 0, - "incorrect value for states[8].sid.reserved, expected 0, is %d", - check_msg->states[8].sid.reserved); - ck_assert_msg(check_msg->states[8].sid.sat == 225, - "incorrect value for states[8].sid.sat, expected 225, is %d", - check_msg->states[8].sid.sat); - ck_assert_msg(check_msg->states[8].state == 1, - "incorrect value for states[8].state, expected 1, is %d", - check_msg->states[8].state); - ck_assert_msg((check_msg->states[9].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[9].cn0, expected -1.0, is %f", - check_msg->states[9].cn0); - ck_assert_msg(check_msg->states[9].sid.code == 0, - "incorrect value for states[9].sid.code, expected 0, is %d", - check_msg->states[9].sid.code); - ck_assert_msg( - check_msg->states[9].sid.reserved == 0, - "incorrect value for states[9].sid.reserved, expected 0, is %d", - check_msg->states[9].sid.reserved); - ck_assert_msg(check_msg->states[9].sid.sat == 0, - "incorrect value for states[9].sid.sat, expected 0, is %d", - check_msg->states[9].sid.sat); - ck_assert_msg(check_msg->states[9].state == 0, - "incorrect value for states[9].state, expected 0, is %d", - check_msg->states[9].state); - ck_assert_msg((check_msg->states[10].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[10].cn0, expected -1.0, is %f", - check_msg->states[10].cn0); - ck_assert_msg(check_msg->states[10].sid.code == 0, - "incorrect value for states[10].sid.code, expected 0, is %d", - check_msg->states[10].sid.code); - ck_assert_msg( - check_msg->states[10].sid.reserved == 0, - "incorrect value for states[10].sid.reserved, expected 0, is %d", - check_msg->states[10].sid.reserved); - ck_assert_msg(check_msg->states[10].sid.sat == 0, - "incorrect value for states[10].sid.sat, expected 0, is %d", - check_msg->states[10].sid.sat); - ck_assert_msg(check_msg->states[10].state == 0, - "incorrect value for states[10].state, expected 0, is %d", - check_msg->states[10].state); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x13, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x13, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 19, 0, 246, 215, 99, 1, 202, 0, 0, 0, 123, 209, 27, - 66, 1, 203, 0, 0, 0, 214, 64, 15, 66, 1, 208, 0, 0, - 0, 56, 55, 22, 66, 1, 212, 0, 0, 0, 91, 142, 27, 66, - 1, 217, 0, 0, 0, 253, 154, 41, 66, 1, 218, 0, 0, 0, - 128, 142, 22, 66, 1, 220, 0, 0, 0, 17, 174, 23, 66, 1, - 222, 0, 0, 0, 155, 2, 29, 66, 1, 225, 0, 0, 0, 162, - 100, 42, 66, 0, 0, 0, 0, 0, 0, 0, 128, 191, 0, 0, - 0, 0, 0, 0, 0, 128, 191, 233, 71, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_dep_b_t* test_msg = - (msg_tracking_state_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[0].cn0 = 38.95457077026367; - test_msg->states[0].sid.code = 0; - test_msg->states[0].sid.reserved = 0; - test_msg->states[0].sid.sat = 202; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[1].cn0 = 35.813316345214844; - test_msg->states[1].sid.code = 0; - test_msg->states[1].sid.reserved = 0; - test_msg->states[1].sid.sat = 203; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[2].cn0 = 37.553924560546875; - test_msg->states[2].sid.code = 0; - test_msg->states[2].sid.reserved = 0; - test_msg->states[2].sid.sat = 208; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[3].cn0 = 38.88901901245117; - test_msg->states[3].sid.code = 0; - test_msg->states[3].sid.reserved = 0; - test_msg->states[3].sid.sat = 212; - test_msg->states[3].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[4].cn0 = 42.4013557434082; - test_msg->states[4].sid.code = 0; - test_msg->states[4].sid.reserved = 0; - test_msg->states[4].sid.sat = 217; - test_msg->states[4].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[5].cn0 = 37.63916015625; - test_msg->states[5].sid.code = 0; - test_msg->states[5].sid.reserved = 0; - test_msg->states[5].sid.sat = 218; - test_msg->states[5].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[6].cn0 = 37.919986724853516; - test_msg->states[6].sid.code = 0; - test_msg->states[6].sid.reserved = 0; - test_msg->states[6].sid.sat = 220; - test_msg->states[6].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[7].cn0 = 39.25254440307617; - test_msg->states[7].sid.code = 0; - test_msg->states[7].sid.reserved = 0; - test_msg->states[7].sid.sat = 222; - test_msg->states[7].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[8].cn0 = 42.59827423095703; - test_msg->states[8].sid.code = 0; - test_msg->states[8].sid.reserved = 0; - test_msg->states[8].sid.sat = 225; - test_msg->states[8].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[9].cn0 = -1.0; - test_msg->states[9].sid.code = 0; - test_msg->states[9].sid.reserved = 0; - test_msg->states[9].sid.sat = 0; - test_msg->states[9].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[10].cn0 = -1.0; - test_msg->states[10].sid.code = 0; - test_msg->states[10].sid.reserved = 0; - test_msg->states[10].sid.sat = 0; - test_msg->states[10].state = 0; - sbp_payload_send(&sbp_state, 0x13, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x13, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_dep_b_t* check_msg = - (msg_tracking_state_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->states[0].cn0 * 100 - 38.9545707703 * 100) < 0.05, - "incorrect value for states[0].cn0, expected 38.9545707703, is %f", - check_msg->states[0].cn0); - ck_assert_msg(check_msg->states[0].sid.code == 0, - "incorrect value for states[0].sid.code, expected 0, is %d", - check_msg->states[0].sid.code); - ck_assert_msg( - check_msg->states[0].sid.reserved == 0, - "incorrect value for states[0].sid.reserved, expected 0, is %d", - check_msg->states[0].sid.reserved); - ck_assert_msg(check_msg->states[0].sid.sat == 202, - "incorrect value for states[0].sid.sat, expected 202, is %d", - check_msg->states[0].sid.sat); - ck_assert_msg(check_msg->states[0].state == 1, - "incorrect value for states[0].state, expected 1, is %d", - check_msg->states[0].state); - ck_assert_msg( - (check_msg->states[1].cn0 * 100 - 35.8133163452 * 100) < 0.05, - "incorrect value for states[1].cn0, expected 35.8133163452, is %f", - check_msg->states[1].cn0); - ck_assert_msg(check_msg->states[1].sid.code == 0, - "incorrect value for states[1].sid.code, expected 0, is %d", - check_msg->states[1].sid.code); - ck_assert_msg( - check_msg->states[1].sid.reserved == 0, - "incorrect value for states[1].sid.reserved, expected 0, is %d", - check_msg->states[1].sid.reserved); - ck_assert_msg(check_msg->states[1].sid.sat == 203, - "incorrect value for states[1].sid.sat, expected 203, is %d", - check_msg->states[1].sid.sat); - ck_assert_msg(check_msg->states[1].state == 1, - "incorrect value for states[1].state, expected 1, is %d", - check_msg->states[1].state); - ck_assert_msg( - (check_msg->states[2].cn0 * 100 - 37.5539245605 * 100) < 0.05, - "incorrect value for states[2].cn0, expected 37.5539245605, is %f", - check_msg->states[2].cn0); - ck_assert_msg(check_msg->states[2].sid.code == 0, - "incorrect value for states[2].sid.code, expected 0, is %d", - check_msg->states[2].sid.code); - ck_assert_msg( - check_msg->states[2].sid.reserved == 0, - "incorrect value for states[2].sid.reserved, expected 0, is %d", - check_msg->states[2].sid.reserved); - ck_assert_msg(check_msg->states[2].sid.sat == 208, - "incorrect value for states[2].sid.sat, expected 208, is %d", - check_msg->states[2].sid.sat); - ck_assert_msg(check_msg->states[2].state == 1, - "incorrect value for states[2].state, expected 1, is %d", - check_msg->states[2].state); - ck_assert_msg( - (check_msg->states[3].cn0 * 100 - 38.8890190125 * 100) < 0.05, - "incorrect value for states[3].cn0, expected 38.8890190125, is %f", - check_msg->states[3].cn0); - ck_assert_msg(check_msg->states[3].sid.code == 0, - "incorrect value for states[3].sid.code, expected 0, is %d", - check_msg->states[3].sid.code); - ck_assert_msg( - check_msg->states[3].sid.reserved == 0, - "incorrect value for states[3].sid.reserved, expected 0, is %d", - check_msg->states[3].sid.reserved); - ck_assert_msg(check_msg->states[3].sid.sat == 212, - "incorrect value for states[3].sid.sat, expected 212, is %d", - check_msg->states[3].sid.sat); - ck_assert_msg(check_msg->states[3].state == 1, - "incorrect value for states[3].state, expected 1, is %d", - check_msg->states[3].state); - ck_assert_msg( - (check_msg->states[4].cn0 * 100 - 42.4013557434 * 100) < 0.05, - "incorrect value for states[4].cn0, expected 42.4013557434, is %f", - check_msg->states[4].cn0); - ck_assert_msg(check_msg->states[4].sid.code == 0, - "incorrect value for states[4].sid.code, expected 0, is %d", - check_msg->states[4].sid.code); - ck_assert_msg( - check_msg->states[4].sid.reserved == 0, - "incorrect value for states[4].sid.reserved, expected 0, is %d", - check_msg->states[4].sid.reserved); - ck_assert_msg(check_msg->states[4].sid.sat == 217, - "incorrect value for states[4].sid.sat, expected 217, is %d", - check_msg->states[4].sid.sat); - ck_assert_msg(check_msg->states[4].state == 1, - "incorrect value for states[4].state, expected 1, is %d", - check_msg->states[4].state); - ck_assert_msg( - (check_msg->states[5].cn0 * 100 - 37.6391601562 * 100) < 0.05, - "incorrect value for states[5].cn0, expected 37.6391601562, is %f", - check_msg->states[5].cn0); - ck_assert_msg(check_msg->states[5].sid.code == 0, - "incorrect value for states[5].sid.code, expected 0, is %d", - check_msg->states[5].sid.code); - ck_assert_msg( - check_msg->states[5].sid.reserved == 0, - "incorrect value for states[5].sid.reserved, expected 0, is %d", - check_msg->states[5].sid.reserved); - ck_assert_msg(check_msg->states[5].sid.sat == 218, - "incorrect value for states[5].sid.sat, expected 218, is %d", - check_msg->states[5].sid.sat); - ck_assert_msg(check_msg->states[5].state == 1, - "incorrect value for states[5].state, expected 1, is %d", - check_msg->states[5].state); - ck_assert_msg( - (check_msg->states[6].cn0 * 100 - 37.9199867249 * 100) < 0.05, - "incorrect value for states[6].cn0, expected 37.9199867249, is %f", - check_msg->states[6].cn0); - ck_assert_msg(check_msg->states[6].sid.code == 0, - "incorrect value for states[6].sid.code, expected 0, is %d", - check_msg->states[6].sid.code); - ck_assert_msg( - check_msg->states[6].sid.reserved == 0, - "incorrect value for states[6].sid.reserved, expected 0, is %d", - check_msg->states[6].sid.reserved); - ck_assert_msg(check_msg->states[6].sid.sat == 220, - "incorrect value for states[6].sid.sat, expected 220, is %d", - check_msg->states[6].sid.sat); - ck_assert_msg(check_msg->states[6].state == 1, - "incorrect value for states[6].state, expected 1, is %d", - check_msg->states[6].state); - ck_assert_msg( - (check_msg->states[7].cn0 * 100 - 39.2525444031 * 100) < 0.05, - "incorrect value for states[7].cn0, expected 39.2525444031, is %f", - check_msg->states[7].cn0); - ck_assert_msg(check_msg->states[7].sid.code == 0, - "incorrect value for states[7].sid.code, expected 0, is %d", - check_msg->states[7].sid.code); - ck_assert_msg( - check_msg->states[7].sid.reserved == 0, - "incorrect value for states[7].sid.reserved, expected 0, is %d", - check_msg->states[7].sid.reserved); - ck_assert_msg(check_msg->states[7].sid.sat == 222, - "incorrect value for states[7].sid.sat, expected 222, is %d", - check_msg->states[7].sid.sat); - ck_assert_msg(check_msg->states[7].state == 1, - "incorrect value for states[7].state, expected 1, is %d", - check_msg->states[7].state); - ck_assert_msg( - (check_msg->states[8].cn0 * 100 - 42.598274231 * 100) < 0.05, - "incorrect value for states[8].cn0, expected 42.598274231, is %f", - check_msg->states[8].cn0); - ck_assert_msg(check_msg->states[8].sid.code == 0, - "incorrect value for states[8].sid.code, expected 0, is %d", - check_msg->states[8].sid.code); - ck_assert_msg( - check_msg->states[8].sid.reserved == 0, - "incorrect value for states[8].sid.reserved, expected 0, is %d", - check_msg->states[8].sid.reserved); - ck_assert_msg(check_msg->states[8].sid.sat == 225, - "incorrect value for states[8].sid.sat, expected 225, is %d", - check_msg->states[8].sid.sat); - ck_assert_msg(check_msg->states[8].state == 1, - "incorrect value for states[8].state, expected 1, is %d", - check_msg->states[8].state); - ck_assert_msg((check_msg->states[9].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[9].cn0, expected -1.0, is %f", - check_msg->states[9].cn0); - ck_assert_msg(check_msg->states[9].sid.code == 0, - "incorrect value for states[9].sid.code, expected 0, is %d", - check_msg->states[9].sid.code); - ck_assert_msg( - check_msg->states[9].sid.reserved == 0, - "incorrect value for states[9].sid.reserved, expected 0, is %d", - check_msg->states[9].sid.reserved); - ck_assert_msg(check_msg->states[9].sid.sat == 0, - "incorrect value for states[9].sid.sat, expected 0, is %d", - check_msg->states[9].sid.sat); - ck_assert_msg(check_msg->states[9].state == 0, - "incorrect value for states[9].state, expected 0, is %d", - check_msg->states[9].state); - ck_assert_msg((check_msg->states[10].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[10].cn0, expected -1.0, is %f", - check_msg->states[10].cn0); - ck_assert_msg(check_msg->states[10].sid.code == 0, - "incorrect value for states[10].sid.code, expected 0, is %d", - check_msg->states[10].sid.code); - ck_assert_msg( - check_msg->states[10].sid.reserved == 0, - "incorrect value for states[10].sid.reserved, expected 0, is %d", - check_msg->states[10].sid.reserved); - ck_assert_msg(check_msg->states[10].sid.sat == 0, - "incorrect value for states[10].sid.sat, expected 0, is %d", - check_msg->states[10].sid.sat); - ck_assert_msg(check_msg->states[10].state == 0, - "incorrect value for states[10].state, expected 0, is %d", - check_msg->states[10].state); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x13, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x13, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 19, 0, 246, 215, 99, 1, 202, 0, 0, 0, 120, 122, 29, - 66, 1, 203, 0, 0, 0, 66, 22, 18, 66, 1, 208, 0, 0, - 0, 153, 163, 24, 66, 1, 212, 0, 0, 0, 178, 204, 28, 66, - 1, 217, 0, 0, 0, 220, 59, 38, 66, 1, 218, 0, 0, 0, - 161, 27, 20, 66, 1, 220, 0, 0, 0, 125, 107, 24, 66, 1, - 222, 0, 0, 0, 242, 46, 28, 66, 1, 225, 0, 0, 0, 231, - 130, 41, 66, 0, 0, 0, 0, 0, 0, 0, 128, 191, 0, 0, - 0, 0, 0, 0, 0, 128, 191, 73, 193, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_dep_b_t* test_msg = - (msg_tracking_state_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[0].cn0 = 39.369598388671875; - test_msg->states[0].sid.code = 0; - test_msg->states[0].sid.reserved = 0; - test_msg->states[0].sid.sat = 202; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[1].cn0 = 36.52173614501953; - test_msg->states[1].sid.code = 0; - test_msg->states[1].sid.reserved = 0; - test_msg->states[1].sid.sat = 203; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[2].cn0 = 38.15976333618164; - test_msg->states[2].sid.code = 0; - test_msg->states[2].sid.reserved = 0; - test_msg->states[2].sid.sat = 208; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[3].cn0 = 39.19989776611328; - test_msg->states[3].sid.code = 0; - test_msg->states[3].sid.reserved = 0; - test_msg->states[3].sid.sat = 212; - test_msg->states[3].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[4].cn0 = 41.55845642089844; - test_msg->states[4].sid.code = 0; - test_msg->states[4].sid.reserved = 0; - test_msg->states[4].sid.sat = 217; - test_msg->states[4].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[5].cn0 = 37.026981353759766; - test_msg->states[5].sid.code = 0; - test_msg->states[5].sid.reserved = 0; - test_msg->states[5].sid.sat = 218; - test_msg->states[5].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[6].cn0 = 38.1049690246582; - test_msg->states[6].sid.code = 0; - test_msg->states[6].sid.reserved = 0; - test_msg->states[6].sid.sat = 220; - test_msg->states[6].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[7].cn0 = 39.04584503173828; - test_msg->states[7].sid.code = 0; - test_msg->states[7].sid.reserved = 0; - test_msg->states[7].sid.sat = 222; - test_msg->states[7].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[8].cn0 = 42.37783432006836; - test_msg->states[8].sid.code = 0; - test_msg->states[8].sid.reserved = 0; - test_msg->states[8].sid.sat = 225; - test_msg->states[8].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[9].cn0 = -1.0; - test_msg->states[9].sid.code = 0; - test_msg->states[9].sid.reserved = 0; - test_msg->states[9].sid.sat = 0; - test_msg->states[9].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[10].cn0 = -1.0; - test_msg->states[10].sid.code = 0; - test_msg->states[10].sid.reserved = 0; - test_msg->states[10].sid.sat = 0; - test_msg->states[10].state = 0; - sbp_payload_send(&sbp_state, 0x13, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x13, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_dep_b_t* check_msg = - (msg_tracking_state_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->states[0].cn0 * 100 - 39.3695983887 * 100) < 0.05, - "incorrect value for states[0].cn0, expected 39.3695983887, is %f", - check_msg->states[0].cn0); - ck_assert_msg(check_msg->states[0].sid.code == 0, - "incorrect value for states[0].sid.code, expected 0, is %d", - check_msg->states[0].sid.code); - ck_assert_msg( - check_msg->states[0].sid.reserved == 0, - "incorrect value for states[0].sid.reserved, expected 0, is %d", - check_msg->states[0].sid.reserved); - ck_assert_msg(check_msg->states[0].sid.sat == 202, - "incorrect value for states[0].sid.sat, expected 202, is %d", - check_msg->states[0].sid.sat); - ck_assert_msg(check_msg->states[0].state == 1, - "incorrect value for states[0].state, expected 1, is %d", - check_msg->states[0].state); - ck_assert_msg( - (check_msg->states[1].cn0 * 100 - 36.521736145 * 100) < 0.05, - "incorrect value for states[1].cn0, expected 36.521736145, is %f", - check_msg->states[1].cn0); - ck_assert_msg(check_msg->states[1].sid.code == 0, - "incorrect value for states[1].sid.code, expected 0, is %d", - check_msg->states[1].sid.code); - ck_assert_msg( - check_msg->states[1].sid.reserved == 0, - "incorrect value for states[1].sid.reserved, expected 0, is %d", - check_msg->states[1].sid.reserved); - ck_assert_msg(check_msg->states[1].sid.sat == 203, - "incorrect value for states[1].sid.sat, expected 203, is %d", - check_msg->states[1].sid.sat); - ck_assert_msg(check_msg->states[1].state == 1, - "incorrect value for states[1].state, expected 1, is %d", - check_msg->states[1].state); - ck_assert_msg( - (check_msg->states[2].cn0 * 100 - 38.1597633362 * 100) < 0.05, - "incorrect value for states[2].cn0, expected 38.1597633362, is %f", - check_msg->states[2].cn0); - ck_assert_msg(check_msg->states[2].sid.code == 0, - "incorrect value for states[2].sid.code, expected 0, is %d", - check_msg->states[2].sid.code); - ck_assert_msg( - check_msg->states[2].sid.reserved == 0, - "incorrect value for states[2].sid.reserved, expected 0, is %d", - check_msg->states[2].sid.reserved); - ck_assert_msg(check_msg->states[2].sid.sat == 208, - "incorrect value for states[2].sid.sat, expected 208, is %d", - check_msg->states[2].sid.sat); - ck_assert_msg(check_msg->states[2].state == 1, - "incorrect value for states[2].state, expected 1, is %d", - check_msg->states[2].state); - ck_assert_msg( - (check_msg->states[3].cn0 * 100 - 39.1998977661 * 100) < 0.05, - "incorrect value for states[3].cn0, expected 39.1998977661, is %f", - check_msg->states[3].cn0); - ck_assert_msg(check_msg->states[3].sid.code == 0, - "incorrect value for states[3].sid.code, expected 0, is %d", - check_msg->states[3].sid.code); - ck_assert_msg( - check_msg->states[3].sid.reserved == 0, - "incorrect value for states[3].sid.reserved, expected 0, is %d", - check_msg->states[3].sid.reserved); - ck_assert_msg(check_msg->states[3].sid.sat == 212, - "incorrect value for states[3].sid.sat, expected 212, is %d", - check_msg->states[3].sid.sat); - ck_assert_msg(check_msg->states[3].state == 1, - "incorrect value for states[3].state, expected 1, is %d", - check_msg->states[3].state); - ck_assert_msg( - (check_msg->states[4].cn0 * 100 - 41.5584564209 * 100) < 0.05, - "incorrect value for states[4].cn0, expected 41.5584564209, is %f", - check_msg->states[4].cn0); - ck_assert_msg(check_msg->states[4].sid.code == 0, - "incorrect value for states[4].sid.code, expected 0, is %d", - check_msg->states[4].sid.code); - ck_assert_msg( - check_msg->states[4].sid.reserved == 0, - "incorrect value for states[4].sid.reserved, expected 0, is %d", - check_msg->states[4].sid.reserved); - ck_assert_msg(check_msg->states[4].sid.sat == 217, - "incorrect value for states[4].sid.sat, expected 217, is %d", - check_msg->states[4].sid.sat); - ck_assert_msg(check_msg->states[4].state == 1, - "incorrect value for states[4].state, expected 1, is %d", - check_msg->states[4].state); - ck_assert_msg( - (check_msg->states[5].cn0 * 100 - 37.0269813538 * 100) < 0.05, - "incorrect value for states[5].cn0, expected 37.0269813538, is %f", - check_msg->states[5].cn0); - ck_assert_msg(check_msg->states[5].sid.code == 0, - "incorrect value for states[5].sid.code, expected 0, is %d", - check_msg->states[5].sid.code); - ck_assert_msg( - check_msg->states[5].sid.reserved == 0, - "incorrect value for states[5].sid.reserved, expected 0, is %d", - check_msg->states[5].sid.reserved); - ck_assert_msg(check_msg->states[5].sid.sat == 218, - "incorrect value for states[5].sid.sat, expected 218, is %d", - check_msg->states[5].sid.sat); - ck_assert_msg(check_msg->states[5].state == 1, - "incorrect value for states[5].state, expected 1, is %d", - check_msg->states[5].state); - ck_assert_msg( - (check_msg->states[6].cn0 * 100 - 38.1049690247 * 100) < 0.05, - "incorrect value for states[6].cn0, expected 38.1049690247, is %f", - check_msg->states[6].cn0); - ck_assert_msg(check_msg->states[6].sid.code == 0, - "incorrect value for states[6].sid.code, expected 0, is %d", - check_msg->states[6].sid.code); - ck_assert_msg( - check_msg->states[6].sid.reserved == 0, - "incorrect value for states[6].sid.reserved, expected 0, is %d", - check_msg->states[6].sid.reserved); - ck_assert_msg(check_msg->states[6].sid.sat == 220, - "incorrect value for states[6].sid.sat, expected 220, is %d", - check_msg->states[6].sid.sat); - ck_assert_msg(check_msg->states[6].state == 1, - "incorrect value for states[6].state, expected 1, is %d", - check_msg->states[6].state); - ck_assert_msg( - (check_msg->states[7].cn0 * 100 - 39.0458450317 * 100) < 0.05, - "incorrect value for states[7].cn0, expected 39.0458450317, is %f", - check_msg->states[7].cn0); - ck_assert_msg(check_msg->states[7].sid.code == 0, - "incorrect value for states[7].sid.code, expected 0, is %d", - check_msg->states[7].sid.code); - ck_assert_msg( - check_msg->states[7].sid.reserved == 0, - "incorrect value for states[7].sid.reserved, expected 0, is %d", - check_msg->states[7].sid.reserved); - ck_assert_msg(check_msg->states[7].sid.sat == 222, - "incorrect value for states[7].sid.sat, expected 222, is %d", - check_msg->states[7].sid.sat); - ck_assert_msg(check_msg->states[7].state == 1, - "incorrect value for states[7].state, expected 1, is %d", - check_msg->states[7].state); - ck_assert_msg( - (check_msg->states[8].cn0 * 100 - 42.3778343201 * 100) < 0.05, - "incorrect value for states[8].cn0, expected 42.3778343201, is %f", - check_msg->states[8].cn0); - ck_assert_msg(check_msg->states[8].sid.code == 0, - "incorrect value for states[8].sid.code, expected 0, is %d", - check_msg->states[8].sid.code); - ck_assert_msg( - check_msg->states[8].sid.reserved == 0, - "incorrect value for states[8].sid.reserved, expected 0, is %d", - check_msg->states[8].sid.reserved); - ck_assert_msg(check_msg->states[8].sid.sat == 225, - "incorrect value for states[8].sid.sat, expected 225, is %d", - check_msg->states[8].sid.sat); - ck_assert_msg(check_msg->states[8].state == 1, - "incorrect value for states[8].state, expected 1, is %d", - check_msg->states[8].state); - ck_assert_msg((check_msg->states[9].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[9].cn0, expected -1.0, is %f", - check_msg->states[9].cn0); - ck_assert_msg(check_msg->states[9].sid.code == 0, - "incorrect value for states[9].sid.code, expected 0, is %d", - check_msg->states[9].sid.code); - ck_assert_msg( - check_msg->states[9].sid.reserved == 0, - "incorrect value for states[9].sid.reserved, expected 0, is %d", - check_msg->states[9].sid.reserved); - ck_assert_msg(check_msg->states[9].sid.sat == 0, - "incorrect value for states[9].sid.sat, expected 0, is %d", - check_msg->states[9].sid.sat); - ck_assert_msg(check_msg->states[9].state == 0, - "incorrect value for states[9].state, expected 0, is %d", - check_msg->states[9].state); - ck_assert_msg((check_msg->states[10].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[10].cn0, expected -1.0, is %f", - check_msg->states[10].cn0); - ck_assert_msg(check_msg->states[10].sid.code == 0, - "incorrect value for states[10].sid.code, expected 0, is %d", - check_msg->states[10].sid.code); - ck_assert_msg( - check_msg->states[10].sid.reserved == 0, - "incorrect value for states[10].sid.reserved, expected 0, is %d", - check_msg->states[10].sid.reserved); - ck_assert_msg(check_msg->states[10].sid.sat == 0, - "incorrect value for states[10].sid.sat, expected 0, is %d", - check_msg->states[10].sid.sat); - ck_assert_msg(check_msg->states[10].state == 0, - "incorrect value for states[10].state, expected 0, is %d", - check_msg->states[10].state); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x13, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x13, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 19, 0, 246, 215, 99, 1, 202, 0, 0, 0, 103, 208, 30, - 66, 1, 203, 0, 0, 0, 117, 24, 18, 66, 1, 208, 0, 0, - 0, 200, 173, 20, 66, 1, 212, 0, 0, 0, 137, 68, 27, 66, - 1, 217, 0, 0, 0, 243, 51, 40, 66, 1, 218, 0, 0, 0, - 225, 58, 23, 66, 1, 220, 0, 0, 0, 132, 221, 22, 66, 1, - 222, 0, 0, 0, 157, 29, 26, 66, 1, 225, 0, 0, 0, 133, - 21, 41, 66, 0, 0, 0, 0, 0, 0, 0, 128, 191, 0, 0, - 0, 0, 0, 0, 0, 128, 191, 126, 47, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_dep_b_t* test_msg = - (msg_tracking_state_dep_b_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[0].cn0 = 39.70351791381836; - test_msg->states[0].sid.code = 0; - test_msg->states[0].sid.reserved = 0; - test_msg->states[0].sid.sat = 202; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[1].cn0 = 36.52388381958008; - test_msg->states[1].sid.code = 0; - test_msg->states[1].sid.reserved = 0; - test_msg->states[1].sid.sat = 203; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[2].cn0 = 37.169708251953125; - test_msg->states[2].sid.code = 0; - test_msg->states[2].sid.reserved = 0; - test_msg->states[2].sid.sat = 208; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[3].cn0 = 38.81692886352539; - test_msg->states[3].sid.code = 0; - test_msg->states[3].sid.reserved = 0; - test_msg->states[3].sid.sat = 212; - test_msg->states[3].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[4].cn0 = 42.05073165893555; - test_msg->states[4].sid.code = 0; - test_msg->states[4].sid.reserved = 0; - test_msg->states[4].sid.sat = 217; - test_msg->states[4].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[5].cn0 = 37.807498931884766; - test_msg->states[5].sid.code = 0; - test_msg->states[5].sid.reserved = 0; - test_msg->states[5].sid.sat = 218; - test_msg->states[5].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[6].cn0 = 37.71632385253906; - test_msg->states[6].sid.code = 0; - test_msg->states[6].sid.reserved = 0; - test_msg->states[6].sid.sat = 220; - test_msg->states[6].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[7].cn0 = 38.5289192199707; - test_msg->states[7].sid.code = 0; - test_msg->states[7].sid.reserved = 0; - test_msg->states[7].sid.sat = 222; - test_msg->states[7].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[8].cn0 = 42.27101516723633; - test_msg->states[8].sid.code = 0; - test_msg->states[8].sid.reserved = 0; - test_msg->states[8].sid.sat = 225; - test_msg->states[8].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[9].cn0 = -1.0; - test_msg->states[9].sid.code = 0; - test_msg->states[9].sid.reserved = 0; - test_msg->states[9].sid.sat = 0; - test_msg->states[9].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[10].cn0 = -1.0; - test_msg->states[10].sid.code = 0; - test_msg->states[10].sid.reserved = 0; - test_msg->states[10].sid.sat = 0; - test_msg->states[10].state = 0; - sbp_payload_send(&sbp_state, 0x13, 55286, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 55286, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 55286, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x13, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_dep_b_t* check_msg = - (msg_tracking_state_dep_b_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->states[0].cn0 * 100 - 39.7035179138 * 100) < 0.05, - "incorrect value for states[0].cn0, expected 39.7035179138, is %f", - check_msg->states[0].cn0); - ck_assert_msg(check_msg->states[0].sid.code == 0, - "incorrect value for states[0].sid.code, expected 0, is %d", - check_msg->states[0].sid.code); - ck_assert_msg( - check_msg->states[0].sid.reserved == 0, - "incorrect value for states[0].sid.reserved, expected 0, is %d", - check_msg->states[0].sid.reserved); - ck_assert_msg(check_msg->states[0].sid.sat == 202, - "incorrect value for states[0].sid.sat, expected 202, is %d", - check_msg->states[0].sid.sat); - ck_assert_msg(check_msg->states[0].state == 1, - "incorrect value for states[0].state, expected 1, is %d", - check_msg->states[0].state); - ck_assert_msg( - (check_msg->states[1].cn0 * 100 - 36.5238838196 * 100) < 0.05, - "incorrect value for states[1].cn0, expected 36.5238838196, is %f", - check_msg->states[1].cn0); - ck_assert_msg(check_msg->states[1].sid.code == 0, - "incorrect value for states[1].sid.code, expected 0, is %d", - check_msg->states[1].sid.code); - ck_assert_msg( - check_msg->states[1].sid.reserved == 0, - "incorrect value for states[1].sid.reserved, expected 0, is %d", - check_msg->states[1].sid.reserved); - ck_assert_msg(check_msg->states[1].sid.sat == 203, - "incorrect value for states[1].sid.sat, expected 203, is %d", - check_msg->states[1].sid.sat); - ck_assert_msg(check_msg->states[1].state == 1, - "incorrect value for states[1].state, expected 1, is %d", - check_msg->states[1].state); - ck_assert_msg( - (check_msg->states[2].cn0 * 100 - 37.169708252 * 100) < 0.05, - "incorrect value for states[2].cn0, expected 37.169708252, is %f", - check_msg->states[2].cn0); - ck_assert_msg(check_msg->states[2].sid.code == 0, - "incorrect value for states[2].sid.code, expected 0, is %d", - check_msg->states[2].sid.code); - ck_assert_msg( - check_msg->states[2].sid.reserved == 0, - "incorrect value for states[2].sid.reserved, expected 0, is %d", - check_msg->states[2].sid.reserved); - ck_assert_msg(check_msg->states[2].sid.sat == 208, - "incorrect value for states[2].sid.sat, expected 208, is %d", - check_msg->states[2].sid.sat); - ck_assert_msg(check_msg->states[2].state == 1, - "incorrect value for states[2].state, expected 1, is %d", - check_msg->states[2].state); - ck_assert_msg( - (check_msg->states[3].cn0 * 100 - 38.8169288635 * 100) < 0.05, - "incorrect value for states[3].cn0, expected 38.8169288635, is %f", - check_msg->states[3].cn0); - ck_assert_msg(check_msg->states[3].sid.code == 0, - "incorrect value for states[3].sid.code, expected 0, is %d", - check_msg->states[3].sid.code); - ck_assert_msg( - check_msg->states[3].sid.reserved == 0, - "incorrect value for states[3].sid.reserved, expected 0, is %d", - check_msg->states[3].sid.reserved); - ck_assert_msg(check_msg->states[3].sid.sat == 212, - "incorrect value for states[3].sid.sat, expected 212, is %d", - check_msg->states[3].sid.sat); - ck_assert_msg(check_msg->states[3].state == 1, - "incorrect value for states[3].state, expected 1, is %d", - check_msg->states[3].state); - ck_assert_msg( - (check_msg->states[4].cn0 * 100 - 42.0507316589 * 100) < 0.05, - "incorrect value for states[4].cn0, expected 42.0507316589, is %f", - check_msg->states[4].cn0); - ck_assert_msg(check_msg->states[4].sid.code == 0, - "incorrect value for states[4].sid.code, expected 0, is %d", - check_msg->states[4].sid.code); - ck_assert_msg( - check_msg->states[4].sid.reserved == 0, - "incorrect value for states[4].sid.reserved, expected 0, is %d", - check_msg->states[4].sid.reserved); - ck_assert_msg(check_msg->states[4].sid.sat == 217, - "incorrect value for states[4].sid.sat, expected 217, is %d", - check_msg->states[4].sid.sat); - ck_assert_msg(check_msg->states[4].state == 1, - "incorrect value for states[4].state, expected 1, is %d", - check_msg->states[4].state); - ck_assert_msg( - (check_msg->states[5].cn0 * 100 - 37.8074989319 * 100) < 0.05, - "incorrect value for states[5].cn0, expected 37.8074989319, is %f", - check_msg->states[5].cn0); - ck_assert_msg(check_msg->states[5].sid.code == 0, - "incorrect value for states[5].sid.code, expected 0, is %d", - check_msg->states[5].sid.code); - ck_assert_msg( - check_msg->states[5].sid.reserved == 0, - "incorrect value for states[5].sid.reserved, expected 0, is %d", - check_msg->states[5].sid.reserved); - ck_assert_msg(check_msg->states[5].sid.sat == 218, - "incorrect value for states[5].sid.sat, expected 218, is %d", - check_msg->states[5].sid.sat); - ck_assert_msg(check_msg->states[5].state == 1, - "incorrect value for states[5].state, expected 1, is %d", - check_msg->states[5].state); - ck_assert_msg( - (check_msg->states[6].cn0 * 100 - 37.7163238525 * 100) < 0.05, - "incorrect value for states[6].cn0, expected 37.7163238525, is %f", - check_msg->states[6].cn0); - ck_assert_msg(check_msg->states[6].sid.code == 0, - "incorrect value for states[6].sid.code, expected 0, is %d", - check_msg->states[6].sid.code); - ck_assert_msg( - check_msg->states[6].sid.reserved == 0, - "incorrect value for states[6].sid.reserved, expected 0, is %d", - check_msg->states[6].sid.reserved); - ck_assert_msg(check_msg->states[6].sid.sat == 220, - "incorrect value for states[6].sid.sat, expected 220, is %d", - check_msg->states[6].sid.sat); - ck_assert_msg(check_msg->states[6].state == 1, - "incorrect value for states[6].state, expected 1, is %d", - check_msg->states[6].state); - ck_assert_msg( - (check_msg->states[7].cn0 * 100 - 38.52891922 * 100) < 0.05, - "incorrect value for states[7].cn0, expected 38.52891922, is %f", - check_msg->states[7].cn0); - ck_assert_msg(check_msg->states[7].sid.code == 0, - "incorrect value for states[7].sid.code, expected 0, is %d", - check_msg->states[7].sid.code); - ck_assert_msg( - check_msg->states[7].sid.reserved == 0, - "incorrect value for states[7].sid.reserved, expected 0, is %d", - check_msg->states[7].sid.reserved); - ck_assert_msg(check_msg->states[7].sid.sat == 222, - "incorrect value for states[7].sid.sat, expected 222, is %d", - check_msg->states[7].sid.sat); - ck_assert_msg(check_msg->states[7].state == 1, - "incorrect value for states[7].state, expected 1, is %d", - check_msg->states[7].state); - ck_assert_msg( - (check_msg->states[8].cn0 * 100 - 42.2710151672 * 100) < 0.05, - "incorrect value for states[8].cn0, expected 42.2710151672, is %f", - check_msg->states[8].cn0); - ck_assert_msg(check_msg->states[8].sid.code == 0, - "incorrect value for states[8].sid.code, expected 0, is %d", - check_msg->states[8].sid.code); - ck_assert_msg( - check_msg->states[8].sid.reserved == 0, - "incorrect value for states[8].sid.reserved, expected 0, is %d", - check_msg->states[8].sid.reserved); - ck_assert_msg(check_msg->states[8].sid.sat == 225, - "incorrect value for states[8].sid.sat, expected 225, is %d", - check_msg->states[8].sid.sat); - ck_assert_msg(check_msg->states[8].state == 1, - "incorrect value for states[8].state, expected 1, is %d", - check_msg->states[8].state); - ck_assert_msg((check_msg->states[9].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[9].cn0, expected -1.0, is %f", - check_msg->states[9].cn0); - ck_assert_msg(check_msg->states[9].sid.code == 0, - "incorrect value for states[9].sid.code, expected 0, is %d", - check_msg->states[9].sid.code); - ck_assert_msg( - check_msg->states[9].sid.reserved == 0, - "incorrect value for states[9].sid.reserved, expected 0, is %d", - check_msg->states[9].sid.reserved); - ck_assert_msg(check_msg->states[9].sid.sat == 0, - "incorrect value for states[9].sid.sat, expected 0, is %d", - check_msg->states[9].sid.sat); - ck_assert_msg(check_msg->states[9].state == 0, - "incorrect value for states[9].state, expected 0, is %d", - check_msg->states[9].state); - ck_assert_msg((check_msg->states[10].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[10].cn0, expected -1.0, is %f", - check_msg->states[10].cn0); - ck_assert_msg(check_msg->states[10].sid.code == 0, - "incorrect value for states[10].sid.code, expected 0, is %d", - check_msg->states[10].sid.code); - ck_assert_msg( - check_msg->states[10].sid.reserved == 0, - "incorrect value for states[10].sid.reserved, expected 0, is %d", - check_msg->states[10].sid.reserved); - ck_assert_msg(check_msg->states[10].sid.sat == 0, - "incorrect value for states[10].sid.sat, expected 0, is %d", - check_msg->states[10].sid.sat); - ck_assert_msg(check_msg->states[10].state == 0, - "incorrect value for states[10].state, expected 0, is %d", - check_msg->states[10].state); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_tracking_MsgTrackingState_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_tracking_MsgTrackingState"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_tracking_MsgTrackingState"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_tracking_MsgTrackingState); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_tracking_MsgTrackingStateDepB.c b/c/test/legacy/auto_check_sbp_tracking_MsgTrackingStateDepB.c deleted file mode 100644 index 105d80d788..0000000000 --- a/c/test/legacy/auto_check_sbp_tracking_MsgTrackingStateDepB.c +++ /dev/null @@ -1,999 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgTrackingStateDepB.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_tracking_MsgTrackingStateDepB) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x13, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x13, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 19, 0, 242, 241, 252, 115, 183, 227, 63, 68, 154, 1, 183, - 69, 255, 175, 121, 43, 222, 51, 67, 35, 69, 78, 240, 5, 53, - 20, 51, 211, 54, 69, 153, 130, 237, 66, 155, 51, 227, 71, 69, - 53, 242, 136, 161, 190, 205, 188, 6, 70, 153, 125, 255, 142, 149, - 154, 217, 184, 69, 248, 102, 95, 31, 76, 154, 33, 169, 69, 131, - 115, 141, 27, 12, 154, 225, 200, 69, 208, 44, 147, 39, 23, 51, - 3, 66, 69, 237, 159, 251, 49, 203, 51, 99, 102, 69, 70, 214, - 87, 128, 206, 154, 121, 186, 69, 14, 206, 111, 218, 19, 154, 121, - 169, 69, 216, 98, 209, 54, 2, 154, 25, 219, 67, 200, 133, 99, - 7, 34, 102, 198, 232, 68, 155, 43, 85, 135, 46, 154, 177, 170, - 69, 155, 3, 83, 171, 201, 154, 241, 232, 69, 121, 43, 197, 16, - 19, 154, 241, 222, 69, 128, 245, 53, 63, 176, 51, 115, 66, 69, - 36, 20, 61, 153, 51, 154, 73, 134, 69, 46, 82, 116, 140, 22, - 51, 147, 37, 69, 177, 67, 146, 96, 143, 205, 76, 107, 68, 220, - 51, 160, 201, 251, 102, 102, 192, 68, 168, 194, 2, 161, 220, 102, - 102, 180, 68, 69, 8, 9, 125, 178, 102, 70, 134, 68, 185, 20, - 135, 186, 171, 51, 163, 4, 69, 18, 124, 155, 85, 170, 205, 208, - 13, 70, 57, 244, 206, 255, 186, 154, 105, 149, 69, 165, 199, 93, - 181, 175, 51, 67, 64, 69, 6, 28, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_dep_b_t *test_msg = - (msg_tracking_state_dep_b_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[0].cn0 = 5856.2001953125; - test_msg->states[0].sid.code = 63; - test_msg->states[0].sid.reserved = 68; - test_msg->states[0].sid.sat = 58295; - test_msg->states[0].state = 115; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[1].cn0 = 2612.199951171875; - test_msg->states[1].sid.code = 43; - test_msg->states[1].sid.reserved = 222; - test_msg->states[1].sid.sat = 31151; - test_msg->states[1].state = 255; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[2].cn0 = 2925.199951171875; - test_msg->states[2].sid.code = 53; - test_msg->states[2].sid.reserved = 20; - test_msg->states[2].sid.sat = 1520; - test_msg->states[2].state = 78; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[3].cn0 = 3198.199951171875; - test_msg->states[3].sid.code = 66; - test_msg->states[3].sid.reserved = 155; - test_msg->states[3].sid.sat = 60802; - test_msg->states[3].state = 153; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[4].cn0 = 8623.2001953125; - test_msg->states[4].sid.code = 161; - test_msg->states[4].sid.reserved = 190; - test_msg->states[4].sid.sat = 35058; - test_msg->states[4].state = 53; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[5].cn0 = 5915.2001953125; - test_msg->states[5].sid.code = 142; - test_msg->states[5].sid.reserved = 149; - test_msg->states[5].sid.sat = 65405; - test_msg->states[5].state = 153; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[6].cn0 = 5412.2001953125; - test_msg->states[6].sid.code = 31; - test_msg->states[6].sid.reserved = 76; - test_msg->states[6].sid.sat = 24422; - test_msg->states[6].state = 248; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[7].cn0 = 6428.2001953125; - test_msg->states[7].sid.code = 27; - test_msg->states[7].sid.reserved = 12; - test_msg->states[7].sid.sat = 36211; - test_msg->states[7].state = 131; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[8].cn0 = 3104.199951171875; - test_msg->states[8].sid.code = 39; - test_msg->states[8].sid.reserved = 23; - test_msg->states[8].sid.sat = 37676; - test_msg->states[8].state = 208; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[9].cn0 = 3686.199951171875; - test_msg->states[9].sid.code = 49; - test_msg->states[9].sid.reserved = 203; - test_msg->states[9].sid.sat = 64415; - test_msg->states[9].state = 237; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[10].cn0 = 5967.2001953125; - test_msg->states[10].sid.code = 128; - test_msg->states[10].sid.reserved = 206; - test_msg->states[10].sid.sat = 22486; - test_msg->states[10].state = 70; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[11].cn0 = 5423.2001953125; - test_msg->states[11].sid.code = 218; - test_msg->states[11].sid.reserved = 19; - test_msg->states[11].sid.sat = 28622; - test_msg->states[11].state = 14; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[12].cn0 = 438.20001220703125; - test_msg->states[12].sid.code = 54; - test_msg->states[12].sid.reserved = 2; - test_msg->states[12].sid.sat = 53602; - test_msg->states[12].state = 216; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[13].cn0 = 1862.199951171875; - test_msg->states[13].sid.code = 7; - test_msg->states[13].sid.reserved = 34; - test_msg->states[13].sid.sat = 25477; - test_msg->states[13].state = 200; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[14].cn0 = 5462.2001953125; - test_msg->states[14].sid.code = 135; - test_msg->states[14].sid.reserved = 46; - test_msg->states[14].sid.sat = 21803; - test_msg->states[14].state = 155; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[15].cn0 = 7454.2001953125; - test_msg->states[15].sid.code = 171; - test_msg->states[15].sid.reserved = 201; - test_msg->states[15].sid.sat = 21251; - test_msg->states[15].state = 155; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[16].cn0 = 7134.2001953125; - test_msg->states[16].sid.code = 16; - test_msg->states[16].sid.reserved = 19; - test_msg->states[16].sid.sat = 50475; - test_msg->states[16].state = 121; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[17].cn0 = 3111.199951171875; - test_msg->states[17].sid.code = 63; - test_msg->states[17].sid.reserved = 176; - test_msg->states[17].sid.sat = 13813; - test_msg->states[17].state = 128; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[18].cn0 = 4297.2001953125; - test_msg->states[18].sid.code = 153; - test_msg->states[18].sid.reserved = 51; - test_msg->states[18].sid.sat = 15636; - test_msg->states[18].state = 36; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[19].cn0 = 2649.199951171875; - test_msg->states[19].sid.code = 140; - test_msg->states[19].sid.reserved = 22; - test_msg->states[19].sid.sat = 29778; - test_msg->states[19].state = 46; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[20].cn0 = 941.2000122070312; - test_msg->states[20].sid.code = 96; - test_msg->states[20].sid.reserved = 143; - test_msg->states[20].sid.sat = 37443; - test_msg->states[20].state = 177; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[21].cn0 = 1539.199951171875; - test_msg->states[21].sid.code = 201; - test_msg->states[21].sid.reserved = 251; - test_msg->states[21].sid.sat = 41011; - test_msg->states[21].state = 220; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[22].cn0 = 1443.199951171875; - test_msg->states[22].sid.code = 161; - test_msg->states[22].sid.reserved = 220; - test_msg->states[22].sid.sat = 706; - test_msg->states[22].state = 168; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[23].cn0 = 1074.199951171875; - test_msg->states[23].sid.code = 125; - test_msg->states[23].sid.reserved = 178; - test_msg->states[23].sid.sat = 2312; - test_msg->states[23].state = 69; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[24].cn0 = 2122.199951171875; - test_msg->states[24].sid.code = 186; - test_msg->states[24].sid.reserved = 171; - test_msg->states[24].sid.sat = 34580; - test_msg->states[24].state = 185; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[25].cn0 = 9076.2001953125; - test_msg->states[25].sid.code = 85; - test_msg->states[25].sid.reserved = 170; - test_msg->states[25].sid.sat = 39804; - test_msg->states[25].state = 18; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[26].cn0 = 4781.2001953125; - test_msg->states[26].sid.code = 255; - test_msg->states[26].sid.reserved = 186; - test_msg->states[26].sid.sat = 52980; - test_msg->states[26].state = 57; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[27].cn0 = 3076.199951171875; - test_msg->states[27].sid.code = 181; - test_msg->states[27].sid.reserved = 175; - test_msg->states[27].sid.sat = 24007; - test_msg->states[27].state = 165; - sbp_payload_send(&sbp_state, 0x13, 61938, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 61938, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 61938, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x13, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_dep_b_t *check_msg = - (msg_tracking_state_dep_b_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->states[0].cn0 * 100 - 5856.20019531 * 100) < 0.05, - "incorrect value for states[0].cn0, expected 5856.20019531, is %f", - check_msg->states[0].cn0); - ck_assert_msg(check_msg->states[0].sid.code == 63, - "incorrect value for states[0].sid.code, expected 63, is %d", - check_msg->states[0].sid.code); - ck_assert_msg( - check_msg->states[0].sid.reserved == 68, - "incorrect value for states[0].sid.reserved, expected 68, is %d", - check_msg->states[0].sid.reserved); - ck_assert_msg( - check_msg->states[0].sid.sat == 58295, - "incorrect value for states[0].sid.sat, expected 58295, is %d", - check_msg->states[0].sid.sat); - ck_assert_msg(check_msg->states[0].state == 115, - "incorrect value for states[0].state, expected 115, is %d", - check_msg->states[0].state); - ck_assert_msg( - (check_msg->states[1].cn0 * 100 - 2612.19995117 * 100) < 0.05, - "incorrect value for states[1].cn0, expected 2612.19995117, is %f", - check_msg->states[1].cn0); - ck_assert_msg(check_msg->states[1].sid.code == 43, - "incorrect value for states[1].sid.code, expected 43, is %d", - check_msg->states[1].sid.code); - ck_assert_msg( - check_msg->states[1].sid.reserved == 222, - "incorrect value for states[1].sid.reserved, expected 222, is %d", - check_msg->states[1].sid.reserved); - ck_assert_msg( - check_msg->states[1].sid.sat == 31151, - "incorrect value for states[1].sid.sat, expected 31151, is %d", - check_msg->states[1].sid.sat); - ck_assert_msg(check_msg->states[1].state == 255, - "incorrect value for states[1].state, expected 255, is %d", - check_msg->states[1].state); - ck_assert_msg( - (check_msg->states[2].cn0 * 100 - 2925.19995117 * 100) < 0.05, - "incorrect value for states[2].cn0, expected 2925.19995117, is %f", - check_msg->states[2].cn0); - ck_assert_msg(check_msg->states[2].sid.code == 53, - "incorrect value for states[2].sid.code, expected 53, is %d", - check_msg->states[2].sid.code); - ck_assert_msg( - check_msg->states[2].sid.reserved == 20, - "incorrect value for states[2].sid.reserved, expected 20, is %d", - check_msg->states[2].sid.reserved); - ck_assert_msg(check_msg->states[2].sid.sat == 1520, - "incorrect value for states[2].sid.sat, expected 1520, is %d", - check_msg->states[2].sid.sat); - ck_assert_msg(check_msg->states[2].state == 78, - "incorrect value for states[2].state, expected 78, is %d", - check_msg->states[2].state); - ck_assert_msg( - (check_msg->states[3].cn0 * 100 - 3198.19995117 * 100) < 0.05, - "incorrect value for states[3].cn0, expected 3198.19995117, is %f", - check_msg->states[3].cn0); - ck_assert_msg(check_msg->states[3].sid.code == 66, - "incorrect value for states[3].sid.code, expected 66, is %d", - check_msg->states[3].sid.code); - ck_assert_msg( - check_msg->states[3].sid.reserved == 155, - "incorrect value for states[3].sid.reserved, expected 155, is %d", - check_msg->states[3].sid.reserved); - ck_assert_msg( - check_msg->states[3].sid.sat == 60802, - "incorrect value for states[3].sid.sat, expected 60802, is %d", - check_msg->states[3].sid.sat); - ck_assert_msg(check_msg->states[3].state == 153, - "incorrect value for states[3].state, expected 153, is %d", - check_msg->states[3].state); - ck_assert_msg( - (check_msg->states[4].cn0 * 100 - 8623.20019531 * 100) < 0.05, - "incorrect value for states[4].cn0, expected 8623.20019531, is %f", - check_msg->states[4].cn0); - ck_assert_msg(check_msg->states[4].sid.code == 161, - "incorrect value for states[4].sid.code, expected 161, is %d", - check_msg->states[4].sid.code); - ck_assert_msg( - check_msg->states[4].sid.reserved == 190, - "incorrect value for states[4].sid.reserved, expected 190, is %d", - check_msg->states[4].sid.reserved); - ck_assert_msg( - check_msg->states[4].sid.sat == 35058, - "incorrect value for states[4].sid.sat, expected 35058, is %d", - check_msg->states[4].sid.sat); - ck_assert_msg(check_msg->states[4].state == 53, - "incorrect value for states[4].state, expected 53, is %d", - check_msg->states[4].state); - ck_assert_msg( - (check_msg->states[5].cn0 * 100 - 5915.20019531 * 100) < 0.05, - "incorrect value for states[5].cn0, expected 5915.20019531, is %f", - check_msg->states[5].cn0); - ck_assert_msg(check_msg->states[5].sid.code == 142, - "incorrect value for states[5].sid.code, expected 142, is %d", - check_msg->states[5].sid.code); - ck_assert_msg( - check_msg->states[5].sid.reserved == 149, - "incorrect value for states[5].sid.reserved, expected 149, is %d", - check_msg->states[5].sid.reserved); - ck_assert_msg( - check_msg->states[5].sid.sat == 65405, - "incorrect value for states[5].sid.sat, expected 65405, is %d", - check_msg->states[5].sid.sat); - ck_assert_msg(check_msg->states[5].state == 153, - "incorrect value for states[5].state, expected 153, is %d", - check_msg->states[5].state); - ck_assert_msg( - (check_msg->states[6].cn0 * 100 - 5412.20019531 * 100) < 0.05, - "incorrect value for states[6].cn0, expected 5412.20019531, is %f", - check_msg->states[6].cn0); - ck_assert_msg(check_msg->states[6].sid.code == 31, - "incorrect value for states[6].sid.code, expected 31, is %d", - check_msg->states[6].sid.code); - ck_assert_msg( - check_msg->states[6].sid.reserved == 76, - "incorrect value for states[6].sid.reserved, expected 76, is %d", - check_msg->states[6].sid.reserved); - ck_assert_msg( - check_msg->states[6].sid.sat == 24422, - "incorrect value for states[6].sid.sat, expected 24422, is %d", - check_msg->states[6].sid.sat); - ck_assert_msg(check_msg->states[6].state == 248, - "incorrect value for states[6].state, expected 248, is %d", - check_msg->states[6].state); - ck_assert_msg( - (check_msg->states[7].cn0 * 100 - 6428.20019531 * 100) < 0.05, - "incorrect value for states[7].cn0, expected 6428.20019531, is %f", - check_msg->states[7].cn0); - ck_assert_msg(check_msg->states[7].sid.code == 27, - "incorrect value for states[7].sid.code, expected 27, is %d", - check_msg->states[7].sid.code); - ck_assert_msg( - check_msg->states[7].sid.reserved == 12, - "incorrect value for states[7].sid.reserved, expected 12, is %d", - check_msg->states[7].sid.reserved); - ck_assert_msg( - check_msg->states[7].sid.sat == 36211, - "incorrect value for states[7].sid.sat, expected 36211, is %d", - check_msg->states[7].sid.sat); - ck_assert_msg(check_msg->states[7].state == 131, - "incorrect value for states[7].state, expected 131, is %d", - check_msg->states[7].state); - ck_assert_msg( - (check_msg->states[8].cn0 * 100 - 3104.19995117 * 100) < 0.05, - "incorrect value for states[8].cn0, expected 3104.19995117, is %f", - check_msg->states[8].cn0); - ck_assert_msg(check_msg->states[8].sid.code == 39, - "incorrect value for states[8].sid.code, expected 39, is %d", - check_msg->states[8].sid.code); - ck_assert_msg( - check_msg->states[8].sid.reserved == 23, - "incorrect value for states[8].sid.reserved, expected 23, is %d", - check_msg->states[8].sid.reserved); - ck_assert_msg( - check_msg->states[8].sid.sat == 37676, - "incorrect value for states[8].sid.sat, expected 37676, is %d", - check_msg->states[8].sid.sat); - ck_assert_msg(check_msg->states[8].state == 208, - "incorrect value for states[8].state, expected 208, is %d", - check_msg->states[8].state); - ck_assert_msg( - (check_msg->states[9].cn0 * 100 - 3686.19995117 * 100) < 0.05, - "incorrect value for states[9].cn0, expected 3686.19995117, is %f", - check_msg->states[9].cn0); - ck_assert_msg(check_msg->states[9].sid.code == 49, - "incorrect value for states[9].sid.code, expected 49, is %d", - check_msg->states[9].sid.code); - ck_assert_msg( - check_msg->states[9].sid.reserved == 203, - "incorrect value for states[9].sid.reserved, expected 203, is %d", - check_msg->states[9].sid.reserved); - ck_assert_msg( - check_msg->states[9].sid.sat == 64415, - "incorrect value for states[9].sid.sat, expected 64415, is %d", - check_msg->states[9].sid.sat); - ck_assert_msg(check_msg->states[9].state == 237, - "incorrect value for states[9].state, expected 237, is %d", - check_msg->states[9].state); - ck_assert_msg( - (check_msg->states[10].cn0 * 100 - 5967.20019531 * 100) < 0.05, - "incorrect value for states[10].cn0, expected 5967.20019531, is %f", - check_msg->states[10].cn0); - ck_assert_msg( - check_msg->states[10].sid.code == 128, - "incorrect value for states[10].sid.code, expected 128, is %d", - check_msg->states[10].sid.code); - ck_assert_msg( - check_msg->states[10].sid.reserved == 206, - "incorrect value for states[10].sid.reserved, expected 206, is %d", - check_msg->states[10].sid.reserved); - ck_assert_msg( - check_msg->states[10].sid.sat == 22486, - "incorrect value for states[10].sid.sat, expected 22486, is %d", - check_msg->states[10].sid.sat); - ck_assert_msg(check_msg->states[10].state == 70, - "incorrect value for states[10].state, expected 70, is %d", - check_msg->states[10].state); - ck_assert_msg( - (check_msg->states[11].cn0 * 100 - 5423.20019531 * 100) < 0.05, - "incorrect value for states[11].cn0, expected 5423.20019531, is %f", - check_msg->states[11].cn0); - ck_assert_msg( - check_msg->states[11].sid.code == 218, - "incorrect value for states[11].sid.code, expected 218, is %d", - check_msg->states[11].sid.code); - ck_assert_msg( - check_msg->states[11].sid.reserved == 19, - "incorrect value for states[11].sid.reserved, expected 19, is %d", - check_msg->states[11].sid.reserved); - ck_assert_msg( - check_msg->states[11].sid.sat == 28622, - "incorrect value for states[11].sid.sat, expected 28622, is %d", - check_msg->states[11].sid.sat); - ck_assert_msg(check_msg->states[11].state == 14, - "incorrect value for states[11].state, expected 14, is %d", - check_msg->states[11].state); - ck_assert_msg( - (check_msg->states[12].cn0 * 100 - 438.200012207 * 100) < 0.05, - "incorrect value for states[12].cn0, expected 438.200012207, is %f", - check_msg->states[12].cn0); - ck_assert_msg(check_msg->states[12].sid.code == 54, - "incorrect value for states[12].sid.code, expected 54, is %d", - check_msg->states[12].sid.code); - ck_assert_msg( - check_msg->states[12].sid.reserved == 2, - "incorrect value for states[12].sid.reserved, expected 2, is %d", - check_msg->states[12].sid.reserved); - ck_assert_msg( - check_msg->states[12].sid.sat == 53602, - "incorrect value for states[12].sid.sat, expected 53602, is %d", - check_msg->states[12].sid.sat); - ck_assert_msg(check_msg->states[12].state == 216, - "incorrect value for states[12].state, expected 216, is %d", - check_msg->states[12].state); - ck_assert_msg( - (check_msg->states[13].cn0 * 100 - 1862.19995117 * 100) < 0.05, - "incorrect value for states[13].cn0, expected 1862.19995117, is %f", - check_msg->states[13].cn0); - ck_assert_msg(check_msg->states[13].sid.code == 7, - "incorrect value for states[13].sid.code, expected 7, is %d", - check_msg->states[13].sid.code); - ck_assert_msg( - check_msg->states[13].sid.reserved == 34, - "incorrect value for states[13].sid.reserved, expected 34, is %d", - check_msg->states[13].sid.reserved); - ck_assert_msg( - check_msg->states[13].sid.sat == 25477, - "incorrect value for states[13].sid.sat, expected 25477, is %d", - check_msg->states[13].sid.sat); - ck_assert_msg(check_msg->states[13].state == 200, - "incorrect value for states[13].state, expected 200, is %d", - check_msg->states[13].state); - ck_assert_msg( - (check_msg->states[14].cn0 * 100 - 5462.20019531 * 100) < 0.05, - "incorrect value for states[14].cn0, expected 5462.20019531, is %f", - check_msg->states[14].cn0); - ck_assert_msg( - check_msg->states[14].sid.code == 135, - "incorrect value for states[14].sid.code, expected 135, is %d", - check_msg->states[14].sid.code); - ck_assert_msg( - check_msg->states[14].sid.reserved == 46, - "incorrect value for states[14].sid.reserved, expected 46, is %d", - check_msg->states[14].sid.reserved); - ck_assert_msg( - check_msg->states[14].sid.sat == 21803, - "incorrect value for states[14].sid.sat, expected 21803, is %d", - check_msg->states[14].sid.sat); - ck_assert_msg(check_msg->states[14].state == 155, - "incorrect value for states[14].state, expected 155, is %d", - check_msg->states[14].state); - ck_assert_msg( - (check_msg->states[15].cn0 * 100 - 7454.20019531 * 100) < 0.05, - "incorrect value for states[15].cn0, expected 7454.20019531, is %f", - check_msg->states[15].cn0); - ck_assert_msg( - check_msg->states[15].sid.code == 171, - "incorrect value for states[15].sid.code, expected 171, is %d", - check_msg->states[15].sid.code); - ck_assert_msg( - check_msg->states[15].sid.reserved == 201, - "incorrect value for states[15].sid.reserved, expected 201, is %d", - check_msg->states[15].sid.reserved); - ck_assert_msg( - check_msg->states[15].sid.sat == 21251, - "incorrect value for states[15].sid.sat, expected 21251, is %d", - check_msg->states[15].sid.sat); - ck_assert_msg(check_msg->states[15].state == 155, - "incorrect value for states[15].state, expected 155, is %d", - check_msg->states[15].state); - ck_assert_msg( - (check_msg->states[16].cn0 * 100 - 7134.20019531 * 100) < 0.05, - "incorrect value for states[16].cn0, expected 7134.20019531, is %f", - check_msg->states[16].cn0); - ck_assert_msg(check_msg->states[16].sid.code == 16, - "incorrect value for states[16].sid.code, expected 16, is %d", - check_msg->states[16].sid.code); - ck_assert_msg( - check_msg->states[16].sid.reserved == 19, - "incorrect value for states[16].sid.reserved, expected 19, is %d", - check_msg->states[16].sid.reserved); - ck_assert_msg( - check_msg->states[16].sid.sat == 50475, - "incorrect value for states[16].sid.sat, expected 50475, is %d", - check_msg->states[16].sid.sat); - ck_assert_msg(check_msg->states[16].state == 121, - "incorrect value for states[16].state, expected 121, is %d", - check_msg->states[16].state); - ck_assert_msg( - (check_msg->states[17].cn0 * 100 - 3111.19995117 * 100) < 0.05, - "incorrect value for states[17].cn0, expected 3111.19995117, is %f", - check_msg->states[17].cn0); - ck_assert_msg(check_msg->states[17].sid.code == 63, - "incorrect value for states[17].sid.code, expected 63, is %d", - check_msg->states[17].sid.code); - ck_assert_msg( - check_msg->states[17].sid.reserved == 176, - "incorrect value for states[17].sid.reserved, expected 176, is %d", - check_msg->states[17].sid.reserved); - ck_assert_msg( - check_msg->states[17].sid.sat == 13813, - "incorrect value for states[17].sid.sat, expected 13813, is %d", - check_msg->states[17].sid.sat); - ck_assert_msg(check_msg->states[17].state == 128, - "incorrect value for states[17].state, expected 128, is %d", - check_msg->states[17].state); - ck_assert_msg( - (check_msg->states[18].cn0 * 100 - 4297.20019531 * 100) < 0.05, - "incorrect value for states[18].cn0, expected 4297.20019531, is %f", - check_msg->states[18].cn0); - ck_assert_msg( - check_msg->states[18].sid.code == 153, - "incorrect value for states[18].sid.code, expected 153, is %d", - check_msg->states[18].sid.code); - ck_assert_msg( - check_msg->states[18].sid.reserved == 51, - "incorrect value for states[18].sid.reserved, expected 51, is %d", - check_msg->states[18].sid.reserved); - ck_assert_msg( - check_msg->states[18].sid.sat == 15636, - "incorrect value for states[18].sid.sat, expected 15636, is %d", - check_msg->states[18].sid.sat); - ck_assert_msg(check_msg->states[18].state == 36, - "incorrect value for states[18].state, expected 36, is %d", - check_msg->states[18].state); - ck_assert_msg( - (check_msg->states[19].cn0 * 100 - 2649.19995117 * 100) < 0.05, - "incorrect value for states[19].cn0, expected 2649.19995117, is %f", - check_msg->states[19].cn0); - ck_assert_msg( - check_msg->states[19].sid.code == 140, - "incorrect value for states[19].sid.code, expected 140, is %d", - check_msg->states[19].sid.code); - ck_assert_msg( - check_msg->states[19].sid.reserved == 22, - "incorrect value for states[19].sid.reserved, expected 22, is %d", - check_msg->states[19].sid.reserved); - ck_assert_msg( - check_msg->states[19].sid.sat == 29778, - "incorrect value for states[19].sid.sat, expected 29778, is %d", - check_msg->states[19].sid.sat); - ck_assert_msg(check_msg->states[19].state == 46, - "incorrect value for states[19].state, expected 46, is %d", - check_msg->states[19].state); - ck_assert_msg( - (check_msg->states[20].cn0 * 100 - 941.200012207 * 100) < 0.05, - "incorrect value for states[20].cn0, expected 941.200012207, is %f", - check_msg->states[20].cn0); - ck_assert_msg(check_msg->states[20].sid.code == 96, - "incorrect value for states[20].sid.code, expected 96, is %d", - check_msg->states[20].sid.code); - ck_assert_msg( - check_msg->states[20].sid.reserved == 143, - "incorrect value for states[20].sid.reserved, expected 143, is %d", - check_msg->states[20].sid.reserved); - ck_assert_msg( - check_msg->states[20].sid.sat == 37443, - "incorrect value for states[20].sid.sat, expected 37443, is %d", - check_msg->states[20].sid.sat); - ck_assert_msg(check_msg->states[20].state == 177, - "incorrect value for states[20].state, expected 177, is %d", - check_msg->states[20].state); - ck_assert_msg( - (check_msg->states[21].cn0 * 100 - 1539.19995117 * 100) < 0.05, - "incorrect value for states[21].cn0, expected 1539.19995117, is %f", - check_msg->states[21].cn0); - ck_assert_msg( - check_msg->states[21].sid.code == 201, - "incorrect value for states[21].sid.code, expected 201, is %d", - check_msg->states[21].sid.code); - ck_assert_msg( - check_msg->states[21].sid.reserved == 251, - "incorrect value for states[21].sid.reserved, expected 251, is %d", - check_msg->states[21].sid.reserved); - ck_assert_msg( - check_msg->states[21].sid.sat == 41011, - "incorrect value for states[21].sid.sat, expected 41011, is %d", - check_msg->states[21].sid.sat); - ck_assert_msg(check_msg->states[21].state == 220, - "incorrect value for states[21].state, expected 220, is %d", - check_msg->states[21].state); - ck_assert_msg( - (check_msg->states[22].cn0 * 100 - 1443.19995117 * 100) < 0.05, - "incorrect value for states[22].cn0, expected 1443.19995117, is %f", - check_msg->states[22].cn0); - ck_assert_msg( - check_msg->states[22].sid.code == 161, - "incorrect value for states[22].sid.code, expected 161, is %d", - check_msg->states[22].sid.code); - ck_assert_msg( - check_msg->states[22].sid.reserved == 220, - "incorrect value for states[22].sid.reserved, expected 220, is %d", - check_msg->states[22].sid.reserved); - ck_assert_msg(check_msg->states[22].sid.sat == 706, - "incorrect value for states[22].sid.sat, expected 706, is %d", - check_msg->states[22].sid.sat); - ck_assert_msg(check_msg->states[22].state == 168, - "incorrect value for states[22].state, expected 168, is %d", - check_msg->states[22].state); - ck_assert_msg( - (check_msg->states[23].cn0 * 100 - 1074.19995117 * 100) < 0.05, - "incorrect value for states[23].cn0, expected 1074.19995117, is %f", - check_msg->states[23].cn0); - ck_assert_msg( - check_msg->states[23].sid.code == 125, - "incorrect value for states[23].sid.code, expected 125, is %d", - check_msg->states[23].sid.code); - ck_assert_msg( - check_msg->states[23].sid.reserved == 178, - "incorrect value for states[23].sid.reserved, expected 178, is %d", - check_msg->states[23].sid.reserved); - ck_assert_msg( - check_msg->states[23].sid.sat == 2312, - "incorrect value for states[23].sid.sat, expected 2312, is %d", - check_msg->states[23].sid.sat); - ck_assert_msg(check_msg->states[23].state == 69, - "incorrect value for states[23].state, expected 69, is %d", - check_msg->states[23].state); - ck_assert_msg( - (check_msg->states[24].cn0 * 100 - 2122.19995117 * 100) < 0.05, - "incorrect value for states[24].cn0, expected 2122.19995117, is %f", - check_msg->states[24].cn0); - ck_assert_msg( - check_msg->states[24].sid.code == 186, - "incorrect value for states[24].sid.code, expected 186, is %d", - check_msg->states[24].sid.code); - ck_assert_msg( - check_msg->states[24].sid.reserved == 171, - "incorrect value for states[24].sid.reserved, expected 171, is %d", - check_msg->states[24].sid.reserved); - ck_assert_msg( - check_msg->states[24].sid.sat == 34580, - "incorrect value for states[24].sid.sat, expected 34580, is %d", - check_msg->states[24].sid.sat); - ck_assert_msg(check_msg->states[24].state == 185, - "incorrect value for states[24].state, expected 185, is %d", - check_msg->states[24].state); - ck_assert_msg( - (check_msg->states[25].cn0 * 100 - 9076.20019531 * 100) < 0.05, - "incorrect value for states[25].cn0, expected 9076.20019531, is %f", - check_msg->states[25].cn0); - ck_assert_msg(check_msg->states[25].sid.code == 85, - "incorrect value for states[25].sid.code, expected 85, is %d", - check_msg->states[25].sid.code); - ck_assert_msg( - check_msg->states[25].sid.reserved == 170, - "incorrect value for states[25].sid.reserved, expected 170, is %d", - check_msg->states[25].sid.reserved); - ck_assert_msg( - check_msg->states[25].sid.sat == 39804, - "incorrect value for states[25].sid.sat, expected 39804, is %d", - check_msg->states[25].sid.sat); - ck_assert_msg(check_msg->states[25].state == 18, - "incorrect value for states[25].state, expected 18, is %d", - check_msg->states[25].state); - ck_assert_msg( - (check_msg->states[26].cn0 * 100 - 4781.20019531 * 100) < 0.05, - "incorrect value for states[26].cn0, expected 4781.20019531, is %f", - check_msg->states[26].cn0); - ck_assert_msg( - check_msg->states[26].sid.code == 255, - "incorrect value for states[26].sid.code, expected 255, is %d", - check_msg->states[26].sid.code); - ck_assert_msg( - check_msg->states[26].sid.reserved == 186, - "incorrect value for states[26].sid.reserved, expected 186, is %d", - check_msg->states[26].sid.reserved); - ck_assert_msg( - check_msg->states[26].sid.sat == 52980, - "incorrect value for states[26].sid.sat, expected 52980, is %d", - check_msg->states[26].sid.sat); - ck_assert_msg(check_msg->states[26].state == 57, - "incorrect value for states[26].state, expected 57, is %d", - check_msg->states[26].state); - ck_assert_msg( - (check_msg->states[27].cn0 * 100 - 3076.19995117 * 100) < 0.05, - "incorrect value for states[27].cn0, expected 3076.19995117, is %f", - check_msg->states[27].cn0); - ck_assert_msg( - check_msg->states[27].sid.code == 181, - "incorrect value for states[27].sid.code, expected 181, is %d", - check_msg->states[27].sid.code); - ck_assert_msg( - check_msg->states[27].sid.reserved == 175, - "incorrect value for states[27].sid.reserved, expected 175, is %d", - check_msg->states[27].sid.reserved); - ck_assert_msg( - check_msg->states[27].sid.sat == 24007, - "incorrect value for states[27].sid.sat, expected 24007, is %d", - check_msg->states[27].sid.sat); - ck_assert_msg(check_msg->states[27].state == 165, - "incorrect value for states[27].state, expected 165, is %d", - check_msg->states[27].state); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_tracking_MsgTrackingStateDepB_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_tracking_MsgTrackingStateDepB"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_tracking_MsgTrackingStateDepB"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_tracking_MsgTrackingStateDepB); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_tracking_MsgTrackingStateDetailedDep.c b/c/test/legacy/auto_check_sbp_tracking_MsgTrackingStateDetailedDep.c deleted file mode 100644 index 9539bd50b1..0000000000 --- a/c/test/legacy/auto_check_sbp_tracking_MsgTrackingStateDetailedDep.c +++ /dev/null @@ -1,1065 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgTrackingStateDetailedDep.yaml -// by generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x11, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x11, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 17, 0, 59, 103, 55, 163, 151, 112, 215, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 5, 0, 0, 169, 177, - 208, 54, 15, 0, 0, 0, 85, 61, 0, 0, 39, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 108, 1, 0, 11, 0, 0, 9, 166, 214, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_detailed_dep_t* test_msg = - (msg_tracking_state_detailed_dep_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->L.f = 169; - test_msg->L.i = 1319; - test_msg->P = 0; - test_msg->P_std = 0; - test_msg->acceleration = 108; - test_msg->clock_drift = 0; - test_msg->clock_offset = 0; - test_msg->cn0 = 177; - test_msg->corr_spacing = 40; - test_msg->doppler = 15701; - test_msg->doppler_std = 39; - test_msg->lock = 14032; - test_msg->misc_flags = 9; - test_msg->nav_flags = 0; - test_msg->pset_flags = 0; - test_msg->recv_time = 7909447587; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 15; - test_msg->sync_flags = 1; - test_msg->tot.tow = 0; - test_msg->tot.wn = 0; - test_msg->tow_flags = 0; - test_msg->track_flags = 11; - test_msg->uptime = 1; - sbp_payload_send(&sbp_state, 0x11, 26427, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 26427, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 26427, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x11, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_detailed_dep_t* check_msg = - (msg_tracking_state_detailed_dep_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->L.f == 169, - "incorrect value for L.f, expected 169, is %d", - check_msg->L.f); - ck_assert_msg(check_msg->L.i == 1319, - "incorrect value for L.i, expected 1319, is %d", - check_msg->L.i); - ck_assert_msg(check_msg->P == 0, "incorrect value for P, expected 0, is %d", - check_msg->P); - ck_assert_msg(check_msg->P_std == 0, - "incorrect value for P_std, expected 0, is %d", - check_msg->P_std); - ck_assert_msg(check_msg->acceleration == 108, - "incorrect value for acceleration, expected 108, is %d", - check_msg->acceleration); - ck_assert_msg(check_msg->clock_drift == 0, - "incorrect value for clock_drift, expected 0, is %d", - check_msg->clock_drift); - ck_assert_msg(check_msg->clock_offset == 0, - "incorrect value for clock_offset, expected 0, is %d", - check_msg->clock_offset); - ck_assert_msg(check_msg->cn0 == 177, - "incorrect value for cn0, expected 177, is %d", - check_msg->cn0); - ck_assert_msg(check_msg->corr_spacing == 40, - "incorrect value for corr_spacing, expected 40, is %d", - check_msg->corr_spacing); - ck_assert_msg(check_msg->doppler == 15701, - "incorrect value for doppler, expected 15701, is %d", - check_msg->doppler); - ck_assert_msg(check_msg->doppler_std == 39, - "incorrect value for doppler_std, expected 39, is %d", - check_msg->doppler_std); - ck_assert_msg(check_msg->lock == 14032, - "incorrect value for lock, expected 14032, is %d", - check_msg->lock); - ck_assert_msg(check_msg->misc_flags == 9, - "incorrect value for misc_flags, expected 9, is %d", - check_msg->misc_flags); - ck_assert_msg(check_msg->nav_flags == 0, - "incorrect value for nav_flags, expected 0, is %d", - check_msg->nav_flags); - ck_assert_msg(check_msg->pset_flags == 0, - "incorrect value for pset_flags, expected 0, is %d", - check_msg->pset_flags); - ck_assert_msg(check_msg->recv_time == 7909447587, - "incorrect value for recv_time, expected 7909447587, is %d", - check_msg->recv_time); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 15, - "incorrect value for sid.sat, expected 15, is %d", - check_msg->sid.sat); - ck_assert_msg(check_msg->sync_flags == 1, - "incorrect value for sync_flags, expected 1, is %d", - check_msg->sync_flags); - ck_assert_msg(check_msg->tot.tow == 0, - "incorrect value for tot.tow, expected 0, is %d", - check_msg->tot.tow); - ck_assert_msg(check_msg->tot.wn == 0, - "incorrect value for tot.wn, expected 0, is %d", - check_msg->tot.wn); - ck_assert_msg(check_msg->tow_flags == 0, - "incorrect value for tow_flags, expected 0, is %d", - check_msg->tow_flags); - ck_assert_msg(check_msg->track_flags == 11, - "incorrect value for track_flags, expected 11, is %d", - check_msg->track_flags); - ck_assert_msg(check_msg->uptime == 1, - "incorrect value for uptime, expected 1, is %d", - check_msg->uptime); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x11, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x11, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 17, 0, 59, 103, 55, 97, 251, 61, 245, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 7, 0, 0, 14, 175, - 208, 54, 15, 0, 0, 0, 51, 61, 0, 0, 30, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 224, 1, 0, 11, 0, 0, 9, 136, 179, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_detailed_dep_t* test_msg = - (msg_tracking_state_detailed_dep_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->L.f = 14; - test_msg->L.i = 1810; - test_msg->P = 0; - test_msg->P_std = 0; - test_msg->acceleration = -32; - test_msg->clock_drift = 0; - test_msg->clock_offset = 0; - test_msg->cn0 = 175; - test_msg->corr_spacing = 40; - test_msg->doppler = 15667; - test_msg->doppler_std = 30; - test_msg->lock = 14032; - test_msg->misc_flags = 9; - test_msg->nav_flags = 0; - test_msg->pset_flags = 0; - test_msg->recv_time = 8409447265; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 15; - test_msg->sync_flags = 1; - test_msg->tot.tow = 0; - test_msg->tot.wn = 0; - test_msg->tow_flags = 0; - test_msg->track_flags = 11; - test_msg->uptime = 1; - sbp_payload_send(&sbp_state, 0x11, 26427, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 26427, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 26427, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x11, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_detailed_dep_t* check_msg = - (msg_tracking_state_detailed_dep_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->L.f == 14, - "incorrect value for L.f, expected 14, is %d", - check_msg->L.f); - ck_assert_msg(check_msg->L.i == 1810, - "incorrect value for L.i, expected 1810, is %d", - check_msg->L.i); - ck_assert_msg(check_msg->P == 0, "incorrect value for P, expected 0, is %d", - check_msg->P); - ck_assert_msg(check_msg->P_std == 0, - "incorrect value for P_std, expected 0, is %d", - check_msg->P_std); - ck_assert_msg(check_msg->acceleration == -32, - "incorrect value for acceleration, expected -32, is %d", - check_msg->acceleration); - ck_assert_msg(check_msg->clock_drift == 0, - "incorrect value for clock_drift, expected 0, is %d", - check_msg->clock_drift); - ck_assert_msg(check_msg->clock_offset == 0, - "incorrect value for clock_offset, expected 0, is %d", - check_msg->clock_offset); - ck_assert_msg(check_msg->cn0 == 175, - "incorrect value for cn0, expected 175, is %d", - check_msg->cn0); - ck_assert_msg(check_msg->corr_spacing == 40, - "incorrect value for corr_spacing, expected 40, is %d", - check_msg->corr_spacing); - ck_assert_msg(check_msg->doppler == 15667, - "incorrect value for doppler, expected 15667, is %d", - check_msg->doppler); - ck_assert_msg(check_msg->doppler_std == 30, - "incorrect value for doppler_std, expected 30, is %d", - check_msg->doppler_std); - ck_assert_msg(check_msg->lock == 14032, - "incorrect value for lock, expected 14032, is %d", - check_msg->lock); - ck_assert_msg(check_msg->misc_flags == 9, - "incorrect value for misc_flags, expected 9, is %d", - check_msg->misc_flags); - ck_assert_msg(check_msg->nav_flags == 0, - "incorrect value for nav_flags, expected 0, is %d", - check_msg->nav_flags); - ck_assert_msg(check_msg->pset_flags == 0, - "incorrect value for pset_flags, expected 0, is %d", - check_msg->pset_flags); - ck_assert_msg(check_msg->recv_time == 8409447265, - "incorrect value for recv_time, expected 8409447265, is %d", - check_msg->recv_time); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 15, - "incorrect value for sid.sat, expected 15, is %d", - check_msg->sid.sat); - ck_assert_msg(check_msg->sync_flags == 1, - "incorrect value for sync_flags, expected 1, is %d", - check_msg->sync_flags); - ck_assert_msg(check_msg->tot.tow == 0, - "incorrect value for tot.tow, expected 0, is %d", - check_msg->tot.tow); - ck_assert_msg(check_msg->tot.wn == 0, - "incorrect value for tot.wn, expected 0, is %d", - check_msg->tot.wn); - ck_assert_msg(check_msg->tow_flags == 0, - "incorrect value for tow_flags, expected 0, is %d", - check_msg->tow_flags); - ck_assert_msg(check_msg->track_flags == 11, - "incorrect value for track_flags, expected 11, is %d", - check_msg->track_flags); - ck_assert_msg(check_msg->uptime == 1, - "incorrect value for uptime, expected 1, is %d", - check_msg->uptime); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x11, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x11, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 17, 0, 59, 103, 55, 139, 218, 236, 18, 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 250, 8, 0, 0, 8, 179, - 208, 54, 15, 0, 0, 0, 67, 61, 0, 0, 22, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 27, 1, 0, 11, 0, 2, 9, 217, 159, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_detailed_dep_t* test_msg = - (msg_tracking_state_detailed_dep_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->L.f = 8; - test_msg->L.i = 2298; - test_msg->P = 0; - test_msg->P_std = 0; - test_msg->acceleration = 27; - test_msg->clock_drift = 0; - test_msg->clock_offset = 0; - test_msg->cn0 = 179; - test_msg->corr_spacing = 40; - test_msg->doppler = 15683; - test_msg->doppler_std = 22; - test_msg->lock = 14032; - test_msg->misc_flags = 9; - test_msg->nav_flags = 0; - test_msg->pset_flags = 2; - test_msg->recv_time = 8907446923; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 15; - test_msg->sync_flags = 1; - test_msg->tot.tow = 0; - test_msg->tot.wn = 0; - test_msg->tow_flags = 0; - test_msg->track_flags = 11; - test_msg->uptime = 2; - sbp_payload_send(&sbp_state, 0x11, 26427, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 26427, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 26427, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x11, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_detailed_dep_t* check_msg = - (msg_tracking_state_detailed_dep_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->L.f == 8, - "incorrect value for L.f, expected 8, is %d", check_msg->L.f); - ck_assert_msg(check_msg->L.i == 2298, - "incorrect value for L.i, expected 2298, is %d", - check_msg->L.i); - ck_assert_msg(check_msg->P == 0, "incorrect value for P, expected 0, is %d", - check_msg->P); - ck_assert_msg(check_msg->P_std == 0, - "incorrect value for P_std, expected 0, is %d", - check_msg->P_std); - ck_assert_msg(check_msg->acceleration == 27, - "incorrect value for acceleration, expected 27, is %d", - check_msg->acceleration); - ck_assert_msg(check_msg->clock_drift == 0, - "incorrect value for clock_drift, expected 0, is %d", - check_msg->clock_drift); - ck_assert_msg(check_msg->clock_offset == 0, - "incorrect value for clock_offset, expected 0, is %d", - check_msg->clock_offset); - ck_assert_msg(check_msg->cn0 == 179, - "incorrect value for cn0, expected 179, is %d", - check_msg->cn0); - ck_assert_msg(check_msg->corr_spacing == 40, - "incorrect value for corr_spacing, expected 40, is %d", - check_msg->corr_spacing); - ck_assert_msg(check_msg->doppler == 15683, - "incorrect value for doppler, expected 15683, is %d", - check_msg->doppler); - ck_assert_msg(check_msg->doppler_std == 22, - "incorrect value for doppler_std, expected 22, is %d", - check_msg->doppler_std); - ck_assert_msg(check_msg->lock == 14032, - "incorrect value for lock, expected 14032, is %d", - check_msg->lock); - ck_assert_msg(check_msg->misc_flags == 9, - "incorrect value for misc_flags, expected 9, is %d", - check_msg->misc_flags); - ck_assert_msg(check_msg->nav_flags == 0, - "incorrect value for nav_flags, expected 0, is %d", - check_msg->nav_flags); - ck_assert_msg(check_msg->pset_flags == 2, - "incorrect value for pset_flags, expected 2, is %d", - check_msg->pset_flags); - ck_assert_msg(check_msg->recv_time == 8907446923, - "incorrect value for recv_time, expected 8907446923, is %d", - check_msg->recv_time); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 15, - "incorrect value for sid.sat, expected 15, is %d", - check_msg->sid.sat); - ck_assert_msg(check_msg->sync_flags == 1, - "incorrect value for sync_flags, expected 1, is %d", - check_msg->sync_flags); - ck_assert_msg(check_msg->tot.tow == 0, - "incorrect value for tot.tow, expected 0, is %d", - check_msg->tot.tow); - ck_assert_msg(check_msg->tot.wn == 0, - "incorrect value for tot.wn, expected 0, is %d", - check_msg->tot.wn); - ck_assert_msg(check_msg->tow_flags == 0, - "incorrect value for tow_flags, expected 0, is %d", - check_msg->tow_flags); - ck_assert_msg(check_msg->track_flags == 11, - "incorrect value for track_flags, expected 11, is %d", - check_msg->track_flags); - ck_assert_msg(check_msg->uptime == 2, - "incorrect value for uptime, expected 2, is %d", - check_msg->uptime); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x11, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x11, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 17, 0, 59, 103, 55, 255, 251, 170, 48, 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 226, 10, 0, 0, 125, 181, - 208, 54, 15, 0, 0, 0, 29, 61, 0, 0, 10, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 220, 1, 0, 11, 0, 3, 9, 66, 95, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_detailed_dep_t* test_msg = - (msg_tracking_state_detailed_dep_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->L.f = 125; - test_msg->L.i = 2786; - test_msg->P = 0; - test_msg->P_std = 0; - test_msg->acceleration = -36; - test_msg->clock_drift = 0; - test_msg->clock_offset = 0; - test_msg->cn0 = 181; - test_msg->corr_spacing = 40; - test_msg->doppler = 15645; - test_msg->doppler_std = 10; - test_msg->lock = 14032; - test_msg->misc_flags = 9; - test_msg->nav_flags = 0; - test_msg->pset_flags = 3; - test_msg->recv_time = 9406446591; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 15; - test_msg->sync_flags = 1; - test_msg->tot.tow = 0; - test_msg->tot.wn = 0; - test_msg->tow_flags = 0; - test_msg->track_flags = 11; - test_msg->uptime = 2; - sbp_payload_send(&sbp_state, 0x11, 26427, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 26427, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 26427, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x11, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_detailed_dep_t* check_msg = - (msg_tracking_state_detailed_dep_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->L.f == 125, - "incorrect value for L.f, expected 125, is %d", - check_msg->L.f); - ck_assert_msg(check_msg->L.i == 2786, - "incorrect value for L.i, expected 2786, is %d", - check_msg->L.i); - ck_assert_msg(check_msg->P == 0, "incorrect value for P, expected 0, is %d", - check_msg->P); - ck_assert_msg(check_msg->P_std == 0, - "incorrect value for P_std, expected 0, is %d", - check_msg->P_std); - ck_assert_msg(check_msg->acceleration == -36, - "incorrect value for acceleration, expected -36, is %d", - check_msg->acceleration); - ck_assert_msg(check_msg->clock_drift == 0, - "incorrect value for clock_drift, expected 0, is %d", - check_msg->clock_drift); - ck_assert_msg(check_msg->clock_offset == 0, - "incorrect value for clock_offset, expected 0, is %d", - check_msg->clock_offset); - ck_assert_msg(check_msg->cn0 == 181, - "incorrect value for cn0, expected 181, is %d", - check_msg->cn0); - ck_assert_msg(check_msg->corr_spacing == 40, - "incorrect value for corr_spacing, expected 40, is %d", - check_msg->corr_spacing); - ck_assert_msg(check_msg->doppler == 15645, - "incorrect value for doppler, expected 15645, is %d", - check_msg->doppler); - ck_assert_msg(check_msg->doppler_std == 10, - "incorrect value for doppler_std, expected 10, is %d", - check_msg->doppler_std); - ck_assert_msg(check_msg->lock == 14032, - "incorrect value for lock, expected 14032, is %d", - check_msg->lock); - ck_assert_msg(check_msg->misc_flags == 9, - "incorrect value for misc_flags, expected 9, is %d", - check_msg->misc_flags); - ck_assert_msg(check_msg->nav_flags == 0, - "incorrect value for nav_flags, expected 0, is %d", - check_msg->nav_flags); - ck_assert_msg(check_msg->pset_flags == 3, - "incorrect value for pset_flags, expected 3, is %d", - check_msg->pset_flags); - ck_assert_msg(check_msg->recv_time == 9406446591, - "incorrect value for recv_time, expected 9406446591, is %d", - check_msg->recv_time); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 15, - "incorrect value for sid.sat, expected 15, is %d", - check_msg->sid.sat); - ck_assert_msg(check_msg->sync_flags == 1, - "incorrect value for sync_flags, expected 1, is %d", - check_msg->sync_flags); - ck_assert_msg(check_msg->tot.tow == 0, - "incorrect value for tot.tow, expected 0, is %d", - check_msg->tot.tow); - ck_assert_msg(check_msg->tot.wn == 0, - "incorrect value for tot.wn, expected 0, is %d", - check_msg->tot.wn); - ck_assert_msg(check_msg->tow_flags == 0, - "incorrect value for tow_flags, expected 0, is %d", - check_msg->tow_flags); - ck_assert_msg(check_msg->track_flags == 11, - "incorrect value for track_flags, expected 11, is %d", - check_msg->track_flags); - ck_assert_msg(check_msg->uptime == 2, - "incorrect value for uptime, expected 2, is %d", - check_msg->uptime); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x11, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x11, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 17, 0, 59, 103, 55, 189, 95, 120, 78, 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 203, 12, 0, 0, 64, 184, - 208, 54, 15, 0, 0, 0, 24, 61, 0, 0, 4, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 2, 1, 0, 11, 0, 3, 9, 194, 206, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_detailed_dep_t* test_msg = - (msg_tracking_state_detailed_dep_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->L.f = 64; - test_msg->L.i = 3275; - test_msg->P = 0; - test_msg->P_std = 0; - test_msg->acceleration = 2; - test_msg->clock_drift = 0; - test_msg->clock_offset = 0; - test_msg->cn0 = 184; - test_msg->corr_spacing = 40; - test_msg->doppler = 15640; - test_msg->doppler_std = 4; - test_msg->lock = 14032; - test_msg->misc_flags = 9; - test_msg->nav_flags = 0; - test_msg->pset_flags = 3; - test_msg->recv_time = 9906446269; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 15; - test_msg->sync_flags = 1; - test_msg->tot.tow = 0; - test_msg->tot.wn = 0; - test_msg->tow_flags = 0; - test_msg->track_flags = 11; - test_msg->uptime = 3; - sbp_payload_send(&sbp_state, 0x11, 26427, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 26427, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 26427, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x11, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_detailed_dep_t* check_msg = - (msg_tracking_state_detailed_dep_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->L.f == 64, - "incorrect value for L.f, expected 64, is %d", - check_msg->L.f); - ck_assert_msg(check_msg->L.i == 3275, - "incorrect value for L.i, expected 3275, is %d", - check_msg->L.i); - ck_assert_msg(check_msg->P == 0, "incorrect value for P, expected 0, is %d", - check_msg->P); - ck_assert_msg(check_msg->P_std == 0, - "incorrect value for P_std, expected 0, is %d", - check_msg->P_std); - ck_assert_msg(check_msg->acceleration == 2, - "incorrect value for acceleration, expected 2, is %d", - check_msg->acceleration); - ck_assert_msg(check_msg->clock_drift == 0, - "incorrect value for clock_drift, expected 0, is %d", - check_msg->clock_drift); - ck_assert_msg(check_msg->clock_offset == 0, - "incorrect value for clock_offset, expected 0, is %d", - check_msg->clock_offset); - ck_assert_msg(check_msg->cn0 == 184, - "incorrect value for cn0, expected 184, is %d", - check_msg->cn0); - ck_assert_msg(check_msg->corr_spacing == 40, - "incorrect value for corr_spacing, expected 40, is %d", - check_msg->corr_spacing); - ck_assert_msg(check_msg->doppler == 15640, - "incorrect value for doppler, expected 15640, is %d", - check_msg->doppler); - ck_assert_msg(check_msg->doppler_std == 4, - "incorrect value for doppler_std, expected 4, is %d", - check_msg->doppler_std); - ck_assert_msg(check_msg->lock == 14032, - "incorrect value for lock, expected 14032, is %d", - check_msg->lock); - ck_assert_msg(check_msg->misc_flags == 9, - "incorrect value for misc_flags, expected 9, is %d", - check_msg->misc_flags); - ck_assert_msg(check_msg->nav_flags == 0, - "incorrect value for nav_flags, expected 0, is %d", - check_msg->nav_flags); - ck_assert_msg(check_msg->pset_flags == 3, - "incorrect value for pset_flags, expected 3, is %d", - check_msg->pset_flags); - ck_assert_msg(check_msg->recv_time == 9906446269, - "incorrect value for recv_time, expected 9906446269, is %d", - check_msg->recv_time); - ck_assert_msg(check_msg->sid.code == 0, - "incorrect value for sid.code, expected 0, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.reserved == 0, - "incorrect value for sid.reserved, expected 0, is %d", - check_msg->sid.reserved); - ck_assert_msg(check_msg->sid.sat == 15, - "incorrect value for sid.sat, expected 15, is %d", - check_msg->sid.sat); - ck_assert_msg(check_msg->sync_flags == 1, - "incorrect value for sync_flags, expected 1, is %d", - check_msg->sync_flags); - ck_assert_msg(check_msg->tot.tow == 0, - "incorrect value for tot.tow, expected 0, is %d", - check_msg->tot.tow); - ck_assert_msg(check_msg->tot.wn == 0, - "incorrect value for tot.wn, expected 0, is %d", - check_msg->tot.wn); - ck_assert_msg(check_msg->tow_flags == 0, - "incorrect value for tow_flags, expected 0, is %d", - check_msg->tow_flags); - ck_assert_msg(check_msg->track_flags == 11, - "incorrect value for track_flags, expected 11, is %d", - check_msg->track_flags); - ck_assert_msg(check_msg->uptime == 3, - "incorrect value for uptime, expected 3, is %d", - check_msg->uptime); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_tracking_" - "MsgTrackingStateDetailedDep"); - tcase_add_test( - tc_acq, test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_tracking_MsgTrackingStateDetailedDepA.c b/c/test/legacy/auto_check_sbp_tracking_MsgTrackingStateDetailedDepA.c deleted file mode 100644 index b0a9009578..0000000000 --- a/c/test/legacy/auto_check_sbp_tracking_MsgTrackingStateDetailedDepA.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgTrackingStateDetailedDepA.yaml -// by generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x21, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x21, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 33, 0, 155, 110, 57, 46, 31, 180, 38, 219, 0, 0, - 0, 133, 100, 71, 94, 192, 2, 160, 207, 212, 255, 135, 139, - 62, 62, 179, 83, 227, 245, 134, 160, 204, 78, 95, 255, 38, - 59, 161, 15, 255, 86, 189, 248, 31, 191, 136, 194, 124, 23, - 15, 91, 249, 117, 142, 90, 219, 67, 25, 83, 62, 122, 100, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_detailed_dep_a_t *test_msg = - (msg_tracking_state_detailed_dep_a_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->L.f = 204; - test_msg->L.i = -1601767965; - test_msg->P = 1044286343; - test_msg->P_std = 21427; - test_msg->acceleration = -114; - test_msg->clock_drift = 23311; - test_msg->clock_offset = 6012; - test_msg->cn0 = 78; - test_msg->corr_spacing = 30201; - test_msg->doppler = 1459556257; - test_msg->doppler_std = 63677; - test_msg->lock = 65375; - test_msg->misc_flags = 62; - test_msg->nav_flags = 25; - test_msg->pset_flags = 83; - test_msg->recv_time = 941247176494; - test_msg->sid.code = 59; - test_msg->sid.sat = 38; - test_msg->sync_flags = 90; - test_msg->tot.ns_residual = -811597120; - test_msg->tot.tow = 1581737093; - test_msg->tot.wn = 65492; - test_msg->tow_flags = 219; - test_msg->track_flags = 67; - test_msg->uptime = 3263741727; - sbp_payload_send(&sbp_state, 0x21, 28315, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 28315, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 28315, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x21, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_detailed_dep_a_t *check_msg = - (msg_tracking_state_detailed_dep_a_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->L.f == 204, - "incorrect value for L.f, expected 204, is %d", - check_msg->L.f); - ck_assert_msg(check_msg->L.i == -1601767965, - "incorrect value for L.i, expected -1601767965, is %d", - check_msg->L.i); - ck_assert_msg(check_msg->P == 1044286343, - "incorrect value for P, expected 1044286343, is %d", - check_msg->P); - ck_assert_msg(check_msg->P_std == 21427, - "incorrect value for P_std, expected 21427, is %d", - check_msg->P_std); - ck_assert_msg(check_msg->acceleration == -114, - "incorrect value for acceleration, expected -114, is %d", - check_msg->acceleration); - ck_assert_msg(check_msg->clock_drift == 23311, - "incorrect value for clock_drift, expected 23311, is %d", - check_msg->clock_drift); - ck_assert_msg(check_msg->clock_offset == 6012, - "incorrect value for clock_offset, expected 6012, is %d", - check_msg->clock_offset); - ck_assert_msg(check_msg->cn0 == 78, - "incorrect value for cn0, expected 78, is %d", - check_msg->cn0); - ck_assert_msg(check_msg->corr_spacing == 30201, - "incorrect value for corr_spacing, expected 30201, is %d", - check_msg->corr_spacing); - ck_assert_msg(check_msg->doppler == 1459556257, - "incorrect value for doppler, expected 1459556257, is %d", - check_msg->doppler); - ck_assert_msg(check_msg->doppler_std == 63677, - "incorrect value for doppler_std, expected 63677, is %d", - check_msg->doppler_std); - ck_assert_msg(check_msg->lock == 65375, - "incorrect value for lock, expected 65375, is %d", - check_msg->lock); - ck_assert_msg(check_msg->misc_flags == 62, - "incorrect value for misc_flags, expected 62, is %d", - check_msg->misc_flags); - ck_assert_msg(check_msg->nav_flags == 25, - "incorrect value for nav_flags, expected 25, is %d", - check_msg->nav_flags); - ck_assert_msg(check_msg->pset_flags == 83, - "incorrect value for pset_flags, expected 83, is %d", - check_msg->pset_flags); - ck_assert_msg(check_msg->recv_time == 941247176494, - "incorrect value for recv_time, expected 941247176494, is %d", - check_msg->recv_time); - ck_assert_msg(check_msg->sid.code == 59, - "incorrect value for sid.code, expected 59, is %d", - check_msg->sid.code); - ck_assert_msg(check_msg->sid.sat == 38, - "incorrect value for sid.sat, expected 38, is %d", - check_msg->sid.sat); - ck_assert_msg(check_msg->sync_flags == 90, - "incorrect value for sync_flags, expected 90, is %d", - check_msg->sync_flags); - ck_assert_msg( - check_msg->tot.ns_residual == -811597120, - "incorrect value for tot.ns_residual, expected -811597120, is %d", - check_msg->tot.ns_residual); - ck_assert_msg(check_msg->tot.tow == 1581737093, - "incorrect value for tot.tow, expected 1581737093, is %d", - check_msg->tot.tow); - ck_assert_msg(check_msg->tot.wn == 65492, - "incorrect value for tot.wn, expected 65492, is %d", - check_msg->tot.wn); - ck_assert_msg(check_msg->tow_flags == 219, - "incorrect value for tow_flags, expected 219, is %d", - check_msg->tow_flags); - ck_assert_msg(check_msg->track_flags == 67, - "incorrect value for track_flags, expected 67, is %d", - check_msg->track_flags); - ck_assert_msg(check_msg->uptime == 3263741727, - "incorrect value for uptime, expected 3263741727, is %d", - check_msg->uptime); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDepA_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDepA"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_tracking_" - "MsgTrackingStateDetailedDepA"); - tcase_add_test( - tc_acq, test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_tracking_MsgtrackingStateDepA.c b/c/test/legacy/auto_check_sbp_tracking_MsgtrackingStateDepA.c deleted file mode 100644 index 7ed5888ea8..0000000000 --- a/c/test/legacy/auto_check_sbp_tracking_MsgtrackingStateDepA.c +++ /dev/null @@ -1,1760 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgtrackingStateDepA.yaml by -// generate.py. Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void* context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void* context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8* buff, u32 n, void* context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void* context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x16, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x16, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 22, 0, 195, 4, 66, 1, 0, 204, 177, 51, 65, 1, - 2, 198, 4, 39, 65, 1, 3, 219, 182, 27, 65, 1, 7, - 132, 120, 101, 65, 1, 10, 91, 91, 251, 64, 1, 13, 42, - 37, 163, 64, 1, 22, 130, 184, 215, 64, 1, 30, 115, 53, - 75, 65, 1, 31, 16, 74, 126, 65, 1, 25, 132, 196, 135, - 64, 1, 6, 100, 59, 223, 64, 17, 225, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_dep_a_t* test_msg = - (msg_tracking_state_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[0].cn0 = 11.230907440185547; - test_msg->states[0].prn = 0; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[1].cn0 = 10.438665390014648; - test_msg->states[1].prn = 2; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[2].cn0 = 9.732142448425293; - test_msg->states[2].prn = 3; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[3].cn0 = 14.341922760009766; - test_msg->states[3].prn = 7; - test_msg->states[3].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[4].cn0 = 7.8549017906188965; - test_msg->states[4].prn = 10; - test_msg->states[4].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[5].cn0 = 5.0982866287231445; - test_msg->states[5].prn = 13; - test_msg->states[5].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[6].cn0 = 6.741272926330566; - test_msg->states[6].prn = 22; - test_msg->states[6].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[7].cn0 = 12.700549125671387; - test_msg->states[7].prn = 30; - test_msg->states[7].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[8].cn0 = 15.893081665039062; - test_msg->states[8].prn = 31; - test_msg->states[8].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[9].cn0 = 4.242738723754883; - test_msg->states[9].prn = 25; - test_msg->states[9].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[10].cn0 = 6.97599983215332; - test_msg->states[10].prn = 6; - test_msg->states[10].state = 1; - sbp_payload_send(&sbp_state, 0x16, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x16, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_dep_a_t* check_msg = - (msg_tracking_state_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->states[0].cn0 * 100 - 11.2309074402 * 100) < 0.05, - "incorrect value for states[0].cn0, expected 11.2309074402, is %f", - check_msg->states[0].cn0); - ck_assert_msg(check_msg->states[0].prn == 0, - "incorrect value for states[0].prn, expected 0, is %d", - check_msg->states[0].prn); - ck_assert_msg(check_msg->states[0].state == 1, - "incorrect value for states[0].state, expected 1, is %d", - check_msg->states[0].state); - ck_assert_msg( - (check_msg->states[1].cn0 * 100 - 10.43866539 * 100) < 0.05, - "incorrect value for states[1].cn0, expected 10.43866539, is %f", - check_msg->states[1].cn0); - ck_assert_msg(check_msg->states[1].prn == 2, - "incorrect value for states[1].prn, expected 2, is %d", - check_msg->states[1].prn); - ck_assert_msg(check_msg->states[1].state == 1, - "incorrect value for states[1].state, expected 1, is %d", - check_msg->states[1].state); - ck_assert_msg( - (check_msg->states[2].cn0 * 100 - 9.73214244843 * 100) < 0.05, - "incorrect value for states[2].cn0, expected 9.73214244843, is %f", - check_msg->states[2].cn0); - ck_assert_msg(check_msg->states[2].prn == 3, - "incorrect value for states[2].prn, expected 3, is %d", - check_msg->states[2].prn); - ck_assert_msg(check_msg->states[2].state == 1, - "incorrect value for states[2].state, expected 1, is %d", - check_msg->states[2].state); - ck_assert_msg( - (check_msg->states[3].cn0 * 100 - 14.34192276 * 100) < 0.05, - "incorrect value for states[3].cn0, expected 14.34192276, is %f", - check_msg->states[3].cn0); - ck_assert_msg(check_msg->states[3].prn == 7, - "incorrect value for states[3].prn, expected 7, is %d", - check_msg->states[3].prn); - ck_assert_msg(check_msg->states[3].state == 1, - "incorrect value for states[3].state, expected 1, is %d", - check_msg->states[3].state); - ck_assert_msg( - (check_msg->states[4].cn0 * 100 - 7.85490179062 * 100) < 0.05, - "incorrect value for states[4].cn0, expected 7.85490179062, is %f", - check_msg->states[4].cn0); - ck_assert_msg(check_msg->states[4].prn == 10, - "incorrect value for states[4].prn, expected 10, is %d", - check_msg->states[4].prn); - ck_assert_msg(check_msg->states[4].state == 1, - "incorrect value for states[4].state, expected 1, is %d", - check_msg->states[4].state); - ck_assert_msg( - (check_msg->states[5].cn0 * 100 - 5.09828662872 * 100) < 0.05, - "incorrect value for states[5].cn0, expected 5.09828662872, is %f", - check_msg->states[5].cn0); - ck_assert_msg(check_msg->states[5].prn == 13, - "incorrect value for states[5].prn, expected 13, is %d", - check_msg->states[5].prn); - ck_assert_msg(check_msg->states[5].state == 1, - "incorrect value for states[5].state, expected 1, is %d", - check_msg->states[5].state); - ck_assert_msg( - (check_msg->states[6].cn0 * 100 - 6.74127292633 * 100) < 0.05, - "incorrect value for states[6].cn0, expected 6.74127292633, is %f", - check_msg->states[6].cn0); - ck_assert_msg(check_msg->states[6].prn == 22, - "incorrect value for states[6].prn, expected 22, is %d", - check_msg->states[6].prn); - ck_assert_msg(check_msg->states[6].state == 1, - "incorrect value for states[6].state, expected 1, is %d", - check_msg->states[6].state); - ck_assert_msg( - (check_msg->states[7].cn0 * 100 - 12.7005491257 * 100) < 0.05, - "incorrect value for states[7].cn0, expected 12.7005491257, is %f", - check_msg->states[7].cn0); - ck_assert_msg(check_msg->states[7].prn == 30, - "incorrect value for states[7].prn, expected 30, is %d", - check_msg->states[7].prn); - ck_assert_msg(check_msg->states[7].state == 1, - "incorrect value for states[7].state, expected 1, is %d", - check_msg->states[7].state); - ck_assert_msg( - (check_msg->states[8].cn0 * 100 - 15.893081665 * 100) < 0.05, - "incorrect value for states[8].cn0, expected 15.893081665, is %f", - check_msg->states[8].cn0); - ck_assert_msg(check_msg->states[8].prn == 31, - "incorrect value for states[8].prn, expected 31, is %d", - check_msg->states[8].prn); - ck_assert_msg(check_msg->states[8].state == 1, - "incorrect value for states[8].state, expected 1, is %d", - check_msg->states[8].state); - ck_assert_msg( - (check_msg->states[9].cn0 * 100 - 4.24273872375 * 100) < 0.05, - "incorrect value for states[9].cn0, expected 4.24273872375, is %f", - check_msg->states[9].cn0); - ck_assert_msg(check_msg->states[9].prn == 25, - "incorrect value for states[9].prn, expected 25, is %d", - check_msg->states[9].prn); - ck_assert_msg(check_msg->states[9].state == 1, - "incorrect value for states[9].state, expected 1, is %d", - check_msg->states[9].state); - ck_assert_msg( - (check_msg->states[10].cn0 * 100 - 6.97599983215 * 100) < 0.05, - "incorrect value for states[10].cn0, expected 6.97599983215, is %f", - check_msg->states[10].cn0); - ck_assert_msg(check_msg->states[10].prn == 6, - "incorrect value for states[10].prn, expected 6, is %d", - check_msg->states[10].prn); - ck_assert_msg(check_msg->states[10].state == 1, - "incorrect value for states[10].state, expected 1, is %d", - check_msg->states[10].state); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x16, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x16, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 22, 0, 195, 4, 66, 1, 0, 216, 57, 48, 65, 1, 2, 145, - 41, 46, 65, 1, 3, 4, 26, 34, 65, 1, 7, 177, 67, 109, 65, - 1, 10, 61, 80, 249, 64, 1, 13, 250, 199, 155, 64, 1, 22, 55, - 19, 215, 64, 1, 30, 138, 138, 79, 65, 1, 31, 214, 179, 119, 65, - 1, 25, 53, 138, 120, 64, 1, 6, 183, 247, 129, 64, 168, 173, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_dep_a_t* test_msg = - (msg_tracking_state_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[0].cn0 = 11.014122009277344; - test_msg->states[0].prn = 0; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[1].cn0 = 10.885148048400879; - test_msg->states[1].prn = 2; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[2].cn0 = 10.131351470947266; - test_msg->states[2].prn = 3; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[3].cn0 = 14.829026222229004; - test_msg->states[3].prn = 7; - test_msg->states[3].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[4].cn0 = 7.79104471206665; - test_msg->states[4].prn = 10; - test_msg->states[4].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[5].cn0 = 4.868161201477051; - test_msg->states[5].prn = 13; - test_msg->states[5].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[6].cn0 = 6.721095561981201; - test_msg->states[6].prn = 22; - test_msg->states[6].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[7].cn0 = 12.971323013305664; - test_msg->states[7].prn = 30; - test_msg->states[7].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[8].cn0 = 15.481405258178711; - test_msg->states[8].prn = 31; - test_msg->states[8].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[9].cn0 = 3.8834354877471924; - test_msg->states[9].prn = 25; - test_msg->states[9].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[10].cn0 = 4.061488628387451; - test_msg->states[10].prn = 6; - test_msg->states[10].state = 1; - sbp_payload_send(&sbp_state, 0x16, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x16, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_dep_a_t* check_msg = - (msg_tracking_state_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->states[0].cn0 * 100 - 11.0141220093 * 100) < 0.05, - "incorrect value for states[0].cn0, expected 11.0141220093, is %f", - check_msg->states[0].cn0); - ck_assert_msg(check_msg->states[0].prn == 0, - "incorrect value for states[0].prn, expected 0, is %d", - check_msg->states[0].prn); - ck_assert_msg(check_msg->states[0].state == 1, - "incorrect value for states[0].state, expected 1, is %d", - check_msg->states[0].state); - ck_assert_msg( - (check_msg->states[1].cn0 * 100 - 10.8851480484 * 100) < 0.05, - "incorrect value for states[1].cn0, expected 10.8851480484, is %f", - check_msg->states[1].cn0); - ck_assert_msg(check_msg->states[1].prn == 2, - "incorrect value for states[1].prn, expected 2, is %d", - check_msg->states[1].prn); - ck_assert_msg(check_msg->states[1].state == 1, - "incorrect value for states[1].state, expected 1, is %d", - check_msg->states[1].state); - ck_assert_msg( - (check_msg->states[2].cn0 * 100 - 10.1313514709 * 100) < 0.05, - "incorrect value for states[2].cn0, expected 10.1313514709, is %f", - check_msg->states[2].cn0); - ck_assert_msg(check_msg->states[2].prn == 3, - "incorrect value for states[2].prn, expected 3, is %d", - check_msg->states[2].prn); - ck_assert_msg(check_msg->states[2].state == 1, - "incorrect value for states[2].state, expected 1, is %d", - check_msg->states[2].state); - ck_assert_msg( - (check_msg->states[3].cn0 * 100 - 14.8290262222 * 100) < 0.05, - "incorrect value for states[3].cn0, expected 14.8290262222, is %f", - check_msg->states[3].cn0); - ck_assert_msg(check_msg->states[3].prn == 7, - "incorrect value for states[3].prn, expected 7, is %d", - check_msg->states[3].prn); - ck_assert_msg(check_msg->states[3].state == 1, - "incorrect value for states[3].state, expected 1, is %d", - check_msg->states[3].state); - ck_assert_msg( - (check_msg->states[4].cn0 * 100 - 7.79104471207 * 100) < 0.05, - "incorrect value for states[4].cn0, expected 7.79104471207, is %f", - check_msg->states[4].cn0); - ck_assert_msg(check_msg->states[4].prn == 10, - "incorrect value for states[4].prn, expected 10, is %d", - check_msg->states[4].prn); - ck_assert_msg(check_msg->states[4].state == 1, - "incorrect value for states[4].state, expected 1, is %d", - check_msg->states[4].state); - ck_assert_msg( - (check_msg->states[5].cn0 * 100 - 4.86816120148 * 100) < 0.05, - "incorrect value for states[5].cn0, expected 4.86816120148, is %f", - check_msg->states[5].cn0); - ck_assert_msg(check_msg->states[5].prn == 13, - "incorrect value for states[5].prn, expected 13, is %d", - check_msg->states[5].prn); - ck_assert_msg(check_msg->states[5].state == 1, - "incorrect value for states[5].state, expected 1, is %d", - check_msg->states[5].state); - ck_assert_msg( - (check_msg->states[6].cn0 * 100 - 6.72109556198 * 100) < 0.05, - "incorrect value for states[6].cn0, expected 6.72109556198, is %f", - check_msg->states[6].cn0); - ck_assert_msg(check_msg->states[6].prn == 22, - "incorrect value for states[6].prn, expected 22, is %d", - check_msg->states[6].prn); - ck_assert_msg(check_msg->states[6].state == 1, - "incorrect value for states[6].state, expected 1, is %d", - check_msg->states[6].state); - ck_assert_msg( - (check_msg->states[7].cn0 * 100 - 12.9713230133 * 100) < 0.05, - "incorrect value for states[7].cn0, expected 12.9713230133, is %f", - check_msg->states[7].cn0); - ck_assert_msg(check_msg->states[7].prn == 30, - "incorrect value for states[7].prn, expected 30, is %d", - check_msg->states[7].prn); - ck_assert_msg(check_msg->states[7].state == 1, - "incorrect value for states[7].state, expected 1, is %d", - check_msg->states[7].state); - ck_assert_msg( - (check_msg->states[8].cn0 * 100 - 15.4814052582 * 100) < 0.05, - "incorrect value for states[8].cn0, expected 15.4814052582, is %f", - check_msg->states[8].cn0); - ck_assert_msg(check_msg->states[8].prn == 31, - "incorrect value for states[8].prn, expected 31, is %d", - check_msg->states[8].prn); - ck_assert_msg(check_msg->states[8].state == 1, - "incorrect value for states[8].state, expected 1, is %d", - check_msg->states[8].state); - ck_assert_msg( - (check_msg->states[9].cn0 * 100 - 3.88343548775 * 100) < 0.05, - "incorrect value for states[9].cn0, expected 3.88343548775, is %f", - check_msg->states[9].cn0); - ck_assert_msg(check_msg->states[9].prn == 25, - "incorrect value for states[9].prn, expected 25, is %d", - check_msg->states[9].prn); - ck_assert_msg(check_msg->states[9].state == 1, - "incorrect value for states[9].state, expected 1, is %d", - check_msg->states[9].state); - ck_assert_msg( - (check_msg->states[10].cn0 * 100 - 4.06148862839 * 100) < 0.05, - "incorrect value for states[10].cn0, expected 4.06148862839, is %f", - check_msg->states[10].cn0); - ck_assert_msg(check_msg->states[10].prn == 6, - "incorrect value for states[10].prn, expected 6, is %d", - check_msg->states[10].prn); - ck_assert_msg(check_msg->states[10].state == 1, - "incorrect value for states[10].state, expected 1, is %d", - check_msg->states[10].state); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x16, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x16, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 22, 0, 195, 4, 66, 1, 0, 141, 76, 60, 65, 1, 2, 69, - 139, 46, 65, 1, 3, 146, 27, 30, 65, 1, 7, 235, 56, 97, 65, - 1, 10, 141, 213, 243, 64, 1, 13, 250, 170, 166, 64, 1, 22, 17, - 101, 201, 64, 1, 30, 172, 183, 83, 65, 1, 31, 238, 193, 120, 65, - 1, 25, 220, 48, 132, 64, 1, 6, 49, 214, 54, 64, 110, 179, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_dep_a_t* test_msg = - (msg_tracking_state_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[0].cn0 = 11.768689155578613; - test_msg->states[0].prn = 0; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[1].cn0 = 10.909001350402832; - test_msg->states[1].prn = 2; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[2].cn0 = 9.881731033325195; - test_msg->states[2].prn = 3; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[3].cn0 = 14.076395988464355; - test_msg->states[3].prn = 7; - test_msg->states[3].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[4].cn0 = 7.619818210601807; - test_msg->states[4].prn = 10; - test_msg->states[4].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[5].cn0 = 5.208371162414551; - test_msg->states[5].prn = 13; - test_msg->states[5].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[6].cn0 = 6.2935872077941895; - test_msg->states[6].prn = 22; - test_msg->states[6].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[7].cn0 = 13.232341766357422; - test_msg->states[7].prn = 30; - test_msg->states[7].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[8].cn0 = 15.547346115112305; - test_msg->states[8].prn = 31; - test_msg->states[8].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[9].cn0 = 4.130964279174805; - test_msg->states[9].prn = 25; - test_msg->states[9].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[10].cn0 = 2.856823205947876; - test_msg->states[10].prn = 6; - test_msg->states[10].state = 1; - sbp_payload_send(&sbp_state, 0x16, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x16, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_dep_a_t* check_msg = - (msg_tracking_state_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->states[0].cn0 * 100 - 11.7686891556 * 100) < 0.05, - "incorrect value for states[0].cn0, expected 11.7686891556, is %f", - check_msg->states[0].cn0); - ck_assert_msg(check_msg->states[0].prn == 0, - "incorrect value for states[0].prn, expected 0, is %d", - check_msg->states[0].prn); - ck_assert_msg(check_msg->states[0].state == 1, - "incorrect value for states[0].state, expected 1, is %d", - check_msg->states[0].state); - ck_assert_msg( - (check_msg->states[1].cn0 * 100 - 10.9090013504 * 100) < 0.05, - "incorrect value for states[1].cn0, expected 10.9090013504, is %f", - check_msg->states[1].cn0); - ck_assert_msg(check_msg->states[1].prn == 2, - "incorrect value for states[1].prn, expected 2, is %d", - check_msg->states[1].prn); - ck_assert_msg(check_msg->states[1].state == 1, - "incorrect value for states[1].state, expected 1, is %d", - check_msg->states[1].state); - ck_assert_msg( - (check_msg->states[2].cn0 * 100 - 9.88173103333 * 100) < 0.05, - "incorrect value for states[2].cn0, expected 9.88173103333, is %f", - check_msg->states[2].cn0); - ck_assert_msg(check_msg->states[2].prn == 3, - "incorrect value for states[2].prn, expected 3, is %d", - check_msg->states[2].prn); - ck_assert_msg(check_msg->states[2].state == 1, - "incorrect value for states[2].state, expected 1, is %d", - check_msg->states[2].state); - ck_assert_msg( - (check_msg->states[3].cn0 * 100 - 14.0763959885 * 100) < 0.05, - "incorrect value for states[3].cn0, expected 14.0763959885, is %f", - check_msg->states[3].cn0); - ck_assert_msg(check_msg->states[3].prn == 7, - "incorrect value for states[3].prn, expected 7, is %d", - check_msg->states[3].prn); - ck_assert_msg(check_msg->states[3].state == 1, - "incorrect value for states[3].state, expected 1, is %d", - check_msg->states[3].state); - ck_assert_msg( - (check_msg->states[4].cn0 * 100 - 7.6198182106 * 100) < 0.05, - "incorrect value for states[4].cn0, expected 7.6198182106, is %f", - check_msg->states[4].cn0); - ck_assert_msg(check_msg->states[4].prn == 10, - "incorrect value for states[4].prn, expected 10, is %d", - check_msg->states[4].prn); - ck_assert_msg(check_msg->states[4].state == 1, - "incorrect value for states[4].state, expected 1, is %d", - check_msg->states[4].state); - ck_assert_msg( - (check_msg->states[5].cn0 * 100 - 5.20837116241 * 100) < 0.05, - "incorrect value for states[5].cn0, expected 5.20837116241, is %f", - check_msg->states[5].cn0); - ck_assert_msg(check_msg->states[5].prn == 13, - "incorrect value for states[5].prn, expected 13, is %d", - check_msg->states[5].prn); - ck_assert_msg(check_msg->states[5].state == 1, - "incorrect value for states[5].state, expected 1, is %d", - check_msg->states[5].state); - ck_assert_msg( - (check_msg->states[6].cn0 * 100 - 6.29358720779 * 100) < 0.05, - "incorrect value for states[6].cn0, expected 6.29358720779, is %f", - check_msg->states[6].cn0); - ck_assert_msg(check_msg->states[6].prn == 22, - "incorrect value for states[6].prn, expected 22, is %d", - check_msg->states[6].prn); - ck_assert_msg(check_msg->states[6].state == 1, - "incorrect value for states[6].state, expected 1, is %d", - check_msg->states[6].state); - ck_assert_msg( - (check_msg->states[7].cn0 * 100 - 13.2323417664 * 100) < 0.05, - "incorrect value for states[7].cn0, expected 13.2323417664, is %f", - check_msg->states[7].cn0); - ck_assert_msg(check_msg->states[7].prn == 30, - "incorrect value for states[7].prn, expected 30, is %d", - check_msg->states[7].prn); - ck_assert_msg(check_msg->states[7].state == 1, - "incorrect value for states[7].state, expected 1, is %d", - check_msg->states[7].state); - ck_assert_msg( - (check_msg->states[8].cn0 * 100 - 15.5473461151 * 100) < 0.05, - "incorrect value for states[8].cn0, expected 15.5473461151, is %f", - check_msg->states[8].cn0); - ck_assert_msg(check_msg->states[8].prn == 31, - "incorrect value for states[8].prn, expected 31, is %d", - check_msg->states[8].prn); - ck_assert_msg(check_msg->states[8].state == 1, - "incorrect value for states[8].state, expected 1, is %d", - check_msg->states[8].state); - ck_assert_msg( - (check_msg->states[9].cn0 * 100 - 4.13096427917 * 100) < 0.05, - "incorrect value for states[9].cn0, expected 4.13096427917, is %f", - check_msg->states[9].cn0); - ck_assert_msg(check_msg->states[9].prn == 25, - "incorrect value for states[9].prn, expected 25, is %d", - check_msg->states[9].prn); - ck_assert_msg(check_msg->states[9].state == 1, - "incorrect value for states[9].state, expected 1, is %d", - check_msg->states[9].state); - ck_assert_msg( - (check_msg->states[10].cn0 * 100 - 2.85682320595 * 100) < 0.05, - "incorrect value for states[10].cn0, expected 2.85682320595, is %f", - check_msg->states[10].cn0); - ck_assert_msg(check_msg->states[10].prn == 6, - "incorrect value for states[10].prn, expected 6, is %d", - check_msg->states[10].prn); - ck_assert_msg(check_msg->states[10].state == 1, - "incorrect value for states[10].state, expected 1, is %d", - check_msg->states[10].state); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x16, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x16, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 22, 0, 195, 4, 66, 1, 0, 55, 143, 120, 66, 0, 0, 0, - 0, 128, 191, 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, - 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, 0, 0, 0, - 0, 128, 191, 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, - 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, 248, 89, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_dep_a_t* test_msg = - (msg_tracking_state_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[0].cn0 = 62.13985824584961; - test_msg->states[0].prn = 0; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[1].cn0 = -1.0; - test_msg->states[1].prn = 0; - test_msg->states[1].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[2].cn0 = -1.0; - test_msg->states[2].prn = 0; - test_msg->states[2].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[3].cn0 = -1.0; - test_msg->states[3].prn = 0; - test_msg->states[3].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[4].cn0 = -1.0; - test_msg->states[4].prn = 0; - test_msg->states[4].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[5].cn0 = -1.0; - test_msg->states[5].prn = 0; - test_msg->states[5].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[6].cn0 = -1.0; - test_msg->states[6].prn = 0; - test_msg->states[6].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[7].cn0 = -1.0; - test_msg->states[7].prn = 0; - test_msg->states[7].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[8].cn0 = -1.0; - test_msg->states[8].prn = 0; - test_msg->states[8].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[9].cn0 = -1.0; - test_msg->states[9].prn = 0; - test_msg->states[9].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[10].cn0 = -1.0; - test_msg->states[10].prn = 0; - test_msg->states[10].state = 0; - sbp_payload_send(&sbp_state, 0x16, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x16, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_dep_a_t* check_msg = - (msg_tracking_state_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->states[0].cn0 * 100 - 62.1398582458 * 100) < 0.05, - "incorrect value for states[0].cn0, expected 62.1398582458, is %f", - check_msg->states[0].cn0); - ck_assert_msg(check_msg->states[0].prn == 0, - "incorrect value for states[0].prn, expected 0, is %d", - check_msg->states[0].prn); - ck_assert_msg(check_msg->states[0].state == 1, - "incorrect value for states[0].state, expected 1, is %d", - check_msg->states[0].state); - ck_assert_msg((check_msg->states[1].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[1].cn0, expected -1.0, is %f", - check_msg->states[1].cn0); - ck_assert_msg(check_msg->states[1].prn == 0, - "incorrect value for states[1].prn, expected 0, is %d", - check_msg->states[1].prn); - ck_assert_msg(check_msg->states[1].state == 0, - "incorrect value for states[1].state, expected 0, is %d", - check_msg->states[1].state); - ck_assert_msg((check_msg->states[2].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[2].cn0, expected -1.0, is %f", - check_msg->states[2].cn0); - ck_assert_msg(check_msg->states[2].prn == 0, - "incorrect value for states[2].prn, expected 0, is %d", - check_msg->states[2].prn); - ck_assert_msg(check_msg->states[2].state == 0, - "incorrect value for states[2].state, expected 0, is %d", - check_msg->states[2].state); - ck_assert_msg((check_msg->states[3].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[3].cn0, expected -1.0, is %f", - check_msg->states[3].cn0); - ck_assert_msg(check_msg->states[3].prn == 0, - "incorrect value for states[3].prn, expected 0, is %d", - check_msg->states[3].prn); - ck_assert_msg(check_msg->states[3].state == 0, - "incorrect value for states[3].state, expected 0, is %d", - check_msg->states[3].state); - ck_assert_msg((check_msg->states[4].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[4].cn0, expected -1.0, is %f", - check_msg->states[4].cn0); - ck_assert_msg(check_msg->states[4].prn == 0, - "incorrect value for states[4].prn, expected 0, is %d", - check_msg->states[4].prn); - ck_assert_msg(check_msg->states[4].state == 0, - "incorrect value for states[4].state, expected 0, is %d", - check_msg->states[4].state); - ck_assert_msg((check_msg->states[5].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[5].cn0, expected -1.0, is %f", - check_msg->states[5].cn0); - ck_assert_msg(check_msg->states[5].prn == 0, - "incorrect value for states[5].prn, expected 0, is %d", - check_msg->states[5].prn); - ck_assert_msg(check_msg->states[5].state == 0, - "incorrect value for states[5].state, expected 0, is %d", - check_msg->states[5].state); - ck_assert_msg((check_msg->states[6].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[6].cn0, expected -1.0, is %f", - check_msg->states[6].cn0); - ck_assert_msg(check_msg->states[6].prn == 0, - "incorrect value for states[6].prn, expected 0, is %d", - check_msg->states[6].prn); - ck_assert_msg(check_msg->states[6].state == 0, - "incorrect value for states[6].state, expected 0, is %d", - check_msg->states[6].state); - ck_assert_msg((check_msg->states[7].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[7].cn0, expected -1.0, is %f", - check_msg->states[7].cn0); - ck_assert_msg(check_msg->states[7].prn == 0, - "incorrect value for states[7].prn, expected 0, is %d", - check_msg->states[7].prn); - ck_assert_msg(check_msg->states[7].state == 0, - "incorrect value for states[7].state, expected 0, is %d", - check_msg->states[7].state); - ck_assert_msg((check_msg->states[8].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[8].cn0, expected -1.0, is %f", - check_msg->states[8].cn0); - ck_assert_msg(check_msg->states[8].prn == 0, - "incorrect value for states[8].prn, expected 0, is %d", - check_msg->states[8].prn); - ck_assert_msg(check_msg->states[8].state == 0, - "incorrect value for states[8].state, expected 0, is %d", - check_msg->states[8].state); - ck_assert_msg((check_msg->states[9].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[9].cn0, expected -1.0, is %f", - check_msg->states[9].cn0); - ck_assert_msg(check_msg->states[9].prn == 0, - "incorrect value for states[9].prn, expected 0, is %d", - check_msg->states[9].prn); - ck_assert_msg(check_msg->states[9].state == 0, - "incorrect value for states[9].state, expected 0, is %d", - check_msg->states[9].state); - ck_assert_msg((check_msg->states[10].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[10].cn0, expected -1.0, is %f", - check_msg->states[10].cn0); - ck_assert_msg(check_msg->states[10].prn == 0, - "incorrect value for states[10].prn, expected 0, is %d", - check_msg->states[10].prn); - ck_assert_msg(check_msg->states[10].state == 0, - "incorrect value for states[10].state, expected 0, is %d", - check_msg->states[10].state); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x16, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x16, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 22, 0, 195, 4, 66, 1, 0, 218, 14, 19, 66, 1, 2, 210, - 3, 21, 65, 1, 3, 234, 214, 134, 65, 0, 0, 0, 0, 128, 191, - 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, 0, 0, 0, - 0, 128, 191, 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, - 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, 84, 101, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_dep_a_t* test_msg = - (msg_tracking_state_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[0].cn0 = 36.764503479003906; - test_msg->states[0].prn = 0; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[1].cn0 = 9.313432693481445; - test_msg->states[1].prn = 2; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[2].cn0 = 16.854938507080078; - test_msg->states[2].prn = 3; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[3].cn0 = -1.0; - test_msg->states[3].prn = 0; - test_msg->states[3].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[4].cn0 = -1.0; - test_msg->states[4].prn = 0; - test_msg->states[4].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[5].cn0 = -1.0; - test_msg->states[5].prn = 0; - test_msg->states[5].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[6].cn0 = -1.0; - test_msg->states[6].prn = 0; - test_msg->states[6].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[7].cn0 = -1.0; - test_msg->states[7].prn = 0; - test_msg->states[7].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[8].cn0 = -1.0; - test_msg->states[8].prn = 0; - test_msg->states[8].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[9].cn0 = -1.0; - test_msg->states[9].prn = 0; - test_msg->states[9].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[10].cn0 = -1.0; - test_msg->states[10].prn = 0; - test_msg->states[10].state = 0; - sbp_payload_send(&sbp_state, 0x16, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x16, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_dep_a_t* check_msg = - (msg_tracking_state_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->states[0].cn0 * 100 - 36.764503479 * 100) < 0.05, - "incorrect value for states[0].cn0, expected 36.764503479, is %f", - check_msg->states[0].cn0); - ck_assert_msg(check_msg->states[0].prn == 0, - "incorrect value for states[0].prn, expected 0, is %d", - check_msg->states[0].prn); - ck_assert_msg(check_msg->states[0].state == 1, - "incorrect value for states[0].state, expected 1, is %d", - check_msg->states[0].state); - ck_assert_msg( - (check_msg->states[1].cn0 * 100 - 9.31343269348 * 100) < 0.05, - "incorrect value for states[1].cn0, expected 9.31343269348, is %f", - check_msg->states[1].cn0); - ck_assert_msg(check_msg->states[1].prn == 2, - "incorrect value for states[1].prn, expected 2, is %d", - check_msg->states[1].prn); - ck_assert_msg(check_msg->states[1].state == 1, - "incorrect value for states[1].state, expected 1, is %d", - check_msg->states[1].state); - ck_assert_msg( - (check_msg->states[2].cn0 * 100 - 16.8549385071 * 100) < 0.05, - "incorrect value for states[2].cn0, expected 16.8549385071, is %f", - check_msg->states[2].cn0); - ck_assert_msg(check_msg->states[2].prn == 3, - "incorrect value for states[2].prn, expected 3, is %d", - check_msg->states[2].prn); - ck_assert_msg(check_msg->states[2].state == 1, - "incorrect value for states[2].state, expected 1, is %d", - check_msg->states[2].state); - ck_assert_msg((check_msg->states[3].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[3].cn0, expected -1.0, is %f", - check_msg->states[3].cn0); - ck_assert_msg(check_msg->states[3].prn == 0, - "incorrect value for states[3].prn, expected 0, is %d", - check_msg->states[3].prn); - ck_assert_msg(check_msg->states[3].state == 0, - "incorrect value for states[3].state, expected 0, is %d", - check_msg->states[3].state); - ck_assert_msg((check_msg->states[4].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[4].cn0, expected -1.0, is %f", - check_msg->states[4].cn0); - ck_assert_msg(check_msg->states[4].prn == 0, - "incorrect value for states[4].prn, expected 0, is %d", - check_msg->states[4].prn); - ck_assert_msg(check_msg->states[4].state == 0, - "incorrect value for states[4].state, expected 0, is %d", - check_msg->states[4].state); - ck_assert_msg((check_msg->states[5].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[5].cn0, expected -1.0, is %f", - check_msg->states[5].cn0); - ck_assert_msg(check_msg->states[5].prn == 0, - "incorrect value for states[5].prn, expected 0, is %d", - check_msg->states[5].prn); - ck_assert_msg(check_msg->states[5].state == 0, - "incorrect value for states[5].state, expected 0, is %d", - check_msg->states[5].state); - ck_assert_msg((check_msg->states[6].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[6].cn0, expected -1.0, is %f", - check_msg->states[6].cn0); - ck_assert_msg(check_msg->states[6].prn == 0, - "incorrect value for states[6].prn, expected 0, is %d", - check_msg->states[6].prn); - ck_assert_msg(check_msg->states[6].state == 0, - "incorrect value for states[6].state, expected 0, is %d", - check_msg->states[6].state); - ck_assert_msg((check_msg->states[7].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[7].cn0, expected -1.0, is %f", - check_msg->states[7].cn0); - ck_assert_msg(check_msg->states[7].prn == 0, - "incorrect value for states[7].prn, expected 0, is %d", - check_msg->states[7].prn); - ck_assert_msg(check_msg->states[7].state == 0, - "incorrect value for states[7].state, expected 0, is %d", - check_msg->states[7].state); - ck_assert_msg((check_msg->states[8].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[8].cn0, expected -1.0, is %f", - check_msg->states[8].cn0); - ck_assert_msg(check_msg->states[8].prn == 0, - "incorrect value for states[8].prn, expected 0, is %d", - check_msg->states[8].prn); - ck_assert_msg(check_msg->states[8].state == 0, - "incorrect value for states[8].state, expected 0, is %d", - check_msg->states[8].state); - ck_assert_msg((check_msg->states[9].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[9].cn0, expected -1.0, is %f", - check_msg->states[9].cn0); - ck_assert_msg(check_msg->states[9].prn == 0, - "incorrect value for states[9].prn, expected 0, is %d", - check_msg->states[9].prn); - ck_assert_msg(check_msg->states[9].state == 0, - "incorrect value for states[9].state, expected 0, is %d", - check_msg->states[9].state); - ck_assert_msg((check_msg->states[10].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[10].cn0, expected -1.0, is %f", - check_msg->states[10].cn0); - ck_assert_msg(check_msg->states[10].prn == 0, - "incorrect value for states[10].prn, expected 0, is %d", - check_msg->states[10].prn); - ck_assert_msg(check_msg->states[10].state == 0, - "incorrect value for states[10].state, expected 0, is %d", - check_msg->states[10].state); - } - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x16, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x16, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 22, 0, 195, 4, 66, 1, 0, 98, 39, 219, 65, 1, 2, 0, - 0, 56, 64, 1, 3, 121, 123, 7, 65, 0, 0, 0, 0, 128, 191, - 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, 0, 0, 0, - 0, 128, 191, 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, - 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, 37, 123, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_tracking_state_dep_a_t* test_msg = - (msg_tracking_state_dep_a_t*)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[0].cn0 = 27.394229888916016; - test_msg->states[0].prn = 0; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[1].cn0 = 2.875; - test_msg->states[1].prn = 2; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[2].cn0 = 8.467644691467285; - test_msg->states[2].prn = 3; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[3].cn0 = -1.0; - test_msg->states[3].prn = 0; - test_msg->states[3].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[4].cn0 = -1.0; - test_msg->states[4].prn = 0; - test_msg->states[4].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[5].cn0 = -1.0; - test_msg->states[5].prn = 0; - test_msg->states[5].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[6].cn0 = -1.0; - test_msg->states[6].prn = 0; - test_msg->states[6].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[7].cn0 = -1.0; - test_msg->states[7].prn = 0; - test_msg->states[7].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[8].cn0 = -1.0; - test_msg->states[8].prn = 0; - test_msg->states[8].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[9].cn0 = -1.0; - test_msg->states[9].prn = 0; - test_msg->states[9].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->states[0]); - } - test_msg->states[10].cn0 = -1.0; - test_msg->states[10].prn = 0; - test_msg->states[10].state = 0; - sbp_payload_send(&sbp_state, 0x16, 1219, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 1219, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 1219, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x16, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_tracking_state_dep_a_t* check_msg = - (msg_tracking_state_dep_a_t*)((void*)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg( - (check_msg->states[0].cn0 * 100 - 27.3942298889 * 100) < 0.05, - "incorrect value for states[0].cn0, expected 27.3942298889, is %f", - check_msg->states[0].cn0); - ck_assert_msg(check_msg->states[0].prn == 0, - "incorrect value for states[0].prn, expected 0, is %d", - check_msg->states[0].prn); - ck_assert_msg(check_msg->states[0].state == 1, - "incorrect value for states[0].state, expected 1, is %d", - check_msg->states[0].state); - ck_assert_msg((check_msg->states[1].cn0 * 100 - 2.875 * 100) < 0.05, - "incorrect value for states[1].cn0, expected 2.875, is %f", - check_msg->states[1].cn0); - ck_assert_msg(check_msg->states[1].prn == 2, - "incorrect value for states[1].prn, expected 2, is %d", - check_msg->states[1].prn); - ck_assert_msg(check_msg->states[1].state == 1, - "incorrect value for states[1].state, expected 1, is %d", - check_msg->states[1].state); - ck_assert_msg( - (check_msg->states[2].cn0 * 100 - 8.46764469147 * 100) < 0.05, - "incorrect value for states[2].cn0, expected 8.46764469147, is %f", - check_msg->states[2].cn0); - ck_assert_msg(check_msg->states[2].prn == 3, - "incorrect value for states[2].prn, expected 3, is %d", - check_msg->states[2].prn); - ck_assert_msg(check_msg->states[2].state == 1, - "incorrect value for states[2].state, expected 1, is %d", - check_msg->states[2].state); - ck_assert_msg((check_msg->states[3].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[3].cn0, expected -1.0, is %f", - check_msg->states[3].cn0); - ck_assert_msg(check_msg->states[3].prn == 0, - "incorrect value for states[3].prn, expected 0, is %d", - check_msg->states[3].prn); - ck_assert_msg(check_msg->states[3].state == 0, - "incorrect value for states[3].state, expected 0, is %d", - check_msg->states[3].state); - ck_assert_msg((check_msg->states[4].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[4].cn0, expected -1.0, is %f", - check_msg->states[4].cn0); - ck_assert_msg(check_msg->states[4].prn == 0, - "incorrect value for states[4].prn, expected 0, is %d", - check_msg->states[4].prn); - ck_assert_msg(check_msg->states[4].state == 0, - "incorrect value for states[4].state, expected 0, is %d", - check_msg->states[4].state); - ck_assert_msg((check_msg->states[5].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[5].cn0, expected -1.0, is %f", - check_msg->states[5].cn0); - ck_assert_msg(check_msg->states[5].prn == 0, - "incorrect value for states[5].prn, expected 0, is %d", - check_msg->states[5].prn); - ck_assert_msg(check_msg->states[5].state == 0, - "incorrect value for states[5].state, expected 0, is %d", - check_msg->states[5].state); - ck_assert_msg((check_msg->states[6].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[6].cn0, expected -1.0, is %f", - check_msg->states[6].cn0); - ck_assert_msg(check_msg->states[6].prn == 0, - "incorrect value for states[6].prn, expected 0, is %d", - check_msg->states[6].prn); - ck_assert_msg(check_msg->states[6].state == 0, - "incorrect value for states[6].state, expected 0, is %d", - check_msg->states[6].state); - ck_assert_msg((check_msg->states[7].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[7].cn0, expected -1.0, is %f", - check_msg->states[7].cn0); - ck_assert_msg(check_msg->states[7].prn == 0, - "incorrect value for states[7].prn, expected 0, is %d", - check_msg->states[7].prn); - ck_assert_msg(check_msg->states[7].state == 0, - "incorrect value for states[7].state, expected 0, is %d", - check_msg->states[7].state); - ck_assert_msg((check_msg->states[8].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[8].cn0, expected -1.0, is %f", - check_msg->states[8].cn0); - ck_assert_msg(check_msg->states[8].prn == 0, - "incorrect value for states[8].prn, expected 0, is %d", - check_msg->states[8].prn); - ck_assert_msg(check_msg->states[8].state == 0, - "incorrect value for states[8].state, expected 0, is %d", - check_msg->states[8].state); - ck_assert_msg((check_msg->states[9].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[9].cn0, expected -1.0, is %f", - check_msg->states[9].cn0); - ck_assert_msg(check_msg->states[9].prn == 0, - "incorrect value for states[9].prn, expected 0, is %d", - check_msg->states[9].prn); - ck_assert_msg(check_msg->states[9].state == 0, - "incorrect value for states[9].state, expected 0, is %d", - check_msg->states[9].state); - ck_assert_msg((check_msg->states[10].cn0 * 100 - -1.0 * 100) < 0.05, - "incorrect value for states[10].cn0, expected -1.0, is %f", - check_msg->states[10].cn0); - ck_assert_msg(check_msg->states[10].prn == 0, - "incorrect value for states[10].prn, expected 0, is %d", - check_msg->states[10].prn); - ck_assert_msg(check_msg->states[10].state == 0, - "incorrect value for states[10].state, expected 0, is %d", - check_msg->states[10].state); - } -} -END_TEST - -Suite* legacy_auto_check_sbp_tracking_MsgtrackingStateDepA_suite(void) { - Suite* s = suite_create( - "SBP generated test suite: " - "legacy_auto_check_sbp_tracking_MsgtrackingStateDepA"); - TCase* tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA"); - tcase_add_test(tc_acq, - test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_user_MsgUserData.c b/c/test/legacy/auto_check_sbp_user_MsgUserData.c deleted file mode 100644 index dfffd87860..0000000000 --- a/c/test/legacy/auto_check_sbp_user_MsgUserData.c +++ /dev/null @@ -1,2269 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/user/test_MsgUserData.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_user_MsgUserData) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x800, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x800, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 0, 8, 126, 33, 255, 53, 5, 172, 138, 50, 49, 206, 234, - 149, 204, 113, 31, 108, 188, 179, 154, 156, 167, 145, 139, 42, 207, - 126, 242, 193, 9, 58, 75, 8, 135, 11, 92, 131, 245, 24, 90, - 255, 30, 58, 31, 109, 148, 56, 178, 140, 30, 159, 70, 17, 170, - 50, 148, 1, 99, 112, 88, 217, 36, 84, 34, 234, 82, 144, 144, - 97, 96, 75, 174, 58, 219, 180, 148, 247, 59, 2, 116, 214, 114, - 55, 134, 54, 119, 108, 128, 73, 181, 20, 233, 23, 23, 73, 119, - 136, 231, 189, 26, 174, 128, 93, 30, 76, 45, 109, 134, 81, 0, - 116, 158, 127, 40, 133, 208, 134, 127, 140, 232, 183, 184, 108, 6, - 228, 54, 238, 59, 220, 30, 228, 212, 50, 182, 97, 20, 41, 76, - 227, 88, 12, 95, 112, 209, 183, 127, 4, 165, 189, 44, 239, 232, - 132, 9, 114, 184, 249, 208, 246, 194, 250, 2, 97, 173, 157, 202, - 172, 180, 150, 213, 193, 177, 209, 156, 20, 174, 18, 73, 132, 215, - 115, 128, 175, 169, 116, 132, 100, 72, 45, 25, 14, 205, 213, 145, - 68, 137, 249, 54, 40, 174, 215, 148, 166, 190, 63, 118, 6, 165, - 212, 74, 68, 200, 38, 139, 212, 112, 45, 167, 236, 255, 106, 92, - 132, 59, 61, 233, 3, 246, 158, 83, 134, 246, 154, 17, 0, 6, - 56, 216, 19, 216, 70, 71, 161, 184, 5, 177, 45, 37, 98, 56, - 149, 0, 73, 221, 105, 239, 168, 205, 85, 81, 245, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_user_data_t *test_msg = (msg_user_data_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[0] = 53; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[1] = 5; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[2] = 172; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[3] = 138; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[4] = 50; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[5] = 49; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[6] = 206; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[7] = 234; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[8] = 149; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[9] = 204; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[10] = 113; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[11] = 31; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[12] = 108; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[13] = 188; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[14] = 179; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[15] = 154; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[16] = 156; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[17] = 167; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[18] = 145; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[19] = 139; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[20] = 42; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[21] = 207; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[22] = 126; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[23] = 242; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[24] = 193; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[25] = 9; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[26] = 58; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[27] = 75; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[28] = 8; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[29] = 135; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[30] = 11; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[31] = 92; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[32] = 131; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[33] = 245; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[34] = 24; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[35] = 90; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[36] = 255; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[37] = 30; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[38] = 58; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[39] = 31; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[40] = 109; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[41] = 148; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[42] = 56; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[43] = 178; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[44] = 140; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[45] = 30; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[46] = 159; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[47] = 70; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[48] = 17; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[49] = 170; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[50] = 50; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[51] = 148; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[52] = 1; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[53] = 99; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[54] = 112; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[55] = 88; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[56] = 217; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[57] = 36; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[58] = 84; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[59] = 34; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[60] = 234; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[61] = 82; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[62] = 144; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[63] = 144; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[64] = 97; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[65] = 96; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[66] = 75; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[67] = 174; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[68] = 58; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[69] = 219; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[70] = 180; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[71] = 148; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[72] = 247; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[73] = 59; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[74] = 2; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[75] = 116; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[76] = 214; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[77] = 114; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[78] = 55; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[79] = 134; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[80] = 54; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[81] = 119; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[82] = 108; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[83] = 128; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[84] = 73; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[85] = 181; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[86] = 20; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[87] = 233; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[88] = 23; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[89] = 23; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[90] = 73; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[91] = 119; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[92] = 136; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[93] = 231; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[94] = 189; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[95] = 26; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[96] = 174; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[97] = 128; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[98] = 93; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[99] = 30; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[100] = 76; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[101] = 45; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[102] = 109; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[103] = 134; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[104] = 81; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[105] = 0; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[106] = 116; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[107] = 158; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[108] = 127; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[109] = 40; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[110] = 133; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[111] = 208; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[112] = 134; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[113] = 127; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[114] = 140; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[115] = 232; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[116] = 183; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[117] = 184; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[118] = 108; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[119] = 6; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[120] = 228; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[121] = 54; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[122] = 238; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[123] = 59; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[124] = 220; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[125] = 30; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[126] = 228; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[127] = 212; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[128] = 50; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[129] = 182; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[130] = 97; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[131] = 20; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[132] = 41; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[133] = 76; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[134] = 227; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[135] = 88; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[136] = 12; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[137] = 95; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[138] = 112; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[139] = 209; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[140] = 183; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[141] = 127; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[142] = 4; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[143] = 165; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[144] = 189; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[145] = 44; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[146] = 239; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[147] = 232; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[148] = 132; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[149] = 9; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[150] = 114; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[151] = 184; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[152] = 249; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[153] = 208; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[154] = 246; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[155] = 194; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[156] = 250; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[157] = 2; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[158] = 97; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[159] = 173; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[160] = 157; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[161] = 202; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[162] = 172; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[163] = 180; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[164] = 150; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[165] = 213; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[166] = 193; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[167] = 177; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[168] = 209; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[169] = 156; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[170] = 20; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[171] = 174; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[172] = 18; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[173] = 73; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[174] = 132; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[175] = 215; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[176] = 115; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[177] = 128; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[178] = 175; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[179] = 169; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[180] = 116; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[181] = 132; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[182] = 100; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[183] = 72; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[184] = 45; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[185] = 25; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[186] = 14; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[187] = 205; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[188] = 213; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[189] = 145; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[190] = 68; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[191] = 137; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[192] = 249; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[193] = 54; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[194] = 40; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[195] = 174; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[196] = 215; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[197] = 148; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[198] = 166; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[199] = 190; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[200] = 63; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[201] = 118; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[202] = 6; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[203] = 165; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[204] = 212; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[205] = 74; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[206] = 68; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[207] = 200; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[208] = 38; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[209] = 139; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[210] = 212; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[211] = 112; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[212] = 45; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[213] = 167; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[214] = 236; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[215] = 255; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[216] = 106; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[217] = 92; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[218] = 132; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[219] = 59; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[220] = 61; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[221] = 233; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[222] = 3; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[223] = 246; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[224] = 158; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[225] = 83; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[226] = 134; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[227] = 246; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[228] = 154; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[229] = 17; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[230] = 0; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[231] = 6; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[232] = 56; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[233] = 216; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[234] = 19; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[235] = 216; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[236] = 70; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[237] = 71; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[238] = 161; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[239] = 184; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[240] = 5; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[241] = 177; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[242] = 45; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[243] = 37; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[244] = 98; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[245] = 56; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[246] = 149; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[247] = 0; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[248] = 73; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[249] = 221; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[250] = 105; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[251] = 239; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[252] = 168; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[253] = 205; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->contents[0]); - } - test_msg->contents[254] = 85; - sbp_payload_send(&sbp_state, 0x800, 8574, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 8574, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 8574, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x800, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_user_data_t *check_msg = (msg_user_data_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->contents[0] == 53, - "incorrect value for contents[0], expected 53, is %d", - check_msg->contents[0]); - ck_assert_msg(check_msg->contents[1] == 5, - "incorrect value for contents[1], expected 5, is %d", - check_msg->contents[1]); - ck_assert_msg(check_msg->contents[2] == 172, - "incorrect value for contents[2], expected 172, is %d", - check_msg->contents[2]); - ck_assert_msg(check_msg->contents[3] == 138, - "incorrect value for contents[3], expected 138, is %d", - check_msg->contents[3]); - ck_assert_msg(check_msg->contents[4] == 50, - "incorrect value for contents[4], expected 50, is %d", - check_msg->contents[4]); - ck_assert_msg(check_msg->contents[5] == 49, - "incorrect value for contents[5], expected 49, is %d", - check_msg->contents[5]); - ck_assert_msg(check_msg->contents[6] == 206, - "incorrect value for contents[6], expected 206, is %d", - check_msg->contents[6]); - ck_assert_msg(check_msg->contents[7] == 234, - "incorrect value for contents[7], expected 234, is %d", - check_msg->contents[7]); - ck_assert_msg(check_msg->contents[8] == 149, - "incorrect value for contents[8], expected 149, is %d", - check_msg->contents[8]); - ck_assert_msg(check_msg->contents[9] == 204, - "incorrect value for contents[9], expected 204, is %d", - check_msg->contents[9]); - ck_assert_msg(check_msg->contents[10] == 113, - "incorrect value for contents[10], expected 113, is %d", - check_msg->contents[10]); - ck_assert_msg(check_msg->contents[11] == 31, - "incorrect value for contents[11], expected 31, is %d", - check_msg->contents[11]); - ck_assert_msg(check_msg->contents[12] == 108, - "incorrect value for contents[12], expected 108, is %d", - check_msg->contents[12]); - ck_assert_msg(check_msg->contents[13] == 188, - "incorrect value for contents[13], expected 188, is %d", - check_msg->contents[13]); - ck_assert_msg(check_msg->contents[14] == 179, - "incorrect value for contents[14], expected 179, is %d", - check_msg->contents[14]); - ck_assert_msg(check_msg->contents[15] == 154, - "incorrect value for contents[15], expected 154, is %d", - check_msg->contents[15]); - ck_assert_msg(check_msg->contents[16] == 156, - "incorrect value for contents[16], expected 156, is %d", - check_msg->contents[16]); - ck_assert_msg(check_msg->contents[17] == 167, - "incorrect value for contents[17], expected 167, is %d", - check_msg->contents[17]); - ck_assert_msg(check_msg->contents[18] == 145, - "incorrect value for contents[18], expected 145, is %d", - check_msg->contents[18]); - ck_assert_msg(check_msg->contents[19] == 139, - "incorrect value for contents[19], expected 139, is %d", - check_msg->contents[19]); - ck_assert_msg(check_msg->contents[20] == 42, - "incorrect value for contents[20], expected 42, is %d", - check_msg->contents[20]); - ck_assert_msg(check_msg->contents[21] == 207, - "incorrect value for contents[21], expected 207, is %d", - check_msg->contents[21]); - ck_assert_msg(check_msg->contents[22] == 126, - "incorrect value for contents[22], expected 126, is %d", - check_msg->contents[22]); - ck_assert_msg(check_msg->contents[23] == 242, - "incorrect value for contents[23], expected 242, is %d", - check_msg->contents[23]); - ck_assert_msg(check_msg->contents[24] == 193, - "incorrect value for contents[24], expected 193, is %d", - check_msg->contents[24]); - ck_assert_msg(check_msg->contents[25] == 9, - "incorrect value for contents[25], expected 9, is %d", - check_msg->contents[25]); - ck_assert_msg(check_msg->contents[26] == 58, - "incorrect value for contents[26], expected 58, is %d", - check_msg->contents[26]); - ck_assert_msg(check_msg->contents[27] == 75, - "incorrect value for contents[27], expected 75, is %d", - check_msg->contents[27]); - ck_assert_msg(check_msg->contents[28] == 8, - "incorrect value for contents[28], expected 8, is %d", - check_msg->contents[28]); - ck_assert_msg(check_msg->contents[29] == 135, - "incorrect value for contents[29], expected 135, is %d", - check_msg->contents[29]); - ck_assert_msg(check_msg->contents[30] == 11, - "incorrect value for contents[30], expected 11, is %d", - check_msg->contents[30]); - ck_assert_msg(check_msg->contents[31] == 92, - "incorrect value for contents[31], expected 92, is %d", - check_msg->contents[31]); - ck_assert_msg(check_msg->contents[32] == 131, - "incorrect value for contents[32], expected 131, is %d", - check_msg->contents[32]); - ck_assert_msg(check_msg->contents[33] == 245, - "incorrect value for contents[33], expected 245, is %d", - check_msg->contents[33]); - ck_assert_msg(check_msg->contents[34] == 24, - "incorrect value for contents[34], expected 24, is %d", - check_msg->contents[34]); - ck_assert_msg(check_msg->contents[35] == 90, - "incorrect value for contents[35], expected 90, is %d", - check_msg->contents[35]); - ck_assert_msg(check_msg->contents[36] == 255, - "incorrect value for contents[36], expected 255, is %d", - check_msg->contents[36]); - ck_assert_msg(check_msg->contents[37] == 30, - "incorrect value for contents[37], expected 30, is %d", - check_msg->contents[37]); - ck_assert_msg(check_msg->contents[38] == 58, - "incorrect value for contents[38], expected 58, is %d", - check_msg->contents[38]); - ck_assert_msg(check_msg->contents[39] == 31, - "incorrect value for contents[39], expected 31, is %d", - check_msg->contents[39]); - ck_assert_msg(check_msg->contents[40] == 109, - "incorrect value for contents[40], expected 109, is %d", - check_msg->contents[40]); - ck_assert_msg(check_msg->contents[41] == 148, - "incorrect value for contents[41], expected 148, is %d", - check_msg->contents[41]); - ck_assert_msg(check_msg->contents[42] == 56, - "incorrect value for contents[42], expected 56, is %d", - check_msg->contents[42]); - ck_assert_msg(check_msg->contents[43] == 178, - "incorrect value for contents[43], expected 178, is %d", - check_msg->contents[43]); - ck_assert_msg(check_msg->contents[44] == 140, - "incorrect value for contents[44], expected 140, is %d", - check_msg->contents[44]); - ck_assert_msg(check_msg->contents[45] == 30, - "incorrect value for contents[45], expected 30, is %d", - check_msg->contents[45]); - ck_assert_msg(check_msg->contents[46] == 159, - "incorrect value for contents[46], expected 159, is %d", - check_msg->contents[46]); - ck_assert_msg(check_msg->contents[47] == 70, - "incorrect value for contents[47], expected 70, is %d", - check_msg->contents[47]); - ck_assert_msg(check_msg->contents[48] == 17, - "incorrect value for contents[48], expected 17, is %d", - check_msg->contents[48]); - ck_assert_msg(check_msg->contents[49] == 170, - "incorrect value for contents[49], expected 170, is %d", - check_msg->contents[49]); - ck_assert_msg(check_msg->contents[50] == 50, - "incorrect value for contents[50], expected 50, is %d", - check_msg->contents[50]); - ck_assert_msg(check_msg->contents[51] == 148, - "incorrect value for contents[51], expected 148, is %d", - check_msg->contents[51]); - ck_assert_msg(check_msg->contents[52] == 1, - "incorrect value for contents[52], expected 1, is %d", - check_msg->contents[52]); - ck_assert_msg(check_msg->contents[53] == 99, - "incorrect value for contents[53], expected 99, is %d", - check_msg->contents[53]); - ck_assert_msg(check_msg->contents[54] == 112, - "incorrect value for contents[54], expected 112, is %d", - check_msg->contents[54]); - ck_assert_msg(check_msg->contents[55] == 88, - "incorrect value for contents[55], expected 88, is %d", - check_msg->contents[55]); - ck_assert_msg(check_msg->contents[56] == 217, - "incorrect value for contents[56], expected 217, is %d", - check_msg->contents[56]); - ck_assert_msg(check_msg->contents[57] == 36, - "incorrect value for contents[57], expected 36, is %d", - check_msg->contents[57]); - ck_assert_msg(check_msg->contents[58] == 84, - "incorrect value for contents[58], expected 84, is %d", - check_msg->contents[58]); - ck_assert_msg(check_msg->contents[59] == 34, - "incorrect value for contents[59], expected 34, is %d", - check_msg->contents[59]); - ck_assert_msg(check_msg->contents[60] == 234, - "incorrect value for contents[60], expected 234, is %d", - check_msg->contents[60]); - ck_assert_msg(check_msg->contents[61] == 82, - "incorrect value for contents[61], expected 82, is %d", - check_msg->contents[61]); - ck_assert_msg(check_msg->contents[62] == 144, - "incorrect value for contents[62], expected 144, is %d", - check_msg->contents[62]); - ck_assert_msg(check_msg->contents[63] == 144, - "incorrect value for contents[63], expected 144, is %d", - check_msg->contents[63]); - ck_assert_msg(check_msg->contents[64] == 97, - "incorrect value for contents[64], expected 97, is %d", - check_msg->contents[64]); - ck_assert_msg(check_msg->contents[65] == 96, - "incorrect value for contents[65], expected 96, is %d", - check_msg->contents[65]); - ck_assert_msg(check_msg->contents[66] == 75, - "incorrect value for contents[66], expected 75, is %d", - check_msg->contents[66]); - ck_assert_msg(check_msg->contents[67] == 174, - "incorrect value for contents[67], expected 174, is %d", - check_msg->contents[67]); - ck_assert_msg(check_msg->contents[68] == 58, - "incorrect value for contents[68], expected 58, is %d", - check_msg->contents[68]); - ck_assert_msg(check_msg->contents[69] == 219, - "incorrect value for contents[69], expected 219, is %d", - check_msg->contents[69]); - ck_assert_msg(check_msg->contents[70] == 180, - "incorrect value for contents[70], expected 180, is %d", - check_msg->contents[70]); - ck_assert_msg(check_msg->contents[71] == 148, - "incorrect value for contents[71], expected 148, is %d", - check_msg->contents[71]); - ck_assert_msg(check_msg->contents[72] == 247, - "incorrect value for contents[72], expected 247, is %d", - check_msg->contents[72]); - ck_assert_msg(check_msg->contents[73] == 59, - "incorrect value for contents[73], expected 59, is %d", - check_msg->contents[73]); - ck_assert_msg(check_msg->contents[74] == 2, - "incorrect value for contents[74], expected 2, is %d", - check_msg->contents[74]); - ck_assert_msg(check_msg->contents[75] == 116, - "incorrect value for contents[75], expected 116, is %d", - check_msg->contents[75]); - ck_assert_msg(check_msg->contents[76] == 214, - "incorrect value for contents[76], expected 214, is %d", - check_msg->contents[76]); - ck_assert_msg(check_msg->contents[77] == 114, - "incorrect value for contents[77], expected 114, is %d", - check_msg->contents[77]); - ck_assert_msg(check_msg->contents[78] == 55, - "incorrect value for contents[78], expected 55, is %d", - check_msg->contents[78]); - ck_assert_msg(check_msg->contents[79] == 134, - "incorrect value for contents[79], expected 134, is %d", - check_msg->contents[79]); - ck_assert_msg(check_msg->contents[80] == 54, - "incorrect value for contents[80], expected 54, is %d", - check_msg->contents[80]); - ck_assert_msg(check_msg->contents[81] == 119, - "incorrect value for contents[81], expected 119, is %d", - check_msg->contents[81]); - ck_assert_msg(check_msg->contents[82] == 108, - "incorrect value for contents[82], expected 108, is %d", - check_msg->contents[82]); - ck_assert_msg(check_msg->contents[83] == 128, - "incorrect value for contents[83], expected 128, is %d", - check_msg->contents[83]); - ck_assert_msg(check_msg->contents[84] == 73, - "incorrect value for contents[84], expected 73, is %d", - check_msg->contents[84]); - ck_assert_msg(check_msg->contents[85] == 181, - "incorrect value for contents[85], expected 181, is %d", - check_msg->contents[85]); - ck_assert_msg(check_msg->contents[86] == 20, - "incorrect value for contents[86], expected 20, is %d", - check_msg->contents[86]); - ck_assert_msg(check_msg->contents[87] == 233, - "incorrect value for contents[87], expected 233, is %d", - check_msg->contents[87]); - ck_assert_msg(check_msg->contents[88] == 23, - "incorrect value for contents[88], expected 23, is %d", - check_msg->contents[88]); - ck_assert_msg(check_msg->contents[89] == 23, - "incorrect value for contents[89], expected 23, is %d", - check_msg->contents[89]); - ck_assert_msg(check_msg->contents[90] == 73, - "incorrect value for contents[90], expected 73, is %d", - check_msg->contents[90]); - ck_assert_msg(check_msg->contents[91] == 119, - "incorrect value for contents[91], expected 119, is %d", - check_msg->contents[91]); - ck_assert_msg(check_msg->contents[92] == 136, - "incorrect value for contents[92], expected 136, is %d", - check_msg->contents[92]); - ck_assert_msg(check_msg->contents[93] == 231, - "incorrect value for contents[93], expected 231, is %d", - check_msg->contents[93]); - ck_assert_msg(check_msg->contents[94] == 189, - "incorrect value for contents[94], expected 189, is %d", - check_msg->contents[94]); - ck_assert_msg(check_msg->contents[95] == 26, - "incorrect value for contents[95], expected 26, is %d", - check_msg->contents[95]); - ck_assert_msg(check_msg->contents[96] == 174, - "incorrect value for contents[96], expected 174, is %d", - check_msg->contents[96]); - ck_assert_msg(check_msg->contents[97] == 128, - "incorrect value for contents[97], expected 128, is %d", - check_msg->contents[97]); - ck_assert_msg(check_msg->contents[98] == 93, - "incorrect value for contents[98], expected 93, is %d", - check_msg->contents[98]); - ck_assert_msg(check_msg->contents[99] == 30, - "incorrect value for contents[99], expected 30, is %d", - check_msg->contents[99]); - ck_assert_msg(check_msg->contents[100] == 76, - "incorrect value for contents[100], expected 76, is %d", - check_msg->contents[100]); - ck_assert_msg(check_msg->contents[101] == 45, - "incorrect value for contents[101], expected 45, is %d", - check_msg->contents[101]); - ck_assert_msg(check_msg->contents[102] == 109, - "incorrect value for contents[102], expected 109, is %d", - check_msg->contents[102]); - ck_assert_msg(check_msg->contents[103] == 134, - "incorrect value for contents[103], expected 134, is %d", - check_msg->contents[103]); - ck_assert_msg(check_msg->contents[104] == 81, - "incorrect value for contents[104], expected 81, is %d", - check_msg->contents[104]); - ck_assert_msg(check_msg->contents[105] == 0, - "incorrect value for contents[105], expected 0, is %d", - check_msg->contents[105]); - ck_assert_msg(check_msg->contents[106] == 116, - "incorrect value for contents[106], expected 116, is %d", - check_msg->contents[106]); - ck_assert_msg(check_msg->contents[107] == 158, - "incorrect value for contents[107], expected 158, is %d", - check_msg->contents[107]); - ck_assert_msg(check_msg->contents[108] == 127, - "incorrect value for contents[108], expected 127, is %d", - check_msg->contents[108]); - ck_assert_msg(check_msg->contents[109] == 40, - "incorrect value for contents[109], expected 40, is %d", - check_msg->contents[109]); - ck_assert_msg(check_msg->contents[110] == 133, - "incorrect value for contents[110], expected 133, is %d", - check_msg->contents[110]); - ck_assert_msg(check_msg->contents[111] == 208, - "incorrect value for contents[111], expected 208, is %d", - check_msg->contents[111]); - ck_assert_msg(check_msg->contents[112] == 134, - "incorrect value for contents[112], expected 134, is %d", - check_msg->contents[112]); - ck_assert_msg(check_msg->contents[113] == 127, - "incorrect value for contents[113], expected 127, is %d", - check_msg->contents[113]); - ck_assert_msg(check_msg->contents[114] == 140, - "incorrect value for contents[114], expected 140, is %d", - check_msg->contents[114]); - ck_assert_msg(check_msg->contents[115] == 232, - "incorrect value for contents[115], expected 232, is %d", - check_msg->contents[115]); - ck_assert_msg(check_msg->contents[116] == 183, - "incorrect value for contents[116], expected 183, is %d", - check_msg->contents[116]); - ck_assert_msg(check_msg->contents[117] == 184, - "incorrect value for contents[117], expected 184, is %d", - check_msg->contents[117]); - ck_assert_msg(check_msg->contents[118] == 108, - "incorrect value for contents[118], expected 108, is %d", - check_msg->contents[118]); - ck_assert_msg(check_msg->contents[119] == 6, - "incorrect value for contents[119], expected 6, is %d", - check_msg->contents[119]); - ck_assert_msg(check_msg->contents[120] == 228, - "incorrect value for contents[120], expected 228, is %d", - check_msg->contents[120]); - ck_assert_msg(check_msg->contents[121] == 54, - "incorrect value for contents[121], expected 54, is %d", - check_msg->contents[121]); - ck_assert_msg(check_msg->contents[122] == 238, - "incorrect value for contents[122], expected 238, is %d", - check_msg->contents[122]); - ck_assert_msg(check_msg->contents[123] == 59, - "incorrect value for contents[123], expected 59, is %d", - check_msg->contents[123]); - ck_assert_msg(check_msg->contents[124] == 220, - "incorrect value for contents[124], expected 220, is %d", - check_msg->contents[124]); - ck_assert_msg(check_msg->contents[125] == 30, - "incorrect value for contents[125], expected 30, is %d", - check_msg->contents[125]); - ck_assert_msg(check_msg->contents[126] == 228, - "incorrect value for contents[126], expected 228, is %d", - check_msg->contents[126]); - ck_assert_msg(check_msg->contents[127] == 212, - "incorrect value for contents[127], expected 212, is %d", - check_msg->contents[127]); - ck_assert_msg(check_msg->contents[128] == 50, - "incorrect value for contents[128], expected 50, is %d", - check_msg->contents[128]); - ck_assert_msg(check_msg->contents[129] == 182, - "incorrect value for contents[129], expected 182, is %d", - check_msg->contents[129]); - ck_assert_msg(check_msg->contents[130] == 97, - "incorrect value for contents[130], expected 97, is %d", - check_msg->contents[130]); - ck_assert_msg(check_msg->contents[131] == 20, - "incorrect value for contents[131], expected 20, is %d", - check_msg->contents[131]); - ck_assert_msg(check_msg->contents[132] == 41, - "incorrect value for contents[132], expected 41, is %d", - check_msg->contents[132]); - ck_assert_msg(check_msg->contents[133] == 76, - "incorrect value for contents[133], expected 76, is %d", - check_msg->contents[133]); - ck_assert_msg(check_msg->contents[134] == 227, - "incorrect value for contents[134], expected 227, is %d", - check_msg->contents[134]); - ck_assert_msg(check_msg->contents[135] == 88, - "incorrect value for contents[135], expected 88, is %d", - check_msg->contents[135]); - ck_assert_msg(check_msg->contents[136] == 12, - "incorrect value for contents[136], expected 12, is %d", - check_msg->contents[136]); - ck_assert_msg(check_msg->contents[137] == 95, - "incorrect value for contents[137], expected 95, is %d", - check_msg->contents[137]); - ck_assert_msg(check_msg->contents[138] == 112, - "incorrect value for contents[138], expected 112, is %d", - check_msg->contents[138]); - ck_assert_msg(check_msg->contents[139] == 209, - "incorrect value for contents[139], expected 209, is %d", - check_msg->contents[139]); - ck_assert_msg(check_msg->contents[140] == 183, - "incorrect value for contents[140], expected 183, is %d", - check_msg->contents[140]); - ck_assert_msg(check_msg->contents[141] == 127, - "incorrect value for contents[141], expected 127, is %d", - check_msg->contents[141]); - ck_assert_msg(check_msg->contents[142] == 4, - "incorrect value for contents[142], expected 4, is %d", - check_msg->contents[142]); - ck_assert_msg(check_msg->contents[143] == 165, - "incorrect value for contents[143], expected 165, is %d", - check_msg->contents[143]); - ck_assert_msg(check_msg->contents[144] == 189, - "incorrect value for contents[144], expected 189, is %d", - check_msg->contents[144]); - ck_assert_msg(check_msg->contents[145] == 44, - "incorrect value for contents[145], expected 44, is %d", - check_msg->contents[145]); - ck_assert_msg(check_msg->contents[146] == 239, - "incorrect value for contents[146], expected 239, is %d", - check_msg->contents[146]); - ck_assert_msg(check_msg->contents[147] == 232, - "incorrect value for contents[147], expected 232, is %d", - check_msg->contents[147]); - ck_assert_msg(check_msg->contents[148] == 132, - "incorrect value for contents[148], expected 132, is %d", - check_msg->contents[148]); - ck_assert_msg(check_msg->contents[149] == 9, - "incorrect value for contents[149], expected 9, is %d", - check_msg->contents[149]); - ck_assert_msg(check_msg->contents[150] == 114, - "incorrect value for contents[150], expected 114, is %d", - check_msg->contents[150]); - ck_assert_msg(check_msg->contents[151] == 184, - "incorrect value for contents[151], expected 184, is %d", - check_msg->contents[151]); - ck_assert_msg(check_msg->contents[152] == 249, - "incorrect value for contents[152], expected 249, is %d", - check_msg->contents[152]); - ck_assert_msg(check_msg->contents[153] == 208, - "incorrect value for contents[153], expected 208, is %d", - check_msg->contents[153]); - ck_assert_msg(check_msg->contents[154] == 246, - "incorrect value for contents[154], expected 246, is %d", - check_msg->contents[154]); - ck_assert_msg(check_msg->contents[155] == 194, - "incorrect value for contents[155], expected 194, is %d", - check_msg->contents[155]); - ck_assert_msg(check_msg->contents[156] == 250, - "incorrect value for contents[156], expected 250, is %d", - check_msg->contents[156]); - ck_assert_msg(check_msg->contents[157] == 2, - "incorrect value for contents[157], expected 2, is %d", - check_msg->contents[157]); - ck_assert_msg(check_msg->contents[158] == 97, - "incorrect value for contents[158], expected 97, is %d", - check_msg->contents[158]); - ck_assert_msg(check_msg->contents[159] == 173, - "incorrect value for contents[159], expected 173, is %d", - check_msg->contents[159]); - ck_assert_msg(check_msg->contents[160] == 157, - "incorrect value for contents[160], expected 157, is %d", - check_msg->contents[160]); - ck_assert_msg(check_msg->contents[161] == 202, - "incorrect value for contents[161], expected 202, is %d", - check_msg->contents[161]); - ck_assert_msg(check_msg->contents[162] == 172, - "incorrect value for contents[162], expected 172, is %d", - check_msg->contents[162]); - ck_assert_msg(check_msg->contents[163] == 180, - "incorrect value for contents[163], expected 180, is %d", - check_msg->contents[163]); - ck_assert_msg(check_msg->contents[164] == 150, - "incorrect value for contents[164], expected 150, is %d", - check_msg->contents[164]); - ck_assert_msg(check_msg->contents[165] == 213, - "incorrect value for contents[165], expected 213, is %d", - check_msg->contents[165]); - ck_assert_msg(check_msg->contents[166] == 193, - "incorrect value for contents[166], expected 193, is %d", - check_msg->contents[166]); - ck_assert_msg(check_msg->contents[167] == 177, - "incorrect value for contents[167], expected 177, is %d", - check_msg->contents[167]); - ck_assert_msg(check_msg->contents[168] == 209, - "incorrect value for contents[168], expected 209, is %d", - check_msg->contents[168]); - ck_assert_msg(check_msg->contents[169] == 156, - "incorrect value for contents[169], expected 156, is %d", - check_msg->contents[169]); - ck_assert_msg(check_msg->contents[170] == 20, - "incorrect value for contents[170], expected 20, is %d", - check_msg->contents[170]); - ck_assert_msg(check_msg->contents[171] == 174, - "incorrect value for contents[171], expected 174, is %d", - check_msg->contents[171]); - ck_assert_msg(check_msg->contents[172] == 18, - "incorrect value for contents[172], expected 18, is %d", - check_msg->contents[172]); - ck_assert_msg(check_msg->contents[173] == 73, - "incorrect value for contents[173], expected 73, is %d", - check_msg->contents[173]); - ck_assert_msg(check_msg->contents[174] == 132, - "incorrect value for contents[174], expected 132, is %d", - check_msg->contents[174]); - ck_assert_msg(check_msg->contents[175] == 215, - "incorrect value for contents[175], expected 215, is %d", - check_msg->contents[175]); - ck_assert_msg(check_msg->contents[176] == 115, - "incorrect value for contents[176], expected 115, is %d", - check_msg->contents[176]); - ck_assert_msg(check_msg->contents[177] == 128, - "incorrect value for contents[177], expected 128, is %d", - check_msg->contents[177]); - ck_assert_msg(check_msg->contents[178] == 175, - "incorrect value for contents[178], expected 175, is %d", - check_msg->contents[178]); - ck_assert_msg(check_msg->contents[179] == 169, - "incorrect value for contents[179], expected 169, is %d", - check_msg->contents[179]); - ck_assert_msg(check_msg->contents[180] == 116, - "incorrect value for contents[180], expected 116, is %d", - check_msg->contents[180]); - ck_assert_msg(check_msg->contents[181] == 132, - "incorrect value for contents[181], expected 132, is %d", - check_msg->contents[181]); - ck_assert_msg(check_msg->contents[182] == 100, - "incorrect value for contents[182], expected 100, is %d", - check_msg->contents[182]); - ck_assert_msg(check_msg->contents[183] == 72, - "incorrect value for contents[183], expected 72, is %d", - check_msg->contents[183]); - ck_assert_msg(check_msg->contents[184] == 45, - "incorrect value for contents[184], expected 45, is %d", - check_msg->contents[184]); - ck_assert_msg(check_msg->contents[185] == 25, - "incorrect value for contents[185], expected 25, is %d", - check_msg->contents[185]); - ck_assert_msg(check_msg->contents[186] == 14, - "incorrect value for contents[186], expected 14, is %d", - check_msg->contents[186]); - ck_assert_msg(check_msg->contents[187] == 205, - "incorrect value for contents[187], expected 205, is %d", - check_msg->contents[187]); - ck_assert_msg(check_msg->contents[188] == 213, - "incorrect value for contents[188], expected 213, is %d", - check_msg->contents[188]); - ck_assert_msg(check_msg->contents[189] == 145, - "incorrect value for contents[189], expected 145, is %d", - check_msg->contents[189]); - ck_assert_msg(check_msg->contents[190] == 68, - "incorrect value for contents[190], expected 68, is %d", - check_msg->contents[190]); - ck_assert_msg(check_msg->contents[191] == 137, - "incorrect value for contents[191], expected 137, is %d", - check_msg->contents[191]); - ck_assert_msg(check_msg->contents[192] == 249, - "incorrect value for contents[192], expected 249, is %d", - check_msg->contents[192]); - ck_assert_msg(check_msg->contents[193] == 54, - "incorrect value for contents[193], expected 54, is %d", - check_msg->contents[193]); - ck_assert_msg(check_msg->contents[194] == 40, - "incorrect value for contents[194], expected 40, is %d", - check_msg->contents[194]); - ck_assert_msg(check_msg->contents[195] == 174, - "incorrect value for contents[195], expected 174, is %d", - check_msg->contents[195]); - ck_assert_msg(check_msg->contents[196] == 215, - "incorrect value for contents[196], expected 215, is %d", - check_msg->contents[196]); - ck_assert_msg(check_msg->contents[197] == 148, - "incorrect value for contents[197], expected 148, is %d", - check_msg->contents[197]); - ck_assert_msg(check_msg->contents[198] == 166, - "incorrect value for contents[198], expected 166, is %d", - check_msg->contents[198]); - ck_assert_msg(check_msg->contents[199] == 190, - "incorrect value for contents[199], expected 190, is %d", - check_msg->contents[199]); - ck_assert_msg(check_msg->contents[200] == 63, - "incorrect value for contents[200], expected 63, is %d", - check_msg->contents[200]); - ck_assert_msg(check_msg->contents[201] == 118, - "incorrect value for contents[201], expected 118, is %d", - check_msg->contents[201]); - ck_assert_msg(check_msg->contents[202] == 6, - "incorrect value for contents[202], expected 6, is %d", - check_msg->contents[202]); - ck_assert_msg(check_msg->contents[203] == 165, - "incorrect value for contents[203], expected 165, is %d", - check_msg->contents[203]); - ck_assert_msg(check_msg->contents[204] == 212, - "incorrect value for contents[204], expected 212, is %d", - check_msg->contents[204]); - ck_assert_msg(check_msg->contents[205] == 74, - "incorrect value for contents[205], expected 74, is %d", - check_msg->contents[205]); - ck_assert_msg(check_msg->contents[206] == 68, - "incorrect value for contents[206], expected 68, is %d", - check_msg->contents[206]); - ck_assert_msg(check_msg->contents[207] == 200, - "incorrect value for contents[207], expected 200, is %d", - check_msg->contents[207]); - ck_assert_msg(check_msg->contents[208] == 38, - "incorrect value for contents[208], expected 38, is %d", - check_msg->contents[208]); - ck_assert_msg(check_msg->contents[209] == 139, - "incorrect value for contents[209], expected 139, is %d", - check_msg->contents[209]); - ck_assert_msg(check_msg->contents[210] == 212, - "incorrect value for contents[210], expected 212, is %d", - check_msg->contents[210]); - ck_assert_msg(check_msg->contents[211] == 112, - "incorrect value for contents[211], expected 112, is %d", - check_msg->contents[211]); - ck_assert_msg(check_msg->contents[212] == 45, - "incorrect value for contents[212], expected 45, is %d", - check_msg->contents[212]); - ck_assert_msg(check_msg->contents[213] == 167, - "incorrect value for contents[213], expected 167, is %d", - check_msg->contents[213]); - ck_assert_msg(check_msg->contents[214] == 236, - "incorrect value for contents[214], expected 236, is %d", - check_msg->contents[214]); - ck_assert_msg(check_msg->contents[215] == 255, - "incorrect value for contents[215], expected 255, is %d", - check_msg->contents[215]); - ck_assert_msg(check_msg->contents[216] == 106, - "incorrect value for contents[216], expected 106, is %d", - check_msg->contents[216]); - ck_assert_msg(check_msg->contents[217] == 92, - "incorrect value for contents[217], expected 92, is %d", - check_msg->contents[217]); - ck_assert_msg(check_msg->contents[218] == 132, - "incorrect value for contents[218], expected 132, is %d", - check_msg->contents[218]); - ck_assert_msg(check_msg->contents[219] == 59, - "incorrect value for contents[219], expected 59, is %d", - check_msg->contents[219]); - ck_assert_msg(check_msg->contents[220] == 61, - "incorrect value for contents[220], expected 61, is %d", - check_msg->contents[220]); - ck_assert_msg(check_msg->contents[221] == 233, - "incorrect value for contents[221], expected 233, is %d", - check_msg->contents[221]); - ck_assert_msg(check_msg->contents[222] == 3, - "incorrect value for contents[222], expected 3, is %d", - check_msg->contents[222]); - ck_assert_msg(check_msg->contents[223] == 246, - "incorrect value for contents[223], expected 246, is %d", - check_msg->contents[223]); - ck_assert_msg(check_msg->contents[224] == 158, - "incorrect value for contents[224], expected 158, is %d", - check_msg->contents[224]); - ck_assert_msg(check_msg->contents[225] == 83, - "incorrect value for contents[225], expected 83, is %d", - check_msg->contents[225]); - ck_assert_msg(check_msg->contents[226] == 134, - "incorrect value for contents[226], expected 134, is %d", - check_msg->contents[226]); - ck_assert_msg(check_msg->contents[227] == 246, - "incorrect value for contents[227], expected 246, is %d", - check_msg->contents[227]); - ck_assert_msg(check_msg->contents[228] == 154, - "incorrect value for contents[228], expected 154, is %d", - check_msg->contents[228]); - ck_assert_msg(check_msg->contents[229] == 17, - "incorrect value for contents[229], expected 17, is %d", - check_msg->contents[229]); - ck_assert_msg(check_msg->contents[230] == 0, - "incorrect value for contents[230], expected 0, is %d", - check_msg->contents[230]); - ck_assert_msg(check_msg->contents[231] == 6, - "incorrect value for contents[231], expected 6, is %d", - check_msg->contents[231]); - ck_assert_msg(check_msg->contents[232] == 56, - "incorrect value for contents[232], expected 56, is %d", - check_msg->contents[232]); - ck_assert_msg(check_msg->contents[233] == 216, - "incorrect value for contents[233], expected 216, is %d", - check_msg->contents[233]); - ck_assert_msg(check_msg->contents[234] == 19, - "incorrect value for contents[234], expected 19, is %d", - check_msg->contents[234]); - ck_assert_msg(check_msg->contents[235] == 216, - "incorrect value for contents[235], expected 216, is %d", - check_msg->contents[235]); - ck_assert_msg(check_msg->contents[236] == 70, - "incorrect value for contents[236], expected 70, is %d", - check_msg->contents[236]); - ck_assert_msg(check_msg->contents[237] == 71, - "incorrect value for contents[237], expected 71, is %d", - check_msg->contents[237]); - ck_assert_msg(check_msg->contents[238] == 161, - "incorrect value for contents[238], expected 161, is %d", - check_msg->contents[238]); - ck_assert_msg(check_msg->contents[239] == 184, - "incorrect value for contents[239], expected 184, is %d", - check_msg->contents[239]); - ck_assert_msg(check_msg->contents[240] == 5, - "incorrect value for contents[240], expected 5, is %d", - check_msg->contents[240]); - ck_assert_msg(check_msg->contents[241] == 177, - "incorrect value for contents[241], expected 177, is %d", - check_msg->contents[241]); - ck_assert_msg(check_msg->contents[242] == 45, - "incorrect value for contents[242], expected 45, is %d", - check_msg->contents[242]); - ck_assert_msg(check_msg->contents[243] == 37, - "incorrect value for contents[243], expected 37, is %d", - check_msg->contents[243]); - ck_assert_msg(check_msg->contents[244] == 98, - "incorrect value for contents[244], expected 98, is %d", - check_msg->contents[244]); - ck_assert_msg(check_msg->contents[245] == 56, - "incorrect value for contents[245], expected 56, is %d", - check_msg->contents[245]); - ck_assert_msg(check_msg->contents[246] == 149, - "incorrect value for contents[246], expected 149, is %d", - check_msg->contents[246]); - ck_assert_msg(check_msg->contents[247] == 0, - "incorrect value for contents[247], expected 0, is %d", - check_msg->contents[247]); - ck_assert_msg(check_msg->contents[248] == 73, - "incorrect value for contents[248], expected 73, is %d", - check_msg->contents[248]); - ck_assert_msg(check_msg->contents[249] == 221, - "incorrect value for contents[249], expected 221, is %d", - check_msg->contents[249]); - ck_assert_msg(check_msg->contents[250] == 105, - "incorrect value for contents[250], expected 105, is %d", - check_msg->contents[250]); - ck_assert_msg(check_msg->contents[251] == 239, - "incorrect value for contents[251], expected 239, is %d", - check_msg->contents[251]); - ck_assert_msg(check_msg->contents[252] == 168, - "incorrect value for contents[252], expected 168, is %d", - check_msg->contents[252]); - ck_assert_msg(check_msg->contents[253] == 205, - "incorrect value for contents[253], expected 205, is %d", - check_msg->contents[253]); - ck_assert_msg(check_msg->contents[254] == 85, - "incorrect value for contents[254], expected 85, is %d", - check_msg->contents[254]); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_user_MsgUserData_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_user_MsgUserData"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_user_MsgUserData"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_user_MsgUserData); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_vehicle_MsgOdometry.c b/c/test/legacy/auto_check_sbp_vehicle_MsgOdometry.c deleted file mode 100644 index 5b1afbcb55..0000000000 --- a/c/test/legacy/auto_check_sbp_vehicle_MsgOdometry.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/vehicle/test_MsgOdometry.yaml by generate.py. Do -// not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_vehicle_MsgOdometry) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x903, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x903, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 3, 9, 66, 0, 9, 8, 0, 0, 0, 7, 0, 0, 0, 1, 52, 99, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_odometry_t *test_msg = (msg_odometry_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 1; - test_msg->tow = 8; - test_msg->velocity = 7; - sbp_payload_send(&sbp_state, 0x903, 66, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 66, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 66, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x903, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_odometry_t *check_msg = (msg_odometry_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->tow == 8, - "incorrect value for tow, expected 8, is %d", check_msg->tow); - ck_assert_msg(check_msg->velocity == 7, - "incorrect value for velocity, expected 7, is %d", - check_msg->velocity); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_vehicle_MsgOdometry_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_vehicle_MsgOdometry"); - TCase *tc_acq = - tcase_create("Automated_Suite_legacy_auto_check_sbp_vehicle_MsgOdometry"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_vehicle_MsgOdometry); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/auto_check_sbp_vehicle_MsgWheeltick.c b/c/test/legacy/auto_check_sbp_vehicle_MsgWheeltick.c deleted file mode 100644 index f83f64dcc5..0000000000 --- a/c/test/legacy/auto_check_sbp_vehicle_MsgWheeltick.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/vehicle/test_MsgWheeltick.yaml by generate.py. -// Do not modify by hand! - -#include -#include -#include // for debugging -#include // for malloc - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void *last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() { - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void *context) { - last_io_context = context; - u32 real_n = n; //(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() { - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void *context) { - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], - u16 frame_len, u8 frame[], void *context) { - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST(test_legacy_auto_check_sbp_vehicle_MsgWheeltick) { - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message - // types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, 0x904, &msg_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, 0x904, &frame_callback, - &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { - 85, 4, 9, 107, 69, 14, 254, 27, 114, 44, 26, - 0, 0, 0, 1, 146, 225, 51, 9, 210, 36, 56, - }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - msg_wheeltick_t *test_msg = (msg_wheeltick_t *)test_msg_storage; - test_msg_len = sizeof(*test_msg); - test_msg->flags = 1; - test_msg->source = 146; - test_msg->ticks = -771148831; - test_msg->time = 112414825470; - sbp_payload_send(&sbp_state, 0x904, 17771, test_msg_len, test_msg_storage, - &dummy_write); - - ck_assert_msg( - test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame " - "from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == 17771, - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg( - memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == 17771, - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == 0x904, - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, - sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg( - memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload - // starts - msg_wheeltick_t *check_msg = (msg_wheeltick_t *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ck_assert_msg(check_msg->flags == 1, - "incorrect value for flags, expected 1, is %d", - check_msg->flags); - ck_assert_msg(check_msg->source == 146, - "incorrect value for source, expected 146, is %d", - check_msg->source); - ck_assert_msg(check_msg->ticks == -771148831, - "incorrect value for ticks, expected -771148831, is %d", - check_msg->ticks); - ck_assert_msg(check_msg->time == 112414825470, - "incorrect value for time, expected 112414825470, is %d", - check_msg->time); - } -} -END_TEST - -Suite *legacy_auto_check_sbp_vehicle_MsgWheeltick_suite(void) { - Suite *s = suite_create( - "SBP generated test suite: legacy_auto_check_sbp_vehicle_MsgWheeltick"); - TCase *tc_acq = tcase_create( - "Automated_Suite_legacy_auto_check_sbp_vehicle_MsgWheeltick"); - tcase_add_test(tc_acq, test_legacy_auto_check_sbp_vehicle_MsgWheeltick); - suite_add_tcase(s, tc_acq); - return s; -} \ No newline at end of file diff --git a/c/test/legacy/cpp/CMakeLists.txt b/c/test/legacy/cpp/CMakeLists.txt deleted file mode 100644 index deb8a38e7b..0000000000 --- a/c/test/legacy/cpp/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -FILE(GLOB generated_cpp_sources auto*.cc) - -swift_add_test(test-libsbp-cpp-legacy - UNIT_TEST - SRCS - test_sbp_stdio.cc - ${generated_cpp_sources} - INCLUDE - ${PROJECT_SOURCE_DIR}/include/libsbp - LINK - sbp - gtest_main) -swift_set_language_standards(test-libsbp-cpp-legacy) -swift_set_compile_options(test-libsbp-cpp-legacy - ADD - -Wno-error=array-bounds - -Wno-deprecated-declarations -) - -file(COPY sbp_data/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/c/test/legacy/cpp/sbp_data/) diff --git a/c/test/legacy/cpp/README.md b/c/test/legacy/cpp/README.md deleted file mode 100644 index 66ade87269..0000000000 --- a/c/test/legacy/cpp/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Unit tests - -Unit tests for the CPP files are defined in this folder. - -## Dependencies - -`json2sbp`, which can be installed by following the instructions [here](https://github.com/swift-nav/libsbp/tree/master/haskell#install-from-hackage). - -## Test data - -The json test data is stored and edited inside the `json_data` folder. - -The unit tests run on the `.sbp` files stored inside the `sbp_data` folder, which are directly generated from the `.json` files by running the following commands: -``` -cd ./c/test/cpp -./generate_sbp_data.sh -``` -One should NOT modify the files within `sbp_data` directly, but should instead modify the corresponding `json_data` file and then regenerate the `.sbp` files and commit the results. diff --git a/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqResult.cc b/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqResult.cc deleted file mode 100644 index 7425928063..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqResult.cc +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/acquisition/test_MsgAcqResult.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqResult0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqResult0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_result_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_result_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqResult0, Test) { - uint8_t encoded_frame[] = { - 85, 47, 0, 195, 4, 14, 0, 0, 104, 65, 102, - 102, 144, 66, 205, 196, 0, 70, 8, 0, 207, 189, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_result_t *test_msg = (msg_acq_result_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cf = 8241.2001953125; - test_msg->cn0 = 14.5; - test_msg->cp = 72.19999694824219; - test_msg->sid.code = 0; - test_msg->sid.sat = 8; - - EXPECT_EQ(send_message(0x2f, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cf * 100 - 8241.20019531 * 100), 0.05) - << "incorrect value for cf, expected 8241.20019531, is " << last_msg_->cf; - EXPECT_LT((last_msg_->cn0 * 100 - 14.5 * 100), 0.05) - << "incorrect value for cn0, expected 14.5, is " << last_msg_->cn0; - EXPECT_LT((last_msg_->cp * 100 - 72.1999969482 * 100), 0.05) - << "incorrect value for cp, expected 72.1999969482, is " << last_msg_->cp; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 8) - << "incorrect value for sid.sat, expected 8, is " << last_msg_->sid.sat; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqResultDepA.cc b/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqResultDepA.cc deleted file mode 100644 index 0d1dfb5f8a..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqResultDepA.cc +++ /dev/null @@ -1,628 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/acquisition/test_MsgAcqResultDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_result_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_result_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 21, 0, 195, 4, 13, 0, 0, 104, 65, 0, - 192, 53, 68, 198, 199, 0, 70, 8, 2, 68, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_result_dep_a_t *test_msg = (msg_acq_result_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cf = 8241.943359375; - test_msg->cp = 727.0; - test_msg->prn = 8; - test_msg->snr = 14.5; - - EXPECT_EQ(send_message(0x15, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cf * 100 - 8241.94335938 * 100), 0.05) - << "incorrect value for cf, expected 8241.94335938, is " << last_msg_->cf; - EXPECT_LT((last_msg_->cp * 100 - 727.0 * 100), 0.05) - << "incorrect value for cp, expected 727.0, is " << last_msg_->cp; - EXPECT_EQ(get_asprn)>( - reinterpret_cast(&last_msg_->prn)), - 8) - << "incorrect value for prn, expected 8, is " << last_msg_->prn; - EXPECT_LT((last_msg_->snr * 100 - 14.5 * 100), 0.05) - << "incorrect value for snr, expected 14.5, is " << last_msg_->snr; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_result_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_result_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA1, Test) { - uint8_t encoded_frame[] = { - 85, 21, 0, 195, 4, 13, 205, 204, 116, 65, 0, - 192, 179, 67, 33, 81, 59, 68, 9, 219, 27, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_result_dep_a_t *test_msg = (msg_acq_result_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cf = 749.2676391601562; - test_msg->cp = 359.5; - test_msg->prn = 9; - test_msg->snr = 15.300000190734863; - - EXPECT_EQ(send_message(0x15, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cf * 100 - 749.26763916 * 100), 0.05) - << "incorrect value for cf, expected 749.26763916, is " << last_msg_->cf; - EXPECT_LT((last_msg_->cp * 100 - 359.5 * 100), 0.05) - << "incorrect value for cp, expected 359.5, is " << last_msg_->cp; - EXPECT_EQ(get_asprn)>( - reinterpret_cast(&last_msg_->prn)), - 9) - << "incorrect value for prn, expected 9, is " << last_msg_->prn; - EXPECT_LT((last_msg_->snr * 100 - 15.3000001907 * 100), 0.05) - << "incorrect value for snr, expected 15.3000001907, is " - << last_msg_->snr; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_result_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_result_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA2, Test) { - uint8_t encoded_frame[] = { - 85, 21, 0, 195, 4, 13, 205, 204, 144, 65, 0, - 0, 34, 66, 57, 237, 202, 197, 11, 150, 35, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_result_dep_a_t *test_msg = (msg_acq_result_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cf = -6493.65283203125; - test_msg->cp = 40.5; - test_msg->prn = 11; - test_msg->snr = 18.100000381469727; - - EXPECT_EQ(send_message(0x15, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cf * 100 - -6493.65283203 * 100), 0.05) - << "incorrect value for cf, expected -6493.65283203, is " - << last_msg_->cf; - EXPECT_LT((last_msg_->cp * 100 - 40.5 * 100), 0.05) - << "incorrect value for cp, expected 40.5, is " << last_msg_->cp; - EXPECT_EQ(get_asprn)>( - reinterpret_cast(&last_msg_->prn)), - 11) - << "incorrect value for prn, expected 11, is " << last_msg_->prn; - EXPECT_LT((last_msg_->snr * 100 - 18.1000003815 * 100), 0.05) - << "incorrect value for snr, expected 18.1000003815, is " - << last_msg_->snr; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_result_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_result_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA3, Test) { - uint8_t encoded_frame[] = { - 85, 21, 0, 195, 4, 13, 205, 204, 116, 65, 0, - 32, 9, 68, 129, 193, 121, 196, 12, 146, 118, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_result_dep_a_t *test_msg = (msg_acq_result_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cf = -999.0234985351562; - test_msg->cp = 548.5; - test_msg->prn = 12; - test_msg->snr = 15.300000190734863; - - EXPECT_EQ(send_message(0x15, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cf * 100 - -999.023498535 * 100), 0.05) - << "incorrect value for cf, expected -999.023498535, is " - << last_msg_->cf; - EXPECT_LT((last_msg_->cp * 100 - 548.5 * 100), 0.05) - << "incorrect value for cp, expected 548.5, is " << last_msg_->cp; - EXPECT_EQ(get_asprn)>( - reinterpret_cast(&last_msg_->prn)), - 12) - << "incorrect value for prn, expected 12, is " << last_msg_->prn; - EXPECT_LT((last_msg_->snr * 100 - 15.3000001907 * 100), 0.05) - << "incorrect value for snr, expected 15.3000001907, is " - << last_msg_->snr; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_result_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_result_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA4, Test) { - uint8_t encoded_frame[] = { - 85, 21, 0, 195, 4, 13, 205, 204, 116, 65, 0, - 32, 67, 68, 228, 74, 148, 69, 14, 23, 75, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_result_dep_a_t *test_msg = (msg_acq_result_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cf = 4745.361328125; - test_msg->cp = 780.5; - test_msg->prn = 14; - test_msg->snr = 15.300000190734863; - - EXPECT_EQ(send_message(0x15, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cf * 100 - 4745.36132812 * 100), 0.05) - << "incorrect value for cf, expected 4745.36132812, is " << last_msg_->cf; - EXPECT_LT((last_msg_->cp * 100 - 780.5 * 100), 0.05) - << "incorrect value for cp, expected 780.5, is " << last_msg_->cp; - EXPECT_EQ(get_asprn)>( - reinterpret_cast(&last_msg_->prn)), - 14) - << "incorrect value for prn, expected 14, is " << last_msg_->prn; - EXPECT_LT((last_msg_->snr * 100 - 15.3000001907 * 100), 0.05) - << "incorrect value for snr, expected 15.3000001907, is " - << last_msg_->snr; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA5 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA5() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_result_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_result_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepA5, Test) { - uint8_t encoded_frame[] = { - 85, 21, 0, 195, 4, 13, 228, 56, 35, 67, 0, - 32, 18, 68, 129, 193, 249, 195, 0, 204, 207, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_result_dep_a_t *test_msg = (msg_acq_result_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cf = -499.5117492675781; - test_msg->cp = 584.5; - test_msg->prn = 0; - test_msg->snr = 163.22222900390625; - - EXPECT_EQ(send_message(0x15, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cf * 100 - -499.511749268 * 100), 0.05) - << "incorrect value for cf, expected -499.511749268, is " - << last_msg_->cf; - EXPECT_LT((last_msg_->cp * 100 - 584.5 * 100), 0.05) - << "incorrect value for cp, expected 584.5, is " << last_msg_->cp; - EXPECT_EQ(get_asprn)>( - reinterpret_cast(&last_msg_->prn)), - 0) - << "incorrect value for prn, expected 0, is " << last_msg_->prn; - EXPECT_LT((last_msg_->snr * 100 - 163.222229004 * 100), 0.05) - << "incorrect value for snr, expected 163.222229004, is " - << last_msg_->snr; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqResultDepB.cc b/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqResultDepB.cc deleted file mode 100644 index 8581e1b7cc..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqResultDepB.cc +++ /dev/null @@ -1,585 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/acquisition/test_MsgAcqResultDepB.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_result_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_result_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB0, Test) { - uint8_t encoded_frame[] = { - 85, 20, 0, 246, 215, 16, 137, 167, 18, 66, 0, 0, - 161, 67, 240, 24, 156, 69, 9, 0, 0, 0, 80, 195, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_result_dep_b_t *test_msg = (msg_acq_result_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cf = 4995.1171875; - test_msg->cp = 322.0; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 9; - test_msg->snr = 36.66360855102539; - - EXPECT_EQ(send_message(0x14, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cf * 100 - 4995.1171875 * 100), 0.05) - << "incorrect value for cf, expected 4995.1171875, is " << last_msg_->cf; - EXPECT_LT((last_msg_->cp * 100 - 322.0 * 100), 0.05) - << "incorrect value for cp, expected 322.0, is " << last_msg_->cp; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 9) - << "incorrect value for sid.sat, expected 9, is " << last_msg_->sid.sat; - EXPECT_LT((last_msg_->snr * 100 - 36.663608551 * 100), 0.05) - << "incorrect value for snr, expected 36.663608551, is " - << last_msg_->snr; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_result_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_result_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB1, Test) { - uint8_t encoded_frame[] = { - 85, 20, 0, 246, 215, 16, 206, 172, 16, 66, 0, 192, - 82, 68, 198, 199, 0, 198, 3, 0, 0, 0, 149, 143, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_result_dep_b_t *test_msg = (msg_acq_result_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cf = -8241.943359375; - test_msg->cp = 843.0; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 3; - test_msg->snr = 36.16875457763672; - - EXPECT_EQ(send_message(0x14, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cf * 100 - -8241.94335938 * 100), 0.05) - << "incorrect value for cf, expected -8241.94335938, is " - << last_msg_->cf; - EXPECT_LT((last_msg_->cp * 100 - 843.0 * 100), 0.05) - << "incorrect value for cp, expected 843.0, is " << last_msg_->cp; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 3) - << "incorrect value for sid.sat, expected 3, is " << last_msg_->sid.sat; - EXPECT_LT((last_msg_->snr * 100 - 36.1687545776 * 100), 0.05) - << "incorrect value for snr, expected 36.1687545776, is " - << last_msg_->snr; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_result_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_result_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB2, Test) { - uint8_t encoded_frame[] = { - 85, 20, 0, 246, 215, 16, 228, 27, 15, 66, 0, 128, - 70, 68, 228, 74, 148, 69, 18, 0, 0, 0, 179, 155, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_result_dep_b_t *test_msg = (msg_acq_result_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cf = 4745.361328125; - test_msg->cp = 794.0; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 18; - test_msg->snr = 35.77723693847656; - - EXPECT_EQ(send_message(0x14, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cf * 100 - 4745.36132812 * 100), 0.05) - << "incorrect value for cf, expected 4745.36132812, is " << last_msg_->cf; - EXPECT_LT((last_msg_->cp * 100 - 794.0 * 100), 0.05) - << "incorrect value for cp, expected 794.0, is " << last_msg_->cp; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 18) - << "incorrect value for sid.sat, expected 18, is " << last_msg_->sid.sat; - EXPECT_LT((last_msg_->snr * 100 - 35.7772369385 * 100), 0.05) - << "incorrect value for snr, expected 35.7772369385, is " - << last_msg_->snr; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_result_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_result_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB3, Test) { - uint8_t encoded_frame[] = { - 85, 20, 0, 246, 215, 16, 46, 199, 14, 66, 0, 64, - 129, 67, 240, 24, 28, 69, 17, 0, 0, 0, 18, 181, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_result_dep_b_t *test_msg = (msg_acq_result_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cf = 2497.55859375; - test_msg->cp = 258.5; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 17; - test_msg->snr = 35.69451141357422; - - EXPECT_EQ(send_message(0x14, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cf * 100 - 2497.55859375 * 100), 0.05) - << "incorrect value for cf, expected 2497.55859375, is " << last_msg_->cf; - EXPECT_LT((last_msg_->cp * 100 - 258.5 * 100), 0.05) - << "incorrect value for cp, expected 258.5, is " << last_msg_->cp; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 17) - << "incorrect value for sid.sat, expected 17, is " << last_msg_->sid.sat; - EXPECT_LT((last_msg_->snr * 100 - 35.6945114136 * 100), 0.05) - << "incorrect value for snr, expected 35.6945114136, is " - << last_msg_->snr; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_result_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_result_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepB4, Test) { - uint8_t encoded_frame[] = { - 85, 20, 0, 246, 215, 16, 194, 24, 14, 66, 0, 128, - 2, 68, 129, 193, 249, 195, 5, 0, 0, 0, 35, 203, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_result_dep_b_t *test_msg = (msg_acq_result_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cf = -499.5117492675781; - test_msg->cp = 522.0; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 5; - test_msg->snr = 35.52417755126953; - - EXPECT_EQ(send_message(0x14, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cf * 100 - -499.511749268 * 100), 0.05) - << "incorrect value for cf, expected -499.511749268, is " - << last_msg_->cf; - EXPECT_LT((last_msg_->cp * 100 - 522.0 * 100), 0.05) - << "incorrect value for cp, expected 522.0, is " << last_msg_->cp; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 5) - << "incorrect value for sid.sat, expected 5, is " << last_msg_->sid.sat; - EXPECT_LT((last_msg_->snr * 100 - 35.5241775513 * 100), 0.05) - << "incorrect value for snr, expected 35.5241775513, is " - << last_msg_->snr; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqResultDepC.cc b/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqResultDepC.cc deleted file mode 100644 index a2e7e1828c..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqResultDepC.cc +++ /dev/null @@ -1,584 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/acquisition/test_MsgAcqResultDepC.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_result_dep_c_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_result_dep_c_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC0, Test) { - uint8_t encoded_frame[] = { - 85, 31, 0, 40, 12, 16, 72, 9, 34, 66, 155, 152, - 228, 67, 28, 34, 221, 68, 10, 0, 0, 0, 9, 189, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_result_dep_c_t *test_msg = (msg_acq_result_dep_c_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cf = 1769.06591796875; - test_msg->cn0 = 40.509063720703125; - test_msg->cp = 457.1922302246094; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 10; - - EXPECT_EQ(send_message(0x1f, 3112, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 3112); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cf * 100 - 1769.06591797 * 100), 0.05) - << "incorrect value for cf, expected 1769.06591797, is " << last_msg_->cf; - EXPECT_LT((last_msg_->cn0 * 100 - 40.5090637207 * 100), 0.05) - << "incorrect value for cn0, expected 40.5090637207, is " - << last_msg_->cn0; - EXPECT_LT((last_msg_->cp * 100 - 457.192230225 * 100), 0.05) - << "incorrect value for cp, expected 457.192230225, is " << last_msg_->cp; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 10) - << "incorrect value for sid.sat, expected 10, is " << last_msg_->sid.sat; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_result_dep_c_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_result_dep_c_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC1, Test) { - uint8_t encoded_frame[] = { - 85, 31, 0, 40, 12, 16, 132, 250, 45, 66, 207, 93, - 88, 68, 68, 185, 252, 195, 6, 0, 0, 0, 136, 185, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_result_dep_c_t *test_msg = (msg_acq_result_dep_c_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cf = -505.4473876953125; - test_msg->cn0 = 43.49464416503906; - test_msg->cp = 865.4657592773438; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 6; - - EXPECT_EQ(send_message(0x1f, 3112, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 3112); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cf * 100 - -505.447387695 * 100), 0.05) - << "incorrect value for cf, expected -505.447387695, is " - << last_msg_->cf; - EXPECT_LT((last_msg_->cn0 * 100 - 43.494644165 * 100), 0.05) - << "incorrect value for cn0, expected 43.494644165, is " - << last_msg_->cn0; - EXPECT_LT((last_msg_->cp * 100 - 865.465759277 * 100), 0.05) - << "incorrect value for cp, expected 865.465759277, is " << last_msg_->cp; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 6) - << "incorrect value for sid.sat, expected 6, is " << last_msg_->sid.sat; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_result_dep_c_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_result_dep_c_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC2, Test) { - uint8_t encoded_frame[] = { - 85, 31, 0, 40, 12, 16, 163, 223, 24, 66, 64, 91, - 102, 67, 202, 243, 157, 196, 13, 0, 0, 0, 150, 161, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_result_dep_c_t *test_msg = (msg_acq_result_dep_c_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cf = -1263.618408203125; - test_msg->cn0 = 38.2183952331543; - test_msg->cp = 230.3564453125; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 13; - - EXPECT_EQ(send_message(0x1f, 3112, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 3112); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cf * 100 - -1263.6184082 * 100), 0.05) - << "incorrect value for cf, expected -1263.6184082, is " << last_msg_->cf; - EXPECT_LT((last_msg_->cn0 * 100 - 38.2183952332 * 100), 0.05) - << "incorrect value for cn0, expected 38.2183952332, is " - << last_msg_->cn0; - EXPECT_LT((last_msg_->cp * 100 - 230.356445312 * 100), 0.05) - << "incorrect value for cp, expected 230.356445312, is " << last_msg_->cp; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 13) - << "incorrect value for sid.sat, expected 13, is " << last_msg_->sid.sat; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_result_dep_c_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_result_dep_c_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC3, Test) { - uint8_t encoded_frame[] = { - 85, 31, 0, 40, 12, 16, 129, 65, 21, 66, 224, 214, - 124, 67, 243, 138, 61, 69, 1, 0, 0, 0, 109, 209, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_result_dep_c_t *test_msg = (msg_acq_result_dep_c_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cf = 3032.684326171875; - test_msg->cn0 = 37.313968658447266; - test_msg->cp = 252.83935546875; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 1; - - EXPECT_EQ(send_message(0x1f, 3112, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 3112); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cf * 100 - 3032.68432617 * 100), 0.05) - << "incorrect value for cf, expected 3032.68432617, is " << last_msg_->cf; - EXPECT_LT((last_msg_->cn0 * 100 - 37.3139686584 * 100), 0.05) - << "incorrect value for cn0, expected 37.3139686584, is " - << last_msg_->cn0; - EXPECT_LT((last_msg_->cp * 100 - 252.839355469 * 100), 0.05) - << "incorrect value for cp, expected 252.839355469, is " << last_msg_->cp; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 1) - << "incorrect value for sid.sat, expected 1, is " << last_msg_->sid.sat; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_result_dep_c_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_result_dep_c_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqResultDepC4, Test) { - uint8_t encoded_frame[] = { - 85, 31, 0, 40, 12, 16, 126, 35, 62, 66, 226, 37, - 102, 68, 202, 243, 29, 69, 27, 0, 0, 0, 91, 67, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_result_dep_c_t *test_msg = (msg_acq_result_dep_c_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cf = 2527.23681640625; - test_msg->cn0 = 47.53466033935547; - test_msg->cp = 920.5919189453125; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 27; - - EXPECT_EQ(send_message(0x1f, 3112, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 3112); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cf * 100 - 2527.23681641 * 100), 0.05) - << "incorrect value for cf, expected 2527.23681641, is " << last_msg_->cf; - EXPECT_LT((last_msg_->cn0 * 100 - 47.5346603394 * 100), 0.05) - << "incorrect value for cn0, expected 47.5346603394, is " - << last_msg_->cn0; - EXPECT_LT((last_msg_->cp * 100 - 920.591918945 * 100), 0.05) - << "incorrect value for cp, expected 920.591918945, is " << last_msg_->cp; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 27) - << "incorrect value for sid.sat, expected 27, is " << last_msg_->sid.sat; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqSvProfile.cc b/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqSvProfile.cc deleted file mode 100644 index aa75ced9ac..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqSvProfile.cc +++ /dev/null @@ -1,413 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/acquisition/test_MsgAcqSvProfile.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqSvProfile0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqSvProfile0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_sv_profile_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_sv_profile_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqSvProfile0, Test) { - uint8_t encoded_frame[] = { - 85, 46, 0, 195, 4, 99, 7, 13, 38, 0, 97, 22, 0, 174, 0, 52, - 0, 0, 0, 49, 0, 0, 0, 61, 0, 0, 0, 147, 0, 0, 0, 47, - 0, 0, 0, 140, 0, 0, 0, 166, 210, 59, 0, 253, 23, 1, 121, 0, - 190, 0, 0, 0, 175, 0, 0, 0, 175, 0, 0, 0, 142, 0, 0, 0, - 237, 0, 0, 0, 12, 0, 0, 0, 126, 88, 21, 0, 153, 24, 0, 8, - 0, 130, 0, 0, 0, 172, 0, 0, 0, 91, 0, 0, 0, 191, 0, 0, - 0, 84, 0, 0, 0, 82, 0, 0, 0, 168, 177, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_sv_profile_t *test_msg = (msg_acq_sv_profile_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->acq_sv_profile) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->acq_sv_profile[0])); - } - test_msg->acq_sv_profile[0].bin_width = 174; - test_msg->acq_sv_profile[0].cf = 47; - test_msg->acq_sv_profile[0].cf_max = 147; - test_msg->acq_sv_profile[0].cf_min = 61; - test_msg->acq_sv_profile[0].cn0 = 38; - test_msg->acq_sv_profile[0].cp = 140; - test_msg->acq_sv_profile[0].int_time = 97; - test_msg->acq_sv_profile[0].job_type = 7; - test_msg->acq_sv_profile[0].sid.code = 0; - test_msg->acq_sv_profile[0].sid.sat = 22; - test_msg->acq_sv_profile[0].status = 13; - test_msg->acq_sv_profile[0].time_spent = 49; - test_msg->acq_sv_profile[0].timestamp = 52; - if (sizeof(test_msg->acq_sv_profile) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->acq_sv_profile[0])); - } - test_msg->acq_sv_profile[1].bin_width = 121; - test_msg->acq_sv_profile[1].cf = 237; - test_msg->acq_sv_profile[1].cf_max = 142; - test_msg->acq_sv_profile[1].cf_min = 175; - test_msg->acq_sv_profile[1].cn0 = 59; - test_msg->acq_sv_profile[1].cp = 12; - test_msg->acq_sv_profile[1].int_time = 253; - test_msg->acq_sv_profile[1].job_type = 166; - test_msg->acq_sv_profile[1].sid.code = 1; - test_msg->acq_sv_profile[1].sid.sat = 23; - test_msg->acq_sv_profile[1].status = 210; - test_msg->acq_sv_profile[1].time_spent = 175; - test_msg->acq_sv_profile[1].timestamp = 190; - if (sizeof(test_msg->acq_sv_profile) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->acq_sv_profile[0])); - } - test_msg->acq_sv_profile[2].bin_width = 8; - test_msg->acq_sv_profile[2].cf = 84; - test_msg->acq_sv_profile[2].cf_max = 191; - test_msg->acq_sv_profile[2].cf_min = 91; - test_msg->acq_sv_profile[2].cn0 = 21; - test_msg->acq_sv_profile[2].cp = 82; - test_msg->acq_sv_profile[2].int_time = 153; - test_msg->acq_sv_profile[2].job_type = 126; - test_msg->acq_sv_profile[2].sid.code = 0; - test_msg->acq_sv_profile[2].sid.sat = 24; - test_msg->acq_sv_profile[2].status = 88; - test_msg->acq_sv_profile[2].time_spent = 172; - test_msg->acq_sv_profile[2].timestamp = 130; - - EXPECT_EQ(send_message(0x2e, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asacq_sv_profile[0].bin_width)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].bin_width)), - 174) - << "incorrect value for acq_sv_profile[0].bin_width, expected 174, is " - << last_msg_->acq_sv_profile[0].bin_width; - EXPECT_EQ( - get_asacq_sv_profile[0].cf)>( - reinterpret_cast(&last_msg_->acq_sv_profile[0].cf)), - 47) - << "incorrect value for acq_sv_profile[0].cf, expected 47, is " - << last_msg_->acq_sv_profile[0].cf; - EXPECT_EQ(get_asacq_sv_profile[0].cf_max)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].cf_max)), - 147) - << "incorrect value for acq_sv_profile[0].cf_max, expected 147, is " - << last_msg_->acq_sv_profile[0].cf_max; - EXPECT_EQ(get_asacq_sv_profile[0].cf_min)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].cf_min)), - 61) - << "incorrect value for acq_sv_profile[0].cf_min, expected 61, is " - << last_msg_->acq_sv_profile[0].cf_min; - EXPECT_EQ( - get_asacq_sv_profile[0].cn0)>( - reinterpret_cast(&last_msg_->acq_sv_profile[0].cn0)), - 38) - << "incorrect value for acq_sv_profile[0].cn0, expected 38, is " - << last_msg_->acq_sv_profile[0].cn0; - EXPECT_EQ( - get_asacq_sv_profile[0].cp)>( - reinterpret_cast(&last_msg_->acq_sv_profile[0].cp)), - 140) - << "incorrect value for acq_sv_profile[0].cp, expected 140, is " - << last_msg_->acq_sv_profile[0].cp; - EXPECT_EQ(get_asacq_sv_profile[0].int_time)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].int_time)), - 97) - << "incorrect value for acq_sv_profile[0].int_time, expected 97, is " - << last_msg_->acq_sv_profile[0].int_time; - EXPECT_EQ(get_asacq_sv_profile[0].job_type)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].job_type)), - 7) - << "incorrect value for acq_sv_profile[0].job_type, expected 7, is " - << last_msg_->acq_sv_profile[0].job_type; - EXPECT_EQ(get_asacq_sv_profile[0].sid.code)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].sid.code)), - 0) - << "incorrect value for acq_sv_profile[0].sid.code, expected 0, is " - << last_msg_->acq_sv_profile[0].sid.code; - EXPECT_EQ(get_asacq_sv_profile[0].sid.sat)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].sid.sat)), - 22) - << "incorrect value for acq_sv_profile[0].sid.sat, expected 22, is " - << last_msg_->acq_sv_profile[0].sid.sat; - EXPECT_EQ(get_asacq_sv_profile[0].status)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].status)), - 13) - << "incorrect value for acq_sv_profile[0].status, expected 13, is " - << last_msg_->acq_sv_profile[0].status; - EXPECT_EQ(get_asacq_sv_profile[0].time_spent)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].time_spent)), - 49) - << "incorrect value for acq_sv_profile[0].time_spent, expected 49, is " - << last_msg_->acq_sv_profile[0].time_spent; - EXPECT_EQ(get_asacq_sv_profile[0].timestamp)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].timestamp)), - 52) - << "incorrect value for acq_sv_profile[0].timestamp, expected 52, is " - << last_msg_->acq_sv_profile[0].timestamp; - EXPECT_EQ(get_asacq_sv_profile[1].bin_width)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].bin_width)), - 121) - << "incorrect value for acq_sv_profile[1].bin_width, expected 121, is " - << last_msg_->acq_sv_profile[1].bin_width; - EXPECT_EQ( - get_asacq_sv_profile[1].cf)>( - reinterpret_cast(&last_msg_->acq_sv_profile[1].cf)), - 237) - << "incorrect value for acq_sv_profile[1].cf, expected 237, is " - << last_msg_->acq_sv_profile[1].cf; - EXPECT_EQ(get_asacq_sv_profile[1].cf_max)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].cf_max)), - 142) - << "incorrect value for acq_sv_profile[1].cf_max, expected 142, is " - << last_msg_->acq_sv_profile[1].cf_max; - EXPECT_EQ(get_asacq_sv_profile[1].cf_min)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].cf_min)), - 175) - << "incorrect value for acq_sv_profile[1].cf_min, expected 175, is " - << last_msg_->acq_sv_profile[1].cf_min; - EXPECT_EQ( - get_asacq_sv_profile[1].cn0)>( - reinterpret_cast(&last_msg_->acq_sv_profile[1].cn0)), - 59) - << "incorrect value for acq_sv_profile[1].cn0, expected 59, is " - << last_msg_->acq_sv_profile[1].cn0; - EXPECT_EQ( - get_asacq_sv_profile[1].cp)>( - reinterpret_cast(&last_msg_->acq_sv_profile[1].cp)), - 12) - << "incorrect value for acq_sv_profile[1].cp, expected 12, is " - << last_msg_->acq_sv_profile[1].cp; - EXPECT_EQ(get_asacq_sv_profile[1].int_time)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].int_time)), - 253) - << "incorrect value for acq_sv_profile[1].int_time, expected 253, is " - << last_msg_->acq_sv_profile[1].int_time; - EXPECT_EQ(get_asacq_sv_profile[1].job_type)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].job_type)), - 166) - << "incorrect value for acq_sv_profile[1].job_type, expected 166, is " - << last_msg_->acq_sv_profile[1].job_type; - EXPECT_EQ(get_asacq_sv_profile[1].sid.code)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].sid.code)), - 1) - << "incorrect value for acq_sv_profile[1].sid.code, expected 1, is " - << last_msg_->acq_sv_profile[1].sid.code; - EXPECT_EQ(get_asacq_sv_profile[1].sid.sat)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].sid.sat)), - 23) - << "incorrect value for acq_sv_profile[1].sid.sat, expected 23, is " - << last_msg_->acq_sv_profile[1].sid.sat; - EXPECT_EQ(get_asacq_sv_profile[1].status)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].status)), - 210) - << "incorrect value for acq_sv_profile[1].status, expected 210, is " - << last_msg_->acq_sv_profile[1].status; - EXPECT_EQ(get_asacq_sv_profile[1].time_spent)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].time_spent)), - 175) - << "incorrect value for acq_sv_profile[1].time_spent, expected 175, is " - << last_msg_->acq_sv_profile[1].time_spent; - EXPECT_EQ(get_asacq_sv_profile[1].timestamp)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].timestamp)), - 190) - << "incorrect value for acq_sv_profile[1].timestamp, expected 190, is " - << last_msg_->acq_sv_profile[1].timestamp; - EXPECT_EQ(get_asacq_sv_profile[2].bin_width)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].bin_width)), - 8) - << "incorrect value for acq_sv_profile[2].bin_width, expected 8, is " - << last_msg_->acq_sv_profile[2].bin_width; - EXPECT_EQ( - get_asacq_sv_profile[2].cf)>( - reinterpret_cast(&last_msg_->acq_sv_profile[2].cf)), - 84) - << "incorrect value for acq_sv_profile[2].cf, expected 84, is " - << last_msg_->acq_sv_profile[2].cf; - EXPECT_EQ(get_asacq_sv_profile[2].cf_max)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].cf_max)), - 191) - << "incorrect value for acq_sv_profile[2].cf_max, expected 191, is " - << last_msg_->acq_sv_profile[2].cf_max; - EXPECT_EQ(get_asacq_sv_profile[2].cf_min)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].cf_min)), - 91) - << "incorrect value for acq_sv_profile[2].cf_min, expected 91, is " - << last_msg_->acq_sv_profile[2].cf_min; - EXPECT_EQ( - get_asacq_sv_profile[2].cn0)>( - reinterpret_cast(&last_msg_->acq_sv_profile[2].cn0)), - 21) - << "incorrect value for acq_sv_profile[2].cn0, expected 21, is " - << last_msg_->acq_sv_profile[2].cn0; - EXPECT_EQ( - get_asacq_sv_profile[2].cp)>( - reinterpret_cast(&last_msg_->acq_sv_profile[2].cp)), - 82) - << "incorrect value for acq_sv_profile[2].cp, expected 82, is " - << last_msg_->acq_sv_profile[2].cp; - EXPECT_EQ(get_asacq_sv_profile[2].int_time)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].int_time)), - 153) - << "incorrect value for acq_sv_profile[2].int_time, expected 153, is " - << last_msg_->acq_sv_profile[2].int_time; - EXPECT_EQ(get_asacq_sv_profile[2].job_type)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].job_type)), - 126) - << "incorrect value for acq_sv_profile[2].job_type, expected 126, is " - << last_msg_->acq_sv_profile[2].job_type; - EXPECT_EQ(get_asacq_sv_profile[2].sid.code)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].sid.code)), - 0) - << "incorrect value for acq_sv_profile[2].sid.code, expected 0, is " - << last_msg_->acq_sv_profile[2].sid.code; - EXPECT_EQ(get_asacq_sv_profile[2].sid.sat)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].sid.sat)), - 24) - << "incorrect value for acq_sv_profile[2].sid.sat, expected 24, is " - << last_msg_->acq_sv_profile[2].sid.sat; - EXPECT_EQ(get_asacq_sv_profile[2].status)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].status)), - 88) - << "incorrect value for acq_sv_profile[2].status, expected 88, is " - << last_msg_->acq_sv_profile[2].status; - EXPECT_EQ(get_asacq_sv_profile[2].time_spent)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].time_spent)), - 172) - << "incorrect value for acq_sv_profile[2].time_spent, expected 172, is " - << last_msg_->acq_sv_profile[2].time_spent; - EXPECT_EQ(get_asacq_sv_profile[2].timestamp)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].timestamp)), - 130) - << "incorrect value for acq_sv_profile[2].timestamp, expected 130, is " - << last_msg_->acq_sv_profile[2].timestamp; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqSvProfileDep.cc b/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqSvProfileDep.cc deleted file mode 100644 index fd22613d36..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_acquisition_MsgAcqSvProfileDep.cc +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/acquisition/test_MsgAcqSvProfileDep.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_acquisition_MsgAcqSvProfileDep0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_acquisition_MsgAcqSvProfileDep0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acq_sv_profile_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acq_sv_profile_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_acquisition_MsgAcqSvProfileDep0, Test) { - uint8_t encoded_frame[] = { - 85, 30, 0, 195, 4, 105, 67, 103, 151, 0, 12, 22, 0, 0, 0, - 187, 0, 91, 0, 0, 0, 75, 0, 0, 0, 132, 0, 0, 0, 36, - 0, 0, 0, 60, 0, 0, 0, 241, 0, 0, 0, 238, 38, 111, 0, - 179, 23, 0, 1, 0, 176, 0, 166, 0, 0, 0, 234, 0, 0, 0, - 155, 0, 0, 0, 24, 0, 0, 0, 212, 0, 0, 0, 247, 0, 0, - 0, 142, 213, 68, 0, 53, 24, 0, 0, 0, 52, 0, 49, 0, 0, - 0, 245, 0, 0, 0, 76, 0, 0, 0, 248, 0, 0, 0, 212, 0, - 0, 0, 101, 0, 0, 0, 67, 132, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acq_sv_profile_dep_t *test_msg = - (msg_acq_sv_profile_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->acq_sv_profile) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->acq_sv_profile[0])); - } - test_msg->acq_sv_profile[0].bin_width = 187; - test_msg->acq_sv_profile[0].cf = 60; - test_msg->acq_sv_profile[0].cf_max = 36; - test_msg->acq_sv_profile[0].cf_min = 132; - test_msg->acq_sv_profile[0].cn0 = 151; - test_msg->acq_sv_profile[0].cp = 241; - test_msg->acq_sv_profile[0].int_time = 12; - test_msg->acq_sv_profile[0].job_type = 67; - test_msg->acq_sv_profile[0].sid.code = 0; - test_msg->acq_sv_profile[0].sid.reserved = 0; - test_msg->acq_sv_profile[0].sid.sat = 22; - test_msg->acq_sv_profile[0].status = 103; - test_msg->acq_sv_profile[0].time_spent = 75; - test_msg->acq_sv_profile[0].timestamp = 91; - if (sizeof(test_msg->acq_sv_profile) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->acq_sv_profile[0])); - } - test_msg->acq_sv_profile[1].bin_width = 176; - test_msg->acq_sv_profile[1].cf = 212; - test_msg->acq_sv_profile[1].cf_max = 24; - test_msg->acq_sv_profile[1].cf_min = 155; - test_msg->acq_sv_profile[1].cn0 = 111; - test_msg->acq_sv_profile[1].cp = 247; - test_msg->acq_sv_profile[1].int_time = 179; - test_msg->acq_sv_profile[1].job_type = 238; - test_msg->acq_sv_profile[1].sid.code = 1; - test_msg->acq_sv_profile[1].sid.reserved = 0; - test_msg->acq_sv_profile[1].sid.sat = 23; - test_msg->acq_sv_profile[1].status = 38; - test_msg->acq_sv_profile[1].time_spent = 234; - test_msg->acq_sv_profile[1].timestamp = 166; - if (sizeof(test_msg->acq_sv_profile) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->acq_sv_profile[0])); - } - test_msg->acq_sv_profile[2].bin_width = 52; - test_msg->acq_sv_profile[2].cf = 212; - test_msg->acq_sv_profile[2].cf_max = 248; - test_msg->acq_sv_profile[2].cf_min = 76; - test_msg->acq_sv_profile[2].cn0 = 68; - test_msg->acq_sv_profile[2].cp = 101; - test_msg->acq_sv_profile[2].int_time = 53; - test_msg->acq_sv_profile[2].job_type = 142; - test_msg->acq_sv_profile[2].sid.code = 0; - test_msg->acq_sv_profile[2].sid.reserved = 0; - test_msg->acq_sv_profile[2].sid.sat = 24; - test_msg->acq_sv_profile[2].status = 213; - test_msg->acq_sv_profile[2].time_spent = 245; - test_msg->acq_sv_profile[2].timestamp = 49; - - EXPECT_EQ(send_message(0x1e, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asacq_sv_profile[0].bin_width)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].bin_width)), - 187) - << "incorrect value for acq_sv_profile[0].bin_width, expected 187, is " - << last_msg_->acq_sv_profile[0].bin_width; - EXPECT_EQ( - get_asacq_sv_profile[0].cf)>( - reinterpret_cast(&last_msg_->acq_sv_profile[0].cf)), - 60) - << "incorrect value for acq_sv_profile[0].cf, expected 60, is " - << last_msg_->acq_sv_profile[0].cf; - EXPECT_EQ(get_asacq_sv_profile[0].cf_max)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].cf_max)), - 36) - << "incorrect value for acq_sv_profile[0].cf_max, expected 36, is " - << last_msg_->acq_sv_profile[0].cf_max; - EXPECT_EQ(get_asacq_sv_profile[0].cf_min)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].cf_min)), - 132) - << "incorrect value for acq_sv_profile[0].cf_min, expected 132, is " - << last_msg_->acq_sv_profile[0].cf_min; - EXPECT_EQ( - get_asacq_sv_profile[0].cn0)>( - reinterpret_cast(&last_msg_->acq_sv_profile[0].cn0)), - 151) - << "incorrect value for acq_sv_profile[0].cn0, expected 151, is " - << last_msg_->acq_sv_profile[0].cn0; - EXPECT_EQ( - get_asacq_sv_profile[0].cp)>( - reinterpret_cast(&last_msg_->acq_sv_profile[0].cp)), - 241) - << "incorrect value for acq_sv_profile[0].cp, expected 241, is " - << last_msg_->acq_sv_profile[0].cp; - EXPECT_EQ(get_asacq_sv_profile[0].int_time)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].int_time)), - 12) - << "incorrect value for acq_sv_profile[0].int_time, expected 12, is " - << last_msg_->acq_sv_profile[0].int_time; - EXPECT_EQ(get_asacq_sv_profile[0].job_type)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].job_type)), - 67) - << "incorrect value for acq_sv_profile[0].job_type, expected 67, is " - << last_msg_->acq_sv_profile[0].job_type; - EXPECT_EQ(get_asacq_sv_profile[0].sid.code)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].sid.code)), - 0) - << "incorrect value for acq_sv_profile[0].sid.code, expected 0, is " - << last_msg_->acq_sv_profile[0].sid.code; - EXPECT_EQ(get_asacq_sv_profile[0].sid.reserved)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].sid.reserved)), - 0) - << "incorrect value for acq_sv_profile[0].sid.reserved, expected 0, is " - << last_msg_->acq_sv_profile[0].sid.reserved; - EXPECT_EQ(get_asacq_sv_profile[0].sid.sat)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].sid.sat)), - 22) - << "incorrect value for acq_sv_profile[0].sid.sat, expected 22, is " - << last_msg_->acq_sv_profile[0].sid.sat; - EXPECT_EQ(get_asacq_sv_profile[0].status)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].status)), - 103) - << "incorrect value for acq_sv_profile[0].status, expected 103, is " - << last_msg_->acq_sv_profile[0].status; - EXPECT_EQ(get_asacq_sv_profile[0].time_spent)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].time_spent)), - 75) - << "incorrect value for acq_sv_profile[0].time_spent, expected 75, is " - << last_msg_->acq_sv_profile[0].time_spent; - EXPECT_EQ(get_asacq_sv_profile[0].timestamp)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[0].timestamp)), - 91) - << "incorrect value for acq_sv_profile[0].timestamp, expected 91, is " - << last_msg_->acq_sv_profile[0].timestamp; - EXPECT_EQ(get_asacq_sv_profile[1].bin_width)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].bin_width)), - 176) - << "incorrect value for acq_sv_profile[1].bin_width, expected 176, is " - << last_msg_->acq_sv_profile[1].bin_width; - EXPECT_EQ( - get_asacq_sv_profile[1].cf)>( - reinterpret_cast(&last_msg_->acq_sv_profile[1].cf)), - 212) - << "incorrect value for acq_sv_profile[1].cf, expected 212, is " - << last_msg_->acq_sv_profile[1].cf; - EXPECT_EQ(get_asacq_sv_profile[1].cf_max)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].cf_max)), - 24) - << "incorrect value for acq_sv_profile[1].cf_max, expected 24, is " - << last_msg_->acq_sv_profile[1].cf_max; - EXPECT_EQ(get_asacq_sv_profile[1].cf_min)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].cf_min)), - 155) - << "incorrect value for acq_sv_profile[1].cf_min, expected 155, is " - << last_msg_->acq_sv_profile[1].cf_min; - EXPECT_EQ( - get_asacq_sv_profile[1].cn0)>( - reinterpret_cast(&last_msg_->acq_sv_profile[1].cn0)), - 111) - << "incorrect value for acq_sv_profile[1].cn0, expected 111, is " - << last_msg_->acq_sv_profile[1].cn0; - EXPECT_EQ( - get_asacq_sv_profile[1].cp)>( - reinterpret_cast(&last_msg_->acq_sv_profile[1].cp)), - 247) - << "incorrect value for acq_sv_profile[1].cp, expected 247, is " - << last_msg_->acq_sv_profile[1].cp; - EXPECT_EQ(get_asacq_sv_profile[1].int_time)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].int_time)), - 179) - << "incorrect value for acq_sv_profile[1].int_time, expected 179, is " - << last_msg_->acq_sv_profile[1].int_time; - EXPECT_EQ(get_asacq_sv_profile[1].job_type)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].job_type)), - 238) - << "incorrect value for acq_sv_profile[1].job_type, expected 238, is " - << last_msg_->acq_sv_profile[1].job_type; - EXPECT_EQ(get_asacq_sv_profile[1].sid.code)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].sid.code)), - 1) - << "incorrect value for acq_sv_profile[1].sid.code, expected 1, is " - << last_msg_->acq_sv_profile[1].sid.code; - EXPECT_EQ(get_asacq_sv_profile[1].sid.reserved)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].sid.reserved)), - 0) - << "incorrect value for acq_sv_profile[1].sid.reserved, expected 0, is " - << last_msg_->acq_sv_profile[1].sid.reserved; - EXPECT_EQ(get_asacq_sv_profile[1].sid.sat)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].sid.sat)), - 23) - << "incorrect value for acq_sv_profile[1].sid.sat, expected 23, is " - << last_msg_->acq_sv_profile[1].sid.sat; - EXPECT_EQ(get_asacq_sv_profile[1].status)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].status)), - 38) - << "incorrect value for acq_sv_profile[1].status, expected 38, is " - << last_msg_->acq_sv_profile[1].status; - EXPECT_EQ(get_asacq_sv_profile[1].time_spent)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].time_spent)), - 234) - << "incorrect value for acq_sv_profile[1].time_spent, expected 234, is " - << last_msg_->acq_sv_profile[1].time_spent; - EXPECT_EQ(get_asacq_sv_profile[1].timestamp)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[1].timestamp)), - 166) - << "incorrect value for acq_sv_profile[1].timestamp, expected 166, is " - << last_msg_->acq_sv_profile[1].timestamp; - EXPECT_EQ(get_asacq_sv_profile[2].bin_width)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].bin_width)), - 52) - << "incorrect value for acq_sv_profile[2].bin_width, expected 52, is " - << last_msg_->acq_sv_profile[2].bin_width; - EXPECT_EQ( - get_asacq_sv_profile[2].cf)>( - reinterpret_cast(&last_msg_->acq_sv_profile[2].cf)), - 212) - << "incorrect value for acq_sv_profile[2].cf, expected 212, is " - << last_msg_->acq_sv_profile[2].cf; - EXPECT_EQ(get_asacq_sv_profile[2].cf_max)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].cf_max)), - 248) - << "incorrect value for acq_sv_profile[2].cf_max, expected 248, is " - << last_msg_->acq_sv_profile[2].cf_max; - EXPECT_EQ(get_asacq_sv_profile[2].cf_min)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].cf_min)), - 76) - << "incorrect value for acq_sv_profile[2].cf_min, expected 76, is " - << last_msg_->acq_sv_profile[2].cf_min; - EXPECT_EQ( - get_asacq_sv_profile[2].cn0)>( - reinterpret_cast(&last_msg_->acq_sv_profile[2].cn0)), - 68) - << "incorrect value for acq_sv_profile[2].cn0, expected 68, is " - << last_msg_->acq_sv_profile[2].cn0; - EXPECT_EQ( - get_asacq_sv_profile[2].cp)>( - reinterpret_cast(&last_msg_->acq_sv_profile[2].cp)), - 101) - << "incorrect value for acq_sv_profile[2].cp, expected 101, is " - << last_msg_->acq_sv_profile[2].cp; - EXPECT_EQ(get_asacq_sv_profile[2].int_time)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].int_time)), - 53) - << "incorrect value for acq_sv_profile[2].int_time, expected 53, is " - << last_msg_->acq_sv_profile[2].int_time; - EXPECT_EQ(get_asacq_sv_profile[2].job_type)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].job_type)), - 142) - << "incorrect value for acq_sv_profile[2].job_type, expected 142, is " - << last_msg_->acq_sv_profile[2].job_type; - EXPECT_EQ(get_asacq_sv_profile[2].sid.code)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].sid.code)), - 0) - << "incorrect value for acq_sv_profile[2].sid.code, expected 0, is " - << last_msg_->acq_sv_profile[2].sid.code; - EXPECT_EQ(get_asacq_sv_profile[2].sid.reserved)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].sid.reserved)), - 0) - << "incorrect value for acq_sv_profile[2].sid.reserved, expected 0, is " - << last_msg_->acq_sv_profile[2].sid.reserved; - EXPECT_EQ(get_asacq_sv_profile[2].sid.sat)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].sid.sat)), - 24) - << "incorrect value for acq_sv_profile[2].sid.sat, expected 24, is " - << last_msg_->acq_sv_profile[2].sid.sat; - EXPECT_EQ(get_asacq_sv_profile[2].status)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].status)), - 213) - << "incorrect value for acq_sv_profile[2].status, expected 213, is " - << last_msg_->acq_sv_profile[2].status; - EXPECT_EQ(get_asacq_sv_profile[2].time_spent)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].time_spent)), - 245) - << "incorrect value for acq_sv_profile[2].time_spent, expected 245, is " - << last_msg_->acq_sv_profile[2].time_spent; - EXPECT_EQ(get_asacq_sv_profile[2].timestamp)>( - reinterpret_cast( - &last_msg_->acq_sv_profile[2].timestamp)), - 49) - << "incorrect value for acq_sv_profile[2].timestamp, expected 49, is " - << last_msg_->acq_sv_profile[2].timestamp; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_bootload_MsgBootloaderHandshakeReq.cc b/c/test/legacy/cpp/auto_check_sbp_bootload_MsgBootloaderHandshakeReq.cc deleted file mode 100644 index 35047b58c4..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_bootload_MsgBootloaderHandshakeReq.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/bootload/test_MsgBootloaderHandshakeReq.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_bootload_MsgBootloaderHandshakeResp.cc b/c/test/legacy/cpp/auto_check_sbp_bootload_MsgBootloaderHandshakeResp.cc deleted file mode 100644 index ac8e4e2973..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_bootload_MsgBootloaderHandshakeResp.cc +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/bootload/test_MsgBootloaderHandshakeResp.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeResp0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeResp0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_bootloader_handshake_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_bootloader_handshake_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeResp0, Test) { - uint8_t encoded_frame[] = { - 85, 180, 0, 0, 0, 9, 0, 0, 0, 0, 118, 49, 46, 50, 10, 201, 1, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_bootloader_handshake_resp_t *test_msg = - (msg_bootloader_handshake_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - { - const char assign_string[] = {(char)118, (char)49, (char)46, (char)50, - (char)10}; - memcpy(test_msg->version, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->version) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0xb4, 0, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 0); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - { - const char check_string[] = {(char)118, (char)49, (char)46, (char)50, - (char)10}; - EXPECT_EQ(memcmp(last_msg_->version, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->version, expected string '" - << check_string << "', is '" << last_msg_->version << "'"; - } -} -class Test_legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeResp1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeResp1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_bootloader_handshake_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_bootloader_handshake_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_bootload_MsgBootloaderHandshakeResp1, Test) { - uint8_t encoded_frame[] = { - 85, 176, 0, 195, 4, 4, 118, 49, 46, 50, 1, 206, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_bootloader_handshake_dep_a_t *test_msg = - (msg_bootloader_handshake_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->handshake) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->handshake[0])); - } - test_msg->handshake[0] = 118; - if (sizeof(test_msg->handshake) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->handshake[0])); - } - test_msg->handshake[1] = 49; - if (sizeof(test_msg->handshake) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->handshake[0])); - } - test_msg->handshake[2] = 46; - if (sizeof(test_msg->handshake) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->handshake[0])); - } - test_msg->handshake[3] = 50; - - EXPECT_EQ(send_message(0xb0, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ashandshake[0])>( - reinterpret_cast(&last_msg_->handshake[0])), - 118) - << "incorrect value for handshake[0], expected 118, is " - << last_msg_->handshake[0]; - EXPECT_EQ(get_ashandshake[1])>( - reinterpret_cast(&last_msg_->handshake[1])), - 49) - << "incorrect value for handshake[1], expected 49, is " - << last_msg_->handshake[1]; - EXPECT_EQ(get_ashandshake[2])>( - reinterpret_cast(&last_msg_->handshake[2])), - 46) - << "incorrect value for handshake[2], expected 46, is " - << last_msg_->handshake[2]; - EXPECT_EQ(get_ashandshake[3])>( - reinterpret_cast(&last_msg_->handshake[3])), - 50) - << "incorrect value for handshake[3], expected 50, is " - << last_msg_->handshake[3]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_bootload_MsgBootloaderJumptoApp.cc b/c/test/legacy/cpp/auto_check_sbp_bootload_MsgBootloaderJumptoApp.cc deleted file mode 100644 index 17b27c6f40..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_bootload_MsgBootloaderJumptoApp.cc +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/bootload/test_MsgBootloaderJumptoApp.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_bootload_MsgBootloaderJumptoApp0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_bootload_MsgBootloaderJumptoApp0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_bootloader_jump_to_app_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_bootloader_jump_to_app_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_bootload_MsgBootloaderJumptoApp0, Test) { - uint8_t encoded_frame[] = { - 85, 177, 0, 205, 18, 1, 216, 105, 96, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_bootloader_jump_to_app_t *test_msg = - (msg_bootloader_jump_to_app_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->jump = 216; - - EXPECT_EQ(send_message(0xb1, 4813, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 4813); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asjump)>( - reinterpret_cast(&last_msg_->jump)), - 216) - << "incorrect value for jump, expected 216, is " << last_msg_->jump; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_bootload_MsgNapDeviceDnaReq.cc b/c/test/legacy/cpp/auto_check_sbp_bootload_MsgNapDeviceDnaReq.cc deleted file mode 100644 index 1eb305e4f3..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_bootload_MsgNapDeviceDnaReq.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/bootload/test_MsgNapDeviceDnaReq.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_bootload_MsgNapDeviceDnaResp.cc b/c/test/legacy/cpp/auto_check_sbp_bootload_MsgNapDeviceDnaResp.cc deleted file mode 100644 index c450bc8274..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_bootload_MsgNapDeviceDnaResp.cc +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/bootload/test_MsgNapDeviceDnaResp.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_bootload_MsgNapDeviceDnaResp0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_bootload_MsgNapDeviceDnaResp0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_nap_device_dna_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_nap_device_dna_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_bootload_MsgNapDeviceDnaResp0, Test) { - uint8_t encoded_frame[] = { - 85, 221, 0, 169, 56, 8, 2, 187, 1, 130, 173, 244, 67, 122, 70, 91, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_nap_device_dna_resp_t *test_msg = - (msg_nap_device_dna_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->dna) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->dna[0])); - } - test_msg->dna[0] = 2; - if (sizeof(test_msg->dna) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->dna[0])); - } - test_msg->dna[1] = 187; - if (sizeof(test_msg->dna) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->dna[0])); - } - test_msg->dna[2] = 1; - if (sizeof(test_msg->dna) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->dna[0])); - } - test_msg->dna[3] = 130; - if (sizeof(test_msg->dna) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->dna[0])); - } - test_msg->dna[4] = 173; - if (sizeof(test_msg->dna) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->dna[0])); - } - test_msg->dna[5] = 244; - if (sizeof(test_msg->dna) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->dna[0])); - } - test_msg->dna[6] = 67; - if (sizeof(test_msg->dna) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->dna[0])); - } - test_msg->dna[7] = 122; - - EXPECT_EQ(send_message(0xdd, 14505, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 14505); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asdna[0])>( - reinterpret_cast(&last_msg_->dna[0])), - 2) - << "incorrect value for dna[0], expected 2, is " << last_msg_->dna[0]; - EXPECT_EQ(get_asdna[1])>( - reinterpret_cast(&last_msg_->dna[1])), - 187) - << "incorrect value for dna[1], expected 187, is " << last_msg_->dna[1]; - EXPECT_EQ(get_asdna[2])>( - reinterpret_cast(&last_msg_->dna[2])), - 1) - << "incorrect value for dna[2], expected 1, is " << last_msg_->dna[2]; - EXPECT_EQ(get_asdna[3])>( - reinterpret_cast(&last_msg_->dna[3])), - 130) - << "incorrect value for dna[3], expected 130, is " << last_msg_->dna[3]; - EXPECT_EQ(get_asdna[4])>( - reinterpret_cast(&last_msg_->dna[4])), - 173) - << "incorrect value for dna[4], expected 173, is " << last_msg_->dna[4]; - EXPECT_EQ(get_asdna[5])>( - reinterpret_cast(&last_msg_->dna[5])), - 244) - << "incorrect value for dna[5], expected 244, is " << last_msg_->dna[5]; - EXPECT_EQ(get_asdna[6])>( - reinterpret_cast(&last_msg_->dna[6])), - 67) - << "incorrect value for dna[6], expected 67, is " << last_msg_->dna[6]; - EXPECT_EQ(get_asdna[7])>( - reinterpret_cast(&last_msg_->dna[7])), - 122) - << "incorrect value for dna[7], expected 122, is " << last_msg_->dna[7]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ext_events_MsgExtEvent.cc b/c/test/legacy/cpp/auto_check_sbp_ext_events_MsgExtEvent.cc deleted file mode 100644 index 022a6395f3..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ext_events_MsgExtEvent.cc +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ext_events/test_MsgExtEvent.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ext_events_MsgExtEvent0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ext_events_MsgExtEvent0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ext_event_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ext_event_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ext_events_MsgExtEvent0, Test) { - uint8_t encoded_frame[] = { - 85, 1, 1, 245, 6, 12, 48, 7, 199, 216, - 49, 15, 202, 65, 15, 0, 3, 0, 62, 204, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ext_event_t *test_msg = (msg_ext_event_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 3; - test_msg->ns_residual = 999882; - test_msg->pin = 0; - test_msg->tow = 254924999; - test_msg->wn = 1840; - - EXPECT_EQ(send_message(0x101, 1781, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1781); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 3) - << "incorrect value for flags, expected 3, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 999882) - << "incorrect value for ns_residual, expected 999882, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_aspin)>( - reinterpret_cast(&last_msg_->pin)), - 0) - << "incorrect value for pin, expected 0, is " << last_msg_->pin; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 254924999) - << "incorrect value for tow, expected 254924999, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1840) - << "incorrect value for wn, expected 1840, is " << last_msg_->wn; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioConfigReq.cc b/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioConfigReq.cc deleted file mode 100644 index 2091b1d639..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioConfigReq.cc +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/file_io/test_MsgFileioConfigReq.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_file_io_MsgFileioConfigReq0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_file_io_MsgFileioConfigReq0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_fileio_config_req_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_fileio_config_req_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_file_io_MsgFileioConfigReq0, Test) { - uint8_t encoded_frame[] = { - 85, 1, 16, 195, 4, 4, 107, 218, 69, 90, 185, 27, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_fileio_config_req_t *test_msg = - (msg_fileio_config_req_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->sequence = 1514527339; - - EXPECT_EQ(send_message(0x1001, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_assequence)>( - reinterpret_cast(&last_msg_->sequence)), - 1514527339) - << "incorrect value for sequence, expected 1514527339, is " - << last_msg_->sequence; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioConfigResp.cc b/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioConfigResp.cc deleted file mode 100644 index e0688bbe9f..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioConfigResp.cc +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/file_io/test_MsgFileioConfigResp.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_file_io_MsgFileioConfigResp0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_file_io_MsgFileioConfigResp0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_fileio_config_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_fileio_config_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_file_io_MsgFileioConfigResp0, Test) { - uint8_t encoded_frame[] = { - 85, 2, 16, 195, 4, 16, 170, 76, 52, 91, 149, 186, - 44, 3, 216, 151, 255, 61, 12, 97, 66, 144, 239, 115, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_fileio_config_resp_t *test_msg = - (msg_fileio_config_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->batch_size = 1040160728; - test_msg->fileio_version = 2420269324; - test_msg->sequence = 1530154154; - test_msg->window_size = 53262997; - - EXPECT_EQ(send_message(0x1002, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asbatch_size)>( - reinterpret_cast(&last_msg_->batch_size)), - 1040160728) - << "incorrect value for batch_size, expected 1040160728, is " - << last_msg_->batch_size; - EXPECT_EQ(get_asfileio_version)>( - reinterpret_cast(&last_msg_->fileio_version)), - 2420269324) - << "incorrect value for fileio_version, expected 2420269324, is " - << last_msg_->fileio_version; - EXPECT_EQ(get_assequence)>( - reinterpret_cast(&last_msg_->sequence)), - 1530154154) - << "incorrect value for sequence, expected 1530154154, is " - << last_msg_->sequence; - EXPECT_EQ(get_aswindow_size)>( - reinterpret_cast(&last_msg_->window_size)), - 53262997) - << "incorrect value for window_size, expected 53262997, is " - << last_msg_->window_size; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioReadDirReq.cc b/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioReadDirReq.cc deleted file mode 100644 index 3e945f02cd..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioReadDirReq.cc +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/file_io/test_MsgFileioReadDirReq.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_file_io_MsgFileioReadDirReq0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_file_io_MsgFileioReadDirReq0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_fileio_read_dir_req_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_fileio_read_dir_req_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_file_io_MsgFileioReadDirReq0, Test) { - uint8_t encoded_frame[] = { - 85, 169, 0, 195, 4, 26, 130, 231, 255, 90, 196, 134, - 47, 134, 47, 115, 111, 109, 101, 47, 114, 97, 110, 100, - 111, 109, 47, 112, 97, 116, 104, 0, 26, 186, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_fileio_read_dir_req_t *test_msg = - (msg_fileio_read_dir_req_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)47, (char)115, (char)111, (char)109, (char)101, (char)47, - (char)114, (char)97, (char)110, (char)100, (char)111, (char)109, - (char)47, (char)112, (char)97, (char)116, (char)104, (char)0}; - memcpy(test_msg->dirname, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->dirname) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->offset = 2251261636; - test_msg->sequence = 1526720386; - - EXPECT_EQ(send_message(0xa9, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)47, (char)115, (char)111, (char)109, (char)101, (char)47, - (char)114, (char)97, (char)110, (char)100, (char)111, (char)109, - (char)47, (char)112, (char)97, (char)116, (char)104, (char)0}; - EXPECT_EQ(memcmp(last_msg_->dirname, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->dirname, expected string '" - << check_string << "', is '" << last_msg_->dirname << "'"; - } - EXPECT_EQ(get_asoffset)>( - reinterpret_cast(&last_msg_->offset)), - 2251261636) - << "incorrect value for offset, expected 2251261636, is " - << last_msg_->offset; - EXPECT_EQ(get_assequence)>( - reinterpret_cast(&last_msg_->sequence)), - 1526720386) - << "incorrect value for sequence, expected 1526720386, is " - << last_msg_->sequence; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioReadDirResp.cc b/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioReadDirResp.cc deleted file mode 100644 index dfdd51228a..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioReadDirResp.cc +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/file_io/test_MsgFileioReadDirResp.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_file_io_MsgFileioReadDirResp0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_file_io_MsgFileioReadDirResp0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_fileio_read_dir_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_fileio_read_dir_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_file_io_MsgFileioReadDirResp0, Test) { - uint8_t encoded_frame[] = { - 85, 170, 0, 195, 4, 45, 78, 253, 224, 235, 102, 105, 108, 101, - 49, 0, 97, 110, 111, 116, 104, 101, 114, 32, 102, 105, 108, 101, - 0, 100, 101, 102, 105, 110, 105, 116, 101, 108, 121, 32, 110, 111, - 116, 32, 97, 32, 102, 105, 108, 101, 0, 186, 137, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_fileio_read_dir_resp_t *test_msg = - (msg_fileio_read_dir_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)102, (char)105, (char)108, (char)101, (char)49, (char)0, - (char)97, (char)110, (char)111, (char)116, (char)104, (char)101, - (char)114, (char)32, (char)102, (char)105, (char)108, (char)101, - (char)0, (char)100, (char)101, (char)102, (char)105, (char)110, - (char)105, (char)116, (char)101, (char)108, (char)121, (char)32, - (char)110, (char)111, (char)116, (char)32, (char)97, (char)32, - (char)102, (char)105, (char)108, (char)101, (char)0}; - memcpy(test_msg->contents, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->contents) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->sequence = 3957390670; - - EXPECT_EQ(send_message(0xaa, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)102, (char)105, (char)108, (char)101, (char)49, (char)0, - (char)97, (char)110, (char)111, (char)116, (char)104, (char)101, - (char)114, (char)32, (char)102, (char)105, (char)108, (char)101, - (char)0, (char)100, (char)101, (char)102, (char)105, (char)110, - (char)105, (char)116, (char)101, (char)108, (char)121, (char)32, - (char)110, (char)111, (char)116, (char)32, (char)97, (char)32, - (char)102, (char)105, (char)108, (char)101, (char)0}; - EXPECT_EQ(memcmp(last_msg_->contents, check_string, sizeof(check_string)), - 0) - << "incorrect value for last_msg_->contents, expected string '" - << check_string << "', is '" << last_msg_->contents << "'"; - } - EXPECT_EQ(get_assequence)>( - reinterpret_cast(&last_msg_->sequence)), - 3957390670) - << "incorrect value for sequence, expected 3957390670, is " - << last_msg_->sequence; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioReadReq.cc b/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioReadReq.cc deleted file mode 100644 index 722c8792a1..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioReadReq.cc +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/file_io/test_MsgFileioReadReq.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_file_io_MsgFileioReadReq0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_file_io_MsgFileioReadReq0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_fileio_read_req_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_fileio_read_req_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_file_io_MsgFileioReadReq0, Test) { - uint8_t encoded_frame[] = { - 85, 168, 0, 195, 4, 28, 34, 156, 130, 40, 98, 178, - 190, 23, 53, 47, 112, 97, 116, 104, 47, 116, 111, 47, - 115, 111, 109, 101, 47, 102, 105, 108, 101, 0, 86, 100, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_fileio_read_req_t *test_msg = (msg_fileio_read_req_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->chunk_size = 53; - { - const char assign_string[] = {(char)47, (char)112, (char)97, (char)116, - (char)104, (char)47, (char)116, (char)111, - (char)47, (char)115, (char)111, (char)109, - (char)101, (char)47, (char)102, (char)105, - (char)108, (char)101, (char)0}; - memcpy(test_msg->filename, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->filename) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->offset = 398373474; - test_msg->sequence = 679648290; - - EXPECT_EQ(send_message(0xa8, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_aschunk_size)>( - reinterpret_cast(&last_msg_->chunk_size)), - 53) - << "incorrect value for chunk_size, expected 53, is " - << last_msg_->chunk_size; - { - const char check_string[] = {(char)47, (char)112, (char)97, (char)116, - (char)104, (char)47, (char)116, (char)111, - (char)47, (char)115, (char)111, (char)109, - (char)101, (char)47, (char)102, (char)105, - (char)108, (char)101, (char)0}; - EXPECT_EQ(memcmp(last_msg_->filename, check_string, sizeof(check_string)), - 0) - << "incorrect value for last_msg_->filename, expected string '" - << check_string << "', is '" << last_msg_->filename << "'"; - } - EXPECT_EQ(get_asoffset)>( - reinterpret_cast(&last_msg_->offset)), - 398373474) - << "incorrect value for offset, expected 398373474, is " - << last_msg_->offset; - EXPECT_EQ(get_assequence)>( - reinterpret_cast(&last_msg_->sequence)), - 679648290) - << "incorrect value for sequence, expected 679648290, is " - << last_msg_->sequence; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioReadResp.cc b/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioReadResp.cc deleted file mode 100644 index 816dc5fab5..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioReadResp.cc +++ /dev/null @@ -1,2653 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/file_io/test_MsgFileioReadResp.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_file_io_MsgFileioReadResp0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_file_io_MsgFileioReadResp0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_fileio_read_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_fileio_read_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_file_io_MsgFileioReadResp0, Test) { - uint8_t encoded_frame[] = { - 85, 163, 0, 195, 4, 255, 67, 183, 115, 15, 73, 231, 227, 179, 18, - 76, 68, 229, 216, 21, 98, 183, 69, 190, 5, 252, 176, 55, 32, 78, - 8, 52, 127, 50, 71, 106, 61, 79, 191, 106, 46, 79, 118, 248, 118, - 207, 206, 210, 91, 73, 251, 81, 131, 205, 193, 146, 206, 185, 140, 249, - 163, 231, 65, 67, 94, 250, 109, 152, 95, 123, 77, 224, 124, 238, 205, - 65, 103, 35, 104, 209, 5, 191, 47, 249, 176, 166, 213, 46, 192, 86, - 32, 103, 146, 252, 4, 16, 54, 161, 60, 6, 13, 191, 116, 182, 42, - 191, 213, 20, 217, 8, 142, 187, 238, 120, 184, 250, 31, 151, 37, 51, - 177, 130, 190, 155, 71, 68, 56, 238, 92, 130, 37, 137, 146, 246, 114, - 116, 138, 165, 217, 79, 10, 189, 128, 189, 2, 240, 92, 28, 126, 105, - 236, 228, 194, 0, 51, 61, 74, 41, 10, 239, 133, 106, 190, 30, 27, - 3, 240, 205, 253, 113, 25, 28, 187, 81, 101, 216, 121, 41, 179, 120, - 152, 18, 116, 53, 212, 100, 2, 114, 198, 200, 10, 147, 25, 33, 115, - 208, 113, 60, 179, 183, 0, 41, 217, 206, 255, 211, 225, 142, 191, 133, - 81, 15, 248, 193, 66, 191, 244, 221, 248, 199, 241, 112, 51, 1, 180, - 180, 125, 97, 145, 25, 72, 210, 215, 208, 15, 126, 56, 38, 65, 4, - 64, 19, 74, 223, 111, 109, 52, 43, 167, 186, 202, 111, 11, 91, 21, - 236, 234, 196, 36, 171, 147, 10, 240, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_fileio_read_resp_t *test_msg = (msg_fileio_read_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[0] = 73; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[1] = 231; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[2] = 227; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[3] = 179; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[4] = 18; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[5] = 76; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[6] = 68; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[7] = 229; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[8] = 216; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[9] = 21; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[10] = 98; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[11] = 183; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[12] = 69; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[13] = 190; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[14] = 5; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[15] = 252; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[16] = 176; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[17] = 55; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[18] = 32; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[19] = 78; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[20] = 8; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[21] = 52; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[22] = 127; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[23] = 50; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[24] = 71; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[25] = 106; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[26] = 61; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[27] = 79; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[28] = 191; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[29] = 106; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[30] = 46; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[31] = 79; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[32] = 118; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[33] = 248; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[34] = 118; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[35] = 207; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[36] = 206; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[37] = 210; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[38] = 91; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[39] = 73; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[40] = 251; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[41] = 81; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[42] = 131; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[43] = 205; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[44] = 193; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[45] = 146; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[46] = 206; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[47] = 185; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[48] = 140; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[49] = 249; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[50] = 163; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[51] = 231; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[52] = 65; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[53] = 67; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[54] = 94; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[55] = 250; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[56] = 109; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[57] = 152; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[58] = 95; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[59] = 123; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[60] = 77; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[61] = 224; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[62] = 124; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[63] = 238; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[64] = 205; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[65] = 65; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[66] = 103; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[67] = 35; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[68] = 104; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[69] = 209; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[70] = 5; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[71] = 191; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[72] = 47; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[73] = 249; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[74] = 176; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[75] = 166; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[76] = 213; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[77] = 46; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[78] = 192; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[79] = 86; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[80] = 32; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[81] = 103; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[82] = 146; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[83] = 252; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[84] = 4; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[85] = 16; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[86] = 54; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[87] = 161; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[88] = 60; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[89] = 6; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[90] = 13; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[91] = 191; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[92] = 116; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[93] = 182; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[94] = 42; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[95] = 191; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[96] = 213; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[97] = 20; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[98] = 217; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[99] = 8; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[100] = 142; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[101] = 187; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[102] = 238; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[103] = 120; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[104] = 184; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[105] = 250; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[106] = 31; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[107] = 151; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[108] = 37; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[109] = 51; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[110] = 177; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[111] = 130; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[112] = 190; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[113] = 155; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[114] = 71; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[115] = 68; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[116] = 56; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[117] = 238; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[118] = 92; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[119] = 130; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[120] = 37; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[121] = 137; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[122] = 146; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[123] = 246; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[124] = 114; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[125] = 116; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[126] = 138; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[127] = 165; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[128] = 217; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[129] = 79; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[130] = 10; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[131] = 189; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[132] = 128; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[133] = 189; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[134] = 2; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[135] = 240; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[136] = 92; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[137] = 28; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[138] = 126; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[139] = 105; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[140] = 236; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[141] = 228; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[142] = 194; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[143] = 0; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[144] = 51; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[145] = 61; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[146] = 74; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[147] = 41; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[148] = 10; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[149] = 239; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[150] = 133; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[151] = 106; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[152] = 190; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[153] = 30; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[154] = 27; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[155] = 3; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[156] = 240; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[157] = 205; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[158] = 253; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[159] = 113; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[160] = 25; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[161] = 28; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[162] = 187; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[163] = 81; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[164] = 101; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[165] = 216; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[166] = 121; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[167] = 41; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[168] = 179; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[169] = 120; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[170] = 152; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[171] = 18; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[172] = 116; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[173] = 53; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[174] = 212; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[175] = 100; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[176] = 2; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[177] = 114; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[178] = 198; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[179] = 200; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[180] = 10; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[181] = 147; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[182] = 25; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[183] = 33; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[184] = 115; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[185] = 208; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[186] = 113; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[187] = 60; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[188] = 179; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[189] = 183; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[190] = 0; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[191] = 41; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[192] = 217; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[193] = 206; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[194] = 255; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[195] = 211; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[196] = 225; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[197] = 142; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[198] = 191; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[199] = 133; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[200] = 81; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[201] = 15; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[202] = 248; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[203] = 193; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[204] = 66; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[205] = 191; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[206] = 244; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[207] = 221; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[208] = 248; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[209] = 199; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[210] = 241; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[211] = 112; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[212] = 51; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[213] = 1; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[214] = 180; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[215] = 180; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[216] = 125; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[217] = 97; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[218] = 145; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[219] = 25; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[220] = 72; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[221] = 210; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[222] = 215; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[223] = 208; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[224] = 15; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[225] = 126; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[226] = 56; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[227] = 38; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[228] = 65; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[229] = 4; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[230] = 64; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[231] = 19; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[232] = 74; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[233] = 223; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[234] = 111; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[235] = 109; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[236] = 52; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[237] = 43; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[238] = 167; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[239] = 186; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[240] = 202; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[241] = 111; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[242] = 11; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[243] = 91; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[244] = 21; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[245] = 236; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[246] = 234; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[247] = 196; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[248] = 36; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[249] = 171; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[250] = 147; - test_msg->sequence = 259241795; - - EXPECT_EQ(send_message(0xa3, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascontents[0])>( - reinterpret_cast(&last_msg_->contents[0])), - 73) - << "incorrect value for contents[0], expected 73, is " - << last_msg_->contents[0]; - EXPECT_EQ(get_ascontents[1])>( - reinterpret_cast(&last_msg_->contents[1])), - 231) - << "incorrect value for contents[1], expected 231, is " - << last_msg_->contents[1]; - EXPECT_EQ(get_ascontents[2])>( - reinterpret_cast(&last_msg_->contents[2])), - 227) - << "incorrect value for contents[2], expected 227, is " - << last_msg_->contents[2]; - EXPECT_EQ(get_ascontents[3])>( - reinterpret_cast(&last_msg_->contents[3])), - 179) - << "incorrect value for contents[3], expected 179, is " - << last_msg_->contents[3]; - EXPECT_EQ(get_ascontents[4])>( - reinterpret_cast(&last_msg_->contents[4])), - 18) - << "incorrect value for contents[4], expected 18, is " - << last_msg_->contents[4]; - EXPECT_EQ(get_ascontents[5])>( - reinterpret_cast(&last_msg_->contents[5])), - 76) - << "incorrect value for contents[5], expected 76, is " - << last_msg_->contents[5]; - EXPECT_EQ(get_ascontents[6])>( - reinterpret_cast(&last_msg_->contents[6])), - 68) - << "incorrect value for contents[6], expected 68, is " - << last_msg_->contents[6]; - EXPECT_EQ(get_ascontents[7])>( - reinterpret_cast(&last_msg_->contents[7])), - 229) - << "incorrect value for contents[7], expected 229, is " - << last_msg_->contents[7]; - EXPECT_EQ(get_ascontents[8])>( - reinterpret_cast(&last_msg_->contents[8])), - 216) - << "incorrect value for contents[8], expected 216, is " - << last_msg_->contents[8]; - EXPECT_EQ(get_ascontents[9])>( - reinterpret_cast(&last_msg_->contents[9])), - 21) - << "incorrect value for contents[9], expected 21, is " - << last_msg_->contents[9]; - EXPECT_EQ(get_ascontents[10])>( - reinterpret_cast(&last_msg_->contents[10])), - 98) - << "incorrect value for contents[10], expected 98, is " - << last_msg_->contents[10]; - EXPECT_EQ(get_ascontents[11])>( - reinterpret_cast(&last_msg_->contents[11])), - 183) - << "incorrect value for contents[11], expected 183, is " - << last_msg_->contents[11]; - EXPECT_EQ(get_ascontents[12])>( - reinterpret_cast(&last_msg_->contents[12])), - 69) - << "incorrect value for contents[12], expected 69, is " - << last_msg_->contents[12]; - EXPECT_EQ(get_ascontents[13])>( - reinterpret_cast(&last_msg_->contents[13])), - 190) - << "incorrect value for contents[13], expected 190, is " - << last_msg_->contents[13]; - EXPECT_EQ(get_ascontents[14])>( - reinterpret_cast(&last_msg_->contents[14])), - 5) - << "incorrect value for contents[14], expected 5, is " - << last_msg_->contents[14]; - EXPECT_EQ(get_ascontents[15])>( - reinterpret_cast(&last_msg_->contents[15])), - 252) - << "incorrect value for contents[15], expected 252, is " - << last_msg_->contents[15]; - EXPECT_EQ(get_ascontents[16])>( - reinterpret_cast(&last_msg_->contents[16])), - 176) - << "incorrect value for contents[16], expected 176, is " - << last_msg_->contents[16]; - EXPECT_EQ(get_ascontents[17])>( - reinterpret_cast(&last_msg_->contents[17])), - 55) - << "incorrect value for contents[17], expected 55, is " - << last_msg_->contents[17]; - EXPECT_EQ(get_ascontents[18])>( - reinterpret_cast(&last_msg_->contents[18])), - 32) - << "incorrect value for contents[18], expected 32, is " - << last_msg_->contents[18]; - EXPECT_EQ(get_ascontents[19])>( - reinterpret_cast(&last_msg_->contents[19])), - 78) - << "incorrect value for contents[19], expected 78, is " - << last_msg_->contents[19]; - EXPECT_EQ(get_ascontents[20])>( - reinterpret_cast(&last_msg_->contents[20])), - 8) - << "incorrect value for contents[20], expected 8, is " - << last_msg_->contents[20]; - EXPECT_EQ(get_ascontents[21])>( - reinterpret_cast(&last_msg_->contents[21])), - 52) - << "incorrect value for contents[21], expected 52, is " - << last_msg_->contents[21]; - EXPECT_EQ(get_ascontents[22])>( - reinterpret_cast(&last_msg_->contents[22])), - 127) - << "incorrect value for contents[22], expected 127, is " - << last_msg_->contents[22]; - EXPECT_EQ(get_ascontents[23])>( - reinterpret_cast(&last_msg_->contents[23])), - 50) - << "incorrect value for contents[23], expected 50, is " - << last_msg_->contents[23]; - EXPECT_EQ(get_ascontents[24])>( - reinterpret_cast(&last_msg_->contents[24])), - 71) - << "incorrect value for contents[24], expected 71, is " - << last_msg_->contents[24]; - EXPECT_EQ(get_ascontents[25])>( - reinterpret_cast(&last_msg_->contents[25])), - 106) - << "incorrect value for contents[25], expected 106, is " - << last_msg_->contents[25]; - EXPECT_EQ(get_ascontents[26])>( - reinterpret_cast(&last_msg_->contents[26])), - 61) - << "incorrect value for contents[26], expected 61, is " - << last_msg_->contents[26]; - EXPECT_EQ(get_ascontents[27])>( - reinterpret_cast(&last_msg_->contents[27])), - 79) - << "incorrect value for contents[27], expected 79, is " - << last_msg_->contents[27]; - EXPECT_EQ(get_ascontents[28])>( - reinterpret_cast(&last_msg_->contents[28])), - 191) - << "incorrect value for contents[28], expected 191, is " - << last_msg_->contents[28]; - EXPECT_EQ(get_ascontents[29])>( - reinterpret_cast(&last_msg_->contents[29])), - 106) - << "incorrect value for contents[29], expected 106, is " - << last_msg_->contents[29]; - EXPECT_EQ(get_ascontents[30])>( - reinterpret_cast(&last_msg_->contents[30])), - 46) - << "incorrect value for contents[30], expected 46, is " - << last_msg_->contents[30]; - EXPECT_EQ(get_ascontents[31])>( - reinterpret_cast(&last_msg_->contents[31])), - 79) - << "incorrect value for contents[31], expected 79, is " - << last_msg_->contents[31]; - EXPECT_EQ(get_ascontents[32])>( - reinterpret_cast(&last_msg_->contents[32])), - 118) - << "incorrect value for contents[32], expected 118, is " - << last_msg_->contents[32]; - EXPECT_EQ(get_ascontents[33])>( - reinterpret_cast(&last_msg_->contents[33])), - 248) - << "incorrect value for contents[33], expected 248, is " - << last_msg_->contents[33]; - EXPECT_EQ(get_ascontents[34])>( - reinterpret_cast(&last_msg_->contents[34])), - 118) - << "incorrect value for contents[34], expected 118, is " - << last_msg_->contents[34]; - EXPECT_EQ(get_ascontents[35])>( - reinterpret_cast(&last_msg_->contents[35])), - 207) - << "incorrect value for contents[35], expected 207, is " - << last_msg_->contents[35]; - EXPECT_EQ(get_ascontents[36])>( - reinterpret_cast(&last_msg_->contents[36])), - 206) - << "incorrect value for contents[36], expected 206, is " - << last_msg_->contents[36]; - EXPECT_EQ(get_ascontents[37])>( - reinterpret_cast(&last_msg_->contents[37])), - 210) - << "incorrect value for contents[37], expected 210, is " - << last_msg_->contents[37]; - EXPECT_EQ(get_ascontents[38])>( - reinterpret_cast(&last_msg_->contents[38])), - 91) - << "incorrect value for contents[38], expected 91, is " - << last_msg_->contents[38]; - EXPECT_EQ(get_ascontents[39])>( - reinterpret_cast(&last_msg_->contents[39])), - 73) - << "incorrect value for contents[39], expected 73, is " - << last_msg_->contents[39]; - EXPECT_EQ(get_ascontents[40])>( - reinterpret_cast(&last_msg_->contents[40])), - 251) - << "incorrect value for contents[40], expected 251, is " - << last_msg_->contents[40]; - EXPECT_EQ(get_ascontents[41])>( - reinterpret_cast(&last_msg_->contents[41])), - 81) - << "incorrect value for contents[41], expected 81, is " - << last_msg_->contents[41]; - EXPECT_EQ(get_ascontents[42])>( - reinterpret_cast(&last_msg_->contents[42])), - 131) - << "incorrect value for contents[42], expected 131, is " - << last_msg_->contents[42]; - EXPECT_EQ(get_ascontents[43])>( - reinterpret_cast(&last_msg_->contents[43])), - 205) - << "incorrect value for contents[43], expected 205, is " - << last_msg_->contents[43]; - EXPECT_EQ(get_ascontents[44])>( - reinterpret_cast(&last_msg_->contents[44])), - 193) - << "incorrect value for contents[44], expected 193, is " - << last_msg_->contents[44]; - EXPECT_EQ(get_ascontents[45])>( - reinterpret_cast(&last_msg_->contents[45])), - 146) - << "incorrect value for contents[45], expected 146, is " - << last_msg_->contents[45]; - EXPECT_EQ(get_ascontents[46])>( - reinterpret_cast(&last_msg_->contents[46])), - 206) - << "incorrect value for contents[46], expected 206, is " - << last_msg_->contents[46]; - EXPECT_EQ(get_ascontents[47])>( - reinterpret_cast(&last_msg_->contents[47])), - 185) - << "incorrect value for contents[47], expected 185, is " - << last_msg_->contents[47]; - EXPECT_EQ(get_ascontents[48])>( - reinterpret_cast(&last_msg_->contents[48])), - 140) - << "incorrect value for contents[48], expected 140, is " - << last_msg_->contents[48]; - EXPECT_EQ(get_ascontents[49])>( - reinterpret_cast(&last_msg_->contents[49])), - 249) - << "incorrect value for contents[49], expected 249, is " - << last_msg_->contents[49]; - EXPECT_EQ(get_ascontents[50])>( - reinterpret_cast(&last_msg_->contents[50])), - 163) - << "incorrect value for contents[50], expected 163, is " - << last_msg_->contents[50]; - EXPECT_EQ(get_ascontents[51])>( - reinterpret_cast(&last_msg_->contents[51])), - 231) - << "incorrect value for contents[51], expected 231, is " - << last_msg_->contents[51]; - EXPECT_EQ(get_ascontents[52])>( - reinterpret_cast(&last_msg_->contents[52])), - 65) - << "incorrect value for contents[52], expected 65, is " - << last_msg_->contents[52]; - EXPECT_EQ(get_ascontents[53])>( - reinterpret_cast(&last_msg_->contents[53])), - 67) - << "incorrect value for contents[53], expected 67, is " - << last_msg_->contents[53]; - EXPECT_EQ(get_ascontents[54])>( - reinterpret_cast(&last_msg_->contents[54])), - 94) - << "incorrect value for contents[54], expected 94, is " - << last_msg_->contents[54]; - EXPECT_EQ(get_ascontents[55])>( - reinterpret_cast(&last_msg_->contents[55])), - 250) - << "incorrect value for contents[55], expected 250, is " - << last_msg_->contents[55]; - EXPECT_EQ(get_ascontents[56])>( - reinterpret_cast(&last_msg_->contents[56])), - 109) - << "incorrect value for contents[56], expected 109, is " - << last_msg_->contents[56]; - EXPECT_EQ(get_ascontents[57])>( - reinterpret_cast(&last_msg_->contents[57])), - 152) - << "incorrect value for contents[57], expected 152, is " - << last_msg_->contents[57]; - EXPECT_EQ(get_ascontents[58])>( - reinterpret_cast(&last_msg_->contents[58])), - 95) - << "incorrect value for contents[58], expected 95, is " - << last_msg_->contents[58]; - EXPECT_EQ(get_ascontents[59])>( - reinterpret_cast(&last_msg_->contents[59])), - 123) - << "incorrect value for contents[59], expected 123, is " - << last_msg_->contents[59]; - EXPECT_EQ(get_ascontents[60])>( - reinterpret_cast(&last_msg_->contents[60])), - 77) - << "incorrect value for contents[60], expected 77, is " - << last_msg_->contents[60]; - EXPECT_EQ(get_ascontents[61])>( - reinterpret_cast(&last_msg_->contents[61])), - 224) - << "incorrect value for contents[61], expected 224, is " - << last_msg_->contents[61]; - EXPECT_EQ(get_ascontents[62])>( - reinterpret_cast(&last_msg_->contents[62])), - 124) - << "incorrect value for contents[62], expected 124, is " - << last_msg_->contents[62]; - EXPECT_EQ(get_ascontents[63])>( - reinterpret_cast(&last_msg_->contents[63])), - 238) - << "incorrect value for contents[63], expected 238, is " - << last_msg_->contents[63]; - EXPECT_EQ(get_ascontents[64])>( - reinterpret_cast(&last_msg_->contents[64])), - 205) - << "incorrect value for contents[64], expected 205, is " - << last_msg_->contents[64]; - EXPECT_EQ(get_ascontents[65])>( - reinterpret_cast(&last_msg_->contents[65])), - 65) - << "incorrect value for contents[65], expected 65, is " - << last_msg_->contents[65]; - EXPECT_EQ(get_ascontents[66])>( - reinterpret_cast(&last_msg_->contents[66])), - 103) - << "incorrect value for contents[66], expected 103, is " - << last_msg_->contents[66]; - EXPECT_EQ(get_ascontents[67])>( - reinterpret_cast(&last_msg_->contents[67])), - 35) - << "incorrect value for contents[67], expected 35, is " - << last_msg_->contents[67]; - EXPECT_EQ(get_ascontents[68])>( - reinterpret_cast(&last_msg_->contents[68])), - 104) - << "incorrect value for contents[68], expected 104, is " - << last_msg_->contents[68]; - EXPECT_EQ(get_ascontents[69])>( - reinterpret_cast(&last_msg_->contents[69])), - 209) - << "incorrect value for contents[69], expected 209, is " - << last_msg_->contents[69]; - EXPECT_EQ(get_ascontents[70])>( - reinterpret_cast(&last_msg_->contents[70])), - 5) - << "incorrect value for contents[70], expected 5, is " - << last_msg_->contents[70]; - EXPECT_EQ(get_ascontents[71])>( - reinterpret_cast(&last_msg_->contents[71])), - 191) - << "incorrect value for contents[71], expected 191, is " - << last_msg_->contents[71]; - EXPECT_EQ(get_ascontents[72])>( - reinterpret_cast(&last_msg_->contents[72])), - 47) - << "incorrect value for contents[72], expected 47, is " - << last_msg_->contents[72]; - EXPECT_EQ(get_ascontents[73])>( - reinterpret_cast(&last_msg_->contents[73])), - 249) - << "incorrect value for contents[73], expected 249, is " - << last_msg_->contents[73]; - EXPECT_EQ(get_ascontents[74])>( - reinterpret_cast(&last_msg_->contents[74])), - 176) - << "incorrect value for contents[74], expected 176, is " - << last_msg_->contents[74]; - EXPECT_EQ(get_ascontents[75])>( - reinterpret_cast(&last_msg_->contents[75])), - 166) - << "incorrect value for contents[75], expected 166, is " - << last_msg_->contents[75]; - EXPECT_EQ(get_ascontents[76])>( - reinterpret_cast(&last_msg_->contents[76])), - 213) - << "incorrect value for contents[76], expected 213, is " - << last_msg_->contents[76]; - EXPECT_EQ(get_ascontents[77])>( - reinterpret_cast(&last_msg_->contents[77])), - 46) - << "incorrect value for contents[77], expected 46, is " - << last_msg_->contents[77]; - EXPECT_EQ(get_ascontents[78])>( - reinterpret_cast(&last_msg_->contents[78])), - 192) - << "incorrect value for contents[78], expected 192, is " - << last_msg_->contents[78]; - EXPECT_EQ(get_ascontents[79])>( - reinterpret_cast(&last_msg_->contents[79])), - 86) - << "incorrect value for contents[79], expected 86, is " - << last_msg_->contents[79]; - EXPECT_EQ(get_ascontents[80])>( - reinterpret_cast(&last_msg_->contents[80])), - 32) - << "incorrect value for contents[80], expected 32, is " - << last_msg_->contents[80]; - EXPECT_EQ(get_ascontents[81])>( - reinterpret_cast(&last_msg_->contents[81])), - 103) - << "incorrect value for contents[81], expected 103, is " - << last_msg_->contents[81]; - EXPECT_EQ(get_ascontents[82])>( - reinterpret_cast(&last_msg_->contents[82])), - 146) - << "incorrect value for contents[82], expected 146, is " - << last_msg_->contents[82]; - EXPECT_EQ(get_ascontents[83])>( - reinterpret_cast(&last_msg_->contents[83])), - 252) - << "incorrect value for contents[83], expected 252, is " - << last_msg_->contents[83]; - EXPECT_EQ(get_ascontents[84])>( - reinterpret_cast(&last_msg_->contents[84])), - 4) - << "incorrect value for contents[84], expected 4, is " - << last_msg_->contents[84]; - EXPECT_EQ(get_ascontents[85])>( - reinterpret_cast(&last_msg_->contents[85])), - 16) - << "incorrect value for contents[85], expected 16, is " - << last_msg_->contents[85]; - EXPECT_EQ(get_ascontents[86])>( - reinterpret_cast(&last_msg_->contents[86])), - 54) - << "incorrect value for contents[86], expected 54, is " - << last_msg_->contents[86]; - EXPECT_EQ(get_ascontents[87])>( - reinterpret_cast(&last_msg_->contents[87])), - 161) - << "incorrect value for contents[87], expected 161, is " - << last_msg_->contents[87]; - EXPECT_EQ(get_ascontents[88])>( - reinterpret_cast(&last_msg_->contents[88])), - 60) - << "incorrect value for contents[88], expected 60, is " - << last_msg_->contents[88]; - EXPECT_EQ(get_ascontents[89])>( - reinterpret_cast(&last_msg_->contents[89])), - 6) - << "incorrect value for contents[89], expected 6, is " - << last_msg_->contents[89]; - EXPECT_EQ(get_ascontents[90])>( - reinterpret_cast(&last_msg_->contents[90])), - 13) - << "incorrect value for contents[90], expected 13, is " - << last_msg_->contents[90]; - EXPECT_EQ(get_ascontents[91])>( - reinterpret_cast(&last_msg_->contents[91])), - 191) - << "incorrect value for contents[91], expected 191, is " - << last_msg_->contents[91]; - EXPECT_EQ(get_ascontents[92])>( - reinterpret_cast(&last_msg_->contents[92])), - 116) - << "incorrect value for contents[92], expected 116, is " - << last_msg_->contents[92]; - EXPECT_EQ(get_ascontents[93])>( - reinterpret_cast(&last_msg_->contents[93])), - 182) - << "incorrect value for contents[93], expected 182, is " - << last_msg_->contents[93]; - EXPECT_EQ(get_ascontents[94])>( - reinterpret_cast(&last_msg_->contents[94])), - 42) - << "incorrect value for contents[94], expected 42, is " - << last_msg_->contents[94]; - EXPECT_EQ(get_ascontents[95])>( - reinterpret_cast(&last_msg_->contents[95])), - 191) - << "incorrect value for contents[95], expected 191, is " - << last_msg_->contents[95]; - EXPECT_EQ(get_ascontents[96])>( - reinterpret_cast(&last_msg_->contents[96])), - 213) - << "incorrect value for contents[96], expected 213, is " - << last_msg_->contents[96]; - EXPECT_EQ(get_ascontents[97])>( - reinterpret_cast(&last_msg_->contents[97])), - 20) - << "incorrect value for contents[97], expected 20, is " - << last_msg_->contents[97]; - EXPECT_EQ(get_ascontents[98])>( - reinterpret_cast(&last_msg_->contents[98])), - 217) - << "incorrect value for contents[98], expected 217, is " - << last_msg_->contents[98]; - EXPECT_EQ(get_ascontents[99])>( - reinterpret_cast(&last_msg_->contents[99])), - 8) - << "incorrect value for contents[99], expected 8, is " - << last_msg_->contents[99]; - EXPECT_EQ(get_ascontents[100])>( - reinterpret_cast(&last_msg_->contents[100])), - 142) - << "incorrect value for contents[100], expected 142, is " - << last_msg_->contents[100]; - EXPECT_EQ(get_ascontents[101])>( - reinterpret_cast(&last_msg_->contents[101])), - 187) - << "incorrect value for contents[101], expected 187, is " - << last_msg_->contents[101]; - EXPECT_EQ(get_ascontents[102])>( - reinterpret_cast(&last_msg_->contents[102])), - 238) - << "incorrect value for contents[102], expected 238, is " - << last_msg_->contents[102]; - EXPECT_EQ(get_ascontents[103])>( - reinterpret_cast(&last_msg_->contents[103])), - 120) - << "incorrect value for contents[103], expected 120, is " - << last_msg_->contents[103]; - EXPECT_EQ(get_ascontents[104])>( - reinterpret_cast(&last_msg_->contents[104])), - 184) - << "incorrect value for contents[104], expected 184, is " - << last_msg_->contents[104]; - EXPECT_EQ(get_ascontents[105])>( - reinterpret_cast(&last_msg_->contents[105])), - 250) - << "incorrect value for contents[105], expected 250, is " - << last_msg_->contents[105]; - EXPECT_EQ(get_ascontents[106])>( - reinterpret_cast(&last_msg_->contents[106])), - 31) - << "incorrect value for contents[106], expected 31, is " - << last_msg_->contents[106]; - EXPECT_EQ(get_ascontents[107])>( - reinterpret_cast(&last_msg_->contents[107])), - 151) - << "incorrect value for contents[107], expected 151, is " - << last_msg_->contents[107]; - EXPECT_EQ(get_ascontents[108])>( - reinterpret_cast(&last_msg_->contents[108])), - 37) - << "incorrect value for contents[108], expected 37, is " - << last_msg_->contents[108]; - EXPECT_EQ(get_ascontents[109])>( - reinterpret_cast(&last_msg_->contents[109])), - 51) - << "incorrect value for contents[109], expected 51, is " - << last_msg_->contents[109]; - EXPECT_EQ(get_ascontents[110])>( - reinterpret_cast(&last_msg_->contents[110])), - 177) - << "incorrect value for contents[110], expected 177, is " - << last_msg_->contents[110]; - EXPECT_EQ(get_ascontents[111])>( - reinterpret_cast(&last_msg_->contents[111])), - 130) - << "incorrect value for contents[111], expected 130, is " - << last_msg_->contents[111]; - EXPECT_EQ(get_ascontents[112])>( - reinterpret_cast(&last_msg_->contents[112])), - 190) - << "incorrect value for contents[112], expected 190, is " - << last_msg_->contents[112]; - EXPECT_EQ(get_ascontents[113])>( - reinterpret_cast(&last_msg_->contents[113])), - 155) - << "incorrect value for contents[113], expected 155, is " - << last_msg_->contents[113]; - EXPECT_EQ(get_ascontents[114])>( - reinterpret_cast(&last_msg_->contents[114])), - 71) - << "incorrect value for contents[114], expected 71, is " - << last_msg_->contents[114]; - EXPECT_EQ(get_ascontents[115])>( - reinterpret_cast(&last_msg_->contents[115])), - 68) - << "incorrect value for contents[115], expected 68, is " - << last_msg_->contents[115]; - EXPECT_EQ(get_ascontents[116])>( - reinterpret_cast(&last_msg_->contents[116])), - 56) - << "incorrect value for contents[116], expected 56, is " - << last_msg_->contents[116]; - EXPECT_EQ(get_ascontents[117])>( - reinterpret_cast(&last_msg_->contents[117])), - 238) - << "incorrect value for contents[117], expected 238, is " - << last_msg_->contents[117]; - EXPECT_EQ(get_ascontents[118])>( - reinterpret_cast(&last_msg_->contents[118])), - 92) - << "incorrect value for contents[118], expected 92, is " - << last_msg_->contents[118]; - EXPECT_EQ(get_ascontents[119])>( - reinterpret_cast(&last_msg_->contents[119])), - 130) - << "incorrect value for contents[119], expected 130, is " - << last_msg_->contents[119]; - EXPECT_EQ(get_ascontents[120])>( - reinterpret_cast(&last_msg_->contents[120])), - 37) - << "incorrect value for contents[120], expected 37, is " - << last_msg_->contents[120]; - EXPECT_EQ(get_ascontents[121])>( - reinterpret_cast(&last_msg_->contents[121])), - 137) - << "incorrect value for contents[121], expected 137, is " - << last_msg_->contents[121]; - EXPECT_EQ(get_ascontents[122])>( - reinterpret_cast(&last_msg_->contents[122])), - 146) - << "incorrect value for contents[122], expected 146, is " - << last_msg_->contents[122]; - EXPECT_EQ(get_ascontents[123])>( - reinterpret_cast(&last_msg_->contents[123])), - 246) - << "incorrect value for contents[123], expected 246, is " - << last_msg_->contents[123]; - EXPECT_EQ(get_ascontents[124])>( - reinterpret_cast(&last_msg_->contents[124])), - 114) - << "incorrect value for contents[124], expected 114, is " - << last_msg_->contents[124]; - EXPECT_EQ(get_ascontents[125])>( - reinterpret_cast(&last_msg_->contents[125])), - 116) - << "incorrect value for contents[125], expected 116, is " - << last_msg_->contents[125]; - EXPECT_EQ(get_ascontents[126])>( - reinterpret_cast(&last_msg_->contents[126])), - 138) - << "incorrect value for contents[126], expected 138, is " - << last_msg_->contents[126]; - EXPECT_EQ(get_ascontents[127])>( - reinterpret_cast(&last_msg_->contents[127])), - 165) - << "incorrect value for contents[127], expected 165, is " - << last_msg_->contents[127]; - EXPECT_EQ(get_ascontents[128])>( - reinterpret_cast(&last_msg_->contents[128])), - 217) - << "incorrect value for contents[128], expected 217, is " - << last_msg_->contents[128]; - EXPECT_EQ(get_ascontents[129])>( - reinterpret_cast(&last_msg_->contents[129])), - 79) - << "incorrect value for contents[129], expected 79, is " - << last_msg_->contents[129]; - EXPECT_EQ(get_ascontents[130])>( - reinterpret_cast(&last_msg_->contents[130])), - 10) - << "incorrect value for contents[130], expected 10, is " - << last_msg_->contents[130]; - EXPECT_EQ(get_ascontents[131])>( - reinterpret_cast(&last_msg_->contents[131])), - 189) - << "incorrect value for contents[131], expected 189, is " - << last_msg_->contents[131]; - EXPECT_EQ(get_ascontents[132])>( - reinterpret_cast(&last_msg_->contents[132])), - 128) - << "incorrect value for contents[132], expected 128, is " - << last_msg_->contents[132]; - EXPECT_EQ(get_ascontents[133])>( - reinterpret_cast(&last_msg_->contents[133])), - 189) - << "incorrect value for contents[133], expected 189, is " - << last_msg_->contents[133]; - EXPECT_EQ(get_ascontents[134])>( - reinterpret_cast(&last_msg_->contents[134])), - 2) - << "incorrect value for contents[134], expected 2, is " - << last_msg_->contents[134]; - EXPECT_EQ(get_ascontents[135])>( - reinterpret_cast(&last_msg_->contents[135])), - 240) - << "incorrect value for contents[135], expected 240, is " - << last_msg_->contents[135]; - EXPECT_EQ(get_ascontents[136])>( - reinterpret_cast(&last_msg_->contents[136])), - 92) - << "incorrect value for contents[136], expected 92, is " - << last_msg_->contents[136]; - EXPECT_EQ(get_ascontents[137])>( - reinterpret_cast(&last_msg_->contents[137])), - 28) - << "incorrect value for contents[137], expected 28, is " - << last_msg_->contents[137]; - EXPECT_EQ(get_ascontents[138])>( - reinterpret_cast(&last_msg_->contents[138])), - 126) - << "incorrect value for contents[138], expected 126, is " - << last_msg_->contents[138]; - EXPECT_EQ(get_ascontents[139])>( - reinterpret_cast(&last_msg_->contents[139])), - 105) - << "incorrect value for contents[139], expected 105, is " - << last_msg_->contents[139]; - EXPECT_EQ(get_ascontents[140])>( - reinterpret_cast(&last_msg_->contents[140])), - 236) - << "incorrect value for contents[140], expected 236, is " - << last_msg_->contents[140]; - EXPECT_EQ(get_ascontents[141])>( - reinterpret_cast(&last_msg_->contents[141])), - 228) - << "incorrect value for contents[141], expected 228, is " - << last_msg_->contents[141]; - EXPECT_EQ(get_ascontents[142])>( - reinterpret_cast(&last_msg_->contents[142])), - 194) - << "incorrect value for contents[142], expected 194, is " - << last_msg_->contents[142]; - EXPECT_EQ(get_ascontents[143])>( - reinterpret_cast(&last_msg_->contents[143])), - 0) - << "incorrect value for contents[143], expected 0, is " - << last_msg_->contents[143]; - EXPECT_EQ(get_ascontents[144])>( - reinterpret_cast(&last_msg_->contents[144])), - 51) - << "incorrect value for contents[144], expected 51, is " - << last_msg_->contents[144]; - EXPECT_EQ(get_ascontents[145])>( - reinterpret_cast(&last_msg_->contents[145])), - 61) - << "incorrect value for contents[145], expected 61, is " - << last_msg_->contents[145]; - EXPECT_EQ(get_ascontents[146])>( - reinterpret_cast(&last_msg_->contents[146])), - 74) - << "incorrect value for contents[146], expected 74, is " - << last_msg_->contents[146]; - EXPECT_EQ(get_ascontents[147])>( - reinterpret_cast(&last_msg_->contents[147])), - 41) - << "incorrect value for contents[147], expected 41, is " - << last_msg_->contents[147]; - EXPECT_EQ(get_ascontents[148])>( - reinterpret_cast(&last_msg_->contents[148])), - 10) - << "incorrect value for contents[148], expected 10, is " - << last_msg_->contents[148]; - EXPECT_EQ(get_ascontents[149])>( - reinterpret_cast(&last_msg_->contents[149])), - 239) - << "incorrect value for contents[149], expected 239, is " - << last_msg_->contents[149]; - EXPECT_EQ(get_ascontents[150])>( - reinterpret_cast(&last_msg_->contents[150])), - 133) - << "incorrect value for contents[150], expected 133, is " - << last_msg_->contents[150]; - EXPECT_EQ(get_ascontents[151])>( - reinterpret_cast(&last_msg_->contents[151])), - 106) - << "incorrect value for contents[151], expected 106, is " - << last_msg_->contents[151]; - EXPECT_EQ(get_ascontents[152])>( - reinterpret_cast(&last_msg_->contents[152])), - 190) - << "incorrect value for contents[152], expected 190, is " - << last_msg_->contents[152]; - EXPECT_EQ(get_ascontents[153])>( - reinterpret_cast(&last_msg_->contents[153])), - 30) - << "incorrect value for contents[153], expected 30, is " - << last_msg_->contents[153]; - EXPECT_EQ(get_ascontents[154])>( - reinterpret_cast(&last_msg_->contents[154])), - 27) - << "incorrect value for contents[154], expected 27, is " - << last_msg_->contents[154]; - EXPECT_EQ(get_ascontents[155])>( - reinterpret_cast(&last_msg_->contents[155])), - 3) - << "incorrect value for contents[155], expected 3, is " - << last_msg_->contents[155]; - EXPECT_EQ(get_ascontents[156])>( - reinterpret_cast(&last_msg_->contents[156])), - 240) - << "incorrect value for contents[156], expected 240, is " - << last_msg_->contents[156]; - EXPECT_EQ(get_ascontents[157])>( - reinterpret_cast(&last_msg_->contents[157])), - 205) - << "incorrect value for contents[157], expected 205, is " - << last_msg_->contents[157]; - EXPECT_EQ(get_ascontents[158])>( - reinterpret_cast(&last_msg_->contents[158])), - 253) - << "incorrect value for contents[158], expected 253, is " - << last_msg_->contents[158]; - EXPECT_EQ(get_ascontents[159])>( - reinterpret_cast(&last_msg_->contents[159])), - 113) - << "incorrect value for contents[159], expected 113, is " - << last_msg_->contents[159]; - EXPECT_EQ(get_ascontents[160])>( - reinterpret_cast(&last_msg_->contents[160])), - 25) - << "incorrect value for contents[160], expected 25, is " - << last_msg_->contents[160]; - EXPECT_EQ(get_ascontents[161])>( - reinterpret_cast(&last_msg_->contents[161])), - 28) - << "incorrect value for contents[161], expected 28, is " - << last_msg_->contents[161]; - EXPECT_EQ(get_ascontents[162])>( - reinterpret_cast(&last_msg_->contents[162])), - 187) - << "incorrect value for contents[162], expected 187, is " - << last_msg_->contents[162]; - EXPECT_EQ(get_ascontents[163])>( - reinterpret_cast(&last_msg_->contents[163])), - 81) - << "incorrect value for contents[163], expected 81, is " - << last_msg_->contents[163]; - EXPECT_EQ(get_ascontents[164])>( - reinterpret_cast(&last_msg_->contents[164])), - 101) - << "incorrect value for contents[164], expected 101, is " - << last_msg_->contents[164]; - EXPECT_EQ(get_ascontents[165])>( - reinterpret_cast(&last_msg_->contents[165])), - 216) - << "incorrect value for contents[165], expected 216, is " - << last_msg_->contents[165]; - EXPECT_EQ(get_ascontents[166])>( - reinterpret_cast(&last_msg_->contents[166])), - 121) - << "incorrect value for contents[166], expected 121, is " - << last_msg_->contents[166]; - EXPECT_EQ(get_ascontents[167])>( - reinterpret_cast(&last_msg_->contents[167])), - 41) - << "incorrect value for contents[167], expected 41, is " - << last_msg_->contents[167]; - EXPECT_EQ(get_ascontents[168])>( - reinterpret_cast(&last_msg_->contents[168])), - 179) - << "incorrect value for contents[168], expected 179, is " - << last_msg_->contents[168]; - EXPECT_EQ(get_ascontents[169])>( - reinterpret_cast(&last_msg_->contents[169])), - 120) - << "incorrect value for contents[169], expected 120, is " - << last_msg_->contents[169]; - EXPECT_EQ(get_ascontents[170])>( - reinterpret_cast(&last_msg_->contents[170])), - 152) - << "incorrect value for contents[170], expected 152, is " - << last_msg_->contents[170]; - EXPECT_EQ(get_ascontents[171])>( - reinterpret_cast(&last_msg_->contents[171])), - 18) - << "incorrect value for contents[171], expected 18, is " - << last_msg_->contents[171]; - EXPECT_EQ(get_ascontents[172])>( - reinterpret_cast(&last_msg_->contents[172])), - 116) - << "incorrect value for contents[172], expected 116, is " - << last_msg_->contents[172]; - EXPECT_EQ(get_ascontents[173])>( - reinterpret_cast(&last_msg_->contents[173])), - 53) - << "incorrect value for contents[173], expected 53, is " - << last_msg_->contents[173]; - EXPECT_EQ(get_ascontents[174])>( - reinterpret_cast(&last_msg_->contents[174])), - 212) - << "incorrect value for contents[174], expected 212, is " - << last_msg_->contents[174]; - EXPECT_EQ(get_ascontents[175])>( - reinterpret_cast(&last_msg_->contents[175])), - 100) - << "incorrect value for contents[175], expected 100, is " - << last_msg_->contents[175]; - EXPECT_EQ(get_ascontents[176])>( - reinterpret_cast(&last_msg_->contents[176])), - 2) - << "incorrect value for contents[176], expected 2, is " - << last_msg_->contents[176]; - EXPECT_EQ(get_ascontents[177])>( - reinterpret_cast(&last_msg_->contents[177])), - 114) - << "incorrect value for contents[177], expected 114, is " - << last_msg_->contents[177]; - EXPECT_EQ(get_ascontents[178])>( - reinterpret_cast(&last_msg_->contents[178])), - 198) - << "incorrect value for contents[178], expected 198, is " - << last_msg_->contents[178]; - EXPECT_EQ(get_ascontents[179])>( - reinterpret_cast(&last_msg_->contents[179])), - 200) - << "incorrect value for contents[179], expected 200, is " - << last_msg_->contents[179]; - EXPECT_EQ(get_ascontents[180])>( - reinterpret_cast(&last_msg_->contents[180])), - 10) - << "incorrect value for contents[180], expected 10, is " - << last_msg_->contents[180]; - EXPECT_EQ(get_ascontents[181])>( - reinterpret_cast(&last_msg_->contents[181])), - 147) - << "incorrect value for contents[181], expected 147, is " - << last_msg_->contents[181]; - EXPECT_EQ(get_ascontents[182])>( - reinterpret_cast(&last_msg_->contents[182])), - 25) - << "incorrect value for contents[182], expected 25, is " - << last_msg_->contents[182]; - EXPECT_EQ(get_ascontents[183])>( - reinterpret_cast(&last_msg_->contents[183])), - 33) - << "incorrect value for contents[183], expected 33, is " - << last_msg_->contents[183]; - EXPECT_EQ(get_ascontents[184])>( - reinterpret_cast(&last_msg_->contents[184])), - 115) - << "incorrect value for contents[184], expected 115, is " - << last_msg_->contents[184]; - EXPECT_EQ(get_ascontents[185])>( - reinterpret_cast(&last_msg_->contents[185])), - 208) - << "incorrect value for contents[185], expected 208, is " - << last_msg_->contents[185]; - EXPECT_EQ(get_ascontents[186])>( - reinterpret_cast(&last_msg_->contents[186])), - 113) - << "incorrect value for contents[186], expected 113, is " - << last_msg_->contents[186]; - EXPECT_EQ(get_ascontents[187])>( - reinterpret_cast(&last_msg_->contents[187])), - 60) - << "incorrect value for contents[187], expected 60, is " - << last_msg_->contents[187]; - EXPECT_EQ(get_ascontents[188])>( - reinterpret_cast(&last_msg_->contents[188])), - 179) - << "incorrect value for contents[188], expected 179, is " - << last_msg_->contents[188]; - EXPECT_EQ(get_ascontents[189])>( - reinterpret_cast(&last_msg_->contents[189])), - 183) - << "incorrect value for contents[189], expected 183, is " - << last_msg_->contents[189]; - EXPECT_EQ(get_ascontents[190])>( - reinterpret_cast(&last_msg_->contents[190])), - 0) - << "incorrect value for contents[190], expected 0, is " - << last_msg_->contents[190]; - EXPECT_EQ(get_ascontents[191])>( - reinterpret_cast(&last_msg_->contents[191])), - 41) - << "incorrect value for contents[191], expected 41, is " - << last_msg_->contents[191]; - EXPECT_EQ(get_ascontents[192])>( - reinterpret_cast(&last_msg_->contents[192])), - 217) - << "incorrect value for contents[192], expected 217, is " - << last_msg_->contents[192]; - EXPECT_EQ(get_ascontents[193])>( - reinterpret_cast(&last_msg_->contents[193])), - 206) - << "incorrect value for contents[193], expected 206, is " - << last_msg_->contents[193]; - EXPECT_EQ(get_ascontents[194])>( - reinterpret_cast(&last_msg_->contents[194])), - 255) - << "incorrect value for contents[194], expected 255, is " - << last_msg_->contents[194]; - EXPECT_EQ(get_ascontents[195])>( - reinterpret_cast(&last_msg_->contents[195])), - 211) - << "incorrect value for contents[195], expected 211, is " - << last_msg_->contents[195]; - EXPECT_EQ(get_ascontents[196])>( - reinterpret_cast(&last_msg_->contents[196])), - 225) - << "incorrect value for contents[196], expected 225, is " - << last_msg_->contents[196]; - EXPECT_EQ(get_ascontents[197])>( - reinterpret_cast(&last_msg_->contents[197])), - 142) - << "incorrect value for contents[197], expected 142, is " - << last_msg_->contents[197]; - EXPECT_EQ(get_ascontents[198])>( - reinterpret_cast(&last_msg_->contents[198])), - 191) - << "incorrect value for contents[198], expected 191, is " - << last_msg_->contents[198]; - EXPECT_EQ(get_ascontents[199])>( - reinterpret_cast(&last_msg_->contents[199])), - 133) - << "incorrect value for contents[199], expected 133, is " - << last_msg_->contents[199]; - EXPECT_EQ(get_ascontents[200])>( - reinterpret_cast(&last_msg_->contents[200])), - 81) - << "incorrect value for contents[200], expected 81, is " - << last_msg_->contents[200]; - EXPECT_EQ(get_ascontents[201])>( - reinterpret_cast(&last_msg_->contents[201])), - 15) - << "incorrect value for contents[201], expected 15, is " - << last_msg_->contents[201]; - EXPECT_EQ(get_ascontents[202])>( - reinterpret_cast(&last_msg_->contents[202])), - 248) - << "incorrect value for contents[202], expected 248, is " - << last_msg_->contents[202]; - EXPECT_EQ(get_ascontents[203])>( - reinterpret_cast(&last_msg_->contents[203])), - 193) - << "incorrect value for contents[203], expected 193, is " - << last_msg_->contents[203]; - EXPECT_EQ(get_ascontents[204])>( - reinterpret_cast(&last_msg_->contents[204])), - 66) - << "incorrect value for contents[204], expected 66, is " - << last_msg_->contents[204]; - EXPECT_EQ(get_ascontents[205])>( - reinterpret_cast(&last_msg_->contents[205])), - 191) - << "incorrect value for contents[205], expected 191, is " - << last_msg_->contents[205]; - EXPECT_EQ(get_ascontents[206])>( - reinterpret_cast(&last_msg_->contents[206])), - 244) - << "incorrect value for contents[206], expected 244, is " - << last_msg_->contents[206]; - EXPECT_EQ(get_ascontents[207])>( - reinterpret_cast(&last_msg_->contents[207])), - 221) - << "incorrect value for contents[207], expected 221, is " - << last_msg_->contents[207]; - EXPECT_EQ(get_ascontents[208])>( - reinterpret_cast(&last_msg_->contents[208])), - 248) - << "incorrect value for contents[208], expected 248, is " - << last_msg_->contents[208]; - EXPECT_EQ(get_ascontents[209])>( - reinterpret_cast(&last_msg_->contents[209])), - 199) - << "incorrect value for contents[209], expected 199, is " - << last_msg_->contents[209]; - EXPECT_EQ(get_ascontents[210])>( - reinterpret_cast(&last_msg_->contents[210])), - 241) - << "incorrect value for contents[210], expected 241, is " - << last_msg_->contents[210]; - EXPECT_EQ(get_ascontents[211])>( - reinterpret_cast(&last_msg_->contents[211])), - 112) - << "incorrect value for contents[211], expected 112, is " - << last_msg_->contents[211]; - EXPECT_EQ(get_ascontents[212])>( - reinterpret_cast(&last_msg_->contents[212])), - 51) - << "incorrect value for contents[212], expected 51, is " - << last_msg_->contents[212]; - EXPECT_EQ(get_ascontents[213])>( - reinterpret_cast(&last_msg_->contents[213])), - 1) - << "incorrect value for contents[213], expected 1, is " - << last_msg_->contents[213]; - EXPECT_EQ(get_ascontents[214])>( - reinterpret_cast(&last_msg_->contents[214])), - 180) - << "incorrect value for contents[214], expected 180, is " - << last_msg_->contents[214]; - EXPECT_EQ(get_ascontents[215])>( - reinterpret_cast(&last_msg_->contents[215])), - 180) - << "incorrect value for contents[215], expected 180, is " - << last_msg_->contents[215]; - EXPECT_EQ(get_ascontents[216])>( - reinterpret_cast(&last_msg_->contents[216])), - 125) - << "incorrect value for contents[216], expected 125, is " - << last_msg_->contents[216]; - EXPECT_EQ(get_ascontents[217])>( - reinterpret_cast(&last_msg_->contents[217])), - 97) - << "incorrect value for contents[217], expected 97, is " - << last_msg_->contents[217]; - EXPECT_EQ(get_ascontents[218])>( - reinterpret_cast(&last_msg_->contents[218])), - 145) - << "incorrect value for contents[218], expected 145, is " - << last_msg_->contents[218]; - EXPECT_EQ(get_ascontents[219])>( - reinterpret_cast(&last_msg_->contents[219])), - 25) - << "incorrect value for contents[219], expected 25, is " - << last_msg_->contents[219]; - EXPECT_EQ(get_ascontents[220])>( - reinterpret_cast(&last_msg_->contents[220])), - 72) - << "incorrect value for contents[220], expected 72, is " - << last_msg_->contents[220]; - EXPECT_EQ(get_ascontents[221])>( - reinterpret_cast(&last_msg_->contents[221])), - 210) - << "incorrect value for contents[221], expected 210, is " - << last_msg_->contents[221]; - EXPECT_EQ(get_ascontents[222])>( - reinterpret_cast(&last_msg_->contents[222])), - 215) - << "incorrect value for contents[222], expected 215, is " - << last_msg_->contents[222]; - EXPECT_EQ(get_ascontents[223])>( - reinterpret_cast(&last_msg_->contents[223])), - 208) - << "incorrect value for contents[223], expected 208, is " - << last_msg_->contents[223]; - EXPECT_EQ(get_ascontents[224])>( - reinterpret_cast(&last_msg_->contents[224])), - 15) - << "incorrect value for contents[224], expected 15, is " - << last_msg_->contents[224]; - EXPECT_EQ(get_ascontents[225])>( - reinterpret_cast(&last_msg_->contents[225])), - 126) - << "incorrect value for contents[225], expected 126, is " - << last_msg_->contents[225]; - EXPECT_EQ(get_ascontents[226])>( - reinterpret_cast(&last_msg_->contents[226])), - 56) - << "incorrect value for contents[226], expected 56, is " - << last_msg_->contents[226]; - EXPECT_EQ(get_ascontents[227])>( - reinterpret_cast(&last_msg_->contents[227])), - 38) - << "incorrect value for contents[227], expected 38, is " - << last_msg_->contents[227]; - EXPECT_EQ(get_ascontents[228])>( - reinterpret_cast(&last_msg_->contents[228])), - 65) - << "incorrect value for contents[228], expected 65, is " - << last_msg_->contents[228]; - EXPECT_EQ(get_ascontents[229])>( - reinterpret_cast(&last_msg_->contents[229])), - 4) - << "incorrect value for contents[229], expected 4, is " - << last_msg_->contents[229]; - EXPECT_EQ(get_ascontents[230])>( - reinterpret_cast(&last_msg_->contents[230])), - 64) - << "incorrect value for contents[230], expected 64, is " - << last_msg_->contents[230]; - EXPECT_EQ(get_ascontents[231])>( - reinterpret_cast(&last_msg_->contents[231])), - 19) - << "incorrect value for contents[231], expected 19, is " - << last_msg_->contents[231]; - EXPECT_EQ(get_ascontents[232])>( - reinterpret_cast(&last_msg_->contents[232])), - 74) - << "incorrect value for contents[232], expected 74, is " - << last_msg_->contents[232]; - EXPECT_EQ(get_ascontents[233])>( - reinterpret_cast(&last_msg_->contents[233])), - 223) - << "incorrect value for contents[233], expected 223, is " - << last_msg_->contents[233]; - EXPECT_EQ(get_ascontents[234])>( - reinterpret_cast(&last_msg_->contents[234])), - 111) - << "incorrect value for contents[234], expected 111, is " - << last_msg_->contents[234]; - EXPECT_EQ(get_ascontents[235])>( - reinterpret_cast(&last_msg_->contents[235])), - 109) - << "incorrect value for contents[235], expected 109, is " - << last_msg_->contents[235]; - EXPECT_EQ(get_ascontents[236])>( - reinterpret_cast(&last_msg_->contents[236])), - 52) - << "incorrect value for contents[236], expected 52, is " - << last_msg_->contents[236]; - EXPECT_EQ(get_ascontents[237])>( - reinterpret_cast(&last_msg_->contents[237])), - 43) - << "incorrect value for contents[237], expected 43, is " - << last_msg_->contents[237]; - EXPECT_EQ(get_ascontents[238])>( - reinterpret_cast(&last_msg_->contents[238])), - 167) - << "incorrect value for contents[238], expected 167, is " - << last_msg_->contents[238]; - EXPECT_EQ(get_ascontents[239])>( - reinterpret_cast(&last_msg_->contents[239])), - 186) - << "incorrect value for contents[239], expected 186, is " - << last_msg_->contents[239]; - EXPECT_EQ(get_ascontents[240])>( - reinterpret_cast(&last_msg_->contents[240])), - 202) - << "incorrect value for contents[240], expected 202, is " - << last_msg_->contents[240]; - EXPECT_EQ(get_ascontents[241])>( - reinterpret_cast(&last_msg_->contents[241])), - 111) - << "incorrect value for contents[241], expected 111, is " - << last_msg_->contents[241]; - EXPECT_EQ(get_ascontents[242])>( - reinterpret_cast(&last_msg_->contents[242])), - 11) - << "incorrect value for contents[242], expected 11, is " - << last_msg_->contents[242]; - EXPECT_EQ(get_ascontents[243])>( - reinterpret_cast(&last_msg_->contents[243])), - 91) - << "incorrect value for contents[243], expected 91, is " - << last_msg_->contents[243]; - EXPECT_EQ(get_ascontents[244])>( - reinterpret_cast(&last_msg_->contents[244])), - 21) - << "incorrect value for contents[244], expected 21, is " - << last_msg_->contents[244]; - EXPECT_EQ(get_ascontents[245])>( - reinterpret_cast(&last_msg_->contents[245])), - 236) - << "incorrect value for contents[245], expected 236, is " - << last_msg_->contents[245]; - EXPECT_EQ(get_ascontents[246])>( - reinterpret_cast(&last_msg_->contents[246])), - 234) - << "incorrect value for contents[246], expected 234, is " - << last_msg_->contents[246]; - EXPECT_EQ(get_ascontents[247])>( - reinterpret_cast(&last_msg_->contents[247])), - 196) - << "incorrect value for contents[247], expected 196, is " - << last_msg_->contents[247]; - EXPECT_EQ(get_ascontents[248])>( - reinterpret_cast(&last_msg_->contents[248])), - 36) - << "incorrect value for contents[248], expected 36, is " - << last_msg_->contents[248]; - EXPECT_EQ(get_ascontents[249])>( - reinterpret_cast(&last_msg_->contents[249])), - 171) - << "incorrect value for contents[249], expected 171, is " - << last_msg_->contents[249]; - EXPECT_EQ(get_ascontents[250])>( - reinterpret_cast(&last_msg_->contents[250])), - 147) - << "incorrect value for contents[250], expected 147, is " - << last_msg_->contents[250]; - EXPECT_EQ(get_assequence)>( - reinterpret_cast(&last_msg_->sequence)), - 259241795) - << "incorrect value for sequence, expected 259241795, is " - << last_msg_->sequence; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioRemove.cc b/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioRemove.cc deleted file mode 100644 index 46c3dd1813..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioRemove.cc +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/file_io/test_MsgFileioRemove.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_file_io_MsgFileioRemove0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_file_io_MsgFileioRemove0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_fileio_remove_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_fileio_remove_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_file_io_MsgFileioRemove0, Test) { - uint8_t encoded_frame[] = { - 85, 172, 0, 195, 4, 14, 47, 112, 97, 116, 104, - 47, 116, 111, 47, 102, 105, 108, 101, 0, 46, 243, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_fileio_remove_t *test_msg = (msg_fileio_remove_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = {(char)47, (char)112, (char)97, (char)116, - (char)104, (char)47, (char)116, (char)111, - (char)47, (char)102, (char)105, (char)108, - (char)101, (char)0}; - memcpy(test_msg->filename, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->filename) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0xac, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = {(char)47, (char)112, (char)97, (char)116, - (char)104, (char)47, (char)116, (char)111, - (char)47, (char)102, (char)105, (char)108, - (char)101, (char)0}; - EXPECT_EQ(memcmp(last_msg_->filename, check_string, sizeof(check_string)), - 0) - << "incorrect value for last_msg_->filename, expected string '" - << check_string << "', is '" << last_msg_->filename << "'"; - } -} diff --git a/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioWriteResp.cc b/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioWriteResp.cc deleted file mode 100644 index ab1830496c..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_file_io_MsgFileioWriteResp.cc +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/file_io/test_MsgFileioWriteResp.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_file_io_MsgFileioWriteResp0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_file_io_MsgFileioWriteResp0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_fileio_write_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_fileio_write_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_file_io_MsgFileioWriteResp0, Test) { - uint8_t encoded_frame[] = { - 85, 171, 0, 66, 0, 4, 202, 0, 0, 0, 243, 243, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_fileio_write_resp_t *test_msg = - (msg_fileio_write_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->sequence = 202; - - EXPECT_EQ(send_message(0xab, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_assequence)>( - reinterpret_cast(&last_msg_->sequence)), - 202) - << "incorrect value for sequence, expected 202, is " - << last_msg_->sequence; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_flash_MsgFlashDone.cc b/c/test/legacy/cpp/auto_check_sbp_flash_MsgFlashDone.cc deleted file mode 100644 index 0dbde9310a..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_flash_MsgFlashDone.cc +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgFlashDone.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_flash_MsgFlashDone0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_flash_MsgFlashDone0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_flash_done_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_flash_done_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_flash_MsgFlashDone0, Test) { - uint8_t encoded_frame[] = { - 85, 224, 0, 195, 4, 1, 82, 6, 54, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_flash_done_t *test_msg = (msg_flash_done_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->response = 82; - - EXPECT_EQ(send_message(0xe0, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asresponse)>( - reinterpret_cast(&last_msg_->response)), - 82) - << "incorrect value for response, expected 82, is " - << last_msg_->response; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_flash_MsgFlashErase.cc b/c/test/legacy/cpp/auto_check_sbp_flash_MsgFlashErase.cc deleted file mode 100644 index 6d82da5e6d..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_flash_MsgFlashErase.cc +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgFlashErase.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_flash_MsgFlashErase0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_flash_MsgFlashErase0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_flash_erase_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_flash_erase_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_flash_MsgFlashErase0, Test) { - uint8_t encoded_frame[] = { - 85, 226, 0, 195, 4, 5, 74, 238, 177, 118, 132, 0, 251, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_flash_erase_t *test_msg = (msg_flash_erase_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->sector_num = 2222371310; - test_msg->target = 74; - - EXPECT_EQ(send_message(0xe2, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_assector_num)>( - reinterpret_cast(&last_msg_->sector_num)), - 2222371310) - << "incorrect value for sector_num, expected 2222371310, is " - << last_msg_->sector_num; - EXPECT_EQ(get_astarget)>( - reinterpret_cast(&last_msg_->target)), - 74) - << "incorrect value for target, expected 74, is " << last_msg_->target; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_flash_MsgFlashProgram.cc b/c/test/legacy/cpp/auto_check_sbp_flash_MsgFlashProgram.cc deleted file mode 100644 index a783e0924e..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_flash_MsgFlashProgram.cc +++ /dev/null @@ -1,2662 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgFlashProgram.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_flash_MsgFlashProgram0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_flash_MsgFlashProgram0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_flash_program_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_flash_program_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_flash_MsgFlashProgram0, Test) { - uint8_t encoded_frame[] = { - 85, 230, 0, 195, 4, 255, 212, 87, 52, 244, 250, 176, 222, 235, 106, - 144, 29, 141, 255, 3, 16, 192, 237, 172, 254, 213, 4, 220, 98, 34, - 222, 230, 214, 6, 217, 172, 122, 46, 13, 38, 240, 236, 60, 121, 47, - 252, 163, 141, 222, 29, 168, 214, 118, 55, 201, 233, 21, 214, 57, 245, - 246, 19, 3, 121, 49, 231, 37, 186, 58, 238, 98, 39, 70, 232, 133, - 25, 10, 134, 129, 69, 228, 134, 9, 88, 183, 133, 171, 255, 166, 100, - 152, 231, 92, 9, 196, 106, 246, 29, 145, 156, 151, 32, 67, 188, 63, - 233, 142, 174, 139, 154, 127, 35, 60, 56, 187, 121, 103, 135, 152, 182, - 88, 160, 255, 227, 240, 54, 100, 91, 31, 141, 102, 130, 254, 54, 227, - 229, 62, 53, 225, 143, 88, 139, 126, 235, 235, 35, 54, 134, 163, 92, - 57, 87, 130, 178, 22, 158, 18, 237, 209, 187, 226, 1, 46, 64, 226, - 235, 213, 186, 159, 221, 186, 25, 115, 84, 131, 167, 201, 104, 1, 200, - 13, 50, 71, 73, 193, 201, 250, 172, 193, 13, 20, 238, 130, 243, 68, - 4, 72, 46, 194, 113, 255, 238, 15, 230, 64, 178, 127, 217, 92, 160, - 201, 118, 163, 144, 58, 28, 174, 65, 73, 45, 123, 118, 83, 107, 239, - 168, 32, 212, 191, 81, 93, 186, 223, 32, 19, 58, 137, 72, 217, 151, - 251, 83, 20, 113, 37, 151, 34, 37, 71, 95, 105, 235, 144, 164, 83, - 197, 254, 183, 223, 91, 19, 45, 227, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_flash_program_t *test_msg = (msg_flash_program_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->addr_len = 250; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->addr_start[0])); - } - test_msg->addr_start[0] = 87; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->addr_start[0])); - } - test_msg->addr_start[1] = 52; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->addr_start[0])); - } - test_msg->addr_start[2] = 244; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[0] = 176; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[1] = 222; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[2] = 235; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[3] = 106; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[4] = 144; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[5] = 29; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[6] = 141; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[7] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[8] = 3; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[9] = 16; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[10] = 192; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[11] = 237; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[12] = 172; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[13] = 254; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[14] = 213; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[15] = 4; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[16] = 220; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[17] = 98; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[18] = 34; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[19] = 222; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[20] = 230; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[21] = 214; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[22] = 6; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[23] = 217; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[24] = 172; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[25] = 122; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[26] = 46; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[27] = 13; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[28] = 38; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[29] = 240; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[30] = 236; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[31] = 60; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[32] = 121; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[33] = 47; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[34] = 252; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[35] = 163; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[36] = 141; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[37] = 222; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[38] = 29; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[39] = 168; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[40] = 214; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[41] = 118; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[42] = 55; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[43] = 201; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[44] = 233; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[45] = 21; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[46] = 214; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[47] = 57; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[48] = 245; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[49] = 246; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[50] = 19; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[51] = 3; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[52] = 121; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[53] = 49; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[54] = 231; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[55] = 37; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[56] = 186; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[57] = 58; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[58] = 238; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[59] = 98; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[60] = 39; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[61] = 70; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[62] = 232; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[63] = 133; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[64] = 25; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[65] = 10; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[66] = 134; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[67] = 129; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[68] = 69; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[69] = 228; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[70] = 134; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[71] = 9; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[72] = 88; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[73] = 183; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[74] = 133; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[75] = 171; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[76] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[77] = 166; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[78] = 100; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[79] = 152; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[80] = 231; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[81] = 92; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[82] = 9; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[83] = 196; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[84] = 106; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[85] = 246; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[86] = 29; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[87] = 145; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[88] = 156; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[89] = 151; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[90] = 32; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[91] = 67; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[92] = 188; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[93] = 63; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[94] = 233; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[95] = 142; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[96] = 174; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[97] = 139; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[98] = 154; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[99] = 127; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[100] = 35; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[101] = 60; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[102] = 56; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[103] = 187; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[104] = 121; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[105] = 103; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[106] = 135; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[107] = 152; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[108] = 182; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[109] = 88; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[110] = 160; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[111] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[112] = 227; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[113] = 240; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[114] = 54; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[115] = 100; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[116] = 91; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[117] = 31; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[118] = 141; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[119] = 102; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[120] = 130; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[121] = 254; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[122] = 54; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[123] = 227; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[124] = 229; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[125] = 62; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[126] = 53; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[127] = 225; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[128] = 143; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[129] = 88; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[130] = 139; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[131] = 126; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[132] = 235; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[133] = 235; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[134] = 35; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[135] = 54; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[136] = 134; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[137] = 163; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[138] = 92; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[139] = 57; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[140] = 87; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[141] = 130; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[142] = 178; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[143] = 22; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[144] = 158; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[145] = 18; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[146] = 237; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[147] = 209; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[148] = 187; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[149] = 226; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[150] = 1; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[151] = 46; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[152] = 64; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[153] = 226; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[154] = 235; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[155] = 213; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[156] = 186; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[157] = 159; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[158] = 221; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[159] = 186; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[160] = 25; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[161] = 115; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[162] = 84; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[163] = 131; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[164] = 167; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[165] = 201; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[166] = 104; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[167] = 1; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[168] = 200; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[169] = 13; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[170] = 50; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[171] = 71; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[172] = 73; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[173] = 193; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[174] = 201; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[175] = 250; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[176] = 172; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[177] = 193; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[178] = 13; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[179] = 20; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[180] = 238; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[181] = 130; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[182] = 243; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[183] = 68; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[184] = 4; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[185] = 72; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[186] = 46; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[187] = 194; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[188] = 113; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[189] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[190] = 238; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[191] = 15; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[192] = 230; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[193] = 64; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[194] = 178; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[195] = 127; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[196] = 217; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[197] = 92; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[198] = 160; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[199] = 201; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[200] = 118; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[201] = 163; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[202] = 144; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[203] = 58; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[204] = 28; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[205] = 174; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[206] = 65; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[207] = 73; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[208] = 45; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[209] = 123; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[210] = 118; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[211] = 83; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[212] = 107; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[213] = 239; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[214] = 168; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[215] = 32; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[216] = 212; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[217] = 191; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[218] = 81; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[219] = 93; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[220] = 186; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[221] = 223; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[222] = 32; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[223] = 19; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[224] = 58; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[225] = 137; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[226] = 72; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[227] = 217; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[228] = 151; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[229] = 251; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[230] = 83; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[231] = 20; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[232] = 113; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[233] = 37; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[234] = 151; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[235] = 34; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[236] = 37; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[237] = 71; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[238] = 95; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[239] = 105; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[240] = 235; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[241] = 144; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[242] = 164; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[243] = 83; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[244] = 197; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[245] = 254; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[246] = 183; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[247] = 223; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[248] = 91; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[249] = 19; - test_msg->target = 212; - - EXPECT_EQ(send_message(0xe6, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaddr_len)>( - reinterpret_cast(&last_msg_->addr_len)), - 250) - << "incorrect value for addr_len, expected 250, is " - << last_msg_->addr_len; - EXPECT_EQ(get_asaddr_start[0])>( - reinterpret_cast(&last_msg_->addr_start[0])), - 87) - << "incorrect value for addr_start[0], expected 87, is " - << last_msg_->addr_start[0]; - EXPECT_EQ(get_asaddr_start[1])>( - reinterpret_cast(&last_msg_->addr_start[1])), - 52) - << "incorrect value for addr_start[1], expected 52, is " - << last_msg_->addr_start[1]; - EXPECT_EQ(get_asaddr_start[2])>( - reinterpret_cast(&last_msg_->addr_start[2])), - 244) - << "incorrect value for addr_start[2], expected 244, is " - << last_msg_->addr_start[2]; - EXPECT_EQ(get_asdata[0])>( - reinterpret_cast(&last_msg_->data[0])), - 176) - << "incorrect value for data[0], expected 176, is " << last_msg_->data[0]; - EXPECT_EQ(get_asdata[1])>( - reinterpret_cast(&last_msg_->data[1])), - 222) - << "incorrect value for data[1], expected 222, is " << last_msg_->data[1]; - EXPECT_EQ(get_asdata[2])>( - reinterpret_cast(&last_msg_->data[2])), - 235) - << "incorrect value for data[2], expected 235, is " << last_msg_->data[2]; - EXPECT_EQ(get_asdata[3])>( - reinterpret_cast(&last_msg_->data[3])), - 106) - << "incorrect value for data[3], expected 106, is " << last_msg_->data[3]; - EXPECT_EQ(get_asdata[4])>( - reinterpret_cast(&last_msg_->data[4])), - 144) - << "incorrect value for data[4], expected 144, is " << last_msg_->data[4]; - EXPECT_EQ(get_asdata[5])>( - reinterpret_cast(&last_msg_->data[5])), - 29) - << "incorrect value for data[5], expected 29, is " << last_msg_->data[5]; - EXPECT_EQ(get_asdata[6])>( - reinterpret_cast(&last_msg_->data[6])), - 141) - << "incorrect value for data[6], expected 141, is " << last_msg_->data[6]; - EXPECT_EQ(get_asdata[7])>( - reinterpret_cast(&last_msg_->data[7])), - 255) - << "incorrect value for data[7], expected 255, is " << last_msg_->data[7]; - EXPECT_EQ(get_asdata[8])>( - reinterpret_cast(&last_msg_->data[8])), - 3) - << "incorrect value for data[8], expected 3, is " << last_msg_->data[8]; - EXPECT_EQ(get_asdata[9])>( - reinterpret_cast(&last_msg_->data[9])), - 16) - << "incorrect value for data[9], expected 16, is " << last_msg_->data[9]; - EXPECT_EQ(get_asdata[10])>( - reinterpret_cast(&last_msg_->data[10])), - 192) - << "incorrect value for data[10], expected 192, is " - << last_msg_->data[10]; - EXPECT_EQ(get_asdata[11])>( - reinterpret_cast(&last_msg_->data[11])), - 237) - << "incorrect value for data[11], expected 237, is " - << last_msg_->data[11]; - EXPECT_EQ(get_asdata[12])>( - reinterpret_cast(&last_msg_->data[12])), - 172) - << "incorrect value for data[12], expected 172, is " - << last_msg_->data[12]; - EXPECT_EQ(get_asdata[13])>( - reinterpret_cast(&last_msg_->data[13])), - 254) - << "incorrect value for data[13], expected 254, is " - << last_msg_->data[13]; - EXPECT_EQ(get_asdata[14])>( - reinterpret_cast(&last_msg_->data[14])), - 213) - << "incorrect value for data[14], expected 213, is " - << last_msg_->data[14]; - EXPECT_EQ(get_asdata[15])>( - reinterpret_cast(&last_msg_->data[15])), - 4) - << "incorrect value for data[15], expected 4, is " << last_msg_->data[15]; - EXPECT_EQ(get_asdata[16])>( - reinterpret_cast(&last_msg_->data[16])), - 220) - << "incorrect value for data[16], expected 220, is " - << last_msg_->data[16]; - EXPECT_EQ(get_asdata[17])>( - reinterpret_cast(&last_msg_->data[17])), - 98) - << "incorrect value for data[17], expected 98, is " - << last_msg_->data[17]; - EXPECT_EQ(get_asdata[18])>( - reinterpret_cast(&last_msg_->data[18])), - 34) - << "incorrect value for data[18], expected 34, is " - << last_msg_->data[18]; - EXPECT_EQ(get_asdata[19])>( - reinterpret_cast(&last_msg_->data[19])), - 222) - << "incorrect value for data[19], expected 222, is " - << last_msg_->data[19]; - EXPECT_EQ(get_asdata[20])>( - reinterpret_cast(&last_msg_->data[20])), - 230) - << "incorrect value for data[20], expected 230, is " - << last_msg_->data[20]; - EXPECT_EQ(get_asdata[21])>( - reinterpret_cast(&last_msg_->data[21])), - 214) - << "incorrect value for data[21], expected 214, is " - << last_msg_->data[21]; - EXPECT_EQ(get_asdata[22])>( - reinterpret_cast(&last_msg_->data[22])), - 6) - << "incorrect value for data[22], expected 6, is " << last_msg_->data[22]; - EXPECT_EQ(get_asdata[23])>( - reinterpret_cast(&last_msg_->data[23])), - 217) - << "incorrect value for data[23], expected 217, is " - << last_msg_->data[23]; - EXPECT_EQ(get_asdata[24])>( - reinterpret_cast(&last_msg_->data[24])), - 172) - << "incorrect value for data[24], expected 172, is " - << last_msg_->data[24]; - EXPECT_EQ(get_asdata[25])>( - reinterpret_cast(&last_msg_->data[25])), - 122) - << "incorrect value for data[25], expected 122, is " - << last_msg_->data[25]; - EXPECT_EQ(get_asdata[26])>( - reinterpret_cast(&last_msg_->data[26])), - 46) - << "incorrect value for data[26], expected 46, is " - << last_msg_->data[26]; - EXPECT_EQ(get_asdata[27])>( - reinterpret_cast(&last_msg_->data[27])), - 13) - << "incorrect value for data[27], expected 13, is " - << last_msg_->data[27]; - EXPECT_EQ(get_asdata[28])>( - reinterpret_cast(&last_msg_->data[28])), - 38) - << "incorrect value for data[28], expected 38, is " - << last_msg_->data[28]; - EXPECT_EQ(get_asdata[29])>( - reinterpret_cast(&last_msg_->data[29])), - 240) - << "incorrect value for data[29], expected 240, is " - << last_msg_->data[29]; - EXPECT_EQ(get_asdata[30])>( - reinterpret_cast(&last_msg_->data[30])), - 236) - << "incorrect value for data[30], expected 236, is " - << last_msg_->data[30]; - EXPECT_EQ(get_asdata[31])>( - reinterpret_cast(&last_msg_->data[31])), - 60) - << "incorrect value for data[31], expected 60, is " - << last_msg_->data[31]; - EXPECT_EQ(get_asdata[32])>( - reinterpret_cast(&last_msg_->data[32])), - 121) - << "incorrect value for data[32], expected 121, is " - << last_msg_->data[32]; - EXPECT_EQ(get_asdata[33])>( - reinterpret_cast(&last_msg_->data[33])), - 47) - << "incorrect value for data[33], expected 47, is " - << last_msg_->data[33]; - EXPECT_EQ(get_asdata[34])>( - reinterpret_cast(&last_msg_->data[34])), - 252) - << "incorrect value for data[34], expected 252, is " - << last_msg_->data[34]; - EXPECT_EQ(get_asdata[35])>( - reinterpret_cast(&last_msg_->data[35])), - 163) - << "incorrect value for data[35], expected 163, is " - << last_msg_->data[35]; - EXPECT_EQ(get_asdata[36])>( - reinterpret_cast(&last_msg_->data[36])), - 141) - << "incorrect value for data[36], expected 141, is " - << last_msg_->data[36]; - EXPECT_EQ(get_asdata[37])>( - reinterpret_cast(&last_msg_->data[37])), - 222) - << "incorrect value for data[37], expected 222, is " - << last_msg_->data[37]; - EXPECT_EQ(get_asdata[38])>( - reinterpret_cast(&last_msg_->data[38])), - 29) - << "incorrect value for data[38], expected 29, is " - << last_msg_->data[38]; - EXPECT_EQ(get_asdata[39])>( - reinterpret_cast(&last_msg_->data[39])), - 168) - << "incorrect value for data[39], expected 168, is " - << last_msg_->data[39]; - EXPECT_EQ(get_asdata[40])>( - reinterpret_cast(&last_msg_->data[40])), - 214) - << "incorrect value for data[40], expected 214, is " - << last_msg_->data[40]; - EXPECT_EQ(get_asdata[41])>( - reinterpret_cast(&last_msg_->data[41])), - 118) - << "incorrect value for data[41], expected 118, is " - << last_msg_->data[41]; - EXPECT_EQ(get_asdata[42])>( - reinterpret_cast(&last_msg_->data[42])), - 55) - << "incorrect value for data[42], expected 55, is " - << last_msg_->data[42]; - EXPECT_EQ(get_asdata[43])>( - reinterpret_cast(&last_msg_->data[43])), - 201) - << "incorrect value for data[43], expected 201, is " - << last_msg_->data[43]; - EXPECT_EQ(get_asdata[44])>( - reinterpret_cast(&last_msg_->data[44])), - 233) - << "incorrect value for data[44], expected 233, is " - << last_msg_->data[44]; - EXPECT_EQ(get_asdata[45])>( - reinterpret_cast(&last_msg_->data[45])), - 21) - << "incorrect value for data[45], expected 21, is " - << last_msg_->data[45]; - EXPECT_EQ(get_asdata[46])>( - reinterpret_cast(&last_msg_->data[46])), - 214) - << "incorrect value for data[46], expected 214, is " - << last_msg_->data[46]; - EXPECT_EQ(get_asdata[47])>( - reinterpret_cast(&last_msg_->data[47])), - 57) - << "incorrect value for data[47], expected 57, is " - << last_msg_->data[47]; - EXPECT_EQ(get_asdata[48])>( - reinterpret_cast(&last_msg_->data[48])), - 245) - << "incorrect value for data[48], expected 245, is " - << last_msg_->data[48]; - EXPECT_EQ(get_asdata[49])>( - reinterpret_cast(&last_msg_->data[49])), - 246) - << "incorrect value for data[49], expected 246, is " - << last_msg_->data[49]; - EXPECT_EQ(get_asdata[50])>( - reinterpret_cast(&last_msg_->data[50])), - 19) - << "incorrect value for data[50], expected 19, is " - << last_msg_->data[50]; - EXPECT_EQ(get_asdata[51])>( - reinterpret_cast(&last_msg_->data[51])), - 3) - << "incorrect value for data[51], expected 3, is " << last_msg_->data[51]; - EXPECT_EQ(get_asdata[52])>( - reinterpret_cast(&last_msg_->data[52])), - 121) - << "incorrect value for data[52], expected 121, is " - << last_msg_->data[52]; - EXPECT_EQ(get_asdata[53])>( - reinterpret_cast(&last_msg_->data[53])), - 49) - << "incorrect value for data[53], expected 49, is " - << last_msg_->data[53]; - EXPECT_EQ(get_asdata[54])>( - reinterpret_cast(&last_msg_->data[54])), - 231) - << "incorrect value for data[54], expected 231, is " - << last_msg_->data[54]; - EXPECT_EQ(get_asdata[55])>( - reinterpret_cast(&last_msg_->data[55])), - 37) - << "incorrect value for data[55], expected 37, is " - << last_msg_->data[55]; - EXPECT_EQ(get_asdata[56])>( - reinterpret_cast(&last_msg_->data[56])), - 186) - << "incorrect value for data[56], expected 186, is " - << last_msg_->data[56]; - EXPECT_EQ(get_asdata[57])>( - reinterpret_cast(&last_msg_->data[57])), - 58) - << "incorrect value for data[57], expected 58, is " - << last_msg_->data[57]; - EXPECT_EQ(get_asdata[58])>( - reinterpret_cast(&last_msg_->data[58])), - 238) - << "incorrect value for data[58], expected 238, is " - << last_msg_->data[58]; - EXPECT_EQ(get_asdata[59])>( - reinterpret_cast(&last_msg_->data[59])), - 98) - << "incorrect value for data[59], expected 98, is " - << last_msg_->data[59]; - EXPECT_EQ(get_asdata[60])>( - reinterpret_cast(&last_msg_->data[60])), - 39) - << "incorrect value for data[60], expected 39, is " - << last_msg_->data[60]; - EXPECT_EQ(get_asdata[61])>( - reinterpret_cast(&last_msg_->data[61])), - 70) - << "incorrect value for data[61], expected 70, is " - << last_msg_->data[61]; - EXPECT_EQ(get_asdata[62])>( - reinterpret_cast(&last_msg_->data[62])), - 232) - << "incorrect value for data[62], expected 232, is " - << last_msg_->data[62]; - EXPECT_EQ(get_asdata[63])>( - reinterpret_cast(&last_msg_->data[63])), - 133) - << "incorrect value for data[63], expected 133, is " - << last_msg_->data[63]; - EXPECT_EQ(get_asdata[64])>( - reinterpret_cast(&last_msg_->data[64])), - 25) - << "incorrect value for data[64], expected 25, is " - << last_msg_->data[64]; - EXPECT_EQ(get_asdata[65])>( - reinterpret_cast(&last_msg_->data[65])), - 10) - << "incorrect value for data[65], expected 10, is " - << last_msg_->data[65]; - EXPECT_EQ(get_asdata[66])>( - reinterpret_cast(&last_msg_->data[66])), - 134) - << "incorrect value for data[66], expected 134, is " - << last_msg_->data[66]; - EXPECT_EQ(get_asdata[67])>( - reinterpret_cast(&last_msg_->data[67])), - 129) - << "incorrect value for data[67], expected 129, is " - << last_msg_->data[67]; - EXPECT_EQ(get_asdata[68])>( - reinterpret_cast(&last_msg_->data[68])), - 69) - << "incorrect value for data[68], expected 69, is " - << last_msg_->data[68]; - EXPECT_EQ(get_asdata[69])>( - reinterpret_cast(&last_msg_->data[69])), - 228) - << "incorrect value for data[69], expected 228, is " - << last_msg_->data[69]; - EXPECT_EQ(get_asdata[70])>( - reinterpret_cast(&last_msg_->data[70])), - 134) - << "incorrect value for data[70], expected 134, is " - << last_msg_->data[70]; - EXPECT_EQ(get_asdata[71])>( - reinterpret_cast(&last_msg_->data[71])), - 9) - << "incorrect value for data[71], expected 9, is " << last_msg_->data[71]; - EXPECT_EQ(get_asdata[72])>( - reinterpret_cast(&last_msg_->data[72])), - 88) - << "incorrect value for data[72], expected 88, is " - << last_msg_->data[72]; - EXPECT_EQ(get_asdata[73])>( - reinterpret_cast(&last_msg_->data[73])), - 183) - << "incorrect value for data[73], expected 183, is " - << last_msg_->data[73]; - EXPECT_EQ(get_asdata[74])>( - reinterpret_cast(&last_msg_->data[74])), - 133) - << "incorrect value for data[74], expected 133, is " - << last_msg_->data[74]; - EXPECT_EQ(get_asdata[75])>( - reinterpret_cast(&last_msg_->data[75])), - 171) - << "incorrect value for data[75], expected 171, is " - << last_msg_->data[75]; - EXPECT_EQ(get_asdata[76])>( - reinterpret_cast(&last_msg_->data[76])), - 255) - << "incorrect value for data[76], expected 255, is " - << last_msg_->data[76]; - EXPECT_EQ(get_asdata[77])>( - reinterpret_cast(&last_msg_->data[77])), - 166) - << "incorrect value for data[77], expected 166, is " - << last_msg_->data[77]; - EXPECT_EQ(get_asdata[78])>( - reinterpret_cast(&last_msg_->data[78])), - 100) - << "incorrect value for data[78], expected 100, is " - << last_msg_->data[78]; - EXPECT_EQ(get_asdata[79])>( - reinterpret_cast(&last_msg_->data[79])), - 152) - << "incorrect value for data[79], expected 152, is " - << last_msg_->data[79]; - EXPECT_EQ(get_asdata[80])>( - reinterpret_cast(&last_msg_->data[80])), - 231) - << "incorrect value for data[80], expected 231, is " - << last_msg_->data[80]; - EXPECT_EQ(get_asdata[81])>( - reinterpret_cast(&last_msg_->data[81])), - 92) - << "incorrect value for data[81], expected 92, is " - << last_msg_->data[81]; - EXPECT_EQ(get_asdata[82])>( - reinterpret_cast(&last_msg_->data[82])), - 9) - << "incorrect value for data[82], expected 9, is " << last_msg_->data[82]; - EXPECT_EQ(get_asdata[83])>( - reinterpret_cast(&last_msg_->data[83])), - 196) - << "incorrect value for data[83], expected 196, is " - << last_msg_->data[83]; - EXPECT_EQ(get_asdata[84])>( - reinterpret_cast(&last_msg_->data[84])), - 106) - << "incorrect value for data[84], expected 106, is " - << last_msg_->data[84]; - EXPECT_EQ(get_asdata[85])>( - reinterpret_cast(&last_msg_->data[85])), - 246) - << "incorrect value for data[85], expected 246, is " - << last_msg_->data[85]; - EXPECT_EQ(get_asdata[86])>( - reinterpret_cast(&last_msg_->data[86])), - 29) - << "incorrect value for data[86], expected 29, is " - << last_msg_->data[86]; - EXPECT_EQ(get_asdata[87])>( - reinterpret_cast(&last_msg_->data[87])), - 145) - << "incorrect value for data[87], expected 145, is " - << last_msg_->data[87]; - EXPECT_EQ(get_asdata[88])>( - reinterpret_cast(&last_msg_->data[88])), - 156) - << "incorrect value for data[88], expected 156, is " - << last_msg_->data[88]; - EXPECT_EQ(get_asdata[89])>( - reinterpret_cast(&last_msg_->data[89])), - 151) - << "incorrect value for data[89], expected 151, is " - << last_msg_->data[89]; - EXPECT_EQ(get_asdata[90])>( - reinterpret_cast(&last_msg_->data[90])), - 32) - << "incorrect value for data[90], expected 32, is " - << last_msg_->data[90]; - EXPECT_EQ(get_asdata[91])>( - reinterpret_cast(&last_msg_->data[91])), - 67) - << "incorrect value for data[91], expected 67, is " - << last_msg_->data[91]; - EXPECT_EQ(get_asdata[92])>( - reinterpret_cast(&last_msg_->data[92])), - 188) - << "incorrect value for data[92], expected 188, is " - << last_msg_->data[92]; - EXPECT_EQ(get_asdata[93])>( - reinterpret_cast(&last_msg_->data[93])), - 63) - << "incorrect value for data[93], expected 63, is " - << last_msg_->data[93]; - EXPECT_EQ(get_asdata[94])>( - reinterpret_cast(&last_msg_->data[94])), - 233) - << "incorrect value for data[94], expected 233, is " - << last_msg_->data[94]; - EXPECT_EQ(get_asdata[95])>( - reinterpret_cast(&last_msg_->data[95])), - 142) - << "incorrect value for data[95], expected 142, is " - << last_msg_->data[95]; - EXPECT_EQ(get_asdata[96])>( - reinterpret_cast(&last_msg_->data[96])), - 174) - << "incorrect value for data[96], expected 174, is " - << last_msg_->data[96]; - EXPECT_EQ(get_asdata[97])>( - reinterpret_cast(&last_msg_->data[97])), - 139) - << "incorrect value for data[97], expected 139, is " - << last_msg_->data[97]; - EXPECT_EQ(get_asdata[98])>( - reinterpret_cast(&last_msg_->data[98])), - 154) - << "incorrect value for data[98], expected 154, is " - << last_msg_->data[98]; - EXPECT_EQ(get_asdata[99])>( - reinterpret_cast(&last_msg_->data[99])), - 127) - << "incorrect value for data[99], expected 127, is " - << last_msg_->data[99]; - EXPECT_EQ(get_asdata[100])>( - reinterpret_cast(&last_msg_->data[100])), - 35) - << "incorrect value for data[100], expected 35, is " - << last_msg_->data[100]; - EXPECT_EQ(get_asdata[101])>( - reinterpret_cast(&last_msg_->data[101])), - 60) - << "incorrect value for data[101], expected 60, is " - << last_msg_->data[101]; - EXPECT_EQ(get_asdata[102])>( - reinterpret_cast(&last_msg_->data[102])), - 56) - << "incorrect value for data[102], expected 56, is " - << last_msg_->data[102]; - EXPECT_EQ(get_asdata[103])>( - reinterpret_cast(&last_msg_->data[103])), - 187) - << "incorrect value for data[103], expected 187, is " - << last_msg_->data[103]; - EXPECT_EQ(get_asdata[104])>( - reinterpret_cast(&last_msg_->data[104])), - 121) - << "incorrect value for data[104], expected 121, is " - << last_msg_->data[104]; - EXPECT_EQ(get_asdata[105])>( - reinterpret_cast(&last_msg_->data[105])), - 103) - << "incorrect value for data[105], expected 103, is " - << last_msg_->data[105]; - EXPECT_EQ(get_asdata[106])>( - reinterpret_cast(&last_msg_->data[106])), - 135) - << "incorrect value for data[106], expected 135, is " - << last_msg_->data[106]; - EXPECT_EQ(get_asdata[107])>( - reinterpret_cast(&last_msg_->data[107])), - 152) - << "incorrect value for data[107], expected 152, is " - << last_msg_->data[107]; - EXPECT_EQ(get_asdata[108])>( - reinterpret_cast(&last_msg_->data[108])), - 182) - << "incorrect value for data[108], expected 182, is " - << last_msg_->data[108]; - EXPECT_EQ(get_asdata[109])>( - reinterpret_cast(&last_msg_->data[109])), - 88) - << "incorrect value for data[109], expected 88, is " - << last_msg_->data[109]; - EXPECT_EQ(get_asdata[110])>( - reinterpret_cast(&last_msg_->data[110])), - 160) - << "incorrect value for data[110], expected 160, is " - << last_msg_->data[110]; - EXPECT_EQ(get_asdata[111])>( - reinterpret_cast(&last_msg_->data[111])), - 255) - << "incorrect value for data[111], expected 255, is " - << last_msg_->data[111]; - EXPECT_EQ(get_asdata[112])>( - reinterpret_cast(&last_msg_->data[112])), - 227) - << "incorrect value for data[112], expected 227, is " - << last_msg_->data[112]; - EXPECT_EQ(get_asdata[113])>( - reinterpret_cast(&last_msg_->data[113])), - 240) - << "incorrect value for data[113], expected 240, is " - << last_msg_->data[113]; - EXPECT_EQ(get_asdata[114])>( - reinterpret_cast(&last_msg_->data[114])), - 54) - << "incorrect value for data[114], expected 54, is " - << last_msg_->data[114]; - EXPECT_EQ(get_asdata[115])>( - reinterpret_cast(&last_msg_->data[115])), - 100) - << "incorrect value for data[115], expected 100, is " - << last_msg_->data[115]; - EXPECT_EQ(get_asdata[116])>( - reinterpret_cast(&last_msg_->data[116])), - 91) - << "incorrect value for data[116], expected 91, is " - << last_msg_->data[116]; - EXPECT_EQ(get_asdata[117])>( - reinterpret_cast(&last_msg_->data[117])), - 31) - << "incorrect value for data[117], expected 31, is " - << last_msg_->data[117]; - EXPECT_EQ(get_asdata[118])>( - reinterpret_cast(&last_msg_->data[118])), - 141) - << "incorrect value for data[118], expected 141, is " - << last_msg_->data[118]; - EXPECT_EQ(get_asdata[119])>( - reinterpret_cast(&last_msg_->data[119])), - 102) - << "incorrect value for data[119], expected 102, is " - << last_msg_->data[119]; - EXPECT_EQ(get_asdata[120])>( - reinterpret_cast(&last_msg_->data[120])), - 130) - << "incorrect value for data[120], expected 130, is " - << last_msg_->data[120]; - EXPECT_EQ(get_asdata[121])>( - reinterpret_cast(&last_msg_->data[121])), - 254) - << "incorrect value for data[121], expected 254, is " - << last_msg_->data[121]; - EXPECT_EQ(get_asdata[122])>( - reinterpret_cast(&last_msg_->data[122])), - 54) - << "incorrect value for data[122], expected 54, is " - << last_msg_->data[122]; - EXPECT_EQ(get_asdata[123])>( - reinterpret_cast(&last_msg_->data[123])), - 227) - << "incorrect value for data[123], expected 227, is " - << last_msg_->data[123]; - EXPECT_EQ(get_asdata[124])>( - reinterpret_cast(&last_msg_->data[124])), - 229) - << "incorrect value for data[124], expected 229, is " - << last_msg_->data[124]; - EXPECT_EQ(get_asdata[125])>( - reinterpret_cast(&last_msg_->data[125])), - 62) - << "incorrect value for data[125], expected 62, is " - << last_msg_->data[125]; - EXPECT_EQ(get_asdata[126])>( - reinterpret_cast(&last_msg_->data[126])), - 53) - << "incorrect value for data[126], expected 53, is " - << last_msg_->data[126]; - EXPECT_EQ(get_asdata[127])>( - reinterpret_cast(&last_msg_->data[127])), - 225) - << "incorrect value for data[127], expected 225, is " - << last_msg_->data[127]; - EXPECT_EQ(get_asdata[128])>( - reinterpret_cast(&last_msg_->data[128])), - 143) - << "incorrect value for data[128], expected 143, is " - << last_msg_->data[128]; - EXPECT_EQ(get_asdata[129])>( - reinterpret_cast(&last_msg_->data[129])), - 88) - << "incorrect value for data[129], expected 88, is " - << last_msg_->data[129]; - EXPECT_EQ(get_asdata[130])>( - reinterpret_cast(&last_msg_->data[130])), - 139) - << "incorrect value for data[130], expected 139, is " - << last_msg_->data[130]; - EXPECT_EQ(get_asdata[131])>( - reinterpret_cast(&last_msg_->data[131])), - 126) - << "incorrect value for data[131], expected 126, is " - << last_msg_->data[131]; - EXPECT_EQ(get_asdata[132])>( - reinterpret_cast(&last_msg_->data[132])), - 235) - << "incorrect value for data[132], expected 235, is " - << last_msg_->data[132]; - EXPECT_EQ(get_asdata[133])>( - reinterpret_cast(&last_msg_->data[133])), - 235) - << "incorrect value for data[133], expected 235, is " - << last_msg_->data[133]; - EXPECT_EQ(get_asdata[134])>( - reinterpret_cast(&last_msg_->data[134])), - 35) - << "incorrect value for data[134], expected 35, is " - << last_msg_->data[134]; - EXPECT_EQ(get_asdata[135])>( - reinterpret_cast(&last_msg_->data[135])), - 54) - << "incorrect value for data[135], expected 54, is " - << last_msg_->data[135]; - EXPECT_EQ(get_asdata[136])>( - reinterpret_cast(&last_msg_->data[136])), - 134) - << "incorrect value for data[136], expected 134, is " - << last_msg_->data[136]; - EXPECT_EQ(get_asdata[137])>( - reinterpret_cast(&last_msg_->data[137])), - 163) - << "incorrect value for data[137], expected 163, is " - << last_msg_->data[137]; - EXPECT_EQ(get_asdata[138])>( - reinterpret_cast(&last_msg_->data[138])), - 92) - << "incorrect value for data[138], expected 92, is " - << last_msg_->data[138]; - EXPECT_EQ(get_asdata[139])>( - reinterpret_cast(&last_msg_->data[139])), - 57) - << "incorrect value for data[139], expected 57, is " - << last_msg_->data[139]; - EXPECT_EQ(get_asdata[140])>( - reinterpret_cast(&last_msg_->data[140])), - 87) - << "incorrect value for data[140], expected 87, is " - << last_msg_->data[140]; - EXPECT_EQ(get_asdata[141])>( - reinterpret_cast(&last_msg_->data[141])), - 130) - << "incorrect value for data[141], expected 130, is " - << last_msg_->data[141]; - EXPECT_EQ(get_asdata[142])>( - reinterpret_cast(&last_msg_->data[142])), - 178) - << "incorrect value for data[142], expected 178, is " - << last_msg_->data[142]; - EXPECT_EQ(get_asdata[143])>( - reinterpret_cast(&last_msg_->data[143])), - 22) - << "incorrect value for data[143], expected 22, is " - << last_msg_->data[143]; - EXPECT_EQ(get_asdata[144])>( - reinterpret_cast(&last_msg_->data[144])), - 158) - << "incorrect value for data[144], expected 158, is " - << last_msg_->data[144]; - EXPECT_EQ(get_asdata[145])>( - reinterpret_cast(&last_msg_->data[145])), - 18) - << "incorrect value for data[145], expected 18, is " - << last_msg_->data[145]; - EXPECT_EQ(get_asdata[146])>( - reinterpret_cast(&last_msg_->data[146])), - 237) - << "incorrect value for data[146], expected 237, is " - << last_msg_->data[146]; - EXPECT_EQ(get_asdata[147])>( - reinterpret_cast(&last_msg_->data[147])), - 209) - << "incorrect value for data[147], expected 209, is " - << last_msg_->data[147]; - EXPECT_EQ(get_asdata[148])>( - reinterpret_cast(&last_msg_->data[148])), - 187) - << "incorrect value for data[148], expected 187, is " - << last_msg_->data[148]; - EXPECT_EQ(get_asdata[149])>( - reinterpret_cast(&last_msg_->data[149])), - 226) - << "incorrect value for data[149], expected 226, is " - << last_msg_->data[149]; - EXPECT_EQ(get_asdata[150])>( - reinterpret_cast(&last_msg_->data[150])), - 1) - << "incorrect value for data[150], expected 1, is " - << last_msg_->data[150]; - EXPECT_EQ(get_asdata[151])>( - reinterpret_cast(&last_msg_->data[151])), - 46) - << "incorrect value for data[151], expected 46, is " - << last_msg_->data[151]; - EXPECT_EQ(get_asdata[152])>( - reinterpret_cast(&last_msg_->data[152])), - 64) - << "incorrect value for data[152], expected 64, is " - << last_msg_->data[152]; - EXPECT_EQ(get_asdata[153])>( - reinterpret_cast(&last_msg_->data[153])), - 226) - << "incorrect value for data[153], expected 226, is " - << last_msg_->data[153]; - EXPECT_EQ(get_asdata[154])>( - reinterpret_cast(&last_msg_->data[154])), - 235) - << "incorrect value for data[154], expected 235, is " - << last_msg_->data[154]; - EXPECT_EQ(get_asdata[155])>( - reinterpret_cast(&last_msg_->data[155])), - 213) - << "incorrect value for data[155], expected 213, is " - << last_msg_->data[155]; - EXPECT_EQ(get_asdata[156])>( - reinterpret_cast(&last_msg_->data[156])), - 186) - << "incorrect value for data[156], expected 186, is " - << last_msg_->data[156]; - EXPECT_EQ(get_asdata[157])>( - reinterpret_cast(&last_msg_->data[157])), - 159) - << "incorrect value for data[157], expected 159, is " - << last_msg_->data[157]; - EXPECT_EQ(get_asdata[158])>( - reinterpret_cast(&last_msg_->data[158])), - 221) - << "incorrect value for data[158], expected 221, is " - << last_msg_->data[158]; - EXPECT_EQ(get_asdata[159])>( - reinterpret_cast(&last_msg_->data[159])), - 186) - << "incorrect value for data[159], expected 186, is " - << last_msg_->data[159]; - EXPECT_EQ(get_asdata[160])>( - reinterpret_cast(&last_msg_->data[160])), - 25) - << "incorrect value for data[160], expected 25, is " - << last_msg_->data[160]; - EXPECT_EQ(get_asdata[161])>( - reinterpret_cast(&last_msg_->data[161])), - 115) - << "incorrect value for data[161], expected 115, is " - << last_msg_->data[161]; - EXPECT_EQ(get_asdata[162])>( - reinterpret_cast(&last_msg_->data[162])), - 84) - << "incorrect value for data[162], expected 84, is " - << last_msg_->data[162]; - EXPECT_EQ(get_asdata[163])>( - reinterpret_cast(&last_msg_->data[163])), - 131) - << "incorrect value for data[163], expected 131, is " - << last_msg_->data[163]; - EXPECT_EQ(get_asdata[164])>( - reinterpret_cast(&last_msg_->data[164])), - 167) - << "incorrect value for data[164], expected 167, is " - << last_msg_->data[164]; - EXPECT_EQ(get_asdata[165])>( - reinterpret_cast(&last_msg_->data[165])), - 201) - << "incorrect value for data[165], expected 201, is " - << last_msg_->data[165]; - EXPECT_EQ(get_asdata[166])>( - reinterpret_cast(&last_msg_->data[166])), - 104) - << "incorrect value for data[166], expected 104, is " - << last_msg_->data[166]; - EXPECT_EQ(get_asdata[167])>( - reinterpret_cast(&last_msg_->data[167])), - 1) - << "incorrect value for data[167], expected 1, is " - << last_msg_->data[167]; - EXPECT_EQ(get_asdata[168])>( - reinterpret_cast(&last_msg_->data[168])), - 200) - << "incorrect value for data[168], expected 200, is " - << last_msg_->data[168]; - EXPECT_EQ(get_asdata[169])>( - reinterpret_cast(&last_msg_->data[169])), - 13) - << "incorrect value for data[169], expected 13, is " - << last_msg_->data[169]; - EXPECT_EQ(get_asdata[170])>( - reinterpret_cast(&last_msg_->data[170])), - 50) - << "incorrect value for data[170], expected 50, is " - << last_msg_->data[170]; - EXPECT_EQ(get_asdata[171])>( - reinterpret_cast(&last_msg_->data[171])), - 71) - << "incorrect value for data[171], expected 71, is " - << last_msg_->data[171]; - EXPECT_EQ(get_asdata[172])>( - reinterpret_cast(&last_msg_->data[172])), - 73) - << "incorrect value for data[172], expected 73, is " - << last_msg_->data[172]; - EXPECT_EQ(get_asdata[173])>( - reinterpret_cast(&last_msg_->data[173])), - 193) - << "incorrect value for data[173], expected 193, is " - << last_msg_->data[173]; - EXPECT_EQ(get_asdata[174])>( - reinterpret_cast(&last_msg_->data[174])), - 201) - << "incorrect value for data[174], expected 201, is " - << last_msg_->data[174]; - EXPECT_EQ(get_asdata[175])>( - reinterpret_cast(&last_msg_->data[175])), - 250) - << "incorrect value for data[175], expected 250, is " - << last_msg_->data[175]; - EXPECT_EQ(get_asdata[176])>( - reinterpret_cast(&last_msg_->data[176])), - 172) - << "incorrect value for data[176], expected 172, is " - << last_msg_->data[176]; - EXPECT_EQ(get_asdata[177])>( - reinterpret_cast(&last_msg_->data[177])), - 193) - << "incorrect value for data[177], expected 193, is " - << last_msg_->data[177]; - EXPECT_EQ(get_asdata[178])>( - reinterpret_cast(&last_msg_->data[178])), - 13) - << "incorrect value for data[178], expected 13, is " - << last_msg_->data[178]; - EXPECT_EQ(get_asdata[179])>( - reinterpret_cast(&last_msg_->data[179])), - 20) - << "incorrect value for data[179], expected 20, is " - << last_msg_->data[179]; - EXPECT_EQ(get_asdata[180])>( - reinterpret_cast(&last_msg_->data[180])), - 238) - << "incorrect value for data[180], expected 238, is " - << last_msg_->data[180]; - EXPECT_EQ(get_asdata[181])>( - reinterpret_cast(&last_msg_->data[181])), - 130) - << "incorrect value for data[181], expected 130, is " - << last_msg_->data[181]; - EXPECT_EQ(get_asdata[182])>( - reinterpret_cast(&last_msg_->data[182])), - 243) - << "incorrect value for data[182], expected 243, is " - << last_msg_->data[182]; - EXPECT_EQ(get_asdata[183])>( - reinterpret_cast(&last_msg_->data[183])), - 68) - << "incorrect value for data[183], expected 68, is " - << last_msg_->data[183]; - EXPECT_EQ(get_asdata[184])>( - reinterpret_cast(&last_msg_->data[184])), - 4) - << "incorrect value for data[184], expected 4, is " - << last_msg_->data[184]; - EXPECT_EQ(get_asdata[185])>( - reinterpret_cast(&last_msg_->data[185])), - 72) - << "incorrect value for data[185], expected 72, is " - << last_msg_->data[185]; - EXPECT_EQ(get_asdata[186])>( - reinterpret_cast(&last_msg_->data[186])), - 46) - << "incorrect value for data[186], expected 46, is " - << last_msg_->data[186]; - EXPECT_EQ(get_asdata[187])>( - reinterpret_cast(&last_msg_->data[187])), - 194) - << "incorrect value for data[187], expected 194, is " - << last_msg_->data[187]; - EXPECT_EQ(get_asdata[188])>( - reinterpret_cast(&last_msg_->data[188])), - 113) - << "incorrect value for data[188], expected 113, is " - << last_msg_->data[188]; - EXPECT_EQ(get_asdata[189])>( - reinterpret_cast(&last_msg_->data[189])), - 255) - << "incorrect value for data[189], expected 255, is " - << last_msg_->data[189]; - EXPECT_EQ(get_asdata[190])>( - reinterpret_cast(&last_msg_->data[190])), - 238) - << "incorrect value for data[190], expected 238, is " - << last_msg_->data[190]; - EXPECT_EQ(get_asdata[191])>( - reinterpret_cast(&last_msg_->data[191])), - 15) - << "incorrect value for data[191], expected 15, is " - << last_msg_->data[191]; - EXPECT_EQ(get_asdata[192])>( - reinterpret_cast(&last_msg_->data[192])), - 230) - << "incorrect value for data[192], expected 230, is " - << last_msg_->data[192]; - EXPECT_EQ(get_asdata[193])>( - reinterpret_cast(&last_msg_->data[193])), - 64) - << "incorrect value for data[193], expected 64, is " - << last_msg_->data[193]; - EXPECT_EQ(get_asdata[194])>( - reinterpret_cast(&last_msg_->data[194])), - 178) - << "incorrect value for data[194], expected 178, is " - << last_msg_->data[194]; - EXPECT_EQ(get_asdata[195])>( - reinterpret_cast(&last_msg_->data[195])), - 127) - << "incorrect value for data[195], expected 127, is " - << last_msg_->data[195]; - EXPECT_EQ(get_asdata[196])>( - reinterpret_cast(&last_msg_->data[196])), - 217) - << "incorrect value for data[196], expected 217, is " - << last_msg_->data[196]; - EXPECT_EQ(get_asdata[197])>( - reinterpret_cast(&last_msg_->data[197])), - 92) - << "incorrect value for data[197], expected 92, is " - << last_msg_->data[197]; - EXPECT_EQ(get_asdata[198])>( - reinterpret_cast(&last_msg_->data[198])), - 160) - << "incorrect value for data[198], expected 160, is " - << last_msg_->data[198]; - EXPECT_EQ(get_asdata[199])>( - reinterpret_cast(&last_msg_->data[199])), - 201) - << "incorrect value for data[199], expected 201, is " - << last_msg_->data[199]; - EXPECT_EQ(get_asdata[200])>( - reinterpret_cast(&last_msg_->data[200])), - 118) - << "incorrect value for data[200], expected 118, is " - << last_msg_->data[200]; - EXPECT_EQ(get_asdata[201])>( - reinterpret_cast(&last_msg_->data[201])), - 163) - << "incorrect value for data[201], expected 163, is " - << last_msg_->data[201]; - EXPECT_EQ(get_asdata[202])>( - reinterpret_cast(&last_msg_->data[202])), - 144) - << "incorrect value for data[202], expected 144, is " - << last_msg_->data[202]; - EXPECT_EQ(get_asdata[203])>( - reinterpret_cast(&last_msg_->data[203])), - 58) - << "incorrect value for data[203], expected 58, is " - << last_msg_->data[203]; - EXPECT_EQ(get_asdata[204])>( - reinterpret_cast(&last_msg_->data[204])), - 28) - << "incorrect value for data[204], expected 28, is " - << last_msg_->data[204]; - EXPECT_EQ(get_asdata[205])>( - reinterpret_cast(&last_msg_->data[205])), - 174) - << "incorrect value for data[205], expected 174, is " - << last_msg_->data[205]; - EXPECT_EQ(get_asdata[206])>( - reinterpret_cast(&last_msg_->data[206])), - 65) - << "incorrect value for data[206], expected 65, is " - << last_msg_->data[206]; - EXPECT_EQ(get_asdata[207])>( - reinterpret_cast(&last_msg_->data[207])), - 73) - << "incorrect value for data[207], expected 73, is " - << last_msg_->data[207]; - EXPECT_EQ(get_asdata[208])>( - reinterpret_cast(&last_msg_->data[208])), - 45) - << "incorrect value for data[208], expected 45, is " - << last_msg_->data[208]; - EXPECT_EQ(get_asdata[209])>( - reinterpret_cast(&last_msg_->data[209])), - 123) - << "incorrect value for data[209], expected 123, is " - << last_msg_->data[209]; - EXPECT_EQ(get_asdata[210])>( - reinterpret_cast(&last_msg_->data[210])), - 118) - << "incorrect value for data[210], expected 118, is " - << last_msg_->data[210]; - EXPECT_EQ(get_asdata[211])>( - reinterpret_cast(&last_msg_->data[211])), - 83) - << "incorrect value for data[211], expected 83, is " - << last_msg_->data[211]; - EXPECT_EQ(get_asdata[212])>( - reinterpret_cast(&last_msg_->data[212])), - 107) - << "incorrect value for data[212], expected 107, is " - << last_msg_->data[212]; - EXPECT_EQ(get_asdata[213])>( - reinterpret_cast(&last_msg_->data[213])), - 239) - << "incorrect value for data[213], expected 239, is " - << last_msg_->data[213]; - EXPECT_EQ(get_asdata[214])>( - reinterpret_cast(&last_msg_->data[214])), - 168) - << "incorrect value for data[214], expected 168, is " - << last_msg_->data[214]; - EXPECT_EQ(get_asdata[215])>( - reinterpret_cast(&last_msg_->data[215])), - 32) - << "incorrect value for data[215], expected 32, is " - << last_msg_->data[215]; - EXPECT_EQ(get_asdata[216])>( - reinterpret_cast(&last_msg_->data[216])), - 212) - << "incorrect value for data[216], expected 212, is " - << last_msg_->data[216]; - EXPECT_EQ(get_asdata[217])>( - reinterpret_cast(&last_msg_->data[217])), - 191) - << "incorrect value for data[217], expected 191, is " - << last_msg_->data[217]; - EXPECT_EQ(get_asdata[218])>( - reinterpret_cast(&last_msg_->data[218])), - 81) - << "incorrect value for data[218], expected 81, is " - << last_msg_->data[218]; - EXPECT_EQ(get_asdata[219])>( - reinterpret_cast(&last_msg_->data[219])), - 93) - << "incorrect value for data[219], expected 93, is " - << last_msg_->data[219]; - EXPECT_EQ(get_asdata[220])>( - reinterpret_cast(&last_msg_->data[220])), - 186) - << "incorrect value for data[220], expected 186, is " - << last_msg_->data[220]; - EXPECT_EQ(get_asdata[221])>( - reinterpret_cast(&last_msg_->data[221])), - 223) - << "incorrect value for data[221], expected 223, is " - << last_msg_->data[221]; - EXPECT_EQ(get_asdata[222])>( - reinterpret_cast(&last_msg_->data[222])), - 32) - << "incorrect value for data[222], expected 32, is " - << last_msg_->data[222]; - EXPECT_EQ(get_asdata[223])>( - reinterpret_cast(&last_msg_->data[223])), - 19) - << "incorrect value for data[223], expected 19, is " - << last_msg_->data[223]; - EXPECT_EQ(get_asdata[224])>( - reinterpret_cast(&last_msg_->data[224])), - 58) - << "incorrect value for data[224], expected 58, is " - << last_msg_->data[224]; - EXPECT_EQ(get_asdata[225])>( - reinterpret_cast(&last_msg_->data[225])), - 137) - << "incorrect value for data[225], expected 137, is " - << last_msg_->data[225]; - EXPECT_EQ(get_asdata[226])>( - reinterpret_cast(&last_msg_->data[226])), - 72) - << "incorrect value for data[226], expected 72, is " - << last_msg_->data[226]; - EXPECT_EQ(get_asdata[227])>( - reinterpret_cast(&last_msg_->data[227])), - 217) - << "incorrect value for data[227], expected 217, is " - << last_msg_->data[227]; - EXPECT_EQ(get_asdata[228])>( - reinterpret_cast(&last_msg_->data[228])), - 151) - << "incorrect value for data[228], expected 151, is " - << last_msg_->data[228]; - EXPECT_EQ(get_asdata[229])>( - reinterpret_cast(&last_msg_->data[229])), - 251) - << "incorrect value for data[229], expected 251, is " - << last_msg_->data[229]; - EXPECT_EQ(get_asdata[230])>( - reinterpret_cast(&last_msg_->data[230])), - 83) - << "incorrect value for data[230], expected 83, is " - << last_msg_->data[230]; - EXPECT_EQ(get_asdata[231])>( - reinterpret_cast(&last_msg_->data[231])), - 20) - << "incorrect value for data[231], expected 20, is " - << last_msg_->data[231]; - EXPECT_EQ(get_asdata[232])>( - reinterpret_cast(&last_msg_->data[232])), - 113) - << "incorrect value for data[232], expected 113, is " - << last_msg_->data[232]; - EXPECT_EQ(get_asdata[233])>( - reinterpret_cast(&last_msg_->data[233])), - 37) - << "incorrect value for data[233], expected 37, is " - << last_msg_->data[233]; - EXPECT_EQ(get_asdata[234])>( - reinterpret_cast(&last_msg_->data[234])), - 151) - << "incorrect value for data[234], expected 151, is " - << last_msg_->data[234]; - EXPECT_EQ(get_asdata[235])>( - reinterpret_cast(&last_msg_->data[235])), - 34) - << "incorrect value for data[235], expected 34, is " - << last_msg_->data[235]; - EXPECT_EQ(get_asdata[236])>( - reinterpret_cast(&last_msg_->data[236])), - 37) - << "incorrect value for data[236], expected 37, is " - << last_msg_->data[236]; - EXPECT_EQ(get_asdata[237])>( - reinterpret_cast(&last_msg_->data[237])), - 71) - << "incorrect value for data[237], expected 71, is " - << last_msg_->data[237]; - EXPECT_EQ(get_asdata[238])>( - reinterpret_cast(&last_msg_->data[238])), - 95) - << "incorrect value for data[238], expected 95, is " - << last_msg_->data[238]; - EXPECT_EQ(get_asdata[239])>( - reinterpret_cast(&last_msg_->data[239])), - 105) - << "incorrect value for data[239], expected 105, is " - << last_msg_->data[239]; - EXPECT_EQ(get_asdata[240])>( - reinterpret_cast(&last_msg_->data[240])), - 235) - << "incorrect value for data[240], expected 235, is " - << last_msg_->data[240]; - EXPECT_EQ(get_asdata[241])>( - reinterpret_cast(&last_msg_->data[241])), - 144) - << "incorrect value for data[241], expected 144, is " - << last_msg_->data[241]; - EXPECT_EQ(get_asdata[242])>( - reinterpret_cast(&last_msg_->data[242])), - 164) - << "incorrect value for data[242], expected 164, is " - << last_msg_->data[242]; - EXPECT_EQ(get_asdata[243])>( - reinterpret_cast(&last_msg_->data[243])), - 83) - << "incorrect value for data[243], expected 83, is " - << last_msg_->data[243]; - EXPECT_EQ(get_asdata[244])>( - reinterpret_cast(&last_msg_->data[244])), - 197) - << "incorrect value for data[244], expected 197, is " - << last_msg_->data[244]; - EXPECT_EQ(get_asdata[245])>( - reinterpret_cast(&last_msg_->data[245])), - 254) - << "incorrect value for data[245], expected 254, is " - << last_msg_->data[245]; - EXPECT_EQ(get_asdata[246])>( - reinterpret_cast(&last_msg_->data[246])), - 183) - << "incorrect value for data[246], expected 183, is " - << last_msg_->data[246]; - EXPECT_EQ(get_asdata[247])>( - reinterpret_cast(&last_msg_->data[247])), - 223) - << "incorrect value for data[247], expected 223, is " - << last_msg_->data[247]; - EXPECT_EQ(get_asdata[248])>( - reinterpret_cast(&last_msg_->data[248])), - 91) - << "incorrect value for data[248], expected 91, is " - << last_msg_->data[248]; - EXPECT_EQ(get_asdata[249])>( - reinterpret_cast(&last_msg_->data[249])), - 19) - << "incorrect value for data[249], expected 19, is " - << last_msg_->data[249]; - EXPECT_EQ(get_astarget)>( - reinterpret_cast(&last_msg_->target)), - 212) - << "incorrect value for target, expected 212, is " << last_msg_->target; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_flash_MsgFlashReadReq.cc b/c/test/legacy/cpp/auto_check_sbp_flash_MsgFlashReadReq.cc deleted file mode 100644 index 377a7b4d8f..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_flash_MsgFlashReadReq.cc +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgFlashReadReq.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_flash_MsgFlashReadReq0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_flash_MsgFlashReadReq0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_flash_read_req_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_flash_read_req_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_flash_MsgFlashReadReq0, Test) { - uint8_t encoded_frame[] = { - 85, 231, 0, 195, 4, 5, 241, 28, 75, 244, 71, 210, 57, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_flash_read_req_t *test_msg = (msg_flash_read_req_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->addr_len = 71; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->addr_start[0])); - } - test_msg->addr_start[0] = 28; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->addr_start[0])); - } - test_msg->addr_start[1] = 75; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->addr_start[0])); - } - test_msg->addr_start[2] = 244; - test_msg->target = 241; - - EXPECT_EQ(send_message(0xe7, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaddr_len)>( - reinterpret_cast(&last_msg_->addr_len)), - 71) - << "incorrect value for addr_len, expected 71, is " - << last_msg_->addr_len; - EXPECT_EQ(get_asaddr_start[0])>( - reinterpret_cast(&last_msg_->addr_start[0])), - 28) - << "incorrect value for addr_start[0], expected 28, is " - << last_msg_->addr_start[0]; - EXPECT_EQ(get_asaddr_start[1])>( - reinterpret_cast(&last_msg_->addr_start[1])), - 75) - << "incorrect value for addr_start[1], expected 75, is " - << last_msg_->addr_start[1]; - EXPECT_EQ(get_asaddr_start[2])>( - reinterpret_cast(&last_msg_->addr_start[2])), - 244) - << "incorrect value for addr_start[2], expected 244, is " - << last_msg_->addr_start[2]; - EXPECT_EQ(get_astarget)>( - reinterpret_cast(&last_msg_->target)), - 241) - << "incorrect value for target, expected 241, is " << last_msg_->target; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_flash_MsgFlashReadResp.cc b/c/test/legacy/cpp/auto_check_sbp_flash_MsgFlashReadResp.cc deleted file mode 100644 index 40d5b84193..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_flash_MsgFlashReadResp.cc +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgFlashReadResp.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_flash_MsgFlashReadResp0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_flash_MsgFlashReadResp0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_flash_read_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_flash_read_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_flash_MsgFlashReadResp0, Test) { - uint8_t encoded_frame[] = { - 85, 225, 0, 195, 4, 5, 136, 155, 52, 172, 124, 149, 135, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_flash_read_resp_t *test_msg = (msg_flash_read_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->addr_len = 124; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->addr_start[0])); - } - test_msg->addr_start[0] = 155; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->addr_start[0])); - } - test_msg->addr_start[1] = 52; - if (sizeof(test_msg->addr_start) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->addr_start[0])); - } - test_msg->addr_start[2] = 172; - test_msg->target = 136; - - EXPECT_EQ(send_message(0xe1, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaddr_len)>( - reinterpret_cast(&last_msg_->addr_len)), - 124) - << "incorrect value for addr_len, expected 124, is " - << last_msg_->addr_len; - EXPECT_EQ(get_asaddr_start[0])>( - reinterpret_cast(&last_msg_->addr_start[0])), - 155) - << "incorrect value for addr_start[0], expected 155, is " - << last_msg_->addr_start[0]; - EXPECT_EQ(get_asaddr_start[1])>( - reinterpret_cast(&last_msg_->addr_start[1])), - 52) - << "incorrect value for addr_start[1], expected 52, is " - << last_msg_->addr_start[1]; - EXPECT_EQ(get_asaddr_start[2])>( - reinterpret_cast(&last_msg_->addr_start[2])), - 172) - << "incorrect value for addr_start[2], expected 172, is " - << last_msg_->addr_start[2]; - EXPECT_EQ(get_astarget)>( - reinterpret_cast(&last_msg_->target)), - 136) - << "incorrect value for target, expected 136, is " << last_msg_->target; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_flash_MsgM25FlashWriteStatus.cc b/c/test/legacy/cpp/auto_check_sbp_flash_MsgM25FlashWriteStatus.cc deleted file mode 100644 index 5d2c56a8f0..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_flash_MsgM25FlashWriteStatus.cc +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgM25FlashWriteStatus.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_flash_MsgM25FlashWriteStatus0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_flash_MsgM25FlashWriteStatus0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_m25_flash_write_status_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_m25_flash_write_status_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_flash_MsgM25FlashWriteStatus0, Test) { - uint8_t encoded_frame[] = { - 85, 243, 0, 195, 4, 1, 5, 112, 200, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_m25_flash_write_status_t *test_msg = - (msg_m25_flash_write_status_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[0] = 5; - - EXPECT_EQ(send_message(0xf3, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asstatus[0])>( - reinterpret_cast(&last_msg_->status[0])), - 5) - << "incorrect value for status[0], expected 5, is " - << last_msg_->status[0]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_flash_MsgStmFlashLockSector.cc b/c/test/legacy/cpp/auto_check_sbp_flash_MsgStmFlashLockSector.cc deleted file mode 100644 index 098486f328..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_flash_MsgStmFlashLockSector.cc +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgStmFlashLockSector.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_flash_MsgStmFlashLockSector0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_flash_MsgStmFlashLockSector0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_stm_flash_lock_sector_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_stm_flash_lock_sector_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_flash_MsgStmFlashLockSector0, Test) { - uint8_t encoded_frame[] = { - 85, 227, 0, 195, 4, 4, 161, 247, 197, 67, 229, 32, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_stm_flash_lock_sector_t *test_msg = - (msg_stm_flash_lock_sector_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->sector = 1137047457; - - EXPECT_EQ(send_message(0xe3, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_assector)>( - reinterpret_cast(&last_msg_->sector)), - 1137047457) - << "incorrect value for sector, expected 1137047457, is " - << last_msg_->sector; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_flash_MsgStmFlashUnlockSector.cc b/c/test/legacy/cpp/auto_check_sbp_flash_MsgStmFlashUnlockSector.cc deleted file mode 100644 index ad8fcc2b4b..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_flash_MsgStmFlashUnlockSector.cc +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgStmFlashUnlockSector.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_flash_MsgStmFlashUnlockSector0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_flash_MsgStmFlashUnlockSector0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_stm_flash_unlock_sector_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_stm_flash_unlock_sector_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_flash_MsgStmFlashUnlockSector0, Test) { - uint8_t encoded_frame[] = { - 85, 228, 0, 195, 4, 4, 31, 16, 231, 49, 53, 217, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_stm_flash_unlock_sector_t *test_msg = - (msg_stm_flash_unlock_sector_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->sector = 837226527; - - EXPECT_EQ(send_message(0xe4, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_assector)>( - reinterpret_cast(&last_msg_->sector)), - 837226527) - << "incorrect value for sector, expected 837226527, is " - << last_msg_->sector; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_flash_MsgStmUniqueIdReq.cc b/c/test/legacy/cpp/auto_check_sbp_flash_MsgStmUniqueIdReq.cc deleted file mode 100644 index 83d92042a7..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_flash_MsgStmUniqueIdReq.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgStmUniqueIdReq.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_flash_MsgStmUniqueIdResp.cc b/c/test/legacy/cpp/auto_check_sbp_flash_MsgStmUniqueIdResp.cc deleted file mode 100644 index d6c26cb7f5..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_flash_MsgStmUniqueIdResp.cc +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/flash/test_MsgStmUniqueIdResp.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_flash_MsgStmUniqueIdResp0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_flash_MsgStmUniqueIdResp0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_stm_unique_id_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_stm_unique_id_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_flash_MsgStmUniqueIdResp0, Test) { - uint8_t encoded_frame[] = { - 85, 229, 0, 195, 4, 12, 196, 16, 15, 163, - 85, 221, 119, 102, 32, 194, 56, 144, 221, 196, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_stm_unique_id_resp_t *test_msg = - (msg_stm_unique_id_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stm_id[0])); - } - test_msg->stm_id[0] = 196; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stm_id[0])); - } - test_msg->stm_id[1] = 16; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stm_id[0])); - } - test_msg->stm_id[2] = 15; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stm_id[0])); - } - test_msg->stm_id[3] = 163; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stm_id[0])); - } - test_msg->stm_id[4] = 85; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stm_id[0])); - } - test_msg->stm_id[5] = 221; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stm_id[0])); - } - test_msg->stm_id[6] = 119; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stm_id[0])); - } - test_msg->stm_id[7] = 102; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stm_id[0])); - } - test_msg->stm_id[8] = 32; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stm_id[0])); - } - test_msg->stm_id[9] = 194; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stm_id[0])); - } - test_msg->stm_id[10] = 56; - if (sizeof(test_msg->stm_id) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stm_id[0])); - } - test_msg->stm_id[11] = 144; - - EXPECT_EQ(send_message(0xe5, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asstm_id[0])>( - reinterpret_cast(&last_msg_->stm_id[0])), - 196) - << "incorrect value for stm_id[0], expected 196, is " - << last_msg_->stm_id[0]; - EXPECT_EQ(get_asstm_id[1])>( - reinterpret_cast(&last_msg_->stm_id[1])), - 16) - << "incorrect value for stm_id[1], expected 16, is " - << last_msg_->stm_id[1]; - EXPECT_EQ(get_asstm_id[2])>( - reinterpret_cast(&last_msg_->stm_id[2])), - 15) - << "incorrect value for stm_id[2], expected 15, is " - << last_msg_->stm_id[2]; - EXPECT_EQ(get_asstm_id[3])>( - reinterpret_cast(&last_msg_->stm_id[3])), - 163) - << "incorrect value for stm_id[3], expected 163, is " - << last_msg_->stm_id[3]; - EXPECT_EQ(get_asstm_id[4])>( - reinterpret_cast(&last_msg_->stm_id[4])), - 85) - << "incorrect value for stm_id[4], expected 85, is " - << last_msg_->stm_id[4]; - EXPECT_EQ(get_asstm_id[5])>( - reinterpret_cast(&last_msg_->stm_id[5])), - 221) - << "incorrect value for stm_id[5], expected 221, is " - << last_msg_->stm_id[5]; - EXPECT_EQ(get_asstm_id[6])>( - reinterpret_cast(&last_msg_->stm_id[6])), - 119) - << "incorrect value for stm_id[6], expected 119, is " - << last_msg_->stm_id[6]; - EXPECT_EQ(get_asstm_id[7])>( - reinterpret_cast(&last_msg_->stm_id[7])), - 102) - << "incorrect value for stm_id[7], expected 102, is " - << last_msg_->stm_id[7]; - EXPECT_EQ(get_asstm_id[8])>( - reinterpret_cast(&last_msg_->stm_id[8])), - 32) - << "incorrect value for stm_id[8], expected 32, is " - << last_msg_->stm_id[8]; - EXPECT_EQ(get_asstm_id[9])>( - reinterpret_cast(&last_msg_->stm_id[9])), - 194) - << "incorrect value for stm_id[9], expected 194, is " - << last_msg_->stm_id[9]; - EXPECT_EQ(get_asstm_id[10])>( - reinterpret_cast(&last_msg_->stm_id[10])), - 56) - << "incorrect value for stm_id[10], expected 56, is " - << last_msg_->stm_id[10]; - EXPECT_EQ(get_asstm_id[11])>( - reinterpret_cast(&last_msg_->stm_id[11])), - 144) - << "incorrect value for stm_id[11], expected 144, is " - << last_msg_->stm_id[11]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_imu_MsgImuAux.cc b/c/test/legacy/cpp/auto_check_sbp_imu_MsgImuAux.cc deleted file mode 100644 index 9258374978..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_imu_MsgImuAux.cc +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/imu/test_MsgImuAux.yaml by generate.py. Do not -// modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_imu_MsgImuAux0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_imu_MsgImuAux0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_imu_aux_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_imu_aux_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_imu_MsgImuAux0, Test) { - uint8_t encoded_frame[] = { - 85, 1, 9, 52, 18, 4, 1, 244, 10, 66, 200, 252, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_imu_aux_t *test_msg = (msg_imu_aux_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->imu_conf = 66; - test_msg->imu_type = 1; - test_msg->temp = 2804; - - EXPECT_EQ(send_message(0x901, 4660, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 4660); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asimu_conf)>( - reinterpret_cast(&last_msg_->imu_conf)), - 66) - << "incorrect value for imu_conf, expected 66, is " - << last_msg_->imu_conf; - EXPECT_EQ(get_asimu_type)>( - reinterpret_cast(&last_msg_->imu_type)), - 1) - << "incorrect value for imu_type, expected 1, is " << last_msg_->imu_type; - EXPECT_EQ(get_astemp)>( - reinterpret_cast(&last_msg_->temp)), - 2804) - << "incorrect value for temp, expected 2804, is " << last_msg_->temp; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_imu_MsgImuRaw.cc b/c/test/legacy/cpp/auto_check_sbp_imu_MsgImuRaw.cc deleted file mode 100644 index ba457e97d3..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_imu_MsgImuRaw.cc +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/imu/test_MsgImuRaw.yaml by generate.py. Do not -// modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_imu_MsgImuRaw0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_imu_MsgImuRaw0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_imu_raw_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_imu_raw_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_imu_MsgImuRaw0, Test) { - uint8_t encoded_frame[] = { - 85, 0, 9, 52, 18, 17, 26, 1, 0, 192, 206, 96, 0, - 223, 255, 44, 16, 60, 0, 208, 254, 238, 255, 70, 135, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_imu_raw_t *test_msg = (msg_imu_raw_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->acc_x = 96; - test_msg->acc_y = -33; - test_msg->acc_z = 4140; - test_msg->gyr_x = 60; - test_msg->gyr_y = -304; - test_msg->gyr_z = -18; - test_msg->tow = 3221225754; - test_msg->tow_f = 206; - - EXPECT_EQ(send_message(0x900, 4660, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 4660); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asacc_x)>( - reinterpret_cast(&last_msg_->acc_x)), - 96) - << "incorrect value for acc_x, expected 96, is " << last_msg_->acc_x; - EXPECT_EQ(get_asacc_y)>( - reinterpret_cast(&last_msg_->acc_y)), - -33) - << "incorrect value for acc_y, expected -33, is " << last_msg_->acc_y; - EXPECT_EQ(get_asacc_z)>( - reinterpret_cast(&last_msg_->acc_z)), - 4140) - << "incorrect value for acc_z, expected 4140, is " << last_msg_->acc_z; - EXPECT_EQ(get_asgyr_x)>( - reinterpret_cast(&last_msg_->gyr_x)), - 60) - << "incorrect value for gyr_x, expected 60, is " << last_msg_->gyr_x; - EXPECT_EQ(get_asgyr_y)>( - reinterpret_cast(&last_msg_->gyr_y)), - -304) - << "incorrect value for gyr_y, expected -304, is " << last_msg_->gyr_y; - EXPECT_EQ(get_asgyr_z)>( - reinterpret_cast(&last_msg_->gyr_z)), - -18) - << "incorrect value for gyr_z, expected -18, is " << last_msg_->gyr_z; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 3221225754) - << "incorrect value for tow, expected 3221225754, is " << last_msg_->tow; - EXPECT_EQ(get_astow_f)>( - reinterpret_cast(&last_msg_->tow_f)), - 206) - << "incorrect value for tow_f, expected 206, is " << last_msg_->tow_f; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_integrity_MsgAcknowledge.cc b/c/test/legacy/cpp/auto_check_sbp_integrity_MsgAcknowledge.cc deleted file mode 100644 index eb916c77e6..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_integrity_MsgAcknowledge.cc +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/integrity/test_MsgAcknowledge.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_integrity_MsgAcknowledge0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_integrity_MsgAcknowledge0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_acknowledge_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_acknowledge_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_integrity_MsgAcknowledge0, Test) { - uint8_t encoded_frame[] = { - 85, 210, 11, 42, 0, 11, 30, 64, 226, 1, 0, 0, 1, 0, 1, 0, 2, 86, 178, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_acknowledge_t *test_msg = (msg_acknowledge_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->area_id = 123456; - test_msg->correction_mask_on_demand = 1; - test_msg->correction_mask_stream = 1; - test_msg->request_id = 30; - test_msg->response_code = 0; - test_msg->solution_id = 2; - - EXPECT_EQ(send_message(0xBD2, 42, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 42); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asarea_id)>( - reinterpret_cast(&last_msg_->area_id)), - 123456) - << "incorrect value for area_id, expected 123456, is " - << last_msg_->area_id; - EXPECT_EQ(get_ascorrection_mask_on_demand)>( - reinterpret_cast( - &last_msg_->correction_mask_on_demand)), - 1) - << "incorrect value for correction_mask_on_demand, expected 1, is " - << last_msg_->correction_mask_on_demand; - EXPECT_EQ(get_ascorrection_mask_stream)>( - reinterpret_cast( - &last_msg_->correction_mask_stream)), - 1) - << "incorrect value for correction_mask_stream, expected 1, is " - << last_msg_->correction_mask_stream; - EXPECT_EQ(get_asrequest_id)>( - reinterpret_cast(&last_msg_->request_id)), - 30) - << "incorrect value for request_id, expected 30, is " - << last_msg_->request_id; - EXPECT_EQ(get_asresponse_code)>( - reinterpret_cast(&last_msg_->response_code)), - 0) - << "incorrect value for response_code, expected 0, is " - << last_msg_->response_code; - EXPECT_EQ(get_assolution_id)>( - reinterpret_cast(&last_msg_->solution_id)), - 2) - << "incorrect value for solution_id, expected 2, is " - << last_msg_->solution_id; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagHighLevel.cc b/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagHighLevel.cc deleted file mode 100644 index 7573f589ab..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagHighLevel.cc +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/integrity/test_MsgSsrFlagHighLevel.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_integrity_MsgSsrFlagHighLevel0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_integrity_MsgSsrFlagHighLevel0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_flag_high_level_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_flag_high_level_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_integrity_MsgSsrFlagHighLevel0, Test) { - uint8_t encoded_frame[] = { - 85, 185, 11, 66, 0, 31, 180, 0, 0, 0, 3, 0, 104, 1, 0, 0, 6, 0, 10, 20, - 0, 30, 0, 40, 1, 2, 3, 0, 0, 0, 0, 0, 0, 4, 5, 6, 7, 102, 67, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_flag_high_level_t *test_msg = - (msg_ssr_flag_high_level_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->chain_id = 40; - test_msg->corr_time.tow = 360; - test_msg->corr_time.wn = 6; - test_msg->obs_time.tow = 180; - test_msg->obs_time.wn = 3; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[0] = 0; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[1] = 0; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[2] = 0; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[3] = 0; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[4] = 0; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[5] = 0; - test_msg->ssr_sol_id = 10; - test_msg->tile_id = 30; - test_msg->tile_set_id = 20; - test_msg->use_bds_sat = 3; - test_msg->use_gal_sat = 2; - test_msg->use_gps_sat = 1; - test_msg->use_iono_grid_point_sat_los = 7; - test_msg->use_iono_grid_points = 5; - test_msg->use_iono_tile_sat_los = 6; - test_msg->use_tropo_grid_points = 4; - - EXPECT_EQ(send_message(3001, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_aschain_id)>( - reinterpret_cast(&last_msg_->chain_id)), - 40) - << "incorrect value for chain_id, expected 40, is " - << last_msg_->chain_id; - EXPECT_EQ(get_ascorr_time.tow)>( - reinterpret_cast(&last_msg_->corr_time.tow)), - 360) - << "incorrect value for corr_time.tow, expected 360, is " - << last_msg_->corr_time.tow; - EXPECT_EQ(get_ascorr_time.wn)>( - reinterpret_cast(&last_msg_->corr_time.wn)), - 6) - << "incorrect value for corr_time.wn, expected 6, is " - << last_msg_->corr_time.wn; - EXPECT_EQ(get_asobs_time.tow)>( - reinterpret_cast(&last_msg_->obs_time.tow)), - 180) - << "incorrect value for obs_time.tow, expected 180, is " - << last_msg_->obs_time.tow; - EXPECT_EQ(get_asobs_time.wn)>( - reinterpret_cast(&last_msg_->obs_time.wn)), - 3) - << "incorrect value for obs_time.wn, expected 3, is " - << last_msg_->obs_time.wn; - EXPECT_EQ(get_asreserved[0])>( - reinterpret_cast(&last_msg_->reserved[0])), - 0) - << "incorrect value for reserved[0], expected 0, is " - << last_msg_->reserved[0]; - EXPECT_EQ(get_asreserved[1])>( - reinterpret_cast(&last_msg_->reserved[1])), - 0) - << "incorrect value for reserved[1], expected 0, is " - << last_msg_->reserved[1]; - EXPECT_EQ(get_asreserved[2])>( - reinterpret_cast(&last_msg_->reserved[2])), - 0) - << "incorrect value for reserved[2], expected 0, is " - << last_msg_->reserved[2]; - EXPECT_EQ(get_asreserved[3])>( - reinterpret_cast(&last_msg_->reserved[3])), - 0) - << "incorrect value for reserved[3], expected 0, is " - << last_msg_->reserved[3]; - EXPECT_EQ(get_asreserved[4])>( - reinterpret_cast(&last_msg_->reserved[4])), - 0) - << "incorrect value for reserved[4], expected 0, is " - << last_msg_->reserved[4]; - EXPECT_EQ(get_asreserved[5])>( - reinterpret_cast(&last_msg_->reserved[5])), - 0) - << "incorrect value for reserved[5], expected 0, is " - << last_msg_->reserved[5]; - EXPECT_EQ(get_asssr_sol_id)>( - reinterpret_cast(&last_msg_->ssr_sol_id)), - 10) - << "incorrect value for ssr_sol_id, expected 10, is " - << last_msg_->ssr_sol_id; - EXPECT_EQ(get_astile_id)>( - reinterpret_cast(&last_msg_->tile_id)), - 30) - << "incorrect value for tile_id, expected 30, is " << last_msg_->tile_id; - EXPECT_EQ(get_astile_set_id)>( - reinterpret_cast(&last_msg_->tile_set_id)), - 20) - << "incorrect value for tile_set_id, expected 20, is " - << last_msg_->tile_set_id; - EXPECT_EQ(get_asuse_bds_sat)>( - reinterpret_cast(&last_msg_->use_bds_sat)), - 3) - << "incorrect value for use_bds_sat, expected 3, is " - << last_msg_->use_bds_sat; - EXPECT_EQ(get_asuse_gal_sat)>( - reinterpret_cast(&last_msg_->use_gal_sat)), - 2) - << "incorrect value for use_gal_sat, expected 2, is " - << last_msg_->use_gal_sat; - EXPECT_EQ(get_asuse_gps_sat)>( - reinterpret_cast(&last_msg_->use_gps_sat)), - 1) - << "incorrect value for use_gps_sat, expected 1, is " - << last_msg_->use_gps_sat; - EXPECT_EQ(get_asuse_iono_grid_point_sat_los)>( - reinterpret_cast( - &last_msg_->use_iono_grid_point_sat_los)), - 7) - << "incorrect value for use_iono_grid_point_sat_los, expected 7, is " - << last_msg_->use_iono_grid_point_sat_los; - EXPECT_EQ( - get_asuse_iono_grid_points)>( - reinterpret_cast(&last_msg_->use_iono_grid_points)), - 5) - << "incorrect value for use_iono_grid_points, expected 5, is " - << last_msg_->use_iono_grid_points; - EXPECT_EQ( - get_asuse_iono_tile_sat_los)>( - reinterpret_cast(&last_msg_->use_iono_tile_sat_los)), - 6) - << "incorrect value for use_iono_tile_sat_los, expected 6, is " - << last_msg_->use_iono_tile_sat_los; - EXPECT_EQ( - get_asuse_tropo_grid_points)>( - reinterpret_cast(&last_msg_->use_tropo_grid_points)), - 4) - << "incorrect value for use_tropo_grid_points, expected 4, is " - << last_msg_->use_tropo_grid_points; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagIonoGridPointSatLos.cc b/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagIonoGridPointSatLos.cc deleted file mode 100644 index 7ff4ca7d26..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagIonoGridPointSatLos.cc +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/integrity/test_MsgSsrFlagIonoGridPointSatLos.yaml -// by generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPointSatLos0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPointSatLos0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg( - uint16_t sender_id, uint8_t message_length, - const msg_ssr_flag_iono_grid_point_sat_los_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_flag_iono_grid_point_sat_los_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPointSatLos0, - Test) { - uint8_t encoded_frame[] = { - 85, 209, 11, 66, 0, 21, 180, 0, 0, 0, 3, 0, 1, 2, 3, - 4, 0, 5, 0, 6, 30, 0, 2, 10, 11, 15, 14, 98, 148, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_flag_iono_grid_point_sat_los_t *test_msg = - (msg_ssr_flag_iono_grid_point_sat_los_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->faulty_los) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->faulty_los[0])); - } - test_msg->faulty_los[0].constellation = 11; - test_msg->faulty_los[0].satId = 10; - if (sizeof(test_msg->faulty_los) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->faulty_los[0])); - } - test_msg->faulty_los[1].constellation = 14; - test_msg->faulty_los[1].satId = 15; - test_msg->grid_point_id = 30; - test_msg->header.chain_id = 6; - test_msg->header.num_msgs = 1; - test_msg->header.obs_time.tow = 180; - test_msg->header.obs_time.wn = 3; - test_msg->header.seq_num = 2; - test_msg->header.ssr_sol_id = 3; - test_msg->header.tile_id = 5; - test_msg->header.tile_set_id = 4; - test_msg->n_faulty_los = 2; - - EXPECT_EQ(send_message(3025, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asfaulty_los[0].constellation)>( - reinterpret_cast( - &last_msg_->faulty_los[0].constellation)), - 11) - << "incorrect value for faulty_los[0].constellation, expected 11, is " - << last_msg_->faulty_los[0].constellation; - EXPECT_EQ( - get_asfaulty_los[0].satId)>( - reinterpret_cast(&last_msg_->faulty_los[0].satId)), - 10) - << "incorrect value for faulty_los[0].satId, expected 10, is " - << last_msg_->faulty_los[0].satId; - EXPECT_EQ(get_asfaulty_los[1].constellation)>( - reinterpret_cast( - &last_msg_->faulty_los[1].constellation)), - 14) - << "incorrect value for faulty_los[1].constellation, expected 14, is " - << last_msg_->faulty_los[1].constellation; - EXPECT_EQ( - get_asfaulty_los[1].satId)>( - reinterpret_cast(&last_msg_->faulty_los[1].satId)), - 15) - << "incorrect value for faulty_los[1].satId, expected 15, is " - << last_msg_->faulty_los[1].satId; - EXPECT_EQ(get_asgrid_point_id)>( - reinterpret_cast(&last_msg_->grid_point_id)), - 30) - << "incorrect value for grid_point_id, expected 30, is " - << last_msg_->grid_point_id; - EXPECT_EQ(get_asheader.chain_id)>( - reinterpret_cast(&last_msg_->header.chain_id)), - 6) - << "incorrect value for header.chain_id, expected 6, is " - << last_msg_->header.chain_id; - EXPECT_EQ(get_asheader.num_msgs)>( - reinterpret_cast(&last_msg_->header.num_msgs)), - 1) - << "incorrect value for header.num_msgs, expected 1, is " - << last_msg_->header.num_msgs; - EXPECT_EQ( - get_asheader.obs_time.tow)>( - reinterpret_cast(&last_msg_->header.obs_time.tow)), - 180) - << "incorrect value for header.obs_time.tow, expected 180, is " - << last_msg_->header.obs_time.tow; - EXPECT_EQ( - get_asheader.obs_time.wn)>( - reinterpret_cast(&last_msg_->header.obs_time.wn)), - 3) - << "incorrect value for header.obs_time.wn, expected 3, is " - << last_msg_->header.obs_time.wn; - EXPECT_EQ(get_asheader.seq_num)>( - reinterpret_cast(&last_msg_->header.seq_num)), - 2) - << "incorrect value for header.seq_num, expected 2, is " - << last_msg_->header.seq_num; - EXPECT_EQ( - get_asheader.ssr_sol_id)>( - reinterpret_cast(&last_msg_->header.ssr_sol_id)), - 3) - << "incorrect value for header.ssr_sol_id, expected 3, is " - << last_msg_->header.ssr_sol_id; - EXPECT_EQ(get_asheader.tile_id)>( - reinterpret_cast(&last_msg_->header.tile_id)), - 5) - << "incorrect value for header.tile_id, expected 5, is " - << last_msg_->header.tile_id; - EXPECT_EQ( - get_asheader.tile_set_id)>( - reinterpret_cast(&last_msg_->header.tile_set_id)), - 4) - << "incorrect value for header.tile_set_id, expected 4, is " - << last_msg_->header.tile_set_id; - EXPECT_EQ(get_asn_faulty_los)>( - reinterpret_cast(&last_msg_->n_faulty_los)), - 2) - << "incorrect value for n_faulty_los, expected 2, is " - << last_msg_->n_faulty_los; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagIonoGridPoints.cc b/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagIonoGridPoints.cc deleted file mode 100644 index 5f6391f698..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagIonoGridPoints.cc +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/integrity/test_MsgSsrFlagIonoGridPoints.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPoints0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPoints0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_flag_iono_grid_points_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_flag_iono_grid_points_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_integrity_MsgSsrFlagIonoGridPoints0, Test) { - uint8_t encoded_frame[] = { - 85, 199, 11, 66, 0, 21, 180, 0, 0, 0, 3, 0, 1, 2, 3, - 4, 0, 5, 0, 6, 3, 10, 0, 11, 0, 12, 0, 53, 7, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_flag_iono_grid_points_t *test_msg = - (msg_ssr_flag_iono_grid_points_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->faulty_points) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->faulty_points[0])); - } - test_msg->faulty_points[0] = 10; - if (sizeof(test_msg->faulty_points) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->faulty_points[0])); - } - test_msg->faulty_points[1] = 11; - if (sizeof(test_msg->faulty_points) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->faulty_points[0])); - } - test_msg->faulty_points[2] = 12; - test_msg->header.chain_id = 6; - test_msg->header.num_msgs = 1; - test_msg->header.obs_time.tow = 180; - test_msg->header.obs_time.wn = 3; - test_msg->header.seq_num = 2; - test_msg->header.ssr_sol_id = 3; - test_msg->header.tile_id = 5; - test_msg->header.tile_set_id = 4; - test_msg->n_faulty_points = 3; - - EXPECT_EQ(send_message(3015, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ( - get_asfaulty_points[0])>( - reinterpret_cast(&last_msg_->faulty_points[0])), - 10) - << "incorrect value for faulty_points[0], expected 10, is " - << last_msg_->faulty_points[0]; - EXPECT_EQ( - get_asfaulty_points[1])>( - reinterpret_cast(&last_msg_->faulty_points[1])), - 11) - << "incorrect value for faulty_points[1], expected 11, is " - << last_msg_->faulty_points[1]; - EXPECT_EQ( - get_asfaulty_points[2])>( - reinterpret_cast(&last_msg_->faulty_points[2])), - 12) - << "incorrect value for faulty_points[2], expected 12, is " - << last_msg_->faulty_points[2]; - EXPECT_EQ(get_asheader.chain_id)>( - reinterpret_cast(&last_msg_->header.chain_id)), - 6) - << "incorrect value for header.chain_id, expected 6, is " - << last_msg_->header.chain_id; - EXPECT_EQ(get_asheader.num_msgs)>( - reinterpret_cast(&last_msg_->header.num_msgs)), - 1) - << "incorrect value for header.num_msgs, expected 1, is " - << last_msg_->header.num_msgs; - EXPECT_EQ( - get_asheader.obs_time.tow)>( - reinterpret_cast(&last_msg_->header.obs_time.tow)), - 180) - << "incorrect value for header.obs_time.tow, expected 180, is " - << last_msg_->header.obs_time.tow; - EXPECT_EQ( - get_asheader.obs_time.wn)>( - reinterpret_cast(&last_msg_->header.obs_time.wn)), - 3) - << "incorrect value for header.obs_time.wn, expected 3, is " - << last_msg_->header.obs_time.wn; - EXPECT_EQ(get_asheader.seq_num)>( - reinterpret_cast(&last_msg_->header.seq_num)), - 2) - << "incorrect value for header.seq_num, expected 2, is " - << last_msg_->header.seq_num; - EXPECT_EQ( - get_asheader.ssr_sol_id)>( - reinterpret_cast(&last_msg_->header.ssr_sol_id)), - 3) - << "incorrect value for header.ssr_sol_id, expected 3, is " - << last_msg_->header.ssr_sol_id; - EXPECT_EQ(get_asheader.tile_id)>( - reinterpret_cast(&last_msg_->header.tile_id)), - 5) - << "incorrect value for header.tile_id, expected 5, is " - << last_msg_->header.tile_id; - EXPECT_EQ( - get_asheader.tile_set_id)>( - reinterpret_cast(&last_msg_->header.tile_set_id)), - 4) - << "incorrect value for header.tile_set_id, expected 4, is " - << last_msg_->header.tile_set_id; - EXPECT_EQ(get_asn_faulty_points)>( - reinterpret_cast(&last_msg_->n_faulty_points)), - 3) - << "incorrect value for n_faulty_points, expected 3, is " - << last_msg_->n_faulty_points; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagIonoTileSatLos.cc b/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagIonoTileSatLos.cc deleted file mode 100644 index 8138ce19c0..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagIonoTileSatLos.cc +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/integrity/test_MsgSsrFlagIonoTileSatLos.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_integrity_MsgSsrFlagIonoTileSatLos0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_integrity_MsgSsrFlagIonoTileSatLos0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_flag_iono_tile_sat_los_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_flag_iono_tile_sat_los_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_integrity_MsgSsrFlagIonoTileSatLos0, Test) { - uint8_t encoded_frame[] = { - 85, 205, 11, 66, 0, 19, 180, 0, 0, 0, 3, 0, 1, 2, - 3, 4, 0, 5, 0, 6, 2, 10, 11, 15, 14, 239, 235, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_flag_iono_tile_sat_los_t *test_msg = - (msg_ssr_flag_iono_tile_sat_los_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->faulty_los) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->faulty_los[0])); - } - test_msg->faulty_los[0].constellation = 11; - test_msg->faulty_los[0].satId = 10; - if (sizeof(test_msg->faulty_los) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->faulty_los[0])); - } - test_msg->faulty_los[1].constellation = 14; - test_msg->faulty_los[1].satId = 15; - test_msg->header.chain_id = 6; - test_msg->header.num_msgs = 1; - test_msg->header.obs_time.tow = 180; - test_msg->header.obs_time.wn = 3; - test_msg->header.seq_num = 2; - test_msg->header.ssr_sol_id = 3; - test_msg->header.tile_id = 5; - test_msg->header.tile_set_id = 4; - test_msg->n_faulty_los = 2; - - EXPECT_EQ(send_message(3021, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asfaulty_los[0].constellation)>( - reinterpret_cast( - &last_msg_->faulty_los[0].constellation)), - 11) - << "incorrect value for faulty_los[0].constellation, expected 11, is " - << last_msg_->faulty_los[0].constellation; - EXPECT_EQ( - get_asfaulty_los[0].satId)>( - reinterpret_cast(&last_msg_->faulty_los[0].satId)), - 10) - << "incorrect value for faulty_los[0].satId, expected 10, is " - << last_msg_->faulty_los[0].satId; - EXPECT_EQ(get_asfaulty_los[1].constellation)>( - reinterpret_cast( - &last_msg_->faulty_los[1].constellation)), - 14) - << "incorrect value for faulty_los[1].constellation, expected 14, is " - << last_msg_->faulty_los[1].constellation; - EXPECT_EQ( - get_asfaulty_los[1].satId)>( - reinterpret_cast(&last_msg_->faulty_los[1].satId)), - 15) - << "incorrect value for faulty_los[1].satId, expected 15, is " - << last_msg_->faulty_los[1].satId; - EXPECT_EQ(get_asheader.chain_id)>( - reinterpret_cast(&last_msg_->header.chain_id)), - 6) - << "incorrect value for header.chain_id, expected 6, is " - << last_msg_->header.chain_id; - EXPECT_EQ(get_asheader.num_msgs)>( - reinterpret_cast(&last_msg_->header.num_msgs)), - 1) - << "incorrect value for header.num_msgs, expected 1, is " - << last_msg_->header.num_msgs; - EXPECT_EQ( - get_asheader.obs_time.tow)>( - reinterpret_cast(&last_msg_->header.obs_time.tow)), - 180) - << "incorrect value for header.obs_time.tow, expected 180, is " - << last_msg_->header.obs_time.tow; - EXPECT_EQ( - get_asheader.obs_time.wn)>( - reinterpret_cast(&last_msg_->header.obs_time.wn)), - 3) - << "incorrect value for header.obs_time.wn, expected 3, is " - << last_msg_->header.obs_time.wn; - EXPECT_EQ(get_asheader.seq_num)>( - reinterpret_cast(&last_msg_->header.seq_num)), - 2) - << "incorrect value for header.seq_num, expected 2, is " - << last_msg_->header.seq_num; - EXPECT_EQ( - get_asheader.ssr_sol_id)>( - reinterpret_cast(&last_msg_->header.ssr_sol_id)), - 3) - << "incorrect value for header.ssr_sol_id, expected 3, is " - << last_msg_->header.ssr_sol_id; - EXPECT_EQ(get_asheader.tile_id)>( - reinterpret_cast(&last_msg_->header.tile_id)), - 5) - << "incorrect value for header.tile_id, expected 5, is " - << last_msg_->header.tile_id; - EXPECT_EQ( - get_asheader.tile_set_id)>( - reinterpret_cast(&last_msg_->header.tile_set_id)), - 4) - << "incorrect value for header.tile_set_id, expected 4, is " - << last_msg_->header.tile_set_id; - EXPECT_EQ(get_asn_faulty_los)>( - reinterpret_cast(&last_msg_->n_faulty_los)), - 2) - << "incorrect value for n_faulty_los, expected 2, is " - << last_msg_->n_faulty_los; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagSatellites.cc b/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagSatellites.cc deleted file mode 100644 index 1b58236739..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagSatellites.cc +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/integrity/test_MsgSsrFlagSatellites.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_integrity_MsgSsrFlagSatellites0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_integrity_MsgSsrFlagSatellites0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_flag_satellites_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_flag_satellites_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_integrity_MsgSsrFlagSatellites0, Test) { - uint8_t encoded_frame[] = { - 85, 189, 11, 66, 0, 15, 180, 0, 0, 0, 3, 0, - 1, 2, 3, 4, 5, 3, 10, 11, 12, 110, 165, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_flag_satellites_t *test_msg = - (msg_ssr_flag_satellites_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->chain_id = 4; - test_msg->const_id = 5; - if (sizeof(test_msg->faulty_sats) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->faulty_sats[0])); - } - test_msg->faulty_sats[0] = 10; - if (sizeof(test_msg->faulty_sats) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->faulty_sats[0])); - } - test_msg->faulty_sats[1] = 11; - if (sizeof(test_msg->faulty_sats) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->faulty_sats[0])); - } - test_msg->faulty_sats[2] = 12; - test_msg->n_faulty_sats = 3; - test_msg->num_msgs = 1; - test_msg->obs_time.tow = 180; - test_msg->obs_time.wn = 3; - test_msg->seq_num = 2; - test_msg->ssr_sol_id = 3; - - EXPECT_EQ(send_message(3005, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_aschain_id)>( - reinterpret_cast(&last_msg_->chain_id)), - 4) - << "incorrect value for chain_id, expected 4, is " << last_msg_->chain_id; - EXPECT_EQ(get_asconst_id)>( - reinterpret_cast(&last_msg_->const_id)), - 5) - << "incorrect value for const_id, expected 5, is " << last_msg_->const_id; - EXPECT_EQ(get_asfaulty_sats[0])>( - reinterpret_cast(&last_msg_->faulty_sats[0])), - 10) - << "incorrect value for faulty_sats[0], expected 10, is " - << last_msg_->faulty_sats[0]; - EXPECT_EQ(get_asfaulty_sats[1])>( - reinterpret_cast(&last_msg_->faulty_sats[1])), - 11) - << "incorrect value for faulty_sats[1], expected 11, is " - << last_msg_->faulty_sats[1]; - EXPECT_EQ(get_asfaulty_sats[2])>( - reinterpret_cast(&last_msg_->faulty_sats[2])), - 12) - << "incorrect value for faulty_sats[2], expected 12, is " - << last_msg_->faulty_sats[2]; - EXPECT_EQ(get_asn_faulty_sats)>( - reinterpret_cast(&last_msg_->n_faulty_sats)), - 3) - << "incorrect value for n_faulty_sats, expected 3, is " - << last_msg_->n_faulty_sats; - EXPECT_EQ(get_asnum_msgs)>( - reinterpret_cast(&last_msg_->num_msgs)), - 1) - << "incorrect value for num_msgs, expected 1, is " << last_msg_->num_msgs; - EXPECT_EQ(get_asobs_time.tow)>( - reinterpret_cast(&last_msg_->obs_time.tow)), - 180) - << "incorrect value for obs_time.tow, expected 180, is " - << last_msg_->obs_time.tow; - EXPECT_EQ(get_asobs_time.wn)>( - reinterpret_cast(&last_msg_->obs_time.wn)), - 3) - << "incorrect value for obs_time.wn, expected 3, is " - << last_msg_->obs_time.wn; - EXPECT_EQ(get_asseq_num)>( - reinterpret_cast(&last_msg_->seq_num)), - 2) - << "incorrect value for seq_num, expected 2, is " << last_msg_->seq_num; - EXPECT_EQ(get_asssr_sol_id)>( - reinterpret_cast(&last_msg_->ssr_sol_id)), - 3) - << "incorrect value for ssr_sol_id, expected 3, is " - << last_msg_->ssr_sol_id; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagTropoGridPoints.cc b/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagTropoGridPoints.cc deleted file mode 100644 index 42288cf609..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_integrity_MsgSsrFlagTropoGridPoints.cc +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/integrity/test_MsgSsrFlagTropoGridPoints.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_integrity_MsgSsrFlagTropoGridPoints0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_integrity_MsgSsrFlagTropoGridPoints0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_flag_tropo_grid_points_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_flag_tropo_grid_points_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_integrity_MsgSsrFlagTropoGridPoints0, Test) { - uint8_t encoded_frame[] = { - 85, 195, 11, 66, 0, 21, 180, 0, 0, 0, 3, 0, 1, 2, 3, - 4, 0, 5, 0, 6, 3, 10, 0, 11, 0, 12, 0, 243, 150, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_flag_tropo_grid_points_t *test_msg = - (msg_ssr_flag_tropo_grid_points_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->faulty_points) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->faulty_points[0])); - } - test_msg->faulty_points[0] = 10; - if (sizeof(test_msg->faulty_points) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->faulty_points[0])); - } - test_msg->faulty_points[1] = 11; - if (sizeof(test_msg->faulty_points) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->faulty_points[0])); - } - test_msg->faulty_points[2] = 12; - test_msg->header.chain_id = 6; - test_msg->header.num_msgs = 1; - test_msg->header.obs_time.tow = 180; - test_msg->header.obs_time.wn = 3; - test_msg->header.seq_num = 2; - test_msg->header.ssr_sol_id = 3; - test_msg->header.tile_id = 5; - test_msg->header.tile_set_id = 4; - test_msg->n_faulty_points = 3; - - EXPECT_EQ(send_message(3011, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ( - get_asfaulty_points[0])>( - reinterpret_cast(&last_msg_->faulty_points[0])), - 10) - << "incorrect value for faulty_points[0], expected 10, is " - << last_msg_->faulty_points[0]; - EXPECT_EQ( - get_asfaulty_points[1])>( - reinterpret_cast(&last_msg_->faulty_points[1])), - 11) - << "incorrect value for faulty_points[1], expected 11, is " - << last_msg_->faulty_points[1]; - EXPECT_EQ( - get_asfaulty_points[2])>( - reinterpret_cast(&last_msg_->faulty_points[2])), - 12) - << "incorrect value for faulty_points[2], expected 12, is " - << last_msg_->faulty_points[2]; - EXPECT_EQ(get_asheader.chain_id)>( - reinterpret_cast(&last_msg_->header.chain_id)), - 6) - << "incorrect value for header.chain_id, expected 6, is " - << last_msg_->header.chain_id; - EXPECT_EQ(get_asheader.num_msgs)>( - reinterpret_cast(&last_msg_->header.num_msgs)), - 1) - << "incorrect value for header.num_msgs, expected 1, is " - << last_msg_->header.num_msgs; - EXPECT_EQ( - get_asheader.obs_time.tow)>( - reinterpret_cast(&last_msg_->header.obs_time.tow)), - 180) - << "incorrect value for header.obs_time.tow, expected 180, is " - << last_msg_->header.obs_time.tow; - EXPECT_EQ( - get_asheader.obs_time.wn)>( - reinterpret_cast(&last_msg_->header.obs_time.wn)), - 3) - << "incorrect value for header.obs_time.wn, expected 3, is " - << last_msg_->header.obs_time.wn; - EXPECT_EQ(get_asheader.seq_num)>( - reinterpret_cast(&last_msg_->header.seq_num)), - 2) - << "incorrect value for header.seq_num, expected 2, is " - << last_msg_->header.seq_num; - EXPECT_EQ( - get_asheader.ssr_sol_id)>( - reinterpret_cast(&last_msg_->header.ssr_sol_id)), - 3) - << "incorrect value for header.ssr_sol_id, expected 3, is " - << last_msg_->header.ssr_sol_id; - EXPECT_EQ(get_asheader.tile_id)>( - reinterpret_cast(&last_msg_->header.tile_id)), - 5) - << "incorrect value for header.tile_id, expected 5, is " - << last_msg_->header.tile_id; - EXPECT_EQ( - get_asheader.tile_set_id)>( - reinterpret_cast(&last_msg_->header.tile_set_id)), - 4) - << "incorrect value for header.tile_set_id, expected 4, is " - << last_msg_->header.tile_set_id; - EXPECT_EQ(get_asn_faulty_points)>( - reinterpret_cast(&last_msg_->n_faulty_points)), - 3) - << "incorrect value for n_faulty_points, expected 3, is " - << last_msg_->n_faulty_points; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxCpuState.cc b/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxCpuState.cc deleted file mode 100644 index d92c627668..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxCpuState.cc +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxCpuState.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_linux_MsgLinuxCpuState0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_linux_MsgLinuxCpuState0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_linux_cpu_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_linux_cpu_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_linux_MsgLinuxCpuState0, Test) { - uint8_t encoded_frame[] = { - 85, 8, 127, 148, 133, 70, 101, 122, 195, 98, 215, 35, 94, - 235, 20, 112, 114, 111, 99, 101, 115, 115, 45, 110, 97, 109, - 101, 0, 0, 0, 47, 112, 97, 116, 104, 47, 116, 111, 47, - 112, 114, 111, 99, 101, 115, 115, 45, 110, 97, 109, 101, 32, - 97, 114, 103, 48, 32, 97, 114, 103, 49, 32, 97, 114, 103, - 50, 32, 97, 114, 103, 51, 32, 97, 114, 103, 52, 68, 229, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_linux_cpu_state_t *test_msg = (msg_linux_cpu_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - memcpy(test_msg->cmdline, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->cmdline) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->flags = 20; - test_msg->index = 101; - test_msg->pcpu = 98; - test_msg->pid = 50042; - test_msg->time = 3948815319; - { - const char assign_string[] = {(char)112, (char)114, (char)111, (char)99, - (char)101, (char)115, (char)115, (char)45, - (char)110, (char)97, (char)109, (char)101, - (char)0, (char)0, (char)0}; - memcpy(test_msg->tname, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->tname) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0x7f08, 34196, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 34196); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - EXPECT_EQ(memcmp(last_msg_->cmdline, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->cmdline, expected string '" - << check_string << "', is '" << last_msg_->cmdline << "'"; - } - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 20) - << "incorrect value for flags, expected 20, is " << last_msg_->flags; - EXPECT_EQ(get_asindex)>( - reinterpret_cast(&last_msg_->index)), - 101) - << "incorrect value for index, expected 101, is " << last_msg_->index; - EXPECT_EQ(get_aspcpu)>( - reinterpret_cast(&last_msg_->pcpu)), - 98) - << "incorrect value for pcpu, expected 98, is " << last_msg_->pcpu; - EXPECT_EQ(get_aspid)>( - reinterpret_cast(&last_msg_->pid)), - 50042) - << "incorrect value for pid, expected 50042, is " << last_msg_->pid; - EXPECT_EQ(get_astime)>( - reinterpret_cast(&last_msg_->time)), - 3948815319) - << "incorrect value for time, expected 3948815319, is " - << last_msg_->time; - { - const char check_string[] = {(char)112, (char)114, (char)111, (char)99, - (char)101, (char)115, (char)115, (char)45, - (char)110, (char)97, (char)109, (char)101, - (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->tname, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->tname, expected string '" - << check_string << "', is '" << last_msg_->tname << "'"; - } -} diff --git a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxCpuStateDepA.cc b/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxCpuStateDepA.cc deleted file mode 100644 index 511d30c612..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxCpuStateDepA.cc +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxCpuStateDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_linux_MsgLinuxCpuStateDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_linux_MsgLinuxCpuStateDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_linux_cpu_state_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_linux_cpu_state_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_linux_MsgLinuxCpuStateDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 0, 127, 12, 91, 65, 51, 240, 250, 178, 112, 114, 111, 99, 101, - 115, 115, 45, 110, 97, 109, 101, 0, 0, 0, 47, 112, 97, 116, 104, - 47, 116, 111, 47, 112, 114, 111, 99, 101, 115, 115, 45, 110, 97, 109, - 101, 32, 97, 114, 103, 48, 32, 97, 114, 103, 49, 32, 97, 114, 103, - 50, 32, 97, 114, 103, 51, 32, 97, 114, 103, 52, 80, 48, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_linux_cpu_state_dep_a_t *test_msg = - (msg_linux_cpu_state_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - memcpy(test_msg->cmdline, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->cmdline) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->index = 51; - test_msg->pcpu = 178; - test_msg->pid = 64240; - { - const char assign_string[] = {(char)112, (char)114, (char)111, (char)99, - (char)101, (char)115, (char)115, (char)45, - (char)110, (char)97, (char)109, (char)101, - (char)0, (char)0, (char)0}; - memcpy(test_msg->tname, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->tname) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0x7f00, 23308, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 23308); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - EXPECT_EQ(memcmp(last_msg_->cmdline, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->cmdline, expected string '" - << check_string << "', is '" << last_msg_->cmdline << "'"; - } - EXPECT_EQ(get_asindex)>( - reinterpret_cast(&last_msg_->index)), - 51) - << "incorrect value for index, expected 51, is " << last_msg_->index; - EXPECT_EQ(get_aspcpu)>( - reinterpret_cast(&last_msg_->pcpu)), - 178) - << "incorrect value for pcpu, expected 178, is " << last_msg_->pcpu; - EXPECT_EQ(get_aspid)>( - reinterpret_cast(&last_msg_->pid)), - 64240) - << "incorrect value for pid, expected 64240, is " << last_msg_->pid; - { - const char check_string[] = {(char)112, (char)114, (char)111, (char)99, - (char)101, (char)115, (char)115, (char)45, - (char)110, (char)97, (char)109, (char)101, - (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->tname, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->tname, expected string '" - << check_string << "', is '" << last_msg_->tname << "'"; - } -} diff --git a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxMemState.cc b/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxMemState.cc deleted file mode 100644 index f6d461f2dd..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxMemState.cc +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxMemState.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_linux_MsgLinuxMemState0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_linux_MsgLinuxMemState0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_linux_mem_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_linux_mem_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_linux_MsgLinuxMemState0, Test) { - uint8_t encoded_frame[] = { - 85, 9, 127, 95, 253, 70, 154, 191, 223, 19, 247, 53, 26, - 187, 76, 112, 114, 111, 99, 101, 115, 115, 45, 110, 97, 109, - 101, 0, 0, 0, 47, 112, 97, 116, 104, 47, 116, 111, 47, - 112, 114, 111, 99, 101, 115, 115, 45, 110, 97, 109, 101, 32, - 97, 114, 103, 48, 32, 97, 114, 103, 49, 32, 97, 114, 103, - 50, 32, 97, 114, 103, 51, 32, 97, 114, 103, 52, 3, 181, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_linux_mem_state_t *test_msg = (msg_linux_mem_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - memcpy(test_msg->cmdline, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->cmdline) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->flags = 76; - test_msg->index = 154; - test_msg->pid = 57279; - test_msg->pmem = 19; - test_msg->time = 3139057143; - { - const char assign_string[] = {(char)112, (char)114, (char)111, (char)99, - (char)101, (char)115, (char)115, (char)45, - (char)110, (char)97, (char)109, (char)101, - (char)0, (char)0, (char)0}; - memcpy(test_msg->tname, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->tname) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0x7f09, 64863, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 64863); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - EXPECT_EQ(memcmp(last_msg_->cmdline, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->cmdline, expected string '" - << check_string << "', is '" << last_msg_->cmdline << "'"; - } - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 76) - << "incorrect value for flags, expected 76, is " << last_msg_->flags; - EXPECT_EQ(get_asindex)>( - reinterpret_cast(&last_msg_->index)), - 154) - << "incorrect value for index, expected 154, is " << last_msg_->index; - EXPECT_EQ(get_aspid)>( - reinterpret_cast(&last_msg_->pid)), - 57279) - << "incorrect value for pid, expected 57279, is " << last_msg_->pid; - EXPECT_EQ(get_aspmem)>( - reinterpret_cast(&last_msg_->pmem)), - 19) - << "incorrect value for pmem, expected 19, is " << last_msg_->pmem; - EXPECT_EQ(get_astime)>( - reinterpret_cast(&last_msg_->time)), - 3139057143) - << "incorrect value for time, expected 3139057143, is " - << last_msg_->time; - { - const char check_string[] = {(char)112, (char)114, (char)111, (char)99, - (char)101, (char)115, (char)115, (char)45, - (char)110, (char)97, (char)109, (char)101, - (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->tname, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->tname, expected string '" - << check_string << "', is '" << last_msg_->tname << "'"; - } -} diff --git a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxMemStateDepA.cc b/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxMemStateDepA.cc deleted file mode 100644 index dd1cc740b7..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxMemStateDepA.cc +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxMemStateDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_linux_MsgLinuxMemStateDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_linux_MsgLinuxMemStateDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_linux_mem_state_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_linux_mem_state_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_linux_MsgLinuxMemStateDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 1, 127, 185, 109, 65, 247, 93, 48, 193, 112, 114, 111, 99, 101, - 115, 115, 45, 110, 97, 109, 101, 0, 0, 0, 47, 112, 97, 116, 104, - 47, 116, 111, 47, 112, 114, 111, 99, 101, 115, 115, 45, 110, 97, 109, - 101, 32, 97, 114, 103, 48, 32, 97, 114, 103, 49, 32, 97, 114, 103, - 50, 32, 97, 114, 103, 51, 32, 97, 114, 103, 52, 17, 137, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_linux_mem_state_dep_a_t *test_msg = - (msg_linux_mem_state_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - memcpy(test_msg->cmdline, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->cmdline) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->index = 247; - test_msg->pid = 12381; - test_msg->pmem = 193; - { - const char assign_string[] = {(char)112, (char)114, (char)111, (char)99, - (char)101, (char)115, (char)115, (char)45, - (char)110, (char)97, (char)109, (char)101, - (char)0, (char)0, (char)0}; - memcpy(test_msg->tname, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->tname) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0x7f01, 28089, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 28089); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - EXPECT_EQ(memcmp(last_msg_->cmdline, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->cmdline, expected string '" - << check_string << "', is '" << last_msg_->cmdline << "'"; - } - EXPECT_EQ(get_asindex)>( - reinterpret_cast(&last_msg_->index)), - 247) - << "incorrect value for index, expected 247, is " << last_msg_->index; - EXPECT_EQ(get_aspid)>( - reinterpret_cast(&last_msg_->pid)), - 12381) - << "incorrect value for pid, expected 12381, is " << last_msg_->pid; - EXPECT_EQ(get_aspmem)>( - reinterpret_cast(&last_msg_->pmem)), - 193) - << "incorrect value for pmem, expected 193, is " << last_msg_->pmem; - { - const char check_string[] = {(char)112, (char)114, (char)111, (char)99, - (char)101, (char)115, (char)115, (char)45, - (char)110, (char)97, (char)109, (char)101, - (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->tname, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->tname, expected string '" - << check_string << "', is '" << last_msg_->tname << "'"; - } -} diff --git a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxProcessFdCount.cc b/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxProcessFdCount.cc deleted file mode 100644 index 50547a394d..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxProcessFdCount.cc +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxProcessFdCount.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_linux_MsgLinuxProcessFdCount0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_linux_MsgLinuxProcessFdCount0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_linux_process_fd_count_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_linux_process_fd_count_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_linux_MsgLinuxProcessFdCount0, Test) { - uint8_t encoded_frame[] = { - 85, 6, 127, 30, 195, 51, 164, 189, 165, 5, 139, 47, 112, 97, 116, - 104, 47, 116, 111, 47, 112, 114, 111, 99, 101, 115, 115, 45, 110, 97, - 109, 101, 32, 97, 114, 103, 48, 32, 97, 114, 103, 49, 32, 97, 114, - 103, 50, 32, 97, 114, 103, 51, 32, 97, 114, 103, 52, 2, 94, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_linux_process_fd_count_t *test_msg = - (msg_linux_process_fd_count_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - memcpy(test_msg->cmdline, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->cmdline) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->fd_count = 35589; - test_msg->index = 164; - test_msg->pid = 42429; - - EXPECT_EQ(send_message(0x7f06, 49950, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 49950); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - EXPECT_EQ(memcmp(last_msg_->cmdline, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->cmdline, expected string '" - << check_string << "', is '" << last_msg_->cmdline << "'"; - } - EXPECT_EQ(get_asfd_count)>( - reinterpret_cast(&last_msg_->fd_count)), - 35589) - << "incorrect value for fd_count, expected 35589, is " - << last_msg_->fd_count; - EXPECT_EQ(get_asindex)>( - reinterpret_cast(&last_msg_->index)), - 164) - << "incorrect value for index, expected 164, is " << last_msg_->index; - EXPECT_EQ(get_aspid)>( - reinterpret_cast(&last_msg_->pid)), - 42429) - << "incorrect value for pid, expected 42429, is " << last_msg_->pid; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxProcessFdSummary.cc b/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxProcessFdSummary.cc deleted file mode 100644 index 5a8a0355d2..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxProcessFdSummary.cc +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxProcessFdSummary.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_linux_MsgLinuxProcessFdSummary0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_linux_MsgLinuxProcessFdSummary0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_linux_process_fd_summary_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_linux_process_fd_summary_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_linux_MsgLinuxProcessFdSummary0, Test) { - uint8_t encoded_frame[] = { - 85, 7, 127, 103, 248, 29, 19, 131, 200, 77, 102, 100, 49, - 0, 102, 100, 50, 0, 102, 100, 51, 0, 102, 100, 52, 0, - 102, 100, 53, 0, 102, 100, 54, 0, 0, 129, 80, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_linux_process_fd_summary_t *test_msg = - (msg_linux_process_fd_summary_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)102, (char)100, (char)49, (char)0, (char)102, - (char)100, (char)50, (char)0, (char)102, (char)100, - (char)51, (char)0, (char)102, (char)100, (char)52, - (char)0, (char)102, (char)100, (char)53, (char)0, - (char)102, (char)100, (char)54, (char)0, (char)0}; - memcpy(test_msg->most_opened, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->most_opened) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->sys_fd_count = 1304986387; - - EXPECT_EQ(send_message(0x7f07, 63591, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 63591); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)102, (char)100, (char)49, (char)0, (char)102, - (char)100, (char)50, (char)0, (char)102, (char)100, - (char)51, (char)0, (char)102, (char)100, (char)52, - (char)0, (char)102, (char)100, (char)53, (char)0, - (char)102, (char)100, (char)54, (char)0, (char)0}; - EXPECT_EQ( - memcmp(last_msg_->most_opened, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->most_opened, expected string '" - << check_string << "', is '" << last_msg_->most_opened << "'"; - } - EXPECT_EQ(get_assys_fd_count)>( - reinterpret_cast(&last_msg_->sys_fd_count)), - 1304986387) - << "incorrect value for sys_fd_count, expected 1304986387, is " - << last_msg_->sys_fd_count; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxProcessSocketCounts.cc b/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxProcessSocketCounts.cc deleted file mode 100644 index bd9a75a365..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxProcessSocketCounts.cc +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxProcessSocketCounts.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_linux_MsgLinuxProcessSocketCounts0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_linux_MsgLinuxProcessSocketCounts0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_linux_process_socket_counts_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_linux_process_socket_counts_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_linux_MsgLinuxProcessSocketCounts0, Test) { - uint8_t encoded_frame[] = { - 85, 3, 127, 108, 9, 55, 51, 137, 111, 79, 118, 3, 140, - 114, 115, 47, 112, 97, 116, 104, 47, 116, 111, 47, 112, 114, - 111, 99, 101, 115, 115, 45, 110, 97, 109, 101, 32, 97, 114, - 103, 48, 32, 97, 114, 103, 49, 32, 97, 114, 103, 50, 32, - 97, 114, 103, 51, 32, 97, 114, 103, 52, 180, 131, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_linux_process_socket_counts_t *test_msg = - (msg_linux_process_socket_counts_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - memcpy(test_msg->cmdline, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->cmdline) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->index = 51; - test_msg->pid = 28553; - test_msg->socket_count = 30287; - test_msg->socket_states = 29554; - test_msg->socket_types = 35843; - - EXPECT_EQ(send_message(0x7f03, 2412, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 2412); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - EXPECT_EQ(memcmp(last_msg_->cmdline, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->cmdline, expected string '" - << check_string << "', is '" << last_msg_->cmdline << "'"; - } - EXPECT_EQ(get_asindex)>( - reinterpret_cast(&last_msg_->index)), - 51) - << "incorrect value for index, expected 51, is " << last_msg_->index; - EXPECT_EQ(get_aspid)>( - reinterpret_cast(&last_msg_->pid)), - 28553) - << "incorrect value for pid, expected 28553, is " << last_msg_->pid; - EXPECT_EQ(get_assocket_count)>( - reinterpret_cast(&last_msg_->socket_count)), - 30287) - << "incorrect value for socket_count, expected 30287, is " - << last_msg_->socket_count; - EXPECT_EQ(get_assocket_states)>( - reinterpret_cast(&last_msg_->socket_states)), - 29554) - << "incorrect value for socket_states, expected 29554, is " - << last_msg_->socket_states; - EXPECT_EQ(get_assocket_types)>( - reinterpret_cast(&last_msg_->socket_types)), - 35843) - << "incorrect value for socket_types, expected 35843, is " - << last_msg_->socket_types; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxProcessSocketQueues.cc b/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxProcessSocketQueues.cc deleted file mode 100644 index e951223453..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxProcessSocketQueues.cc +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxProcessSocketQueues.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_linux_MsgLinuxProcessSocketQueues0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_linux_MsgLinuxProcessSocketQueues0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_linux_process_socket_queues_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_linux_process_socket_queues_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_linux_MsgLinuxProcessSocketQueues0, Test) { - uint8_t encoded_frame[] = { - 85, 4, 127, 187, 232, 121, 181, 135, 75, 249, 211, 35, 252, 80, 109, - 15, 223, 97, 100, 100, 114, 101, 115, 115, 32, 111, 102, 32, 108, 97, - 114, 103, 101, 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 47, 112, 97, 116, 104, 47, 116, 111, 47, - 112, 114, 111, 99, 101, 115, 115, 45, 110, 97, 109, 101, 32, 97, 114, - 103, 48, 32, 97, 114, 103, 49, 32, 97, 114, 103, 50, 32, 97, 114, - 103, 51, 32, 97, 114, 103, 52, 2, 247, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_linux_process_socket_queues_t *test_msg = - (msg_linux_process_socket_queues_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)97, (char)100, (char)100, (char)114, (char)101, (char)115, - (char)115, (char)32, (char)111, (char)102, (char)32, (char)108, - (char)97, (char)114, (char)103, (char)101, (char)115, (char)116, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->address_of_largest, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->address_of_largest) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - { - const char assign_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - memcpy(test_msg->cmdline, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->cmdline) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->index = 181; - test_msg->pid = 19335; - test_msg->recv_queued = 54265; - test_msg->send_queued = 64547; - test_msg->socket_states = 57103; - test_msg->socket_types = 27984; - - EXPECT_EQ(send_message(0x7f04, 59579, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 59579); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)97, (char)100, (char)100, (char)114, (char)101, (char)115, - (char)115, (char)32, (char)111, (char)102, (char)32, (char)108, - (char)97, (char)114, (char)103, (char)101, (char)115, (char)116, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->address_of_largest, check_string, - sizeof(check_string)), - 0) - << "incorrect value for last_msg_->address_of_largest, expected string " - "'" - << check_string << "', is '" << last_msg_->address_of_largest << "'"; - } - { - const char check_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)112, (char)114, (char)111, - (char)99, (char)101, (char)115, (char)115, (char)45, (char)110, - (char)97, (char)109, (char)101, (char)32, (char)97, (char)114, - (char)103, (char)48, (char)32, (char)97, (char)114, (char)103, - (char)49, (char)32, (char)97, (char)114, (char)103, (char)50, - (char)32, (char)97, (char)114, (char)103, (char)51, (char)32, - (char)97, (char)114, (char)103, (char)52}; - EXPECT_EQ(memcmp(last_msg_->cmdline, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->cmdline, expected string '" - << check_string << "', is '" << last_msg_->cmdline << "'"; - } - EXPECT_EQ(get_asindex)>( - reinterpret_cast(&last_msg_->index)), - 181) - << "incorrect value for index, expected 181, is " << last_msg_->index; - EXPECT_EQ(get_aspid)>( - reinterpret_cast(&last_msg_->pid)), - 19335) - << "incorrect value for pid, expected 19335, is " << last_msg_->pid; - EXPECT_EQ(get_asrecv_queued)>( - reinterpret_cast(&last_msg_->recv_queued)), - 54265) - << "incorrect value for recv_queued, expected 54265, is " - << last_msg_->recv_queued; - EXPECT_EQ(get_assend_queued)>( - reinterpret_cast(&last_msg_->send_queued)), - 64547) - << "incorrect value for send_queued, expected 64547, is " - << last_msg_->send_queued; - EXPECT_EQ(get_assocket_states)>( - reinterpret_cast(&last_msg_->socket_states)), - 57103) - << "incorrect value for socket_states, expected 57103, is " - << last_msg_->socket_states; - EXPECT_EQ(get_assocket_types)>( - reinterpret_cast(&last_msg_->socket_types)), - 27984) - << "incorrect value for socket_types, expected 27984, is " - << last_msg_->socket_types; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxSocketUsage.cc b/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxSocketUsage.cc deleted file mode 100644 index 61c48f61b9..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxSocketUsage.cc +++ /dev/null @@ -1,523 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxSocketUsage.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_linux_MsgLinuxSocketUsage0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_linux_MsgLinuxSocketUsage0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_linux_socket_usage_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_linux_socket_usage_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_linux_MsgLinuxSocketUsage0, Test) { - uint8_t encoded_frame[] = { - 85, 5, 127, 114, 138, 72, 13, 196, 69, 173, 67, 222, 186, 181, - 246, 154, 251, 17, 224, 179, 26, 169, 177, 90, 149, 213, 214, 6, - 126, 64, 120, 185, 84, 131, 200, 111, 32, 141, 217, 209, 52, 14, - 190, 147, 159, 246, 141, 122, 212, 119, 131, 30, 120, 47, 25, 109, - 154, 65, 132, 164, 39, 30, 30, 175, 8, 44, 28, 111, 236, 240, - 176, 74, 159, 129, 154, 153, 162, 229, 130, 154, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_linux_socket_usage_t *test_msg = - (msg_linux_socket_usage_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->avg_queue_depth = 2907030541; - test_msg->max_queue_depth = 3048922691; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_state_counts[0])); - } - test_msg->socket_state_counts[0] = 39670; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_state_counts[0])); - } - test_msg->socket_state_counts[1] = 4603; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_state_counts[0])); - } - test_msg->socket_state_counts[2] = 46048; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_state_counts[0])); - } - test_msg->socket_state_counts[3] = 43290; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_state_counts[0])); - } - test_msg->socket_state_counts[4] = 23217; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_state_counts[0])); - } - test_msg->socket_state_counts[5] = 54677; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_state_counts[0])); - } - test_msg->socket_state_counts[6] = 1750; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_state_counts[0])); - } - test_msg->socket_state_counts[7] = 16510; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_state_counts[0])); - } - test_msg->socket_state_counts[8] = 47480; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_state_counts[0])); - } - test_msg->socket_state_counts[9] = 33620; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_state_counts[0])); - } - test_msg->socket_state_counts[10] = 28616; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_state_counts[0])); - } - test_msg->socket_state_counts[11] = 36128; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_state_counts[0])); - } - test_msg->socket_state_counts[12] = 53721; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_state_counts[0])); - } - test_msg->socket_state_counts[13] = 3636; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_state_counts[0])); - } - test_msg->socket_state_counts[14] = 37822; - if (sizeof(test_msg->socket_state_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_state_counts[0])); - } - test_msg->socket_state_counts[15] = 63135; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_type_counts[0])); - } - test_msg->socket_type_counts[0] = 31373; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_type_counts[0])); - } - test_msg->socket_type_counts[1] = 30676; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_type_counts[0])); - } - test_msg->socket_type_counts[2] = 7811; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_type_counts[0])); - } - test_msg->socket_type_counts[3] = 12152; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_type_counts[0])); - } - test_msg->socket_type_counts[4] = 27929; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_type_counts[0])); - } - test_msg->socket_type_counts[5] = 16794; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_type_counts[0])); - } - test_msg->socket_type_counts[6] = 42116; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_type_counts[0])); - } - test_msg->socket_type_counts[7] = 7719; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_type_counts[0])); - } - test_msg->socket_type_counts[8] = 44830; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_type_counts[0])); - } - test_msg->socket_type_counts[9] = 11272; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_type_counts[0])); - } - test_msg->socket_type_counts[10] = 28444; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_type_counts[0])); - } - test_msg->socket_type_counts[11] = 61676; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_type_counts[0])); - } - test_msg->socket_type_counts[12] = 19120; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_type_counts[0])); - } - test_msg->socket_type_counts[13] = 33183; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_type_counts[0])); - } - test_msg->socket_type_counts[14] = 39322; - if (sizeof(test_msg->socket_type_counts) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->socket_type_counts[0])); - } - test_msg->socket_type_counts[15] = 58786; - - EXPECT_EQ(send_message(0x7f05, 35442, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35442); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asavg_queue_depth)>( - reinterpret_cast(&last_msg_->avg_queue_depth)), - 2907030541) - << "incorrect value for avg_queue_depth, expected 2907030541, is " - << last_msg_->avg_queue_depth; - EXPECT_EQ(get_asmax_queue_depth)>( - reinterpret_cast(&last_msg_->max_queue_depth)), - 3048922691) - << "incorrect value for max_queue_depth, expected 3048922691, is " - << last_msg_->max_queue_depth; - EXPECT_EQ(get_assocket_state_counts[0])>( - reinterpret_cast( - &last_msg_->socket_state_counts[0])), - 39670) - << "incorrect value for socket_state_counts[0], expected 39670, is " - << last_msg_->socket_state_counts[0]; - EXPECT_EQ(get_assocket_state_counts[1])>( - reinterpret_cast( - &last_msg_->socket_state_counts[1])), - 4603) - << "incorrect value for socket_state_counts[1], expected 4603, is " - << last_msg_->socket_state_counts[1]; - EXPECT_EQ(get_assocket_state_counts[2])>( - reinterpret_cast( - &last_msg_->socket_state_counts[2])), - 46048) - << "incorrect value for socket_state_counts[2], expected 46048, is " - << last_msg_->socket_state_counts[2]; - EXPECT_EQ(get_assocket_state_counts[3])>( - reinterpret_cast( - &last_msg_->socket_state_counts[3])), - 43290) - << "incorrect value for socket_state_counts[3], expected 43290, is " - << last_msg_->socket_state_counts[3]; - EXPECT_EQ(get_assocket_state_counts[4])>( - reinterpret_cast( - &last_msg_->socket_state_counts[4])), - 23217) - << "incorrect value for socket_state_counts[4], expected 23217, is " - << last_msg_->socket_state_counts[4]; - EXPECT_EQ(get_assocket_state_counts[5])>( - reinterpret_cast( - &last_msg_->socket_state_counts[5])), - 54677) - << "incorrect value for socket_state_counts[5], expected 54677, is " - << last_msg_->socket_state_counts[5]; - EXPECT_EQ(get_assocket_state_counts[6])>( - reinterpret_cast( - &last_msg_->socket_state_counts[6])), - 1750) - << "incorrect value for socket_state_counts[6], expected 1750, is " - << last_msg_->socket_state_counts[6]; - EXPECT_EQ(get_assocket_state_counts[7])>( - reinterpret_cast( - &last_msg_->socket_state_counts[7])), - 16510) - << "incorrect value for socket_state_counts[7], expected 16510, is " - << last_msg_->socket_state_counts[7]; - EXPECT_EQ(get_assocket_state_counts[8])>( - reinterpret_cast( - &last_msg_->socket_state_counts[8])), - 47480) - << "incorrect value for socket_state_counts[8], expected 47480, is " - << last_msg_->socket_state_counts[8]; - EXPECT_EQ(get_assocket_state_counts[9])>( - reinterpret_cast( - &last_msg_->socket_state_counts[9])), - 33620) - << "incorrect value for socket_state_counts[9], expected 33620, is " - << last_msg_->socket_state_counts[9]; - EXPECT_EQ(get_assocket_state_counts[10])>( - reinterpret_cast( - &last_msg_->socket_state_counts[10])), - 28616) - << "incorrect value for socket_state_counts[10], expected 28616, is " - << last_msg_->socket_state_counts[10]; - EXPECT_EQ(get_assocket_state_counts[11])>( - reinterpret_cast( - &last_msg_->socket_state_counts[11])), - 36128) - << "incorrect value for socket_state_counts[11], expected 36128, is " - << last_msg_->socket_state_counts[11]; - EXPECT_EQ(get_assocket_state_counts[12])>( - reinterpret_cast( - &last_msg_->socket_state_counts[12])), - 53721) - << "incorrect value for socket_state_counts[12], expected 53721, is " - << last_msg_->socket_state_counts[12]; - EXPECT_EQ(get_assocket_state_counts[13])>( - reinterpret_cast( - &last_msg_->socket_state_counts[13])), - 3636) - << "incorrect value for socket_state_counts[13], expected 3636, is " - << last_msg_->socket_state_counts[13]; - EXPECT_EQ(get_assocket_state_counts[14])>( - reinterpret_cast( - &last_msg_->socket_state_counts[14])), - 37822) - << "incorrect value for socket_state_counts[14], expected 37822, is " - << last_msg_->socket_state_counts[14]; - EXPECT_EQ(get_assocket_state_counts[15])>( - reinterpret_cast( - &last_msg_->socket_state_counts[15])), - 63135) - << "incorrect value for socket_state_counts[15], expected 63135, is " - << last_msg_->socket_state_counts[15]; - EXPECT_EQ( - get_assocket_type_counts[0])>( - reinterpret_cast(&last_msg_->socket_type_counts[0])), - 31373) - << "incorrect value for socket_type_counts[0], expected 31373, is " - << last_msg_->socket_type_counts[0]; - EXPECT_EQ( - get_assocket_type_counts[1])>( - reinterpret_cast(&last_msg_->socket_type_counts[1])), - 30676) - << "incorrect value for socket_type_counts[1], expected 30676, is " - << last_msg_->socket_type_counts[1]; - EXPECT_EQ( - get_assocket_type_counts[2])>( - reinterpret_cast(&last_msg_->socket_type_counts[2])), - 7811) - << "incorrect value for socket_type_counts[2], expected 7811, is " - << last_msg_->socket_type_counts[2]; - EXPECT_EQ( - get_assocket_type_counts[3])>( - reinterpret_cast(&last_msg_->socket_type_counts[3])), - 12152) - << "incorrect value for socket_type_counts[3], expected 12152, is " - << last_msg_->socket_type_counts[3]; - EXPECT_EQ( - get_assocket_type_counts[4])>( - reinterpret_cast(&last_msg_->socket_type_counts[4])), - 27929) - << "incorrect value for socket_type_counts[4], expected 27929, is " - << last_msg_->socket_type_counts[4]; - EXPECT_EQ( - get_assocket_type_counts[5])>( - reinterpret_cast(&last_msg_->socket_type_counts[5])), - 16794) - << "incorrect value for socket_type_counts[5], expected 16794, is " - << last_msg_->socket_type_counts[5]; - EXPECT_EQ( - get_assocket_type_counts[6])>( - reinterpret_cast(&last_msg_->socket_type_counts[6])), - 42116) - << "incorrect value for socket_type_counts[6], expected 42116, is " - << last_msg_->socket_type_counts[6]; - EXPECT_EQ( - get_assocket_type_counts[7])>( - reinterpret_cast(&last_msg_->socket_type_counts[7])), - 7719) - << "incorrect value for socket_type_counts[7], expected 7719, is " - << last_msg_->socket_type_counts[7]; - EXPECT_EQ( - get_assocket_type_counts[8])>( - reinterpret_cast(&last_msg_->socket_type_counts[8])), - 44830) - << "incorrect value for socket_type_counts[8], expected 44830, is " - << last_msg_->socket_type_counts[8]; - EXPECT_EQ( - get_assocket_type_counts[9])>( - reinterpret_cast(&last_msg_->socket_type_counts[9])), - 11272) - << "incorrect value for socket_type_counts[9], expected 11272, is " - << last_msg_->socket_type_counts[9]; - EXPECT_EQ(get_assocket_type_counts[10])>( - reinterpret_cast( - &last_msg_->socket_type_counts[10])), - 28444) - << "incorrect value for socket_type_counts[10], expected 28444, is " - << last_msg_->socket_type_counts[10]; - EXPECT_EQ(get_assocket_type_counts[11])>( - reinterpret_cast( - &last_msg_->socket_type_counts[11])), - 61676) - << "incorrect value for socket_type_counts[11], expected 61676, is " - << last_msg_->socket_type_counts[11]; - EXPECT_EQ(get_assocket_type_counts[12])>( - reinterpret_cast( - &last_msg_->socket_type_counts[12])), - 19120) - << "incorrect value for socket_type_counts[12], expected 19120, is " - << last_msg_->socket_type_counts[12]; - EXPECT_EQ(get_assocket_type_counts[13])>( - reinterpret_cast( - &last_msg_->socket_type_counts[13])), - 33183) - << "incorrect value for socket_type_counts[13], expected 33183, is " - << last_msg_->socket_type_counts[13]; - EXPECT_EQ(get_assocket_type_counts[14])>( - reinterpret_cast( - &last_msg_->socket_type_counts[14])), - 39322) - << "incorrect value for socket_type_counts[14], expected 39322, is " - << last_msg_->socket_type_counts[14]; - EXPECT_EQ(get_assocket_type_counts[15])>( - reinterpret_cast( - &last_msg_->socket_type_counts[15])), - 58786) - << "incorrect value for socket_type_counts[15], expected 58786, is " - << last_msg_->socket_type_counts[15]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxSysState.cc b/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxSysState.cc deleted file mode 100644 index a5fcef339b..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxSysState.cc +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxSysState.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_linux_MsgLinuxSysState0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_linux_MsgLinuxSysState0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_linux_sys_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_linux_sys_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_linux_MsgLinuxSysState0, Test) { - uint8_t encoded_frame[] = { - 85, 10, 127, 85, 167, 15, 20, 207, 125, 215, 196, 71, - 161, 229, 250, 186, 108, 30, 106, 5, 9, 229, 242, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_linux_sys_state_t *test_msg = (msg_linux_sys_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 9; - test_msg->mem_total = 53012; - test_msg->pcpu = 125; - test_msg->pid_count = 47866; - test_msg->pmem = 215; - test_msg->procs_starting = 18372; - test_msg->procs_stopping = 58785; - test_msg->time = 90840684; - - EXPECT_EQ(send_message(0x7f0a, 42837, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 42837); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 9) - << "incorrect value for flags, expected 9, is " << last_msg_->flags; - EXPECT_EQ(get_asmem_total)>( - reinterpret_cast(&last_msg_->mem_total)), - 53012) - << "incorrect value for mem_total, expected 53012, is " - << last_msg_->mem_total; - EXPECT_EQ(get_aspcpu)>( - reinterpret_cast(&last_msg_->pcpu)), - 125) - << "incorrect value for pcpu, expected 125, is " << last_msg_->pcpu; - EXPECT_EQ(get_aspid_count)>( - reinterpret_cast(&last_msg_->pid_count)), - 47866) - << "incorrect value for pid_count, expected 47866, is " - << last_msg_->pid_count; - EXPECT_EQ(get_aspmem)>( - reinterpret_cast(&last_msg_->pmem)), - 215) - << "incorrect value for pmem, expected 215, is " << last_msg_->pmem; - EXPECT_EQ(get_asprocs_starting)>( - reinterpret_cast(&last_msg_->procs_starting)), - 18372) - << "incorrect value for procs_starting, expected 18372, is " - << last_msg_->procs_starting; - EXPECT_EQ(get_asprocs_stopping)>( - reinterpret_cast(&last_msg_->procs_stopping)), - 58785) - << "incorrect value for procs_stopping, expected 58785, is " - << last_msg_->procs_stopping; - EXPECT_EQ(get_astime)>( - reinterpret_cast(&last_msg_->time)), - 90840684) - << "incorrect value for time, expected 90840684, is " << last_msg_->time; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxSysStateDepA.cc b/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxSysStateDepA.cc deleted file mode 100644 index 3b010ea449..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_linux_MsgLinuxSysStateDepA.cc +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/linux/test_MsgLinuxSysStateDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_linux_MsgLinuxSysStateDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_linux_MsgLinuxSysStateDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_linux_sys_state_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_linux_sys_state_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_linux_MsgLinuxSysStateDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 2, 127, 84, 56, 10, 188, 163, 211, - 194, 115, 71, 101, 103, 124, 201, 223, 223, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_linux_sys_state_dep_a_t *test_msg = - (msg_linux_sys_state_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->mem_total = 41916; - test_msg->pcpu = 211; - test_msg->pid_count = 51580; - test_msg->pmem = 194; - test_msg->procs_starting = 18291; - test_msg->procs_stopping = 26469; - - EXPECT_EQ(send_message(0x7f02, 14420, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 14420); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asmem_total)>( - reinterpret_cast(&last_msg_->mem_total)), - 41916) - << "incorrect value for mem_total, expected 41916, is " - << last_msg_->mem_total; - EXPECT_EQ(get_aspcpu)>( - reinterpret_cast(&last_msg_->pcpu)), - 211) - << "incorrect value for pcpu, expected 211, is " << last_msg_->pcpu; - EXPECT_EQ(get_aspid_count)>( - reinterpret_cast(&last_msg_->pid_count)), - 51580) - << "incorrect value for pid_count, expected 51580, is " - << last_msg_->pid_count; - EXPECT_EQ(get_aspmem)>( - reinterpret_cast(&last_msg_->pmem)), - 194) - << "incorrect value for pmem, expected 194, is " << last_msg_->pmem; - EXPECT_EQ(get_asprocs_starting)>( - reinterpret_cast(&last_msg_->procs_starting)), - 18291) - << "incorrect value for procs_starting, expected 18291, is " - << last_msg_->procs_starting; - EXPECT_EQ(get_asprocs_stopping)>( - reinterpret_cast(&last_msg_->procs_stopping)), - 26469) - << "incorrect value for procs_stopping, expected 26469, is " - << last_msg_->procs_stopping; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_logging_MsgFwd.cc b/c/test/legacy/cpp/auto_check_sbp_logging_MsgFwd.cc deleted file mode 100644 index 60a2d26b80..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_logging_MsgFwd.cc +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/logging/test_MsgFwd.yaml by generate.py. Do not -// modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_logging_MsgFwd0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_logging_MsgFwd0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_fwd_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_fwd_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_logging_MsgFwd0, Test) { - uint8_t encoded_frame[] = { - 85, 2, 4, 66, 0, 18, 0, 0, 86, 81, 68, 47, 81, - 103, 65, 69, 65, 65, 65, 65, 65, 69, 97, 103, 125, 95, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_fwd_t *test_msg = (msg_fwd_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fwd_payload[0])); - } - test_msg->fwd_payload[0] = 86; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fwd_payload[0])); - } - test_msg->fwd_payload[1] = 81; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fwd_payload[0])); - } - test_msg->fwd_payload[2] = 68; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fwd_payload[0])); - } - test_msg->fwd_payload[3] = 47; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fwd_payload[0])); - } - test_msg->fwd_payload[4] = 81; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fwd_payload[0])); - } - test_msg->fwd_payload[5] = 103; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fwd_payload[0])); - } - test_msg->fwd_payload[6] = 65; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fwd_payload[0])); - } - test_msg->fwd_payload[7] = 69; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fwd_payload[0])); - } - test_msg->fwd_payload[8] = 65; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fwd_payload[0])); - } - test_msg->fwd_payload[9] = 65; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fwd_payload[0])); - } - test_msg->fwd_payload[10] = 65; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fwd_payload[0])); - } - test_msg->fwd_payload[11] = 65; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fwd_payload[0])); - } - test_msg->fwd_payload[12] = 65; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fwd_payload[0])); - } - test_msg->fwd_payload[13] = 69; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fwd_payload[0])); - } - test_msg->fwd_payload[14] = 97; - if (sizeof(test_msg->fwd_payload) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fwd_payload[0])); - } - test_msg->fwd_payload[15] = 103; - test_msg->protocol = 0; - test_msg->source = 0; - - EXPECT_EQ(send_message(0x402, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asfwd_payload[0])>( - reinterpret_cast(&last_msg_->fwd_payload[0])), - 86) - << "incorrect value for fwd_payload[0], expected 86, is " - << last_msg_->fwd_payload[0]; - EXPECT_EQ(get_asfwd_payload[1])>( - reinterpret_cast(&last_msg_->fwd_payload[1])), - 81) - << "incorrect value for fwd_payload[1], expected 81, is " - << last_msg_->fwd_payload[1]; - EXPECT_EQ(get_asfwd_payload[2])>( - reinterpret_cast(&last_msg_->fwd_payload[2])), - 68) - << "incorrect value for fwd_payload[2], expected 68, is " - << last_msg_->fwd_payload[2]; - EXPECT_EQ(get_asfwd_payload[3])>( - reinterpret_cast(&last_msg_->fwd_payload[3])), - 47) - << "incorrect value for fwd_payload[3], expected 47, is " - << last_msg_->fwd_payload[3]; - EXPECT_EQ(get_asfwd_payload[4])>( - reinterpret_cast(&last_msg_->fwd_payload[4])), - 81) - << "incorrect value for fwd_payload[4], expected 81, is " - << last_msg_->fwd_payload[4]; - EXPECT_EQ(get_asfwd_payload[5])>( - reinterpret_cast(&last_msg_->fwd_payload[5])), - 103) - << "incorrect value for fwd_payload[5], expected 103, is " - << last_msg_->fwd_payload[5]; - EXPECT_EQ(get_asfwd_payload[6])>( - reinterpret_cast(&last_msg_->fwd_payload[6])), - 65) - << "incorrect value for fwd_payload[6], expected 65, is " - << last_msg_->fwd_payload[6]; - EXPECT_EQ(get_asfwd_payload[7])>( - reinterpret_cast(&last_msg_->fwd_payload[7])), - 69) - << "incorrect value for fwd_payload[7], expected 69, is " - << last_msg_->fwd_payload[7]; - EXPECT_EQ(get_asfwd_payload[8])>( - reinterpret_cast(&last_msg_->fwd_payload[8])), - 65) - << "incorrect value for fwd_payload[8], expected 65, is " - << last_msg_->fwd_payload[8]; - EXPECT_EQ(get_asfwd_payload[9])>( - reinterpret_cast(&last_msg_->fwd_payload[9])), - 65) - << "incorrect value for fwd_payload[9], expected 65, is " - << last_msg_->fwd_payload[9]; - EXPECT_EQ(get_asfwd_payload[10])>( - reinterpret_cast(&last_msg_->fwd_payload[10])), - 65) - << "incorrect value for fwd_payload[10], expected 65, is " - << last_msg_->fwd_payload[10]; - EXPECT_EQ(get_asfwd_payload[11])>( - reinterpret_cast(&last_msg_->fwd_payload[11])), - 65) - << "incorrect value for fwd_payload[11], expected 65, is " - << last_msg_->fwd_payload[11]; - EXPECT_EQ(get_asfwd_payload[12])>( - reinterpret_cast(&last_msg_->fwd_payload[12])), - 65) - << "incorrect value for fwd_payload[12], expected 65, is " - << last_msg_->fwd_payload[12]; - EXPECT_EQ(get_asfwd_payload[13])>( - reinterpret_cast(&last_msg_->fwd_payload[13])), - 69) - << "incorrect value for fwd_payload[13], expected 69, is " - << last_msg_->fwd_payload[13]; - EXPECT_EQ(get_asfwd_payload[14])>( - reinterpret_cast(&last_msg_->fwd_payload[14])), - 97) - << "incorrect value for fwd_payload[14], expected 97, is " - << last_msg_->fwd_payload[14]; - EXPECT_EQ(get_asfwd_payload[15])>( - reinterpret_cast(&last_msg_->fwd_payload[15])), - 103) - << "incorrect value for fwd_payload[15], expected 103, is " - << last_msg_->fwd_payload[15]; - EXPECT_EQ(get_asprotocol)>( - reinterpret_cast(&last_msg_->protocol)), - 0) - << "incorrect value for protocol, expected 0, is " << last_msg_->protocol; - EXPECT_EQ(get_assource)>( - reinterpret_cast(&last_msg_->source)), - 0) - << "incorrect value for source, expected 0, is " << last_msg_->source; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_logging_MsgLog.cc b/c/test/legacy/cpp/auto_check_sbp_logging_MsgLog.cc deleted file mode 100644 index c1a7e53438..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_logging_MsgLog.cc +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/logging/test_MsgLog.yaml by generate.py. Do not -// modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_logging_MsgLog0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_logging_MsgLog0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_log_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_log_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_logging_MsgLog0, Test) { - uint8_t encoded_frame[] = { - 85, 1, 4, 10, 9, 44, 6, 70, 105, 108, 116, 101, 114, - 101, 100, 32, 97, 108, 108, 32, 111, 98, 115, 32, 102, 114, - 111, 109, 32, 50, 51, 49, 52, 32, 97, 116, 32, 116, 111, - 119, 32, 56, 51, 46, 53, 51, 57, 48, 49, 57, 177, 163, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_log_t *test_msg = (msg_log_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->level = 6; - { - const char assign_string[] = { - (char)70, (char)105, (char)108, (char)116, (char)101, (char)114, - (char)101, (char)100, (char)32, (char)97, (char)108, (char)108, - (char)32, (char)111, (char)98, (char)115, (char)32, (char)102, - (char)114, (char)111, (char)109, (char)32, (char)50, (char)51, - (char)49, (char)52, (char)32, (char)97, (char)116, (char)32, - (char)116, (char)111, (char)119, (char)32, (char)56, (char)51, - (char)46, (char)53, (char)51, (char)57, (char)48, (char)49, - (char)57}; - memcpy(test_msg->text, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->text) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0x0401, 2314, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 2314); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_aslevel)>( - reinterpret_cast(&last_msg_->level)), - 6) - << "incorrect value for level, expected 6, is " << last_msg_->level; - { - const char check_string[] = { - (char)70, (char)105, (char)108, (char)116, (char)101, (char)114, - (char)101, (char)100, (char)32, (char)97, (char)108, (char)108, - (char)32, (char)111, (char)98, (char)115, (char)32, (char)102, - (char)114, (char)111, (char)109, (char)32, (char)50, (char)51, - (char)49, (char)52, (char)32, (char)97, (char)116, (char)32, - (char)116, (char)111, (char)119, (char)32, (char)56, (char)51, - (char)46, (char)53, (char)51, (char)57, (char)48, (char)49, - (char)57}; - EXPECT_EQ(memcmp(last_msg_->text, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->text, expected string '" - << check_string << "', is '" << last_msg_->text << "'"; - } -} diff --git a/c/test/legacy/cpp/auto_check_sbp_logging_MsgPrintDep.cc b/c/test/legacy/cpp/auto_check_sbp_logging_MsgPrintDep.cc deleted file mode 100644 index ce789b4e7b..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_logging_MsgPrintDep.cc +++ /dev/null @@ -1,699 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/logging/test_MsgPrintDep.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_logging_MsgPrintDep0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_logging_MsgPrintDep0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_print_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_print_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_logging_MsgPrintDep0, Test) { - uint8_t encoded_frame[] = { - 85, 16, 0, 34, 34, 43, 73, 78, 70, 79, 58, 32, 97, - 99, 113, 58, 32, 80, 82, 78, 32, 49, 53, 32, 102, 111, - 117, 110, 100, 32, 64, 32, 45, 50, 52, 57, 55, 32, 72, - 122, 44, 32, 50, 48, 32, 83, 78, 82, 10, 116, 103, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_print_dep_t *test_msg = (msg_print_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)97, (char)99, (char)113, (char)58, (char)32, (char)80, - (char)82, (char)78, (char)32, (char)49, (char)53, (char)32, - (char)102, (char)111, (char)117, (char)110, (char)100, (char)32, - (char)64, (char)32, (char)45, (char)50, (char)52, (char)57, - (char)55, (char)32, (char)72, (char)122, (char)44, (char)32, - (char)50, (char)48, (char)32, (char)83, (char)78, (char)82, - (char)10}; - memcpy(test_msg->text, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->text) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0x10, 8738, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 8738); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)97, (char)99, (char)113, (char)58, (char)32, (char)80, - (char)82, (char)78, (char)32, (char)49, (char)53, (char)32, - (char)102, (char)111, (char)117, (char)110, (char)100, (char)32, - (char)64, (char)32, (char)45, (char)50, (char)52, (char)57, - (char)55, (char)32, (char)72, (char)122, (char)44, (char)32, - (char)50, (char)48, (char)32, (char)83, (char)78, (char)82, - (char)10}; - EXPECT_EQ(memcmp(last_msg_->text, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->text, expected string '" - << check_string << "', is '" << last_msg_->text << "'"; - } -} -class Test_legacy_auto_check_sbp_logging_MsgPrintDep1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_logging_MsgPrintDep1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_print_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_print_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_logging_MsgPrintDep1, Test) { - uint8_t encoded_frame[] = { - 85, 16, 0, 34, 34, 42, 73, 78, 70, 79, 58, 32, 97, 99, 113, 58, 32, - 80, 82, 78, 32, 51, 49, 32, 102, 111, 117, 110, 100, 32, 64, 32, 52, 50, - 52, 53, 32, 72, 122, 44, 32, 50, 49, 32, 83, 78, 82, 10, 140, 43, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_print_dep_t *test_msg = (msg_print_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)97, (char)99, (char)113, (char)58, (char)32, (char)80, - (char)82, (char)78, (char)32, (char)51, (char)49, (char)32, - (char)102, (char)111, (char)117, (char)110, (char)100, (char)32, - (char)64, (char)32, (char)52, (char)50, (char)52, (char)53, - (char)32, (char)72, (char)122, (char)44, (char)32, (char)50, - (char)49, (char)32, (char)83, (char)78, (char)82, (char)10}; - memcpy(test_msg->text, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->text) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0x10, 8738, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 8738); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)97, (char)99, (char)113, (char)58, (char)32, (char)80, - (char)82, (char)78, (char)32, (char)51, (char)49, (char)32, - (char)102, (char)111, (char)117, (char)110, (char)100, (char)32, - (char)64, (char)32, (char)52, (char)50, (char)52, (char)53, - (char)32, (char)72, (char)122, (char)44, (char)32, (char)50, - (char)49, (char)32, (char)83, (char)78, (char)82, (char)10}; - EXPECT_EQ(memcmp(last_msg_->text, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->text, expected string '" - << check_string << "', is '" << last_msg_->text << "'"; - } -} -class Test_legacy_auto_check_sbp_logging_MsgPrintDep2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_logging_MsgPrintDep2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_print_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_print_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_logging_MsgPrintDep2, Test) { - uint8_t encoded_frame[] = { - 85, 16, 0, 34, 34, 35, 73, 78, 70, 79, 58, 32, 68, 105, 115, - 97, 98, 108, 105, 110, 103, 32, 99, 104, 97, 110, 110, 101, 108, 32, - 48, 32, 40, 80, 82, 78, 32, 49, 49, 41, 10, 23, 143, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_print_dep_t *test_msg = (msg_print_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)68, (char)105, (char)115, (char)97, (char)98, (char)108, - (char)105, (char)110, (char)103, (char)32, (char)99, (char)104, - (char)97, (char)110, (char)110, (char)101, (char)108, (char)32, - (char)48, (char)32, (char)40, (char)80, (char)82, (char)78, - (char)32, (char)49, (char)49, (char)41, (char)10}; - memcpy(test_msg->text, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->text) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0x10, 8738, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 8738); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)68, (char)105, (char)115, (char)97, (char)98, (char)108, - (char)105, (char)110, (char)103, (char)32, (char)99, (char)104, - (char)97, (char)110, (char)110, (char)101, (char)108, (char)32, - (char)48, (char)32, (char)40, (char)80, (char)82, (char)78, - (char)32, (char)49, (char)49, (char)41, (char)10}; - EXPECT_EQ(memcmp(last_msg_->text, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->text, expected string '" - << check_string << "', is '" << last_msg_->text << "'"; - } -} -class Test_legacy_auto_check_sbp_logging_MsgPrintDep3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_logging_MsgPrintDep3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_print_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_print_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_logging_MsgPrintDep3, Test) { - uint8_t encoded_frame[] = { - 85, 16, 0, 34, 34, 41, 73, 78, 70, 79, 58, 32, 97, - 99, 113, 58, 32, 80, 82, 78, 32, 50, 32, 102, 111, 117, - 110, 100, 32, 64, 32, 51, 57, 57, 54, 32, 72, 122, 44, - 32, 50, 48, 32, 83, 78, 82, 10, 239, 48, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_print_dep_t *test_msg = (msg_print_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)97, (char)99, (char)113, (char)58, (char)32, (char)80, - (char)82, (char)78, (char)32, (char)50, (char)32, (char)102, - (char)111, (char)117, (char)110, (char)100, (char)32, (char)64, - (char)32, (char)51, (char)57, (char)57, (char)54, (char)32, - (char)72, (char)122, (char)44, (char)32, (char)50, (char)48, - (char)32, (char)83, (char)78, (char)82, (char)10}; - memcpy(test_msg->text, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->text) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0x10, 8738, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 8738); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)97, (char)99, (char)113, (char)58, (char)32, (char)80, - (char)82, (char)78, (char)32, (char)50, (char)32, (char)102, - (char)111, (char)117, (char)110, (char)100, (char)32, (char)64, - (char)32, (char)51, (char)57, (char)57, (char)54, (char)32, - (char)72, (char)122, (char)44, (char)32, (char)50, (char)48, - (char)32, (char)83, (char)78, (char)82, (char)10}; - EXPECT_EQ(memcmp(last_msg_->text, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->text, expected string '" - << check_string << "', is '" << last_msg_->text << "'"; - } -} -class Test_legacy_auto_check_sbp_logging_MsgPrintDep4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_logging_MsgPrintDep4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_print_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_print_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_logging_MsgPrintDep4, Test) { - uint8_t encoded_frame[] = { - 85, 16, 0, 34, 34, 42, 73, 78, 70, 79, 58, 32, 97, - 99, 113, 58, 32, 80, 82, 78, 32, 52, 32, 102, 111, 117, - 110, 100, 32, 64, 32, 45, 55, 52, 57, 50, 32, 72, 122, - 44, 32, 50, 48, 32, 83, 78, 82, 10, 47, 248, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_print_dep_t *test_msg = (msg_print_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)97, (char)99, (char)113, (char)58, (char)32, (char)80, - (char)82, (char)78, (char)32, (char)52, (char)32, (char)102, - (char)111, (char)117, (char)110, (char)100, (char)32, (char)64, - (char)32, (char)45, (char)55, (char)52, (char)57, (char)50, - (char)32, (char)72, (char)122, (char)44, (char)32, (char)50, - (char)48, (char)32, (char)83, (char)78, (char)82, (char)10}; - memcpy(test_msg->text, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->text) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0x10, 8738, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 8738); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)97, (char)99, (char)113, (char)58, (char)32, (char)80, - (char)82, (char)78, (char)32, (char)52, (char)32, (char)102, - (char)111, (char)117, (char)110, (char)100, (char)32, (char)64, - (char)32, (char)45, (char)55, (char)52, (char)57, (char)50, - (char)32, (char)72, (char)122, (char)44, (char)32, (char)50, - (char)48, (char)32, (char)83, (char)78, (char)82, (char)10}; - EXPECT_EQ(memcmp(last_msg_->text, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->text, expected string '" - << check_string << "', is '" << last_msg_->text << "'"; - } -} -class Test_legacy_auto_check_sbp_logging_MsgPrintDep5 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_logging_MsgPrintDep5() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_print_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_print_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_logging_MsgPrintDep5, Test) { - uint8_t encoded_frame[] = { - 85, 16, 0, 34, 34, 35, 73, 78, 70, 79, 58, 32, 68, 105, 115, - 97, 98, 108, 105, 110, 103, 32, 99, 104, 97, 110, 110, 101, 108, 32, - 49, 32, 40, 80, 82, 78, 32, 49, 53, 41, 10, 158, 139, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_print_dep_t *test_msg = (msg_print_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)68, (char)105, (char)115, (char)97, (char)98, (char)108, - (char)105, (char)110, (char)103, (char)32, (char)99, (char)104, - (char)97, (char)110, (char)110, (char)101, (char)108, (char)32, - (char)49, (char)32, (char)40, (char)80, (char)82, (char)78, - (char)32, (char)49, (char)53, (char)41, (char)10}; - memcpy(test_msg->text, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->text) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0x10, 8738, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 8738); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)73, (char)78, (char)70, (char)79, (char)58, (char)32, - (char)68, (char)105, (char)115, (char)97, (char)98, (char)108, - (char)105, (char)110, (char)103, (char)32, (char)99, (char)104, - (char)97, (char)110, (char)110, (char)101, (char)108, (char)32, - (char)49, (char)32, (char)40, (char)80, (char)82, (char)78, - (char)32, (char)49, (char)53, (char)41, (char)10}; - EXPECT_EQ(memcmp(last_msg_->text, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->text, expected string '" - << check_string << "', is '" << last_msg_->text << "'"; - } -} diff --git a/c/test/legacy/cpp/auto_check_sbp_mag_MsgMagRaw.cc b/c/test/legacy/cpp/auto_check_sbp_mag_MsgMagRaw.cc deleted file mode 100644 index 730348cdc3..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_mag_MsgMagRaw.cc +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/mag/test_MsgMagRaw.yaml by generate.py. Do not -// modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_mag_MsgMagRaw0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_mag_MsgMagRaw0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_mag_raw_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_mag_raw_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_mag_MsgMagRaw0, Test) { - uint8_t encoded_frame[] = { - 85, 2, 9, 195, 4, 11, 173, 227, 158, 198, - 206, 98, 3, 230, 2, 110, 229, 159, 23, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_mag_raw_t *test_msg = (msg_mag_raw_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->mag_x = 866; - test_msg->mag_y = 742; - test_msg->mag_z = -6802; - test_msg->tow = 3332301741; - test_msg->tow_f = 206; - - EXPECT_EQ(send_message(0x902, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asmag_x)>( - reinterpret_cast(&last_msg_->mag_x)), - 866) - << "incorrect value for mag_x, expected 866, is " << last_msg_->mag_x; - EXPECT_EQ(get_asmag_y)>( - reinterpret_cast(&last_msg_->mag_y)), - 742) - << "incorrect value for mag_y, expected 742, is " << last_msg_->mag_y; - EXPECT_EQ(get_asmag_z)>( - reinterpret_cast(&last_msg_->mag_z)), - -6802) - << "incorrect value for mag_z, expected -6802, is " << last_msg_->mag_z; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 3332301741) - << "incorrect value for tow, expected 3332301741, is " << last_msg_->tow; - EXPECT_EQ(get_astow_f)>( - reinterpret_cast(&last_msg_->tow_f)), - 206) - << "incorrect value for tow_f, expected 206, is " << last_msg_->tow_f; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgAgeCorrections.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgAgeCorrections.cc deleted file mode 100644 index e104128991..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgAgeCorrections.cc +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgAgeCorrections.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgAgeCorrections0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgAgeCorrections0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_age_corrections_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_age_corrections_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgAgeCorrections0, Test) { - uint8_t encoded_frame[] = { - 85, 16, 2, 66, 0, 6, 100, 0, 0, 0, 30, 0, 233, 202, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_age_corrections_t *test_msg = (msg_age_corrections_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->age = 30; - test_msg->tow = 100; - - EXPECT_EQ(send_message(0x210, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asage)>( - reinterpret_cast(&last_msg_->age)), - 30) - << "incorrect value for age, expected 30, is " << last_msg_->age; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 100) - << "incorrect value for tow, expected 100, is " << last_msg_->tow; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgBaselineECEF.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgBaselineECEF.cc deleted file mode 100644 index e1a9f39c25..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgBaselineECEF.cc +++ /dev/null @@ -1,623 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgBaselineECEF.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineECEF0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineECEF0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ecef_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ecef_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineECEF0, Test) { - uint8_t encoded_frame[] = { - 85, 11, 2, 211, 136, 20, 40, 244, 122, 19, 150, 98, 238, 255, - 190, 64, 20, 0, 246, 163, 9, 0, 0, 0, 14, 0, 219, 191, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ecef_t *test_msg = (msg_baseline_ecef_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 14; - test_msg->tow = 326825000; - test_msg->x = -1154410; - test_msg->y = 1327294; - test_msg->z = 631798; - - EXPECT_EQ(send_message(0x20b, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 14) - << "incorrect value for n_sats, expected 14, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326825000) - << "incorrect value for tow, expected 326825000, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -1154410) - << "incorrect value for x, expected -1154410, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - 1327294) - << "incorrect value for y, expected 1327294, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 631798) - << "incorrect value for z, expected 631798, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineECEF1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineECEF1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ecef_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ecef_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineECEF1, Test) { - uint8_t encoded_frame[] = { - 85, 11, 2, 211, 136, 20, 16, 248, 122, 19, 72, 99, 238, 255, - 191, 65, 20, 0, 138, 162, 9, 0, 0, 0, 15, 0, 240, 78, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ecef_t *test_msg = (msg_baseline_ecef_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 15; - test_msg->tow = 326826000; - test_msg->x = -1154232; - test_msg->y = 1327551; - test_msg->z = 631434; - - EXPECT_EQ(send_message(0x20b, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326826000) - << "incorrect value for tow, expected 326826000, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -1154232) - << "incorrect value for x, expected -1154232, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - 1327551) - << "incorrect value for y, expected 1327551, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 631434) - << "incorrect value for z, expected 631434, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineECEF2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineECEF2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ecef_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ecef_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineECEF2, Test) { - uint8_t encoded_frame[] = { - 85, 11, 2, 211, 136, 20, 248, 251, 122, 19, 41, 99, 238, 255, - 181, 65, 20, 0, 148, 161, 9, 0, 0, 0, 15, 0, 4, 132, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ecef_t *test_msg = (msg_baseline_ecef_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 15; - test_msg->tow = 326827000; - test_msg->x = -1154263; - test_msg->y = 1327541; - test_msg->z = 631188; - - EXPECT_EQ(send_message(0x20b, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326827000) - << "incorrect value for tow, expected 326827000, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -1154263) - << "incorrect value for x, expected -1154263, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - 1327541) - << "incorrect value for y, expected 1327541, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 631188) - << "incorrect value for z, expected 631188, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineECEF3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineECEF3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ecef_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ecef_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineECEF3, Test) { - uint8_t encoded_frame[] = { - 85, 11, 2, 211, 136, 20, 224, 255, 122, 19, 188, 97, 238, 255, - 81, 64, 20, 0, 65, 160, 9, 0, 0, 0, 15, 0, 67, 94, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ecef_t *test_msg = (msg_baseline_ecef_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 15; - test_msg->tow = 326828000; - test_msg->x = -1154628; - test_msg->y = 1327185; - test_msg->z = 630849; - - EXPECT_EQ(send_message(0x20b, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326828000) - << "incorrect value for tow, expected 326828000, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -1154628) - << "incorrect value for x, expected -1154628, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - 1327185) - << "incorrect value for y, expected 1327185, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 630849) - << "incorrect value for z, expected 630849, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineECEF4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineECEF4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ecef_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ecef_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineECEF4, Test) { - uint8_t encoded_frame[] = { - 85, 11, 2, 211, 136, 20, 200, 3, 123, 19, 189, 96, 238, 255, - 93, 63, 20, 0, 98, 159, 9, 0, 0, 0, 15, 0, 106, 94, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ecef_t *test_msg = (msg_baseline_ecef_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 15; - test_msg->tow = 326829000; - test_msg->x = -1154883; - test_msg->y = 1326941; - test_msg->z = 630626; - - EXPECT_EQ(send_message(0x20b, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326829000) - << "incorrect value for tow, expected 326829000, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -1154883) - << "incorrect value for x, expected -1154883, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - 1326941) - << "incorrect value for y, expected 1326941, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 630626) - << "incorrect value for z, expected 630626, is " << last_msg_->z; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgBaselineECEFDepA.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgBaselineECEFDepA.cc deleted file mode 100644 index 22ce33c165..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgBaselineECEFDepA.cc +++ /dev/null @@ -1,1347 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgBaselineECEFDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 2, 2, 246, 215, 20, 20, 46, 39, 0, 21, 48, 255, 255, - 52, 117, 255, 255, 216, 211, 254, 255, 0, 0, 9, 1, 50, 137, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ecef_dep_a_t *test_msg = - (msg_baseline_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 1; - test_msg->n_sats = 9; - test_msg->tow = 2567700; - test_msg->x = -53227; - test_msg->y = -35532; - test_msg->z = -76840; - - EXPECT_EQ(send_message(0x202, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567700) - << "incorrect value for tow, expected 2567700, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -53227) - << "incorrect value for x, expected -53227, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -35532) - << "incorrect value for y, expected -35532, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - -76840) - << "incorrect value for z, expected -76840, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA1, Test) { - uint8_t encoded_frame[] = { - 85, 2, 2, 246, 215, 20, 120, 46, 39, 0, 58, 49, 255, 255, - 49, 116, 255, 255, 134, 211, 254, 255, 0, 0, 9, 1, 227, 155, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ecef_dep_a_t *test_msg = - (msg_baseline_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 1; - test_msg->n_sats = 9; - test_msg->tow = 2567800; - test_msg->x = -52934; - test_msg->y = -35791; - test_msg->z = -76922; - - EXPECT_EQ(send_message(0x202, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567800) - << "incorrect value for tow, expected 2567800, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -52934) - << "incorrect value for x, expected -52934, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -35791) - << "incorrect value for y, expected -35791, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - -76922) - << "incorrect value for z, expected -76922, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA2, Test) { - uint8_t encoded_frame[] = { - 85, 2, 2, 246, 215, 20, 220, 46, 39, 0, 97, 50, 255, 255, - 47, 115, 255, 255, 52, 211, 254, 255, 0, 0, 9, 1, 61, 126, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ecef_dep_a_t *test_msg = - (msg_baseline_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 1; - test_msg->n_sats = 9; - test_msg->tow = 2567900; - test_msg->x = -52639; - test_msg->y = -36049; - test_msg->z = -77004; - - EXPECT_EQ(send_message(0x202, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567900) - << "incorrect value for tow, expected 2567900, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -52639) - << "incorrect value for x, expected -52639, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -36049) - << "incorrect value for y, expected -36049, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - -77004) - << "incorrect value for z, expected -77004, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA3, Test) { - uint8_t encoded_frame[] = { - 85, 2, 2, 246, 215, 20, 64, 47, 39, 0, 136, 51, 255, 255, - 45, 114, 255, 255, 228, 210, 254, 255, 0, 0, 9, 1, 200, 79, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ecef_dep_a_t *test_msg = - (msg_baseline_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 1; - test_msg->n_sats = 9; - test_msg->tow = 2568000; - test_msg->x = -52344; - test_msg->y = -36307; - test_msg->z = -77084; - - EXPECT_EQ(send_message(0x202, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2568000) - << "incorrect value for tow, expected 2568000, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -52344) - << "incorrect value for x, expected -52344, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -36307) - << "incorrect value for y, expected -36307, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - -77084) - << "incorrect value for z, expected -77084, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA4, Test) { - uint8_t encoded_frame[] = { - 85, 2, 2, 246, 215, 20, 164, 47, 39, 0, 176, 52, 255, 255, - 44, 113, 255, 255, 149, 210, 254, 255, 0, 0, 9, 1, 104, 24, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ecef_dep_a_t *test_msg = - (msg_baseline_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 1; - test_msg->n_sats = 9; - test_msg->tow = 2568100; - test_msg->x = -52048; - test_msg->y = -36564; - test_msg->z = -77163; - - EXPECT_EQ(send_message(0x202, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2568100) - << "incorrect value for tow, expected 2568100, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -52048) - << "incorrect value for x, expected -52048, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -36564) - << "incorrect value for y, expected -36564, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - -77163) - << "incorrect value for z, expected -77163, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA5 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA5() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA5, Test) { - uint8_t encoded_frame[] = { - 85, 2, 2, 195, 4, 20, 156, 21, 69, 24, 169, 231, 255, 255, - 102, 208, 255, 255, 251, 28, 0, 0, 0, 0, 6, 0, 146, 168, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ecef_dep_a_t *test_msg = - (msg_baseline_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 6; - test_msg->tow = 407180700; - test_msg->x = -6231; - test_msg->y = -12186; - test_msg->z = 7419; - - EXPECT_EQ(send_message(0x202, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 6) - << "incorrect value for n_sats, expected 6, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407180700) - << "incorrect value for tow, expected 407180700, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -6231) - << "incorrect value for x, expected -6231, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -12186) - << "incorrect value for y, expected -12186, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 7419) - << "incorrect value for z, expected 7419, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA6 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA6() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA6, Test) { - uint8_t encoded_frame[] = { - 85, 2, 2, 195, 4, 20, 0, 22, 69, 24, 169, 231, 255, 255, - 103, 208, 255, 255, 252, 28, 0, 0, 0, 0, 6, 0, 34, 116, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ecef_dep_a_t *test_msg = - (msg_baseline_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 6; - test_msg->tow = 407180800; - test_msg->x = -6231; - test_msg->y = -12185; - test_msg->z = 7420; - - EXPECT_EQ(send_message(0x202, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 6) - << "incorrect value for n_sats, expected 6, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407180800) - << "incorrect value for tow, expected 407180800, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -6231) - << "incorrect value for x, expected -6231, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -12185) - << "incorrect value for y, expected -12185, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 7420) - << "incorrect value for z, expected 7420, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA7 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA7() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA7, Test) { - uint8_t encoded_frame[] = { - 85, 2, 2, 195, 4, 20, 100, 22, 69, 24, 30, 224, 255, 255, - 192, 183, 255, 255, 239, 53, 0, 0, 0, 0, 6, 0, 225, 15, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ecef_dep_a_t *test_msg = - (msg_baseline_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 6; - test_msg->tow = 407180900; - test_msg->x = -8162; - test_msg->y = -18496; - test_msg->z = 13807; - - EXPECT_EQ(send_message(0x202, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 6) - << "incorrect value for n_sats, expected 6, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407180900) - << "incorrect value for tow, expected 407180900, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -8162) - << "incorrect value for x, expected -8162, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -18496) - << "incorrect value for y, expected -18496, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 13807) - << "incorrect value for z, expected 13807, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA8 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA8() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA8, Test) { - uint8_t encoded_frame[] = { - 85, 2, 2, 195, 4, 20, 200, 22, 69, 24, 28, 224, 255, 255, - 191, 183, 255, 255, 242, 53, 0, 0, 0, 0, 6, 0, 35, 100, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ecef_dep_a_t *test_msg = - (msg_baseline_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 6; - test_msg->tow = 407181000; - test_msg->x = -8164; - test_msg->y = -18497; - test_msg->z = 13810; - - EXPECT_EQ(send_message(0x202, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 6) - << "incorrect value for n_sats, expected 6, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407181000) - << "incorrect value for tow, expected 407181000, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -8164) - << "incorrect value for x, expected -8164, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -18497) - << "incorrect value for y, expected -18497, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 13810) - << "incorrect value for z, expected 13810, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA9 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA9() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA9, Test) { - uint8_t encoded_frame[] = { - 85, 2, 2, 195, 4, 20, 44, 23, 69, 24, 24, 227, 255, 255, - 25, 195, 255, 255, 153, 59, 0, 0, 0, 0, 6, 0, 66, 66, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ecef_dep_a_t *test_msg = - (msg_baseline_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 6; - test_msg->tow = 407181100; - test_msg->x = -7400; - test_msg->y = -15591; - test_msg->z = 15257; - - EXPECT_EQ(send_message(0x202, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 6) - << "incorrect value for n_sats, expected 6, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407181100) - << "incorrect value for tow, expected 407181100, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -7400) - << "incorrect value for x, expected -7400, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -15591) - << "incorrect value for y, expected -15591, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 15257) - << "incorrect value for z, expected 15257, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA10 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA10() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineECEFDepA10, Test) { - uint8_t encoded_frame[] = { - 85, 2, 2, 195, 4, 20, 144, 23, 69, 24, 23, 227, 255, 255, - 25, 195, 255, 255, 153, 59, 0, 0, 0, 0, 6, 0, 35, 135, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ecef_dep_a_t *test_msg = - (msg_baseline_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 6; - test_msg->tow = 407181200; - test_msg->x = -7401; - test_msg->y = -15591; - test_msg->z = 15257; - - EXPECT_EQ(send_message(0x202, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 6) - << "incorrect value for n_sats, expected 6, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407181200) - << "incorrect value for tow, expected 407181200, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -7401) - << "incorrect value for x, expected -7401, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -15591) - << "incorrect value for y, expected -15591, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 15257) - << "incorrect value for z, expected 15257, is " << last_msg_->z; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgBaselineHeadingDepA.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgBaselineHeadingDepA.cc deleted file mode 100644 index b4c2ea7153..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgBaselineHeadingDepA.cc +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgBaselineHeadingDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineHeadingDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineHeadingDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_heading_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_heading_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineHeadingDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 7, 2, 124, 206, 10, 82, 109, 88, - 176, 68, 14, 82, 203, 186, 58, 173, 182, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_heading_dep_a_t *test_msg = - (msg_baseline_heading_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 58; - test_msg->heading = 3411152452; - test_msg->n_sats = 186; - test_msg->tow = 2958585170; - - EXPECT_EQ(send_message(0x207, 52860, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 52860); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 58) - << "incorrect value for flags, expected 58, is " << last_msg_->flags; - EXPECT_EQ(get_asheading)>( - reinterpret_cast(&last_msg_->heading)), - 3411152452) - << "incorrect value for heading, expected 3411152452, is " - << last_msg_->heading; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 186) - << "incorrect value for n_sats, expected 186, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2958585170) - << "incorrect value for tow, expected 2958585170, is " << last_msg_->tow; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgBaselineNED.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgBaselineNED.cc deleted file mode 100644 index 3412e31686..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgBaselineNED.cc +++ /dev/null @@ -1,658 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgBaselineNED.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineNED0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineNED0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ned_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ned_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineNED0, Test) { - uint8_t encoded_frame[] = { - 85, 12, 2, 211, 136, 22, 40, 244, 122, 19, 201, 115, 12, 0, 179, - 88, 230, 255, 153, 125, 0, 0, 0, 0, 0, 0, 14, 0, 226, 70, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ned_t *test_msg = (msg_baseline_ned_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = 32153; - test_msg->e = -1681229; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 816073; - test_msg->n_sats = 14; - test_msg->tow = 326825000; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x20c, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 32153) - << "incorrect value for d, expected 32153, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - -1681229) - << "incorrect value for e, expected -1681229, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - 816073) - << "incorrect value for n, expected 816073, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 14) - << "incorrect value for n_sats, expected 14, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326825000) - << "incorrect value for tow, expected 326825000, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineNED1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineNED1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ned_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ned_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineNED1, Test) { - uint8_t encoded_frame[] = { - 85, 12, 2, 211, 136, 22, 16, 248, 122, 19, 98, 115, 12, 0, 194, - 88, 230, 255, 110, 127, 0, 0, 0, 0, 0, 0, 15, 0, 69, 93, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ned_t *test_msg = (msg_baseline_ned_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = 32622; - test_msg->e = -1681214; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 815970; - test_msg->n_sats = 15; - test_msg->tow = 326826000; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x20c, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 32622) - << "incorrect value for d, expected 32622, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - -1681214) - << "incorrect value for e, expected -1681214, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - 815970) - << "incorrect value for n, expected 815970, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326826000) - << "incorrect value for tow, expected 326826000, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineNED2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineNED2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ned_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ned_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineNED2, Test) { - uint8_t encoded_frame[] = { - 85, 12, 2, 211, 136, 22, 248, 251, 122, 19, 143, 114, 12, 0, 173, - 88, 230, 255, 238, 127, 0, 0, 0, 0, 0, 0, 15, 0, 210, 169, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ned_t *test_msg = (msg_baseline_ned_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = 32750; - test_msg->e = -1681235; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 815759; - test_msg->n_sats = 15; - test_msg->tow = 326827000; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x20c, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 32750) - << "incorrect value for d, expected 32750, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - -1681235) - << "incorrect value for e, expected -1681235, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - 815759) - << "incorrect value for n, expected 815759, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326827000) - << "incorrect value for tow, expected 326827000, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineNED3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineNED3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ned_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ned_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineNED3, Test) { - uint8_t encoded_frame[] = { - 85, 12, 2, 211, 136, 22, 224, 255, 122, 19, 86, 112, 12, 0, 51, - 88, 230, 255, 47, 127, 0, 0, 0, 0, 0, 0, 15, 0, 135, 107, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ned_t *test_msg = (msg_baseline_ned_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = 32559; - test_msg->e = -1681357; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 815190; - test_msg->n_sats = 15; - test_msg->tow = 326828000; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x20c, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 32559) - << "incorrect value for d, expected 32559, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - -1681357) - << "incorrect value for e, expected -1681357, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - 815190) - << "incorrect value for n, expected 815190, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326828000) - << "incorrect value for tow, expected 326828000, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineNED4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineNED4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ned_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ned_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineNED4, Test) { - uint8_t encoded_frame[] = { - 85, 12, 2, 211, 136, 22, 200, 3, 123, 19, 214, 110, 12, 0, 220, - 87, 230, 255, 165, 126, 0, 0, 0, 0, 0, 0, 15, 0, 190, 80, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ned_t *test_msg = (msg_baseline_ned_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = 32421; - test_msg->e = -1681444; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 814806; - test_msg->n_sats = 15; - test_msg->tow = 326829000; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x20c, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 32421) - << "incorrect value for d, expected 32421, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - -1681444) - << "incorrect value for e, expected -1681444, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - 814806) - << "incorrect value for n, expected 814806, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326829000) - << "incorrect value for tow, expected 326829000, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgBaselineNEDDepA.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgBaselineNEDDepA.cc deleted file mode 100644 index e89e41ba31..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgBaselineNEDDepA.cc +++ /dev/null @@ -1,1424 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgBaselineNEDDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 3, 2, 246, 215, 22, 20, 46, 39, 0, 243, 134, 254, 255, 234, - 153, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 93, 193, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ned_dep_a_t *test_msg = - (msg_baseline_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = -26134; - test_msg->flags = 1; - test_msg->h_accuracy = 0; - test_msg->n = -96525; - test_msg->n_sats = 9; - test_msg->tow = 2567700; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x203, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 0) - << "incorrect value for d, expected 0, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - -26134) - << "incorrect value for e, expected -26134, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -96525) - << "incorrect value for n, expected -96525, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567700) - << "incorrect value for tow, expected 2567700, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA1, Test) { - uint8_t encoded_frame[] = { - 85, 3, 2, 246, 215, 22, 120, 46, 39, 0, 139, 134, 254, 255, 109, - 155, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 38, 39, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ned_dep_a_t *test_msg = - (msg_baseline_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = -25747; - test_msg->flags = 1; - test_msg->h_accuracy = 0; - test_msg->n = -96629; - test_msg->n_sats = 9; - test_msg->tow = 2567800; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x203, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 0) - << "incorrect value for d, expected 0, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - -25747) - << "incorrect value for e, expected -25747, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -96629) - << "incorrect value for n, expected -96629, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567800) - << "incorrect value for tow, expected 2567800, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA2, Test) { - uint8_t encoded_frame[] = { - 85, 3, 2, 246, 215, 22, 220, 46, 39, 0, 37, 134, 254, 255, 240, - 156, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 58, 133, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ned_dep_a_t *test_msg = - (msg_baseline_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = -25360; - test_msg->flags = 1; - test_msg->h_accuracy = 0; - test_msg->n = -96731; - test_msg->n_sats = 9; - test_msg->tow = 2567900; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x203, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 0) - << "incorrect value for d, expected 0, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - -25360) - << "incorrect value for e, expected -25360, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -96731) - << "incorrect value for n, expected -96731, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567900) - << "incorrect value for tow, expected 2567900, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA3, Test) { - uint8_t encoded_frame[] = { - 85, 3, 2, 246, 215, 22, 64, 47, 39, 0, 193, 133, 254, 255, 115, - 158, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 56, 214, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ned_dep_a_t *test_msg = - (msg_baseline_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = -24973; - test_msg->flags = 1; - test_msg->h_accuracy = 0; - test_msg->n = -96831; - test_msg->n_sats = 9; - test_msg->tow = 2568000; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x203, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 0) - << "incorrect value for d, expected 0, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - -24973) - << "incorrect value for e, expected -24973, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -96831) - << "incorrect value for n, expected -96831, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2568000) - << "incorrect value for tow, expected 2568000, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA4, Test) { - uint8_t encoded_frame[] = { - 85, 3, 2, 246, 215, 22, 164, 47, 39, 0, 93, 133, 254, 255, 246, - 159, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 234, 244, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ned_dep_a_t *test_msg = - (msg_baseline_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = -24586; - test_msg->flags = 1; - test_msg->h_accuracy = 0; - test_msg->n = -96931; - test_msg->n_sats = 9; - test_msg->tow = 2568100; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x203, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 0) - << "incorrect value for d, expected 0, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - -24586) - << "incorrect value for e, expected -24586, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -96931) - << "incorrect value for n, expected -96931, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2568100) - << "incorrect value for tow, expected 2568100, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA5 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA5() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA5, Test) { - uint8_t encoded_frame[] = { - 85, 3, 2, 195, 4, 22, 156, 21, 69, 24, 130, 246, 255, 255, 241, - 4, 0, 0, 35, 196, 255, 255, 0, 0, 0, 0, 6, 0, 250, 21, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ned_dep_a_t *test_msg = - (msg_baseline_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = -15325; - test_msg->e = 1265; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -2430; - test_msg->n_sats = 6; - test_msg->tow = 407180700; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x203, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - -15325) - << "incorrect value for d, expected -15325, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 1265) - << "incorrect value for e, expected 1265, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -2430) - << "incorrect value for n, expected -2430, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 6) - << "incorrect value for n_sats, expected 6, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407180700) - << "incorrect value for tow, expected 407180700, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA6 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA6() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA6, Test) { - uint8_t encoded_frame[] = { - 85, 3, 2, 195, 4, 22, 0, 22, 69, 24, 130, 246, 255, 255, 241, - 4, 0, 0, 35, 196, 255, 255, 0, 0, 0, 0, 6, 0, 240, 133, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ned_dep_a_t *test_msg = - (msg_baseline_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = -15325; - test_msg->e = 1265; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -2430; - test_msg->n_sats = 6; - test_msg->tow = 407180800; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x203, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - -15325) - << "incorrect value for d, expected -15325, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 1265) - << "incorrect value for e, expected 1265, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -2430) - << "incorrect value for n, expected -2430, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 6) - << "incorrect value for n_sats, expected 6, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407180800) - << "incorrect value for tow, expected 407180800, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA7 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA7() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA7, Test) { - uint8_t encoded_frame[] = { - 85, 3, 2, 195, 4, 22, 100, 22, 69, 24, 32, 251, 255, 255, 199, - 11, 0, 0, 57, 161, 255, 255, 0, 0, 0, 0, 6, 0, 12, 181, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ned_dep_a_t *test_msg = - (msg_baseline_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = -24263; - test_msg->e = 3015; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -1248; - test_msg->n_sats = 6; - test_msg->tow = 407180900; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x203, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - -24263) - << "incorrect value for d, expected -24263, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 3015) - << "incorrect value for e, expected 3015, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -1248) - << "incorrect value for n, expected -1248, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 6) - << "incorrect value for n_sats, expected 6, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407180900) - << "incorrect value for tow, expected 407180900, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA8 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA8() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA8, Test) { - uint8_t encoded_frame[] = { - 85, 3, 2, 195, 4, 22, 200, 22, 69, 24, 33, 251, 255, 255, 199, - 11, 0, 0, 54, 161, 255, 255, 0, 0, 0, 0, 6, 0, 86, 58, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ned_dep_a_t *test_msg = - (msg_baseline_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = -24266; - test_msg->e = 3015; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -1247; - test_msg->n_sats = 6; - test_msg->tow = 407181000; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x203, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - -24266) - << "incorrect value for d, expected -24266, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 3015) - << "incorrect value for e, expected 3015, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -1247) - << "incorrect value for n, expected -1247, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 6) - << "incorrect value for n_sats, expected 6, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407181000) - << "incorrect value for tow, expected 407181000, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA9 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA9() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA9, Test) { - uint8_t encoded_frame[] = { - 85, 3, 2, 195, 4, 22, 44, 23, 69, 24, 110, 6, 0, 0, 55, - 8, 0, 0, 160, 166, 255, 255, 0, 0, 0, 0, 6, 0, 51, 249, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ned_dep_a_t *test_msg = - (msg_baseline_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = -22880; - test_msg->e = 2103; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 1646; - test_msg->n_sats = 6; - test_msg->tow = 407181100; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x203, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - -22880) - << "incorrect value for d, expected -22880, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 2103) - << "incorrect value for e, expected 2103, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - 1646) - << "incorrect value for n, expected 1646, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 6) - << "incorrect value for n_sats, expected 6, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407181100) - << "incorrect value for tow, expected 407181100, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA10 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA10() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgBaselineNEDDepA10, Test) { - uint8_t encoded_frame[] = { - 85, 3, 2, 195, 4, 22, 144, 23, 69, 24, 110, 6, 0, 0, 54, - 8, 0, 0, 160, 166, 255, 255, 0, 0, 0, 0, 6, 0, 206, 22, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_ned_dep_a_t *test_msg = - (msg_baseline_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = -22880; - test_msg->e = 2102; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 1646; - test_msg->n_sats = 6; - test_msg->tow = 407181200; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x203, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - -22880) - << "incorrect value for d, expected -22880, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 2102) - << "incorrect value for e, expected 2102, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - 1646) - << "incorrect value for n, expected 1646, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 6) - << "incorrect value for n_sats, expected 6, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407181200) - << "incorrect value for tow, expected 407181200, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgDops.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgDops.cc deleted file mode 100644 index 3b41aee6f2..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgDops.cc +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgDops.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgDops0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgDops0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_dops_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_dops_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgDops0, Test) { - uint8_t encoded_frame[] = { - 85, 8, 2, 66, 0, 15, 100, 0, 0, 0, 2, 0, - 6, 0, 5, 0, 5, 0, 5, 0, 0, 244, 4, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_dops_t *test_msg = (msg_dops_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->gdop = 2; - test_msg->hdop = 5; - test_msg->pdop = 6; - test_msg->tdop = 5; - test_msg->tow = 100; - test_msg->vdop = 5; - - EXPECT_EQ(send_message(0x208, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asgdop)>( - reinterpret_cast(&last_msg_->gdop)), - 2) - << "incorrect value for gdop, expected 2, is " << last_msg_->gdop; - EXPECT_EQ(get_ashdop)>( - reinterpret_cast(&last_msg_->hdop)), - 5) - << "incorrect value for hdop, expected 5, is " << last_msg_->hdop; - EXPECT_EQ(get_aspdop)>( - reinterpret_cast(&last_msg_->pdop)), - 6) - << "incorrect value for pdop, expected 6, is " << last_msg_->pdop; - EXPECT_EQ(get_astdop)>( - reinterpret_cast(&last_msg_->tdop)), - 5) - << "incorrect value for tdop, expected 5, is " << last_msg_->tdop; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 100) - << "incorrect value for tow, expected 100, is " << last_msg_->tow; - EXPECT_EQ(get_asvdop)>( - reinterpret_cast(&last_msg_->vdop)), - 5) - << "incorrect value for vdop, expected 5, is " << last_msg_->vdop; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgDopsDepA.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgDopsDepA.cc deleted file mode 100644 index 7dbecc3c3f..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgDopsDepA.cc +++ /dev/null @@ -1,1046 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgDopsDepA.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgDopsDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgDopsDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_dops_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_dops_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgDopsDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 6, 2, 246, 215, 14, 8, 48, 39, 0, 180, - 0, 190, 0, 170, 0, 160, 0, 150, 0, 121, 170, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_dops_dep_a_t *test_msg = (msg_dops_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->gdop = 180; - test_msg->hdop = 160; - test_msg->pdop = 190; - test_msg->tdop = 170; - test_msg->tow = 2568200; - test_msg->vdop = 150; - - EXPECT_EQ(send_message(0x206, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asgdop)>( - reinterpret_cast(&last_msg_->gdop)), - 180) - << "incorrect value for gdop, expected 180, is " << last_msg_->gdop; - EXPECT_EQ(get_ashdop)>( - reinterpret_cast(&last_msg_->hdop)), - 160) - << "incorrect value for hdop, expected 160, is " << last_msg_->hdop; - EXPECT_EQ(get_aspdop)>( - reinterpret_cast(&last_msg_->pdop)), - 190) - << "incorrect value for pdop, expected 190, is " << last_msg_->pdop; - EXPECT_EQ(get_astdop)>( - reinterpret_cast(&last_msg_->tdop)), - 170) - << "incorrect value for tdop, expected 170, is " << last_msg_->tdop; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2568200) - << "incorrect value for tow, expected 2568200, is " << last_msg_->tow; - EXPECT_EQ(get_asvdop)>( - reinterpret_cast(&last_msg_->vdop)), - 150) - << "incorrect value for vdop, expected 150, is " << last_msg_->vdop; -} -class Test_legacy_auto_check_sbp_navigation_MsgDopsDepA1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgDopsDepA1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_dops_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_dops_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgDopsDepA1, Test) { - uint8_t encoded_frame[] = { - 85, 6, 2, 246, 215, 14, 240, 51, 39, 0, 180, - 0, 190, 0, 170, 0, 160, 0, 150, 0, 78, 169, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_dops_dep_a_t *test_msg = (msg_dops_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->gdop = 180; - test_msg->hdop = 160; - test_msg->pdop = 190; - test_msg->tdop = 170; - test_msg->tow = 2569200; - test_msg->vdop = 150; - - EXPECT_EQ(send_message(0x206, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asgdop)>( - reinterpret_cast(&last_msg_->gdop)), - 180) - << "incorrect value for gdop, expected 180, is " << last_msg_->gdop; - EXPECT_EQ(get_ashdop)>( - reinterpret_cast(&last_msg_->hdop)), - 160) - << "incorrect value for hdop, expected 160, is " << last_msg_->hdop; - EXPECT_EQ(get_aspdop)>( - reinterpret_cast(&last_msg_->pdop)), - 190) - << "incorrect value for pdop, expected 190, is " << last_msg_->pdop; - EXPECT_EQ(get_astdop)>( - reinterpret_cast(&last_msg_->tdop)), - 170) - << "incorrect value for tdop, expected 170, is " << last_msg_->tdop; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2569200) - << "incorrect value for tow, expected 2569200, is " << last_msg_->tow; - EXPECT_EQ(get_asvdop)>( - reinterpret_cast(&last_msg_->vdop)), - 150) - << "incorrect value for vdop, expected 150, is " << last_msg_->vdop; -} -class Test_legacy_auto_check_sbp_navigation_MsgDopsDepA2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgDopsDepA2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_dops_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_dops_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgDopsDepA2, Test) { - uint8_t encoded_frame[] = { - 85, 6, 2, 246, 215, 14, 216, 55, 39, 0, 180, - 0, 190, 0, 170, 0, 160, 0, 150, 0, 71, 218, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_dops_dep_a_t *test_msg = (msg_dops_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->gdop = 180; - test_msg->hdop = 160; - test_msg->pdop = 190; - test_msg->tdop = 170; - test_msg->tow = 2570200; - test_msg->vdop = 150; - - EXPECT_EQ(send_message(0x206, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asgdop)>( - reinterpret_cast(&last_msg_->gdop)), - 180) - << "incorrect value for gdop, expected 180, is " << last_msg_->gdop; - EXPECT_EQ(get_ashdop)>( - reinterpret_cast(&last_msg_->hdop)), - 160) - << "incorrect value for hdop, expected 160, is " << last_msg_->hdop; - EXPECT_EQ(get_aspdop)>( - reinterpret_cast(&last_msg_->pdop)), - 190) - << "incorrect value for pdop, expected 190, is " << last_msg_->pdop; - EXPECT_EQ(get_astdop)>( - reinterpret_cast(&last_msg_->tdop)), - 170) - << "incorrect value for tdop, expected 170, is " << last_msg_->tdop; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2570200) - << "incorrect value for tow, expected 2570200, is " << last_msg_->tow; - EXPECT_EQ(get_asvdop)>( - reinterpret_cast(&last_msg_->vdop)), - 150) - << "incorrect value for vdop, expected 150, is " << last_msg_->vdop; -} -class Test_legacy_auto_check_sbp_navigation_MsgDopsDepA3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgDopsDepA3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_dops_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_dops_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgDopsDepA3, Test) { - uint8_t encoded_frame[] = { - 85, 6, 2, 195, 4, 14, 212, 157, 67, 24, 247, - 0, 215, 0, 123, 0, 17, 1, 44, 0, 206, 21, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_dops_dep_a_t *test_msg = (msg_dops_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->gdop = 247; - test_msg->hdop = 273; - test_msg->pdop = 215; - test_msg->tdop = 123; - test_msg->tow = 407084500; - test_msg->vdop = 44; - - EXPECT_EQ(send_message(0x206, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asgdop)>( - reinterpret_cast(&last_msg_->gdop)), - 247) - << "incorrect value for gdop, expected 247, is " << last_msg_->gdop; - EXPECT_EQ(get_ashdop)>( - reinterpret_cast(&last_msg_->hdop)), - 273) - << "incorrect value for hdop, expected 273, is " << last_msg_->hdop; - EXPECT_EQ(get_aspdop)>( - reinterpret_cast(&last_msg_->pdop)), - 215) - << "incorrect value for pdop, expected 215, is " << last_msg_->pdop; - EXPECT_EQ(get_astdop)>( - reinterpret_cast(&last_msg_->tdop)), - 123) - << "incorrect value for tdop, expected 123, is " << last_msg_->tdop; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084500) - << "incorrect value for tow, expected 407084500, is " << last_msg_->tow; - EXPECT_EQ(get_asvdop)>( - reinterpret_cast(&last_msg_->vdop)), - 44) - << "incorrect value for vdop, expected 44, is " << last_msg_->vdop; -} -class Test_legacy_auto_check_sbp_navigation_MsgDopsDepA4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgDopsDepA4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_dops_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_dops_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgDopsDepA4, Test) { - uint8_t encoded_frame[] = { - 85, 6, 2, 195, 4, 14, 0, 0, 0, 0, 255, - 255, 255, 255, 0, 0, 0, 0, 0, 0, 146, 12, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_dops_dep_a_t *test_msg = (msg_dops_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->gdop = 65535; - test_msg->hdop = 0; - test_msg->pdop = 65535; - test_msg->tdop = 0; - test_msg->tow = 0; - test_msg->vdop = 0; - - EXPECT_EQ(send_message(0x206, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asgdop)>( - reinterpret_cast(&last_msg_->gdop)), - 65535) - << "incorrect value for gdop, expected 65535, is " << last_msg_->gdop; - EXPECT_EQ(get_ashdop)>( - reinterpret_cast(&last_msg_->hdop)), - 0) - << "incorrect value for hdop, expected 0, is " << last_msg_->hdop; - EXPECT_EQ(get_aspdop)>( - reinterpret_cast(&last_msg_->pdop)), - 65535) - << "incorrect value for pdop, expected 65535, is " << last_msg_->pdop; - EXPECT_EQ(get_astdop)>( - reinterpret_cast(&last_msg_->tdop)), - 0) - << "incorrect value for tdop, expected 0, is " << last_msg_->tdop; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 0) - << "incorrect value for tow, expected 0, is " << last_msg_->tow; - EXPECT_EQ(get_asvdop)>( - reinterpret_cast(&last_msg_->vdop)), - 0) - << "incorrect value for vdop, expected 0, is " << last_msg_->vdop; -} -class Test_legacy_auto_check_sbp_navigation_MsgDopsDepA5 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgDopsDepA5() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_dops_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_dops_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgDopsDepA5, Test) { - uint8_t encoded_frame[] = { - 85, 6, 2, 195, 4, 14, 128, 165, 68, 24, 92, - 1, 56, 1, 155, 0, 125, 2, 113, 0, 129, 93, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_dops_dep_a_t *test_msg = (msg_dops_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->gdop = 348; - test_msg->hdop = 637; - test_msg->pdop = 312; - test_msg->tdop = 155; - test_msg->tow = 407152000; - test_msg->vdop = 113; - - EXPECT_EQ(send_message(0x206, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asgdop)>( - reinterpret_cast(&last_msg_->gdop)), - 348) - << "incorrect value for gdop, expected 348, is " << last_msg_->gdop; - EXPECT_EQ(get_ashdop)>( - reinterpret_cast(&last_msg_->hdop)), - 637) - << "incorrect value for hdop, expected 637, is " << last_msg_->hdop; - EXPECT_EQ(get_aspdop)>( - reinterpret_cast(&last_msg_->pdop)), - 312) - << "incorrect value for pdop, expected 312, is " << last_msg_->pdop; - EXPECT_EQ(get_astdop)>( - reinterpret_cast(&last_msg_->tdop)), - 155) - << "incorrect value for tdop, expected 155, is " << last_msg_->tdop; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407152000) - << "incorrect value for tow, expected 407152000, is " << last_msg_->tow; - EXPECT_EQ(get_asvdop)>( - reinterpret_cast(&last_msg_->vdop)), - 113) - << "incorrect value for vdop, expected 113, is " << last_msg_->vdop; -} -class Test_legacy_auto_check_sbp_navigation_MsgDopsDepA6 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgDopsDepA6() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_dops_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_dops_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgDopsDepA6, Test) { - uint8_t encoded_frame[] = { - 85, 6, 2, 195, 4, 14, 104, 169, 68, 24, 92, - 1, 55, 1, 155, 0, 125, 2, 113, 0, 209, 128, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_dops_dep_a_t *test_msg = (msg_dops_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->gdop = 348; - test_msg->hdop = 637; - test_msg->pdop = 311; - test_msg->tdop = 155; - test_msg->tow = 407153000; - test_msg->vdop = 113; - - EXPECT_EQ(send_message(0x206, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asgdop)>( - reinterpret_cast(&last_msg_->gdop)), - 348) - << "incorrect value for gdop, expected 348, is " << last_msg_->gdop; - EXPECT_EQ(get_ashdop)>( - reinterpret_cast(&last_msg_->hdop)), - 637) - << "incorrect value for hdop, expected 637, is " << last_msg_->hdop; - EXPECT_EQ(get_aspdop)>( - reinterpret_cast(&last_msg_->pdop)), - 311) - << "incorrect value for pdop, expected 311, is " << last_msg_->pdop; - EXPECT_EQ(get_astdop)>( - reinterpret_cast(&last_msg_->tdop)), - 155) - << "incorrect value for tdop, expected 155, is " << last_msg_->tdop; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407153000) - << "incorrect value for tow, expected 407153000, is " << last_msg_->tow; - EXPECT_EQ(get_asvdop)>( - reinterpret_cast(&last_msg_->vdop)), - 113) - << "incorrect value for vdop, expected 113, is " << last_msg_->vdop; -} -class Test_legacy_auto_check_sbp_navigation_MsgDopsDepA7 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgDopsDepA7() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_dops_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_dops_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgDopsDepA7, Test) { - uint8_t encoded_frame[] = { - 85, 6, 2, 195, 4, 14, 80, 173, 68, 24, 92, - 1, 55, 1, 155, 0, 125, 2, 112, 0, 30, 6, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_dops_dep_a_t *test_msg = (msg_dops_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->gdop = 348; - test_msg->hdop = 637; - test_msg->pdop = 311; - test_msg->tdop = 155; - test_msg->tow = 407154000; - test_msg->vdop = 112; - - EXPECT_EQ(send_message(0x206, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asgdop)>( - reinterpret_cast(&last_msg_->gdop)), - 348) - << "incorrect value for gdop, expected 348, is " << last_msg_->gdop; - EXPECT_EQ(get_ashdop)>( - reinterpret_cast(&last_msg_->hdop)), - 637) - << "incorrect value for hdop, expected 637, is " << last_msg_->hdop; - EXPECT_EQ(get_aspdop)>( - reinterpret_cast(&last_msg_->pdop)), - 311) - << "incorrect value for pdop, expected 311, is " << last_msg_->pdop; - EXPECT_EQ(get_astdop)>( - reinterpret_cast(&last_msg_->tdop)), - 155) - << "incorrect value for tdop, expected 155, is " << last_msg_->tdop; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407154000) - << "incorrect value for tow, expected 407154000, is " << last_msg_->tow; - EXPECT_EQ(get_asvdop)>( - reinterpret_cast(&last_msg_->vdop)), - 112) - << "incorrect value for vdop, expected 112, is " << last_msg_->vdop; -} -class Test_legacy_auto_check_sbp_navigation_MsgDopsDepA8 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgDopsDepA8() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_dops_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_dops_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgDopsDepA8, Test) { - uint8_t encoded_frame[] = { - 85, 6, 2, 195, 4, 14, 56, 177, 68, 24, 92, - 1, 55, 1, 155, 0, 125, 2, 112, 0, 70, 67, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_dops_dep_a_t *test_msg = (msg_dops_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->gdop = 348; - test_msg->hdop = 637; - test_msg->pdop = 311; - test_msg->tdop = 155; - test_msg->tow = 407155000; - test_msg->vdop = 112; - - EXPECT_EQ(send_message(0x206, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asgdop)>( - reinterpret_cast(&last_msg_->gdop)), - 348) - << "incorrect value for gdop, expected 348, is " << last_msg_->gdop; - EXPECT_EQ(get_ashdop)>( - reinterpret_cast(&last_msg_->hdop)), - 637) - << "incorrect value for hdop, expected 637, is " << last_msg_->hdop; - EXPECT_EQ(get_aspdop)>( - reinterpret_cast(&last_msg_->pdop)), - 311) - << "incorrect value for pdop, expected 311, is " << last_msg_->pdop; - EXPECT_EQ(get_astdop)>( - reinterpret_cast(&last_msg_->tdop)), - 155) - << "incorrect value for tdop, expected 155, is " << last_msg_->tdop; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407155000) - << "incorrect value for tow, expected 407155000, is " << last_msg_->tow; - EXPECT_EQ(get_asvdop)>( - reinterpret_cast(&last_msg_->vdop)), - 112) - << "incorrect value for vdop, expected 112, is " << last_msg_->vdop; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgGPSTime.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgGPSTime.cc deleted file mode 100644 index f711f33228..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgGPSTime.cc +++ /dev/null @@ -1,553 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgGPSTime.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTime0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTime0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTime0, Test) { - uint8_t encoded_frame[] = { - 85, 2, 1, 211, 136, 11, 128, 7, 40, 244, - 122, 19, 244, 139, 2, 0, 0, 34, 152, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_t *test_msg = (msg_gps_time_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 166900; - test_msg->tow = 326825000; - test_msg->wn = 1920; - - EXPECT_EQ(send_message(0x102, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 166900) - << "incorrect value for ns_residual, expected 166900, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326825000) - << "incorrect value for tow, expected 326825000, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1920) - << "incorrect value for wn, expected 1920, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTime1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTime1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTime1, Test) { - uint8_t encoded_frame[] = { - 85, 2, 1, 211, 136, 11, 128, 7, 28, 246, - 122, 19, 126, 234, 3, 0, 0, 65, 3, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_t *test_msg = (msg_gps_time_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 256638; - test_msg->tow = 326825500; - test_msg->wn = 1920; - - EXPECT_EQ(send_message(0x102, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 256638) - << "incorrect value for ns_residual, expected 256638, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326825500) - << "incorrect value for tow, expected 326825500, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1920) - << "incorrect value for wn, expected 1920, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTime2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTime2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTime2, Test) { - uint8_t encoded_frame[] = { - 85, 2, 1, 211, 136, 11, 128, 7, 16, 248, - 122, 19, 129, 12, 4, 0, 0, 12, 84, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_t *test_msg = (msg_gps_time_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 265345; - test_msg->tow = 326826000; - test_msg->wn = 1920; - - EXPECT_EQ(send_message(0x102, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 265345) - << "incorrect value for ns_residual, expected 265345, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326826000) - << "incorrect value for tow, expected 326826000, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1920) - << "incorrect value for wn, expected 1920, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTime3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTime3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTime3, Test) { - uint8_t encoded_frame[] = { - 85, 2, 1, 211, 136, 11, 128, 7, 4, 250, - 122, 19, 137, 204, 4, 0, 0, 50, 165, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_t *test_msg = (msg_gps_time_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 314505; - test_msg->tow = 326826500; - test_msg->wn = 1920; - - EXPECT_EQ(send_message(0x102, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 314505) - << "incorrect value for ns_residual, expected 314505, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326826500) - << "incorrect value for tow, expected 326826500, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1920) - << "incorrect value for wn, expected 1920, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTime4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTime4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTime4, Test) { - uint8_t encoded_frame[] = { - 85, 2, 1, 211, 136, 11, 128, 7, 248, 251, - 122, 19, 181, 137, 5, 0, 0, 180, 33, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_t *test_msg = (msg_gps_time_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 362933; - test_msg->tow = 326827000; - test_msg->wn = 1920; - - EXPECT_EQ(send_message(0x102, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 362933) - << "incorrect value for ns_residual, expected 362933, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326827000) - << "incorrect value for tow, expected 326827000, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1920) - << "incorrect value for wn, expected 1920, is " << last_msg_->wn; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgGPSTimeDepA.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgGPSTimeDepA.cc deleted file mode 100644 index 3389bd8fa1..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgGPSTimeDepA.cc +++ /dev/null @@ -1,1164 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgGPSTimeDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 0, 1, 246, 215, 11, 251, 6, 120, 46, 39, 0, 0, 0, 0, 0, 0, 133, 36, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_dep_a_t *test_msg = (msg_gps_time_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 0; - test_msg->tow = 2567800; - test_msg->wn = 1787; - - EXPECT_EQ(send_message(0x100, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 0) - << "incorrect value for ns_residual, expected 0, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567800) - << "incorrect value for tow, expected 2567800, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1787) - << "incorrect value for wn, expected 1787, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA1, Test) { - uint8_t encoded_frame[] = { - 85, 0, 1, 246, 215, 11, 251, 6, 220, 46, 39, 0, 0, 0, 0, 0, 0, 36, 160, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_dep_a_t *test_msg = (msg_gps_time_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 0; - test_msg->tow = 2567900; - test_msg->wn = 1787; - - EXPECT_EQ(send_message(0x100, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 0) - << "incorrect value for ns_residual, expected 0, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567900) - << "incorrect value for tow, expected 2567900, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1787) - << "incorrect value for wn, expected 1787, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA2, Test) { - uint8_t encoded_frame[] = { - 85, 0, 1, 246, 215, 11, 251, 6, 64, 47, 39, 0, 0, 0, 0, 0, 0, 171, 190, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_dep_a_t *test_msg = (msg_gps_time_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 0; - test_msg->tow = 2568000; - test_msg->wn = 1787; - - EXPECT_EQ(send_message(0x100, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 0) - << "incorrect value for ns_residual, expected 0, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2568000) - << "incorrect value for tow, expected 2568000, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1787) - << "incorrect value for wn, expected 1787, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA3, Test) { - uint8_t encoded_frame[] = { - 85, 0, 1, 246, 215, 11, 251, 6, 164, 47, 39, 0, 0, 0, 0, 0, 0, 211, 101, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_dep_a_t *test_msg = (msg_gps_time_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 0; - test_msg->tow = 2568100; - test_msg->wn = 1787; - - EXPECT_EQ(send_message(0x100, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 0) - << "incorrect value for ns_residual, expected 0, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2568100) - << "incorrect value for tow, expected 2568100, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1787) - << "incorrect value for wn, expected 1787, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA4, Test) { - uint8_t encoded_frame[] = { - 85, 0, 1, 246, 215, 11, 251, 6, 8, 48, 39, 0, 0, 0, 0, 0, 0, 251, 44, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_dep_a_t *test_msg = (msg_gps_time_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 0; - test_msg->tow = 2568200; - test_msg->wn = 1787; - - EXPECT_EQ(send_message(0x100, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 0) - << "incorrect value for ns_residual, expected 0, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2568200) - << "incorrect value for tow, expected 2568200, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1787) - << "incorrect value for wn, expected 1787, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA5 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA5() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA5, Test) { - uint8_t encoded_frame[] = { - 85, 0, 1, 195, 4, 11, 46, 7, 212, 157, - 67, 24, 111, 147, 252, 255, 0, 215, 190, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_dep_a_t *test_msg = (msg_gps_time_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = -224401; - test_msg->tow = 407084500; - test_msg->wn = 1838; - - EXPECT_EQ(send_message(0x100, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - -224401) - << "incorrect value for ns_residual, expected -224401, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084500) - << "incorrect value for tow, expected 407084500, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1838) - << "incorrect value for wn, expected 1838, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA6 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA6() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA6, Test) { - uint8_t encoded_frame[] = { - 85, 0, 1, 195, 4, 11, 46, 7, 56, 158, 67, 24, 109, 103, 3, 0, 0, 134, 89, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_dep_a_t *test_msg = (msg_gps_time_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 223085; - test_msg->tow = 407084600; - test_msg->wn = 1838; - - EXPECT_EQ(send_message(0x100, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 223085) - << "incorrect value for ns_residual, expected 223085, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084600) - << "incorrect value for tow, expected 407084600, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1838) - << "incorrect value for wn, expected 1838, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA7 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA7() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA7, Test) { - uint8_t encoded_frame[] = { - 85, 0, 1, 195, 4, 11, 46, 7, 156, 158, - 67, 24, 233, 152, 252, 255, 0, 206, 241, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_dep_a_t *test_msg = (msg_gps_time_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = -222999; - test_msg->tow = 407084700; - test_msg->wn = 1838; - - EXPECT_EQ(send_message(0x100, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - -222999) - << "incorrect value for ns_residual, expected -222999, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084700) - << "incorrect value for tow, expected 407084700, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1838) - << "incorrect value for wn, expected 1838, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA8 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA8() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA8, Test) { - uint8_t encoded_frame[] = { - 85, 0, 1, 195, 4, 11, 46, 7, 0, 159, 67, 24, 240, 154, 3, 0, 0, 147, 98, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_dep_a_t *test_msg = (msg_gps_time_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 236272; - test_msg->tow = 407084800; - test_msg->wn = 1838; - - EXPECT_EQ(send_message(0x100, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 236272) - << "incorrect value for ns_residual, expected 236272, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084800) - << "incorrect value for tow, expected 407084800, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1838) - << "incorrect value for wn, expected 1838, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA9 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA9() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA9, Test) { - uint8_t encoded_frame[] = { - 85, 0, 1, 195, 4, 11, 46, 7, 100, 159, - 67, 24, 144, 101, 252, 255, 0, 186, 152, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_dep_a_t *test_msg = (msg_gps_time_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = -236144; - test_msg->tow = 407084900; - test_msg->wn = 1838; - - EXPECT_EQ(send_message(0x100, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - -236144) - << "incorrect value for ns_residual, expected -236144, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084900) - << "incorrect value for tow, expected 407084900, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1838) - << "incorrect value for wn, expected 1838, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA10 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA10() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTimeDepA10, Test) { - uint8_t encoded_frame[] = { - 85, 0, 1, 195, 4, 11, 46, 7, 46, 162, - 68, 24, 205, 230, 250, 255, 0, 11, 225, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_dep_a_t *test_msg = (msg_gps_time_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = -334131; - test_msg->tow = 407151150; - test_msg->wn = 1838; - - EXPECT_EQ(send_message(0x100, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - -334131) - << "incorrect value for ns_residual, expected -334131, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407151150) - << "incorrect value for tow, expected 407151150, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1838) - << "incorrect value for wn, expected 1838, is " << last_msg_->wn; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgGPSTimeGNSS.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgGPSTimeGNSS.cc deleted file mode 100644 index 446f71c0a7..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgGPSTimeGNSS.cc +++ /dev/null @@ -1,553 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgGPSTimeGNSS.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_gnss_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_gnss_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS0, Test) { - uint8_t encoded_frame[] = { - 85, 4, 1, 211, 136, 11, 128, 7, 40, 244, - 122, 19, 244, 139, 2, 0, 0, 153, 88, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_gnss_t *test_msg = (msg_gps_time_gnss_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 166900; - test_msg->tow = 326825000; - test_msg->wn = 1920; - - EXPECT_EQ(send_message(0x104, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 166900) - << "incorrect value for ns_residual, expected 166900, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326825000) - << "incorrect value for tow, expected 326825000, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1920) - << "incorrect value for wn, expected 1920, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_gnss_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_gnss_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS1, Test) { - uint8_t encoded_frame[] = { - 85, 4, 1, 211, 136, 11, 128, 7, 28, 246, - 122, 19, 126, 234, 3, 0, 0, 250, 195, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_gnss_t *test_msg = (msg_gps_time_gnss_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 256638; - test_msg->tow = 326825500; - test_msg->wn = 1920; - - EXPECT_EQ(send_message(0x104, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 256638) - << "incorrect value for ns_residual, expected 256638, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326825500) - << "incorrect value for tow, expected 326825500, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1920) - << "incorrect value for wn, expected 1920, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_gnss_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_gnss_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS2, Test) { - uint8_t encoded_frame[] = { - 85, 4, 1, 211, 136, 11, 128, 7, 16, 248, - 122, 19, 129, 12, 4, 0, 0, 183, 148, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_gnss_t *test_msg = (msg_gps_time_gnss_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 265345; - test_msg->tow = 326826000; - test_msg->wn = 1920; - - EXPECT_EQ(send_message(0x104, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 265345) - << "incorrect value for ns_residual, expected 265345, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326826000) - << "incorrect value for tow, expected 326826000, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1920) - << "incorrect value for wn, expected 1920, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_gnss_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_gnss_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS3, Test) { - uint8_t encoded_frame[] = { - 85, 4, 1, 211, 136, 11, 128, 7, 4, 250, - 122, 19, 137, 204, 4, 0, 0, 137, 101, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_gnss_t *test_msg = (msg_gps_time_gnss_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 314505; - test_msg->tow = 326826500; - test_msg->wn = 1920; - - EXPECT_EQ(send_message(0x104, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 314505) - << "incorrect value for ns_residual, expected 314505, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326826500) - << "incorrect value for tow, expected 326826500, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1920) - << "incorrect value for wn, expected 1920, is " << last_msg_->wn; -} -class Test_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gps_time_gnss_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gps_time_gnss_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgGPSTimeGNSS4, Test) { - uint8_t encoded_frame[] = { - 85, 4, 1, 211, 136, 11, 128, 7, 248, 251, - 122, 19, 181, 137, 5, 0, 0, 15, 225, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gps_time_gnss_t *test_msg = (msg_gps_time_gnss_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->ns_residual = 362933; - test_msg->tow = 326827000; - test_msg->wn = 1920; - - EXPECT_EQ(send_message(0x104, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asns_residual)>( - reinterpret_cast(&last_msg_->ns_residual)), - 362933) - << "incorrect value for ns_residual, expected 362933, is " - << last_msg_->ns_residual; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326827000) - << "incorrect value for tow, expected 326827000, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 1920) - << "incorrect value for wn, expected 1920, is " << last_msg_->wn; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosECEF.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosECEF.cc deleted file mode 100644 index d9f97b1d14..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosECEF.cc +++ /dev/null @@ -1,486 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosECEF.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEF0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEF0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEF0, Test) { - uint8_t encoded_frame[] = { - 85, 9, 2, 211, 136, 32, 16, 248, 122, 19, 73, 29, 46, 132, - 182, 122, 68, 193, 219, 192, 29, 176, 121, 119, 80, 193, 83, 11, - 210, 90, 79, 75, 77, 65, 0, 0, 15, 2, 84, 6, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_t *test_msg = (msg_pos_ecef_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 2; - test_msg->n_sats = 15; - test_msg->tow = 326826000; - test_msg->x = -2684269.0326572997; - test_msg->y = -4316646.751816; - test_msg->z = 3839646.7095350414; - - EXPECT_EQ(send_message(0x209, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 2) - << "incorrect value for flags, expected 2, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326826000) - << "incorrect value for tow, expected 326826000, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - -2684269.03266 * 100), 0.05) - << "incorrect value for x, expected -2684269.03266, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4316646.75182 * 100), 0.05) - << "incorrect value for y, expected -4316646.75182, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3839646.70954 * 100), 0.05) - << "incorrect value for z, expected 3839646.70954, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEF1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEF1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEF1, Test) { - uint8_t encoded_frame[] = { - 85, 9, 2, 211, 136, 32, 248, 251, 122, 19, 103, 106, 57, 136, - 182, 122, 68, 193, 176, 242, 200, 176, 121, 119, 80, 193, 244, 135, - 97, 59, 79, 75, 77, 65, 0, 0, 15, 2, 147, 216, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_t *test_msg = (msg_pos_ecef_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 2; - test_msg->n_sats = 15; - test_msg->tow = 326827000; - test_msg->x = -2684269.064252186; - test_msg->y = -4316646.762264892; - test_msg->z = 3839646.463913912; - - EXPECT_EQ(send_message(0x209, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 2) - << "incorrect value for flags, expected 2, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326827000) - << "incorrect value for tow, expected 326827000, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - -2684269.06425 * 100), 0.05) - << "incorrect value for x, expected -2684269.06425, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4316646.76226 * 100), 0.05) - << "incorrect value for y, expected -4316646.76226, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3839646.46391 * 100), 0.05) - << "incorrect value for z, expected 3839646.46391, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEF2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEF2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEF2, Test) { - uint8_t encoded_frame[] = { - 85, 9, 2, 211, 136, 32, 224, 255, 122, 19, 101, 179, 242, 182, - 182, 122, 68, 193, 130, 196, 145, 199, 121, 119, 80, 193, 212, 10, - 253, 15, 79, 75, 77, 65, 0, 0, 15, 2, 40, 201, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_t *test_msg = (msg_pos_ecef_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 2; - test_msg->n_sats = 15; - test_msg->tow = 326828000; - test_msg->x = -2684269.4292816394; - test_msg->y = -4316647.118271949; - test_msg->z = 3839646.124909738; - - EXPECT_EQ(send_message(0x209, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 2) - << "incorrect value for flags, expected 2, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326828000) - << "incorrect value for tow, expected 326828000, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - -2684269.42928 * 100), 0.05) - << "incorrect value for x, expected -2684269.42928, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4316647.11827 * 100), 0.05) - << "incorrect value for y, expected -4316647.11827, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3839646.12491 * 100), 0.05) - << "incorrect value for z, expected 3839646.12491, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEF3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEF3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEF3, Test) { - uint8_t encoded_frame[] = { - 85, 9, 2, 211, 136, 32, 200, 3, 123, 19, 146, 214, 132, 215, - 182, 122, 68, 193, 213, 68, 49, 215, 121, 119, 80, 193, 71, 34, - 110, 243, 78, 75, 77, 65, 0, 0, 15, 2, 187, 86, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_t *test_msg = (msg_pos_ecef_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 2; - test_msg->n_sats = 15; - test_msg->tow = 326829000; - test_msg->x = -2684269.683741399; - test_msg->y = -4316647.3623821335; - test_msg->z = 3839645.90179852; - - EXPECT_EQ(send_message(0x209, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 2) - << "incorrect value for flags, expected 2, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326829000) - << "incorrect value for tow, expected 326829000, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - -2684269.68374 * 100), 0.05) - << "incorrect value for x, expected -2684269.68374, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4316647.36238 * 100), 0.05) - << "incorrect value for y, expected -4316647.36238, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3839645.9018 * 100), 0.05) - << "incorrect value for z, expected 3839645.9018, is " << last_msg_->z; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosECEFCov.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosECEFCov.cc deleted file mode 100644 index 2b5c3ad88d..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosECEFCov.cc +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosECEFCov.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEFCov0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEFCov0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_cov_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_cov_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEFCov0, Test) { - uint8_t encoded_frame[] = { - 85, 20, 2, 66, 0, 54, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 24, 64, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, - 16, 64, 0, 0, 0, 65, 0, 0, 224, 64, 0, 0, 0, 64, 0, 0, - 192, 64, 0, 0, 0, 65, 0, 0, 160, 64, 4, 5, 249, 167, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_cov_t *test_msg = (msg_pos_ecef_cov_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cov_x_x = 8.0; - test_msg->cov_x_y = 7.0; - test_msg->cov_x_z = 2.0; - test_msg->cov_y_y = 6.0; - test_msg->cov_y_z = 8.0; - test_msg->cov_z_z = 5.0; - test_msg->flags = 5; - test_msg->n_sats = 4; - test_msg->tow = 7; - test_msg->x = 6.0; - test_msg->y = 1.0; - test_msg->z = 4.0; - - EXPECT_EQ(send_message(0x214, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cov_x_x * 100 - 8.0 * 100), 0.05) - << "incorrect value for cov_x_x, expected 8.0, is " << last_msg_->cov_x_x; - EXPECT_LT((last_msg_->cov_x_y * 100 - 7.0 * 100), 0.05) - << "incorrect value for cov_x_y, expected 7.0, is " << last_msg_->cov_x_y; - EXPECT_LT((last_msg_->cov_x_z * 100 - 2.0 * 100), 0.05) - << "incorrect value for cov_x_z, expected 2.0, is " << last_msg_->cov_x_z; - EXPECT_LT((last_msg_->cov_y_y * 100 - 6.0 * 100), 0.05) - << "incorrect value for cov_y_y, expected 6.0, is " << last_msg_->cov_y_y; - EXPECT_LT((last_msg_->cov_y_z * 100 - 8.0 * 100), 0.05) - << "incorrect value for cov_y_z, expected 8.0, is " << last_msg_->cov_y_z; - EXPECT_LT((last_msg_->cov_z_z * 100 - 5.0 * 100), 0.05) - << "incorrect value for cov_z_z, expected 5.0, is " << last_msg_->cov_z_z; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 5) - << "incorrect value for flags, expected 5, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 4) - << "incorrect value for n_sats, expected 4, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 7) - << "incorrect value for tow, expected 7, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - 6.0 * 100), 0.05) - << "incorrect value for x, expected 6.0, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - 1.0 * 100), 0.05) - << "incorrect value for y, expected 1.0, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 4.0 * 100), 0.05) - << "incorrect value for z, expected 4.0, is " << last_msg_->z; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosECEFCovGNSS.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosECEFCovGNSS.cc deleted file mode 100644 index 27d7c9fa3f..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosECEFCovGNSS.cc +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosECEFCovGNSS.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEFCovGNSS0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEFCovGNSS0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_cov_gnss_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_cov_gnss_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEFCovGNSS0, Test) { - uint8_t encoded_frame[] = { - 85, 52, 2, 0, 16, 54, 24, 229, 233, 29, 52, 254, 158, - 218, 42, 142, 68, 193, 69, 162, 89, 91, 34, 68, 80, 193, - 131, 21, 176, 129, 239, 174, 77, 65, 158, 232, 30, 60, 218, - 221, 20, 60, 129, 136, 198, 187, 205, 120, 166, 60, 5, 166, - 35, 188, 122, 177, 115, 60, 18, 4, 159, 102, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_cov_gnss_t *test_msg = - (msg_pos_ecef_cov_gnss_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cov_x_x = 0.009699014946818352; - test_msg->cov_x_y = 0.009086096659302711; - test_msg->cov_x_z = -0.006058753002434969; - test_msg->cov_y_y = 0.020321274176239967; - test_msg->cov_y_z = -0.009988312609493732; - test_msg->cov_z_z = 0.01487385667860508; - test_msg->flags = 4; - test_msg->n_sats = 18; - test_msg->tow = 501867800; - test_msg->x = -2694229.7079770807; - test_msg->y = -4264073.427345817; - test_msg->z = 3890655.013186158; - - EXPECT_EQ(send_message(0x234, 4096, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 4096); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cov_x_x * 100 - 0.00969901494682 * 100), 0.05) - << "incorrect value for cov_x_x, expected 0.00969901494682, is " - << last_msg_->cov_x_x; - EXPECT_LT((last_msg_->cov_x_y * 100 - 0.0090860966593 * 100), 0.05) - << "incorrect value for cov_x_y, expected 0.0090860966593, is " - << last_msg_->cov_x_y; - EXPECT_LT((last_msg_->cov_x_z * 100 - -0.00605875300243 * 100), 0.05) - << "incorrect value for cov_x_z, expected -0.00605875300243, is " - << last_msg_->cov_x_z; - EXPECT_LT((last_msg_->cov_y_y * 100 - 0.0203212741762 * 100), 0.05) - << "incorrect value for cov_y_y, expected 0.0203212741762, is " - << last_msg_->cov_y_y; - EXPECT_LT((last_msg_->cov_y_z * 100 - -0.00998831260949 * 100), 0.05) - << "incorrect value for cov_y_z, expected -0.00998831260949, is " - << last_msg_->cov_y_z; - EXPECT_LT((last_msg_->cov_z_z * 100 - 0.0148738566786 * 100), 0.05) - << "incorrect value for cov_z_z, expected 0.0148738566786, is " - << last_msg_->cov_z_z; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 4) - << "incorrect value for flags, expected 4, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 18) - << "incorrect value for n_sats, expected 18, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 501867800) - << "incorrect value for tow, expected 501867800, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - -2694229.70798 * 100), 0.05) - << "incorrect value for x, expected -2694229.70798, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4264073.42735 * 100), 0.05) - << "incorrect value for y, expected -4264073.42735, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3890655.01319 * 100), 0.05) - << "incorrect value for z, expected 3890655.01319, is " << last_msg_->z; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosECEFDepA.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosECEFDepA.cc deleted file mode 100644 index 0dd7286ae0..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosECEFDepA.cc +++ /dev/null @@ -1,1270 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosECEFDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 0, 2, 246, 215, 32, 20, 46, 39, 0, 195, 122, 175, 75, - 33, 154, 68, 193, 164, 14, 230, 176, 231, 95, 80, 193, 78, 220, - 22, 253, 254, 105, 77, 65, 0, 0, 9, 0, 13, 86, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_dep_a_t *test_msg = (msg_pos_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 9; - test_msg->tow = 2567700; - test_msg->x = -2700354.5912927105; - test_msg->y = -4292510.764041577; - test_msg->z = 3855357.977260149; - - EXPECT_EQ(send_message(0x200, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567700) - << "incorrect value for tow, expected 2567700, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - -2700354.59129 * 100), 0.05) - << "incorrect value for x, expected -2700354.59129, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4292510.76404 * 100), 0.05) - << "incorrect value for y, expected -4292510.76404, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3855357.97726 * 100), 0.05) - << "incorrect value for z, expected 3855357.97726, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA1, Test) { - uint8_t encoded_frame[] = { - 85, 0, 2, 246, 215, 32, 20, 46, 39, 0, 212, 196, 12, 42, - 34, 154, 68, 193, 9, 113, 112, 123, 231, 95, 80, 193, 54, 97, - 38, 192, 254, 105, 77, 65, 0, 0, 9, 1, 75, 143, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_dep_a_t *test_msg = (msg_pos_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 1; - test_msg->n_sats = 9; - test_msg->tow = 2567700; - test_msg->x = -2700356.3285146747; - test_msg->y = -4292509.928737887; - test_msg->z = 3855357.5011712564; - - EXPECT_EQ(send_message(0x200, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567700) - << "incorrect value for tow, expected 2567700, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - -2700356.32851 * 100), 0.05) - << "incorrect value for x, expected -2700356.32851, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4292509.92874 * 100), 0.05) - << "incorrect value for y, expected -4292509.92874, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3855357.50117 * 100), 0.05) - << "incorrect value for z, expected 3855357.50117, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA2, Test) { - uint8_t encoded_frame[] = { - 85, 0, 2, 246, 215, 32, 120, 46, 39, 0, 112, 97, 39, 190, - 34, 154, 68, 193, 230, 43, 119, 115, 231, 95, 80, 193, 50, 199, - 76, 66, 254, 105, 77, 65, 0, 0, 9, 0, 204, 113, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_dep_a_t *test_msg = (msg_pos_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 9; - test_msg->tow = 2567800; - test_msg->x = -2700357.485576801; - test_msg->y = -4292509.80414865; - test_msg->z = 3855356.517968082; - - EXPECT_EQ(send_message(0x200, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567800) - << "incorrect value for tow, expected 2567800, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - -2700357.48558 * 100), 0.05) - << "incorrect value for x, expected -2700357.48558, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4292509.80415 * 100), 0.05) - << "incorrect value for y, expected -4292509.80415, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3855356.51797 * 100), 0.05) - << "incorrect value for z, expected 3855356.51797, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA3, Test) { - uint8_t encoded_frame[] = { - 85, 0, 2, 246, 215, 32, 120, 46, 39, 0, 194, 82, 121, 4, - 34, 154, 68, 193, 223, 186, 1, 140, 231, 95, 80, 193, 176, 152, - 147, 181, 254, 105, 77, 65, 0, 0, 9, 1, 97, 71, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_dep_a_t *test_msg = (msg_pos_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 1; - test_msg->n_sats = 9; - test_msg->tow = 2567800; - test_msg->x = -2700356.0349524925; - test_msg->y = -4292510.187605589; - test_msg->z = 3855357.4185667858; - - EXPECT_EQ(send_message(0x200, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567800) - << "incorrect value for tow, expected 2567800, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - -2700356.03495 * 100), 0.05) - << "incorrect value for x, expected -2700356.03495, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4292510.18761 * 100), 0.05) - << "incorrect value for y, expected -4292510.18761, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3855357.41857 * 100), 0.05) - << "incorrect value for z, expected 3855357.41857, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA4, Test) { - uint8_t encoded_frame[] = { - 85, 0, 2, 246, 215, 32, 220, 46, 39, 0, 216, 41, 227, 254, - 33, 154, 68, 193, 9, 151, 154, 124, 231, 95, 80, 193, 1, 183, - 214, 139, 255, 105, 77, 65, 0, 0, 9, 0, 7, 98, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_dep_a_t *test_msg = (msg_pos_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 9; - test_msg->tow = 2567900; - test_msg->x = -2700355.9913074784; - test_msg->y = -4292509.946935424; - test_msg->z = 3855359.0924900775; - - EXPECT_EQ(send_message(0x200, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567900) - << "incorrect value for tow, expected 2567900, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - -2700355.99131 * 100), 0.05) - << "incorrect value for x, expected -2700355.99131, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4292509.94694 * 100), 0.05) - << "incorrect value for y, expected -4292509.94694, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3855359.09249 * 100), 0.05) - << "incorrect value for z, expected 3855359.09249, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA5 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA5() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA5, Test) { - uint8_t encoded_frame[] = { - 85, 0, 2, 195, 4, 32, 212, 157, 67, 24, 153, 222, 105, 1, - 252, 161, 68, 193, 254, 247, 52, 112, 74, 67, 80, 193, 164, 207, - 47, 146, 44, 163, 77, 65, 0, 0, 8, 0, 145, 4, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_dep_a_t *test_msg = (msg_pos_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084500; - test_msg->x = -2704376.0110433814; - test_msg->y = -4263209.753232954; - test_msg->z = 3884633.142084079; - - EXPECT_EQ(send_message(0x200, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084500) - << "incorrect value for tow, expected 407084500, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - -2704376.01104 * 100), 0.05) - << "incorrect value for x, expected -2704376.01104, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4263209.75323 * 100), 0.05) - << "incorrect value for y, expected -4263209.75323, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3884633.14208 * 100), 0.05) - << "incorrect value for z, expected 3884633.14208, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA6 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA6() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA6, Test) { - uint8_t encoded_frame[] = { - 85, 0, 2, 195, 4, 32, 56, 158, 67, 24, 215, 184, 223, 246, - 251, 161, 68, 193, 36, 126, 17, 39, 74, 67, 80, 193, 19, 179, - 70, 80, 44, 163, 77, 65, 0, 0, 8, 0, 245, 66, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_dep_a_t *test_msg = (msg_pos_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084600; - test_msg->x = -2704375.9287024545; - test_msg->y = -4263208.610442672; - test_msg->z = 3884632.627157578; - - EXPECT_EQ(send_message(0x200, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084600) - << "incorrect value for tow, expected 407084600, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - -2704375.9287 * 100), 0.05) - << "incorrect value for x, expected -2704375.9287, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4263208.61044 * 100), 0.05) - << "incorrect value for y, expected -4263208.61044, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3884632.62716 * 100), 0.05) - << "incorrect value for z, expected 3884632.62716, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA7 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA7() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA7, Test) { - uint8_t encoded_frame[] = { - 85, 0, 2, 195, 4, 32, 156, 158, 67, 24, 73, 74, 214, 148, - 251, 161, 68, 193, 213, 151, 184, 215, 73, 67, 80, 193, 110, 99, - 38, 164, 43, 163, 77, 65, 0, 0, 8, 0, 5, 223, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_dep_a_t *test_msg = (msg_pos_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084700; - test_msg->x = -2704375.162789617; - test_msg->y = -4263207.370641668; - test_msg->z = 3884631.282421521; - - EXPECT_EQ(send_message(0x200, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084700) - << "incorrect value for tow, expected 407084700, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - -2704375.16279 * 100), 0.05) - << "incorrect value for x, expected -2704375.16279, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4263207.37064 * 100), 0.05) - << "incorrect value for y, expected -4263207.37064, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3884631.28242 * 100), 0.05) - << "incorrect value for z, expected 3884631.28242, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA8 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA8() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA8, Test) { - uint8_t encoded_frame[] = { - 85, 0, 2, 195, 4, 32, 0, 159, 67, 24, 177, 111, 112, 45, - 252, 161, 68, 193, 213, 168, 198, 253, 73, 67, 80, 193, 245, 12, - 228, 12, 44, 163, 77, 65, 0, 0, 8, 0, 143, 212, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_dep_a_t *test_msg = (msg_pos_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084800; - test_msg->x = -2704376.3549937834; - test_msg->y = -4263207.965250214; - test_msg->z = 3884632.1007095524; - - EXPECT_EQ(send_message(0x200, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084800) - << "incorrect value for tow, expected 407084800, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - -2704376.35499 * 100), 0.05) - << "incorrect value for x, expected -2704376.35499, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4263207.96525 * 100), 0.05) - << "incorrect value for y, expected -4263207.96525, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3884632.10071 * 100), 0.05) - << "incorrect value for z, expected 3884632.10071, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA9 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA9() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA9, Test) { - uint8_t encoded_frame[] = { - 85, 0, 2, 195, 4, 32, 100, 159, 67, 24, 67, 231, 72, 165, - 251, 161, 68, 193, 150, 210, 36, 212, 73, 67, 80, 193, 234, 33, - 25, 189, 43, 163, 77, 65, 0, 0, 8, 0, 70, 221, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_dep_a_t *test_msg = (msg_pos_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084900; - test_msg->x = -2704375.291287334; - test_msg->y = -4263207.314747473; - test_msg->z = 3884631.4773294823; - - EXPECT_EQ(send_message(0x200, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084900) - << "incorrect value for tow, expected 407084900, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - -2704375.29129 * 100), 0.05) - << "incorrect value for x, expected -2704375.29129, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4263207.31475 * 100), 0.05) - << "incorrect value for y, expected -4263207.31475, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3884631.47733 * 100), 0.05) - << "incorrect value for z, expected 3884631.47733, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA10 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA10() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEFDepA10, Test) { - uint8_t encoded_frame[] = { - 85, 0, 2, 195, 4, 32, 46, 162, 68, 24, 224, 72, 131, 215, - 251, 161, 68, 193, 180, 123, 222, 94, 74, 67, 80, 193, 191, 3, - 131, 193, 45, 163, 77, 65, 0, 0, 5, 0, 17, 221, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_dep_a_t *test_msg = (msg_pos_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 5; - test_msg->tow = 407151150; - test_msg->x = -2704375.68369399; - test_msg->y = -4263209.482329298; - test_msg->z = 3884635.5118107493; - - EXPECT_EQ(send_message(0x200, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 5) - << "incorrect value for n_sats, expected 5, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407151150) - << "incorrect value for tow, expected 407151150, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - -2704375.68369 * 100), 0.05) - << "incorrect value for x, expected -2704375.68369, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4263209.48233 * 100), 0.05) - << "incorrect value for y, expected -4263209.48233, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3884635.51181 * 100), 0.05) - << "incorrect value for z, expected 3884635.51181, is " << last_msg_->z; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosECEFGNSS.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosECEFGNSS.cc deleted file mode 100644 index ff5556b6e7..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosECEFGNSS.cc +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosECEFGNSS.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosECEFGNSS0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosECEFGNSS0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_ecef_gnss_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_ecef_gnss_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosECEFGNSS0, Test) { - uint8_t encoded_frame[] = { - 85, 41, 2, 0, 16, 32, 24, 229, 233, 29, 52, 254, 158, 218, - 42, 142, 68, 193, 69, 162, 89, 91, 34, 68, 80, 193, 131, 21, - 176, 129, 239, 174, 77, 65, 182, 0, 18, 4, 135, 2, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_ecef_gnss_t *test_msg = (msg_pos_ecef_gnss_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 182; - test_msg->flags = 4; - test_msg->n_sats = 18; - test_msg->tow = 501867800; - test_msg->x = -2694229.7079770807; - test_msg->y = -4264073.427345817; - test_msg->z = 3890655.013186158; - - EXPECT_EQ(send_message(0x229, 4096, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 4096); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 182) - << "incorrect value for accuracy, expected 182, is " - << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 4) - << "incorrect value for flags, expected 4, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 18) - << "incorrect value for n_sats, expected 18, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 501867800) - << "incorrect value for tow, expected 501867800, is " << last_msg_->tow; - EXPECT_LT((last_msg_->x * 100 - -2694229.70798 * 100), 0.05) - << "incorrect value for x, expected -2694229.70798, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4264073.42735 * 100), 0.05) - << "incorrect value for y, expected -4264073.42735, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3890655.01319 * 100), 0.05) - << "incorrect value for z, expected 3890655.01319, is " << last_msg_->z; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLLH.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLLH.cc deleted file mode 100644 index 357d07a808..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLLH.cc +++ /dev/null @@ -1,648 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosLLH.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLLH0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLLH0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLLH0, Test) { - uint8_t encoded_frame[] = { - 85, 10, 2, 211, 136, 34, 40, 244, 122, 19, 201, 106, 155, 186, - 42, 160, 66, 64, 168, 109, 26, 225, 0, 120, 94, 192, 130, 102, - 237, 230, 43, 54, 60, 64, 0, 0, 0, 0, 14, 2, 175, 162, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_t *test_msg = (msg_pos_llh_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 2; - test_msg->h_accuracy = 0; - test_msg->height = 28.21160739227208; - test_msg->lat = 37.25130398358085; - test_msg->lon = -121.87505366879361; - test_msg->n_sats = 14; - test_msg->tow = 326825000; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x20a, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 2) - << "incorrect value for flags, expected 2, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->height * 100 - 28.2116073923 * 100), 0.05) - << "incorrect value for height, expected 28.2116073923, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.2513039836 * 100), 0.05) - << "incorrect value for lat, expected 37.2513039836, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -121.875053669 * 100), 0.05) - << "incorrect value for lon, expected -121.875053669, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 14) - << "incorrect value for n_sats, expected 14, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326825000) - << "incorrect value for tow, expected 326825000, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLLH1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLLH1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLLH1, Test) { - uint8_t encoded_frame[] = { - 85, 10, 2, 211, 136, 34, 16, 248, 122, 19, 52, 177, 251, 178, - 42, 160, 66, 64, 237, 22, 97, 224, 0, 120, 94, 192, 107, 188, - 109, 90, 247, 189, 59, 64, 0, 0, 0, 0, 15, 2, 38, 177, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_t *test_msg = (msg_pos_llh_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 2; - test_msg->h_accuracy = 0; - test_msg->height = 27.742055560866373; - test_msg->lat = 37.251303074738104; - test_msg->lon = -121.87505349618341; - test_msg->n_sats = 15; - test_msg->tow = 326826000; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x20a, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 2) - << "incorrect value for flags, expected 2, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->height * 100 - 27.7420555609 * 100), 0.05) - << "incorrect value for height, expected 27.7420555609, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.2513030747 * 100), 0.05) - << "incorrect value for lat, expected 37.2513030747, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -121.875053496 * 100), 0.05) - << "incorrect value for lon, expected -121.875053496, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326826000) - << "incorrect value for tow, expected 326826000, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLLH2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLLH2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLLH2, Test) { - uint8_t encoded_frame[] = { - 85, 10, 2, 211, 136, 34, 248, 251, 122, 19, 135, 66, 9, 163, - 42, 160, 66, 64, 146, 8, 99, 225, 0, 120, 94, 192, 45, 181, - 143, 219, 28, 157, 59, 64, 0, 0, 0, 0, 15, 2, 51, 40, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_t *test_msg = (msg_pos_llh_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 2; - test_msg->h_accuracy = 0; - test_msg->height = 27.613721582970516; - test_msg->lat = 37.25130117370741; - test_msg->lon = -121.87505373641241; - test_msg->n_sats = 15; - test_msg->tow = 326827000; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x20a, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 2) - << "incorrect value for flags, expected 2, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->height * 100 - 27.613721583 * 100), 0.05) - << "incorrect value for height, expected 27.613721583, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.2513011737 * 100), 0.05) - << "incorrect value for lat, expected 37.2513011737, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -121.875053736 * 100), 0.05) - << "incorrect value for lon, expected -121.875053736, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326827000) - << "incorrect value for tow, expected 326827000, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLLH3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLLH3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLLH3, Test) { - uint8_t encoded_frame[] = { - 85, 10, 2, 211, 136, 34, 224, 255, 122, 19, 18, 44, 253, 119, - 42, 160, 66, 64, 48, 109, 39, 231, 0, 120, 94, 192, 185, 76, - 48, 17, 119, 205, 59, 64, 0, 0, 0, 0, 15, 2, 12, 194, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_t *test_msg = (msg_pos_llh_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 2; - test_msg->h_accuracy = 0; - test_msg->height = 27.80259807042305; - test_msg->lat = 37.251296042079176; - test_msg->lon = -121.87505511141057; - test_msg->n_sats = 15; - test_msg->tow = 326828000; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x20a, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 2) - << "incorrect value for flags, expected 2, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->height * 100 - 27.8025980704 * 100), 0.05) - << "incorrect value for height, expected 27.8025980704, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.2512960421 * 100), 0.05) - << "incorrect value for lat, expected 37.2512960421, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -121.875055111 * 100), 0.05) - << "incorrect value for lon, expected -121.875055111, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326828000) - << "incorrect value for tow, expected 326828000, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLLH4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLLH4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLLH4, Test) { - uint8_t encoded_frame[] = { - 85, 10, 2, 211, 136, 34, 200, 3, 123, 19, 225, 237, 238, 90, - 42, 160, 66, 64, 59, 143, 70, 235, 0, 120, 94, 192, 101, 106, - 249, 224, 131, 240, 59, 64, 0, 0, 0, 0, 15, 2, 34, 103, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_t *test_msg = (msg_pos_llh_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 2; - test_msg->h_accuracy = 0; - test_msg->height = 27.939512310879213; - test_msg->lat = 37.251292578377395; - test_msg->lon = -121.87505609407974; - test_msg->n_sats = 15; - test_msg->tow = 326829000; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x20a, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 2) - << "incorrect value for flags, expected 2, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->height * 100 - 27.9395123109 * 100), 0.05) - << "incorrect value for height, expected 27.9395123109, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.2512925784 * 100), 0.05) - << "incorrect value for lat, expected 37.2512925784, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -121.875056094 * 100), 0.05) - << "incorrect value for lon, expected -121.875056094, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326829000) - << "incorrect value for tow, expected 326829000, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLLHCov.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLLHCov.cc deleted file mode 100644 index ffcb019688..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLLHCov.cc +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosLLHCov.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLLHCov0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLLHCov0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_cov_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_cov_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLLHCov0, Test) { - uint8_t encoded_frame[] = { - 85, 17, 2, 66, 0, 54, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 28, 64, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 224, 64, 0, 0, 160, 64, 0, 0, 0, 65, 0, 0, - 192, 64, 0, 0, 128, 63, 0, 0, 0, 64, 5, 5, 151, 98, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_cov_t *test_msg = (msg_pos_llh_cov_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cov_d_d = 2.0; - test_msg->cov_e_d = 1.0; - test_msg->cov_e_e = 6.0; - test_msg->cov_n_d = 8.0; - test_msg->cov_n_e = 5.0; - test_msg->cov_n_n = 7.0; - test_msg->flags = 5; - test_msg->height = 0.0; - test_msg->lat = 0.0; - test_msg->lon = 7.0; - test_msg->n_sats = 5; - test_msg->tow = 7; - - EXPECT_EQ(send_message(0x211, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cov_d_d * 100 - 2.0 * 100), 0.05) - << "incorrect value for cov_d_d, expected 2.0, is " << last_msg_->cov_d_d; - EXPECT_LT((last_msg_->cov_e_d * 100 - 1.0 * 100), 0.05) - << "incorrect value for cov_e_d, expected 1.0, is " << last_msg_->cov_e_d; - EXPECT_LT((last_msg_->cov_e_e * 100 - 6.0 * 100), 0.05) - << "incorrect value for cov_e_e, expected 6.0, is " << last_msg_->cov_e_e; - EXPECT_LT((last_msg_->cov_n_d * 100 - 8.0 * 100), 0.05) - << "incorrect value for cov_n_d, expected 8.0, is " << last_msg_->cov_n_d; - EXPECT_LT((last_msg_->cov_n_e * 100 - 5.0 * 100), 0.05) - << "incorrect value for cov_n_e, expected 5.0, is " << last_msg_->cov_n_e; - EXPECT_LT((last_msg_->cov_n_n * 100 - 7.0 * 100), 0.05) - << "incorrect value for cov_n_n, expected 7.0, is " << last_msg_->cov_n_n; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 5) - << "incorrect value for flags, expected 5, is " << last_msg_->flags; - EXPECT_LT((last_msg_->height * 100 - 0.0 * 100), 0.05) - << "incorrect value for height, expected 0.0, is " << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 0.0 * 100), 0.05) - << "incorrect value for lat, expected 0.0, is " << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - 7.0 * 100), 0.05) - << "incorrect value for lon, expected 7.0, is " << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 5) - << "incorrect value for n_sats, expected 5, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 7) - << "incorrect value for tow, expected 7, is " << last_msg_->tow; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLLHDepA.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLLHDepA.cc deleted file mode 100644 index 858b069541..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLLHDepA.cc +++ /dev/null @@ -1,1380 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosLLHDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 1, 2, 246, 215, 34, 20, 46, 39, 0, 250, 29, 226, 186, - 235, 182, 66, 64, 19, 203, 51, 196, 24, 139, 94, 192, 31, 157, - 160, 232, 122, 115, 81, 64, 0, 0, 0, 0, 9, 0, 236, 139, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_dep_a_t *test_msg = (msg_pos_llh_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 69.80437675175607; - test_msg->lat = 37.42906890908121; - test_msg->lon = -122.17338662202773; - test_msg->n_sats = 9; - test_msg->tow = 2567700; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x201, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->height * 100 - 69.8043767518 * 100), 0.05) - << "incorrect value for height, expected 69.8043767518, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.4290689091 * 100), 0.05) - << "incorrect value for lat, expected 37.4290689091, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -122.173386622 * 100), 0.05) - << "incorrect value for lon, expected -122.173386622, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567700) - << "incorrect value for tow, expected 2567700, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA1, Test) { - uint8_t encoded_frame[] = { - 85, 1, 2, 246, 215, 34, 20, 46, 39, 0, 161, 51, 75, 148, - 235, 182, 66, 64, 36, 41, 246, 30, 25, 139, 94, 192, 254, 218, - 49, 127, 10, 108, 81, 64, 0, 0, 0, 0, 9, 1, 25, 117, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_dep_a_t *test_msg = (msg_pos_llh_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 1; - test_msg->h_accuracy = 0; - test_msg->height = 69.68814067715354; - test_msg->lat = 37.42906430885274; - test_msg->lon = -122.17340826071865; - test_msg->n_sats = 9; - test_msg->tow = 2567700; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x201, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->height * 100 - 69.6881406772 * 100), 0.05) - << "incorrect value for height, expected 69.6881406772, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.4290643089 * 100), 0.05) - << "incorrect value for lat, expected 37.4290643089, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -122.173408261 * 100), 0.05) - << "incorrect value for lon, expected -122.173408261, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567700) - << "incorrect value for tow, expected 2567700, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA2, Test) { - uint8_t encoded_frame[] = { - 85, 1, 2, 246, 215, 34, 120, 46, 39, 0, 56, 214, 210, 65, - 235, 182, 66, 64, 13, 46, 132, 80, 25, 139, 94, 192, 22, 143, - 46, 234, 191, 95, 81, 64, 0, 0, 0, 0, 9, 0, 174, 105, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_dep_a_t *test_msg = (msg_pos_llh_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 69.49608854815264; - test_msg->lat = 37.42905447764173; - test_msg->lon = -122.17342007549469; - test_msg->n_sats = 9; - test_msg->tow = 2567800; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x201, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->height * 100 - 69.4960885482 * 100), 0.05) - << "incorrect value for height, expected 69.4960885482, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.4290544776 * 100), 0.05) - << "incorrect value for lat, expected 37.4290544776, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -122.173420075 * 100), 0.05) - << "incorrect value for lon, expected -122.173420075, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567800) - << "incorrect value for tow, expected 2567800, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA3, Test) { - uint8_t encoded_frame[] = { - 85, 1, 2, 246, 215, 34, 120, 46, 39, 0, 251, 117, 115, 140, - 235, 182, 66, 64, 152, 134, 167, 12, 25, 139, 94, 192, 160, 22, - 137, 253, 4, 108, 81, 64, 0, 0, 0, 0, 9, 1, 122, 127, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_dep_a_t *test_msg = (msg_pos_llh_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 1; - test_msg->h_accuracy = 0; - test_msg->height = 69.68780458819901; - test_msg->lat = 37.429063373925565; - test_msg->lon = -122.17340389594972; - test_msg->n_sats = 9; - test_msg->tow = 2567800; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x201, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->height * 100 - 69.6878045882 * 100), 0.05) - << "incorrect value for height, expected 69.6878045882, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.4290633739 * 100), 0.05) - << "incorrect value for lat, expected 37.4290633739, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -122.173403896 * 100), 0.05) - << "incorrect value for lon, expected -122.173403896, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567800) - << "incorrect value for tow, expected 2567800, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA4, Test) { - uint8_t encoded_frame[] = { - 85, 1, 2, 246, 215, 34, 220, 46, 39, 0, 51, 124, 88, 251, - 235, 182, 66, 64, 153, 5, 250, 16, 25, 139, 94, 192, 146, 60, - 187, 219, 152, 161, 81, 64, 0, 0, 0, 0, 9, 0, 194, 158, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_dep_a_t *test_msg = (msg_pos_llh_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 70.5249547317965; - test_msg->lat = 37.42907659359516; - test_msg->lon = -122.17340492645452; - test_msg->n_sats = 9; - test_msg->tow = 2567900; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x201, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->height * 100 - 70.5249547318 * 100), 0.05) - << "incorrect value for height, expected 70.5249547318, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.4290765936 * 100), 0.05) - << "incorrect value for lat, expected 37.4290765936, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -122.173404926 * 100), 0.05) - << "incorrect value for lon, expected -122.173404926, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567900) - << "incorrect value for tow, expected 2567900, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA5 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA5() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA5, Test) { - uint8_t encoded_frame[] = { - 85, 1, 2, 195, 4, 34, 212, 157, 67, 24, 8, 23, 228, 8, - 151, 225, 66, 64, 156, 174, 42, 194, 230, 152, 94, 192, 153, 23, - 72, 47, 196, 40, 16, 64, 0, 0, 0, 0, 8, 0, 237, 169, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_dep_a_t *test_msg = (msg_pos_llh_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 4.039810885214956; - test_msg->lat = 37.76242171418386; - test_msg->lon = -122.38908437889262; - test_msg->n_sats = 8; - test_msg->tow = 407084500; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x201, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->height * 100 - 4.03981088521 * 100), 0.05) - << "incorrect value for height, expected 4.03981088521, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.7624217142 * 100), 0.05) - << "incorrect value for lat, expected 37.7624217142, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -122.389084379 * 100), 0.05) - << "incorrect value for lon, expected -122.389084379, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084500) - << "incorrect value for tow, expected 407084500, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA6 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA6() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA6, Test) { - uint8_t encoded_frame[] = { - 85, 1, 2, 195, 4, 34, 56, 158, 67, 24, 220, 109, 212, 24, - 151, 225, 66, 64, 159, 231, 254, 219, 230, 152, 94, 192, 128, 151, - 67, 19, 233, 105, 7, 64, 0, 0, 0, 0, 8, 0, 152, 11, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_dep_a_t *test_msg = (msg_pos_llh_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 2.926714087009657; - test_msg->lat = 37.76242361423985; - test_msg->lon = -122.38909053700489; - test_msg->n_sats = 8; - test_msg->tow = 407084600; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x201, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->height * 100 - 2.92671408701 * 100), 0.05) - << "incorrect value for height, expected 2.92671408701, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.7624236142 * 100), 0.05) - << "incorrect value for lat, expected 37.7624236142, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -122.389090537 * 100), 0.05) - << "incorrect value for lon, expected -122.389090537, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084600) - << "incorrect value for tow, expected 407084600, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA7 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA7() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA7, Test) { - uint8_t encoded_frame[] = { - 85, 1, 2, 195, 4, 34, 156, 158, 67, 24, 13, 91, 237, 11, - 151, 225, 66, 64, 75, 113, 210, 220, 230, 152, 94, 192, 37, 6, - 145, 188, 89, 112, 238, 63, 0, 0, 0, 0, 8, 0, 221, 155, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_dep_a_t *test_msg = (msg_pos_llh_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 0.9512146647395566; - test_msg->lat = 37.762422076126406; - test_msg->lon = -122.3890907340148; - test_msg->n_sats = 8; - test_msg->tow = 407084700; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x201, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->height * 100 - 0.95121466474 * 100), 0.05) - << "incorrect value for height, expected 0.95121466474, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.7624220761 * 100), 0.05) - << "incorrect value for lat, expected 37.7624220761, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -122.389090734 * 100), 0.05) - << "incorrect value for lon, expected -122.389090734, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084700) - << "incorrect value for tow, expected 407084700, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA8 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA8() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA8, Test) { - uint8_t encoded_frame[] = { - 85, 1, 2, 195, 4, 34, 0, 159, 67, 24, 51, 183, 5, 8, - 151, 225, 66, 64, 13, 226, 148, 253, 230, 152, 94, 192, 187, 27, - 11, 32, 69, 213, 2, 64, 0, 0, 0, 0, 8, 0, 82, 94, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_dep_a_t *test_msg = (msg_pos_llh_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 2.354135752047538; - test_msg->lat = 37.762421610632735; - test_msg->lon = -122.38909854449612; - test_msg->n_sats = 8; - test_msg->tow = 407084800; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x201, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->height * 100 - 2.35413575205 * 100), 0.05) - << "incorrect value for height, expected 2.35413575205, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.7624216106 * 100), 0.05) - << "incorrect value for lat, expected 37.7624216106, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -122.389098544 * 100), 0.05) - << "incorrect value for lon, expected -122.389098544, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084800) - << "incorrect value for tow, expected 407084800, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA9 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA9() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA9, Test) { - uint8_t encoded_frame[] = { - 85, 1, 2, 195, 4, 34, 100, 159, 67, 24, 22, 77, 146, 22, - 151, 225, 66, 64, 64, 134, 105, 227, 230, 152, 94, 192, 37, 99, - 114, 72, 31, 103, 241, 63, 0, 0, 0, 0, 8, 0, 70, 60, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_dep_a_t *test_msg = (msg_pos_llh_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 1.0876763181642641; - test_msg->lat = 37.76242334502801; - test_msg->lon = -122.38909230523223; - test_msg->n_sats = 8; - test_msg->tow = 407084900; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x201, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->height * 100 - 1.08767631816 * 100), 0.05) - << "incorrect value for height, expected 1.08767631816, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.762423345 * 100), 0.05) - << "incorrect value for lat, expected 37.762423345, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -122.389092305 * 100), 0.05) - << "incorrect value for lon, expected -122.389092305, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084900) - << "incorrect value for tow, expected 407084900, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA10 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA10() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLLHDepA10, Test) { - uint8_t encoded_frame[] = { - 85, 1, 2, 195, 4, 34, 46, 162, 68, 24, 124, 245, 46, 169, - 151, 225, 66, 64, 135, 149, 234, 187, 230, 152, 94, 192, 194, 201, - 115, 145, 166, 175, 20, 64, 0, 0, 0, 0, 5, 0, 212, 121, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_dep_a_t *test_msg = (msg_pos_llh_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->height = 5.171533844654222; - test_msg->lat = 37.76244082253376; - test_msg->lon = -122.38908288868525; - test_msg->n_sats = 5; - test_msg->tow = 407151150; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x201, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->height * 100 - 5.17153384465 * 100), 0.05) - << "incorrect value for height, expected 5.17153384465, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.7624408225 * 100), 0.05) - << "incorrect value for lat, expected 37.7624408225, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -122.389082889 * 100), 0.05) - << "incorrect value for lon, expected -122.389082889, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 5) - << "incorrect value for n_sats, expected 5, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407151150) - << "incorrect value for tow, expected 407151150, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLlhAcc.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLlhAcc.cc deleted file mode 100644 index 39c88ed605..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLlhAcc.cc +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosLlhAcc.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLlhAcc0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLlhAcc0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_acc_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_acc_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLlhAcc0, Test) { - uint8_t encoded_frame[] = { - 85, 24, 2, 2, 28, 67, 39, 120, 110, 18, 51, 51, 51, 51, 51, - 139, 189, 64, 154, 153, 153, 153, 25, 151, 192, 64, 51, 51, 51, 51, - 51, 161, 176, 64, 51, 51, 51, 51, 51, 101, 179, 64, 51, 163, 22, - 69, 154, 25, 173, 69, 102, 134, 243, 68, 154, 201, 196, 69, 205, 224, - 0, 70, 51, 35, 72, 69, 51, 99, 31, 69, 95, 27, 72, 220, 177, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_acc_t *test_msg = (msg_pos_llh_acc_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->at_accuracy = 6297.2001953125; - test_msg->confidence_and_geoid = 95; - test_msg->ct_accuracy = 1948.199951171875; - test_msg->flags = 72; - test_msg->h_accuracy = 2410.199951171875; - test_msg->h_ellipse.orientation = 2550.199951171875; - test_msg->h_ellipse.semi_major = 8248.2001953125; - test_msg->h_ellipse.semi_minor = 3202.199951171875; - test_msg->height = 4257.2; - test_msg->lat = 7563.2; - test_msg->lon = 8494.2; - test_msg->n_sats = 27; - test_msg->orthometric_height = 4965.2; - test_msg->tow = 309229607; - test_msg->v_accuracy = 5539.2001953125; - - EXPECT_EQ(send_message(0x218, 7170, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 7170); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->at_accuracy * 100 - 6297.20019531 * 100), 0.05) - << "incorrect value for at_accuracy, expected 6297.20019531, is " - << last_msg_->at_accuracy; - EXPECT_EQ( - get_asconfidence_and_geoid)>( - reinterpret_cast(&last_msg_->confidence_and_geoid)), - 95) - << "incorrect value for confidence_and_geoid, expected 95, is " - << last_msg_->confidence_and_geoid; - EXPECT_LT((last_msg_->ct_accuracy * 100 - 1948.19995117 * 100), 0.05) - << "incorrect value for ct_accuracy, expected 1948.19995117, is " - << last_msg_->ct_accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 72) - << "incorrect value for flags, expected 72, is " << last_msg_->flags; - EXPECT_LT((last_msg_->h_accuracy * 100 - 2410.19995117 * 100), 0.05) - << "incorrect value for h_accuracy, expected 2410.19995117, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->h_ellipse.orientation * 100 - 2550.19995117 * 100), - 0.05) - << "incorrect value for h_ellipse.orientation, expected 2550.19995117, " - "is " - << last_msg_->h_ellipse.orientation; - EXPECT_LT((last_msg_->h_ellipse.semi_major * 100 - 8248.20019531 * 100), 0.05) - << "incorrect value for h_ellipse.semi_major, expected 8248.20019531, is " - << last_msg_->h_ellipse.semi_major; - EXPECT_LT((last_msg_->h_ellipse.semi_minor * 100 - 3202.19995117 * 100), 0.05) - << "incorrect value for h_ellipse.semi_minor, expected 3202.19995117, is " - << last_msg_->h_ellipse.semi_minor; - EXPECT_LT((last_msg_->height * 100 - 4257.2 * 100), 0.05) - << "incorrect value for height, expected 4257.2, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 7563.2 * 100), 0.05) - << "incorrect value for lat, expected 7563.2, is " << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - 8494.2 * 100), 0.05) - << "incorrect value for lon, expected 8494.2, is " << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 27) - << "incorrect value for n_sats, expected 27, is " << last_msg_->n_sats; - EXPECT_LT((last_msg_->orthometric_height * 100 - 4965.2 * 100), 0.05) - << "incorrect value for orthometric_height, expected 4965.2, is " - << last_msg_->orthometric_height; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 309229607) - << "incorrect value for tow, expected 309229607, is " << last_msg_->tow; - EXPECT_LT((last_msg_->v_accuracy * 100 - 5539.20019531 * 100), 0.05) - << "incorrect value for v_accuracy, expected 5539.20019531, is " - << last_msg_->v_accuracy; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLlhCovGnss.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLlhCovGnss.cc deleted file mode 100644 index 945c5d711e..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLlhCovGnss.cc +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosLlhCovGnss.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLlhCovGnss0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLlhCovGnss0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_cov_gnss_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_cov_gnss_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLlhCovGnss0, Test) { - uint8_t encoded_frame[] = { - 85, 49, 2, 0, 16, 54, 24, 229, 233, 29, 73, 123, 28, - 207, 101, 234, 66, 64, 100, 168, 19, 20, 86, 146, 94, 192, - 214, 198, 35, 120, 209, 100, 49, 192, 12, 102, 245, 59, 6, - 181, 192, 185, 168, 79, 243, 58, 96, 60, 148, 59, 253, 58, - 93, 186, 159, 174, 6, 61, 18, 4, 10, 196, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_cov_gnss_t *test_msg = (msg_pos_llh_cov_gnss_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cov_d_d = 0.03288137540221214; - test_msg->cov_e_d = -0.0008439270895905793; - test_msg->cov_e_e = 0.004523798823356628; - test_msg->cov_n_d = 0.0018563168123364449; - test_msg->cov_n_e = -0.00036755966721102595; - test_msg->cov_n_n = 0.007488971576094627; - test_msg->flags = 4; - test_msg->height = -17.39382124780135; - test_msg->lat = 37.83123196497633; - test_msg->lon = -122.28650381011681; - test_msg->n_sats = 18; - test_msg->tow = 501867800; - - EXPECT_EQ(send_message(0x231, 4096, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 4096); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cov_d_d * 100 - 0.0328813754022 * 100), 0.05) - << "incorrect value for cov_d_d, expected 0.0328813754022, is " - << last_msg_->cov_d_d; - EXPECT_LT((last_msg_->cov_e_d * 100 - -0.000843927089591 * 100), 0.05) - << "incorrect value for cov_e_d, expected -0.000843927089591, is " - << last_msg_->cov_e_d; - EXPECT_LT((last_msg_->cov_e_e * 100 - 0.00452379882336 * 100), 0.05) - << "incorrect value for cov_e_e, expected 0.00452379882336, is " - << last_msg_->cov_e_e; - EXPECT_LT((last_msg_->cov_n_d * 100 - 0.00185631681234 * 100), 0.05) - << "incorrect value for cov_n_d, expected 0.00185631681234, is " - << last_msg_->cov_n_d; - EXPECT_LT((last_msg_->cov_n_e * 100 - -0.000367559667211 * 100), 0.05) - << "incorrect value for cov_n_e, expected -0.000367559667211, is " - << last_msg_->cov_n_e; - EXPECT_LT((last_msg_->cov_n_n * 100 - 0.00748897157609 * 100), 0.05) - << "incorrect value for cov_n_n, expected 0.00748897157609, is " - << last_msg_->cov_n_n; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 4) - << "incorrect value for flags, expected 4, is " << last_msg_->flags; - EXPECT_LT((last_msg_->height * 100 - -17.3938212478 * 100), 0.05) - << "incorrect value for height, expected -17.3938212478, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.831231965 * 100), 0.05) - << "incorrect value for lat, expected 37.831231965, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -122.28650381 * 100), 0.05) - << "incorrect value for lon, expected -122.28650381, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 18) - << "incorrect value for n_sats, expected 18, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 501867800) - << "incorrect value for tow, expected 501867800, is " << last_msg_->tow; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLlhGnss.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLlhGnss.cc deleted file mode 100644 index 7a3c852e94..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPosLlhGnss.cc +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPosLlhGnss.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgPosLlhGnss0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPosLlhGnss0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pos_llh_gnss_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pos_llh_gnss_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPosLlhGnss0, Test) { - uint8_t encoded_frame[] = { - 85, 42, 2, 0, 16, 34, 24, 229, 233, 29, 73, 123, 28, 207, - 101, 234, 66, 64, 100, 168, 19, 20, 86, 146, 94, 192, 214, 198, - 35, 120, 209, 100, 49, 192, 87, 0, 181, 0, 18, 4, 105, 55, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pos_llh_gnss_t *test_msg = (msg_pos_llh_gnss_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 4; - test_msg->h_accuracy = 87; - test_msg->height = -17.39382124780135; - test_msg->lat = 37.83123196497633; - test_msg->lon = -122.28650381011681; - test_msg->n_sats = 18; - test_msg->tow = 501867800; - test_msg->v_accuracy = 181; - - EXPECT_EQ(send_message(0x22a, 4096, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 4096); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 4) - << "incorrect value for flags, expected 4, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 87) - << "incorrect value for h_accuracy, expected 87, is " - << last_msg_->h_accuracy; - EXPECT_LT((last_msg_->height * 100 - -17.3938212478 * 100), 0.05) - << "incorrect value for height, expected -17.3938212478, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.831231965 * 100), 0.05) - << "incorrect value for lat, expected 37.831231965, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -122.28650381 * 100), 0.05) - << "incorrect value for lon, expected -122.28650381, is " - << last_msg_->lon; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 18) - << "incorrect value for n_sats, expected 18, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 501867800) - << "incorrect value for tow, expected 501867800, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 181) - << "incorrect value for v_accuracy, expected 181, is " - << last_msg_->v_accuracy; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPoseRelative.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPoseRelative.cc deleted file mode 100644 index 25fafcd8f8..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgPoseRelative.cc +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgPoseRelative.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgPoseRelative0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgPoseRelative0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pose_relative_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pose_relative_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgPoseRelative0, Test) { - uint8_t encoded_frame[] = { - 85, 69, 2, 66, 0, 90, 86, 4, 0, 0, 0, 86, 4, 0, - 0, 172, 8, 0, 0, 76, 4, 0, 0, 38, 2, 0, 0, 100, - 0, 0, 0, 100, 3, 200, 204, 252, 168, 157, 255, 115, 53, 186, - 144, 190, 48, 34, 37, 0, 0, 128, 63, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 128, - 63, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 64, 5, 171, 187, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pose_relative_t *test_msg = (msg_pose_relative_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cov_c_x_x = 2.0; - test_msg->cov_c_x_y = 0.0; - test_msg->cov_c_x_z = 0.0; - test_msg->cov_c_y_y = 2.0; - test_msg->cov_c_y_z = 0.0; - test_msg->cov_c_z_z = 2.0; - test_msg->cov_r_x_x = 1.0; - test_msg->cov_r_x_y = 0.0; - test_msg->cov_r_x_z = 0.0; - test_msg->cov_r_y_y = 1.0; - test_msg->cov_r_y_z = 0.0; - test_msg->cov_r_z_z = 1.0; - test_msg->flags = 5; - test_msg->sensor_id = 0; - test_msg->timestamp_1 = 1110; - test_msg->timestamp_2 = 2220; - test_msg->tow = 1110; - if (sizeof(test_msg->trans) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->trans[0])); - } - test_msg->trans[0] = 1100; - if (sizeof(test_msg->trans) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->trans[0])); - } - test_msg->trans[1] = 550; - if (sizeof(test_msg->trans) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->trans[0])); - } - test_msg->trans[2] = 100; - test_msg->w = -859307164; - test_msg->x = -6444804; - test_msg->y = -1866844813; - test_msg->z = 622997694; - - EXPECT_EQ(send_message(0x245, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cov_c_x_x * 100 - 2.0 * 100), 0.05) - << "incorrect value for cov_c_x_x, expected 2.0, is " - << last_msg_->cov_c_x_x; - EXPECT_LT((last_msg_->cov_c_x_y * 100 - 0.0 * 100), 0.05) - << "incorrect value for cov_c_x_y, expected 0.0, is " - << last_msg_->cov_c_x_y; - EXPECT_LT((last_msg_->cov_c_x_z * 100 - 0.0 * 100), 0.05) - << "incorrect value for cov_c_x_z, expected 0.0, is " - << last_msg_->cov_c_x_z; - EXPECT_LT((last_msg_->cov_c_y_y * 100 - 2.0 * 100), 0.05) - << "incorrect value for cov_c_y_y, expected 2.0, is " - << last_msg_->cov_c_y_y; - EXPECT_LT((last_msg_->cov_c_y_z * 100 - 0.0 * 100), 0.05) - << "incorrect value for cov_c_y_z, expected 0.0, is " - << last_msg_->cov_c_y_z; - EXPECT_LT((last_msg_->cov_c_z_z * 100 - 2.0 * 100), 0.05) - << "incorrect value for cov_c_z_z, expected 2.0, is " - << last_msg_->cov_c_z_z; - EXPECT_LT((last_msg_->cov_r_x_x * 100 - 1.0 * 100), 0.05) - << "incorrect value for cov_r_x_x, expected 1.0, is " - << last_msg_->cov_r_x_x; - EXPECT_LT((last_msg_->cov_r_x_y * 100 - 0.0 * 100), 0.05) - << "incorrect value for cov_r_x_y, expected 0.0, is " - << last_msg_->cov_r_x_y; - EXPECT_LT((last_msg_->cov_r_x_z * 100 - 0.0 * 100), 0.05) - << "incorrect value for cov_r_x_z, expected 0.0, is " - << last_msg_->cov_r_x_z; - EXPECT_LT((last_msg_->cov_r_y_y * 100 - 1.0 * 100), 0.05) - << "incorrect value for cov_r_y_y, expected 1.0, is " - << last_msg_->cov_r_y_y; - EXPECT_LT((last_msg_->cov_r_y_z * 100 - 0.0 * 100), 0.05) - << "incorrect value for cov_r_y_z, expected 0.0, is " - << last_msg_->cov_r_y_z; - EXPECT_LT((last_msg_->cov_r_z_z * 100 - 1.0 * 100), 0.05) - << "incorrect value for cov_r_z_z, expected 1.0, is " - << last_msg_->cov_r_z_z; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 5) - << "incorrect value for flags, expected 5, is " << last_msg_->flags; - EXPECT_EQ(get_assensor_id)>( - reinterpret_cast(&last_msg_->sensor_id)), - 0) - << "incorrect value for sensor_id, expected 0, is " - << last_msg_->sensor_id; - EXPECT_EQ(get_astimestamp_1)>( - reinterpret_cast(&last_msg_->timestamp_1)), - 1110) - << "incorrect value for timestamp_1, expected 1110, is " - << last_msg_->timestamp_1; - EXPECT_EQ(get_astimestamp_2)>( - reinterpret_cast(&last_msg_->timestamp_2)), - 2220) - << "incorrect value for timestamp_2, expected 2220, is " - << last_msg_->timestamp_2; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 1110) - << "incorrect value for tow, expected 1110, is " << last_msg_->tow; - EXPECT_EQ(get_astrans[0])>( - reinterpret_cast(&last_msg_->trans[0])), - 1100) - << "incorrect value for trans[0], expected 1100, is " - << last_msg_->trans[0]; - EXPECT_EQ(get_astrans[1])>( - reinterpret_cast(&last_msg_->trans[1])), - 550) - << "incorrect value for trans[1], expected 550, is " - << last_msg_->trans[1]; - EXPECT_EQ(get_astrans[2])>( - reinterpret_cast(&last_msg_->trans[2])), - 100) - << "incorrect value for trans[2], expected 100, is " - << last_msg_->trans[2]; - EXPECT_EQ(get_asw)>( - reinterpret_cast(&last_msg_->w)), - -859307164) - << "incorrect value for w, expected -859307164, is " << last_msg_->w; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -6444804) - << "incorrect value for x, expected -6444804, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -1866844813) - << "incorrect value for y, expected -1866844813, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 622997694) - << "incorrect value for z, expected 622997694, is " << last_msg_->z; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgProtectionLevel.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgProtectionLevel.cc deleted file mode 100644 index 23cb1706c8..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgProtectionLevel.cc +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgProtectionLevel.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgProtectionLevel0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgProtectionLevel0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_protection_level_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_protection_level_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgProtectionLevel0, Test) { - uint8_t encoded_frame[] = { - 85, 23, 2, 45, 3, 76, 110, 84, 4, 242, 46, 51, 53, 160, - 89, 84, 167, 41, 57, 21, 217, 244, 61, 161, 83, 104, 140, 137, - 90, 246, 51, 51, 51, 51, 51, 170, 180, 64, 154, 153, 153, 153, - 25, 88, 195, 64, 51, 51, 51, 51, 51, 195, 121, 64, 231, 251, - 38, 221, 208, 183, 167, 80, 223, 26, 97, 164, 45, 46, 186, 60, - 235, 227, 183, 160, 187, 93, 116, 224, 105, 40, 32, 33, 133, 188, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_protection_level_t *test_msg = (msg_protection_level_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->atpl = 10663; - test_msg->ctpl = 5433; - test_msg->flags = 555755625; - test_msg->heading = -529244741; - test_msg->height = 412.2; - test_msg->hopl = 26707; - test_msg->hpl = 41013; - test_msg->hvpl = 62681; - test_msg->lat = 5290.2; - test_msg->lon = 9904.2; - test_msg->pitch = -1598561301; - test_msg->popl = 35212; - test_msg->roll = 1018834477; - test_msg->ropl = 63066; - test_msg->tow = 4060370030; - test_msg->v_x = -584647705; - test_msg->v_y = 1353168848; - test_msg->v_z = -1537140001; - test_msg->vpl = 21593; - test_msg->vvpl = 41277; - test_msg->wn = 13102; - - EXPECT_EQ(send_message(0x217, 813, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 813); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asatpl)>( - reinterpret_cast(&last_msg_->atpl)), - 10663) - << "incorrect value for atpl, expected 10663, is " << last_msg_->atpl; - EXPECT_EQ(get_asctpl)>( - reinterpret_cast(&last_msg_->ctpl)), - 5433) - << "incorrect value for ctpl, expected 5433, is " << last_msg_->ctpl; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 555755625) - << "incorrect value for flags, expected 555755625, is " - << last_msg_->flags; - EXPECT_EQ(get_asheading)>( - reinterpret_cast(&last_msg_->heading)), - -529244741) - << "incorrect value for heading, expected -529244741, is " - << last_msg_->heading; - EXPECT_LT((last_msg_->height * 100 - 412.2 * 100), 0.05) - << "incorrect value for height, expected 412.2, is " << last_msg_->height; - EXPECT_EQ(get_ashopl)>( - reinterpret_cast(&last_msg_->hopl)), - 26707) - << "incorrect value for hopl, expected 26707, is " << last_msg_->hopl; - EXPECT_EQ(get_ashpl)>( - reinterpret_cast(&last_msg_->hpl)), - 41013) - << "incorrect value for hpl, expected 41013, is " << last_msg_->hpl; - EXPECT_EQ(get_ashvpl)>( - reinterpret_cast(&last_msg_->hvpl)), - 62681) - << "incorrect value for hvpl, expected 62681, is " << last_msg_->hvpl; - EXPECT_LT((last_msg_->lat * 100 - 5290.2 * 100), 0.05) - << "incorrect value for lat, expected 5290.2, is " << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - 9904.2 * 100), 0.05) - << "incorrect value for lon, expected 9904.2, is " << last_msg_->lon; - EXPECT_EQ(get_aspitch)>( - reinterpret_cast(&last_msg_->pitch)), - -1598561301) - << "incorrect value for pitch, expected -1598561301, is " - << last_msg_->pitch; - EXPECT_EQ(get_aspopl)>( - reinterpret_cast(&last_msg_->popl)), - 35212) - << "incorrect value for popl, expected 35212, is " << last_msg_->popl; - EXPECT_EQ(get_asroll)>( - reinterpret_cast(&last_msg_->roll)), - 1018834477) - << "incorrect value for roll, expected 1018834477, is " - << last_msg_->roll; - EXPECT_EQ(get_asropl)>( - reinterpret_cast(&last_msg_->ropl)), - 63066) - << "incorrect value for ropl, expected 63066, is " << last_msg_->ropl; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 4060370030) - << "incorrect value for tow, expected 4060370030, is " << last_msg_->tow; - EXPECT_EQ(get_asv_x)>( - reinterpret_cast(&last_msg_->v_x)), - -584647705) - << "incorrect value for v_x, expected -584647705, is " << last_msg_->v_x; - EXPECT_EQ(get_asv_y)>( - reinterpret_cast(&last_msg_->v_y)), - 1353168848) - << "incorrect value for v_y, expected 1353168848, is " << last_msg_->v_y; - EXPECT_EQ(get_asv_z)>( - reinterpret_cast(&last_msg_->v_z)), - -1537140001) - << "incorrect value for v_z, expected -1537140001, is " << last_msg_->v_z; - EXPECT_EQ(get_asvpl)>( - reinterpret_cast(&last_msg_->vpl)), - 21593) - << "incorrect value for vpl, expected 21593, is " << last_msg_->vpl; - EXPECT_EQ(get_asvvpl)>( - reinterpret_cast(&last_msg_->vvpl)), - 41277) - << "incorrect value for vvpl, expected 41277, is " << last_msg_->vvpl; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 13102) - << "incorrect value for wn, expected 13102, is " << last_msg_->wn; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgProtectionLevelDepA.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgProtectionLevelDepA.cc deleted file mode 100644 index ece8ef89c5..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgProtectionLevelDepA.cc +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgProtectionLevelDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgProtectionLevelDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgProtectionLevelDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_protection_level_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_protection_level_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgProtectionLevelDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 22, 2, 148, 22, 33, 52, 126, 69, 185, 47, 85, 4, 139, - 51, 51, 51, 51, 51, 244, 190, 64, 102, 102, 102, 102, 102, 204, - 168, 64, 154, 153, 153, 153, 25, 39, 192, 64, 248, 81, 104, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_protection_level_dep_a_t *test_msg = - (msg_protection_level_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 248; - test_msg->height = 8270.2; - test_msg->hpl = 35588; - test_msg->lat = 7924.2; - test_msg->lon = 3174.2; - test_msg->tow = 3108339252; - test_msg->vpl = 21807; - - EXPECT_EQ(send_message(0x216, 5780, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 5780); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 248) - << "incorrect value for flags, expected 248, is " << last_msg_->flags; - EXPECT_LT((last_msg_->height * 100 - 8270.2 * 100), 0.05) - << "incorrect value for height, expected 8270.2, is " - << last_msg_->height; - EXPECT_EQ(get_ashpl)>( - reinterpret_cast(&last_msg_->hpl)), - 35588) - << "incorrect value for hpl, expected 35588, is " << last_msg_->hpl; - EXPECT_LT((last_msg_->lat * 100 - 7924.2 * 100), 0.05) - << "incorrect value for lat, expected 7924.2, is " << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - 3174.2 * 100), 0.05) - << "incorrect value for lon, expected 3174.2, is " << last_msg_->lon; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 3108339252) - << "incorrect value for tow, expected 3108339252, is " << last_msg_->tow; - EXPECT_EQ(get_asvpl)>( - reinterpret_cast(&last_msg_->vpl)), - 21807) - << "incorrect value for vpl, expected 21807, is " << last_msg_->vpl; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgReferenceFrameParam.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgReferenceFrameParam.cc deleted file mode 100644 index 6a596d4d31..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgReferenceFrameParam.cc +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgReferenceFrameParam.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgReferenceFrameParam0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgReferenceFrameParam0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_reference_frame_param_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_reference_frame_param_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgReferenceFrameParam0, Test) { - uint8_t encoded_frame[] = { - 85, 68, 2, 66, 0, 124, 1, 102, 111, 111, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 98, 97, 114, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 4, 5, 0, 6, 0, 7, 0, 0, 0, 8, 0, 0, 0, 9, - 0, 0, 0, 10, 0, 0, 0, 11, 0, 0, 0, 12, 0, 0, 0, 13, 0, - 0, 0, 14, 0, 0, 0, 15, 0, 0, 0, 16, 0, 0, 0, 17, 0, 0, - 0, 18, 0, 0, 0, 19, 0, 0, 0, 20, 0, 6, 161, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_reference_frame_param_t *test_msg = - (msg_reference_frame_param_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->delta_X0 = 7; - test_msg->delta_Y0 = 8; - test_msg->delta_Z0 = 9; - test_msg->dot_delta_X0 = 14; - test_msg->dot_delta_Y0 = 15; - test_msg->dot_delta_Z0 = 16; - test_msg->dot_scale = 20; - test_msg->dot_theta_01 = 17; - test_msg->dot_theta_02 = 18; - test_msg->dot_theta_03 = 19; - test_msg->re_t0 = 6; - test_msg->scale = 13; - test_msg->sin = 4; - { - const char assign_string[] = { - (char)102, (char)111, (char)111, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->sn, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->sn) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->ssr_iod = 1; - test_msg->theta_01 = 10; - test_msg->theta_02 = 11; - test_msg->theta_03 = 12; - { - const char assign_string[] = { - (char)98, (char)97, (char)114, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->tn, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->tn) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->utn = 5; - - EXPECT_EQ(send_message(580, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asdelta_X0)>( - reinterpret_cast(&last_msg_->delta_X0)), - 7) - << "incorrect value for delta_X0, expected 7, is " << last_msg_->delta_X0; - EXPECT_EQ(get_asdelta_Y0)>( - reinterpret_cast(&last_msg_->delta_Y0)), - 8) - << "incorrect value for delta_Y0, expected 8, is " << last_msg_->delta_Y0; - EXPECT_EQ(get_asdelta_Z0)>( - reinterpret_cast(&last_msg_->delta_Z0)), - 9) - << "incorrect value for delta_Z0, expected 9, is " << last_msg_->delta_Z0; - EXPECT_EQ(get_asdot_delta_X0)>( - reinterpret_cast(&last_msg_->dot_delta_X0)), - 14) - << "incorrect value for dot_delta_X0, expected 14, is " - << last_msg_->dot_delta_X0; - EXPECT_EQ(get_asdot_delta_Y0)>( - reinterpret_cast(&last_msg_->dot_delta_Y0)), - 15) - << "incorrect value for dot_delta_Y0, expected 15, is " - << last_msg_->dot_delta_Y0; - EXPECT_EQ(get_asdot_delta_Z0)>( - reinterpret_cast(&last_msg_->dot_delta_Z0)), - 16) - << "incorrect value for dot_delta_Z0, expected 16, is " - << last_msg_->dot_delta_Z0; - EXPECT_EQ(get_asdot_scale)>( - reinterpret_cast(&last_msg_->dot_scale)), - 20) - << "incorrect value for dot_scale, expected 20, is " - << last_msg_->dot_scale; - EXPECT_EQ(get_asdot_theta_01)>( - reinterpret_cast(&last_msg_->dot_theta_01)), - 17) - << "incorrect value for dot_theta_01, expected 17, is " - << last_msg_->dot_theta_01; - EXPECT_EQ(get_asdot_theta_02)>( - reinterpret_cast(&last_msg_->dot_theta_02)), - 18) - << "incorrect value for dot_theta_02, expected 18, is " - << last_msg_->dot_theta_02; - EXPECT_EQ(get_asdot_theta_03)>( - reinterpret_cast(&last_msg_->dot_theta_03)), - 19) - << "incorrect value for dot_theta_03, expected 19, is " - << last_msg_->dot_theta_03; - EXPECT_EQ(get_asre_t0)>( - reinterpret_cast(&last_msg_->re_t0)), - 6) - << "incorrect value for re_t0, expected 6, is " << last_msg_->re_t0; - EXPECT_EQ(get_asscale)>( - reinterpret_cast(&last_msg_->scale)), - 13) - << "incorrect value for scale, expected 13, is " << last_msg_->scale; - EXPECT_EQ(get_assin)>( - reinterpret_cast(&last_msg_->sin)), - 4) - << "incorrect value for sin, expected 4, is " << last_msg_->sin; - { - const char check_string[] = { - (char)102, (char)111, (char)111, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->sn, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->sn, expected string '" - << check_string << "', is '" << last_msg_->sn << "'"; - } - EXPECT_EQ(get_asssr_iod)>( - reinterpret_cast(&last_msg_->ssr_iod)), - 1) - << "incorrect value for ssr_iod, expected 1, is " << last_msg_->ssr_iod; - EXPECT_EQ(get_astheta_01)>( - reinterpret_cast(&last_msg_->theta_01)), - 10) - << "incorrect value for theta_01, expected 10, is " - << last_msg_->theta_01; - EXPECT_EQ(get_astheta_02)>( - reinterpret_cast(&last_msg_->theta_02)), - 11) - << "incorrect value for theta_02, expected 11, is " - << last_msg_->theta_02; - EXPECT_EQ(get_astheta_03)>( - reinterpret_cast(&last_msg_->theta_03)), - 12) - << "incorrect value for theta_03, expected 12, is " - << last_msg_->theta_03; - { - const char check_string[] = { - (char)98, (char)97, (char)114, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->tn, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->tn, expected string '" - << check_string << "', is '" << last_msg_->tn << "'"; - } - EXPECT_EQ(get_asutn)>( - reinterpret_cast(&last_msg_->utn)), - 5) - << "incorrect value for utn, expected 5, is " << last_msg_->utn; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgUTCLeapSecond.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgUTCLeapSecond.cc deleted file mode 100644 index 0e4296d734..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgUTCLeapSecond.cc +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgUTCLeapSecond.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgUTCLeapSecond0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgUTCLeapSecond0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_utc_leap_second_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_utc_leap_second_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgUTCLeapSecond0, Test) { - uint8_t encoded_frame[] = { - 85, 58, 2, 66, 0, 14, 1, 0, 2, 0, 3, 4, 5, 0, 6, 0, 7, 0, 8, 9, 50, 232, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_utc_leap_second_t *test_msg = (msg_utc_leap_second_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->count_after = 9; - test_msg->count_before = 4; - test_msg->ref_dn = 8; - test_msg->ref_wn = 7; - test_msg->reserved_0 = 1; - test_msg->reserved_1 = 2; - test_msg->reserved_2 = 3; - test_msg->reserved_3 = 5; - test_msg->reserved_4 = 6; - - EXPECT_EQ(send_message(570, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascount_after)>( - reinterpret_cast(&last_msg_->count_after)), - 9) - << "incorrect value for count_after, expected 9, is " - << last_msg_->count_after; - EXPECT_EQ(get_ascount_before)>( - reinterpret_cast(&last_msg_->count_before)), - 4) - << "incorrect value for count_before, expected 4, is " - << last_msg_->count_before; - EXPECT_EQ(get_asref_dn)>( - reinterpret_cast(&last_msg_->ref_dn)), - 8) - << "incorrect value for ref_dn, expected 8, is " << last_msg_->ref_dn; - EXPECT_EQ(get_asref_wn)>( - reinterpret_cast(&last_msg_->ref_wn)), - 7) - << "incorrect value for ref_wn, expected 7, is " << last_msg_->ref_wn; - EXPECT_EQ(get_asreserved_0)>( - reinterpret_cast(&last_msg_->reserved_0)), - 1) - << "incorrect value for reserved_0, expected 1, is " - << last_msg_->reserved_0; - EXPECT_EQ(get_asreserved_1)>( - reinterpret_cast(&last_msg_->reserved_1)), - 2) - << "incorrect value for reserved_1, expected 2, is " - << last_msg_->reserved_1; - EXPECT_EQ(get_asreserved_2)>( - reinterpret_cast(&last_msg_->reserved_2)), - 3) - << "incorrect value for reserved_2, expected 3, is " - << last_msg_->reserved_2; - EXPECT_EQ(get_asreserved_3)>( - reinterpret_cast(&last_msg_->reserved_3)), - 5) - << "incorrect value for reserved_3, expected 5, is " - << last_msg_->reserved_3; - EXPECT_EQ(get_asreserved_4)>( - reinterpret_cast(&last_msg_->reserved_4)), - 6) - << "incorrect value for reserved_4, expected 6, is " - << last_msg_->reserved_4; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgUTCTime.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgUTCTime.cc deleted file mode 100644 index 72eda11455..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgUTCTime.cc +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgUTCTime.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgUTCTime0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgUTCTime0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_utc_time_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_utc_time_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgUTCTime0, Test) { - uint8_t encoded_frame[] = { - 85, 3, 1, 21, 3, 16, 1, 24, 229, 233, 29, 229, - 7, 4, 9, 19, 24, 9, 0, 8, 175, 47, 199, 253, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_utc_time_t *test_msg = (msg_utc_time_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->day = 9; - test_msg->flags = 1; - test_msg->hours = 19; - test_msg->minutes = 24; - test_msg->month = 4; - test_msg->ns = 800000000; - test_msg->seconds = 9; - test_msg->tow = 501867800; - test_msg->year = 2021; - - EXPECT_EQ(send_message(0x103, 789, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 789); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asday)>( - reinterpret_cast(&last_msg_->day)), - 9) - << "incorrect value for day, expected 9, is " << last_msg_->day; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_ashours)>( - reinterpret_cast(&last_msg_->hours)), - 19) - << "incorrect value for hours, expected 19, is " << last_msg_->hours; - EXPECT_EQ(get_asminutes)>( - reinterpret_cast(&last_msg_->minutes)), - 24) - << "incorrect value for minutes, expected 24, is " << last_msg_->minutes; - EXPECT_EQ(get_asmonth)>( - reinterpret_cast(&last_msg_->month)), - 4) - << "incorrect value for month, expected 4, is " << last_msg_->month; - EXPECT_EQ(get_asns)>( - reinterpret_cast(&last_msg_->ns)), - 800000000) - << "incorrect value for ns, expected 800000000, is " << last_msg_->ns; - EXPECT_EQ(get_asseconds)>( - reinterpret_cast(&last_msg_->seconds)), - 9) - << "incorrect value for seconds, expected 9, is " << last_msg_->seconds; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 501867800) - << "incorrect value for tow, expected 501867800, is " << last_msg_->tow; - EXPECT_EQ(get_asyear)>( - reinterpret_cast(&last_msg_->year)), - 2021) - << "incorrect value for year, expected 2021, is " << last_msg_->year; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgUTCTimeGNSS.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgUTCTimeGNSS.cc deleted file mode 100644 index 762b3ed2a0..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgUTCTimeGNSS.cc +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgUTCTimeGNSS.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgUTCTimeGNSS0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgUTCTimeGNSS0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_utc_time_gnss_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_utc_time_gnss_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgUTCTimeGNSS0, Test) { - uint8_t encoded_frame[] = { - 85, 5, 1, 21, 3, 16, 1, 24, 229, 233, 29, 229, - 7, 4, 9, 19, 24, 9, 0, 8, 175, 47, 177, 33, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_utc_time_gnss_t *test_msg = (msg_utc_time_gnss_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->day = 9; - test_msg->flags = 1; - test_msg->hours = 19; - test_msg->minutes = 24; - test_msg->month = 4; - test_msg->ns = 800000000; - test_msg->seconds = 9; - test_msg->tow = 501867800; - test_msg->year = 2021; - - EXPECT_EQ(send_message(0x105, 789, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 789); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asday)>( - reinterpret_cast(&last_msg_->day)), - 9) - << "incorrect value for day, expected 9, is " << last_msg_->day; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_ashours)>( - reinterpret_cast(&last_msg_->hours)), - 19) - << "incorrect value for hours, expected 19, is " << last_msg_->hours; - EXPECT_EQ(get_asminutes)>( - reinterpret_cast(&last_msg_->minutes)), - 24) - << "incorrect value for minutes, expected 24, is " << last_msg_->minutes; - EXPECT_EQ(get_asmonth)>( - reinterpret_cast(&last_msg_->month)), - 4) - << "incorrect value for month, expected 4, is " << last_msg_->month; - EXPECT_EQ(get_asns)>( - reinterpret_cast(&last_msg_->ns)), - 800000000) - << "incorrect value for ns, expected 800000000, is " << last_msg_->ns; - EXPECT_EQ(get_asseconds)>( - reinterpret_cast(&last_msg_->seconds)), - 9) - << "incorrect value for seconds, expected 9, is " << last_msg_->seconds; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 501867800) - << "incorrect value for tow, expected 501867800, is " << last_msg_->tow; - EXPECT_EQ(get_asyear)>( - reinterpret_cast(&last_msg_->year)), - 2021) - << "incorrect value for year, expected 2021, is " << last_msg_->year; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelBody.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelBody.cc deleted file mode 100644 index 62acc5a989..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelBody.cc +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelBody.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelBody0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelBody0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_body_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_body_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelBody0, Test) { - uint8_t encoded_frame[] = { - 85, 19, 2, 66, 0, 42, 1, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 64, 0, 0, 224, 64, - 0, 0, 224, 64, 0, 0, 64, 64, 0, 0, 0, 64, 3, 8, 120, 144, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_body_t *test_msg = (msg_vel_body_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cov_x_x = 0.0; - test_msg->cov_x_y = 5.0; - test_msg->cov_x_z = 7.0; - test_msg->cov_y_y = 7.0; - test_msg->cov_y_z = 3.0; - test_msg->cov_z_z = 2.0; - test_msg->flags = 8; - test_msg->n_sats = 3; - test_msg->tow = 1; - test_msg->x = 4; - test_msg->y = 2; - test_msg->z = 1; - - EXPECT_EQ(send_message(0x213, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cov_x_x * 100 - 0.0 * 100), 0.05) - << "incorrect value for cov_x_x, expected 0.0, is " << last_msg_->cov_x_x; - EXPECT_LT((last_msg_->cov_x_y * 100 - 5.0 * 100), 0.05) - << "incorrect value for cov_x_y, expected 5.0, is " << last_msg_->cov_x_y; - EXPECT_LT((last_msg_->cov_x_z * 100 - 7.0 * 100), 0.05) - << "incorrect value for cov_x_z, expected 7.0, is " << last_msg_->cov_x_z; - EXPECT_LT((last_msg_->cov_y_y * 100 - 7.0 * 100), 0.05) - << "incorrect value for cov_y_y, expected 7.0, is " << last_msg_->cov_y_y; - EXPECT_LT((last_msg_->cov_y_z * 100 - 3.0 * 100), 0.05) - << "incorrect value for cov_y_z, expected 3.0, is " << last_msg_->cov_y_z; - EXPECT_LT((last_msg_->cov_z_z * 100 - 2.0 * 100), 0.05) - << "incorrect value for cov_z_z, expected 2.0, is " << last_msg_->cov_z_z; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 8) - << "incorrect value for flags, expected 8, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 3) - << "incorrect value for n_sats, expected 3, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 1) - << "incorrect value for tow, expected 1, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - 4) - << "incorrect value for x, expected 4, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - 2) - << "incorrect value for y, expected 2, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 1) - << "incorrect value for z, expected 1, is " << last_msg_->z; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelCog.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelCog.cc deleted file mode 100644 index 86972b6216..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelCog.cc +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelCog.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelCog0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelCog0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_cog_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_cog_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelCog0, Test) { - uint8_t encoded_frame[] = { - 85, 28, 2, 211, 136, 30, 48, 246, 122, 19, 232, 3, 0, - 0, 208, 7, 0, 0, 184, 11, 0, 0, 160, 15, 0, 0, - 136, 19, 0, 0, 112, 23, 0, 0, 62, 0, 212, 193, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_cog_t *test_msg = (msg_vel_cog_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cog = 1000; - test_msg->cog_accuracy = 4000; - test_msg->flags = 62; - test_msg->sog = 2000; - test_msg->sog_accuracy = 5000; - test_msg->tow = 326825520; - test_msg->v_up = 3000; - test_msg->v_up_accuracy = 6000; - - EXPECT_EQ(send_message(0x21C, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascog)>( - reinterpret_cast(&last_msg_->cog)), - 1000) - << "incorrect value for cog, expected 1000, is " << last_msg_->cog; - EXPECT_EQ(get_ascog_accuracy)>( - reinterpret_cast(&last_msg_->cog_accuracy)), - 4000) - << "incorrect value for cog_accuracy, expected 4000, is " - << last_msg_->cog_accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 62) - << "incorrect value for flags, expected 62, is " << last_msg_->flags; - EXPECT_EQ(get_assog)>( - reinterpret_cast(&last_msg_->sog)), - 2000) - << "incorrect value for sog, expected 2000, is " << last_msg_->sog; - EXPECT_EQ(get_assog_accuracy)>( - reinterpret_cast(&last_msg_->sog_accuracy)), - 5000) - << "incorrect value for sog_accuracy, expected 5000, is " - << last_msg_->sog_accuracy; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326825520) - << "incorrect value for tow, expected 326825520, is " << last_msg_->tow; - EXPECT_EQ(get_asv_up)>( - reinterpret_cast(&last_msg_->v_up)), - 3000) - << "incorrect value for v_up, expected 3000, is " << last_msg_->v_up; - EXPECT_EQ(get_asv_up_accuracy)>( - reinterpret_cast(&last_msg_->v_up_accuracy)), - 6000) - << "incorrect value for v_up_accuracy, expected 6000, is " - << last_msg_->v_up_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelCog1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelCog1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_cog_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_cog_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelCog1, Test) { - uint8_t encoded_frame[] = { - 85, 28, 2, 211, 136, 30, 48, 246, 122, 19, 123, 0, 0, - 0, 200, 1, 0, 0, 24, 252, 255, 255, 0, 149, 186, 10, - 100, 0, 0, 0, 100, 0, 0, 0, 0, 0, 90, 114, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_cog_t *test_msg = (msg_vel_cog_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cog = 123; - test_msg->cog_accuracy = 180000000; - test_msg->flags = 0; - test_msg->sog = 456; - test_msg->sog_accuracy = 100; - test_msg->tow = 326825520; - test_msg->v_up = -1000; - test_msg->v_up_accuracy = 100; - - EXPECT_EQ(send_message(0x21C, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascog)>( - reinterpret_cast(&last_msg_->cog)), - 123) - << "incorrect value for cog, expected 123, is " << last_msg_->cog; - EXPECT_EQ(get_ascog_accuracy)>( - reinterpret_cast(&last_msg_->cog_accuracy)), - 180000000) - << "incorrect value for cog_accuracy, expected 180000000, is " - << last_msg_->cog_accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_assog)>( - reinterpret_cast(&last_msg_->sog)), - 456) - << "incorrect value for sog, expected 456, is " << last_msg_->sog; - EXPECT_EQ(get_assog_accuracy)>( - reinterpret_cast(&last_msg_->sog_accuracy)), - 100) - << "incorrect value for sog_accuracy, expected 100, is " - << last_msg_->sog_accuracy; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326825520) - << "incorrect value for tow, expected 326825520, is " << last_msg_->tow; - EXPECT_EQ(get_asv_up)>( - reinterpret_cast(&last_msg_->v_up)), - -1000) - << "incorrect value for v_up, expected -1000, is " << last_msg_->v_up; - EXPECT_EQ(get_asv_up_accuracy)>( - reinterpret_cast(&last_msg_->v_up_accuracy)), - 100) - << "incorrect value for v_up_accuracy, expected 100, is " - << last_msg_->v_up_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelCog2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelCog2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_cog_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_cog_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelCog2, Test) { - uint8_t encoded_frame[] = { - 85, 28, 2, 211, 136, 30, 48, 246, 122, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 210, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_cog_t *test_msg = (msg_vel_cog_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cog = 0; - test_msg->cog_accuracy = 0; - test_msg->flags = 0; - test_msg->sog = 0; - test_msg->sog_accuracy = 0; - test_msg->tow = 326825520; - test_msg->v_up = 0; - test_msg->v_up_accuracy = 0; - - EXPECT_EQ(send_message(0x21C, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascog)>( - reinterpret_cast(&last_msg_->cog)), - 0) - << "incorrect value for cog, expected 0, is " << last_msg_->cog; - EXPECT_EQ(get_ascog_accuracy)>( - reinterpret_cast(&last_msg_->cog_accuracy)), - 0) - << "incorrect value for cog_accuracy, expected 0, is " - << last_msg_->cog_accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_assog)>( - reinterpret_cast(&last_msg_->sog)), - 0) - << "incorrect value for sog, expected 0, is " << last_msg_->sog; - EXPECT_EQ(get_assog_accuracy)>( - reinterpret_cast(&last_msg_->sog_accuracy)), - 0) - << "incorrect value for sog_accuracy, expected 0, is " - << last_msg_->sog_accuracy; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326825520) - << "incorrect value for tow, expected 326825520, is " << last_msg_->tow; - EXPECT_EQ(get_asv_up)>( - reinterpret_cast(&last_msg_->v_up)), - 0) - << "incorrect value for v_up, expected 0, is " << last_msg_->v_up; - EXPECT_EQ(get_asv_up_accuracy)>( - reinterpret_cast(&last_msg_->v_up_accuracy)), - 0) - << "incorrect value for v_up_accuracy, expected 0, is " - << last_msg_->v_up_accuracy; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelECEF.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelECEF.cc deleted file mode 100644 index 803e510f9a..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelECEF.cc +++ /dev/null @@ -1,623 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelECEF.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelECEF0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelECEF0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelECEF0, Test) { - uint8_t encoded_frame[] = { - 85, 13, 2, 211, 136, 20, 40, 244, 122, 19, 248, 255, 255, 255, - 251, 255, 255, 255, 10, 0, 0, 0, 0, 0, 14, 0, 181, 99, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_t *test_msg = (msg_vel_ecef_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 14; - test_msg->tow = 326825000; - test_msg->x = -8; - test_msg->y = -5; - test_msg->z = 10; - - EXPECT_EQ(send_message(0x20d, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 14) - << "incorrect value for n_sats, expected 14, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326825000) - << "incorrect value for tow, expected 326825000, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -8) - << "incorrect value for x, expected -8, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -5) - << "incorrect value for y, expected -5, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 10) - << "incorrect value for z, expected 10, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelECEF1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelECEF1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelECEF1, Test) { - uint8_t encoded_frame[] = { - 85, 13, 2, 211, 136, 20, 28, 246, 122, 19, 244, 255, 255, 255, - 238, 255, 255, 255, 11, 0, 0, 0, 0, 0, 15, 0, 215, 120, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_t *test_msg = (msg_vel_ecef_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 15; - test_msg->tow = 326825500; - test_msg->x = -12; - test_msg->y = -18; - test_msg->z = 11; - - EXPECT_EQ(send_message(0x20d, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326825500) - << "incorrect value for tow, expected 326825500, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -12) - << "incorrect value for x, expected -12, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -18) - << "incorrect value for y, expected -18, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 11) - << "incorrect value for z, expected 11, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelECEF2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelECEF2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelECEF2, Test) { - uint8_t encoded_frame[] = { - 85, 13, 2, 211, 136, 20, 16, 248, 122, 19, 248, 255, 255, 255, - 250, 255, 255, 255, 7, 0, 0, 0, 0, 0, 15, 0, 248, 221, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_t *test_msg = (msg_vel_ecef_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 15; - test_msg->tow = 326826000; - test_msg->x = -8; - test_msg->y = -6; - test_msg->z = 7; - - EXPECT_EQ(send_message(0x20d, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326826000) - << "incorrect value for tow, expected 326826000, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -8) - << "incorrect value for x, expected -8, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -6) - << "incorrect value for y, expected -6, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 7) - << "incorrect value for z, expected 7, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelECEF3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelECEF3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelECEF3, Test) { - uint8_t encoded_frame[] = { - 85, 13, 2, 211, 136, 20, 4, 250, 122, 19, 249, 255, 255, 255, - 239, 255, 255, 255, 16, 0, 0, 0, 0, 0, 15, 0, 1, 167, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_t *test_msg = (msg_vel_ecef_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 15; - test_msg->tow = 326826500; - test_msg->x = -7; - test_msg->y = -17; - test_msg->z = 16; - - EXPECT_EQ(send_message(0x20d, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326826500) - << "incorrect value for tow, expected 326826500, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -7) - << "incorrect value for x, expected -7, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -17) - << "incorrect value for y, expected -17, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 16) - << "incorrect value for z, expected 16, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelECEF4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelECEF4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelECEF4, Test) { - uint8_t encoded_frame[] = { - 85, 13, 2, 211, 136, 20, 248, 251, 122, 19, 247, 255, 255, 255, - 243, 255, 255, 255, 14, 0, 0, 0, 0, 0, 15, 0, 191, 43, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_t *test_msg = (msg_vel_ecef_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 15; - test_msg->tow = 326827000; - test_msg->x = -9; - test_msg->y = -13; - test_msg->z = 14; - - EXPECT_EQ(send_message(0x20d, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326827000) - << "incorrect value for tow, expected 326827000, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -9) - << "incorrect value for x, expected -9, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -13) - << "incorrect value for y, expected -13, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 14) - << "incorrect value for z, expected 14, is " << last_msg_->z; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelECEFCov.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelECEFCov.cc deleted file mode 100644 index 271776eab7..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelECEFCov.cc +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelECEFCov.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelECEFCov0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelECEFCov0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_cov_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_cov_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelECEFCov0, Test) { - uint8_t encoded_frame[] = { - 85, 21, 2, 66, 0, 42, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 6, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 0, 0, 64, - 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 64, 64, 3, 4, 91, 254, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_cov_t *test_msg = (msg_vel_ecef_cov_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cov_x_x = 2.0; - test_msg->cov_x_y = 2.0; - test_msg->cov_x_z = 2.0; - test_msg->cov_y_y = 2.0; - test_msg->cov_y_z = 1.0; - test_msg->cov_z_z = 3.0; - test_msg->flags = 4; - test_msg->n_sats = 3; - test_msg->tow = 2; - test_msg->x = 0; - test_msg->y = 0; - test_msg->z = 6; - - EXPECT_EQ(send_message(0x215, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cov_x_x * 100 - 2.0 * 100), 0.05) - << "incorrect value for cov_x_x, expected 2.0, is " << last_msg_->cov_x_x; - EXPECT_LT((last_msg_->cov_x_y * 100 - 2.0 * 100), 0.05) - << "incorrect value for cov_x_y, expected 2.0, is " << last_msg_->cov_x_y; - EXPECT_LT((last_msg_->cov_x_z * 100 - 2.0 * 100), 0.05) - << "incorrect value for cov_x_z, expected 2.0, is " << last_msg_->cov_x_z; - EXPECT_LT((last_msg_->cov_y_y * 100 - 2.0 * 100), 0.05) - << "incorrect value for cov_y_y, expected 2.0, is " << last_msg_->cov_y_y; - EXPECT_LT((last_msg_->cov_y_z * 100 - 1.0 * 100), 0.05) - << "incorrect value for cov_y_z, expected 1.0, is " << last_msg_->cov_y_z; - EXPECT_LT((last_msg_->cov_z_z * 100 - 3.0 * 100), 0.05) - << "incorrect value for cov_z_z, expected 3.0, is " << last_msg_->cov_z_z; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 4) - << "incorrect value for flags, expected 4, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 3) - << "incorrect value for n_sats, expected 3, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2) - << "incorrect value for tow, expected 2, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - 0) - << "incorrect value for x, expected 0, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - 0) - << "incorrect value for y, expected 0, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 6) - << "incorrect value for z, expected 6, is " << last_msg_->z; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelECEFDepA.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelECEFDepA.cc deleted file mode 100644 index 43e9e6f4c3..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelECEFDepA.cc +++ /dev/null @@ -1,1325 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelECEFDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 4, 2, 246, 215, 20, 20, 46, 39, 0, 218, 11, 0, 0, - 134, 245, 255, 255, 163, 252, 255, 255, 0, 0, 9, 0, 80, 236, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_dep_a_t *test_msg = (msg_vel_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 9; - test_msg->tow = 2567700; - test_msg->x = 3034; - test_msg->y = -2682; - test_msg->z = -861; - - EXPECT_EQ(send_message(0x204, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567700) - << "incorrect value for tow, expected 2567700, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - 3034) - << "incorrect value for x, expected 3034, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -2682) - << "incorrect value for y, expected -2682, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - -861) - << "incorrect value for z, expected -861, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA1, Test) { - uint8_t encoded_frame[] = { - 85, 4, 2, 246, 215, 20, 120, 46, 39, 0, 68, 11, 0, 0, - 24, 246, 255, 255, 220, 252, 255, 255, 0, 0, 9, 0, 248, 138, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_dep_a_t *test_msg = (msg_vel_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 9; - test_msg->tow = 2567800; - test_msg->x = 2884; - test_msg->y = -2536; - test_msg->z = -804; - - EXPECT_EQ(send_message(0x204, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567800) - << "incorrect value for tow, expected 2567800, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - 2884) - << "incorrect value for x, expected 2884, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -2536) - << "incorrect value for y, expected -2536, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - -804) - << "incorrect value for z, expected -804, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA2, Test) { - uint8_t encoded_frame[] = { - 85, 4, 2, 246, 215, 20, 220, 46, 39, 0, 21, 11, 0, 0, - 77, 246, 255, 255, 247, 252, 255, 255, 0, 0, 9, 0, 25, 174, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_dep_a_t *test_msg = (msg_vel_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 9; - test_msg->tow = 2567900; - test_msg->x = 2837; - test_msg->y = -2483; - test_msg->z = -777; - - EXPECT_EQ(send_message(0x204, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567900) - << "incorrect value for tow, expected 2567900, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - 2837) - << "incorrect value for x, expected 2837, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -2483) - << "incorrect value for y, expected -2483, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - -777) - << "incorrect value for z, expected -777, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA3, Test) { - uint8_t encoded_frame[] = { - 85, 4, 2, 246, 215, 20, 64, 47, 39, 0, 121, 11, 0, 0, - 2, 246, 255, 255, 234, 252, 255, 255, 0, 0, 9, 0, 195, 228, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_dep_a_t *test_msg = (msg_vel_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 9; - test_msg->tow = 2568000; - test_msg->x = 2937; - test_msg->y = -2558; - test_msg->z = -790; - - EXPECT_EQ(send_message(0x204, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2568000) - << "incorrect value for tow, expected 2568000, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - 2937) - << "incorrect value for x, expected 2937, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -2558) - << "incorrect value for y, expected -2558, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - -790) - << "incorrect value for z, expected -790, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA4, Test) { - uint8_t encoded_frame[] = { - 85, 4, 2, 246, 215, 20, 164, 47, 39, 0, 31, 11, 0, 0, - 93, 246, 255, 255, 16, 253, 255, 255, 0, 0, 9, 0, 219, 164, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_dep_a_t *test_msg = (msg_vel_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 9; - test_msg->tow = 2568100; - test_msg->x = 2847; - test_msg->y = -2467; - test_msg->z = -752; - - EXPECT_EQ(send_message(0x204, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2568100) - << "incorrect value for tow, expected 2568100, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - 2847) - << "incorrect value for x, expected 2847, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -2467) - << "incorrect value for y, expected -2467, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - -752) - << "incorrect value for z, expected -752, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA5 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA5() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA5, Test) { - uint8_t encoded_frame[] = { - 85, 4, 2, 195, 4, 20, 212, 157, 67, 24, 24, 0, 0, 0, - 245, 255, 255, 255, 219, 255, 255, 255, 0, 0, 8, 0, 68, 255, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_dep_a_t *test_msg = (msg_vel_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084500; - test_msg->x = 24; - test_msg->y = -11; - test_msg->z = -37; - - EXPECT_EQ(send_message(0x204, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084500) - << "incorrect value for tow, expected 407084500, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - 24) - << "incorrect value for x, expected 24, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -11) - << "incorrect value for y, expected -11, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - -37) - << "incorrect value for z, expected -37, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA6 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA6() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA6, Test) { - uint8_t encoded_frame[] = { - 85, 4, 2, 195, 4, 20, 56, 158, 67, 24, 4, 0, 0, 0, - 234, 255, 255, 255, 18, 0, 0, 0, 0, 0, 8, 0, 214, 136, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_dep_a_t *test_msg = (msg_vel_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084600; - test_msg->x = 4; - test_msg->y = -22; - test_msg->z = 18; - - EXPECT_EQ(send_message(0x204, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084600) - << "incorrect value for tow, expected 407084600, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - 4) - << "incorrect value for x, expected 4, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -22) - << "incorrect value for y, expected -22, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 18) - << "incorrect value for z, expected 18, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA7 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA7() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA7, Test) { - uint8_t encoded_frame[] = { - 85, 4, 2, 195, 4, 20, 156, 158, 67, 24, 230, 255, 255, 255, - 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 8, 0, 122, 159, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_dep_a_t *test_msg = (msg_vel_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084700; - test_msg->x = -26; - test_msg->y = 4; - test_msg->z = 1; - - EXPECT_EQ(send_message(0x204, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084700) - << "incorrect value for tow, expected 407084700, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -26) - << "incorrect value for x, expected -26, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - 4) - << "incorrect value for y, expected 4, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 1) - << "incorrect value for z, expected 1, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA8 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA8() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA8, Test) { - uint8_t encoded_frame[] = { - 85, 4, 2, 195, 4, 20, 0, 159, 67, 24, 247, 255, 255, 255, - 237, 255, 255, 255, 28, 0, 0, 0, 0, 0, 8, 0, 232, 146, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_dep_a_t *test_msg = (msg_vel_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084800; - test_msg->x = -9; - test_msg->y = -19; - test_msg->z = 28; - - EXPECT_EQ(send_message(0x204, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084800) - << "incorrect value for tow, expected 407084800, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -9) - << "incorrect value for x, expected -9, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -19) - << "incorrect value for y, expected -19, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 28) - << "incorrect value for z, expected 28, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA9 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA9() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA9, Test) { - uint8_t encoded_frame[] = { - 85, 4, 2, 195, 4, 20, 100, 159, 67, 24, 255, 255, 255, 255, - 2, 0, 0, 0, 245, 255, 255, 255, 0, 0, 8, 0, 171, 238, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_dep_a_t *test_msg = (msg_vel_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 8; - test_msg->tow = 407084900; - test_msg->x = -1; - test_msg->y = 2; - test_msg->z = -11; - - EXPECT_EQ(send_message(0x204, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084900) - << "incorrect value for tow, expected 407084900, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -1) - << "incorrect value for x, expected -1, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - 2) - << "incorrect value for y, expected 2, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - -11) - << "incorrect value for z, expected -11, is " << last_msg_->z; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA10 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA10() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelECEFDepA10, Test) { - uint8_t encoded_frame[] = { - 85, 4, 2, 195, 4, 20, 46, 162, 68, 24, 207, 255, 255, 255, - 185, 255, 255, 255, 65, 0, 0, 0, 0, 0, 5, 0, 82, 154, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_dep_a_t *test_msg = (msg_vel_ecef_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 0; - test_msg->flags = 0; - test_msg->n_sats = 5; - test_msg->tow = 407151150; - test_msg->x = -49; - test_msg->y = -71; - test_msg->z = 65; - - EXPECT_EQ(send_message(0x204, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 0) - << "incorrect value for accuracy, expected 0, is " << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 5) - << "incorrect value for n_sats, expected 5, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407151150) - << "incorrect value for tow, expected 407151150, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -49) - << "incorrect value for x, expected -49, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - -71) - << "incorrect value for y, expected -71, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 65) - << "incorrect value for z, expected 65, is " << last_msg_->z; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelEcefCovGnss.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelEcefCovGnss.cc deleted file mode 100644 index 2197f7bb86..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelEcefCovGnss.cc +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelEcefCovGnss.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelEcefCovGnss0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelEcefCovGnss0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_cov_gnss_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_cov_gnss_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelEcefCovGnss0, Test) { - uint8_t encoded_frame[] = { - 85, 53, 2, 0, 16, 42, 224, 229, 233, 29, 253, 255, 255, - 255, 1, 0, 0, 0, 4, 0, 0, 0, 46, 224, 32, 59, - 32, 214, 14, 59, 150, 147, 220, 186, 19, 63, 138, 59, 26, - 150, 35, 187, 11, 193, 119, 59, 21, 2, 22, 230, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_cov_gnss_t *test_msg = - (msg_vel_ecef_cov_gnss_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cov_x_x = 0.0024547684006392956; - test_msg->cov_x_y = 0.0021795108914375305; - test_msg->cov_x_z = -0.0016828652005642653; - test_msg->cov_y_y = 0.004218944814056158; - test_msg->cov_y_z = -0.0024961293675005436; - test_msg->cov_z_z = 0.0037804271560162306; - test_msg->flags = 2; - test_msg->n_sats = 21; - test_msg->tow = 501868000; - test_msg->x = -3; - test_msg->y = 1; - test_msg->z = 4; - - EXPECT_EQ(send_message(0x235, 4096, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 4096); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cov_x_x * 100 - 0.00245476840064 * 100), 0.05) - << "incorrect value for cov_x_x, expected 0.00245476840064, is " - << last_msg_->cov_x_x; - EXPECT_LT((last_msg_->cov_x_y * 100 - 0.00217951089144 * 100), 0.05) - << "incorrect value for cov_x_y, expected 0.00217951089144, is " - << last_msg_->cov_x_y; - EXPECT_LT((last_msg_->cov_x_z * 100 - -0.00168286520056 * 100), 0.05) - << "incorrect value for cov_x_z, expected -0.00168286520056, is " - << last_msg_->cov_x_z; - EXPECT_LT((last_msg_->cov_y_y * 100 - 0.00421894481406 * 100), 0.05) - << "incorrect value for cov_y_y, expected 0.00421894481406, is " - << last_msg_->cov_y_y; - EXPECT_LT((last_msg_->cov_y_z * 100 - -0.0024961293675 * 100), 0.05) - << "incorrect value for cov_y_z, expected -0.0024961293675, is " - << last_msg_->cov_y_z; - EXPECT_LT((last_msg_->cov_z_z * 100 - 0.00378042715602 * 100), 0.05) - << "incorrect value for cov_z_z, expected 0.00378042715602, is " - << last_msg_->cov_z_z; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 2) - << "incorrect value for flags, expected 2, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 21) - << "incorrect value for n_sats, expected 21, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 501868000) - << "incorrect value for tow, expected 501868000, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -3) - << "incorrect value for x, expected -3, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - 1) - << "incorrect value for y, expected 1, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 4) - << "incorrect value for z, expected 4, is " << last_msg_->z; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelEcefGnss.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelEcefGnss.cc deleted file mode 100644 index 4339c5bc8d..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelEcefGnss.cc +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelEcefGnss.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelEcefGnss0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelEcefGnss0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ecef_gnss_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ecef_gnss_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelEcefGnss0, Test) { - uint8_t encoded_frame[] = { - 85, 45, 2, 0, 16, 20, 224, 229, 233, 29, 253, 255, 255, 255, - 1, 0, 0, 0, 4, 0, 0, 0, 89, 0, 21, 2, 205, 16, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ecef_gnss_t *test_msg = (msg_vel_ecef_gnss_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->accuracy = 89; - test_msg->flags = 2; - test_msg->n_sats = 21; - test_msg->tow = 501868000; - test_msg->x = -3; - test_msg->y = 1; - test_msg->z = 4; - - EXPECT_EQ(send_message(0x22d, 4096, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 4096); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asaccuracy)>( - reinterpret_cast(&last_msg_->accuracy)), - 89) - << "incorrect value for accuracy, expected 89, is " - << last_msg_->accuracy; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 2) - << "incorrect value for flags, expected 2, is " << last_msg_->flags; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 21) - << "incorrect value for n_sats, expected 21, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 501868000) - << "incorrect value for tow, expected 501868000, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - -3) - << "incorrect value for x, expected -3, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - 1) - << "incorrect value for y, expected 1, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 4) - << "incorrect value for z, expected 4, is " << last_msg_->z; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelNED.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelNED.cc deleted file mode 100644 index f21c6b7387..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelNED.cc +++ /dev/null @@ -1,658 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelNED.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNED0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNED0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNED0, Test) { - uint8_t encoded_frame[] = { - 85, 14, 2, 211, 136, 22, 40, 244, 122, 19, 3, 0, 0, 0, 252, - 255, 255, 255, 243, 255, 255, 255, 0, 0, 0, 0, 14, 0, 86, 209, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_t *test_msg = (msg_vel_ned_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = -13; - test_msg->e = -4; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 3; - test_msg->n_sats = 14; - test_msg->tow = 326825000; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x20e, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - -13) - << "incorrect value for d, expected -13, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - -4) - << "incorrect value for e, expected -4, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - 3) - << "incorrect value for n, expected 3, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 14) - << "incorrect value for n_sats, expected 14, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326825000) - << "incorrect value for tow, expected 326825000, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNED1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNED1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNED1, Test) { - uint8_t encoded_frame[] = { - 85, 14, 2, 211, 136, 22, 28, 246, 122, 19, 252, 255, 255, 255, 255, - 255, 255, 255, 232, 255, 255, 255, 0, 0, 0, 0, 15, 0, 16, 228, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_t *test_msg = (msg_vel_ned_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = -24; - test_msg->e = -1; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -4; - test_msg->n_sats = 15; - test_msg->tow = 326825500; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x20e, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - -24) - << "incorrect value for d, expected -24, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - -1) - << "incorrect value for e, expected -1, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -4) - << "incorrect value for n, expected -4, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326825500) - << "incorrect value for tow, expected 326825500, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNED2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNED2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNED2, Test) { - uint8_t encoded_frame[] = { - 85, 14, 2, 211, 136, 22, 16, 248, 122, 19, 0, 0, 0, 0, 253, - 255, 255, 255, 244, 255, 255, 255, 0, 0, 0, 0, 15, 0, 11, 164, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_t *test_msg = (msg_vel_ned_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = -12; - test_msg->e = -3; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 0; - test_msg->n_sats = 15; - test_msg->tow = 326826000; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x20e, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - -12) - << "incorrect value for d, expected -12, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - -3) - << "incorrect value for e, expected -3, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - 0) - << "incorrect value for n, expected 0, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326826000) - << "incorrect value for tow, expected 326826000, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNED3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNED3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNED3, Test) { - uint8_t encoded_frame[] = { - 85, 14, 2, 211, 136, 22, 4, 250, 122, 19, 2, 0, 0, 0, 3, - 0, 0, 0, 232, 255, 255, 255, 0, 0, 0, 0, 15, 0, 152, 208, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_t *test_msg = (msg_vel_ned_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = -24; - test_msg->e = 3; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 2; - test_msg->n_sats = 15; - test_msg->tow = 326826500; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x20e, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - -24) - << "incorrect value for d, expected -24, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 3) - << "incorrect value for e, expected 3, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - 2) - << "incorrect value for n, expected 2, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326826500) - << "incorrect value for tow, expected 326826500, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNED4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNED4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNED4, Test) { - uint8_t encoded_frame[] = { - 85, 14, 2, 211, 136, 22, 248, 251, 122, 19, 1, 0, 0, 0, 0, - 0, 0, 0, 235, 255, 255, 255, 0, 0, 0, 0, 15, 0, 182, 120, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_t *test_msg = (msg_vel_ned_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = -21; - test_msg->e = 0; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 1; - test_msg->n_sats = 15; - test_msg->tow = 326827000; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x20e, 35027, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - -21) - << "incorrect value for d, expected -21, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 0) - << "incorrect value for e, expected 0, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - 1) - << "incorrect value for n, expected 1, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 15) - << "incorrect value for n_sats, expected 15, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 326827000) - << "incorrect value for tow, expected 326827000, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelNEDCOV.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelNEDCOV.cc deleted file mode 100644 index c7ce274f40..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelNEDCOV.cc +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelNEDCOV.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNEDCOV0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNEDCOV0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_cov_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_cov_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNEDCOV0, Test) { - uint8_t encoded_frame[] = { - 85, 18, 2, 66, 0, 42, 100, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, - 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 10, 0, 88, 205, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_cov_t *test_msg = (msg_vel_ned_cov_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cov_d_d = 1.0; - test_msg->cov_e_d = 1.0; - test_msg->cov_e_e = 1.0; - test_msg->cov_n_d = 1.0; - test_msg->cov_n_e = 1.0; - test_msg->cov_n_n = 1.0; - test_msg->d = 1; - test_msg->e = 1; - test_msg->flags = 0; - test_msg->n = 1; - test_msg->n_sats = 10; - test_msg->tow = 100; - - EXPECT_EQ(send_message(0x212, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cov_d_d * 100 - 1.0 * 100), 0.05) - << "incorrect value for cov_d_d, expected 1.0, is " << last_msg_->cov_d_d; - EXPECT_LT((last_msg_->cov_e_d * 100 - 1.0 * 100), 0.05) - << "incorrect value for cov_e_d, expected 1.0, is " << last_msg_->cov_e_d; - EXPECT_LT((last_msg_->cov_e_e * 100 - 1.0 * 100), 0.05) - << "incorrect value for cov_e_e, expected 1.0, is " << last_msg_->cov_e_e; - EXPECT_LT((last_msg_->cov_n_d * 100 - 1.0 * 100), 0.05) - << "incorrect value for cov_n_d, expected 1.0, is " << last_msg_->cov_n_d; - EXPECT_LT((last_msg_->cov_n_e * 100 - 1.0 * 100), 0.05) - << "incorrect value for cov_n_e, expected 1.0, is " << last_msg_->cov_n_e; - EXPECT_LT((last_msg_->cov_n_n * 100 - 1.0 * 100), 0.05) - << "incorrect value for cov_n_n, expected 1.0, is " << last_msg_->cov_n_n; - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 1) - << "incorrect value for d, expected 1, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 1) - << "incorrect value for e, expected 1, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - 1) - << "incorrect value for n, expected 1, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 10) - << "incorrect value for n_sats, expected 10, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 100) - << "incorrect value for tow, expected 100, is " << last_msg_->tow; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelNEDDepA.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelNEDDepA.cc deleted file mode 100644 index e790df2464..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelNEDDepA.cc +++ /dev/null @@ -1,1402 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelNEDDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 5, 2, 246, 215, 22, 20, 46, 39, 0, 198, 251, 255, 255, 156, - 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 161, 92, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_dep_a_t *test_msg = (msg_vel_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = 3996; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -1082; - test_msg->n_sats = 9; - test_msg->tow = 2567700; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x205, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 0) - << "incorrect value for d, expected 0, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 3996) - << "incorrect value for e, expected 3996, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -1082) - << "incorrect value for n, expected -1082, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567700) - << "incorrect value for tow, expected 2567700, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA1, Test) { - uint8_t encoded_frame[] = { - 85, 5, 2, 246, 215, 22, 120, 46, 39, 0, 14, 252, 255, 255, 207, - 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 125, 160, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_dep_a_t *test_msg = (msg_vel_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = 3791; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -1010; - test_msg->n_sats = 9; - test_msg->tow = 2567800; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x205, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 0) - << "incorrect value for d, expected 0, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 3791) - << "incorrect value for e, expected 3791, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -1010) - << "incorrect value for n, expected -1010, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567800) - << "incorrect value for tow, expected 2567800, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA2, Test) { - uint8_t encoded_frame[] = { - 85, 5, 2, 246, 215, 22, 220, 46, 39, 0, 48, 252, 255, 255, 140, - 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 179, 135, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_dep_a_t *test_msg = (msg_vel_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = 3724; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -976; - test_msg->n_sats = 9; - test_msg->tow = 2567900; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x205, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 0) - << "incorrect value for d, expected 0, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 3724) - << "incorrect value for e, expected 3724, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -976) - << "incorrect value for n, expected -976, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2567900) - << "incorrect value for tow, expected 2567900, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA3, Test) { - uint8_t encoded_frame[] = { - 85, 5, 2, 246, 215, 22, 64, 47, 39, 0, 32, 252, 255, 255, 8, - 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 51, 177, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_dep_a_t *test_msg = (msg_vel_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = 3848; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -992; - test_msg->n_sats = 9; - test_msg->tow = 2568000; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x205, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 0) - << "incorrect value for d, expected 0, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 3848) - << "incorrect value for e, expected 3848, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -992) - << "incorrect value for n, expected -992, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2568000) - << "incorrect value for tow, expected 2568000, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA4, Test) { - uint8_t encoded_frame[] = { - 85, 5, 2, 246, 215, 22, 164, 47, 39, 0, 80, 252, 255, 255, 140, - 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 23, 0, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_dep_a_t *test_msg = (msg_vel_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = 0; - test_msg->e = 3724; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -944; - test_msg->n_sats = 9; - test_msg->tow = 2568100; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x205, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 0) - << "incorrect value for d, expected 0, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 3724) - << "incorrect value for e, expected 3724, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -944) - << "incorrect value for n, expected -944, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 9) - << "incorrect value for n_sats, expected 9, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2568100) - << "incorrect value for tow, expected 2568100, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA5 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA5() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA5, Test) { - uint8_t encoded_frame[] = { - 85, 5, 2, 195, 4, 22, 212, 157, 67, 24, 229, 255, 255, 255, 26, - 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 8, 0, 132, 25, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_dep_a_t *test_msg = (msg_vel_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = 25; - test_msg->e = 26; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -27; - test_msg->n_sats = 8; - test_msg->tow = 407084500; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x205, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 25) - << "incorrect value for d, expected 25, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 26) - << "incorrect value for e, expected 26, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -27) - << "incorrect value for n, expected -27, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084500) - << "incorrect value for tow, expected 407084500, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA6 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA6() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA6, Test) { - uint8_t encoded_frame[] = { - 85, 5, 2, 195, 4, 22, 56, 158, 67, 24, 4, 0, 0, 0, 15, - 0, 0, 0, 232, 255, 255, 255, 0, 0, 0, 0, 8, 0, 42, 14, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_dep_a_t *test_msg = (msg_vel_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = -24; - test_msg->e = 15; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 4; - test_msg->n_sats = 8; - test_msg->tow = 407084600; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x205, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - -24) - << "incorrect value for d, expected -24, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 15) - << "incorrect value for e, expected 15, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - 4) - << "incorrect value for n, expected 4, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084600) - << "incorrect value for tow, expected 407084600, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA7 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA7() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA7, Test) { - uint8_t encoded_frame[] = { - 85, 5, 2, 195, 4, 22, 156, 158, 67, 24, 251, 255, 255, 255, 232, - 255, 255, 255, 247, 255, 255, 255, 0, 0, 0, 0, 8, 0, 218, 148, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_dep_a_t *test_msg = (msg_vel_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = -9; - test_msg->e = -24; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -5; - test_msg->n_sats = 8; - test_msg->tow = 407084700; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x205, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - -9) - << "incorrect value for d, expected -9, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - -24) - << "incorrect value for e, expected -24, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -5) - << "incorrect value for n, expected -5, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084700) - << "incorrect value for tow, expected 407084700, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA8 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA8() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA8, Test) { - uint8_t encoded_frame[] = { - 85, 5, 2, 195, 4, 22, 0, 159, 67, 24, 10, 0, 0, 0, 2, - 0, 0, 0, 222, 255, 255, 255, 0, 0, 0, 0, 8, 0, 148, 16, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_dep_a_t *test_msg = (msg_vel_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = -34; - test_msg->e = 2; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = 10; - test_msg->n_sats = 8; - test_msg->tow = 407084800; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x205, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - -34) - << "incorrect value for d, expected -34, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 2) - << "incorrect value for e, expected 2, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - 10) - << "incorrect value for n, expected 10, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084800) - << "incorrect value for tow, expected 407084800, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA9 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA9() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA9, Test) { - uint8_t encoded_frame[] = { - 85, 5, 2, 195, 4, 22, 100, 159, 67, 24, 248, 255, 255, 255, 254, - 255, 255, 255, 7, 0, 0, 0, 0, 0, 0, 0, 8, 0, 255, 236, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_dep_a_t *test_msg = (msg_vel_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = 7; - test_msg->e = -2; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -8; - test_msg->n_sats = 8; - test_msg->tow = 407084900; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x205, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - 7) - << "incorrect value for d, expected 7, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - -2) - << "incorrect value for e, expected -2, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -8) - << "incorrect value for n, expected -8, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 8) - << "incorrect value for n_sats, expected 8, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407084900) - << "incorrect value for tow, expected 407084900, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA10 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA10() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNEDDepA10, Test) { - uint8_t encoded_frame[] = { - 85, 5, 2, 195, 4, 22, 46, 162, 68, 24, 255, 255, 255, 255, 253, - 255, 255, 255, 148, 255, 255, 255, 0, 0, 0, 0, 5, 0, 166, 189, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_dep_a_t *test_msg = (msg_vel_ned_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = -108; - test_msg->e = -3; - test_msg->flags = 0; - test_msg->h_accuracy = 0; - test_msg->n = -1; - test_msg->n_sats = 5; - test_msg->tow = 407151150; - test_msg->v_accuracy = 0; - - EXPECT_EQ(send_message(0x205, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - -108) - << "incorrect value for d, expected -108, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - -3) - << "incorrect value for e, expected -3, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 0) - << "incorrect value for h_accuracy, expected 0, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -1) - << "incorrect value for n, expected -1, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 5) - << "incorrect value for n_sats, expected 5, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 407151150) - << "incorrect value for tow, expected 407151150, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 0) - << "incorrect value for v_accuracy, expected 0, is " - << last_msg_->v_accuracy; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelNedCovGnss.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelNedCovGnss.cc deleted file mode 100644 index 4e9c1a8f63..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelNedCovGnss.cc +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelNedCovGnss.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNedCovGnss0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNedCovGnss0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_cov_gnss_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_cov_gnss_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNedCovGnss0, Test) { - uint8_t encoded_frame[] = { - 85, 50, 2, 0, 16, 42, 168, 230, 233, 29, 251, 255, 255, - 255, 0, 0, 0, 0, 246, 255, 255, 255, 15, 58, 207, 58, - 248, 139, 116, 55, 103, 197, 57, 57, 203, 186, 129, 58, 109, - 171, 44, 57, 135, 39, 1, 60, 21, 2, 155, 3, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_cov_gnss_t *test_msg = (msg_vel_ned_cov_gnss_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cov_d_d = 0.007882959209382534; - test_msg->cov_e_d = 0.00016467059322167188; - test_msg->cov_e_e = 0.0009897587588056922; - test_msg->cov_n_d = 0.00017716512957122177; - test_msg->cov_n_e = 1.457612233934924e-05; - test_msg->cov_n_n = 0.0015810149488970637; - test_msg->d = -10; - test_msg->e = 0; - test_msg->flags = 2; - test_msg->n = -5; - test_msg->n_sats = 21; - test_msg->tow = 501868200; - - EXPECT_EQ(send_message(0x232, 4096, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 4096); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->cov_d_d * 100 - 0.00788295920938 * 100), 0.05) - << "incorrect value for cov_d_d, expected 0.00788295920938, is " - << last_msg_->cov_d_d; - EXPECT_LT((last_msg_->cov_e_d * 100 - 0.000164670593222 * 100), 0.05) - << "incorrect value for cov_e_d, expected 0.000164670593222, is " - << last_msg_->cov_e_d; - EXPECT_LT((last_msg_->cov_e_e * 100 - 0.000989758758806 * 100), 0.05) - << "incorrect value for cov_e_e, expected 0.000989758758806, is " - << last_msg_->cov_e_e; - EXPECT_LT((last_msg_->cov_n_d * 100 - 0.000177165129571 * 100), 0.05) - << "incorrect value for cov_n_d, expected 0.000177165129571, is " - << last_msg_->cov_n_d; - EXPECT_LT((last_msg_->cov_n_e * 100 - 1.45761223393e-05 * 100), 0.05) - << "incorrect value for cov_n_e, expected 1.45761223393e-05, is " - << last_msg_->cov_n_e; - EXPECT_LT((last_msg_->cov_n_n * 100 - 0.0015810149489 * 100), 0.05) - << "incorrect value for cov_n_n, expected 0.0015810149489, is " - << last_msg_->cov_n_n; - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - -10) - << "incorrect value for d, expected -10, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 0) - << "incorrect value for e, expected 0, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 2) - << "incorrect value for flags, expected 2, is " << last_msg_->flags; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -5) - << "incorrect value for n, expected -5, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 21) - << "incorrect value for n_sats, expected 21, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 501868200) - << "incorrect value for tow, expected 501868200, is " << last_msg_->tow; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelNedGnss.cc b/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelNedGnss.cc deleted file mode 100644 index 41fdb5acd1..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_navigation_MsgVelNedGnss.cc +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/navigation/test_MsgVelNedGnss.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_navigation_MsgVelNedGnss0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_navigation_MsgVelNedGnss0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_vel_ned_gnss_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_vel_ned_gnss_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_navigation_MsgVelNedGnss0, Test) { - uint8_t encoded_frame[] = { - 85, 46, 2, 0, 16, 22, 168, 230, 233, 29, 251, 255, 255, 255, 0, - 0, 0, 0, 246, 255, 255, 255, 40, 0, 89, 0, 21, 2, 99, 171, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_vel_ned_gnss_t *test_msg = (msg_vel_ned_gnss_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->d = -10; - test_msg->e = 0; - test_msg->flags = 2; - test_msg->h_accuracy = 40; - test_msg->n = -5; - test_msg->n_sats = 21; - test_msg->tow = 501868200; - test_msg->v_accuracy = 89; - - EXPECT_EQ(send_message(0x22e, 4096, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 4096); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asd)>( - reinterpret_cast(&last_msg_->d)), - -10) - << "incorrect value for d, expected -10, is " << last_msg_->d; - EXPECT_EQ(get_ase)>( - reinterpret_cast(&last_msg_->e)), - 0) - << "incorrect value for e, expected 0, is " << last_msg_->e; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 2) - << "incorrect value for flags, expected 2, is " << last_msg_->flags; - EXPECT_EQ(get_ash_accuracy)>( - reinterpret_cast(&last_msg_->h_accuracy)), - 40) - << "incorrect value for h_accuracy, expected 40, is " - << last_msg_->h_accuracy; - EXPECT_EQ(get_asn)>( - reinterpret_cast(&last_msg_->n)), - -5) - << "incorrect value for n, expected -5, is " << last_msg_->n; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 21) - << "incorrect value for n_sats, expected 21, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 501868200) - << "incorrect value for tow, expected 501868200, is " << last_msg_->tow; - EXPECT_EQ(get_asv_accuracy)>( - reinterpret_cast(&last_msg_->v_accuracy)), - 89) - << "incorrect value for v_accuracy, expected 89, is " - << last_msg_->v_accuracy; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ndb_MsgNdbEvent.cc b/c/test/legacy/cpp/auto_check_sbp_ndb_MsgNdbEvent.cc deleted file mode 100644 index 336fb29e03..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ndb_MsgNdbEvent.cc +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ndb/test_MsgNdbEvent.yaml by generate.py. Do not -// modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ndb_MsgNdbEvent0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ndb_MsgNdbEvent0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ndb_event_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ndb_event_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ndb_MsgNdbEvent0, Test) { - uint8_t encoded_frame[] = { - 85, 0, 4, 164, 174, 18, 254, 188, 70, 185, 69, 0, 0, - 0, 249, 73, 205, 115, 238, 74, 98, 66, 182, 148, 16, 166, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ndb_event_t *test_msg = (msg_ndb_event_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->data_source = 115; - test_msg->event = 249; - test_msg->object_sid.code = 74; - test_msg->object_sid.sat = 238; - test_msg->object_type = 73; - test_msg->original_sender = 38070; - test_msg->recv_time = 299461164286; - test_msg->result = 205; - test_msg->src_sid.code = 66; - test_msg->src_sid.sat = 98; - - EXPECT_EQ(send_message(0x400, 44708, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 44708); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asdata_source)>( - reinterpret_cast(&last_msg_->data_source)), - 115) - << "incorrect value for data_source, expected 115, is " - << last_msg_->data_source; - EXPECT_EQ(get_asevent)>( - reinterpret_cast(&last_msg_->event)), - 249) - << "incorrect value for event, expected 249, is " << last_msg_->event; - EXPECT_EQ(get_asobject_sid.code)>( - reinterpret_cast(&last_msg_->object_sid.code)), - 74) - << "incorrect value for object_sid.code, expected 74, is " - << last_msg_->object_sid.code; - EXPECT_EQ(get_asobject_sid.sat)>( - reinterpret_cast(&last_msg_->object_sid.sat)), - 238) - << "incorrect value for object_sid.sat, expected 238, is " - << last_msg_->object_sid.sat; - EXPECT_EQ(get_asobject_type)>( - reinterpret_cast(&last_msg_->object_type)), - 73) - << "incorrect value for object_type, expected 73, is " - << last_msg_->object_type; - EXPECT_EQ(get_asoriginal_sender)>( - reinterpret_cast(&last_msg_->original_sender)), - 38070) - << "incorrect value for original_sender, expected 38070, is " - << last_msg_->original_sender; - EXPECT_EQ(get_asrecv_time)>( - reinterpret_cast(&last_msg_->recv_time)), - 299461164286) - << "incorrect value for recv_time, expected 299461164286, is " - << last_msg_->recv_time; - EXPECT_EQ(get_asresult)>( - reinterpret_cast(&last_msg_->result)), - 205) - << "incorrect value for result, expected 205, is " << last_msg_->result; - EXPECT_EQ(get_assrc_sid.code)>( - reinterpret_cast(&last_msg_->src_sid.code)), - 66) - << "incorrect value for src_sid.code, expected 66, is " - << last_msg_->src_sid.code; - EXPECT_EQ(get_assrc_sid.sat)>( - reinterpret_cast(&last_msg_->src_sid.sat)), - 98) - << "incorrect value for src_sid.sat, expected 98, is " - << last_msg_->src_sid.sat; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgAlmanacGLO.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgAlmanacGLO.cc deleted file mode 100644 index c327cb7ad7..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgAlmanacGLO.cc +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgAlmanacGLO.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgAlmanacGLO0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgAlmanacGLO0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_almanac_glo_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_almanac_glo_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgAlmanacGLO0, Test) { - uint8_t encoded_frame[] = { - 85, 115, 0, 195, 4, 78, 22, 0, 176, 207, 6, 0, 106, 8, 154, - 153, 153, 153, 153, 153, 1, 64, 64, 56, 0, 0, 1, 0, 142, 41, - 5, 235, 95, 135, 150, 191, 0, 0, 0, 32, 191, 247, 124, 63, 0, - 0, 192, 206, 140, 33, 180, 64, 41, 131, 179, 134, 141, 248, 253, 191, - 227, 133, 81, 54, 204, 30, 67, 190, 216, 59, 199, 39, 96, 168, 239, - 191, 71, 11, 217, 147, 145, 228, 237, 63, 155, 87, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_almanac_glo_t *test_msg = (msg_almanac_glo_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 0; - test_msg->common.sid.sat = 22; - test_msg->common.toa.tow = 446384; - test_msg->common.toa.wn = 2154; - test_msg->common.ura = 2.2; - test_msg->common.valid = 1; - test_msg->epsilon = -0.9893036629599647; - test_msg->i = 5153.550029754639; - test_msg->lambda_na = -0.02200078842114688; - test_msg->omega = 0.9341514480259797; - test_msg->t = -1.8731818448797617; - test_msg->t_dot = -8.903585155774196e-09; - test_msg->t_lambda_na = 0.007072207052260637; - - EXPECT_EQ(send_message(0x73, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 14400) - << "incorrect value for common.fit_interval, expected 14400, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 0) - << "incorrect value for common.sid.code, expected 0, is " - << last_msg_->common.sid.code; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 22) - << "incorrect value for common.sid.sat, expected 22, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toa.tow)>( - reinterpret_cast(&last_msg_->common.toa.tow)), - 446384) - << "incorrect value for common.toa.tow, expected 446384, is " - << last_msg_->common.toa.tow; - EXPECT_EQ(get_ascommon.toa.wn)>( - reinterpret_cast(&last_msg_->common.toa.wn)), - 2154) - << "incorrect value for common.toa.wn, expected 2154, is " - << last_msg_->common.toa.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 2.2 * 100), 0.05) - << "incorrect value for common.ura, expected 2.2, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->epsilon * 100 - -0.98930366296 * 100), 0.05) - << "incorrect value for epsilon, expected -0.98930366296, is " - << last_msg_->epsilon; - EXPECT_LT((last_msg_->i * 100 - 5153.55002975 * 100), 0.05) - << "incorrect value for i, expected 5153.55002975, is " << last_msg_->i; - EXPECT_LT((last_msg_->lambda_na * 100 - -0.0220007884211 * 100), 0.05) - << "incorrect value for lambda_na, expected -0.0220007884211, is " - << last_msg_->lambda_na; - EXPECT_LT((last_msg_->omega * 100 - 0.934151448026 * 100), 0.05) - << "incorrect value for omega, expected 0.934151448026, is " - << last_msg_->omega; - EXPECT_LT((last_msg_->t * 100 - -1.87318184488 * 100), 0.05) - << "incorrect value for t, expected -1.87318184488, is " << last_msg_->t; - EXPECT_LT((last_msg_->t_dot * 100 - -8.90358515577e-09 * 100), 0.05) - << "incorrect value for t_dot, expected -8.90358515577e-09, is " - << last_msg_->t_dot; - EXPECT_LT((last_msg_->t_lambda_na * 100 - 0.00707220705226 * 100), 0.05) - << "incorrect value for t_lambda_na, expected 0.00707220705226, is " - << last_msg_->t_lambda_na; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgAlmanacGLODep.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgAlmanacGLODep.cc deleted file mode 100644 index 4249a08638..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgAlmanacGLODep.cc +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgAlmanacGLODep.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgAlmanacGLODep0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgAlmanacGLODep0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_almanac_glo_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_almanac_glo_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgAlmanacGLODep0, Test) { - uint8_t encoded_frame[] = { - 85, 113, 0, 195, 4, 80, 22, 0, 0, 0, 176, 207, 6, 0, 106, - 8, 154, 153, 153, 153, 153, 153, 1, 64, 64, 56, 0, 0, 1, 0, - 142, 41, 5, 235, 95, 135, 150, 191, 0, 0, 0, 32, 191, 247, 124, - 63, 0, 0, 192, 206, 140, 33, 180, 64, 41, 131, 179, 134, 141, 248, - 253, 191, 227, 133, 81, 54, 204, 30, 67, 190, 216, 59, 199, 39, 96, - 168, 239, 191, 71, 11, 217, 147, 145, 228, 237, 63, 203, 178, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_almanac_glo_dep_t *test_msg = (msg_almanac_glo_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 0; - test_msg->common.sid.reserved = 0; - test_msg->common.sid.sat = 22; - test_msg->common.toa.tow = 446384; - test_msg->common.toa.wn = 2154; - test_msg->common.ura = 2.2; - test_msg->common.valid = 1; - test_msg->epsilon = -0.9893036629599647; - test_msg->i = 5153.550029754639; - test_msg->lambda_na = -0.02200078842114688; - test_msg->omega = 0.9341514480259797; - test_msg->t = -1.8731818448797617; - test_msg->t_dot = -8.903585155774196e-09; - test_msg->t_lambda_na = 0.007072207052260637; - - EXPECT_EQ(send_message(0x71, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 14400) - << "incorrect value for common.fit_interval, expected 14400, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 0) - << "incorrect value for common.sid.code, expected 0, is " - << last_msg_->common.sid.code; - EXPECT_EQ( - get_ascommon.sid.reserved)>( - reinterpret_cast(&last_msg_->common.sid.reserved)), - 0) - << "incorrect value for common.sid.reserved, expected 0, is " - << last_msg_->common.sid.reserved; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 22) - << "incorrect value for common.sid.sat, expected 22, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toa.tow)>( - reinterpret_cast(&last_msg_->common.toa.tow)), - 446384) - << "incorrect value for common.toa.tow, expected 446384, is " - << last_msg_->common.toa.tow; - EXPECT_EQ(get_ascommon.toa.wn)>( - reinterpret_cast(&last_msg_->common.toa.wn)), - 2154) - << "incorrect value for common.toa.wn, expected 2154, is " - << last_msg_->common.toa.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 2.2 * 100), 0.05) - << "incorrect value for common.ura, expected 2.2, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->epsilon * 100 - -0.98930366296 * 100), 0.05) - << "incorrect value for epsilon, expected -0.98930366296, is " - << last_msg_->epsilon; - EXPECT_LT((last_msg_->i * 100 - 5153.55002975 * 100), 0.05) - << "incorrect value for i, expected 5153.55002975, is " << last_msg_->i; - EXPECT_LT((last_msg_->lambda_na * 100 - -0.0220007884211 * 100), 0.05) - << "incorrect value for lambda_na, expected -0.0220007884211, is " - << last_msg_->lambda_na; - EXPECT_LT((last_msg_->omega * 100 - 0.934151448026 * 100), 0.05) - << "incorrect value for omega, expected 0.934151448026, is " - << last_msg_->omega; - EXPECT_LT((last_msg_->t * 100 - -1.87318184488 * 100), 0.05) - << "incorrect value for t, expected -1.87318184488, is " << last_msg_->t; - EXPECT_LT((last_msg_->t_dot * 100 - -8.90358515577e-09 * 100), 0.05) - << "incorrect value for t_dot, expected -8.90358515577e-09, is " - << last_msg_->t_dot; - EXPECT_LT((last_msg_->t_lambda_na * 100 - 0.00707220705226 * 100), 0.05) - << "incorrect value for t_lambda_na, expected 0.00707220705226, is " - << last_msg_->t_lambda_na; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgAlmanacGPS.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgAlmanacGPS.cc deleted file mode 100644 index b7a983b7db..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgAlmanacGPS.cc +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgAlmanacGPS.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgAlmanacGPS0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgAlmanacGPS0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_almanac_gps_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_almanac_gps_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgAlmanacGPS0, Test) { - uint8_t encoded_frame[] = { - 85, 114, 0, 195, 4, 94, 22, 0, 176, 207, 6, 0, 106, 8, 154, - 153, 153, 153, 153, 153, 1, 64, 64, 56, 0, 0, 1, 0, 142, 41, - 5, 235, 95, 135, 150, 191, 0, 0, 0, 32, 191, 247, 124, 63, 0, - 0, 192, 206, 140, 33, 180, 64, 41, 131, 179, 134, 141, 248, 253, 191, - 227, 133, 81, 54, 204, 30, 67, 190, 216, 59, 199, 39, 96, 168, 239, - 191, 71, 11, 217, 147, 145, 228, 237, 63, 0, 0, 0, 0, 108, 177, - 68, 191, 0, 0, 0, 0, 0, 192, 163, 61, 190, 45, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_almanac_gps_t *test_msg = (msg_almanac_gps_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = -0.0006315018981695175; - test_msg->af1 = 8.981260180007666e-12; - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 0; - test_msg->common.sid.sat = 22; - test_msg->common.toa.tow = 446384; - test_msg->common.toa.wn = 2154; - test_msg->common.ura = 2.2; - test_msg->common.valid = 1; - test_msg->ecc = 0.007072207052260637; - test_msg->inc = 0.9341514480259797; - test_msg->m0 = -0.02200078842114688; - test_msg->omega0 = -1.8731818448797617; - test_msg->omegadot = -8.903585155774196e-09; - test_msg->sqrta = 5153.550029754639; - test_msg->w = -0.9893036629599647; - - EXPECT_EQ(send_message(0x72, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - -0.00063150189817 * 100), 0.05) - << "incorrect value for af0, expected -0.00063150189817, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - 8.98126018001e-12 * 100), 0.05) - << "incorrect value for af1, expected 8.98126018001e-12, is " - << last_msg_->af1; - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 14400) - << "incorrect value for common.fit_interval, expected 14400, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 0) - << "incorrect value for common.sid.code, expected 0, is " - << last_msg_->common.sid.code; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 22) - << "incorrect value for common.sid.sat, expected 22, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toa.tow)>( - reinterpret_cast(&last_msg_->common.toa.tow)), - 446384) - << "incorrect value for common.toa.tow, expected 446384, is " - << last_msg_->common.toa.tow; - EXPECT_EQ(get_ascommon.toa.wn)>( - reinterpret_cast(&last_msg_->common.toa.wn)), - 2154) - << "incorrect value for common.toa.wn, expected 2154, is " - << last_msg_->common.toa.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 2.2 * 100), 0.05) - << "incorrect value for common.ura, expected 2.2, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->ecc * 100 - 0.00707220705226 * 100), 0.05) - << "incorrect value for ecc, expected 0.00707220705226, is " - << last_msg_->ecc; - EXPECT_LT((last_msg_->inc * 100 - 0.934151448026 * 100), 0.05) - << "incorrect value for inc, expected 0.934151448026, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->m0 * 100 - -0.0220007884211 * 100), 0.05) - << "incorrect value for m0, expected -0.0220007884211, is " - << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - -1.87318184488 * 100), 0.05) - << "incorrect value for omega0, expected -1.87318184488, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -8.90358515577e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -8.90358515577e-09, is " - << last_msg_->omegadot; - EXPECT_LT((last_msg_->sqrta * 100 - 5153.55002975 * 100), 0.05) - << "incorrect value for sqrta, expected 5153.55002975, is " - << last_msg_->sqrta; - EXPECT_LT((last_msg_->w * 100 - -0.98930366296 * 100), 0.05) - << "incorrect value for w, expected -0.98930366296, is " << last_msg_->w; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgAlmanacGPSDep.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgAlmanacGPSDep.cc deleted file mode 100644 index 761d1494be..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgAlmanacGPSDep.cc +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgAlmanacGPSDep.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgAlmanacGPSDep0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgAlmanacGPSDep0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_almanac_gps_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_almanac_gps_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgAlmanacGPSDep0, Test) { - uint8_t encoded_frame[] = { - 85, 112, 0, 195, 4, 96, 22, 0, 0, 0, 176, 207, 6, 0, 106, - 8, 154, 153, 153, 153, 153, 153, 1, 64, 64, 56, 0, 0, 1, 0, - 142, 41, 5, 235, 95, 135, 150, 191, 0, 0, 0, 32, 191, 247, 124, - 63, 0, 0, 192, 206, 140, 33, 180, 64, 41, 131, 179, 134, 141, 248, - 253, 191, 227, 133, 81, 54, 204, 30, 67, 190, 216, 59, 199, 39, 96, - 168, 239, 191, 71, 11, 217, 147, 145, 228, 237, 63, 0, 0, 0, 0, - 108, 177, 68, 191, 0, 0, 0, 0, 0, 192, 163, 61, 144, 232, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_almanac_gps_dep_t *test_msg = (msg_almanac_gps_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = -0.0006315018981695175; - test_msg->af1 = 8.981260180007666e-12; - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 0; - test_msg->common.sid.reserved = 0; - test_msg->common.sid.sat = 22; - test_msg->common.toa.tow = 446384; - test_msg->common.toa.wn = 2154; - test_msg->common.ura = 2.2; - test_msg->common.valid = 1; - test_msg->ecc = 0.007072207052260637; - test_msg->inc = 0.9341514480259797; - test_msg->m0 = -0.02200078842114688; - test_msg->omega0 = -1.8731818448797617; - test_msg->omegadot = -8.903585155774196e-09; - test_msg->sqrta = 5153.550029754639; - test_msg->w = -0.9893036629599647; - - EXPECT_EQ(send_message(0x70, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - -0.00063150189817 * 100), 0.05) - << "incorrect value for af0, expected -0.00063150189817, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - 8.98126018001e-12 * 100), 0.05) - << "incorrect value for af1, expected 8.98126018001e-12, is " - << last_msg_->af1; - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 14400) - << "incorrect value for common.fit_interval, expected 14400, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 0) - << "incorrect value for common.sid.code, expected 0, is " - << last_msg_->common.sid.code; - EXPECT_EQ( - get_ascommon.sid.reserved)>( - reinterpret_cast(&last_msg_->common.sid.reserved)), - 0) - << "incorrect value for common.sid.reserved, expected 0, is " - << last_msg_->common.sid.reserved; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 22) - << "incorrect value for common.sid.sat, expected 22, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toa.tow)>( - reinterpret_cast(&last_msg_->common.toa.tow)), - 446384) - << "incorrect value for common.toa.tow, expected 446384, is " - << last_msg_->common.toa.tow; - EXPECT_EQ(get_ascommon.toa.wn)>( - reinterpret_cast(&last_msg_->common.toa.wn)), - 2154) - << "incorrect value for common.toa.wn, expected 2154, is " - << last_msg_->common.toa.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 2.2 * 100), 0.05) - << "incorrect value for common.ura, expected 2.2, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->ecc * 100 - 0.00707220705226 * 100), 0.05) - << "incorrect value for ecc, expected 0.00707220705226, is " - << last_msg_->ecc; - EXPECT_LT((last_msg_->inc * 100 - 0.934151448026 * 100), 0.05) - << "incorrect value for inc, expected 0.934151448026, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->m0 * 100 - -0.0220007884211 * 100), 0.05) - << "incorrect value for m0, expected -0.0220007884211, is " - << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - -1.87318184488 * 100), 0.05) - << "incorrect value for omega0, expected -1.87318184488, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -8.90358515577e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -8.90358515577e-09, is " - << last_msg_->omegadot; - EXPECT_LT((last_msg_->sqrta * 100 - 5153.55002975 * 100), 0.05) - << "incorrect value for sqrta, expected 5153.55002975, is " - << last_msg_->sqrta; - EXPECT_LT((last_msg_->w * 100 - -0.98930366296 * 100), 0.05) - << "incorrect value for w, expected -0.98930366296, is " << last_msg_->w; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgBasePosEcef.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgBasePosEcef.cc deleted file mode 100644 index d5f6e9e532..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgBasePosEcef.cc +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgBasePosEcef.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgBasePosEcef0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgBasePosEcef0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_base_pos_ecef_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_base_pos_ecef_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgBasePosEcef0, Test) { - uint8_t encoded_frame[] = { - 85, 72, 0, 0, 0, 24, 228, 131, 158, 245, 87, - 205, 68, 193, 66, 62, 232, 209, 32, 118, 80, 193, - 213, 231, 106, 251, 63, 20, 77, 65, 194, 125, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_base_pos_ecef_t *test_msg = (msg_base_pos_ecef_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->x = -2726575.9189; - test_msg->y = -4315267.2798; - test_msg->z = 3811455.9642; - - EXPECT_EQ(send_message(0x48, 0, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 0); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->x * 100 - -2726575.9189 * 100), 0.05) - << "incorrect value for x, expected -2726575.9189, is " << last_msg_->x; - EXPECT_LT((last_msg_->y * 100 - -4315267.2798 * 100), 0.05) - << "incorrect value for y, expected -4315267.2798, is " << last_msg_->y; - EXPECT_LT((last_msg_->z * 100 - 3811455.9642 * 100), 0.05) - << "incorrect value for z, expected 3811455.9642, is " << last_msg_->z; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgBasePosLLH.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgBasePosLLH.cc deleted file mode 100644 index cbd1818975..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgBasePosLLH.cc +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgBasePosLLH.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgBasePosLLH0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgBasePosLLH0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_base_pos_llh_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_base_pos_llh_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgBasePosLLH0, Test) { - uint8_t encoded_frame[] = { - 85, 68, 0, 123, 0, 24, 225, 237, 238, 90, 42, 160, 66, 64, 59, 143, - 70, 235, 0, 120, 94, 192, 51, 181, 124, 240, 65, 248, 66, 64, 82, 230, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_base_pos_llh_t *test_msg = (msg_base_pos_llh_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->height = 37.939512310879216; - test_msg->lat = 37.251292578377395; - test_msg->lon = -121.87505609407974; - - EXPECT_EQ(send_message(0x44, 123, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 123); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->height * 100 - 37.9395123109 * 100), 0.05) - << "incorrect value for height, expected 37.9395123109, is " - << last_msg_->height; - EXPECT_LT((last_msg_->lat * 100 - 37.2512925784 * 100), 0.05) - << "incorrect value for lat, expected 37.2512925784, is " - << last_msg_->lat; - EXPECT_LT((last_msg_->lon * 100 - -121.875056094 * 100), 0.05) - << "incorrect value for lon, expected -121.875056094, is " - << last_msg_->lon; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisBds.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisBds.cc deleted file mode 100644 index f6b0e8e35b..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisBds.cc +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisBds.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgEphemerisBds0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgEphemerisBds0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_bds_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_bds_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgEphemerisBds0, Test) { - uint8_t encoded_frame[] = { - 85, 137, 0, 128, 240, 147, 8, 12, 174, 179, 6, 0, 106, 8, 0, - 0, 0, 64, 48, 42, 0, 0, 1, 0, 125, 99, 52, 50, 207, 46, - 151, 176, 0, 112, 96, 67, 0, 164, 106, 67, 0, 60, 255, 54, 0, - 224, 47, 53, 0, 0, 143, 179, 0, 192, 190, 52, 146, 101, 162, 196, - 109, 104, 19, 62, 253, 87, 86, 202, 62, 28, 251, 63, 0, 0, 0, - 96, 151, 60, 117, 63, 0, 0, 128, 154, 127, 93, 185, 64, 151, 193, - 64, 0, 10, 166, 4, 192, 160, 75, 174, 98, 8, 201, 35, 190, 205, - 29, 12, 71, 189, 150, 5, 192, 176, 72, 249, 189, 193, 172, 240, 63, - 72, 249, 188, 180, 160, 203, 9, 62, 0, 0, 0, 0, 92, 51, 77, - 191, 0, 128, 174, 43, 0, 0, 88, 161, 174, 179, 6, 0, 106, 8, - 6, 5, 0, 157, 249, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_bds_t *test_msg = (msg_ephemeris_bds_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = -0.0008911322802305222; - test_msg->af1 = 1.2398970739013748e-12; - test_msg->af2 = -7.318364664277155e-19; - test_msg->c_ic = -6.658956408500671e-08; - test_msg->c_is = 3.5529956221580505e-07; - test_msg->c_rc = 234.640625; - test_msg->c_rs = 224.4375; - test_msg->c_uc = 7.606577128171921e-06; - test_msg->c_us = 6.551854312419891e-07; - test_msg->common.fit_interval = 10800; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 12; - test_msg->common.sid.sat = 8; - test_msg->common.toe.tow = 439214; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 2.0; - test_msg->common.valid = 1; - test_msg->dn = 1.1296899132622133e-09; - test_msg->ecc = 0.005184737499803305; - test_msg->inc = 1.0421769543504915; - test_msg->inc_dot = 7.507455572801683e-10; - test_msg->iodc = 5; - test_msg->iode = 6; - test_msg->m0 = 1.6943958190727237; - test_msg->omega0 = -2.581073762870982; - test_msg->omegadot = -2.303310227830545e-09; - test_msg->sqrta = 6493.49845123291; - test_msg->tgd1 = 1.0499999980595476e-08; - test_msg->tgd2 = -1.0999999799921056e-09; - test_msg->toc.tow = 439214; - test_msg->toc.wn = 2154; - test_msg->w = -2.698603205735458; - - EXPECT_EQ(send_message(0x89, 61568, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 61568); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - -0.000891132280231 * 100), 0.05) - << "incorrect value for af0, expected -0.000891132280231, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - 1.2398970739e-12 * 100), 0.05) - << "incorrect value for af1, expected 1.2398970739e-12, is " - << last_msg_->af1; - EXPECT_LT((last_msg_->af2 * 100 - -7.31836466428e-19 * 100), 0.05) - << "incorrect value for af2, expected -7.31836466428e-19, is " - << last_msg_->af2; - EXPECT_LT((last_msg_->c_ic * 100 - -6.6589564085e-08 * 100), 0.05) - << "incorrect value for c_ic, expected -6.6589564085e-08, is " - << last_msg_->c_ic; - EXPECT_LT((last_msg_->c_is * 100 - 3.55299562216e-07 * 100), 0.05) - << "incorrect value for c_is, expected 3.55299562216e-07, is " - << last_msg_->c_is; - EXPECT_LT((last_msg_->c_rc * 100 - 234.640625 * 100), 0.05) - << "incorrect value for c_rc, expected 234.640625, is " - << last_msg_->c_rc; - EXPECT_LT((last_msg_->c_rs * 100 - 224.4375 * 100), 0.05) - << "incorrect value for c_rs, expected 224.4375, is " << last_msg_->c_rs; - EXPECT_LT((last_msg_->c_uc * 100 - 7.60657712817e-06 * 100), 0.05) - << "incorrect value for c_uc, expected 7.60657712817e-06, is " - << last_msg_->c_uc; - EXPECT_LT((last_msg_->c_us * 100 - 6.55185431242e-07 * 100), 0.05) - << "incorrect value for c_us, expected 6.55185431242e-07, is " - << last_msg_->c_us; - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 10800) - << "incorrect value for common.fit_interval, expected 10800, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 12) - << "incorrect value for common.sid.code, expected 12, is " - << last_msg_->common.sid.code; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 8) - << "incorrect value for common.sid.sat, expected 8, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toe.tow)>( - reinterpret_cast(&last_msg_->common.toe.tow)), - 439214) - << "incorrect value for common.toe.tow, expected 439214, is " - << last_msg_->common.toe.tow; - EXPECT_EQ(get_ascommon.toe.wn)>( - reinterpret_cast(&last_msg_->common.toe.wn)), - 2154) - << "incorrect value for common.toe.wn, expected 2154, is " - << last_msg_->common.toe.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 2.0 * 100), 0.05) - << "incorrect value for common.ura, expected 2.0, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->dn * 100 - 1.12968991326e-09 * 100), 0.05) - << "incorrect value for dn, expected 1.12968991326e-09, is " - << last_msg_->dn; - EXPECT_LT((last_msg_->ecc * 100 - 0.0051847374998 * 100), 0.05) - << "incorrect value for ecc, expected 0.0051847374998, is " - << last_msg_->ecc; - EXPECT_LT((last_msg_->inc * 100 - 1.04217695435 * 100), 0.05) - << "incorrect value for inc, expected 1.04217695435, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->inc_dot * 100 - 7.5074555728e-10 * 100), 0.05) - << "incorrect value for inc_dot, expected 7.5074555728e-10, is " - << last_msg_->inc_dot; - EXPECT_EQ(get_asiodc)>( - reinterpret_cast(&last_msg_->iodc)), - 5) - << "incorrect value for iodc, expected 5, is " << last_msg_->iodc; - EXPECT_EQ(get_asiode)>( - reinterpret_cast(&last_msg_->iode)), - 6) - << "incorrect value for iode, expected 6, is " << last_msg_->iode; - EXPECT_LT((last_msg_->m0 * 100 - 1.69439581907 * 100), 0.05) - << "incorrect value for m0, expected 1.69439581907, is " << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - -2.58107376287 * 100), 0.05) - << "incorrect value for omega0, expected -2.58107376287, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -2.30331022783e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -2.30331022783e-09, is " - << last_msg_->omegadot; - EXPECT_LT((last_msg_->sqrta * 100 - 6493.49845123 * 100), 0.05) - << "incorrect value for sqrta, expected 6493.49845123, is " - << last_msg_->sqrta; - EXPECT_LT((last_msg_->tgd1 * 100 - 1.04999999806e-08 * 100), 0.05) - << "incorrect value for tgd1, expected 1.04999999806e-08, is " - << last_msg_->tgd1; - EXPECT_LT((last_msg_->tgd2 * 100 - -1.09999997999e-09 * 100), 0.05) - << "incorrect value for tgd2, expected -1.09999997999e-09, is " - << last_msg_->tgd2; - EXPECT_EQ(get_astoc.tow)>( - reinterpret_cast(&last_msg_->toc.tow)), - 439214) - << "incorrect value for toc.tow, expected 439214, is " - << last_msg_->toc.tow; - EXPECT_EQ(get_astoc.wn)>( - reinterpret_cast(&last_msg_->toc.wn)), - 2154) - << "incorrect value for toc.wn, expected 2154, is " << last_msg_->toc.wn; - EXPECT_LT((last_msg_->w * 100 - -2.69860320574 * 100), 0.05) - << "incorrect value for w, expected -2.69860320574, is " << last_msg_->w; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisDepA.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisDepA.cc deleted file mode 100644 index 7fb9100f4f..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisDepA.cc +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgEphemerisDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgEphemerisDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgEphemerisDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 26, 0, 195, 4, 175, 0, 0, 0, 0, 0, 0, 83, 190, 0, - 0, 0, 0, 0, 40, 74, 192, 0, 0, 0, 0, 0, 74, 115, 64, - 0, 0, 0, 0, 0, 4, 199, 190, 0, 0, 0, 0, 0, 80, 202, - 62, 0, 0, 0, 0, 0, 0, 64, 62, 0, 0, 0, 0, 0, 0, - 127, 190, 114, 216, 96, 180, 49, 117, 56, 62, 142, 41, 5, 235, 95, - 135, 150, 191, 0, 0, 0, 32, 191, 247, 124, 63, 0, 0, 192, 206, - 140, 33, 180, 64, 41, 131, 179, 134, 141, 248, 253, 191, 227, 133, 81, - 54, 204, 30, 67, 190, 216, 59, 199, 39, 96, 168, 239, 191, 71, 11, - 217, 147, 145, 228, 237, 63, 221, 47, 100, 224, 255, 47, 198, 189, 0, - 0, 0, 0, 108, 177, 68, 191, 0, 0, 0, 0, 0, 192, 163, 61, - 154, 153, 153, 153, 153, 153, 201, 63, 205, 204, 204, 204, 192, 62, 27, - 65, 106, 8, 205, 204, 204, 204, 192, 62, 27, 65, 106, 8, 1, 0, - 22, 242, 84, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_dep_a_t *test_msg = (msg_ephemeris_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = -0.0006315018981695175; - test_msg->af1 = 8.981260180007666e-12; - test_msg->af2 = 0.2; - test_msg->c_ic = 7.450580596923828e-09; - test_msg->c_is = -1.1548399925231934e-07; - test_msg->c_rc = 308.625; - test_msg->c_rs = -52.3125; - test_msg->c_uc = -2.7436763048171997e-06; - test_msg->c_us = 3.1366944313049316e-06; - test_msg->dn = 5.694522914022375e-09; - test_msg->ecc = 0.007072207052260637; - test_msg->healthy = 0; - test_msg->inc = 0.9341514480259797; - test_msg->inc_dot = -4.035882396415757e-11; - test_msg->m0 = -0.02200078842114688; - test_msg->omega0 = -1.8731818448797617; - test_msg->omegadot = -8.903585155774196e-09; - test_msg->prn = 22; - test_msg->sqrta = 5153.550029754639; - test_msg->tgd = -1.7695128917694092e-08; - test_msg->toc_tow = 446384.2; - test_msg->toc_wn = 2154; - test_msg->toe_tow = 446384.2; - test_msg->toe_wn = 2154; - test_msg->valid = 1; - test_msg->w = -0.9893036629599647; - - EXPECT_EQ(send_message(0x1a, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - -0.00063150189817 * 100), 0.05) - << "incorrect value for af0, expected -0.00063150189817, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - 8.98126018001e-12 * 100), 0.05) - << "incorrect value for af1, expected 8.98126018001e-12, is " - << last_msg_->af1; - EXPECT_LT((last_msg_->af2 * 100 - 0.2 * 100), 0.05) - << "incorrect value for af2, expected 0.2, is " << last_msg_->af2; - EXPECT_LT((last_msg_->c_ic * 100 - 7.45058059692e-09 * 100), 0.05) - << "incorrect value for c_ic, expected 7.45058059692e-09, is " - << last_msg_->c_ic; - EXPECT_LT((last_msg_->c_is * 100 - -1.15483999252e-07 * 100), 0.05) - << "incorrect value for c_is, expected -1.15483999252e-07, is " - << last_msg_->c_is; - EXPECT_LT((last_msg_->c_rc * 100 - 308.625 * 100), 0.05) - << "incorrect value for c_rc, expected 308.625, is " << last_msg_->c_rc; - EXPECT_LT((last_msg_->c_rs * 100 - -52.3125 * 100), 0.05) - << "incorrect value for c_rs, expected -52.3125, is " << last_msg_->c_rs; - EXPECT_LT((last_msg_->c_uc * 100 - -2.74367630482e-06 * 100), 0.05) - << "incorrect value for c_uc, expected -2.74367630482e-06, is " - << last_msg_->c_uc; - EXPECT_LT((last_msg_->c_us * 100 - 3.1366944313e-06 * 100), 0.05) - << "incorrect value for c_us, expected 3.1366944313e-06, is " - << last_msg_->c_us; - EXPECT_LT((last_msg_->dn * 100 - 5.69452291402e-09 * 100), 0.05) - << "incorrect value for dn, expected 5.69452291402e-09, is " - << last_msg_->dn; - EXPECT_LT((last_msg_->ecc * 100 - 0.00707220705226 * 100), 0.05) - << "incorrect value for ecc, expected 0.00707220705226, is " - << last_msg_->ecc; - EXPECT_EQ(get_ashealthy)>( - reinterpret_cast(&last_msg_->healthy)), - 0) - << "incorrect value for healthy, expected 0, is " << last_msg_->healthy; - EXPECT_LT((last_msg_->inc * 100 - 0.934151448026 * 100), 0.05) - << "incorrect value for inc, expected 0.934151448026, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->inc_dot * 100 - -4.03588239642e-11 * 100), 0.05) - << "incorrect value for inc_dot, expected -4.03588239642e-11, is " - << last_msg_->inc_dot; - EXPECT_LT((last_msg_->m0 * 100 - -0.0220007884211 * 100), 0.05) - << "incorrect value for m0, expected -0.0220007884211, is " - << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - -1.87318184488 * 100), 0.05) - << "incorrect value for omega0, expected -1.87318184488, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -8.90358515577e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -8.90358515577e-09, is " - << last_msg_->omegadot; - EXPECT_EQ(get_asprn)>( - reinterpret_cast(&last_msg_->prn)), - 22) - << "incorrect value for prn, expected 22, is " << last_msg_->prn; - EXPECT_LT((last_msg_->sqrta * 100 - 5153.55002975 * 100), 0.05) - << "incorrect value for sqrta, expected 5153.55002975, is " - << last_msg_->sqrta; - EXPECT_LT((last_msg_->tgd * 100 - -1.76951289177e-08 * 100), 0.05) - << "incorrect value for tgd, expected -1.76951289177e-08, is " - << last_msg_->tgd; - EXPECT_LT((last_msg_->toc_tow * 100 - 446384.2 * 100), 0.05) - << "incorrect value for toc_tow, expected 446384.2, is " - << last_msg_->toc_tow; - EXPECT_EQ(get_astoc_wn)>( - reinterpret_cast(&last_msg_->toc_wn)), - 2154) - << "incorrect value for toc_wn, expected 2154, is " << last_msg_->toc_wn; - EXPECT_LT((last_msg_->toe_tow * 100 - 446384.2 * 100), 0.05) - << "incorrect value for toe_tow, expected 446384.2, is " - << last_msg_->toe_tow; - EXPECT_EQ(get_astoe_wn)>( - reinterpret_cast(&last_msg_->toe_wn)), - 2154) - << "incorrect value for toe_wn, expected 2154, is " << last_msg_->toe_wn; - EXPECT_EQ(get_asvalid)>( - reinterpret_cast(&last_msg_->valid)), - 1) - << "incorrect value for valid, expected 1, is " << last_msg_->valid; - EXPECT_LT((last_msg_->w * 100 - -0.98930366296 * 100), 0.05) - << "incorrect value for w, expected -0.98930366296, is " << last_msg_->w; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisDepC.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisDepC.cc deleted file mode 100644 index ab7f2638c2..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisDepC.cc +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisDepC.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgEphemerisDepC0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgEphemerisDepC0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_dep_c_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_dep_c_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgEphemerisDepC0, Test) { - uint8_t encoded_frame[] = { - 85, 71, 0, 195, 4, 185, 0, 0, 0, 0, 0, 0, 83, 190, 0, - 0, 0, 0, 0, 40, 74, 192, 0, 0, 0, 0, 0, 74, 115, 64, - 0, 0, 0, 0, 0, 4, 199, 190, 0, 0, 0, 0, 0, 80, 202, - 62, 0, 0, 0, 0, 0, 0, 64, 62, 0, 0, 0, 0, 0, 0, - 127, 190, 114, 216, 96, 180, 49, 117, 56, 62, 142, 41, 5, 235, 95, - 135, 150, 191, 0, 0, 0, 32, 191, 247, 124, 63, 0, 0, 192, 206, - 140, 33, 180, 64, 41, 131, 179, 134, 141, 248, 253, 191, 227, 133, 81, - 54, 204, 30, 67, 190, 216, 59, 199, 39, 96, 168, 239, 191, 71, 11, - 217, 147, 145, 228, 237, 63, 221, 47, 100, 224, 255, 47, 198, 189, 0, - 0, 0, 0, 108, 177, 68, 191, 0, 0, 0, 0, 0, 192, 163, 61, - 154, 153, 153, 153, 153, 153, 201, 63, 205, 204, 204, 204, 192, 62, 27, - 65, 106, 8, 205, 204, 204, 204, 192, 62, 27, 65, 106, 8, 1, 0, - 22, 0, 0, 0, 45, 45, 0, 0, 0, 0, 0, 23, 170, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_dep_c_t *test_msg = (msg_ephemeris_dep_c_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = -0.0006315018981695175; - test_msg->af1 = 8.981260180007666e-12; - test_msg->af2 = 0.2; - test_msg->c_ic = 7.450580596923828e-09; - test_msg->c_is = -1.1548399925231934e-07; - test_msg->c_rc = 308.625; - test_msg->c_rs = -52.3125; - test_msg->c_uc = -2.7436763048171997e-06; - test_msg->c_us = 3.1366944313049316e-06; - test_msg->dn = 5.694522914022375e-09; - test_msg->ecc = 0.007072207052260637; - test_msg->healthy = 0; - test_msg->inc = 0.9341514480259797; - test_msg->inc_dot = -4.035882396415757e-11; - test_msg->iodc = 45; - test_msg->iode = 45; - test_msg->m0 = -0.02200078842114688; - test_msg->omega0 = -1.8731818448797617; - test_msg->omegadot = -8.903585155774196e-09; - test_msg->reserved = 0; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 22; - test_msg->sqrta = 5153.550029754639; - test_msg->tgd = -1.7695128917694092e-08; - test_msg->toc_tow = 446384.2; - test_msg->toc_wn = 2154; - test_msg->toe_tow = 446384.2; - test_msg->toe_wn = 2154; - test_msg->valid = 1; - test_msg->w = -0.9893036629599647; - - EXPECT_EQ(send_message(0x47, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - -0.00063150189817 * 100), 0.05) - << "incorrect value for af0, expected -0.00063150189817, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - 8.98126018001e-12 * 100), 0.05) - << "incorrect value for af1, expected 8.98126018001e-12, is " - << last_msg_->af1; - EXPECT_LT((last_msg_->af2 * 100 - 0.2 * 100), 0.05) - << "incorrect value for af2, expected 0.2, is " << last_msg_->af2; - EXPECT_LT((last_msg_->c_ic * 100 - 7.45058059692e-09 * 100), 0.05) - << "incorrect value for c_ic, expected 7.45058059692e-09, is " - << last_msg_->c_ic; - EXPECT_LT((last_msg_->c_is * 100 - -1.15483999252e-07 * 100), 0.05) - << "incorrect value for c_is, expected -1.15483999252e-07, is " - << last_msg_->c_is; - EXPECT_LT((last_msg_->c_rc * 100 - 308.625 * 100), 0.05) - << "incorrect value for c_rc, expected 308.625, is " << last_msg_->c_rc; - EXPECT_LT((last_msg_->c_rs * 100 - -52.3125 * 100), 0.05) - << "incorrect value for c_rs, expected -52.3125, is " << last_msg_->c_rs; - EXPECT_LT((last_msg_->c_uc * 100 - -2.74367630482e-06 * 100), 0.05) - << "incorrect value for c_uc, expected -2.74367630482e-06, is " - << last_msg_->c_uc; - EXPECT_LT((last_msg_->c_us * 100 - 3.1366944313e-06 * 100), 0.05) - << "incorrect value for c_us, expected 3.1366944313e-06, is " - << last_msg_->c_us; - EXPECT_LT((last_msg_->dn * 100 - 5.69452291402e-09 * 100), 0.05) - << "incorrect value for dn, expected 5.69452291402e-09, is " - << last_msg_->dn; - EXPECT_LT((last_msg_->ecc * 100 - 0.00707220705226 * 100), 0.05) - << "incorrect value for ecc, expected 0.00707220705226, is " - << last_msg_->ecc; - EXPECT_EQ(get_ashealthy)>( - reinterpret_cast(&last_msg_->healthy)), - 0) - << "incorrect value for healthy, expected 0, is " << last_msg_->healthy; - EXPECT_LT((last_msg_->inc * 100 - 0.934151448026 * 100), 0.05) - << "incorrect value for inc, expected 0.934151448026, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->inc_dot * 100 - -4.03588239642e-11 * 100), 0.05) - << "incorrect value for inc_dot, expected -4.03588239642e-11, is " - << last_msg_->inc_dot; - EXPECT_EQ(get_asiodc)>( - reinterpret_cast(&last_msg_->iodc)), - 45) - << "incorrect value for iodc, expected 45, is " << last_msg_->iodc; - EXPECT_EQ(get_asiode)>( - reinterpret_cast(&last_msg_->iode)), - 45) - << "incorrect value for iode, expected 45, is " << last_msg_->iode; - EXPECT_LT((last_msg_->m0 * 100 - -0.0220007884211 * 100), 0.05) - << "incorrect value for m0, expected -0.0220007884211, is " - << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - -1.87318184488 * 100), 0.05) - << "incorrect value for omega0, expected -1.87318184488, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -8.90358515577e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -8.90358515577e-09, is " - << last_msg_->omegadot; - EXPECT_EQ(get_asreserved)>( - reinterpret_cast(&last_msg_->reserved)), - 0) - << "incorrect value for reserved, expected 0, is " << last_msg_->reserved; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 22) - << "incorrect value for sid.sat, expected 22, is " << last_msg_->sid.sat; - EXPECT_LT((last_msg_->sqrta * 100 - 5153.55002975 * 100), 0.05) - << "incorrect value for sqrta, expected 5153.55002975, is " - << last_msg_->sqrta; - EXPECT_LT((last_msg_->tgd * 100 - -1.76951289177e-08 * 100), 0.05) - << "incorrect value for tgd, expected -1.76951289177e-08, is " - << last_msg_->tgd; - EXPECT_LT((last_msg_->toc_tow * 100 - 446384.2 * 100), 0.05) - << "incorrect value for toc_tow, expected 446384.2, is " - << last_msg_->toc_tow; - EXPECT_EQ(get_astoc_wn)>( - reinterpret_cast(&last_msg_->toc_wn)), - 2154) - << "incorrect value for toc_wn, expected 2154, is " << last_msg_->toc_wn; - EXPECT_LT((last_msg_->toe_tow * 100 - 446384.2 * 100), 0.05) - << "incorrect value for toe_tow, expected 446384.2, is " - << last_msg_->toe_tow; - EXPECT_EQ(get_astoe_wn)>( - reinterpret_cast(&last_msg_->toe_wn)), - 2154) - << "incorrect value for toe_wn, expected 2154, is " << last_msg_->toe_wn; - EXPECT_EQ(get_asvalid)>( - reinterpret_cast(&last_msg_->valid)), - 1) - << "incorrect value for valid, expected 1, is " << last_msg_->valid; - EXPECT_LT((last_msg_->w * 100 - -0.98930366296 * 100), 0.05) - << "incorrect value for w, expected -0.98930366296, is " << last_msg_->w; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisDepD.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisDepD.cc deleted file mode 100644 index 8e9cb333dc..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisDepD.cc +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisDepD.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgEphemerisDepD0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgEphemerisDepD0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_dep_d_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_dep_d_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgEphemerisDepD0, Test) { - uint8_t encoded_frame[] = { - 85, 128, 0, 195, 4, 185, 0, 0, 0, 0, 0, 0, 83, 190, 0, - 0, 0, 0, 0, 40, 74, 192, 0, 0, 0, 0, 0, 74, 115, 64, - 0, 0, 0, 0, 0, 4, 199, 190, 0, 0, 0, 0, 0, 80, 202, - 62, 0, 0, 0, 0, 0, 0, 64, 62, 0, 0, 0, 0, 0, 0, - 127, 190, 114, 216, 96, 180, 49, 117, 56, 62, 142, 41, 5, 235, 95, - 135, 150, 191, 0, 0, 0, 32, 191, 247, 124, 63, 0, 0, 192, 206, - 140, 33, 180, 64, 41, 131, 179, 134, 141, 248, 253, 191, 227, 133, 81, - 54, 204, 30, 67, 190, 216, 59, 199, 39, 96, 168, 239, 191, 71, 11, - 217, 147, 145, 228, 237, 63, 221, 47, 100, 224, 255, 47, 198, 189, 0, - 0, 0, 0, 108, 177, 68, 191, 0, 0, 0, 0, 0, 192, 163, 61, - 154, 153, 153, 153, 153, 153, 201, 63, 205, 204, 204, 204, 192, 62, 27, - 65, 106, 8, 205, 204, 204, 204, 192, 62, 27, 65, 106, 8, 1, 0, - 22, 0, 0, 0, 45, 45, 0, 0, 0, 0, 0, 95, 7, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_dep_d_t *test_msg = (msg_ephemeris_dep_d_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = -0.0006315018981695175; - test_msg->af1 = 8.981260180007666e-12; - test_msg->af2 = 0.2; - test_msg->c_ic = 7.450580596923828e-09; - test_msg->c_is = -1.1548399925231934e-07; - test_msg->c_rc = 308.625; - test_msg->c_rs = -52.3125; - test_msg->c_uc = -2.7436763048171997e-06; - test_msg->c_us = 3.1366944313049316e-06; - test_msg->dn = 5.694522914022375e-09; - test_msg->ecc = 0.007072207052260637; - test_msg->healthy = 0; - test_msg->inc = 0.9341514480259797; - test_msg->inc_dot = -4.035882396415757e-11; - test_msg->iodc = 45; - test_msg->iode = 45; - test_msg->m0 = -0.02200078842114688; - test_msg->omega0 = -1.8731818448797617; - test_msg->omegadot = -8.903585155774196e-09; - test_msg->reserved = 0; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 22; - test_msg->sqrta = 5153.550029754639; - test_msg->tgd = -1.7695128917694092e-08; - test_msg->toc_tow = 446384.2; - test_msg->toc_wn = 2154; - test_msg->toe_tow = 446384.2; - test_msg->toe_wn = 2154; - test_msg->valid = 1; - test_msg->w = -0.9893036629599647; - - EXPECT_EQ(send_message(0x80, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - -0.00063150189817 * 100), 0.05) - << "incorrect value for af0, expected -0.00063150189817, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - 8.98126018001e-12 * 100), 0.05) - << "incorrect value for af1, expected 8.98126018001e-12, is " - << last_msg_->af1; - EXPECT_LT((last_msg_->af2 * 100 - 0.2 * 100), 0.05) - << "incorrect value for af2, expected 0.2, is " << last_msg_->af2; - EXPECT_LT((last_msg_->c_ic * 100 - 7.45058059692e-09 * 100), 0.05) - << "incorrect value for c_ic, expected 7.45058059692e-09, is " - << last_msg_->c_ic; - EXPECT_LT((last_msg_->c_is * 100 - -1.15483999252e-07 * 100), 0.05) - << "incorrect value for c_is, expected -1.15483999252e-07, is " - << last_msg_->c_is; - EXPECT_LT((last_msg_->c_rc * 100 - 308.625 * 100), 0.05) - << "incorrect value for c_rc, expected 308.625, is " << last_msg_->c_rc; - EXPECT_LT((last_msg_->c_rs * 100 - -52.3125 * 100), 0.05) - << "incorrect value for c_rs, expected -52.3125, is " << last_msg_->c_rs; - EXPECT_LT((last_msg_->c_uc * 100 - -2.74367630482e-06 * 100), 0.05) - << "incorrect value for c_uc, expected -2.74367630482e-06, is " - << last_msg_->c_uc; - EXPECT_LT((last_msg_->c_us * 100 - 3.1366944313e-06 * 100), 0.05) - << "incorrect value for c_us, expected 3.1366944313e-06, is " - << last_msg_->c_us; - EXPECT_LT((last_msg_->dn * 100 - 5.69452291402e-09 * 100), 0.05) - << "incorrect value for dn, expected 5.69452291402e-09, is " - << last_msg_->dn; - EXPECT_LT((last_msg_->ecc * 100 - 0.00707220705226 * 100), 0.05) - << "incorrect value for ecc, expected 0.00707220705226, is " - << last_msg_->ecc; - EXPECT_EQ(get_ashealthy)>( - reinterpret_cast(&last_msg_->healthy)), - 0) - << "incorrect value for healthy, expected 0, is " << last_msg_->healthy; - EXPECT_LT((last_msg_->inc * 100 - 0.934151448026 * 100), 0.05) - << "incorrect value for inc, expected 0.934151448026, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->inc_dot * 100 - -4.03588239642e-11 * 100), 0.05) - << "incorrect value for inc_dot, expected -4.03588239642e-11, is " - << last_msg_->inc_dot; - EXPECT_EQ(get_asiodc)>( - reinterpret_cast(&last_msg_->iodc)), - 45) - << "incorrect value for iodc, expected 45, is " << last_msg_->iodc; - EXPECT_EQ(get_asiode)>( - reinterpret_cast(&last_msg_->iode)), - 45) - << "incorrect value for iode, expected 45, is " << last_msg_->iode; - EXPECT_LT((last_msg_->m0 * 100 - -0.0220007884211 * 100), 0.05) - << "incorrect value for m0, expected -0.0220007884211, is " - << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - -1.87318184488 * 100), 0.05) - << "incorrect value for omega0, expected -1.87318184488, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -8.90358515577e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -8.90358515577e-09, is " - << last_msg_->omegadot; - EXPECT_EQ(get_asreserved)>( - reinterpret_cast(&last_msg_->reserved)), - 0) - << "incorrect value for reserved, expected 0, is " << last_msg_->reserved; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 22) - << "incorrect value for sid.sat, expected 22, is " << last_msg_->sid.sat; - EXPECT_LT((last_msg_->sqrta * 100 - 5153.55002975 * 100), 0.05) - << "incorrect value for sqrta, expected 5153.55002975, is " - << last_msg_->sqrta; - EXPECT_LT((last_msg_->tgd * 100 - -1.76951289177e-08 * 100), 0.05) - << "incorrect value for tgd, expected -1.76951289177e-08, is " - << last_msg_->tgd; - EXPECT_LT((last_msg_->toc_tow * 100 - 446384.2 * 100), 0.05) - << "incorrect value for toc_tow, expected 446384.2, is " - << last_msg_->toc_tow; - EXPECT_EQ(get_astoc_wn)>( - reinterpret_cast(&last_msg_->toc_wn)), - 2154) - << "incorrect value for toc_wn, expected 2154, is " << last_msg_->toc_wn; - EXPECT_LT((last_msg_->toe_tow * 100 - 446384.2 * 100), 0.05) - << "incorrect value for toe_tow, expected 446384.2, is " - << last_msg_->toe_tow; - EXPECT_EQ(get_astoe_wn)>( - reinterpret_cast(&last_msg_->toe_wn)), - 2154) - << "incorrect value for toe_wn, expected 2154, is " << last_msg_->toe_wn; - EXPECT_EQ(get_asvalid)>( - reinterpret_cast(&last_msg_->valid)), - 1) - << "incorrect value for valid, expected 1, is " << last_msg_->valid; - EXPECT_LT((last_msg_->w * 100 - -0.98930366296 * 100), 0.05) - << "incorrect value for w, expected -0.98930366296, is " << last_msg_->w; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGLO.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGLO.cc deleted file mode 100644 index 6203c1f27c..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGLO.cc +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGLO.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgEphemerisGLO0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgEphemerisGLO0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_glo_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_glo_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgEphemerisGLO0, Test) { - uint8_t encoded_frame[] = { - 85, 139, 0, 10, 9, 92, 4, 3, 70, 197, 6, 0, 106, 8, 0, - 0, 160, 64, 96, 9, 0, 0, 1, 0, 0, 0, 128, 43, 128, 97, - 175, 184, 0, 0, 64, 177, 0, 0, 128, 66, 246, 57, 103, 193, 0, - 0, 0, 34, 170, 78, 34, 65, 0, 0, 240, 199, 84, 86, 117, 193, - 0, 0, 0, 98, 6, 250, 154, 192, 0, 0, 0, 217, 58, 221, 163, - 192, 0, 0, 0, 184, 138, 46, 139, 64, 0, 0, 122, 53, 0, 0, - 122, 53, 0, 128, 59, 54, 14, 100, 89, 149, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_glo_t *test_msg = (msg_ephemeris_glo_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[0] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[1] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[2] = 2.7939677238464355e-06; - test_msg->common.fit_interval = 2400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 3; - test_msg->common.sid.sat = 4; - test_msg->common.toe.tow = 443718; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 5.0; - test_msg->common.valid = 1; - test_msg->d_tau = -2.7939677238464355e-09; - test_msg->fcn = 14; - test_msg->gamma = 9.094947017729282e-13; - test_msg->iod = 100; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[0] = -12177330.078125; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[1] = 599893.06640625; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[2] = -22373708.49609375; - test_msg->tau = -8.36281105875969e-05; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[0] = -1726.506233215332; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[1] = -2542.6149368286133; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[2] = 869.8177337646484; - - EXPECT_EQ(send_message(0x8b, 2314, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 2314); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->acc[0] * 100 - 9.31322574615e-07 * 100), 0.05) - << "incorrect value for acc[0], expected 9.31322574615e-07, is " - << last_msg_->acc[0]; - EXPECT_LT((last_msg_->acc[1] * 100 - 9.31322574615e-07 * 100), 0.05) - << "incorrect value for acc[1], expected 9.31322574615e-07, is " - << last_msg_->acc[1]; - EXPECT_LT((last_msg_->acc[2] * 100 - 2.79396772385e-06 * 100), 0.05) - << "incorrect value for acc[2], expected 2.79396772385e-06, is " - << last_msg_->acc[2]; - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 2400) - << "incorrect value for common.fit_interval, expected 2400, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 3) - << "incorrect value for common.sid.code, expected 3, is " - << last_msg_->common.sid.code; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 4) - << "incorrect value for common.sid.sat, expected 4, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toe.tow)>( - reinterpret_cast(&last_msg_->common.toe.tow)), - 443718) - << "incorrect value for common.toe.tow, expected 443718, is " - << last_msg_->common.toe.tow; - EXPECT_EQ(get_ascommon.toe.wn)>( - reinterpret_cast(&last_msg_->common.toe.wn)), - 2154) - << "incorrect value for common.toe.wn, expected 2154, is " - << last_msg_->common.toe.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 5.0 * 100), 0.05) - << "incorrect value for common.ura, expected 5.0, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->d_tau * 100 - -2.79396772385e-09 * 100), 0.05) - << "incorrect value for d_tau, expected -2.79396772385e-09, is " - << last_msg_->d_tau; - EXPECT_EQ(get_asfcn)>( - reinterpret_cast(&last_msg_->fcn)), - 14) - << "incorrect value for fcn, expected 14, is " << last_msg_->fcn; - EXPECT_LT((last_msg_->gamma * 100 - 9.09494701773e-13 * 100), 0.05) - << "incorrect value for gamma, expected 9.09494701773e-13, is " - << last_msg_->gamma; - EXPECT_EQ(get_asiod)>( - reinterpret_cast(&last_msg_->iod)), - 100) - << "incorrect value for iod, expected 100, is " << last_msg_->iod; - EXPECT_LT((last_msg_->pos[0] * 100 - -12177330.0781 * 100), 0.05) - << "incorrect value for pos[0], expected -12177330.0781, is " - << last_msg_->pos[0]; - EXPECT_LT((last_msg_->pos[1] * 100 - 599893.066406 * 100), 0.05) - << "incorrect value for pos[1], expected 599893.066406, is " - << last_msg_->pos[1]; - EXPECT_LT((last_msg_->pos[2] * 100 - -22373708.4961 * 100), 0.05) - << "incorrect value for pos[2], expected -22373708.4961, is " - << last_msg_->pos[2]; - EXPECT_LT((last_msg_->tau * 100 - -8.36281105876e-05 * 100), 0.05) - << "incorrect value for tau, expected -8.36281105876e-05, is " - << last_msg_->tau; - EXPECT_LT((last_msg_->vel[0] * 100 - -1726.50623322 * 100), 0.05) - << "incorrect value for vel[0], expected -1726.50623322, is " - << last_msg_->vel[0]; - EXPECT_LT((last_msg_->vel[1] * 100 - -2542.61493683 * 100), 0.05) - << "incorrect value for vel[1], expected -2542.61493683, is " - << last_msg_->vel[1]; - EXPECT_LT((last_msg_->vel[2] * 100 - 869.817733765 * 100), 0.05) - << "incorrect value for vel[2], expected 869.817733765, is " - << last_msg_->vel[2]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGLODepA.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGLODepA.cc deleted file mode 100644 index 43184d48bc..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGLODepA.cc +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGLODepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_glo_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_glo_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepA0, Test) { - uint8_t encoded_frame[] = { - 85, 131, 0, 195, 4, 112, 4, 0, 3, 0, 70, 197, 6, 0, 106, - 8, 205, 204, 204, 204, 204, 204, 20, 64, 96, 9, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 112, 61, 0, 0, 0, 0, 48, 236, 21, - 191, 0, 0, 128, 66, 246, 57, 103, 193, 0, 0, 0, 34, 170, 78, - 34, 65, 0, 0, 240, 199, 84, 86, 117, 193, 0, 0, 0, 98, 6, - 250, 154, 192, 0, 0, 0, 217, 58, 221, 163, 192, 0, 0, 0, 184, - 138, 46, 139, 64, 0, 0, 0, 0, 0, 64, 175, 62, 0, 0, 0, - 0, 0, 64, 175, 62, 0, 0, 0, 0, 0, 112, 199, 62, 202, 238, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_glo_dep_a_t *test_msg = - (msg_ephemeris_glo_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[0] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[1] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[2] = 2.7939677238464355e-06; - test_msg->common.fit_interval = 2400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 3; - test_msg->common.sid.reserved = 0; - test_msg->common.sid.sat = 4; - test_msg->common.toe.tow = 443718; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 5.2; - test_msg->common.valid = 1; - test_msg->gamma = 9.094947017729282e-13; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[0] = -12177330.078125; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[1] = 599893.06640625; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[2] = -22373708.49609375; - test_msg->tau = -8.36281105875969e-05; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[0] = -1726.506233215332; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[1] = -2542.6149368286133; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[2] = 869.8177337646484; - - EXPECT_EQ(send_message(0x83, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->acc[0] * 100 - 9.31322574615e-07 * 100), 0.05) - << "incorrect value for acc[0], expected 9.31322574615e-07, is " - << last_msg_->acc[0]; - EXPECT_LT((last_msg_->acc[1] * 100 - 9.31322574615e-07 * 100), 0.05) - << "incorrect value for acc[1], expected 9.31322574615e-07, is " - << last_msg_->acc[1]; - EXPECT_LT((last_msg_->acc[2] * 100 - 2.79396772385e-06 * 100), 0.05) - << "incorrect value for acc[2], expected 2.79396772385e-06, is " - << last_msg_->acc[2]; - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 2400) - << "incorrect value for common.fit_interval, expected 2400, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 3) - << "incorrect value for common.sid.code, expected 3, is " - << last_msg_->common.sid.code; - EXPECT_EQ( - get_ascommon.sid.reserved)>( - reinterpret_cast(&last_msg_->common.sid.reserved)), - 0) - << "incorrect value for common.sid.reserved, expected 0, is " - << last_msg_->common.sid.reserved; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 4) - << "incorrect value for common.sid.sat, expected 4, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toe.tow)>( - reinterpret_cast(&last_msg_->common.toe.tow)), - 443718) - << "incorrect value for common.toe.tow, expected 443718, is " - << last_msg_->common.toe.tow; - EXPECT_EQ(get_ascommon.toe.wn)>( - reinterpret_cast(&last_msg_->common.toe.wn)), - 2154) - << "incorrect value for common.toe.wn, expected 2154, is " - << last_msg_->common.toe.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 5.2 * 100), 0.05) - << "incorrect value for common.ura, expected 5.2, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->gamma * 100 - 9.09494701773e-13 * 100), 0.05) - << "incorrect value for gamma, expected 9.09494701773e-13, is " - << last_msg_->gamma; - EXPECT_LT((last_msg_->pos[0] * 100 - -12177330.0781 * 100), 0.05) - << "incorrect value for pos[0], expected -12177330.0781, is " - << last_msg_->pos[0]; - EXPECT_LT((last_msg_->pos[1] * 100 - 599893.066406 * 100), 0.05) - << "incorrect value for pos[1], expected 599893.066406, is " - << last_msg_->pos[1]; - EXPECT_LT((last_msg_->pos[2] * 100 - -22373708.4961 * 100), 0.05) - << "incorrect value for pos[2], expected -22373708.4961, is " - << last_msg_->pos[2]; - EXPECT_LT((last_msg_->tau * 100 - -8.36281105876e-05 * 100), 0.05) - << "incorrect value for tau, expected -8.36281105876e-05, is " - << last_msg_->tau; - EXPECT_LT((last_msg_->vel[0] * 100 - -1726.50623322 * 100), 0.05) - << "incorrect value for vel[0], expected -1726.50623322, is " - << last_msg_->vel[0]; - EXPECT_LT((last_msg_->vel[1] * 100 - -2542.61493683 * 100), 0.05) - << "incorrect value for vel[1], expected -2542.61493683, is " - << last_msg_->vel[1]; - EXPECT_LT((last_msg_->vel[2] * 100 - 869.817733765 * 100), 0.05) - << "incorrect value for vel[2], expected 869.817733765, is " - << last_msg_->vel[2]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGLODepB.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGLODepB.cc deleted file mode 100644 index dc495f54d3..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGLODepB.cc +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGLODepB.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepB0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepB0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_glo_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_glo_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepB0, Test) { - uint8_t encoded_frame[] = { - 85, 133, 0, 195, 4, 110, 4, 3, 70, 197, 6, 0, 106, 8, 205, - 204, 204, 204, 204, 204, 20, 64, 96, 9, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 112, 61, 0, 0, 0, 0, 48, 236, 21, 191, 0, - 0, 128, 66, 246, 57, 103, 193, 0, 0, 0, 34, 170, 78, 34, 65, - 0, 0, 240, 199, 84, 86, 117, 193, 0, 0, 0, 98, 6, 250, 154, - 192, 0, 0, 0, 217, 58, 221, 163, 192, 0, 0, 0, 184, 138, 46, - 139, 64, 0, 0, 0, 0, 0, 64, 175, 62, 0, 0, 0, 0, 0, - 64, 175, 62, 0, 0, 0, 0, 0, 112, 199, 62, 122, 127, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_glo_dep_b_t *test_msg = - (msg_ephemeris_glo_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[0] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[1] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[2] = 2.7939677238464355e-06; - test_msg->common.fit_interval = 2400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 3; - test_msg->common.sid.sat = 4; - test_msg->common.toe.tow = 443718; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 5.2; - test_msg->common.valid = 1; - test_msg->gamma = 9.094947017729282e-13; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[0] = -12177330.078125; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[1] = 599893.06640625; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[2] = -22373708.49609375; - test_msg->tau = -8.36281105875969e-05; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[0] = -1726.506233215332; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[1] = -2542.6149368286133; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[2] = 869.8177337646484; - - EXPECT_EQ(send_message(0x85, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->acc[0] * 100 - 9.31322574615e-07 * 100), 0.05) - << "incorrect value for acc[0], expected 9.31322574615e-07, is " - << last_msg_->acc[0]; - EXPECT_LT((last_msg_->acc[1] * 100 - 9.31322574615e-07 * 100), 0.05) - << "incorrect value for acc[1], expected 9.31322574615e-07, is " - << last_msg_->acc[1]; - EXPECT_LT((last_msg_->acc[2] * 100 - 2.79396772385e-06 * 100), 0.05) - << "incorrect value for acc[2], expected 2.79396772385e-06, is " - << last_msg_->acc[2]; - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 2400) - << "incorrect value for common.fit_interval, expected 2400, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 3) - << "incorrect value for common.sid.code, expected 3, is " - << last_msg_->common.sid.code; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 4) - << "incorrect value for common.sid.sat, expected 4, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toe.tow)>( - reinterpret_cast(&last_msg_->common.toe.tow)), - 443718) - << "incorrect value for common.toe.tow, expected 443718, is " - << last_msg_->common.toe.tow; - EXPECT_EQ(get_ascommon.toe.wn)>( - reinterpret_cast(&last_msg_->common.toe.wn)), - 2154) - << "incorrect value for common.toe.wn, expected 2154, is " - << last_msg_->common.toe.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 5.2 * 100), 0.05) - << "incorrect value for common.ura, expected 5.2, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->gamma * 100 - 9.09494701773e-13 * 100), 0.05) - << "incorrect value for gamma, expected 9.09494701773e-13, is " - << last_msg_->gamma; - EXPECT_LT((last_msg_->pos[0] * 100 - -12177330.0781 * 100), 0.05) - << "incorrect value for pos[0], expected -12177330.0781, is " - << last_msg_->pos[0]; - EXPECT_LT((last_msg_->pos[1] * 100 - 599893.066406 * 100), 0.05) - << "incorrect value for pos[1], expected 599893.066406, is " - << last_msg_->pos[1]; - EXPECT_LT((last_msg_->pos[2] * 100 - -22373708.4961 * 100), 0.05) - << "incorrect value for pos[2], expected -22373708.4961, is " - << last_msg_->pos[2]; - EXPECT_LT((last_msg_->tau * 100 - -8.36281105876e-05 * 100), 0.05) - << "incorrect value for tau, expected -8.36281105876e-05, is " - << last_msg_->tau; - EXPECT_LT((last_msg_->vel[0] * 100 - -1726.50623322 * 100), 0.05) - << "incorrect value for vel[0], expected -1726.50623322, is " - << last_msg_->vel[0]; - EXPECT_LT((last_msg_->vel[1] * 100 - -2542.61493683 * 100), 0.05) - << "incorrect value for vel[1], expected -2542.61493683, is " - << last_msg_->vel[1]; - EXPECT_LT((last_msg_->vel[2] * 100 - 869.817733765 * 100), 0.05) - << "incorrect value for vel[2], expected 869.817733765, is " - << last_msg_->vel[2]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGLODepC.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGLODepC.cc deleted file mode 100644 index f842f6190b..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGLODepC.cc +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGLODepC.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepC0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepC0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_glo_dep_c_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_glo_dep_c_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepC0, Test) { - uint8_t encoded_frame[] = { - 85, 135, 0, 195, 4, 119, 4, 3, 70, 197, 6, 0, 106, 8, 205, - 204, 204, 204, 204, 204, 20, 64, 96, 9, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 112, 61, 0, 0, 0, 0, 48, 236, 21, 191, 0, - 0, 0, 0, 0, 0, 40, 190, 0, 0, 128, 66, 246, 57, 103, 193, - 0, 0, 0, 34, 170, 78, 34, 65, 0, 0, 240, 199, 84, 86, 117, - 193, 0, 0, 0, 98, 6, 250, 154, 192, 0, 0, 0, 217, 58, 221, - 163, 192, 0, 0, 0, 184, 138, 46, 139, 64, 0, 0, 0, 0, 0, - 64, 175, 62, 0, 0, 0, 0, 0, 64, 175, 62, 0, 0, 0, 0, - 0, 112, 199, 62, 14, 151, 65, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_glo_dep_c_t *test_msg = - (msg_ephemeris_glo_dep_c_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[0] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[1] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[2] = 2.7939677238464355e-06; - test_msg->common.fit_interval = 2400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 3; - test_msg->common.sid.sat = 4; - test_msg->common.toe.tow = 443718; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 5.2; - test_msg->common.valid = 1; - test_msg->d_tau = -2.7939677238464355e-09; - test_msg->fcn = 14; - test_msg->gamma = 9.094947017729282e-13; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[0] = -12177330.078125; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[1] = 599893.06640625; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[2] = -22373708.49609375; - test_msg->tau = -8.36281105875969e-05; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[0] = -1726.506233215332; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[1] = -2542.6149368286133; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[2] = 869.8177337646484; - - EXPECT_EQ(send_message(0x87, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->acc[0] * 100 - 9.31322574615e-07 * 100), 0.05) - << "incorrect value for acc[0], expected 9.31322574615e-07, is " - << last_msg_->acc[0]; - EXPECT_LT((last_msg_->acc[1] * 100 - 9.31322574615e-07 * 100), 0.05) - << "incorrect value for acc[1], expected 9.31322574615e-07, is " - << last_msg_->acc[1]; - EXPECT_LT((last_msg_->acc[2] * 100 - 2.79396772385e-06 * 100), 0.05) - << "incorrect value for acc[2], expected 2.79396772385e-06, is " - << last_msg_->acc[2]; - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 2400) - << "incorrect value for common.fit_interval, expected 2400, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 3) - << "incorrect value for common.sid.code, expected 3, is " - << last_msg_->common.sid.code; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 4) - << "incorrect value for common.sid.sat, expected 4, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toe.tow)>( - reinterpret_cast(&last_msg_->common.toe.tow)), - 443718) - << "incorrect value for common.toe.tow, expected 443718, is " - << last_msg_->common.toe.tow; - EXPECT_EQ(get_ascommon.toe.wn)>( - reinterpret_cast(&last_msg_->common.toe.wn)), - 2154) - << "incorrect value for common.toe.wn, expected 2154, is " - << last_msg_->common.toe.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 5.2 * 100), 0.05) - << "incorrect value for common.ura, expected 5.2, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->d_tau * 100 - -2.79396772385e-09 * 100), 0.05) - << "incorrect value for d_tau, expected -2.79396772385e-09, is " - << last_msg_->d_tau; - EXPECT_EQ(get_asfcn)>( - reinterpret_cast(&last_msg_->fcn)), - 14) - << "incorrect value for fcn, expected 14, is " << last_msg_->fcn; - EXPECT_LT((last_msg_->gamma * 100 - 9.09494701773e-13 * 100), 0.05) - << "incorrect value for gamma, expected 9.09494701773e-13, is " - << last_msg_->gamma; - EXPECT_LT((last_msg_->pos[0] * 100 - -12177330.0781 * 100), 0.05) - << "incorrect value for pos[0], expected -12177330.0781, is " - << last_msg_->pos[0]; - EXPECT_LT((last_msg_->pos[1] * 100 - 599893.066406 * 100), 0.05) - << "incorrect value for pos[1], expected 599893.066406, is " - << last_msg_->pos[1]; - EXPECT_LT((last_msg_->pos[2] * 100 - -22373708.4961 * 100), 0.05) - << "incorrect value for pos[2], expected -22373708.4961, is " - << last_msg_->pos[2]; - EXPECT_LT((last_msg_->tau * 100 - -8.36281105876e-05 * 100), 0.05) - << "incorrect value for tau, expected -8.36281105876e-05, is " - << last_msg_->tau; - EXPECT_LT((last_msg_->vel[0] * 100 - -1726.50623322 * 100), 0.05) - << "incorrect value for vel[0], expected -1726.50623322, is " - << last_msg_->vel[0]; - EXPECT_LT((last_msg_->vel[1] * 100 - -2542.61493683 * 100), 0.05) - << "incorrect value for vel[1], expected -2542.61493683, is " - << last_msg_->vel[1]; - EXPECT_LT((last_msg_->vel[2] * 100 - 869.817733765 * 100), 0.05) - << "incorrect value for vel[2], expected 869.817733765, is " - << last_msg_->vel[2]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGLODepD.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGLODepD.cc deleted file mode 100644 index 9b364278d0..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGLODepD.cc +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGLODepD.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepD0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepD0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_glo_dep_d_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_glo_dep_d_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgEphemerisGLODepD0, Test) { - uint8_t encoded_frame[] = { - 85, 136, 0, 195, 4, 120, 4, 3, 70, 197, 6, 0, 106, 8, 205, - 204, 204, 204, 204, 204, 20, 64, 96, 9, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 112, 61, 0, 0, 0, 0, 48, 236, 21, 191, 0, - 0, 0, 0, 0, 0, 40, 190, 0, 0, 128, 66, 246, 57, 103, 193, - 0, 0, 0, 34, 170, 78, 34, 65, 0, 0, 240, 199, 84, 86, 117, - 193, 0, 0, 0, 98, 6, 250, 154, 192, 0, 0, 0, 217, 58, 221, - 163, 192, 0, 0, 0, 184, 138, 46, 139, 64, 0, 0, 0, 0, 0, - 64, 175, 62, 0, 0, 0, 0, 0, 64, 175, 62, 0, 0, 0, 0, - 0, 112, 199, 62, 14, 100, 82, 64, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_glo_dep_d_t *test_msg = - (msg_ephemeris_glo_dep_d_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[0] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[1] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[2] = 2.7939677238464355e-06; - test_msg->common.fit_interval = 2400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 3; - test_msg->common.sid.sat = 4; - test_msg->common.toe.tow = 443718; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 5.2; - test_msg->common.valid = 1; - test_msg->d_tau = -2.7939677238464355e-09; - test_msg->fcn = 14; - test_msg->gamma = 9.094947017729282e-13; - test_msg->iod = 100; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[0] = -12177330.078125; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[1] = 599893.06640625; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[2] = -22373708.49609375; - test_msg->tau = -8.36281105875969e-05; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[0] = -1726.506233215332; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[1] = -2542.6149368286133; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[2] = 869.8177337646484; - - EXPECT_EQ(send_message(0x88, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->acc[0] * 100 - 9.31322574615e-07 * 100), 0.05) - << "incorrect value for acc[0], expected 9.31322574615e-07, is " - << last_msg_->acc[0]; - EXPECT_LT((last_msg_->acc[1] * 100 - 9.31322574615e-07 * 100), 0.05) - << "incorrect value for acc[1], expected 9.31322574615e-07, is " - << last_msg_->acc[1]; - EXPECT_LT((last_msg_->acc[2] * 100 - 2.79396772385e-06 * 100), 0.05) - << "incorrect value for acc[2], expected 2.79396772385e-06, is " - << last_msg_->acc[2]; - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 2400) - << "incorrect value for common.fit_interval, expected 2400, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 3) - << "incorrect value for common.sid.code, expected 3, is " - << last_msg_->common.sid.code; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 4) - << "incorrect value for common.sid.sat, expected 4, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toe.tow)>( - reinterpret_cast(&last_msg_->common.toe.tow)), - 443718) - << "incorrect value for common.toe.tow, expected 443718, is " - << last_msg_->common.toe.tow; - EXPECT_EQ(get_ascommon.toe.wn)>( - reinterpret_cast(&last_msg_->common.toe.wn)), - 2154) - << "incorrect value for common.toe.wn, expected 2154, is " - << last_msg_->common.toe.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 5.2 * 100), 0.05) - << "incorrect value for common.ura, expected 5.2, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->d_tau * 100 - -2.79396772385e-09 * 100), 0.05) - << "incorrect value for d_tau, expected -2.79396772385e-09, is " - << last_msg_->d_tau; - EXPECT_EQ(get_asfcn)>( - reinterpret_cast(&last_msg_->fcn)), - 14) - << "incorrect value for fcn, expected 14, is " << last_msg_->fcn; - EXPECT_LT((last_msg_->gamma * 100 - 9.09494701773e-13 * 100), 0.05) - << "incorrect value for gamma, expected 9.09494701773e-13, is " - << last_msg_->gamma; - EXPECT_EQ(get_asiod)>( - reinterpret_cast(&last_msg_->iod)), - 100) - << "incorrect value for iod, expected 100, is " << last_msg_->iod; - EXPECT_LT((last_msg_->pos[0] * 100 - -12177330.0781 * 100), 0.05) - << "incorrect value for pos[0], expected -12177330.0781, is " - << last_msg_->pos[0]; - EXPECT_LT((last_msg_->pos[1] * 100 - 599893.066406 * 100), 0.05) - << "incorrect value for pos[1], expected 599893.066406, is " - << last_msg_->pos[1]; - EXPECT_LT((last_msg_->pos[2] * 100 - -22373708.4961 * 100), 0.05) - << "incorrect value for pos[2], expected -22373708.4961, is " - << last_msg_->pos[2]; - EXPECT_LT((last_msg_->tau * 100 - -8.36281105876e-05 * 100), 0.05) - << "incorrect value for tau, expected -8.36281105876e-05, is " - << last_msg_->tau; - EXPECT_LT((last_msg_->vel[0] * 100 - -1726.50623322 * 100), 0.05) - << "incorrect value for vel[0], expected -1726.50623322, is " - << last_msg_->vel[0]; - EXPECT_LT((last_msg_->vel[1] * 100 - -2542.61493683 * 100), 0.05) - << "incorrect value for vel[1], expected -2542.61493683, is " - << last_msg_->vel[1]; - EXPECT_LT((last_msg_->vel[2] * 100 - 869.817733765 * 100), 0.05) - << "incorrect value for vel[2], expected 869.817733765, is " - << last_msg_->vel[2]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGPS.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGPS.cc deleted file mode 100644 index da71f40965..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGPS.cc +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGPS.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgEphemerisGPS0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgEphemerisGPS0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_gps_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_gps_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgEphemerisGPS0, Test) { - uint8_t encoded_frame[] = { - 85, 138, 0, 10, 9, 139, 22, 0, 176, 207, 6, 0, 106, 8, 0, - 0, 0, 64, 64, 56, 0, 0, 1, 0, 0, 0, 152, 178, 0, 64, - 81, 194, 0, 80, 154, 67, 0, 32, 56, 182, 0, 128, 82, 54, 0, - 0, 0, 50, 0, 0, 248, 179, 114, 216, 96, 180, 49, 117, 56, 62, - 142, 41, 5, 235, 95, 135, 150, 191, 0, 0, 0, 32, 191, 247, 124, - 63, 0, 0, 192, 206, 140, 33, 180, 64, 41, 131, 179, 134, 141, 248, - 253, 191, 227, 133, 81, 54, 204, 30, 67, 190, 216, 59, 199, 39, 96, - 168, 239, 191, 71, 11, 217, 147, 145, 228, 237, 63, 221, 47, 100, 224, - 255, 47, 198, 189, 96, 139, 37, 186, 0, 0, 30, 45, 0, 0, 0, - 0, 176, 207, 6, 0, 106, 8, 45, 45, 0, 170, 4, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_gps_t *test_msg = (msg_ephemeris_gps_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = -0.0006315018981695175; - test_msg->af1 = 8.981260180007666e-12; - test_msg->af2 = 0.0; - test_msg->c_ic = 7.450580596923828e-09; - test_msg->c_is = -1.1548399925231934e-07; - test_msg->c_rc = 308.625; - test_msg->c_rs = -52.3125; - test_msg->c_uc = -2.7436763048171997e-06; - test_msg->c_us = 3.1366944313049316e-06; - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 0; - test_msg->common.sid.sat = 22; - test_msg->common.toe.tow = 446384; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 2.0; - test_msg->common.valid = 1; - test_msg->dn = 5.694522914022375e-09; - test_msg->ecc = 0.007072207052260637; - test_msg->inc = 0.9341514480259797; - test_msg->inc_dot = -4.035882396415757e-11; - test_msg->iodc = 45; - test_msg->iode = 45; - test_msg->m0 = -0.02200078842114688; - test_msg->omega0 = -1.8731818448797617; - test_msg->omegadot = -8.903585155774196e-09; - test_msg->sqrta = 5153.550029754639; - test_msg->tgd = -1.7695128917694092e-08; - test_msg->toc.tow = 446384; - test_msg->toc.wn = 2154; - test_msg->w = -0.9893036629599647; - - EXPECT_EQ(send_message(0x8a, 2314, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 2314); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - -0.00063150189817 * 100), 0.05) - << "incorrect value for af0, expected -0.00063150189817, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - 8.98126018001e-12 * 100), 0.05) - << "incorrect value for af1, expected 8.98126018001e-12, is " - << last_msg_->af1; - EXPECT_LT((last_msg_->af2 * 100 - 0.0 * 100), 0.05) - << "incorrect value for af2, expected 0.0, is " << last_msg_->af2; - EXPECT_LT((last_msg_->c_ic * 100 - 7.45058059692e-09 * 100), 0.05) - << "incorrect value for c_ic, expected 7.45058059692e-09, is " - << last_msg_->c_ic; - EXPECT_LT((last_msg_->c_is * 100 - -1.15483999252e-07 * 100), 0.05) - << "incorrect value for c_is, expected -1.15483999252e-07, is " - << last_msg_->c_is; - EXPECT_LT((last_msg_->c_rc * 100 - 308.625 * 100), 0.05) - << "incorrect value for c_rc, expected 308.625, is " << last_msg_->c_rc; - EXPECT_LT((last_msg_->c_rs * 100 - -52.3125 * 100), 0.05) - << "incorrect value for c_rs, expected -52.3125, is " << last_msg_->c_rs; - EXPECT_LT((last_msg_->c_uc * 100 - -2.74367630482e-06 * 100), 0.05) - << "incorrect value for c_uc, expected -2.74367630482e-06, is " - << last_msg_->c_uc; - EXPECT_LT((last_msg_->c_us * 100 - 3.1366944313e-06 * 100), 0.05) - << "incorrect value for c_us, expected 3.1366944313e-06, is " - << last_msg_->c_us; - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 14400) - << "incorrect value for common.fit_interval, expected 14400, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 0) - << "incorrect value for common.sid.code, expected 0, is " - << last_msg_->common.sid.code; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 22) - << "incorrect value for common.sid.sat, expected 22, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toe.tow)>( - reinterpret_cast(&last_msg_->common.toe.tow)), - 446384) - << "incorrect value for common.toe.tow, expected 446384, is " - << last_msg_->common.toe.tow; - EXPECT_EQ(get_ascommon.toe.wn)>( - reinterpret_cast(&last_msg_->common.toe.wn)), - 2154) - << "incorrect value for common.toe.wn, expected 2154, is " - << last_msg_->common.toe.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 2.0 * 100), 0.05) - << "incorrect value for common.ura, expected 2.0, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->dn * 100 - 5.69452291402e-09 * 100), 0.05) - << "incorrect value for dn, expected 5.69452291402e-09, is " - << last_msg_->dn; - EXPECT_LT((last_msg_->ecc * 100 - 0.00707220705226 * 100), 0.05) - << "incorrect value for ecc, expected 0.00707220705226, is " - << last_msg_->ecc; - EXPECT_LT((last_msg_->inc * 100 - 0.934151448026 * 100), 0.05) - << "incorrect value for inc, expected 0.934151448026, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->inc_dot * 100 - -4.03588239642e-11 * 100), 0.05) - << "incorrect value for inc_dot, expected -4.03588239642e-11, is " - << last_msg_->inc_dot; - EXPECT_EQ(get_asiodc)>( - reinterpret_cast(&last_msg_->iodc)), - 45) - << "incorrect value for iodc, expected 45, is " << last_msg_->iodc; - EXPECT_EQ(get_asiode)>( - reinterpret_cast(&last_msg_->iode)), - 45) - << "incorrect value for iode, expected 45, is " << last_msg_->iode; - EXPECT_LT((last_msg_->m0 * 100 - -0.0220007884211 * 100), 0.05) - << "incorrect value for m0, expected -0.0220007884211, is " - << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - -1.87318184488 * 100), 0.05) - << "incorrect value for omega0, expected -1.87318184488, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -8.90358515577e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -8.90358515577e-09, is " - << last_msg_->omegadot; - EXPECT_LT((last_msg_->sqrta * 100 - 5153.55002975 * 100), 0.05) - << "incorrect value for sqrta, expected 5153.55002975, is " - << last_msg_->sqrta; - EXPECT_LT((last_msg_->tgd * 100 - -1.76951289177e-08 * 100), 0.05) - << "incorrect value for tgd, expected -1.76951289177e-08, is " - << last_msg_->tgd; - EXPECT_EQ(get_astoc.tow)>( - reinterpret_cast(&last_msg_->toc.tow)), - 446384) - << "incorrect value for toc.tow, expected 446384, is " - << last_msg_->toc.tow; - EXPECT_EQ(get_astoc.wn)>( - reinterpret_cast(&last_msg_->toc.wn)), - 2154) - << "incorrect value for toc.wn, expected 2154, is " << last_msg_->toc.wn; - EXPECT_LT((last_msg_->w * 100 - -0.98930366296 * 100), 0.05) - << "incorrect value for w, expected -0.98930366296, is " << last_msg_->w; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGPSDepE.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGPSDepE.cc deleted file mode 100644 index 41ea842a10..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGPSDepE.cc +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGPSDepE.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgEphemerisGPSDepE0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgEphemerisGPSDepE0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_gps_dep_e_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_gps_dep_e_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgEphemerisGPSDepE0, Test) { - uint8_t encoded_frame[] = { - 85, 129, 0, 123, 0, 185, 22, 0, 0, 0, 176, 207, 6, 0, 106, - 8, 0, 0, 0, 0, 0, 0, 0, 64, 64, 56, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 83, 190, 0, 0, 0, 0, 0, 40, 74, - 192, 0, 0, 0, 0, 0, 74, 115, 64, 0, 0, 0, 0, 0, 4, - 199, 190, 0, 0, 0, 0, 0, 80, 202, 62, 0, 0, 0, 0, 0, - 0, 64, 62, 0, 0, 0, 0, 0, 0, 127, 190, 114, 216, 96, 180, - 49, 117, 56, 62, 142, 41, 5, 235, 95, 135, 150, 191, 0, 0, 0, - 32, 191, 247, 124, 63, 0, 0, 192, 206, 140, 33, 180, 64, 41, 131, - 179, 134, 141, 248, 253, 191, 227, 133, 81, 54, 204, 30, 67, 190, 216, - 59, 199, 39, 96, 168, 239, 191, 71, 11, 217, 147, 145, 228, 237, 63, - 221, 47, 100, 224, 255, 47, 198, 189, 0, 0, 0, 0, 108, 177, 68, - 191, 0, 0, 0, 0, 0, 192, 163, 61, 0, 0, 0, 0, 0, 0, - 0, 0, 176, 207, 6, 0, 106, 8, 45, 45, 0, 6, 238, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_gps_dep_e_t *test_msg = - (msg_ephemeris_gps_dep_e_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = -0.0006315018981695175; - test_msg->af1 = 8.981260180007666e-12; - test_msg->af2 = 0.0; - test_msg->c_ic = 7.450580596923828e-09; - test_msg->c_is = -1.1548399925231934e-07; - test_msg->c_rc = 308.625; - test_msg->c_rs = -52.3125; - test_msg->c_uc = -2.7436763048171997e-06; - test_msg->c_us = 3.1366944313049316e-06; - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 0; - test_msg->common.sid.reserved = 0; - test_msg->common.sid.sat = 22; - test_msg->common.toe.tow = 446384; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 2.0; - test_msg->common.valid = 1; - test_msg->dn = 5.694522914022375e-09; - test_msg->ecc = 0.007072207052260637; - test_msg->inc = 0.9341514480259797; - test_msg->inc_dot = -4.035882396415757e-11; - test_msg->iodc = 45; - test_msg->iode = 45; - test_msg->m0 = -0.02200078842114688; - test_msg->omega0 = -1.8731818448797617; - test_msg->omegadot = -8.903585155774196e-09; - test_msg->sqrta = 5153.550029754639; - test_msg->tgd = -1.7695128917694092e-08; - test_msg->toc.tow = 446384; - test_msg->toc.wn = 2154; - test_msg->w = -0.9893036629599647; - - EXPECT_EQ(send_message(0x81, 123, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 123); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - -0.00063150189817 * 100), 0.05) - << "incorrect value for af0, expected -0.00063150189817, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - 8.98126018001e-12 * 100), 0.05) - << "incorrect value for af1, expected 8.98126018001e-12, is " - << last_msg_->af1; - EXPECT_LT((last_msg_->af2 * 100 - 0.0 * 100), 0.05) - << "incorrect value for af2, expected 0.0, is " << last_msg_->af2; - EXPECT_LT((last_msg_->c_ic * 100 - 7.45058059692e-09 * 100), 0.05) - << "incorrect value for c_ic, expected 7.45058059692e-09, is " - << last_msg_->c_ic; - EXPECT_LT((last_msg_->c_is * 100 - -1.15483999252e-07 * 100), 0.05) - << "incorrect value for c_is, expected -1.15483999252e-07, is " - << last_msg_->c_is; - EXPECT_LT((last_msg_->c_rc * 100 - 308.625 * 100), 0.05) - << "incorrect value for c_rc, expected 308.625, is " << last_msg_->c_rc; - EXPECT_LT((last_msg_->c_rs * 100 - -52.3125 * 100), 0.05) - << "incorrect value for c_rs, expected -52.3125, is " << last_msg_->c_rs; - EXPECT_LT((last_msg_->c_uc * 100 - -2.74367630482e-06 * 100), 0.05) - << "incorrect value for c_uc, expected -2.74367630482e-06, is " - << last_msg_->c_uc; - EXPECT_LT((last_msg_->c_us * 100 - 3.1366944313e-06 * 100), 0.05) - << "incorrect value for c_us, expected 3.1366944313e-06, is " - << last_msg_->c_us; - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 14400) - << "incorrect value for common.fit_interval, expected 14400, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 0) - << "incorrect value for common.sid.code, expected 0, is " - << last_msg_->common.sid.code; - EXPECT_EQ( - get_ascommon.sid.reserved)>( - reinterpret_cast(&last_msg_->common.sid.reserved)), - 0) - << "incorrect value for common.sid.reserved, expected 0, is " - << last_msg_->common.sid.reserved; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 22) - << "incorrect value for common.sid.sat, expected 22, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toe.tow)>( - reinterpret_cast(&last_msg_->common.toe.tow)), - 446384) - << "incorrect value for common.toe.tow, expected 446384, is " - << last_msg_->common.toe.tow; - EXPECT_EQ(get_ascommon.toe.wn)>( - reinterpret_cast(&last_msg_->common.toe.wn)), - 2154) - << "incorrect value for common.toe.wn, expected 2154, is " - << last_msg_->common.toe.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 2.0 * 100), 0.05) - << "incorrect value for common.ura, expected 2.0, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->dn * 100 - 5.69452291402e-09 * 100), 0.05) - << "incorrect value for dn, expected 5.69452291402e-09, is " - << last_msg_->dn; - EXPECT_LT((last_msg_->ecc * 100 - 0.00707220705226 * 100), 0.05) - << "incorrect value for ecc, expected 0.00707220705226, is " - << last_msg_->ecc; - EXPECT_LT((last_msg_->inc * 100 - 0.934151448026 * 100), 0.05) - << "incorrect value for inc, expected 0.934151448026, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->inc_dot * 100 - -4.03588239642e-11 * 100), 0.05) - << "incorrect value for inc_dot, expected -4.03588239642e-11, is " - << last_msg_->inc_dot; - EXPECT_EQ(get_asiodc)>( - reinterpret_cast(&last_msg_->iodc)), - 45) - << "incorrect value for iodc, expected 45, is " << last_msg_->iodc; - EXPECT_EQ(get_asiode)>( - reinterpret_cast(&last_msg_->iode)), - 45) - << "incorrect value for iode, expected 45, is " << last_msg_->iode; - EXPECT_LT((last_msg_->m0 * 100 - -0.0220007884211 * 100), 0.05) - << "incorrect value for m0, expected -0.0220007884211, is " - << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - -1.87318184488 * 100), 0.05) - << "incorrect value for omega0, expected -1.87318184488, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -8.90358515577e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -8.90358515577e-09, is " - << last_msg_->omegadot; - EXPECT_LT((last_msg_->sqrta * 100 - 5153.55002975 * 100), 0.05) - << "incorrect value for sqrta, expected 5153.55002975, is " - << last_msg_->sqrta; - EXPECT_LT((last_msg_->tgd * 100 - -1.76951289177e-08 * 100), 0.05) - << "incorrect value for tgd, expected -1.76951289177e-08, is " - << last_msg_->tgd; - EXPECT_EQ(get_astoc.tow)>( - reinterpret_cast(&last_msg_->toc.tow)), - 446384) - << "incorrect value for toc.tow, expected 446384, is " - << last_msg_->toc.tow; - EXPECT_EQ(get_astoc.wn)>( - reinterpret_cast(&last_msg_->toc.wn)), - 2154) - << "incorrect value for toc.wn, expected 2154, is " << last_msg_->toc.wn; - EXPECT_LT((last_msg_->w * 100 - -0.98930366296 * 100), 0.05) - << "incorrect value for w, expected -0.98930366296, is " << last_msg_->w; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGPSDepF.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGPSDepF.cc deleted file mode 100644 index e7b27f54cb..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGPSDepF.cc +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGPSDepF.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgEphemerisGPSDepF0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgEphemerisGPSDepF0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_gps_dep_f_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_gps_dep_f_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgEphemerisGPSDepF0, Test) { - uint8_t encoded_frame[] = { - 85, 134, 0, 123, 0, 183, 22, 0, 176, 207, 6, 0, 106, 8, 0, - 0, 0, 0, 0, 0, 0, 64, 64, 56, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 83, 190, 0, 0, 0, 0, 0, 40, 74, 192, 0, - 0, 0, 0, 0, 74, 115, 64, 0, 0, 0, 0, 0, 4, 199, 190, - 0, 0, 0, 0, 0, 80, 202, 62, 0, 0, 0, 0, 0, 0, 64, - 62, 0, 0, 0, 0, 0, 0, 127, 190, 114, 216, 96, 180, 49, 117, - 56, 62, 142, 41, 5, 235, 95, 135, 150, 191, 0, 0, 0, 32, 191, - 247, 124, 63, 0, 0, 192, 206, 140, 33, 180, 64, 41, 131, 179, 134, - 141, 248, 253, 191, 227, 133, 81, 54, 204, 30, 67, 190, 216, 59, 199, - 39, 96, 168, 239, 191, 71, 11, 217, 147, 145, 228, 237, 63, 221, 47, - 100, 224, 255, 47, 198, 189, 0, 0, 0, 0, 108, 177, 68, 191, 0, - 0, 0, 0, 0, 192, 163, 61, 0, 0, 0, 0, 0, 0, 0, 0, - 176, 207, 6, 0, 106, 8, 45, 45, 0, 115, 254, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_gps_dep_f_t *test_msg = - (msg_ephemeris_gps_dep_f_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = -0.0006315018981695175; - test_msg->af1 = 8.981260180007666e-12; - test_msg->af2 = 0.0; - test_msg->c_ic = 7.450580596923828e-09; - test_msg->c_is = -1.1548399925231934e-07; - test_msg->c_rc = 308.625; - test_msg->c_rs = -52.3125; - test_msg->c_uc = -2.7436763048171997e-06; - test_msg->c_us = 3.1366944313049316e-06; - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 0; - test_msg->common.sid.sat = 22; - test_msg->common.toe.tow = 446384; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 2.0; - test_msg->common.valid = 1; - test_msg->dn = 5.694522914022375e-09; - test_msg->ecc = 0.007072207052260637; - test_msg->inc = 0.9341514480259797; - test_msg->inc_dot = -4.035882396415757e-11; - test_msg->iodc = 45; - test_msg->iode = 45; - test_msg->m0 = -0.02200078842114688; - test_msg->omega0 = -1.8731818448797617; - test_msg->omegadot = -8.903585155774196e-09; - test_msg->sqrta = 5153.550029754639; - test_msg->tgd = -1.7695128917694092e-08; - test_msg->toc.tow = 446384; - test_msg->toc.wn = 2154; - test_msg->w = -0.9893036629599647; - - EXPECT_EQ(send_message(0x86, 123, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 123); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - -0.00063150189817 * 100), 0.05) - << "incorrect value for af0, expected -0.00063150189817, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - 8.98126018001e-12 * 100), 0.05) - << "incorrect value for af1, expected 8.98126018001e-12, is " - << last_msg_->af1; - EXPECT_LT((last_msg_->af2 * 100 - 0.0 * 100), 0.05) - << "incorrect value for af2, expected 0.0, is " << last_msg_->af2; - EXPECT_LT((last_msg_->c_ic * 100 - 7.45058059692e-09 * 100), 0.05) - << "incorrect value for c_ic, expected 7.45058059692e-09, is " - << last_msg_->c_ic; - EXPECT_LT((last_msg_->c_is * 100 - -1.15483999252e-07 * 100), 0.05) - << "incorrect value for c_is, expected -1.15483999252e-07, is " - << last_msg_->c_is; - EXPECT_LT((last_msg_->c_rc * 100 - 308.625 * 100), 0.05) - << "incorrect value for c_rc, expected 308.625, is " << last_msg_->c_rc; - EXPECT_LT((last_msg_->c_rs * 100 - -52.3125 * 100), 0.05) - << "incorrect value for c_rs, expected -52.3125, is " << last_msg_->c_rs; - EXPECT_LT((last_msg_->c_uc * 100 - -2.74367630482e-06 * 100), 0.05) - << "incorrect value for c_uc, expected -2.74367630482e-06, is " - << last_msg_->c_uc; - EXPECT_LT((last_msg_->c_us * 100 - 3.1366944313e-06 * 100), 0.05) - << "incorrect value for c_us, expected 3.1366944313e-06, is " - << last_msg_->c_us; - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 14400) - << "incorrect value for common.fit_interval, expected 14400, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 0) - << "incorrect value for common.sid.code, expected 0, is " - << last_msg_->common.sid.code; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 22) - << "incorrect value for common.sid.sat, expected 22, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toe.tow)>( - reinterpret_cast(&last_msg_->common.toe.tow)), - 446384) - << "incorrect value for common.toe.tow, expected 446384, is " - << last_msg_->common.toe.tow; - EXPECT_EQ(get_ascommon.toe.wn)>( - reinterpret_cast(&last_msg_->common.toe.wn)), - 2154) - << "incorrect value for common.toe.wn, expected 2154, is " - << last_msg_->common.toe.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 2.0 * 100), 0.05) - << "incorrect value for common.ura, expected 2.0, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->dn * 100 - 5.69452291402e-09 * 100), 0.05) - << "incorrect value for dn, expected 5.69452291402e-09, is " - << last_msg_->dn; - EXPECT_LT((last_msg_->ecc * 100 - 0.00707220705226 * 100), 0.05) - << "incorrect value for ecc, expected 0.00707220705226, is " - << last_msg_->ecc; - EXPECT_LT((last_msg_->inc * 100 - 0.934151448026 * 100), 0.05) - << "incorrect value for inc, expected 0.934151448026, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->inc_dot * 100 - -4.03588239642e-11 * 100), 0.05) - << "incorrect value for inc_dot, expected -4.03588239642e-11, is " - << last_msg_->inc_dot; - EXPECT_EQ(get_asiodc)>( - reinterpret_cast(&last_msg_->iodc)), - 45) - << "incorrect value for iodc, expected 45, is " << last_msg_->iodc; - EXPECT_EQ(get_asiode)>( - reinterpret_cast(&last_msg_->iode)), - 45) - << "incorrect value for iode, expected 45, is " << last_msg_->iode; - EXPECT_LT((last_msg_->m0 * 100 - -0.0220007884211 * 100), 0.05) - << "incorrect value for m0, expected -0.0220007884211, is " - << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - -1.87318184488 * 100), 0.05) - << "incorrect value for omega0, expected -1.87318184488, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -8.90358515577e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -8.90358515577e-09, is " - << last_msg_->omegadot; - EXPECT_LT((last_msg_->sqrta * 100 - 5153.55002975 * 100), 0.05) - << "incorrect value for sqrta, expected 5153.55002975, is " - << last_msg_->sqrta; - EXPECT_LT((last_msg_->tgd * 100 - -1.76951289177e-08 * 100), 0.05) - << "incorrect value for tgd, expected -1.76951289177e-08, is " - << last_msg_->tgd; - EXPECT_EQ(get_astoc.tow)>( - reinterpret_cast(&last_msg_->toc.tow)), - 446384) - << "incorrect value for toc.tow, expected 446384, is " - << last_msg_->toc.tow; - EXPECT_EQ(get_astoc.wn)>( - reinterpret_cast(&last_msg_->toc.wn)), - 2154) - << "incorrect value for toc.wn, expected 2154, is " << last_msg_->toc.wn; - EXPECT_LT((last_msg_->w * 100 - -0.98930366296 * 100), 0.05) - << "incorrect value for w, expected -0.98930366296, is " << last_msg_->w; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGal.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGal.cc deleted file mode 100644 index a38043c15b..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGal.cc +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGal.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgEphemerisGal0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgEphemerisGal0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_gal_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_gal_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgEphemerisGal0, Test) { - uint8_t encoded_frame[] = { - 85, 141, 0, 128, 240, 153, 27, 14, 32, 217, 6, 0, 106, 8, 20, - 174, 71, 64, 64, 56, 0, 0, 1, 0, 0, 0, 16, 49, 0, 0, - 16, 49, 0, 0, 34, 65, 0, 184, 132, 67, 0, 0, 16, 53, 0, - 0, 134, 54, 0, 0, 8, 179, 0, 0, 8, 179, 217, 204, 130, 105, - 128, 182, 43, 62, 248, 106, 31, 220, 8, 136, 253, 191, 0, 0, 0, - 0, 151, 92, 38, 63, 0, 0, 0, 55, 154, 64, 181, 64, 56, 38, - 1, 141, 255, 182, 242, 63, 222, 147, 136, 39, 79, 186, 56, 190, 80, - 114, 204, 251, 193, 92, 191, 63, 237, 55, 19, 41, 177, 73, 239, 63, - 49, 65, 189, 240, 8, 216, 245, 189, 255, 255, 255, 255, 67, 235, 241, - 190, 255, 255, 255, 255, 255, 255, 161, 189, 0, 0, 0, 0, 32, 217, - 6, 0, 106, 8, 108, 0, 108, 0, 0, 71, 208, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_gal_t *test_msg = (msg_ephemeris_gal_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = -1.7088896129280325e-05; - test_msg->af1 = -8.185452315956353e-12; - test_msg->af2 = 0.0; - test_msg->bgd_e1e5a = 2.0954757928848267e-09; - test_msg->bgd_e1e5b = 2.0954757928848267e-09; - test_msg->c_ic = -3.166496753692627e-08; - test_msg->c_is = -3.166496753692627e-08; - test_msg->c_rc = 265.4375; - test_msg->c_rs = 10.125; - test_msg->c_uc = 5.364418029785156e-07; - test_msg->c_us = 3.993511199951172e-06; - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 14; - test_msg->common.sid.sat = 27; - test_msg->common.toe.tow = 448800; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 3.119999885559082; - test_msg->common.valid = 1; - test_msg->dn = 3.2262058129932258e-09; - test_msg->ecc = 0.00017060607206076384; - test_msg->inc = 0.9777456094977858; - test_msg->inc_dot = -3.1787038343451465e-10; - test_msg->iodc = 108; - test_msg->iode = 108; - test_msg->m0 = -1.8457115744155868; - test_msg->omega0 = 1.16967730598334; - test_msg->omegadot = -5.757382675240872e-09; - test_msg->source = 0; - test_msg->sqrta = 5440.602401733398; - test_msg->toc.tow = 448800; - test_msg->toc.wn = 2154; - test_msg->w = 0.12250912091662625; - - EXPECT_EQ(send_message(0x8d, 61568, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 61568); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - -1.70888961293e-05 * 100), 0.05) - << "incorrect value for af0, expected -1.70888961293e-05, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - -8.18545231596e-12 * 100), 0.05) - << "incorrect value for af1, expected -8.18545231596e-12, is " - << last_msg_->af1; - EXPECT_LT((last_msg_->af2 * 100 - 0.0 * 100), 0.05) - << "incorrect value for af2, expected 0.0, is " << last_msg_->af2; - EXPECT_LT((last_msg_->bgd_e1e5a * 100 - 2.09547579288e-09 * 100), 0.05) - << "incorrect value for bgd_e1e5a, expected 2.09547579288e-09, is " - << last_msg_->bgd_e1e5a; - EXPECT_LT((last_msg_->bgd_e1e5b * 100 - 2.09547579288e-09 * 100), 0.05) - << "incorrect value for bgd_e1e5b, expected 2.09547579288e-09, is " - << last_msg_->bgd_e1e5b; - EXPECT_LT((last_msg_->c_ic * 100 - -3.16649675369e-08 * 100), 0.05) - << "incorrect value for c_ic, expected -3.16649675369e-08, is " - << last_msg_->c_ic; - EXPECT_LT((last_msg_->c_is * 100 - -3.16649675369e-08 * 100), 0.05) - << "incorrect value for c_is, expected -3.16649675369e-08, is " - << last_msg_->c_is; - EXPECT_LT((last_msg_->c_rc * 100 - 265.4375 * 100), 0.05) - << "incorrect value for c_rc, expected 265.4375, is " << last_msg_->c_rc; - EXPECT_LT((last_msg_->c_rs * 100 - 10.125 * 100), 0.05) - << "incorrect value for c_rs, expected 10.125, is " << last_msg_->c_rs; - EXPECT_LT((last_msg_->c_uc * 100 - 5.36441802979e-07 * 100), 0.05) - << "incorrect value for c_uc, expected 5.36441802979e-07, is " - << last_msg_->c_uc; - EXPECT_LT((last_msg_->c_us * 100 - 3.99351119995e-06 * 100), 0.05) - << "incorrect value for c_us, expected 3.99351119995e-06, is " - << last_msg_->c_us; - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 14400) - << "incorrect value for common.fit_interval, expected 14400, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 14) - << "incorrect value for common.sid.code, expected 14, is " - << last_msg_->common.sid.code; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 27) - << "incorrect value for common.sid.sat, expected 27, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toe.tow)>( - reinterpret_cast(&last_msg_->common.toe.tow)), - 448800) - << "incorrect value for common.toe.tow, expected 448800, is " - << last_msg_->common.toe.tow; - EXPECT_EQ(get_ascommon.toe.wn)>( - reinterpret_cast(&last_msg_->common.toe.wn)), - 2154) - << "incorrect value for common.toe.wn, expected 2154, is " - << last_msg_->common.toe.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 3.11999988556 * 100), 0.05) - << "incorrect value for common.ura, expected 3.11999988556, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->dn * 100 - 3.22620581299e-09 * 100), 0.05) - << "incorrect value for dn, expected 3.22620581299e-09, is " - << last_msg_->dn; - EXPECT_LT((last_msg_->ecc * 100 - 0.000170606072061 * 100), 0.05) - << "incorrect value for ecc, expected 0.000170606072061, is " - << last_msg_->ecc; - EXPECT_LT((last_msg_->inc * 100 - 0.977745609498 * 100), 0.05) - << "incorrect value for inc, expected 0.977745609498, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->inc_dot * 100 - -3.17870383435e-10 * 100), 0.05) - << "incorrect value for inc_dot, expected -3.17870383435e-10, is " - << last_msg_->inc_dot; - EXPECT_EQ(get_asiodc)>( - reinterpret_cast(&last_msg_->iodc)), - 108) - << "incorrect value for iodc, expected 108, is " << last_msg_->iodc; - EXPECT_EQ(get_asiode)>( - reinterpret_cast(&last_msg_->iode)), - 108) - << "incorrect value for iode, expected 108, is " << last_msg_->iode; - EXPECT_LT((last_msg_->m0 * 100 - -1.84571157442 * 100), 0.05) - << "incorrect value for m0, expected -1.84571157442, is " - << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - 1.16967730598 * 100), 0.05) - << "incorrect value for omega0, expected 1.16967730598, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -5.75738267524e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -5.75738267524e-09, is " - << last_msg_->omegadot; - EXPECT_EQ(get_assource)>( - reinterpret_cast(&last_msg_->source)), - 0) - << "incorrect value for source, expected 0, is " << last_msg_->source; - EXPECT_LT((last_msg_->sqrta * 100 - 5440.60240173 * 100), 0.05) - << "incorrect value for sqrta, expected 5440.60240173, is " - << last_msg_->sqrta; - EXPECT_EQ(get_astoc.tow)>( - reinterpret_cast(&last_msg_->toc.tow)), - 448800) - << "incorrect value for toc.tow, expected 448800, is " - << last_msg_->toc.tow; - EXPECT_EQ(get_astoc.wn)>( - reinterpret_cast(&last_msg_->toc.wn)), - 2154) - << "incorrect value for toc.wn, expected 2154, is " << last_msg_->toc.wn; - EXPECT_LT((last_msg_->w * 100 - 0.122509120917 * 100), 0.05) - << "incorrect value for w, expected 0.122509120917, is " << last_msg_->w; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGalDepA.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGalDepA.cc deleted file mode 100644 index 5c6f550d18..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisGalDepA.cc +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGalDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgEphemerisGalDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgEphemerisGalDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_gal_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_gal_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgEphemerisGalDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 149, 0, 195, 4, 152, 27, 14, 32, 217, 6, 0, 106, 8, 102, - 102, 230, 64, 64, 56, 0, 0, 1, 0, 154, 153, 153, 63, 205, 204, - 12, 64, 0, 0, 34, 65, 0, 184, 132, 67, 102, 102, 166, 64, 102, - 102, 198, 64, 205, 204, 76, 64, 102, 102, 134, 64, 217, 204, 130, 105, - 128, 182, 43, 62, 248, 106, 31, 220, 8, 136, 253, 191, 0, 0, 0, - 0, 151, 92, 38, 63, 0, 0, 0, 55, 154, 64, 181, 64, 56, 38, - 1, 141, 255, 182, 242, 63, 222, 147, 136, 39, 79, 186, 56, 190, 80, - 114, 204, 251, 193, 92, 191, 63, 237, 55, 19, 41, 177, 73, 239, 63, - 49, 65, 189, 240, 8, 216, 245, 189, 255, 255, 255, 255, 67, 235, 241, - 190, 255, 255, 255, 255, 255, 255, 161, 189, 205, 204, 76, 62, 32, 217, - 6, 0, 106, 8, 108, 0, 108, 0, 168, 49, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_gal_dep_a_t *test_msg = - (msg_ephemeris_gal_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = -1.7088896129280325e-05; - test_msg->af1 = -8.185452315956353e-12; - test_msg->af2 = 0.20000000298023224; - test_msg->bgd_e1e5a = 1.2000000476837158; - test_msg->bgd_e1e5b = 2.200000047683716; - test_msg->c_ic = 3.200000047683716; - test_msg->c_is = 4.199999809265137; - test_msg->c_rc = 265.4375; - test_msg->c_rs = 10.125; - test_msg->c_uc = 5.199999809265137; - test_msg->c_us = 6.199999809265137; - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 14; - test_msg->common.sid.sat = 27; - test_msg->common.toe.tow = 448800; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 7.199999809265137; - test_msg->common.valid = 1; - test_msg->dn = 3.2262058129932258e-09; - test_msg->ecc = 0.00017060607206076384; - test_msg->inc = 0.9777456094977858; - test_msg->inc_dot = -3.1787038343451465e-10; - test_msg->iodc = 108; - test_msg->iode = 108; - test_msg->m0 = -1.8457115744155868; - test_msg->omega0 = 1.16967730598334; - test_msg->omegadot = -5.757382675240872e-09; - test_msg->sqrta = 5440.602401733398; - test_msg->toc.tow = 448800; - test_msg->toc.wn = 2154; - test_msg->w = 0.12250912091662625; - - EXPECT_EQ(send_message(0x95, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - -1.70888961293e-05 * 100), 0.05) - << "incorrect value for af0, expected -1.70888961293e-05, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - -8.18545231596e-12 * 100), 0.05) - << "incorrect value for af1, expected -8.18545231596e-12, is " - << last_msg_->af1; - EXPECT_LT((last_msg_->af2 * 100 - 0.20000000298 * 100), 0.05) - << "incorrect value for af2, expected 0.20000000298, is " - << last_msg_->af2; - EXPECT_LT((last_msg_->bgd_e1e5a * 100 - 1.20000004768 * 100), 0.05) - << "incorrect value for bgd_e1e5a, expected 1.20000004768, is " - << last_msg_->bgd_e1e5a; - EXPECT_LT((last_msg_->bgd_e1e5b * 100 - 2.20000004768 * 100), 0.05) - << "incorrect value for bgd_e1e5b, expected 2.20000004768, is " - << last_msg_->bgd_e1e5b; - EXPECT_LT((last_msg_->c_ic * 100 - 3.20000004768 * 100), 0.05) - << "incorrect value for c_ic, expected 3.20000004768, is " - << last_msg_->c_ic; - EXPECT_LT((last_msg_->c_is * 100 - 4.19999980927 * 100), 0.05) - << "incorrect value for c_is, expected 4.19999980927, is " - << last_msg_->c_is; - EXPECT_LT((last_msg_->c_rc * 100 - 265.4375 * 100), 0.05) - << "incorrect value for c_rc, expected 265.4375, is " << last_msg_->c_rc; - EXPECT_LT((last_msg_->c_rs * 100 - 10.125 * 100), 0.05) - << "incorrect value for c_rs, expected 10.125, is " << last_msg_->c_rs; - EXPECT_LT((last_msg_->c_uc * 100 - 5.19999980927 * 100), 0.05) - << "incorrect value for c_uc, expected 5.19999980927, is " - << last_msg_->c_uc; - EXPECT_LT((last_msg_->c_us * 100 - 6.19999980927 * 100), 0.05) - << "incorrect value for c_us, expected 6.19999980927, is " - << last_msg_->c_us; - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 14400) - << "incorrect value for common.fit_interval, expected 14400, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 14) - << "incorrect value for common.sid.code, expected 14, is " - << last_msg_->common.sid.code; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 27) - << "incorrect value for common.sid.sat, expected 27, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toe.tow)>( - reinterpret_cast(&last_msg_->common.toe.tow)), - 448800) - << "incorrect value for common.toe.tow, expected 448800, is " - << last_msg_->common.toe.tow; - EXPECT_EQ(get_ascommon.toe.wn)>( - reinterpret_cast(&last_msg_->common.toe.wn)), - 2154) - << "incorrect value for common.toe.wn, expected 2154, is " - << last_msg_->common.toe.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 7.19999980927 * 100), 0.05) - << "incorrect value for common.ura, expected 7.19999980927, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->dn * 100 - 3.22620581299e-09 * 100), 0.05) - << "incorrect value for dn, expected 3.22620581299e-09, is " - << last_msg_->dn; - EXPECT_LT((last_msg_->ecc * 100 - 0.000170606072061 * 100), 0.05) - << "incorrect value for ecc, expected 0.000170606072061, is " - << last_msg_->ecc; - EXPECT_LT((last_msg_->inc * 100 - 0.977745609498 * 100), 0.05) - << "incorrect value for inc, expected 0.977745609498, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->inc_dot * 100 - -3.17870383435e-10 * 100), 0.05) - << "incorrect value for inc_dot, expected -3.17870383435e-10, is " - << last_msg_->inc_dot; - EXPECT_EQ(get_asiodc)>( - reinterpret_cast(&last_msg_->iodc)), - 108) - << "incorrect value for iodc, expected 108, is " << last_msg_->iodc; - EXPECT_EQ(get_asiode)>( - reinterpret_cast(&last_msg_->iode)), - 108) - << "incorrect value for iode, expected 108, is " << last_msg_->iode; - EXPECT_LT((last_msg_->m0 * 100 - -1.84571157442 * 100), 0.05) - << "incorrect value for m0, expected -1.84571157442, is " - << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - 1.16967730598 * 100), 0.05) - << "incorrect value for omega0, expected 1.16967730598, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -5.75738267524e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -5.75738267524e-09, is " - << last_msg_->omegadot; - EXPECT_LT((last_msg_->sqrta * 100 - 5440.60240173 * 100), 0.05) - << "incorrect value for sqrta, expected 5440.60240173, is " - << last_msg_->sqrta; - EXPECT_EQ(get_astoc.tow)>( - reinterpret_cast(&last_msg_->toc.tow)), - 448800) - << "incorrect value for toc.tow, expected 448800, is " - << last_msg_->toc.tow; - EXPECT_EQ(get_astoc.wn)>( - reinterpret_cast(&last_msg_->toc.wn)), - 2154) - << "incorrect value for toc.wn, expected 2154, is " << last_msg_->toc.wn; - EXPECT_LT((last_msg_->w * 100 - 0.122509120917 * 100), 0.05) - << "incorrect value for w, expected 0.122509120917, is " << last_msg_->w; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisSbas.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisSbas.cc deleted file mode 100644 index dc58f6527f..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisSbas.cc +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisSbas.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgEphemerisSbas0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgEphemerisSbas0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_sbas_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_sbas_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgEphemerisSbas0, Test) { - uint8_t encoded_frame[] = { - 85, 140, 0, 195, 4, 74, 22, 6, 176, 207, 6, 0, 106, 8, - 0, 0, 64, 177, 0, 0, 0, 0, 1, 0, 0, 0, 128, 66, - 246, 57, 103, 193, 0, 0, 0, 34, 170, 78, 34, 65, 0, 0, - 240, 199, 84, 86, 117, 193, 51, 208, 215, 196, 215, 233, 30, 197, - 86, 116, 89, 68, 0, 0, 122, 53, 0, 0, 122, 53, 0, 128, - 59, 54, 96, 139, 37, 186, 0, 0, 30, 45, 192, 147, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_sbas_t *test_msg = (msg_ephemeris_sbas_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->a_gf0 = -0.0006315018981695175; - test_msg->a_gf1 = 8.981260180007666e-12; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[0] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[1] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[2] = 2.7939677238464355e-06; - test_msg->common.fit_interval = 0; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 6; - test_msg->common.sid.sat = 22; - test_msg->common.toe.tow = 446384; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = -2.7939677238464355e-09; - test_msg->common.valid = 1; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[0] = -12177330.078125; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[1] = 599893.06640625; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[2] = -22373708.49609375; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[0] = -1726.5062255859375; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[1] = -2542.614990234375; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[2] = 869.8177490234375; - - EXPECT_EQ(send_message(0x8c, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->a_gf0 * 100 - -0.00063150189817 * 100), 0.05) - << "incorrect value for a_gf0, expected -0.00063150189817, is " - << last_msg_->a_gf0; - EXPECT_LT((last_msg_->a_gf1 * 100 - 8.98126018001e-12 * 100), 0.05) - << "incorrect value for a_gf1, expected 8.98126018001e-12, is " - << last_msg_->a_gf1; - EXPECT_LT((last_msg_->acc[0] * 100 - 9.31322574615e-07 * 100), 0.05) - << "incorrect value for acc[0], expected 9.31322574615e-07, is " - << last_msg_->acc[0]; - EXPECT_LT((last_msg_->acc[1] * 100 - 9.31322574615e-07 * 100), 0.05) - << "incorrect value for acc[1], expected 9.31322574615e-07, is " - << last_msg_->acc[1]; - EXPECT_LT((last_msg_->acc[2] * 100 - 2.79396772385e-06 * 100), 0.05) - << "incorrect value for acc[2], expected 2.79396772385e-06, is " - << last_msg_->acc[2]; - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 0) - << "incorrect value for common.fit_interval, expected 0, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 6) - << "incorrect value for common.sid.code, expected 6, is " - << last_msg_->common.sid.code; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 22) - << "incorrect value for common.sid.sat, expected 22, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toe.tow)>( - reinterpret_cast(&last_msg_->common.toe.tow)), - 446384) - << "incorrect value for common.toe.tow, expected 446384, is " - << last_msg_->common.toe.tow; - EXPECT_EQ(get_ascommon.toe.wn)>( - reinterpret_cast(&last_msg_->common.toe.wn)), - 2154) - << "incorrect value for common.toe.wn, expected 2154, is " - << last_msg_->common.toe.wn; - EXPECT_LT((last_msg_->common.ura * 100 - -2.79396772385e-09 * 100), 0.05) - << "incorrect value for common.ura, expected -2.79396772385e-09, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->pos[0] * 100 - -12177330.0781 * 100), 0.05) - << "incorrect value for pos[0], expected -12177330.0781, is " - << last_msg_->pos[0]; - EXPECT_LT((last_msg_->pos[1] * 100 - 599893.066406 * 100), 0.05) - << "incorrect value for pos[1], expected 599893.066406, is " - << last_msg_->pos[1]; - EXPECT_LT((last_msg_->pos[2] * 100 - -22373708.4961 * 100), 0.05) - << "incorrect value for pos[2], expected -22373708.4961, is " - << last_msg_->pos[2]; - EXPECT_LT((last_msg_->vel[0] * 100 - -1726.50622559 * 100), 0.05) - << "incorrect value for vel[0], expected -1726.50622559, is " - << last_msg_->vel[0]; - EXPECT_LT((last_msg_->vel[1] * 100 - -2542.61499023 * 100), 0.05) - << "incorrect value for vel[1], expected -2542.61499023, is " - << last_msg_->vel[1]; - EXPECT_LT((last_msg_->vel[2] * 100 - 869.817749023 * 100), 0.05) - << "incorrect value for vel[2], expected 869.817749023, is " - << last_msg_->vel[2]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisSbasDepA.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisSbasDepA.cc deleted file mode 100644 index 66b2efcfb8..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisSbasDepA.cc +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisSbasDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgEphemerisSbasDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgEphemerisSbasDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_sbas_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_sbas_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgEphemerisSbasDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 130, 0, 123, 0, 112, 22, 0, 6, 0, 176, 207, 6, 0, 106, - 8, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 1, 0, - 0, 0, 128, 66, 246, 57, 103, 193, 0, 0, 0, 34, 170, 78, 34, - 65, 0, 0, 240, 199, 84, 86, 117, 193, 0, 0, 0, 98, 6, 250, - 154, 192, 0, 0, 0, 217, 58, 221, 163, 192, 0, 0, 0, 184, 138, - 46, 139, 64, 0, 0, 0, 0, 0, 64, 175, 62, 0, 0, 0, 0, - 0, 64, 175, 62, 0, 0, 0, 0, 0, 112, 199, 62, 0, 0, 0, - 0, 108, 177, 68, 191, 0, 0, 0, 0, 0, 192, 163, 61, 178, 180, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_sbas_dep_a_t *test_msg = - (msg_ephemeris_sbas_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->a_gf0 = -0.0006315018981695175; - test_msg->a_gf1 = 8.981260180007666e-12; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[0] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[1] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[2] = 2.7939677238464355e-06; - test_msg->common.fit_interval = 0; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 6; - test_msg->common.sid.reserved = 0; - test_msg->common.sid.sat = 22; - test_msg->common.toe.tow = 446384; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 2.0; - test_msg->common.valid = 1; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[0] = -12177330.078125; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[1] = 599893.06640625; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[2] = -22373708.49609375; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[0] = -1726.506233215332; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[1] = -2542.6149368286133; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[2] = 869.8177337646484; - - EXPECT_EQ(send_message(0x82, 123, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 123); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->a_gf0 * 100 - -0.00063150189817 * 100), 0.05) - << "incorrect value for a_gf0, expected -0.00063150189817, is " - << last_msg_->a_gf0; - EXPECT_LT((last_msg_->a_gf1 * 100 - 8.98126018001e-12 * 100), 0.05) - << "incorrect value for a_gf1, expected 8.98126018001e-12, is " - << last_msg_->a_gf1; - EXPECT_LT((last_msg_->acc[0] * 100 - 9.31322574615e-07 * 100), 0.05) - << "incorrect value for acc[0], expected 9.31322574615e-07, is " - << last_msg_->acc[0]; - EXPECT_LT((last_msg_->acc[1] * 100 - 9.31322574615e-07 * 100), 0.05) - << "incorrect value for acc[1], expected 9.31322574615e-07, is " - << last_msg_->acc[1]; - EXPECT_LT((last_msg_->acc[2] * 100 - 2.79396772385e-06 * 100), 0.05) - << "incorrect value for acc[2], expected 2.79396772385e-06, is " - << last_msg_->acc[2]; - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 0) - << "incorrect value for common.fit_interval, expected 0, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 6) - << "incorrect value for common.sid.code, expected 6, is " - << last_msg_->common.sid.code; - EXPECT_EQ( - get_ascommon.sid.reserved)>( - reinterpret_cast(&last_msg_->common.sid.reserved)), - 0) - << "incorrect value for common.sid.reserved, expected 0, is " - << last_msg_->common.sid.reserved; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 22) - << "incorrect value for common.sid.sat, expected 22, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toe.tow)>( - reinterpret_cast(&last_msg_->common.toe.tow)), - 446384) - << "incorrect value for common.toe.tow, expected 446384, is " - << last_msg_->common.toe.tow; - EXPECT_EQ(get_ascommon.toe.wn)>( - reinterpret_cast(&last_msg_->common.toe.wn)), - 2154) - << "incorrect value for common.toe.wn, expected 2154, is " - << last_msg_->common.toe.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 2.0 * 100), 0.05) - << "incorrect value for common.ura, expected 2.0, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->pos[0] * 100 - -12177330.0781 * 100), 0.05) - << "incorrect value for pos[0], expected -12177330.0781, is " - << last_msg_->pos[0]; - EXPECT_LT((last_msg_->pos[1] * 100 - 599893.066406 * 100), 0.05) - << "incorrect value for pos[1], expected 599893.066406, is " - << last_msg_->pos[1]; - EXPECT_LT((last_msg_->pos[2] * 100 - -22373708.4961 * 100), 0.05) - << "incorrect value for pos[2], expected -22373708.4961, is " - << last_msg_->pos[2]; - EXPECT_LT((last_msg_->vel[0] * 100 - -1726.50623322 * 100), 0.05) - << "incorrect value for vel[0], expected -1726.50623322, is " - << last_msg_->vel[0]; - EXPECT_LT((last_msg_->vel[1] * 100 - -2542.61493683 * 100), 0.05) - << "incorrect value for vel[1], expected -2542.61493683, is " - << last_msg_->vel[1]; - EXPECT_LT((last_msg_->vel[2] * 100 - 869.817733765 * 100), 0.05) - << "incorrect value for vel[2], expected 869.817733765, is " - << last_msg_->vel[2]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisSbasDepB.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisSbasDepB.cc deleted file mode 100644 index 86507a91b0..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgEphemerisSbasDepB.cc +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisSbasDepB.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgEphemerisSbasDepB0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgEphemerisSbasDepB0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_sbas_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_sbas_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgEphemerisSbasDepB0, Test) { - uint8_t encoded_frame[] = { - 85, 132, 0, 123, 0, 110, 22, 6, 176, 207, 6, 0, 106, 8, 0, - 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 1, 0, 0, 0, - 128, 66, 246, 57, 103, 193, 0, 0, 0, 34, 170, 78, 34, 65, 0, - 0, 240, 199, 84, 86, 117, 193, 0, 0, 0, 98, 6, 250, 154, 192, - 0, 0, 0, 217, 58, 221, 163, 192, 0, 0, 0, 184, 138, 46, 139, - 64, 0, 0, 0, 0, 0, 64, 175, 62, 0, 0, 0, 0, 0, 64, - 175, 62, 0, 0, 0, 0, 0, 112, 199, 62, 0, 0, 0, 0, 108, - 177, 68, 191, 0, 0, 0, 0, 0, 192, 163, 61, 145, 104, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_sbas_dep_b_t *test_msg = - (msg_ephemeris_sbas_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->a_gf0 = -0.0006315018981695175; - test_msg->a_gf1 = 8.981260180007666e-12; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[0] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[1] = 9.313225746154785e-07; - if (sizeof(test_msg->acc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->acc[0])); - } - test_msg->acc[2] = 2.7939677238464355e-06; - test_msg->common.fit_interval = 0; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 6; - test_msg->common.sid.sat = 22; - test_msg->common.toe.tow = 446384; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 2.0; - test_msg->common.valid = 1; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[0] = -12177330.078125; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[1] = 599893.06640625; - if (sizeof(test_msg->pos) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->pos[0])); - } - test_msg->pos[2] = -22373708.49609375; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[0] = -1726.506233215332; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[1] = -2542.6149368286133; - if (sizeof(test_msg->vel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->vel[0])); - } - test_msg->vel[2] = 869.8177337646484; - - EXPECT_EQ(send_message(0x84, 123, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 123); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->a_gf0 * 100 - -0.00063150189817 * 100), 0.05) - << "incorrect value for a_gf0, expected -0.00063150189817, is " - << last_msg_->a_gf0; - EXPECT_LT((last_msg_->a_gf1 * 100 - 8.98126018001e-12 * 100), 0.05) - << "incorrect value for a_gf1, expected 8.98126018001e-12, is " - << last_msg_->a_gf1; - EXPECT_LT((last_msg_->acc[0] * 100 - 9.31322574615e-07 * 100), 0.05) - << "incorrect value for acc[0], expected 9.31322574615e-07, is " - << last_msg_->acc[0]; - EXPECT_LT((last_msg_->acc[1] * 100 - 9.31322574615e-07 * 100), 0.05) - << "incorrect value for acc[1], expected 9.31322574615e-07, is " - << last_msg_->acc[1]; - EXPECT_LT((last_msg_->acc[2] * 100 - 2.79396772385e-06 * 100), 0.05) - << "incorrect value for acc[2], expected 2.79396772385e-06, is " - << last_msg_->acc[2]; - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 0) - << "incorrect value for common.fit_interval, expected 0, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 6) - << "incorrect value for common.sid.code, expected 6, is " - << last_msg_->common.sid.code; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 22) - << "incorrect value for common.sid.sat, expected 22, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toe.tow)>( - reinterpret_cast(&last_msg_->common.toe.tow)), - 446384) - << "incorrect value for common.toe.tow, expected 446384, is " - << last_msg_->common.toe.tow; - EXPECT_EQ(get_ascommon.toe.wn)>( - reinterpret_cast(&last_msg_->common.toe.wn)), - 2154) - << "incorrect value for common.toe.wn, expected 2154, is " - << last_msg_->common.toe.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 2.0 * 100), 0.05) - << "incorrect value for common.ura, expected 2.0, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 1) - << "incorrect value for common.valid, expected 1, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->pos[0] * 100 - -12177330.0781 * 100), 0.05) - << "incorrect value for pos[0], expected -12177330.0781, is " - << last_msg_->pos[0]; - EXPECT_LT((last_msg_->pos[1] * 100 - 599893.066406 * 100), 0.05) - << "incorrect value for pos[1], expected 599893.066406, is " - << last_msg_->pos[1]; - EXPECT_LT((last_msg_->pos[2] * 100 - -22373708.4961 * 100), 0.05) - << "incorrect value for pos[2], expected -22373708.4961, is " - << last_msg_->pos[2]; - EXPECT_LT((last_msg_->vel[0] * 100 - -1726.50623322 * 100), 0.05) - << "incorrect value for vel[0], expected -1726.50623322, is " - << last_msg_->vel[0]; - EXPECT_LT((last_msg_->vel[1] * 100 - -2542.61493683 * 100), 0.05) - << "incorrect value for vel[1], expected -2542.61493683, is " - << last_msg_->vel[1]; - EXPECT_LT((last_msg_->vel[2] * 100 - 869.817733765 * 100), 0.05) - << "incorrect value for vel[2], expected 869.817733765, is " - << last_msg_->vel[2]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgGloBiases.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgGloBiases.cc deleted file mode 100644 index 9a0b509a0d..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgGloBiases.cc +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgGloBiases.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgGloBiases0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgGloBiases0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_glo_biases_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_glo_biases_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgGloBiases0, Test) { - uint8_t encoded_frame[] = { - 85, 117, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 211, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_glo_biases_t *test_msg = (msg_glo_biases_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->l1ca_bias = 0; - test_msg->l1p_bias = 0; - test_msg->l2ca_bias = 0; - test_msg->l2p_bias = 0; - test_msg->mask = 0; - - EXPECT_EQ(send_message(0x75, 0, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 0); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asl1ca_bias)>( - reinterpret_cast(&last_msg_->l1ca_bias)), - 0) - << "incorrect value for l1ca_bias, expected 0, is " - << last_msg_->l1ca_bias; - EXPECT_EQ(get_asl1p_bias)>( - reinterpret_cast(&last_msg_->l1p_bias)), - 0) - << "incorrect value for l1p_bias, expected 0, is " << last_msg_->l1p_bias; - EXPECT_EQ(get_asl2ca_bias)>( - reinterpret_cast(&last_msg_->l2ca_bias)), - 0) - << "incorrect value for l2ca_bias, expected 0, is " - << last_msg_->l2ca_bias; - EXPECT_EQ(get_asl2p_bias)>( - reinterpret_cast(&last_msg_->l2p_bias)), - 0) - << "incorrect value for l2p_bias, expected 0, is " << last_msg_->l2p_bias; - EXPECT_EQ(get_asmask)>( - reinterpret_cast(&last_msg_->mask)), - 0) - << "incorrect value for mask, expected 0, is " << last_msg_->mask; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgGnssCapb.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgGnssCapb.cc deleted file mode 100644 index a3bb178091..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgGnssCapb.cc +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgGnssCapb.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgGnssCapb0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgGnssCapb0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gnss_capb_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gnss_capb_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgGnssCapb0, Test) { - uint8_t encoded_frame[] = { - 85, 150, 0, 123, 0, 110, 176, 207, 6, 0, 106, 8, 26, 171, 80, - 64, 0, 0, 0, 0, 81, 173, 144, 46, 0, 0, 0, 0, 209, 139, - 93, 108, 0, 0, 0, 0, 252, 204, 200, 0, 205, 92, 30, 49, 240, - 203, 21, 24, 212, 93, 182, 32, 0, 0, 0, 0, 105, 32, 192, 27, - 0, 0, 0, 0, 40, 75, 250, 114, 0, 0, 0, 0, 119, 147, 123, - 81, 0, 0, 0, 0, 85, 89, 4, 2, 0, 0, 0, 0, 233, 116, - 137, 22, 0, 0, 0, 0, 199, 109, 219, 11, 221, 171, 248, 82, 0, - 0, 0, 0, 252, 62, 221, 28, 0, 0, 0, 0, 163, 90, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gnss_capb_t *test_msg = (msg_gnss_capb_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->gc.bds_active = 1929005864; - test_msg->gc.bds_b2 = 33839445; - test_msg->gc.bds_b2a = 378107113; - test_msg->gc.bds_d2nav = 1367053175; - test_msg->gc.gal_active = 1392028637; - test_msg->gc.gal_e5 = 484261628; - test_msg->gc.glo_active = 13159676; - test_msg->gc.glo_l2of = 824073421; - test_msg->gc.glo_l3 = 404081648; - test_msg->gc.gps_active = 1079028506; - test_msg->gc.gps_l2c = 781233489; - test_msg->gc.gps_l5 = 1818069969; - test_msg->gc.qzss_active = 198929863; - test_msg->gc.sbas_active = 548822484; - test_msg->gc.sbas_l5 = 465576041; - test_msg->t_nmct.tow = 446384; - test_msg->t_nmct.wn = 2154; - - EXPECT_EQ(send_message(0x96, 123, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 123); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asgc.bds_active)>( - reinterpret_cast(&last_msg_->gc.bds_active)), - 1929005864) - << "incorrect value for gc.bds_active, expected 1929005864, is " - << last_msg_->gc.bds_active; - EXPECT_EQ(get_asgc.bds_b2)>( - reinterpret_cast(&last_msg_->gc.bds_b2)), - 33839445) - << "incorrect value for gc.bds_b2, expected 33839445, is " - << last_msg_->gc.bds_b2; - EXPECT_EQ(get_asgc.bds_b2a)>( - reinterpret_cast(&last_msg_->gc.bds_b2a)), - 378107113) - << "incorrect value for gc.bds_b2a, expected 378107113, is " - << last_msg_->gc.bds_b2a; - EXPECT_EQ(get_asgc.bds_d2nav)>( - reinterpret_cast(&last_msg_->gc.bds_d2nav)), - 1367053175) - << "incorrect value for gc.bds_d2nav, expected 1367053175, is " - << last_msg_->gc.bds_d2nav; - EXPECT_EQ(get_asgc.gal_active)>( - reinterpret_cast(&last_msg_->gc.gal_active)), - 1392028637) - << "incorrect value for gc.gal_active, expected 1392028637, is " - << last_msg_->gc.gal_active; - EXPECT_EQ(get_asgc.gal_e5)>( - reinterpret_cast(&last_msg_->gc.gal_e5)), - 484261628) - << "incorrect value for gc.gal_e5, expected 484261628, is " - << last_msg_->gc.gal_e5; - EXPECT_EQ(get_asgc.glo_active)>( - reinterpret_cast(&last_msg_->gc.glo_active)), - 13159676) - << "incorrect value for gc.glo_active, expected 13159676, is " - << last_msg_->gc.glo_active; - EXPECT_EQ(get_asgc.glo_l2of)>( - reinterpret_cast(&last_msg_->gc.glo_l2of)), - 824073421) - << "incorrect value for gc.glo_l2of, expected 824073421, is " - << last_msg_->gc.glo_l2of; - EXPECT_EQ(get_asgc.glo_l3)>( - reinterpret_cast(&last_msg_->gc.glo_l3)), - 404081648) - << "incorrect value for gc.glo_l3, expected 404081648, is " - << last_msg_->gc.glo_l3; - EXPECT_EQ(get_asgc.gps_active)>( - reinterpret_cast(&last_msg_->gc.gps_active)), - 1079028506) - << "incorrect value for gc.gps_active, expected 1079028506, is " - << last_msg_->gc.gps_active; - EXPECT_EQ(get_asgc.gps_l2c)>( - reinterpret_cast(&last_msg_->gc.gps_l2c)), - 781233489) - << "incorrect value for gc.gps_l2c, expected 781233489, is " - << last_msg_->gc.gps_l2c; - EXPECT_EQ(get_asgc.gps_l5)>( - reinterpret_cast(&last_msg_->gc.gps_l5)), - 1818069969) - << "incorrect value for gc.gps_l5, expected 1818069969, is " - << last_msg_->gc.gps_l5; - EXPECT_EQ(get_asgc.qzss_active)>( - reinterpret_cast(&last_msg_->gc.qzss_active)), - 198929863) - << "incorrect value for gc.qzss_active, expected 198929863, is " - << last_msg_->gc.qzss_active; - EXPECT_EQ(get_asgc.sbas_active)>( - reinterpret_cast(&last_msg_->gc.sbas_active)), - 548822484) - << "incorrect value for gc.sbas_active, expected 548822484, is " - << last_msg_->gc.sbas_active; - EXPECT_EQ(get_asgc.sbas_l5)>( - reinterpret_cast(&last_msg_->gc.sbas_l5)), - 465576041) - << "incorrect value for gc.sbas_l5, expected 465576041, is " - << last_msg_->gc.sbas_l5; - EXPECT_EQ(get_ast_nmct.tow)>( - reinterpret_cast(&last_msg_->t_nmct.tow)), - 446384) - << "incorrect value for t_nmct.tow, expected 446384, is " - << last_msg_->t_nmct.tow; - EXPECT_EQ(get_ast_nmct.wn)>( - reinterpret_cast(&last_msg_->t_nmct.wn)), - 2154) - << "incorrect value for t_nmct.wn, expected 2154, is " - << last_msg_->t_nmct.wn; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgGroupDelay.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgGroupDelay.cc deleted file mode 100644 index 92f4abbade..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgGroupDelay.cc +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgGroupDelay.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgGroupDelay0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgGroupDelay0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_group_delay_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_group_delay_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgGroupDelay0, Test) { - uint8_t encoded_frame[] = { - 85, 148, 0, 123, 0, 15, 176, 207, 6, 0, 106, 8, - 22, 0, 1, 254, 253, 165, 255, 237, 23, 2, 201, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_group_delay_t *test_msg = (msg_group_delay_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->isc_l1ca = -91; - test_msg->isc_l2c = 6125; - test_msg->sid.code = 0; - test_msg->sid.sat = 22; - test_msg->t_op.tow = 446384; - test_msg->t_op.wn = 2154; - test_msg->tgd = -514; - test_msg->valid = 1; - - EXPECT_EQ(send_message(0x94, 123, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 123); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asisc_l1ca)>( - reinterpret_cast(&last_msg_->isc_l1ca)), - -91) - << "incorrect value for isc_l1ca, expected -91, is " - << last_msg_->isc_l1ca; - EXPECT_EQ(get_asisc_l2c)>( - reinterpret_cast(&last_msg_->isc_l2c)), - 6125) - << "incorrect value for isc_l2c, expected 6125, is " - << last_msg_->isc_l2c; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 22) - << "incorrect value for sid.sat, expected 22, is " << last_msg_->sid.sat; - EXPECT_EQ(get_ast_op.tow)>( - reinterpret_cast(&last_msg_->t_op.tow)), - 446384) - << "incorrect value for t_op.tow, expected 446384, is " - << last_msg_->t_op.tow; - EXPECT_EQ(get_ast_op.wn)>( - reinterpret_cast(&last_msg_->t_op.wn)), - 2154) - << "incorrect value for t_op.wn, expected 2154, is " - << last_msg_->t_op.wn; - EXPECT_EQ(get_astgd)>( - reinterpret_cast(&last_msg_->tgd)), - -514) - << "incorrect value for tgd, expected -514, is " << last_msg_->tgd; - EXPECT_EQ(get_asvalid)>( - reinterpret_cast(&last_msg_->valid)), - 1) - << "incorrect value for valid, expected 1, is " << last_msg_->valid; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgGroupDelayDepA.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgGroupDelayDepA.cc deleted file mode 100644 index a94904b067..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgGroupDelayDepA.cc +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgGroupDelayDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgGroupDelayDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgGroupDelayDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_group_delay_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_group_delay_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgGroupDelayDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 146, 0, 123, 0, 14, 176, 207, 6, 0, 106, - 8, 22, 1, 254, 253, 165, 255, 237, 23, 162, 91, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_group_delay_dep_a_t *test_msg = - (msg_group_delay_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->isc_l1ca = -91; - test_msg->isc_l2c = 6125; - test_msg->prn = 22; - test_msg->t_op.tow = 446384; - test_msg->t_op.wn = 2154; - test_msg->tgd = -514; - test_msg->valid = 1; - - EXPECT_EQ(send_message(0x92, 123, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 123); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asisc_l1ca)>( - reinterpret_cast(&last_msg_->isc_l1ca)), - -91) - << "incorrect value for isc_l1ca, expected -91, is " - << last_msg_->isc_l1ca; - EXPECT_EQ(get_asisc_l2c)>( - reinterpret_cast(&last_msg_->isc_l2c)), - 6125) - << "incorrect value for isc_l2c, expected 6125, is " - << last_msg_->isc_l2c; - EXPECT_EQ(get_asprn)>( - reinterpret_cast(&last_msg_->prn)), - 22) - << "incorrect value for prn, expected 22, is " << last_msg_->prn; - EXPECT_EQ(get_ast_op.tow)>( - reinterpret_cast(&last_msg_->t_op.tow)), - 446384) - << "incorrect value for t_op.tow, expected 446384, is " - << last_msg_->t_op.tow; - EXPECT_EQ(get_ast_op.wn)>( - reinterpret_cast(&last_msg_->t_op.wn)), - 2154) - << "incorrect value for t_op.wn, expected 2154, is " - << last_msg_->t_op.wn; - EXPECT_EQ(get_astgd)>( - reinterpret_cast(&last_msg_->tgd)), - -514) - << "incorrect value for tgd, expected -514, is " << last_msg_->tgd; - EXPECT_EQ(get_asvalid)>( - reinterpret_cast(&last_msg_->valid)), - 1) - << "incorrect value for valid, expected 1, is " << last_msg_->valid; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgGroupDelayDepB.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgGroupDelayDepB.cc deleted file mode 100644 index 0e32e590bb..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgGroupDelayDepB.cc +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgGroupDelayDepB.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgGroupDelayDepB0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgGroupDelayDepB0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_group_delay_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_group_delay_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgGroupDelayDepB0, Test) { - uint8_t encoded_frame[] = { - 85, 147, 0, 123, 0, 17, 176, 207, 6, 0, 106, 8, 22, - 0, 0, 0, 1, 254, 253, 165, 255, 237, 23, 221, 202, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_group_delay_dep_b_t *test_msg = - (msg_group_delay_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->isc_l1ca = -91; - test_msg->isc_l2c = 6125; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 22; - test_msg->t_op.tow = 446384; - test_msg->t_op.wn = 2154; - test_msg->tgd = -514; - test_msg->valid = 1; - - EXPECT_EQ(send_message(0x93, 123, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 123); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asisc_l1ca)>( - reinterpret_cast(&last_msg_->isc_l1ca)), - -91) - << "incorrect value for isc_l1ca, expected -91, is " - << last_msg_->isc_l1ca; - EXPECT_EQ(get_asisc_l2c)>( - reinterpret_cast(&last_msg_->isc_l2c)), - 6125) - << "incorrect value for isc_l2c, expected 6125, is " - << last_msg_->isc_l2c; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 22) - << "incorrect value for sid.sat, expected 22, is " << last_msg_->sid.sat; - EXPECT_EQ(get_ast_op.tow)>( - reinterpret_cast(&last_msg_->t_op.tow)), - 446384) - << "incorrect value for t_op.tow, expected 446384, is " - << last_msg_->t_op.tow; - EXPECT_EQ(get_ast_op.wn)>( - reinterpret_cast(&last_msg_->t_op.wn)), - 2154) - << "incorrect value for t_op.wn, expected 2154, is " - << last_msg_->t_op.wn; - EXPECT_EQ(get_astgd)>( - reinterpret_cast(&last_msg_->tgd)), - -514) - << "incorrect value for tgd, expected -514, is " << last_msg_->tgd; - EXPECT_EQ(get_asvalid)>( - reinterpret_cast(&last_msg_->valid)), - 1) - << "incorrect value for valid, expected 1, is " << last_msg_->valid; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgIono.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgIono.cc deleted file mode 100644 index f6d8739ddd..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgIono.cc +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgIono.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgIono0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgIono0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_iono_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_iono_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgIono0, Test) { - uint8_t encoded_frame[] = { - 85, 144, 0, 123, 0, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 52, 62, 0, 0, 0, 0, 0, 0, 80, 62, 0, 0, 0, 0, - 0, 0, 112, 190, 0, 0, 0, 0, 0, 0, 112, 190, 0, 0, 0, 0, - 0, 0, 243, 64, 0, 0, 0, 0, 0, 0, 232, 64, 0, 0, 0, 0, - 0, 0, 240, 192, 0, 0, 0, 0, 0, 0, 20, 193, 101, 31, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_iono_t *test_msg = (msg_iono_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->a0 = 4.6566128730773926e-09; - test_msg->a1 = 1.4901161193847656e-08; - test_msg->a2 = -5.960464477539063e-08; - test_msg->a3 = -5.960464477539063e-08; - test_msg->b0 = 77824.0; - test_msg->b1 = 49152.0; - test_msg->b2 = -65536.0; - test_msg->b3 = -327680.0; - test_msg->t_nmct.tow = 0; - test_msg->t_nmct.wn = 0; - - EXPECT_EQ(send_message(0x90, 123, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 123); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->a0 * 100 - 4.65661287308e-09 * 100), 0.05) - << "incorrect value for a0, expected 4.65661287308e-09, is " - << last_msg_->a0; - EXPECT_LT((last_msg_->a1 * 100 - 1.49011611938e-08 * 100), 0.05) - << "incorrect value for a1, expected 1.49011611938e-08, is " - << last_msg_->a1; - EXPECT_LT((last_msg_->a2 * 100 - -5.96046447754e-08 * 100), 0.05) - << "incorrect value for a2, expected -5.96046447754e-08, is " - << last_msg_->a2; - EXPECT_LT((last_msg_->a3 * 100 - -5.96046447754e-08 * 100), 0.05) - << "incorrect value for a3, expected -5.96046447754e-08, is " - << last_msg_->a3; - EXPECT_LT((last_msg_->b0 * 100 - 77824.0 * 100), 0.05) - << "incorrect value for b0, expected 77824.0, is " << last_msg_->b0; - EXPECT_LT((last_msg_->b1 * 100 - 49152.0 * 100), 0.05) - << "incorrect value for b1, expected 49152.0, is " << last_msg_->b1; - EXPECT_LT((last_msg_->b2 * 100 - -65536.0 * 100), 0.05) - << "incorrect value for b2, expected -65536.0, is " << last_msg_->b2; - EXPECT_LT((last_msg_->b3 * 100 - -327680.0 * 100), 0.05) - << "incorrect value for b3, expected -327680.0, is " << last_msg_->b3; - EXPECT_EQ(get_ast_nmct.tow)>( - reinterpret_cast(&last_msg_->t_nmct.tow)), - 0) - << "incorrect value for t_nmct.tow, expected 0, is " - << last_msg_->t_nmct.tow; - EXPECT_EQ(get_ast_nmct.wn)>( - reinterpret_cast(&last_msg_->t_nmct.wn)), - 0) - << "incorrect value for t_nmct.wn, expected 0, is " - << last_msg_->t_nmct.wn; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgObs.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgObs.cc deleted file mode 100644 index f3bfb946b8..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgObs.cc +++ /dev/null @@ -1,1168 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgObs.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgObs0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgObs0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgObs0, Test) { - uint8_t encoded_frame[] = { - 85, 74, 0, 129, 240, 249, 152, 202, 226, 25, 0, 0, 0, 0, 106, - 8, 32, 49, 227, 254, 62, 121, 242, 158, 6, 146, 0, 250, 172, 182, - 10, 15, 10, 0, 30, 228, 254, 62, 12, 189, 40, 5, 59, 83, 251, - 172, 178, 10, 15, 10, 1, 215, 205, 144, 72, 106, 111, 160, 7, 243, - 109, 243, 119, 158, 10, 15, 18, 0, 25, 207, 144, 72, 223, 96, 241, - 5, 12, 52, 246, 27, 125, 9, 11, 18, 1, 34, 184, 223, 74, 150, - 138, 222, 7, 53, 13, 11, 245, 114, 9, 15, 22, 0, 113, 80, 6, - 69, 162, 41, 65, 7, 70, 127, 246, 246, 189, 9, 15, 23, 0, 247, - 80, 6, 69, 213, 35, 167, 5, 221, 152, 248, 231, 158, 9, 11, 23, - 1, 8, 146, 166, 64, 12, 122, 203, 6, 114, 51, 248, 67, 93, 3, - 11, 27, 0, 221, 172, 173, 75, 217, 47, 244, 7, 232, 225, 11, 237, - 123, 5, 15, 31, 0, 250, 174, 173, 75, 216, 163, 50, 6, 40, 70, - 9, 62, 120, 3, 11, 31, 1, 135, 16, 6, 66, 99, 218, 11, 7, - 7, 138, 242, 96, 176, 10, 15, 2, 3, 148, 130, 6, 58, 217, 88, - 54, 6, 203, 21, 252, 96, 170, 10, 15, 3, 3, 186, 108, 197, 63, - 127, 54, 211, 6, 80, 4, 241, 219, 200, 10, 15, 17, 3, 167, 195, - 8, 57, 19, 204, 22, 6, 105, 51, 254, 182, 152, 10, 15, 18, 3, - 237, 248, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_t *test_msg = (msg_obs_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.ns_residual = 0; - test_msg->header.t.tow = 434293400; - test_msg->header.t.wn = 2154; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].D.f = 172; - test_msg->obs[0].D.i = -1536; - test_msg->obs[0].L.f = 146; - test_msg->obs[0].L.i = 111080057; - test_msg->obs[0].P = 1056891697; - test_msg->obs[0].cn0 = 182; - test_msg->obs[0].flags = 15; - test_msg->obs[0].lock = 10; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.sat = 10; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[1].D.f = 172; - test_msg->obs[1].D.i = -1197; - test_msg->obs[1].L.f = 59; - test_msg->obs[1].L.i = 86555916; - test_msg->obs[1].P = 1056891934; - test_msg->obs[1].cn0 = 178; - test_msg->obs[1].flags = 15; - test_msg->obs[1].lock = 10; - test_msg->obs[1].sid.code = 1; - test_msg->obs[1].sid.sat = 10; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[2].D.f = 119; - test_msg->obs[2].D.i = -3219; - test_msg->obs[2].L.f = 243; - test_msg->obs[2].L.i = 127954794; - test_msg->obs[2].P = 1217449431; - test_msg->obs[2].cn0 = 158; - test_msg->obs[2].flags = 15; - test_msg->obs[2].lock = 10; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.sat = 18; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[3].D.f = 27; - test_msg->obs[3].D.i = -2508; - test_msg->obs[3].L.f = 12; - test_msg->obs[3].L.i = 99705055; - test_msg->obs[3].P = 1217449753; - test_msg->obs[3].cn0 = 125; - test_msg->obs[3].flags = 11; - test_msg->obs[3].lock = 9; - test_msg->obs[3].sid.code = 1; - test_msg->obs[3].sid.sat = 18; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[4].D.f = 245; - test_msg->obs[4].D.i = 2829; - test_msg->obs[4].L.f = 53; - test_msg->obs[4].L.i = 132024982; - test_msg->obs[4].P = 1256175650; - test_msg->obs[4].cn0 = 114; - test_msg->obs[4].flags = 15; - test_msg->obs[4].lock = 9; - test_msg->obs[4].sid.code = 0; - test_msg->obs[4].sid.sat = 22; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[5].D.f = 246; - test_msg->obs[5].D.i = -2433; - test_msg->obs[5].L.f = 70; - test_msg->obs[5].L.i = 121711010; - test_msg->obs[5].P = 1158041713; - test_msg->obs[5].cn0 = 189; - test_msg->obs[5].flags = 15; - test_msg->obs[5].lock = 9; - test_msg->obs[5].sid.code = 0; - test_msg->obs[5].sid.sat = 23; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[6].D.f = 231; - test_msg->obs[6].D.i = -1896; - test_msg->obs[6].L.f = 221; - test_msg->obs[6].L.i = 94839765; - test_msg->obs[6].P = 1158041847; - test_msg->obs[6].cn0 = 158; - test_msg->obs[6].flags = 11; - test_msg->obs[6].lock = 9; - test_msg->obs[6].sid.code = 1; - test_msg->obs[6].sid.sat = 23; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[7].D.f = 67; - test_msg->obs[7].D.i = -1997; - test_msg->obs[7].L.f = 114; - test_msg->obs[7].L.i = 113998348; - test_msg->obs[7].P = 1084658184; - test_msg->obs[7].cn0 = 93; - test_msg->obs[7].flags = 11; - test_msg->obs[7].lock = 3; - test_msg->obs[7].sid.code = 0; - test_msg->obs[7].sid.sat = 27; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[8].D.f = 237; - test_msg->obs[8].D.i = 3041; - test_msg->obs[8].L.f = 232; - test_msg->obs[8].L.i = 133443545; - test_msg->obs[8].P = 1269673181; - test_msg->obs[8].cn0 = 123; - test_msg->obs[8].flags = 15; - test_msg->obs[8].lock = 5; - test_msg->obs[8].sid.code = 0; - test_msg->obs[8].sid.sat = 31; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[9].D.f = 62; - test_msg->obs[9].D.i = 2374; - test_msg->obs[9].L.f = 40; - test_msg->obs[9].L.i = 103982040; - test_msg->obs[9].P = 1269673722; - test_msg->obs[9].cn0 = 120; - test_msg->obs[9].flags = 11; - test_msg->obs[9].lock = 3; - test_msg->obs[9].sid.code = 1; - test_msg->obs[9].sid.sat = 31; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[10].D.f = 96; - test_msg->obs[10].D.i = -3446; - test_msg->obs[10].L.f = 7; - test_msg->obs[10].L.i = 118217315; - test_msg->obs[10].P = 1107693703; - test_msg->obs[10].cn0 = 176; - test_msg->obs[10].flags = 15; - test_msg->obs[10].lock = 10; - test_msg->obs[10].sid.code = 3; - test_msg->obs[10].sid.sat = 2; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[11].D.f = 96; - test_msg->obs[11].D.i = -1003; - test_msg->obs[11].L.f = 203; - test_msg->obs[11].L.i = 104224985; - test_msg->obs[11].P = 973505172; - test_msg->obs[11].cn0 = 170; - test_msg->obs[11].flags = 15; - test_msg->obs[11].lock = 10; - test_msg->obs[11].sid.code = 3; - test_msg->obs[11].sid.sat = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[12].D.f = 219; - test_msg->obs[12].D.i = -3836; - test_msg->obs[12].L.f = 80; - test_msg->obs[12].L.i = 114505343; - test_msg->obs[12].P = 1069903034; - test_msg->obs[12].cn0 = 200; - test_msg->obs[12].flags = 15; - test_msg->obs[12].lock = 10; - test_msg->obs[12].sid.code = 3; - test_msg->obs[12].sid.sat = 17; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[13].D.f = 182; - test_msg->obs[13].D.i = -461; - test_msg->obs[13].L.f = 105; - test_msg->obs[13].L.i = 102157331; - test_msg->obs[13].P = 956875687; - test_msg->obs[13].cn0 = 152; - test_msg->obs[13].flags = 15; - test_msg->obs[13].lock = 10; - test_msg->obs[13].sid.code = 3; - test_msg->obs[13].sid.sat = 18; - - EXPECT_EQ(send_message(0x4a, 61569, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 61569); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 32) - << "incorrect value for header.n_obs, expected 32, is " - << last_msg_->header.n_obs; - EXPECT_EQ( - get_asheader.t.ns_residual)>( - reinterpret_cast(&last_msg_->header.t.ns_residual)), - 0) - << "incorrect value for header.t.ns_residual, expected 0, is " - << last_msg_->header.t.ns_residual; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 434293400) - << "incorrect value for header.t.tow, expected 434293400, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 2154) - << "incorrect value for header.t.wn, expected 2154, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].D.f)>( - reinterpret_cast(&last_msg_->obs[0].D.f)), - 172) - << "incorrect value for obs[0].D.f, expected 172, is " - << last_msg_->obs[0].D.f; - EXPECT_EQ(get_asobs[0].D.i)>( - reinterpret_cast(&last_msg_->obs[0].D.i)), - -1536) - << "incorrect value for obs[0].D.i, expected -1536, is " - << last_msg_->obs[0].D.i; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 146) - << "incorrect value for obs[0].L.f, expected 146, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - 111080057) - << "incorrect value for obs[0].L.i, expected 111080057, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 1056891697) - << "incorrect value for obs[0].P, expected 1056891697, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].cn0)>( - reinterpret_cast(&last_msg_->obs[0].cn0)), - 182) - << "incorrect value for obs[0].cn0, expected 182, is " - << last_msg_->obs[0].cn0; - EXPECT_EQ(get_asobs[0].flags)>( - reinterpret_cast(&last_msg_->obs[0].flags)), - 15) - << "incorrect value for obs[0].flags, expected 15, is " - << last_msg_->obs[0].flags; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 10) - << "incorrect value for obs[0].lock, expected 10, is " - << last_msg_->obs[0].lock; - EXPECT_EQ(get_asobs[0].sid.code)>( - reinterpret_cast(&last_msg_->obs[0].sid.code)), - 0) - << "incorrect value for obs[0].sid.code, expected 0, is " - << last_msg_->obs[0].sid.code; - EXPECT_EQ(get_asobs[0].sid.sat)>( - reinterpret_cast(&last_msg_->obs[0].sid.sat)), - 10) - << "incorrect value for obs[0].sid.sat, expected 10, is " - << last_msg_->obs[0].sid.sat; - EXPECT_EQ(get_asobs[1].D.f)>( - reinterpret_cast(&last_msg_->obs[1].D.f)), - 172) - << "incorrect value for obs[1].D.f, expected 172, is " - << last_msg_->obs[1].D.f; - EXPECT_EQ(get_asobs[1].D.i)>( - reinterpret_cast(&last_msg_->obs[1].D.i)), - -1197) - << "incorrect value for obs[1].D.i, expected -1197, is " - << last_msg_->obs[1].D.i; - EXPECT_EQ(get_asobs[1].L.f)>( - reinterpret_cast(&last_msg_->obs[1].L.f)), - 59) - << "incorrect value for obs[1].L.f, expected 59, is " - << last_msg_->obs[1].L.f; - EXPECT_EQ(get_asobs[1].L.i)>( - reinterpret_cast(&last_msg_->obs[1].L.i)), - 86555916) - << "incorrect value for obs[1].L.i, expected 86555916, is " - << last_msg_->obs[1].L.i; - EXPECT_EQ(get_asobs[1].P)>( - reinterpret_cast(&last_msg_->obs[1].P)), - 1056891934) - << "incorrect value for obs[1].P, expected 1056891934, is " - << last_msg_->obs[1].P; - EXPECT_EQ(get_asobs[1].cn0)>( - reinterpret_cast(&last_msg_->obs[1].cn0)), - 178) - << "incorrect value for obs[1].cn0, expected 178, is " - << last_msg_->obs[1].cn0; - EXPECT_EQ(get_asobs[1].flags)>( - reinterpret_cast(&last_msg_->obs[1].flags)), - 15) - << "incorrect value for obs[1].flags, expected 15, is " - << last_msg_->obs[1].flags; - EXPECT_EQ(get_asobs[1].lock)>( - reinterpret_cast(&last_msg_->obs[1].lock)), - 10) - << "incorrect value for obs[1].lock, expected 10, is " - << last_msg_->obs[1].lock; - EXPECT_EQ(get_asobs[1].sid.code)>( - reinterpret_cast(&last_msg_->obs[1].sid.code)), - 1) - << "incorrect value for obs[1].sid.code, expected 1, is " - << last_msg_->obs[1].sid.code; - EXPECT_EQ(get_asobs[1].sid.sat)>( - reinterpret_cast(&last_msg_->obs[1].sid.sat)), - 10) - << "incorrect value for obs[1].sid.sat, expected 10, is " - << last_msg_->obs[1].sid.sat; - EXPECT_EQ(get_asobs[2].D.f)>( - reinterpret_cast(&last_msg_->obs[2].D.f)), - 119) - << "incorrect value for obs[2].D.f, expected 119, is " - << last_msg_->obs[2].D.f; - EXPECT_EQ(get_asobs[2].D.i)>( - reinterpret_cast(&last_msg_->obs[2].D.i)), - -3219) - << "incorrect value for obs[2].D.i, expected -3219, is " - << last_msg_->obs[2].D.i; - EXPECT_EQ(get_asobs[2].L.f)>( - reinterpret_cast(&last_msg_->obs[2].L.f)), - 243) - << "incorrect value for obs[2].L.f, expected 243, is " - << last_msg_->obs[2].L.f; - EXPECT_EQ(get_asobs[2].L.i)>( - reinterpret_cast(&last_msg_->obs[2].L.i)), - 127954794) - << "incorrect value for obs[2].L.i, expected 127954794, is " - << last_msg_->obs[2].L.i; - EXPECT_EQ(get_asobs[2].P)>( - reinterpret_cast(&last_msg_->obs[2].P)), - 1217449431) - << "incorrect value for obs[2].P, expected 1217449431, is " - << last_msg_->obs[2].P; - EXPECT_EQ(get_asobs[2].cn0)>( - reinterpret_cast(&last_msg_->obs[2].cn0)), - 158) - << "incorrect value for obs[2].cn0, expected 158, is " - << last_msg_->obs[2].cn0; - EXPECT_EQ(get_asobs[2].flags)>( - reinterpret_cast(&last_msg_->obs[2].flags)), - 15) - << "incorrect value for obs[2].flags, expected 15, is " - << last_msg_->obs[2].flags; - EXPECT_EQ(get_asobs[2].lock)>( - reinterpret_cast(&last_msg_->obs[2].lock)), - 10) - << "incorrect value for obs[2].lock, expected 10, is " - << last_msg_->obs[2].lock; - EXPECT_EQ(get_asobs[2].sid.code)>( - reinterpret_cast(&last_msg_->obs[2].sid.code)), - 0) - << "incorrect value for obs[2].sid.code, expected 0, is " - << last_msg_->obs[2].sid.code; - EXPECT_EQ(get_asobs[2].sid.sat)>( - reinterpret_cast(&last_msg_->obs[2].sid.sat)), - 18) - << "incorrect value for obs[2].sid.sat, expected 18, is " - << last_msg_->obs[2].sid.sat; - EXPECT_EQ(get_asobs[3].D.f)>( - reinterpret_cast(&last_msg_->obs[3].D.f)), - 27) - << "incorrect value for obs[3].D.f, expected 27, is " - << last_msg_->obs[3].D.f; - EXPECT_EQ(get_asobs[3].D.i)>( - reinterpret_cast(&last_msg_->obs[3].D.i)), - -2508) - << "incorrect value for obs[3].D.i, expected -2508, is " - << last_msg_->obs[3].D.i; - EXPECT_EQ(get_asobs[3].L.f)>( - reinterpret_cast(&last_msg_->obs[3].L.f)), - 12) - << "incorrect value for obs[3].L.f, expected 12, is " - << last_msg_->obs[3].L.f; - EXPECT_EQ(get_asobs[3].L.i)>( - reinterpret_cast(&last_msg_->obs[3].L.i)), - 99705055) - << "incorrect value for obs[3].L.i, expected 99705055, is " - << last_msg_->obs[3].L.i; - EXPECT_EQ(get_asobs[3].P)>( - reinterpret_cast(&last_msg_->obs[3].P)), - 1217449753) - << "incorrect value for obs[3].P, expected 1217449753, is " - << last_msg_->obs[3].P; - EXPECT_EQ(get_asobs[3].cn0)>( - reinterpret_cast(&last_msg_->obs[3].cn0)), - 125) - << "incorrect value for obs[3].cn0, expected 125, is " - << last_msg_->obs[3].cn0; - EXPECT_EQ(get_asobs[3].flags)>( - reinterpret_cast(&last_msg_->obs[3].flags)), - 11) - << "incorrect value for obs[3].flags, expected 11, is " - << last_msg_->obs[3].flags; - EXPECT_EQ(get_asobs[3].lock)>( - reinterpret_cast(&last_msg_->obs[3].lock)), - 9) - << "incorrect value for obs[3].lock, expected 9, is " - << last_msg_->obs[3].lock; - EXPECT_EQ(get_asobs[3].sid.code)>( - reinterpret_cast(&last_msg_->obs[3].sid.code)), - 1) - << "incorrect value for obs[3].sid.code, expected 1, is " - << last_msg_->obs[3].sid.code; - EXPECT_EQ(get_asobs[3].sid.sat)>( - reinterpret_cast(&last_msg_->obs[3].sid.sat)), - 18) - << "incorrect value for obs[3].sid.sat, expected 18, is " - << last_msg_->obs[3].sid.sat; - EXPECT_EQ(get_asobs[4].D.f)>( - reinterpret_cast(&last_msg_->obs[4].D.f)), - 245) - << "incorrect value for obs[4].D.f, expected 245, is " - << last_msg_->obs[4].D.f; - EXPECT_EQ(get_asobs[4].D.i)>( - reinterpret_cast(&last_msg_->obs[4].D.i)), - 2829) - << "incorrect value for obs[4].D.i, expected 2829, is " - << last_msg_->obs[4].D.i; - EXPECT_EQ(get_asobs[4].L.f)>( - reinterpret_cast(&last_msg_->obs[4].L.f)), - 53) - << "incorrect value for obs[4].L.f, expected 53, is " - << last_msg_->obs[4].L.f; - EXPECT_EQ(get_asobs[4].L.i)>( - reinterpret_cast(&last_msg_->obs[4].L.i)), - 132024982) - << "incorrect value for obs[4].L.i, expected 132024982, is " - << last_msg_->obs[4].L.i; - EXPECT_EQ(get_asobs[4].P)>( - reinterpret_cast(&last_msg_->obs[4].P)), - 1256175650) - << "incorrect value for obs[4].P, expected 1256175650, is " - << last_msg_->obs[4].P; - EXPECT_EQ(get_asobs[4].cn0)>( - reinterpret_cast(&last_msg_->obs[4].cn0)), - 114) - << "incorrect value for obs[4].cn0, expected 114, is " - << last_msg_->obs[4].cn0; - EXPECT_EQ(get_asobs[4].flags)>( - reinterpret_cast(&last_msg_->obs[4].flags)), - 15) - << "incorrect value for obs[4].flags, expected 15, is " - << last_msg_->obs[4].flags; - EXPECT_EQ(get_asobs[4].lock)>( - reinterpret_cast(&last_msg_->obs[4].lock)), - 9) - << "incorrect value for obs[4].lock, expected 9, is " - << last_msg_->obs[4].lock; - EXPECT_EQ(get_asobs[4].sid.code)>( - reinterpret_cast(&last_msg_->obs[4].sid.code)), - 0) - << "incorrect value for obs[4].sid.code, expected 0, is " - << last_msg_->obs[4].sid.code; - EXPECT_EQ(get_asobs[4].sid.sat)>( - reinterpret_cast(&last_msg_->obs[4].sid.sat)), - 22) - << "incorrect value for obs[4].sid.sat, expected 22, is " - << last_msg_->obs[4].sid.sat; - EXPECT_EQ(get_asobs[5].D.f)>( - reinterpret_cast(&last_msg_->obs[5].D.f)), - 246) - << "incorrect value for obs[5].D.f, expected 246, is " - << last_msg_->obs[5].D.f; - EXPECT_EQ(get_asobs[5].D.i)>( - reinterpret_cast(&last_msg_->obs[5].D.i)), - -2433) - << "incorrect value for obs[5].D.i, expected -2433, is " - << last_msg_->obs[5].D.i; - EXPECT_EQ(get_asobs[5].L.f)>( - reinterpret_cast(&last_msg_->obs[5].L.f)), - 70) - << "incorrect value for obs[5].L.f, expected 70, is " - << last_msg_->obs[5].L.f; - EXPECT_EQ(get_asobs[5].L.i)>( - reinterpret_cast(&last_msg_->obs[5].L.i)), - 121711010) - << "incorrect value for obs[5].L.i, expected 121711010, is " - << last_msg_->obs[5].L.i; - EXPECT_EQ(get_asobs[5].P)>( - reinterpret_cast(&last_msg_->obs[5].P)), - 1158041713) - << "incorrect value for obs[5].P, expected 1158041713, is " - << last_msg_->obs[5].P; - EXPECT_EQ(get_asobs[5].cn0)>( - reinterpret_cast(&last_msg_->obs[5].cn0)), - 189) - << "incorrect value for obs[5].cn0, expected 189, is " - << last_msg_->obs[5].cn0; - EXPECT_EQ(get_asobs[5].flags)>( - reinterpret_cast(&last_msg_->obs[5].flags)), - 15) - << "incorrect value for obs[5].flags, expected 15, is " - << last_msg_->obs[5].flags; - EXPECT_EQ(get_asobs[5].lock)>( - reinterpret_cast(&last_msg_->obs[5].lock)), - 9) - << "incorrect value for obs[5].lock, expected 9, is " - << last_msg_->obs[5].lock; - EXPECT_EQ(get_asobs[5].sid.code)>( - reinterpret_cast(&last_msg_->obs[5].sid.code)), - 0) - << "incorrect value for obs[5].sid.code, expected 0, is " - << last_msg_->obs[5].sid.code; - EXPECT_EQ(get_asobs[5].sid.sat)>( - reinterpret_cast(&last_msg_->obs[5].sid.sat)), - 23) - << "incorrect value for obs[5].sid.sat, expected 23, is " - << last_msg_->obs[5].sid.sat; - EXPECT_EQ(get_asobs[6].D.f)>( - reinterpret_cast(&last_msg_->obs[6].D.f)), - 231) - << "incorrect value for obs[6].D.f, expected 231, is " - << last_msg_->obs[6].D.f; - EXPECT_EQ(get_asobs[6].D.i)>( - reinterpret_cast(&last_msg_->obs[6].D.i)), - -1896) - << "incorrect value for obs[6].D.i, expected -1896, is " - << last_msg_->obs[6].D.i; - EXPECT_EQ(get_asobs[6].L.f)>( - reinterpret_cast(&last_msg_->obs[6].L.f)), - 221) - << "incorrect value for obs[6].L.f, expected 221, is " - << last_msg_->obs[6].L.f; - EXPECT_EQ(get_asobs[6].L.i)>( - reinterpret_cast(&last_msg_->obs[6].L.i)), - 94839765) - << "incorrect value for obs[6].L.i, expected 94839765, is " - << last_msg_->obs[6].L.i; - EXPECT_EQ(get_asobs[6].P)>( - reinterpret_cast(&last_msg_->obs[6].P)), - 1158041847) - << "incorrect value for obs[6].P, expected 1158041847, is " - << last_msg_->obs[6].P; - EXPECT_EQ(get_asobs[6].cn0)>( - reinterpret_cast(&last_msg_->obs[6].cn0)), - 158) - << "incorrect value for obs[6].cn0, expected 158, is " - << last_msg_->obs[6].cn0; - EXPECT_EQ(get_asobs[6].flags)>( - reinterpret_cast(&last_msg_->obs[6].flags)), - 11) - << "incorrect value for obs[6].flags, expected 11, is " - << last_msg_->obs[6].flags; - EXPECT_EQ(get_asobs[6].lock)>( - reinterpret_cast(&last_msg_->obs[6].lock)), - 9) - << "incorrect value for obs[6].lock, expected 9, is " - << last_msg_->obs[6].lock; - EXPECT_EQ(get_asobs[6].sid.code)>( - reinterpret_cast(&last_msg_->obs[6].sid.code)), - 1) - << "incorrect value for obs[6].sid.code, expected 1, is " - << last_msg_->obs[6].sid.code; - EXPECT_EQ(get_asobs[6].sid.sat)>( - reinterpret_cast(&last_msg_->obs[6].sid.sat)), - 23) - << "incorrect value for obs[6].sid.sat, expected 23, is " - << last_msg_->obs[6].sid.sat; - EXPECT_EQ(get_asobs[7].D.f)>( - reinterpret_cast(&last_msg_->obs[7].D.f)), - 67) - << "incorrect value for obs[7].D.f, expected 67, is " - << last_msg_->obs[7].D.f; - EXPECT_EQ(get_asobs[7].D.i)>( - reinterpret_cast(&last_msg_->obs[7].D.i)), - -1997) - << "incorrect value for obs[7].D.i, expected -1997, is " - << last_msg_->obs[7].D.i; - EXPECT_EQ(get_asobs[7].L.f)>( - reinterpret_cast(&last_msg_->obs[7].L.f)), - 114) - << "incorrect value for obs[7].L.f, expected 114, is " - << last_msg_->obs[7].L.f; - EXPECT_EQ(get_asobs[7].L.i)>( - reinterpret_cast(&last_msg_->obs[7].L.i)), - 113998348) - << "incorrect value for obs[7].L.i, expected 113998348, is " - << last_msg_->obs[7].L.i; - EXPECT_EQ(get_asobs[7].P)>( - reinterpret_cast(&last_msg_->obs[7].P)), - 1084658184) - << "incorrect value for obs[7].P, expected 1084658184, is " - << last_msg_->obs[7].P; - EXPECT_EQ(get_asobs[7].cn0)>( - reinterpret_cast(&last_msg_->obs[7].cn0)), - 93) - << "incorrect value for obs[7].cn0, expected 93, is " - << last_msg_->obs[7].cn0; - EXPECT_EQ(get_asobs[7].flags)>( - reinterpret_cast(&last_msg_->obs[7].flags)), - 11) - << "incorrect value for obs[7].flags, expected 11, is " - << last_msg_->obs[7].flags; - EXPECT_EQ(get_asobs[7].lock)>( - reinterpret_cast(&last_msg_->obs[7].lock)), - 3) - << "incorrect value for obs[7].lock, expected 3, is " - << last_msg_->obs[7].lock; - EXPECT_EQ(get_asobs[7].sid.code)>( - reinterpret_cast(&last_msg_->obs[7].sid.code)), - 0) - << "incorrect value for obs[7].sid.code, expected 0, is " - << last_msg_->obs[7].sid.code; - EXPECT_EQ(get_asobs[7].sid.sat)>( - reinterpret_cast(&last_msg_->obs[7].sid.sat)), - 27) - << "incorrect value for obs[7].sid.sat, expected 27, is " - << last_msg_->obs[7].sid.sat; - EXPECT_EQ(get_asobs[8].D.f)>( - reinterpret_cast(&last_msg_->obs[8].D.f)), - 237) - << "incorrect value for obs[8].D.f, expected 237, is " - << last_msg_->obs[8].D.f; - EXPECT_EQ(get_asobs[8].D.i)>( - reinterpret_cast(&last_msg_->obs[8].D.i)), - 3041) - << "incorrect value for obs[8].D.i, expected 3041, is " - << last_msg_->obs[8].D.i; - EXPECT_EQ(get_asobs[8].L.f)>( - reinterpret_cast(&last_msg_->obs[8].L.f)), - 232) - << "incorrect value for obs[8].L.f, expected 232, is " - << last_msg_->obs[8].L.f; - EXPECT_EQ(get_asobs[8].L.i)>( - reinterpret_cast(&last_msg_->obs[8].L.i)), - 133443545) - << "incorrect value for obs[8].L.i, expected 133443545, is " - << last_msg_->obs[8].L.i; - EXPECT_EQ(get_asobs[8].P)>( - reinterpret_cast(&last_msg_->obs[8].P)), - 1269673181) - << "incorrect value for obs[8].P, expected 1269673181, is " - << last_msg_->obs[8].P; - EXPECT_EQ(get_asobs[8].cn0)>( - reinterpret_cast(&last_msg_->obs[8].cn0)), - 123) - << "incorrect value for obs[8].cn0, expected 123, is " - << last_msg_->obs[8].cn0; - EXPECT_EQ(get_asobs[8].flags)>( - reinterpret_cast(&last_msg_->obs[8].flags)), - 15) - << "incorrect value for obs[8].flags, expected 15, is " - << last_msg_->obs[8].flags; - EXPECT_EQ(get_asobs[8].lock)>( - reinterpret_cast(&last_msg_->obs[8].lock)), - 5) - << "incorrect value for obs[8].lock, expected 5, is " - << last_msg_->obs[8].lock; - EXPECT_EQ(get_asobs[8].sid.code)>( - reinterpret_cast(&last_msg_->obs[8].sid.code)), - 0) - << "incorrect value for obs[8].sid.code, expected 0, is " - << last_msg_->obs[8].sid.code; - EXPECT_EQ(get_asobs[8].sid.sat)>( - reinterpret_cast(&last_msg_->obs[8].sid.sat)), - 31) - << "incorrect value for obs[8].sid.sat, expected 31, is " - << last_msg_->obs[8].sid.sat; - EXPECT_EQ(get_asobs[9].D.f)>( - reinterpret_cast(&last_msg_->obs[9].D.f)), - 62) - << "incorrect value for obs[9].D.f, expected 62, is " - << last_msg_->obs[9].D.f; - EXPECT_EQ(get_asobs[9].D.i)>( - reinterpret_cast(&last_msg_->obs[9].D.i)), - 2374) - << "incorrect value for obs[9].D.i, expected 2374, is " - << last_msg_->obs[9].D.i; - EXPECT_EQ(get_asobs[9].L.f)>( - reinterpret_cast(&last_msg_->obs[9].L.f)), - 40) - << "incorrect value for obs[9].L.f, expected 40, is " - << last_msg_->obs[9].L.f; - EXPECT_EQ(get_asobs[9].L.i)>( - reinterpret_cast(&last_msg_->obs[9].L.i)), - 103982040) - << "incorrect value for obs[9].L.i, expected 103982040, is " - << last_msg_->obs[9].L.i; - EXPECT_EQ(get_asobs[9].P)>( - reinterpret_cast(&last_msg_->obs[9].P)), - 1269673722) - << "incorrect value for obs[9].P, expected 1269673722, is " - << last_msg_->obs[9].P; - EXPECT_EQ(get_asobs[9].cn0)>( - reinterpret_cast(&last_msg_->obs[9].cn0)), - 120) - << "incorrect value for obs[9].cn0, expected 120, is " - << last_msg_->obs[9].cn0; - EXPECT_EQ(get_asobs[9].flags)>( - reinterpret_cast(&last_msg_->obs[9].flags)), - 11) - << "incorrect value for obs[9].flags, expected 11, is " - << last_msg_->obs[9].flags; - EXPECT_EQ(get_asobs[9].lock)>( - reinterpret_cast(&last_msg_->obs[9].lock)), - 3) - << "incorrect value for obs[9].lock, expected 3, is " - << last_msg_->obs[9].lock; - EXPECT_EQ(get_asobs[9].sid.code)>( - reinterpret_cast(&last_msg_->obs[9].sid.code)), - 1) - << "incorrect value for obs[9].sid.code, expected 1, is " - << last_msg_->obs[9].sid.code; - EXPECT_EQ(get_asobs[9].sid.sat)>( - reinterpret_cast(&last_msg_->obs[9].sid.sat)), - 31) - << "incorrect value for obs[9].sid.sat, expected 31, is " - << last_msg_->obs[9].sid.sat; - EXPECT_EQ(get_asobs[10].D.f)>( - reinterpret_cast(&last_msg_->obs[10].D.f)), - 96) - << "incorrect value for obs[10].D.f, expected 96, is " - << last_msg_->obs[10].D.f; - EXPECT_EQ(get_asobs[10].D.i)>( - reinterpret_cast(&last_msg_->obs[10].D.i)), - -3446) - << "incorrect value for obs[10].D.i, expected -3446, is " - << last_msg_->obs[10].D.i; - EXPECT_EQ(get_asobs[10].L.f)>( - reinterpret_cast(&last_msg_->obs[10].L.f)), - 7) - << "incorrect value for obs[10].L.f, expected 7, is " - << last_msg_->obs[10].L.f; - EXPECT_EQ(get_asobs[10].L.i)>( - reinterpret_cast(&last_msg_->obs[10].L.i)), - 118217315) - << "incorrect value for obs[10].L.i, expected 118217315, is " - << last_msg_->obs[10].L.i; - EXPECT_EQ(get_asobs[10].P)>( - reinterpret_cast(&last_msg_->obs[10].P)), - 1107693703) - << "incorrect value for obs[10].P, expected 1107693703, is " - << last_msg_->obs[10].P; - EXPECT_EQ(get_asobs[10].cn0)>( - reinterpret_cast(&last_msg_->obs[10].cn0)), - 176) - << "incorrect value for obs[10].cn0, expected 176, is " - << last_msg_->obs[10].cn0; - EXPECT_EQ(get_asobs[10].flags)>( - reinterpret_cast(&last_msg_->obs[10].flags)), - 15) - << "incorrect value for obs[10].flags, expected 15, is " - << last_msg_->obs[10].flags; - EXPECT_EQ(get_asobs[10].lock)>( - reinterpret_cast(&last_msg_->obs[10].lock)), - 10) - << "incorrect value for obs[10].lock, expected 10, is " - << last_msg_->obs[10].lock; - EXPECT_EQ( - get_asobs[10].sid.code)>( - reinterpret_cast(&last_msg_->obs[10].sid.code)), - 3) - << "incorrect value for obs[10].sid.code, expected 3, is " - << last_msg_->obs[10].sid.code; - EXPECT_EQ(get_asobs[10].sid.sat)>( - reinterpret_cast(&last_msg_->obs[10].sid.sat)), - 2) - << "incorrect value for obs[10].sid.sat, expected 2, is " - << last_msg_->obs[10].sid.sat; - EXPECT_EQ(get_asobs[11].D.f)>( - reinterpret_cast(&last_msg_->obs[11].D.f)), - 96) - << "incorrect value for obs[11].D.f, expected 96, is " - << last_msg_->obs[11].D.f; - EXPECT_EQ(get_asobs[11].D.i)>( - reinterpret_cast(&last_msg_->obs[11].D.i)), - -1003) - << "incorrect value for obs[11].D.i, expected -1003, is " - << last_msg_->obs[11].D.i; - EXPECT_EQ(get_asobs[11].L.f)>( - reinterpret_cast(&last_msg_->obs[11].L.f)), - 203) - << "incorrect value for obs[11].L.f, expected 203, is " - << last_msg_->obs[11].L.f; - EXPECT_EQ(get_asobs[11].L.i)>( - reinterpret_cast(&last_msg_->obs[11].L.i)), - 104224985) - << "incorrect value for obs[11].L.i, expected 104224985, is " - << last_msg_->obs[11].L.i; - EXPECT_EQ(get_asobs[11].P)>( - reinterpret_cast(&last_msg_->obs[11].P)), - 973505172) - << "incorrect value for obs[11].P, expected 973505172, is " - << last_msg_->obs[11].P; - EXPECT_EQ(get_asobs[11].cn0)>( - reinterpret_cast(&last_msg_->obs[11].cn0)), - 170) - << "incorrect value for obs[11].cn0, expected 170, is " - << last_msg_->obs[11].cn0; - EXPECT_EQ(get_asobs[11].flags)>( - reinterpret_cast(&last_msg_->obs[11].flags)), - 15) - << "incorrect value for obs[11].flags, expected 15, is " - << last_msg_->obs[11].flags; - EXPECT_EQ(get_asobs[11].lock)>( - reinterpret_cast(&last_msg_->obs[11].lock)), - 10) - << "incorrect value for obs[11].lock, expected 10, is " - << last_msg_->obs[11].lock; - EXPECT_EQ( - get_asobs[11].sid.code)>( - reinterpret_cast(&last_msg_->obs[11].sid.code)), - 3) - << "incorrect value for obs[11].sid.code, expected 3, is " - << last_msg_->obs[11].sid.code; - EXPECT_EQ(get_asobs[11].sid.sat)>( - reinterpret_cast(&last_msg_->obs[11].sid.sat)), - 3) - << "incorrect value for obs[11].sid.sat, expected 3, is " - << last_msg_->obs[11].sid.sat; - EXPECT_EQ(get_asobs[12].D.f)>( - reinterpret_cast(&last_msg_->obs[12].D.f)), - 219) - << "incorrect value for obs[12].D.f, expected 219, is " - << last_msg_->obs[12].D.f; - EXPECT_EQ(get_asobs[12].D.i)>( - reinterpret_cast(&last_msg_->obs[12].D.i)), - -3836) - << "incorrect value for obs[12].D.i, expected -3836, is " - << last_msg_->obs[12].D.i; - EXPECT_EQ(get_asobs[12].L.f)>( - reinterpret_cast(&last_msg_->obs[12].L.f)), - 80) - << "incorrect value for obs[12].L.f, expected 80, is " - << last_msg_->obs[12].L.f; - EXPECT_EQ(get_asobs[12].L.i)>( - reinterpret_cast(&last_msg_->obs[12].L.i)), - 114505343) - << "incorrect value for obs[12].L.i, expected 114505343, is " - << last_msg_->obs[12].L.i; - EXPECT_EQ(get_asobs[12].P)>( - reinterpret_cast(&last_msg_->obs[12].P)), - 1069903034) - << "incorrect value for obs[12].P, expected 1069903034, is " - << last_msg_->obs[12].P; - EXPECT_EQ(get_asobs[12].cn0)>( - reinterpret_cast(&last_msg_->obs[12].cn0)), - 200) - << "incorrect value for obs[12].cn0, expected 200, is " - << last_msg_->obs[12].cn0; - EXPECT_EQ(get_asobs[12].flags)>( - reinterpret_cast(&last_msg_->obs[12].flags)), - 15) - << "incorrect value for obs[12].flags, expected 15, is " - << last_msg_->obs[12].flags; - EXPECT_EQ(get_asobs[12].lock)>( - reinterpret_cast(&last_msg_->obs[12].lock)), - 10) - << "incorrect value for obs[12].lock, expected 10, is " - << last_msg_->obs[12].lock; - EXPECT_EQ( - get_asobs[12].sid.code)>( - reinterpret_cast(&last_msg_->obs[12].sid.code)), - 3) - << "incorrect value for obs[12].sid.code, expected 3, is " - << last_msg_->obs[12].sid.code; - EXPECT_EQ(get_asobs[12].sid.sat)>( - reinterpret_cast(&last_msg_->obs[12].sid.sat)), - 17) - << "incorrect value for obs[12].sid.sat, expected 17, is " - << last_msg_->obs[12].sid.sat; - EXPECT_EQ(get_asobs[13].D.f)>( - reinterpret_cast(&last_msg_->obs[13].D.f)), - 182) - << "incorrect value for obs[13].D.f, expected 182, is " - << last_msg_->obs[13].D.f; - EXPECT_EQ(get_asobs[13].D.i)>( - reinterpret_cast(&last_msg_->obs[13].D.i)), - -461) - << "incorrect value for obs[13].D.i, expected -461, is " - << last_msg_->obs[13].D.i; - EXPECT_EQ(get_asobs[13].L.f)>( - reinterpret_cast(&last_msg_->obs[13].L.f)), - 105) - << "incorrect value for obs[13].L.f, expected 105, is " - << last_msg_->obs[13].L.f; - EXPECT_EQ(get_asobs[13].L.i)>( - reinterpret_cast(&last_msg_->obs[13].L.i)), - 102157331) - << "incorrect value for obs[13].L.i, expected 102157331, is " - << last_msg_->obs[13].L.i; - EXPECT_EQ(get_asobs[13].P)>( - reinterpret_cast(&last_msg_->obs[13].P)), - 956875687) - << "incorrect value for obs[13].P, expected 956875687, is " - << last_msg_->obs[13].P; - EXPECT_EQ(get_asobs[13].cn0)>( - reinterpret_cast(&last_msg_->obs[13].cn0)), - 152) - << "incorrect value for obs[13].cn0, expected 152, is " - << last_msg_->obs[13].cn0; - EXPECT_EQ(get_asobs[13].flags)>( - reinterpret_cast(&last_msg_->obs[13].flags)), - 15) - << "incorrect value for obs[13].flags, expected 15, is " - << last_msg_->obs[13].flags; - EXPECT_EQ(get_asobs[13].lock)>( - reinterpret_cast(&last_msg_->obs[13].lock)), - 10) - << "incorrect value for obs[13].lock, expected 10, is " - << last_msg_->obs[13].lock; - EXPECT_EQ( - get_asobs[13].sid.code)>( - reinterpret_cast(&last_msg_->obs[13].sid.code)), - 3) - << "incorrect value for obs[13].sid.code, expected 3, is " - << last_msg_->obs[13].sid.code; - EXPECT_EQ(get_asobs[13].sid.sat)>( - reinterpret_cast(&last_msg_->obs[13].sid.sat)), - 18) - << "incorrect value for obs[13].sid.sat, expected 18, is " - << last_msg_->obs[13].sid.sat; -} -class Test_legacy_auto_check_sbp_observation_MsgObs1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgObs1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgObs1, Test) { - uint8_t encoded_frame[] = { - 85, 74, 0, 129, 240, 11, 152, 202, 226, 25, - 0, 0, 0, 0, 106, 8, 16, 201, 101, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_t *test_msg = (msg_obs_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 16; - test_msg->header.t.ns_residual = 0; - test_msg->header.t.tow = 434293400; - test_msg->header.t.wn = 2154; - - EXPECT_EQ(send_message(0x4a, 61569, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 61569); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 16) - << "incorrect value for header.n_obs, expected 16, is " - << last_msg_->header.n_obs; - EXPECT_EQ( - get_asheader.t.ns_residual)>( - reinterpret_cast(&last_msg_->header.t.ns_residual)), - 0) - << "incorrect value for header.t.ns_residual, expected 0, is " - << last_msg_->header.t.ns_residual; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 434293400) - << "incorrect value for header.t.tow, expected 434293400, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 2154) - << "incorrect value for header.t.wn, expected 2154, is " - << last_msg_->header.t.wn; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgObsDepB.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgObsDepB.cc deleted file mode 100644 index f0b7847d71..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgObsDepB.cc +++ /dev/null @@ -1,1829 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgObsDepB.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgObsDepB0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgObsDepB0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgObsDepB0, Test) { - uint8_t encoded_frame[] = { - 85, 67, 0, 246, 215, 103, 120, 46, 39, 0, 251, 6, 32, 180, 175, 187, - 133, 223, 53, 7, 7, 27, 157, 0, 0, 202, 0, 0, 0, 58, 140, 85, - 147, 88, 28, 190, 7, 175, 144, 0, 0, 203, 0, 0, 0, 220, 140, 248, - 138, 208, 172, 77, 7, 135, 151, 0, 0, 208, 0, 0, 0, 173, 194, 72, - 135, 115, 18, 28, 7, 242, 156, 0, 0, 212, 0, 0, 0, 164, 144, 105, - 124, 18, 196, 137, 6, 120, 168, 0, 0, 217, 0, 0, 0, 30, 232, 228, - 139, 210, 7, 90, 7, 87, 150, 0, 0, 218, 0, 0, 0, 169, 85, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_dep_b_t *test_msg = (msg_obs_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.tow = 2567800; - test_msg->header.t.wn = 1787; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].L.f = 27; - test_msg->obs[0].L.i = 117913055; - test_msg->obs[0].P = 2243669940; - test_msg->obs[0].cn0 = 157; - test_msg->obs[0].lock = 0; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 202; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[1].L.f = 175; - test_msg->obs[1].L.i = 129899608; - test_msg->obs[1].P = 2471857210; - test_msg->obs[1].cn0 = 144; - test_msg->obs[1].lock = 0; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 203; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[2].L.f = 135; - test_msg->obs[2].L.i = 122531024; - test_msg->obs[2].P = 2331544796; - test_msg->obs[2].cn0 = 151; - test_msg->obs[2].lock = 0; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 208; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[3].L.f = 242; - test_msg->obs[3].L.i = 119280243; - test_msg->obs[3].P = 2269692589; - test_msg->obs[3].cn0 = 156; - test_msg->obs[3].lock = 0; - test_msg->obs[3].sid.code = 0; - test_msg->obs[3].sid.reserved = 0; - test_msg->obs[3].sid.sat = 212; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[4].L.f = 120; - test_msg->obs[4].L.i = 109691922; - test_msg->obs[4].P = 2087293092; - test_msg->obs[4].cn0 = 168; - test_msg->obs[4].lock = 0; - test_msg->obs[4].sid.code = 0; - test_msg->obs[4].sid.reserved = 0; - test_msg->obs[4].sid.sat = 217; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[5].L.f = 87; - test_msg->obs[5].L.i = 123340754; - test_msg->obs[5].P = 2347034654; - test_msg->obs[5].cn0 = 150; - test_msg->obs[5].lock = 0; - test_msg->obs[5].sid.code = 0; - test_msg->obs[5].sid.reserved = 0; - test_msg->obs[5].sid.sat = 218; - - EXPECT_EQ(send_message(0x43, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 32) - << "incorrect value for header.n_obs, expected 32, is " - << last_msg_->header.n_obs; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 2567800) - << "incorrect value for header.t.tow, expected 2567800, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 1787) - << "incorrect value for header.t.wn, expected 1787, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 27) - << "incorrect value for obs[0].L.f, expected 27, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - 117913055) - << "incorrect value for obs[0].L.i, expected 117913055, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 2243669940) - << "incorrect value for obs[0].P, expected 2243669940, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].cn0)>( - reinterpret_cast(&last_msg_->obs[0].cn0)), - 157) - << "incorrect value for obs[0].cn0, expected 157, is " - << last_msg_->obs[0].cn0; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 0) - << "incorrect value for obs[0].lock, expected 0, is " - << last_msg_->obs[0].lock; - EXPECT_EQ(get_asobs[0].sid.code)>( - reinterpret_cast(&last_msg_->obs[0].sid.code)), - 0) - << "incorrect value for obs[0].sid.code, expected 0, is " - << last_msg_->obs[0].sid.code; - EXPECT_EQ( - get_asobs[0].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[0].sid.reserved)), - 0) - << "incorrect value for obs[0].sid.reserved, expected 0, is " - << last_msg_->obs[0].sid.reserved; - EXPECT_EQ(get_asobs[0].sid.sat)>( - reinterpret_cast(&last_msg_->obs[0].sid.sat)), - 202) - << "incorrect value for obs[0].sid.sat, expected 202, is " - << last_msg_->obs[0].sid.sat; - EXPECT_EQ(get_asobs[1].L.f)>( - reinterpret_cast(&last_msg_->obs[1].L.f)), - 175) - << "incorrect value for obs[1].L.f, expected 175, is " - << last_msg_->obs[1].L.f; - EXPECT_EQ(get_asobs[1].L.i)>( - reinterpret_cast(&last_msg_->obs[1].L.i)), - 129899608) - << "incorrect value for obs[1].L.i, expected 129899608, is " - << last_msg_->obs[1].L.i; - EXPECT_EQ(get_asobs[1].P)>( - reinterpret_cast(&last_msg_->obs[1].P)), - 2471857210) - << "incorrect value for obs[1].P, expected 2471857210, is " - << last_msg_->obs[1].P; - EXPECT_EQ(get_asobs[1].cn0)>( - reinterpret_cast(&last_msg_->obs[1].cn0)), - 144) - << "incorrect value for obs[1].cn0, expected 144, is " - << last_msg_->obs[1].cn0; - EXPECT_EQ(get_asobs[1].lock)>( - reinterpret_cast(&last_msg_->obs[1].lock)), - 0) - << "incorrect value for obs[1].lock, expected 0, is " - << last_msg_->obs[1].lock; - EXPECT_EQ(get_asobs[1].sid.code)>( - reinterpret_cast(&last_msg_->obs[1].sid.code)), - 0) - << "incorrect value for obs[1].sid.code, expected 0, is " - << last_msg_->obs[1].sid.code; - EXPECT_EQ( - get_asobs[1].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[1].sid.reserved)), - 0) - << "incorrect value for obs[1].sid.reserved, expected 0, is " - << last_msg_->obs[1].sid.reserved; - EXPECT_EQ(get_asobs[1].sid.sat)>( - reinterpret_cast(&last_msg_->obs[1].sid.sat)), - 203) - << "incorrect value for obs[1].sid.sat, expected 203, is " - << last_msg_->obs[1].sid.sat; - EXPECT_EQ(get_asobs[2].L.f)>( - reinterpret_cast(&last_msg_->obs[2].L.f)), - 135) - << "incorrect value for obs[2].L.f, expected 135, is " - << last_msg_->obs[2].L.f; - EXPECT_EQ(get_asobs[2].L.i)>( - reinterpret_cast(&last_msg_->obs[2].L.i)), - 122531024) - << "incorrect value for obs[2].L.i, expected 122531024, is " - << last_msg_->obs[2].L.i; - EXPECT_EQ(get_asobs[2].P)>( - reinterpret_cast(&last_msg_->obs[2].P)), - 2331544796) - << "incorrect value for obs[2].P, expected 2331544796, is " - << last_msg_->obs[2].P; - EXPECT_EQ(get_asobs[2].cn0)>( - reinterpret_cast(&last_msg_->obs[2].cn0)), - 151) - << "incorrect value for obs[2].cn0, expected 151, is " - << last_msg_->obs[2].cn0; - EXPECT_EQ(get_asobs[2].lock)>( - reinterpret_cast(&last_msg_->obs[2].lock)), - 0) - << "incorrect value for obs[2].lock, expected 0, is " - << last_msg_->obs[2].lock; - EXPECT_EQ(get_asobs[2].sid.code)>( - reinterpret_cast(&last_msg_->obs[2].sid.code)), - 0) - << "incorrect value for obs[2].sid.code, expected 0, is " - << last_msg_->obs[2].sid.code; - EXPECT_EQ( - get_asobs[2].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[2].sid.reserved)), - 0) - << "incorrect value for obs[2].sid.reserved, expected 0, is " - << last_msg_->obs[2].sid.reserved; - EXPECT_EQ(get_asobs[2].sid.sat)>( - reinterpret_cast(&last_msg_->obs[2].sid.sat)), - 208) - << "incorrect value for obs[2].sid.sat, expected 208, is " - << last_msg_->obs[2].sid.sat; - EXPECT_EQ(get_asobs[3].L.f)>( - reinterpret_cast(&last_msg_->obs[3].L.f)), - 242) - << "incorrect value for obs[3].L.f, expected 242, is " - << last_msg_->obs[3].L.f; - EXPECT_EQ(get_asobs[3].L.i)>( - reinterpret_cast(&last_msg_->obs[3].L.i)), - 119280243) - << "incorrect value for obs[3].L.i, expected 119280243, is " - << last_msg_->obs[3].L.i; - EXPECT_EQ(get_asobs[3].P)>( - reinterpret_cast(&last_msg_->obs[3].P)), - 2269692589) - << "incorrect value for obs[3].P, expected 2269692589, is " - << last_msg_->obs[3].P; - EXPECT_EQ(get_asobs[3].cn0)>( - reinterpret_cast(&last_msg_->obs[3].cn0)), - 156) - << "incorrect value for obs[3].cn0, expected 156, is " - << last_msg_->obs[3].cn0; - EXPECT_EQ(get_asobs[3].lock)>( - reinterpret_cast(&last_msg_->obs[3].lock)), - 0) - << "incorrect value for obs[3].lock, expected 0, is " - << last_msg_->obs[3].lock; - EXPECT_EQ(get_asobs[3].sid.code)>( - reinterpret_cast(&last_msg_->obs[3].sid.code)), - 0) - << "incorrect value for obs[3].sid.code, expected 0, is " - << last_msg_->obs[3].sid.code; - EXPECT_EQ( - get_asobs[3].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[3].sid.reserved)), - 0) - << "incorrect value for obs[3].sid.reserved, expected 0, is " - << last_msg_->obs[3].sid.reserved; - EXPECT_EQ(get_asobs[3].sid.sat)>( - reinterpret_cast(&last_msg_->obs[3].sid.sat)), - 212) - << "incorrect value for obs[3].sid.sat, expected 212, is " - << last_msg_->obs[3].sid.sat; - EXPECT_EQ(get_asobs[4].L.f)>( - reinterpret_cast(&last_msg_->obs[4].L.f)), - 120) - << "incorrect value for obs[4].L.f, expected 120, is " - << last_msg_->obs[4].L.f; - EXPECT_EQ(get_asobs[4].L.i)>( - reinterpret_cast(&last_msg_->obs[4].L.i)), - 109691922) - << "incorrect value for obs[4].L.i, expected 109691922, is " - << last_msg_->obs[4].L.i; - EXPECT_EQ(get_asobs[4].P)>( - reinterpret_cast(&last_msg_->obs[4].P)), - 2087293092) - << "incorrect value for obs[4].P, expected 2087293092, is " - << last_msg_->obs[4].P; - EXPECT_EQ(get_asobs[4].cn0)>( - reinterpret_cast(&last_msg_->obs[4].cn0)), - 168) - << "incorrect value for obs[4].cn0, expected 168, is " - << last_msg_->obs[4].cn0; - EXPECT_EQ(get_asobs[4].lock)>( - reinterpret_cast(&last_msg_->obs[4].lock)), - 0) - << "incorrect value for obs[4].lock, expected 0, is " - << last_msg_->obs[4].lock; - EXPECT_EQ(get_asobs[4].sid.code)>( - reinterpret_cast(&last_msg_->obs[4].sid.code)), - 0) - << "incorrect value for obs[4].sid.code, expected 0, is " - << last_msg_->obs[4].sid.code; - EXPECT_EQ( - get_asobs[4].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[4].sid.reserved)), - 0) - << "incorrect value for obs[4].sid.reserved, expected 0, is " - << last_msg_->obs[4].sid.reserved; - EXPECT_EQ(get_asobs[4].sid.sat)>( - reinterpret_cast(&last_msg_->obs[4].sid.sat)), - 217) - << "incorrect value for obs[4].sid.sat, expected 217, is " - << last_msg_->obs[4].sid.sat; - EXPECT_EQ(get_asobs[5].L.f)>( - reinterpret_cast(&last_msg_->obs[5].L.f)), - 87) - << "incorrect value for obs[5].L.f, expected 87, is " - << last_msg_->obs[5].L.f; - EXPECT_EQ(get_asobs[5].L.i)>( - reinterpret_cast(&last_msg_->obs[5].L.i)), - 123340754) - << "incorrect value for obs[5].L.i, expected 123340754, is " - << last_msg_->obs[5].L.i; - EXPECT_EQ(get_asobs[5].P)>( - reinterpret_cast(&last_msg_->obs[5].P)), - 2347034654) - << "incorrect value for obs[5].P, expected 2347034654, is " - << last_msg_->obs[5].P; - EXPECT_EQ(get_asobs[5].cn0)>( - reinterpret_cast(&last_msg_->obs[5].cn0)), - 150) - << "incorrect value for obs[5].cn0, expected 150, is " - << last_msg_->obs[5].cn0; - EXPECT_EQ(get_asobs[5].lock)>( - reinterpret_cast(&last_msg_->obs[5].lock)), - 0) - << "incorrect value for obs[5].lock, expected 0, is " - << last_msg_->obs[5].lock; - EXPECT_EQ(get_asobs[5].sid.code)>( - reinterpret_cast(&last_msg_->obs[5].sid.code)), - 0) - << "incorrect value for obs[5].sid.code, expected 0, is " - << last_msg_->obs[5].sid.code; - EXPECT_EQ( - get_asobs[5].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[5].sid.reserved)), - 0) - << "incorrect value for obs[5].sid.reserved, expected 0, is " - << last_msg_->obs[5].sid.reserved; - EXPECT_EQ(get_asobs[5].sid.sat)>( - reinterpret_cast(&last_msg_->obs[5].sid.sat)), - 218) - << "incorrect value for obs[5].sid.sat, expected 218, is " - << last_msg_->obs[5].sid.sat; -} -class Test_legacy_auto_check_sbp_observation_MsgObsDepB1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgObsDepB1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgObsDepB1, Test) { - uint8_t encoded_frame[] = { - 85, 67, 0, 246, 215, 55, 120, 46, 39, 0, 251, 6, 33, 68, 199, 101, - 136, 133, 247, 42, 7, 219, 154, 0, 0, 220, 0, 0, 0, 219, 14, 123, - 133, 96, 215, 3, 7, 235, 156, 0, 0, 222, 0, 0, 0, 87, 166, 81, - 122, 5, 173, 109, 6, 174, 170, 0, 0, 225, 0, 0, 0, 11, 233, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_dep_b_t *test_msg = (msg_obs_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 33; - test_msg->header.t.tow = 2567800; - test_msg->header.t.wn = 1787; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].L.f = 219; - test_msg->obs[0].L.i = 120256389; - test_msg->obs[0].P = 2288371524; - test_msg->obs[0].cn0 = 154; - test_msg->obs[0].lock = 0; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 220; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[1].L.f = 235; - test_msg->obs[1].L.i = 117692256; - test_msg->obs[1].P = 2239434459; - test_msg->obs[1].cn0 = 156; - test_msg->obs[1].lock = 0; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 222; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[2].L.f = 174; - test_msg->obs[2].L.i = 107851013; - test_msg->obs[2].P = 2052171351; - test_msg->obs[2].cn0 = 170; - test_msg->obs[2].lock = 0; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 225; - - EXPECT_EQ(send_message(0x43, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 33) - << "incorrect value for header.n_obs, expected 33, is " - << last_msg_->header.n_obs; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 2567800) - << "incorrect value for header.t.tow, expected 2567800, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 1787) - << "incorrect value for header.t.wn, expected 1787, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 219) - << "incorrect value for obs[0].L.f, expected 219, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - 120256389) - << "incorrect value for obs[0].L.i, expected 120256389, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 2288371524) - << "incorrect value for obs[0].P, expected 2288371524, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].cn0)>( - reinterpret_cast(&last_msg_->obs[0].cn0)), - 154) - << "incorrect value for obs[0].cn0, expected 154, is " - << last_msg_->obs[0].cn0; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 0) - << "incorrect value for obs[0].lock, expected 0, is " - << last_msg_->obs[0].lock; - EXPECT_EQ(get_asobs[0].sid.code)>( - reinterpret_cast(&last_msg_->obs[0].sid.code)), - 0) - << "incorrect value for obs[0].sid.code, expected 0, is " - << last_msg_->obs[0].sid.code; - EXPECT_EQ( - get_asobs[0].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[0].sid.reserved)), - 0) - << "incorrect value for obs[0].sid.reserved, expected 0, is " - << last_msg_->obs[0].sid.reserved; - EXPECT_EQ(get_asobs[0].sid.sat)>( - reinterpret_cast(&last_msg_->obs[0].sid.sat)), - 220) - << "incorrect value for obs[0].sid.sat, expected 220, is " - << last_msg_->obs[0].sid.sat; - EXPECT_EQ(get_asobs[1].L.f)>( - reinterpret_cast(&last_msg_->obs[1].L.f)), - 235) - << "incorrect value for obs[1].L.f, expected 235, is " - << last_msg_->obs[1].L.f; - EXPECT_EQ(get_asobs[1].L.i)>( - reinterpret_cast(&last_msg_->obs[1].L.i)), - 117692256) - << "incorrect value for obs[1].L.i, expected 117692256, is " - << last_msg_->obs[1].L.i; - EXPECT_EQ(get_asobs[1].P)>( - reinterpret_cast(&last_msg_->obs[1].P)), - 2239434459) - << "incorrect value for obs[1].P, expected 2239434459, is " - << last_msg_->obs[1].P; - EXPECT_EQ(get_asobs[1].cn0)>( - reinterpret_cast(&last_msg_->obs[1].cn0)), - 156) - << "incorrect value for obs[1].cn0, expected 156, is " - << last_msg_->obs[1].cn0; - EXPECT_EQ(get_asobs[1].lock)>( - reinterpret_cast(&last_msg_->obs[1].lock)), - 0) - << "incorrect value for obs[1].lock, expected 0, is " - << last_msg_->obs[1].lock; - EXPECT_EQ(get_asobs[1].sid.code)>( - reinterpret_cast(&last_msg_->obs[1].sid.code)), - 0) - << "incorrect value for obs[1].sid.code, expected 0, is " - << last_msg_->obs[1].sid.code; - EXPECT_EQ( - get_asobs[1].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[1].sid.reserved)), - 0) - << "incorrect value for obs[1].sid.reserved, expected 0, is " - << last_msg_->obs[1].sid.reserved; - EXPECT_EQ(get_asobs[1].sid.sat)>( - reinterpret_cast(&last_msg_->obs[1].sid.sat)), - 222) - << "incorrect value for obs[1].sid.sat, expected 222, is " - << last_msg_->obs[1].sid.sat; - EXPECT_EQ(get_asobs[2].L.f)>( - reinterpret_cast(&last_msg_->obs[2].L.f)), - 174) - << "incorrect value for obs[2].L.f, expected 174, is " - << last_msg_->obs[2].L.f; - EXPECT_EQ(get_asobs[2].L.i)>( - reinterpret_cast(&last_msg_->obs[2].L.i)), - 107851013) - << "incorrect value for obs[2].L.i, expected 107851013, is " - << last_msg_->obs[2].L.i; - EXPECT_EQ(get_asobs[2].P)>( - reinterpret_cast(&last_msg_->obs[2].P)), - 2052171351) - << "incorrect value for obs[2].P, expected 2052171351, is " - << last_msg_->obs[2].P; - EXPECT_EQ(get_asobs[2].cn0)>( - reinterpret_cast(&last_msg_->obs[2].cn0)), - 170) - << "incorrect value for obs[2].cn0, expected 170, is " - << last_msg_->obs[2].cn0; - EXPECT_EQ(get_asobs[2].lock)>( - reinterpret_cast(&last_msg_->obs[2].lock)), - 0) - << "incorrect value for obs[2].lock, expected 0, is " - << last_msg_->obs[2].lock; - EXPECT_EQ(get_asobs[2].sid.code)>( - reinterpret_cast(&last_msg_->obs[2].sid.code)), - 0) - << "incorrect value for obs[2].sid.code, expected 0, is " - << last_msg_->obs[2].sid.code; - EXPECT_EQ( - get_asobs[2].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[2].sid.reserved)), - 0) - << "incorrect value for obs[2].sid.reserved, expected 0, is " - << last_msg_->obs[2].sid.reserved; - EXPECT_EQ(get_asobs[2].sid.sat)>( - reinterpret_cast(&last_msg_->obs[2].sid.sat)), - 225) - << "incorrect value for obs[2].sid.sat, expected 225, is " - << last_msg_->obs[2].sid.sat; -} -class Test_legacy_auto_check_sbp_observation_MsgObsDepB2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgObsDepB2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgObsDepB2, Test) { - uint8_t encoded_frame[] = { - 85, 67, 0, 246, 215, 103, 64, 47, 39, 0, 251, 6, 32, 100, 132, 187, - 133, 236, 51, 7, 7, 94, 156, 0, 0, 202, 0, 0, 0, 97, 184, 85, - 147, 178, 30, 190, 7, 40, 140, 0, 0, 203, 0, 0, 0, 135, 111, 248, - 138, 90, 171, 77, 7, 2, 150, 0, 0, 208, 0, 0, 0, 180, 238, 72, - 135, 190, 20, 28, 7, 241, 155, 0, 0, 212, 0, 0, 0, 15, 153, 105, - 124, 92, 196, 137, 6, 153, 168, 0, 0, 217, 0, 0, 0, 49, 185, 228, - 139, 144, 5, 90, 7, 41, 150, 0, 0, 218, 0, 0, 0, 241, 98, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_dep_b_t *test_msg = (msg_obs_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.tow = 2568000; - test_msg->header.t.wn = 1787; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].L.f = 94; - test_msg->obs[0].L.i = 117912556; - test_msg->obs[0].P = 2243658852; - test_msg->obs[0].cn0 = 156; - test_msg->obs[0].lock = 0; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 202; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[1].L.f = 40; - test_msg->obs[1].L.i = 129900210; - test_msg->obs[1].P = 2471868513; - test_msg->obs[1].cn0 = 140; - test_msg->obs[1].lock = 0; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 203; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[2].L.f = 2; - test_msg->obs[2].L.i = 122530650; - test_msg->obs[2].P = 2331537287; - test_msg->obs[2].cn0 = 150; - test_msg->obs[2].lock = 0; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 208; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[3].L.f = 241; - test_msg->obs[3].L.i = 119280830; - test_msg->obs[3].P = 2269703860; - test_msg->obs[3].cn0 = 155; - test_msg->obs[3].lock = 0; - test_msg->obs[3].sid.code = 0; - test_msg->obs[3].sid.reserved = 0; - test_msg->obs[3].sid.sat = 212; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[4].L.f = 153; - test_msg->obs[4].L.i = 109691996; - test_msg->obs[4].P = 2087295247; - test_msg->obs[4].cn0 = 168; - test_msg->obs[4].lock = 0; - test_msg->obs[4].sid.code = 0; - test_msg->obs[4].sid.reserved = 0; - test_msg->obs[4].sid.sat = 217; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[5].L.f = 41; - test_msg->obs[5].L.i = 123340176; - test_msg->obs[5].P = 2347022641; - test_msg->obs[5].cn0 = 150; - test_msg->obs[5].lock = 0; - test_msg->obs[5].sid.code = 0; - test_msg->obs[5].sid.reserved = 0; - test_msg->obs[5].sid.sat = 218; - - EXPECT_EQ(send_message(0x43, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 32) - << "incorrect value for header.n_obs, expected 32, is " - << last_msg_->header.n_obs; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 2568000) - << "incorrect value for header.t.tow, expected 2568000, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 1787) - << "incorrect value for header.t.wn, expected 1787, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 94) - << "incorrect value for obs[0].L.f, expected 94, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - 117912556) - << "incorrect value for obs[0].L.i, expected 117912556, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 2243658852) - << "incorrect value for obs[0].P, expected 2243658852, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].cn0)>( - reinterpret_cast(&last_msg_->obs[0].cn0)), - 156) - << "incorrect value for obs[0].cn0, expected 156, is " - << last_msg_->obs[0].cn0; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 0) - << "incorrect value for obs[0].lock, expected 0, is " - << last_msg_->obs[0].lock; - EXPECT_EQ(get_asobs[0].sid.code)>( - reinterpret_cast(&last_msg_->obs[0].sid.code)), - 0) - << "incorrect value for obs[0].sid.code, expected 0, is " - << last_msg_->obs[0].sid.code; - EXPECT_EQ( - get_asobs[0].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[0].sid.reserved)), - 0) - << "incorrect value for obs[0].sid.reserved, expected 0, is " - << last_msg_->obs[0].sid.reserved; - EXPECT_EQ(get_asobs[0].sid.sat)>( - reinterpret_cast(&last_msg_->obs[0].sid.sat)), - 202) - << "incorrect value for obs[0].sid.sat, expected 202, is " - << last_msg_->obs[0].sid.sat; - EXPECT_EQ(get_asobs[1].L.f)>( - reinterpret_cast(&last_msg_->obs[1].L.f)), - 40) - << "incorrect value for obs[1].L.f, expected 40, is " - << last_msg_->obs[1].L.f; - EXPECT_EQ(get_asobs[1].L.i)>( - reinterpret_cast(&last_msg_->obs[1].L.i)), - 129900210) - << "incorrect value for obs[1].L.i, expected 129900210, is " - << last_msg_->obs[1].L.i; - EXPECT_EQ(get_asobs[1].P)>( - reinterpret_cast(&last_msg_->obs[1].P)), - 2471868513) - << "incorrect value for obs[1].P, expected 2471868513, is " - << last_msg_->obs[1].P; - EXPECT_EQ(get_asobs[1].cn0)>( - reinterpret_cast(&last_msg_->obs[1].cn0)), - 140) - << "incorrect value for obs[1].cn0, expected 140, is " - << last_msg_->obs[1].cn0; - EXPECT_EQ(get_asobs[1].lock)>( - reinterpret_cast(&last_msg_->obs[1].lock)), - 0) - << "incorrect value for obs[1].lock, expected 0, is " - << last_msg_->obs[1].lock; - EXPECT_EQ(get_asobs[1].sid.code)>( - reinterpret_cast(&last_msg_->obs[1].sid.code)), - 0) - << "incorrect value for obs[1].sid.code, expected 0, is " - << last_msg_->obs[1].sid.code; - EXPECT_EQ( - get_asobs[1].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[1].sid.reserved)), - 0) - << "incorrect value for obs[1].sid.reserved, expected 0, is " - << last_msg_->obs[1].sid.reserved; - EXPECT_EQ(get_asobs[1].sid.sat)>( - reinterpret_cast(&last_msg_->obs[1].sid.sat)), - 203) - << "incorrect value for obs[1].sid.sat, expected 203, is " - << last_msg_->obs[1].sid.sat; - EXPECT_EQ(get_asobs[2].L.f)>( - reinterpret_cast(&last_msg_->obs[2].L.f)), - 2) - << "incorrect value for obs[2].L.f, expected 2, is " - << last_msg_->obs[2].L.f; - EXPECT_EQ(get_asobs[2].L.i)>( - reinterpret_cast(&last_msg_->obs[2].L.i)), - 122530650) - << "incorrect value for obs[2].L.i, expected 122530650, is " - << last_msg_->obs[2].L.i; - EXPECT_EQ(get_asobs[2].P)>( - reinterpret_cast(&last_msg_->obs[2].P)), - 2331537287) - << "incorrect value for obs[2].P, expected 2331537287, is " - << last_msg_->obs[2].P; - EXPECT_EQ(get_asobs[2].cn0)>( - reinterpret_cast(&last_msg_->obs[2].cn0)), - 150) - << "incorrect value for obs[2].cn0, expected 150, is " - << last_msg_->obs[2].cn0; - EXPECT_EQ(get_asobs[2].lock)>( - reinterpret_cast(&last_msg_->obs[2].lock)), - 0) - << "incorrect value for obs[2].lock, expected 0, is " - << last_msg_->obs[2].lock; - EXPECT_EQ(get_asobs[2].sid.code)>( - reinterpret_cast(&last_msg_->obs[2].sid.code)), - 0) - << "incorrect value for obs[2].sid.code, expected 0, is " - << last_msg_->obs[2].sid.code; - EXPECT_EQ( - get_asobs[2].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[2].sid.reserved)), - 0) - << "incorrect value for obs[2].sid.reserved, expected 0, is " - << last_msg_->obs[2].sid.reserved; - EXPECT_EQ(get_asobs[2].sid.sat)>( - reinterpret_cast(&last_msg_->obs[2].sid.sat)), - 208) - << "incorrect value for obs[2].sid.sat, expected 208, is " - << last_msg_->obs[2].sid.sat; - EXPECT_EQ(get_asobs[3].L.f)>( - reinterpret_cast(&last_msg_->obs[3].L.f)), - 241) - << "incorrect value for obs[3].L.f, expected 241, is " - << last_msg_->obs[3].L.f; - EXPECT_EQ(get_asobs[3].L.i)>( - reinterpret_cast(&last_msg_->obs[3].L.i)), - 119280830) - << "incorrect value for obs[3].L.i, expected 119280830, is " - << last_msg_->obs[3].L.i; - EXPECT_EQ(get_asobs[3].P)>( - reinterpret_cast(&last_msg_->obs[3].P)), - 2269703860) - << "incorrect value for obs[3].P, expected 2269703860, is " - << last_msg_->obs[3].P; - EXPECT_EQ(get_asobs[3].cn0)>( - reinterpret_cast(&last_msg_->obs[3].cn0)), - 155) - << "incorrect value for obs[3].cn0, expected 155, is " - << last_msg_->obs[3].cn0; - EXPECT_EQ(get_asobs[3].lock)>( - reinterpret_cast(&last_msg_->obs[3].lock)), - 0) - << "incorrect value for obs[3].lock, expected 0, is " - << last_msg_->obs[3].lock; - EXPECT_EQ(get_asobs[3].sid.code)>( - reinterpret_cast(&last_msg_->obs[3].sid.code)), - 0) - << "incorrect value for obs[3].sid.code, expected 0, is " - << last_msg_->obs[3].sid.code; - EXPECT_EQ( - get_asobs[3].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[3].sid.reserved)), - 0) - << "incorrect value for obs[3].sid.reserved, expected 0, is " - << last_msg_->obs[3].sid.reserved; - EXPECT_EQ(get_asobs[3].sid.sat)>( - reinterpret_cast(&last_msg_->obs[3].sid.sat)), - 212) - << "incorrect value for obs[3].sid.sat, expected 212, is " - << last_msg_->obs[3].sid.sat; - EXPECT_EQ(get_asobs[4].L.f)>( - reinterpret_cast(&last_msg_->obs[4].L.f)), - 153) - << "incorrect value for obs[4].L.f, expected 153, is " - << last_msg_->obs[4].L.f; - EXPECT_EQ(get_asobs[4].L.i)>( - reinterpret_cast(&last_msg_->obs[4].L.i)), - 109691996) - << "incorrect value for obs[4].L.i, expected 109691996, is " - << last_msg_->obs[4].L.i; - EXPECT_EQ(get_asobs[4].P)>( - reinterpret_cast(&last_msg_->obs[4].P)), - 2087295247) - << "incorrect value for obs[4].P, expected 2087295247, is " - << last_msg_->obs[4].P; - EXPECT_EQ(get_asobs[4].cn0)>( - reinterpret_cast(&last_msg_->obs[4].cn0)), - 168) - << "incorrect value for obs[4].cn0, expected 168, is " - << last_msg_->obs[4].cn0; - EXPECT_EQ(get_asobs[4].lock)>( - reinterpret_cast(&last_msg_->obs[4].lock)), - 0) - << "incorrect value for obs[4].lock, expected 0, is " - << last_msg_->obs[4].lock; - EXPECT_EQ(get_asobs[4].sid.code)>( - reinterpret_cast(&last_msg_->obs[4].sid.code)), - 0) - << "incorrect value for obs[4].sid.code, expected 0, is " - << last_msg_->obs[4].sid.code; - EXPECT_EQ( - get_asobs[4].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[4].sid.reserved)), - 0) - << "incorrect value for obs[4].sid.reserved, expected 0, is " - << last_msg_->obs[4].sid.reserved; - EXPECT_EQ(get_asobs[4].sid.sat)>( - reinterpret_cast(&last_msg_->obs[4].sid.sat)), - 217) - << "incorrect value for obs[4].sid.sat, expected 217, is " - << last_msg_->obs[4].sid.sat; - EXPECT_EQ(get_asobs[5].L.f)>( - reinterpret_cast(&last_msg_->obs[5].L.f)), - 41) - << "incorrect value for obs[5].L.f, expected 41, is " - << last_msg_->obs[5].L.f; - EXPECT_EQ(get_asobs[5].L.i)>( - reinterpret_cast(&last_msg_->obs[5].L.i)), - 123340176) - << "incorrect value for obs[5].L.i, expected 123340176, is " - << last_msg_->obs[5].L.i; - EXPECT_EQ(get_asobs[5].P)>( - reinterpret_cast(&last_msg_->obs[5].P)), - 2347022641) - << "incorrect value for obs[5].P, expected 2347022641, is " - << last_msg_->obs[5].P; - EXPECT_EQ(get_asobs[5].cn0)>( - reinterpret_cast(&last_msg_->obs[5].cn0)), - 150) - << "incorrect value for obs[5].cn0, expected 150, is " - << last_msg_->obs[5].cn0; - EXPECT_EQ(get_asobs[5].lock)>( - reinterpret_cast(&last_msg_->obs[5].lock)), - 0) - << "incorrect value for obs[5].lock, expected 0, is " - << last_msg_->obs[5].lock; - EXPECT_EQ(get_asobs[5].sid.code)>( - reinterpret_cast(&last_msg_->obs[5].sid.code)), - 0) - << "incorrect value for obs[5].sid.code, expected 0, is " - << last_msg_->obs[5].sid.code; - EXPECT_EQ( - get_asobs[5].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[5].sid.reserved)), - 0) - << "incorrect value for obs[5].sid.reserved, expected 0, is " - << last_msg_->obs[5].sid.reserved; - EXPECT_EQ(get_asobs[5].sid.sat)>( - reinterpret_cast(&last_msg_->obs[5].sid.sat)), - 218) - << "incorrect value for obs[5].sid.sat, expected 218, is " - << last_msg_->obs[5].sid.sat; -} -class Test_legacy_auto_check_sbp_observation_MsgObsDepB3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgObsDepB3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgObsDepB3, Test) { - uint8_t encoded_frame[] = { - 85, 67, 0, 246, 215, 55, 64, 47, 39, 0, 251, 6, 33, 234, 148, 101, - 136, 15, 245, 42, 7, 20, 154, 0, 0, 220, 0, 0, 0, 208, 247, 122, - 133, 16, 214, 3, 7, 38, 156, 0, 0, 222, 0, 0, 0, 15, 150, 81, - 122, 22, 172, 109, 6, 7, 172, 0, 0, 225, 0, 0, 0, 201, 13, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_dep_b_t *test_msg = (msg_obs_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 33; - test_msg->header.t.tow = 2568000; - test_msg->header.t.wn = 1787; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].L.f = 20; - test_msg->obs[0].L.i = 120255759; - test_msg->obs[0].P = 2288358634; - test_msg->obs[0].cn0 = 154; - test_msg->obs[0].lock = 0; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 220; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[1].L.f = 38; - test_msg->obs[1].L.i = 117691920; - test_msg->obs[1].P = 2239428560; - test_msg->obs[1].cn0 = 156; - test_msg->obs[1].lock = 0; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 222; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[2].L.f = 7; - test_msg->obs[2].L.i = 107850774; - test_msg->obs[2].P = 2052167183; - test_msg->obs[2].cn0 = 172; - test_msg->obs[2].lock = 0; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 225; - - EXPECT_EQ(send_message(0x43, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 33) - << "incorrect value for header.n_obs, expected 33, is " - << last_msg_->header.n_obs; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 2568000) - << "incorrect value for header.t.tow, expected 2568000, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 1787) - << "incorrect value for header.t.wn, expected 1787, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 20) - << "incorrect value for obs[0].L.f, expected 20, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - 120255759) - << "incorrect value for obs[0].L.i, expected 120255759, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 2288358634) - << "incorrect value for obs[0].P, expected 2288358634, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].cn0)>( - reinterpret_cast(&last_msg_->obs[0].cn0)), - 154) - << "incorrect value for obs[0].cn0, expected 154, is " - << last_msg_->obs[0].cn0; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 0) - << "incorrect value for obs[0].lock, expected 0, is " - << last_msg_->obs[0].lock; - EXPECT_EQ(get_asobs[0].sid.code)>( - reinterpret_cast(&last_msg_->obs[0].sid.code)), - 0) - << "incorrect value for obs[0].sid.code, expected 0, is " - << last_msg_->obs[0].sid.code; - EXPECT_EQ( - get_asobs[0].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[0].sid.reserved)), - 0) - << "incorrect value for obs[0].sid.reserved, expected 0, is " - << last_msg_->obs[0].sid.reserved; - EXPECT_EQ(get_asobs[0].sid.sat)>( - reinterpret_cast(&last_msg_->obs[0].sid.sat)), - 220) - << "incorrect value for obs[0].sid.sat, expected 220, is " - << last_msg_->obs[0].sid.sat; - EXPECT_EQ(get_asobs[1].L.f)>( - reinterpret_cast(&last_msg_->obs[1].L.f)), - 38) - << "incorrect value for obs[1].L.f, expected 38, is " - << last_msg_->obs[1].L.f; - EXPECT_EQ(get_asobs[1].L.i)>( - reinterpret_cast(&last_msg_->obs[1].L.i)), - 117691920) - << "incorrect value for obs[1].L.i, expected 117691920, is " - << last_msg_->obs[1].L.i; - EXPECT_EQ(get_asobs[1].P)>( - reinterpret_cast(&last_msg_->obs[1].P)), - 2239428560) - << "incorrect value for obs[1].P, expected 2239428560, is " - << last_msg_->obs[1].P; - EXPECT_EQ(get_asobs[1].cn0)>( - reinterpret_cast(&last_msg_->obs[1].cn0)), - 156) - << "incorrect value for obs[1].cn0, expected 156, is " - << last_msg_->obs[1].cn0; - EXPECT_EQ(get_asobs[1].lock)>( - reinterpret_cast(&last_msg_->obs[1].lock)), - 0) - << "incorrect value for obs[1].lock, expected 0, is " - << last_msg_->obs[1].lock; - EXPECT_EQ(get_asobs[1].sid.code)>( - reinterpret_cast(&last_msg_->obs[1].sid.code)), - 0) - << "incorrect value for obs[1].sid.code, expected 0, is " - << last_msg_->obs[1].sid.code; - EXPECT_EQ( - get_asobs[1].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[1].sid.reserved)), - 0) - << "incorrect value for obs[1].sid.reserved, expected 0, is " - << last_msg_->obs[1].sid.reserved; - EXPECT_EQ(get_asobs[1].sid.sat)>( - reinterpret_cast(&last_msg_->obs[1].sid.sat)), - 222) - << "incorrect value for obs[1].sid.sat, expected 222, is " - << last_msg_->obs[1].sid.sat; - EXPECT_EQ(get_asobs[2].L.f)>( - reinterpret_cast(&last_msg_->obs[2].L.f)), - 7) - << "incorrect value for obs[2].L.f, expected 7, is " - << last_msg_->obs[2].L.f; - EXPECT_EQ(get_asobs[2].L.i)>( - reinterpret_cast(&last_msg_->obs[2].L.i)), - 107850774) - << "incorrect value for obs[2].L.i, expected 107850774, is " - << last_msg_->obs[2].L.i; - EXPECT_EQ(get_asobs[2].P)>( - reinterpret_cast(&last_msg_->obs[2].P)), - 2052167183) - << "incorrect value for obs[2].P, expected 2052167183, is " - << last_msg_->obs[2].P; - EXPECT_EQ(get_asobs[2].cn0)>( - reinterpret_cast(&last_msg_->obs[2].cn0)), - 172) - << "incorrect value for obs[2].cn0, expected 172, is " - << last_msg_->obs[2].cn0; - EXPECT_EQ(get_asobs[2].lock)>( - reinterpret_cast(&last_msg_->obs[2].lock)), - 0) - << "incorrect value for obs[2].lock, expected 0, is " - << last_msg_->obs[2].lock; - EXPECT_EQ(get_asobs[2].sid.code)>( - reinterpret_cast(&last_msg_->obs[2].sid.code)), - 0) - << "incorrect value for obs[2].sid.code, expected 0, is " - << last_msg_->obs[2].sid.code; - EXPECT_EQ( - get_asobs[2].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[2].sid.reserved)), - 0) - << "incorrect value for obs[2].sid.reserved, expected 0, is " - << last_msg_->obs[2].sid.reserved; - EXPECT_EQ(get_asobs[2].sid.sat)>( - reinterpret_cast(&last_msg_->obs[2].sid.sat)), - 225) - << "incorrect value for obs[2].sid.sat, expected 225, is " - << last_msg_->obs[2].sid.sat; -} -class Test_legacy_auto_check_sbp_observation_MsgObsDepB4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgObsDepB4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgObsDepB4, Test) { - uint8_t encoded_frame[] = { - 85, 67, 0, 246, 215, 103, 8, 48, 39, 0, 251, 6, 32, 254, 96, 187, - 133, 249, 49, 7, 7, 165, 156, 0, 0, 202, 0, 0, 0, 113, 229, 85, - 147, 11, 33, 190, 7, 106, 143, 0, 0, 203, 0, 0, 0, 182, 85, 248, - 138, 227, 169, 77, 7, 159, 150, 0, 0, 208, 0, 0, 0, 17, 24, 73, - 135, 10, 23, 28, 7, 7, 156, 0, 0, 212, 0, 0, 0, 108, 155, 105, - 124, 166, 196, 137, 6, 186, 170, 0, 0, 217, 0, 0, 0, 214, 142, 228, - 139, 77, 3, 90, 7, 236, 151, 0, 0, 218, 0, 0, 0, 59, 118, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_dep_b_t *test_msg = (msg_obs_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.tow = 2568200; - test_msg->header.t.wn = 1787; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].L.f = 165; - test_msg->obs[0].L.i = 117912057; - test_msg->obs[0].P = 2243649790; - test_msg->obs[0].cn0 = 156; - test_msg->obs[0].lock = 0; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 202; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[1].L.f = 106; - test_msg->obs[1].L.i = 129900811; - test_msg->obs[1].P = 2471880049; - test_msg->obs[1].cn0 = 143; - test_msg->obs[1].lock = 0; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 203; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[2].L.f = 159; - test_msg->obs[2].L.i = 122530275; - test_msg->obs[2].P = 2331530678; - test_msg->obs[2].cn0 = 150; - test_msg->obs[2].lock = 0; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 208; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[3].L.f = 7; - test_msg->obs[3].L.i = 119281418; - test_msg->obs[3].P = 2269714449; - test_msg->obs[3].cn0 = 156; - test_msg->obs[3].lock = 0; - test_msg->obs[3].sid.code = 0; - test_msg->obs[3].sid.reserved = 0; - test_msg->obs[3].sid.sat = 212; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[4].L.f = 186; - test_msg->obs[4].L.i = 109692070; - test_msg->obs[4].P = 2087295852; - test_msg->obs[4].cn0 = 170; - test_msg->obs[4].lock = 0; - test_msg->obs[4].sid.code = 0; - test_msg->obs[4].sid.reserved = 0; - test_msg->obs[4].sid.sat = 217; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[5].L.f = 236; - test_msg->obs[5].L.i = 123339597; - test_msg->obs[5].P = 2347011798; - test_msg->obs[5].cn0 = 151; - test_msg->obs[5].lock = 0; - test_msg->obs[5].sid.code = 0; - test_msg->obs[5].sid.reserved = 0; - test_msg->obs[5].sid.sat = 218; - - EXPECT_EQ(send_message(0x43, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 32) - << "incorrect value for header.n_obs, expected 32, is " - << last_msg_->header.n_obs; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 2568200) - << "incorrect value for header.t.tow, expected 2568200, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 1787) - << "incorrect value for header.t.wn, expected 1787, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 165) - << "incorrect value for obs[0].L.f, expected 165, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - 117912057) - << "incorrect value for obs[0].L.i, expected 117912057, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 2243649790) - << "incorrect value for obs[0].P, expected 2243649790, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].cn0)>( - reinterpret_cast(&last_msg_->obs[0].cn0)), - 156) - << "incorrect value for obs[0].cn0, expected 156, is " - << last_msg_->obs[0].cn0; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 0) - << "incorrect value for obs[0].lock, expected 0, is " - << last_msg_->obs[0].lock; - EXPECT_EQ(get_asobs[0].sid.code)>( - reinterpret_cast(&last_msg_->obs[0].sid.code)), - 0) - << "incorrect value for obs[0].sid.code, expected 0, is " - << last_msg_->obs[0].sid.code; - EXPECT_EQ( - get_asobs[0].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[0].sid.reserved)), - 0) - << "incorrect value for obs[0].sid.reserved, expected 0, is " - << last_msg_->obs[0].sid.reserved; - EXPECT_EQ(get_asobs[0].sid.sat)>( - reinterpret_cast(&last_msg_->obs[0].sid.sat)), - 202) - << "incorrect value for obs[0].sid.sat, expected 202, is " - << last_msg_->obs[0].sid.sat; - EXPECT_EQ(get_asobs[1].L.f)>( - reinterpret_cast(&last_msg_->obs[1].L.f)), - 106) - << "incorrect value for obs[1].L.f, expected 106, is " - << last_msg_->obs[1].L.f; - EXPECT_EQ(get_asobs[1].L.i)>( - reinterpret_cast(&last_msg_->obs[1].L.i)), - 129900811) - << "incorrect value for obs[1].L.i, expected 129900811, is " - << last_msg_->obs[1].L.i; - EXPECT_EQ(get_asobs[1].P)>( - reinterpret_cast(&last_msg_->obs[1].P)), - 2471880049) - << "incorrect value for obs[1].P, expected 2471880049, is " - << last_msg_->obs[1].P; - EXPECT_EQ(get_asobs[1].cn0)>( - reinterpret_cast(&last_msg_->obs[1].cn0)), - 143) - << "incorrect value for obs[1].cn0, expected 143, is " - << last_msg_->obs[1].cn0; - EXPECT_EQ(get_asobs[1].lock)>( - reinterpret_cast(&last_msg_->obs[1].lock)), - 0) - << "incorrect value for obs[1].lock, expected 0, is " - << last_msg_->obs[1].lock; - EXPECT_EQ(get_asobs[1].sid.code)>( - reinterpret_cast(&last_msg_->obs[1].sid.code)), - 0) - << "incorrect value for obs[1].sid.code, expected 0, is " - << last_msg_->obs[1].sid.code; - EXPECT_EQ( - get_asobs[1].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[1].sid.reserved)), - 0) - << "incorrect value for obs[1].sid.reserved, expected 0, is " - << last_msg_->obs[1].sid.reserved; - EXPECT_EQ(get_asobs[1].sid.sat)>( - reinterpret_cast(&last_msg_->obs[1].sid.sat)), - 203) - << "incorrect value for obs[1].sid.sat, expected 203, is " - << last_msg_->obs[1].sid.sat; - EXPECT_EQ(get_asobs[2].L.f)>( - reinterpret_cast(&last_msg_->obs[2].L.f)), - 159) - << "incorrect value for obs[2].L.f, expected 159, is " - << last_msg_->obs[2].L.f; - EXPECT_EQ(get_asobs[2].L.i)>( - reinterpret_cast(&last_msg_->obs[2].L.i)), - 122530275) - << "incorrect value for obs[2].L.i, expected 122530275, is " - << last_msg_->obs[2].L.i; - EXPECT_EQ(get_asobs[2].P)>( - reinterpret_cast(&last_msg_->obs[2].P)), - 2331530678) - << "incorrect value for obs[2].P, expected 2331530678, is " - << last_msg_->obs[2].P; - EXPECT_EQ(get_asobs[2].cn0)>( - reinterpret_cast(&last_msg_->obs[2].cn0)), - 150) - << "incorrect value for obs[2].cn0, expected 150, is " - << last_msg_->obs[2].cn0; - EXPECT_EQ(get_asobs[2].lock)>( - reinterpret_cast(&last_msg_->obs[2].lock)), - 0) - << "incorrect value for obs[2].lock, expected 0, is " - << last_msg_->obs[2].lock; - EXPECT_EQ(get_asobs[2].sid.code)>( - reinterpret_cast(&last_msg_->obs[2].sid.code)), - 0) - << "incorrect value for obs[2].sid.code, expected 0, is " - << last_msg_->obs[2].sid.code; - EXPECT_EQ( - get_asobs[2].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[2].sid.reserved)), - 0) - << "incorrect value for obs[2].sid.reserved, expected 0, is " - << last_msg_->obs[2].sid.reserved; - EXPECT_EQ(get_asobs[2].sid.sat)>( - reinterpret_cast(&last_msg_->obs[2].sid.sat)), - 208) - << "incorrect value for obs[2].sid.sat, expected 208, is " - << last_msg_->obs[2].sid.sat; - EXPECT_EQ(get_asobs[3].L.f)>( - reinterpret_cast(&last_msg_->obs[3].L.f)), - 7) - << "incorrect value for obs[3].L.f, expected 7, is " - << last_msg_->obs[3].L.f; - EXPECT_EQ(get_asobs[3].L.i)>( - reinterpret_cast(&last_msg_->obs[3].L.i)), - 119281418) - << "incorrect value for obs[3].L.i, expected 119281418, is " - << last_msg_->obs[3].L.i; - EXPECT_EQ(get_asobs[3].P)>( - reinterpret_cast(&last_msg_->obs[3].P)), - 2269714449) - << "incorrect value for obs[3].P, expected 2269714449, is " - << last_msg_->obs[3].P; - EXPECT_EQ(get_asobs[3].cn0)>( - reinterpret_cast(&last_msg_->obs[3].cn0)), - 156) - << "incorrect value for obs[3].cn0, expected 156, is " - << last_msg_->obs[3].cn0; - EXPECT_EQ(get_asobs[3].lock)>( - reinterpret_cast(&last_msg_->obs[3].lock)), - 0) - << "incorrect value for obs[3].lock, expected 0, is " - << last_msg_->obs[3].lock; - EXPECT_EQ(get_asobs[3].sid.code)>( - reinterpret_cast(&last_msg_->obs[3].sid.code)), - 0) - << "incorrect value for obs[3].sid.code, expected 0, is " - << last_msg_->obs[3].sid.code; - EXPECT_EQ( - get_asobs[3].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[3].sid.reserved)), - 0) - << "incorrect value for obs[3].sid.reserved, expected 0, is " - << last_msg_->obs[3].sid.reserved; - EXPECT_EQ(get_asobs[3].sid.sat)>( - reinterpret_cast(&last_msg_->obs[3].sid.sat)), - 212) - << "incorrect value for obs[3].sid.sat, expected 212, is " - << last_msg_->obs[3].sid.sat; - EXPECT_EQ(get_asobs[4].L.f)>( - reinterpret_cast(&last_msg_->obs[4].L.f)), - 186) - << "incorrect value for obs[4].L.f, expected 186, is " - << last_msg_->obs[4].L.f; - EXPECT_EQ(get_asobs[4].L.i)>( - reinterpret_cast(&last_msg_->obs[4].L.i)), - 109692070) - << "incorrect value for obs[4].L.i, expected 109692070, is " - << last_msg_->obs[4].L.i; - EXPECT_EQ(get_asobs[4].P)>( - reinterpret_cast(&last_msg_->obs[4].P)), - 2087295852) - << "incorrect value for obs[4].P, expected 2087295852, is " - << last_msg_->obs[4].P; - EXPECT_EQ(get_asobs[4].cn0)>( - reinterpret_cast(&last_msg_->obs[4].cn0)), - 170) - << "incorrect value for obs[4].cn0, expected 170, is " - << last_msg_->obs[4].cn0; - EXPECT_EQ(get_asobs[4].lock)>( - reinterpret_cast(&last_msg_->obs[4].lock)), - 0) - << "incorrect value for obs[4].lock, expected 0, is " - << last_msg_->obs[4].lock; - EXPECT_EQ(get_asobs[4].sid.code)>( - reinterpret_cast(&last_msg_->obs[4].sid.code)), - 0) - << "incorrect value for obs[4].sid.code, expected 0, is " - << last_msg_->obs[4].sid.code; - EXPECT_EQ( - get_asobs[4].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[4].sid.reserved)), - 0) - << "incorrect value for obs[4].sid.reserved, expected 0, is " - << last_msg_->obs[4].sid.reserved; - EXPECT_EQ(get_asobs[4].sid.sat)>( - reinterpret_cast(&last_msg_->obs[4].sid.sat)), - 217) - << "incorrect value for obs[4].sid.sat, expected 217, is " - << last_msg_->obs[4].sid.sat; - EXPECT_EQ(get_asobs[5].L.f)>( - reinterpret_cast(&last_msg_->obs[5].L.f)), - 236) - << "incorrect value for obs[5].L.f, expected 236, is " - << last_msg_->obs[5].L.f; - EXPECT_EQ(get_asobs[5].L.i)>( - reinterpret_cast(&last_msg_->obs[5].L.i)), - 123339597) - << "incorrect value for obs[5].L.i, expected 123339597, is " - << last_msg_->obs[5].L.i; - EXPECT_EQ(get_asobs[5].P)>( - reinterpret_cast(&last_msg_->obs[5].P)), - 2347011798) - << "incorrect value for obs[5].P, expected 2347011798, is " - << last_msg_->obs[5].P; - EXPECT_EQ(get_asobs[5].cn0)>( - reinterpret_cast(&last_msg_->obs[5].cn0)), - 151) - << "incorrect value for obs[5].cn0, expected 151, is " - << last_msg_->obs[5].cn0; - EXPECT_EQ(get_asobs[5].lock)>( - reinterpret_cast(&last_msg_->obs[5].lock)), - 0) - << "incorrect value for obs[5].lock, expected 0, is " - << last_msg_->obs[5].lock; - EXPECT_EQ(get_asobs[5].sid.code)>( - reinterpret_cast(&last_msg_->obs[5].sid.code)), - 0) - << "incorrect value for obs[5].sid.code, expected 0, is " - << last_msg_->obs[5].sid.code; - EXPECT_EQ( - get_asobs[5].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[5].sid.reserved)), - 0) - << "incorrect value for obs[5].sid.reserved, expected 0, is " - << last_msg_->obs[5].sid.reserved; - EXPECT_EQ(get_asobs[5].sid.sat)>( - reinterpret_cast(&last_msg_->obs[5].sid.sat)), - 218) - << "incorrect value for obs[5].sid.sat, expected 218, is " - << last_msg_->obs[5].sid.sat; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgObsDepC.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgObsDepC.cc deleted file mode 100644 index 4012beeb44..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgObsDepC.cc +++ /dev/null @@ -1,1667 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgObsDepC.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgObsDepC0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgObsDepC0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_dep_c_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_dep_c_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgObsDepC0, Test) { - uint8_t encoded_frame[] = { - 85, 73, 0, 70, 152, 87, 8, 95, 183, 24, 106, 7, 32, 126, 250, 73, - 80, 113, 94, 247, 255, 231, 163, 229, 229, 4, 0, 0, 0, 60, 220, 96, - 70, 81, 147, 250, 255, 196, 208, 20, 28, 6, 0, 0, 0, 248, 61, 62, - 77, 28, 60, 242, 255, 110, 171, 180, 178, 7, 0, 0, 0, 237, 84, 190, - 77, 172, 37, 13, 0, 41, 170, 233, 164, 10, 0, 0, 0, 36, 85, 9, - 75, 240, 188, 21, 0, 19, 182, 196, 209, 12, 0, 0, 0, 190, 175, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_dep_c_t *test_msg = (msg_obs_dep_c_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.tow = 414670600; - test_msg->header.t.wn = 1898; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].L.f = 231; - test_msg->obs[0].L.i = -565647; - test_msg->obs[0].P = 1347025534; - test_msg->obs[0].cn0 = 163; - test_msg->obs[0].lock = 58853; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 4; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[1].L.f = 196; - test_msg->obs[1].L.i = -355503; - test_msg->obs[1].P = 1180752956; - test_msg->obs[1].cn0 = 208; - test_msg->obs[1].lock = 7188; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 6; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[2].L.f = 110; - test_msg->obs[2].L.i = -902116; - test_msg->obs[2].P = 1295924728; - test_msg->obs[2].cn0 = 171; - test_msg->obs[2].lock = 45748; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 7; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[3].L.f = 41; - test_msg->obs[3].L.i = 861612; - test_msg->obs[3].P = 1304319213; - test_msg->obs[3].cn0 = 170; - test_msg->obs[3].lock = 42217; - test_msg->obs[3].sid.code = 0; - test_msg->obs[3].sid.reserved = 0; - test_msg->obs[3].sid.sat = 10; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[4].L.f = 19; - test_msg->obs[4].L.i = 1424624; - test_msg->obs[4].P = 1258902820; - test_msg->obs[4].cn0 = 182; - test_msg->obs[4].lock = 53700; - test_msg->obs[4].sid.code = 0; - test_msg->obs[4].sid.reserved = 0; - test_msg->obs[4].sid.sat = 12; - - EXPECT_EQ(send_message(0x49, 38982, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 38982); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 32) - << "incorrect value for header.n_obs, expected 32, is " - << last_msg_->header.n_obs; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 414670600) - << "incorrect value for header.t.tow, expected 414670600, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 1898) - << "incorrect value for header.t.wn, expected 1898, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 231) - << "incorrect value for obs[0].L.f, expected 231, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - -565647) - << "incorrect value for obs[0].L.i, expected -565647, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 1347025534) - << "incorrect value for obs[0].P, expected 1347025534, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].cn0)>( - reinterpret_cast(&last_msg_->obs[0].cn0)), - 163) - << "incorrect value for obs[0].cn0, expected 163, is " - << last_msg_->obs[0].cn0; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 58853) - << "incorrect value for obs[0].lock, expected 58853, is " - << last_msg_->obs[0].lock; - EXPECT_EQ(get_asobs[0].sid.code)>( - reinterpret_cast(&last_msg_->obs[0].sid.code)), - 0) - << "incorrect value for obs[0].sid.code, expected 0, is " - << last_msg_->obs[0].sid.code; - EXPECT_EQ( - get_asobs[0].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[0].sid.reserved)), - 0) - << "incorrect value for obs[0].sid.reserved, expected 0, is " - << last_msg_->obs[0].sid.reserved; - EXPECT_EQ(get_asobs[0].sid.sat)>( - reinterpret_cast(&last_msg_->obs[0].sid.sat)), - 4) - << "incorrect value for obs[0].sid.sat, expected 4, is " - << last_msg_->obs[0].sid.sat; - EXPECT_EQ(get_asobs[1].L.f)>( - reinterpret_cast(&last_msg_->obs[1].L.f)), - 196) - << "incorrect value for obs[1].L.f, expected 196, is " - << last_msg_->obs[1].L.f; - EXPECT_EQ(get_asobs[1].L.i)>( - reinterpret_cast(&last_msg_->obs[1].L.i)), - -355503) - << "incorrect value for obs[1].L.i, expected -355503, is " - << last_msg_->obs[1].L.i; - EXPECT_EQ(get_asobs[1].P)>( - reinterpret_cast(&last_msg_->obs[1].P)), - 1180752956) - << "incorrect value for obs[1].P, expected 1180752956, is " - << last_msg_->obs[1].P; - EXPECT_EQ(get_asobs[1].cn0)>( - reinterpret_cast(&last_msg_->obs[1].cn0)), - 208) - << "incorrect value for obs[1].cn0, expected 208, is " - << last_msg_->obs[1].cn0; - EXPECT_EQ(get_asobs[1].lock)>( - reinterpret_cast(&last_msg_->obs[1].lock)), - 7188) - << "incorrect value for obs[1].lock, expected 7188, is " - << last_msg_->obs[1].lock; - EXPECT_EQ(get_asobs[1].sid.code)>( - reinterpret_cast(&last_msg_->obs[1].sid.code)), - 0) - << "incorrect value for obs[1].sid.code, expected 0, is " - << last_msg_->obs[1].sid.code; - EXPECT_EQ( - get_asobs[1].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[1].sid.reserved)), - 0) - << "incorrect value for obs[1].sid.reserved, expected 0, is " - << last_msg_->obs[1].sid.reserved; - EXPECT_EQ(get_asobs[1].sid.sat)>( - reinterpret_cast(&last_msg_->obs[1].sid.sat)), - 6) - << "incorrect value for obs[1].sid.sat, expected 6, is " - << last_msg_->obs[1].sid.sat; - EXPECT_EQ(get_asobs[2].L.f)>( - reinterpret_cast(&last_msg_->obs[2].L.f)), - 110) - << "incorrect value for obs[2].L.f, expected 110, is " - << last_msg_->obs[2].L.f; - EXPECT_EQ(get_asobs[2].L.i)>( - reinterpret_cast(&last_msg_->obs[2].L.i)), - -902116) - << "incorrect value for obs[2].L.i, expected -902116, is " - << last_msg_->obs[2].L.i; - EXPECT_EQ(get_asobs[2].P)>( - reinterpret_cast(&last_msg_->obs[2].P)), - 1295924728) - << "incorrect value for obs[2].P, expected 1295924728, is " - << last_msg_->obs[2].P; - EXPECT_EQ(get_asobs[2].cn0)>( - reinterpret_cast(&last_msg_->obs[2].cn0)), - 171) - << "incorrect value for obs[2].cn0, expected 171, is " - << last_msg_->obs[2].cn0; - EXPECT_EQ(get_asobs[2].lock)>( - reinterpret_cast(&last_msg_->obs[2].lock)), - 45748) - << "incorrect value for obs[2].lock, expected 45748, is " - << last_msg_->obs[2].lock; - EXPECT_EQ(get_asobs[2].sid.code)>( - reinterpret_cast(&last_msg_->obs[2].sid.code)), - 0) - << "incorrect value for obs[2].sid.code, expected 0, is " - << last_msg_->obs[2].sid.code; - EXPECT_EQ( - get_asobs[2].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[2].sid.reserved)), - 0) - << "incorrect value for obs[2].sid.reserved, expected 0, is " - << last_msg_->obs[2].sid.reserved; - EXPECT_EQ(get_asobs[2].sid.sat)>( - reinterpret_cast(&last_msg_->obs[2].sid.sat)), - 7) - << "incorrect value for obs[2].sid.sat, expected 7, is " - << last_msg_->obs[2].sid.sat; - EXPECT_EQ(get_asobs[3].L.f)>( - reinterpret_cast(&last_msg_->obs[3].L.f)), - 41) - << "incorrect value for obs[3].L.f, expected 41, is " - << last_msg_->obs[3].L.f; - EXPECT_EQ(get_asobs[3].L.i)>( - reinterpret_cast(&last_msg_->obs[3].L.i)), - 861612) - << "incorrect value for obs[3].L.i, expected 861612, is " - << last_msg_->obs[3].L.i; - EXPECT_EQ(get_asobs[3].P)>( - reinterpret_cast(&last_msg_->obs[3].P)), - 1304319213) - << "incorrect value for obs[3].P, expected 1304319213, is " - << last_msg_->obs[3].P; - EXPECT_EQ(get_asobs[3].cn0)>( - reinterpret_cast(&last_msg_->obs[3].cn0)), - 170) - << "incorrect value for obs[3].cn0, expected 170, is " - << last_msg_->obs[3].cn0; - EXPECT_EQ(get_asobs[3].lock)>( - reinterpret_cast(&last_msg_->obs[3].lock)), - 42217) - << "incorrect value for obs[3].lock, expected 42217, is " - << last_msg_->obs[3].lock; - EXPECT_EQ(get_asobs[3].sid.code)>( - reinterpret_cast(&last_msg_->obs[3].sid.code)), - 0) - << "incorrect value for obs[3].sid.code, expected 0, is " - << last_msg_->obs[3].sid.code; - EXPECT_EQ( - get_asobs[3].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[3].sid.reserved)), - 0) - << "incorrect value for obs[3].sid.reserved, expected 0, is " - << last_msg_->obs[3].sid.reserved; - EXPECT_EQ(get_asobs[3].sid.sat)>( - reinterpret_cast(&last_msg_->obs[3].sid.sat)), - 10) - << "incorrect value for obs[3].sid.sat, expected 10, is " - << last_msg_->obs[3].sid.sat; - EXPECT_EQ(get_asobs[4].L.f)>( - reinterpret_cast(&last_msg_->obs[4].L.f)), - 19) - << "incorrect value for obs[4].L.f, expected 19, is " - << last_msg_->obs[4].L.f; - EXPECT_EQ(get_asobs[4].L.i)>( - reinterpret_cast(&last_msg_->obs[4].L.i)), - 1424624) - << "incorrect value for obs[4].L.i, expected 1424624, is " - << last_msg_->obs[4].L.i; - EXPECT_EQ(get_asobs[4].P)>( - reinterpret_cast(&last_msg_->obs[4].P)), - 1258902820) - << "incorrect value for obs[4].P, expected 1258902820, is " - << last_msg_->obs[4].P; - EXPECT_EQ(get_asobs[4].cn0)>( - reinterpret_cast(&last_msg_->obs[4].cn0)), - 182) - << "incorrect value for obs[4].cn0, expected 182, is " - << last_msg_->obs[4].cn0; - EXPECT_EQ(get_asobs[4].lock)>( - reinterpret_cast(&last_msg_->obs[4].lock)), - 53700) - << "incorrect value for obs[4].lock, expected 53700, is " - << last_msg_->obs[4].lock; - EXPECT_EQ(get_asobs[4].sid.code)>( - reinterpret_cast(&last_msg_->obs[4].sid.code)), - 0) - << "incorrect value for obs[4].sid.code, expected 0, is " - << last_msg_->obs[4].sid.code; - EXPECT_EQ( - get_asobs[4].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[4].sid.reserved)), - 0) - << "incorrect value for obs[4].sid.reserved, expected 0, is " - << last_msg_->obs[4].sid.reserved; - EXPECT_EQ(get_asobs[4].sid.sat)>( - reinterpret_cast(&last_msg_->obs[4].sid.sat)), - 12) - << "incorrect value for obs[4].sid.sat, expected 12, is " - << last_msg_->obs[4].sid.sat; -} -class Test_legacy_auto_check_sbp_observation_MsgObsDepC1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgObsDepC1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_dep_c_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_dep_c_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgObsDepC1, Test) { - uint8_t encoded_frame[] = { - 85, 73, 0, 70, 152, 55, 8, 95, 183, 24, 106, 7, 33, 68, 166, 75, - 77, 186, 230, 24, 0, 101, 186, 162, 102, 16, 0, 0, 0, 87, 255, 155, - 69, 74, 158, 5, 0, 26, 190, 206, 30, 27, 0, 0, 0, 64, 89, 124, - 68, 26, 22, 3, 0, 114, 217, 225, 73, 29, 0, 0, 0, 37, 179, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_dep_c_t *test_msg = (msg_obs_dep_c_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 33; - test_msg->header.t.tow = 414670600; - test_msg->header.t.wn = 1898; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].L.f = 101; - test_msg->obs[0].L.i = 1631930; - test_msg->obs[0].P = 1296803396; - test_msg->obs[0].cn0 = 186; - test_msg->obs[0].lock = 26274; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 16; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[1].L.f = 26; - test_msg->obs[1].L.i = 368202; - test_msg->obs[1].P = 1167851351; - test_msg->obs[1].cn0 = 190; - test_msg->obs[1].lock = 7886; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 27; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[2].L.f = 114; - test_msg->obs[2].L.i = 202266; - test_msg->obs[2].P = 1149000000; - test_msg->obs[2].cn0 = 217; - test_msg->obs[2].lock = 18913; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 29; - - EXPECT_EQ(send_message(0x49, 38982, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 38982); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 33) - << "incorrect value for header.n_obs, expected 33, is " - << last_msg_->header.n_obs; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 414670600) - << "incorrect value for header.t.tow, expected 414670600, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 1898) - << "incorrect value for header.t.wn, expected 1898, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 101) - << "incorrect value for obs[0].L.f, expected 101, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - 1631930) - << "incorrect value for obs[0].L.i, expected 1631930, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 1296803396) - << "incorrect value for obs[0].P, expected 1296803396, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].cn0)>( - reinterpret_cast(&last_msg_->obs[0].cn0)), - 186) - << "incorrect value for obs[0].cn0, expected 186, is " - << last_msg_->obs[0].cn0; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 26274) - << "incorrect value for obs[0].lock, expected 26274, is " - << last_msg_->obs[0].lock; - EXPECT_EQ(get_asobs[0].sid.code)>( - reinterpret_cast(&last_msg_->obs[0].sid.code)), - 0) - << "incorrect value for obs[0].sid.code, expected 0, is " - << last_msg_->obs[0].sid.code; - EXPECT_EQ( - get_asobs[0].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[0].sid.reserved)), - 0) - << "incorrect value for obs[0].sid.reserved, expected 0, is " - << last_msg_->obs[0].sid.reserved; - EXPECT_EQ(get_asobs[0].sid.sat)>( - reinterpret_cast(&last_msg_->obs[0].sid.sat)), - 16) - << "incorrect value for obs[0].sid.sat, expected 16, is " - << last_msg_->obs[0].sid.sat; - EXPECT_EQ(get_asobs[1].L.f)>( - reinterpret_cast(&last_msg_->obs[1].L.f)), - 26) - << "incorrect value for obs[1].L.f, expected 26, is " - << last_msg_->obs[1].L.f; - EXPECT_EQ(get_asobs[1].L.i)>( - reinterpret_cast(&last_msg_->obs[1].L.i)), - 368202) - << "incorrect value for obs[1].L.i, expected 368202, is " - << last_msg_->obs[1].L.i; - EXPECT_EQ(get_asobs[1].P)>( - reinterpret_cast(&last_msg_->obs[1].P)), - 1167851351) - << "incorrect value for obs[1].P, expected 1167851351, is " - << last_msg_->obs[1].P; - EXPECT_EQ(get_asobs[1].cn0)>( - reinterpret_cast(&last_msg_->obs[1].cn0)), - 190) - << "incorrect value for obs[1].cn0, expected 190, is " - << last_msg_->obs[1].cn0; - EXPECT_EQ(get_asobs[1].lock)>( - reinterpret_cast(&last_msg_->obs[1].lock)), - 7886) - << "incorrect value for obs[1].lock, expected 7886, is " - << last_msg_->obs[1].lock; - EXPECT_EQ(get_asobs[1].sid.code)>( - reinterpret_cast(&last_msg_->obs[1].sid.code)), - 0) - << "incorrect value for obs[1].sid.code, expected 0, is " - << last_msg_->obs[1].sid.code; - EXPECT_EQ( - get_asobs[1].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[1].sid.reserved)), - 0) - << "incorrect value for obs[1].sid.reserved, expected 0, is " - << last_msg_->obs[1].sid.reserved; - EXPECT_EQ(get_asobs[1].sid.sat)>( - reinterpret_cast(&last_msg_->obs[1].sid.sat)), - 27) - << "incorrect value for obs[1].sid.sat, expected 27, is " - << last_msg_->obs[1].sid.sat; - EXPECT_EQ(get_asobs[2].L.f)>( - reinterpret_cast(&last_msg_->obs[2].L.f)), - 114) - << "incorrect value for obs[2].L.f, expected 114, is " - << last_msg_->obs[2].L.f; - EXPECT_EQ(get_asobs[2].L.i)>( - reinterpret_cast(&last_msg_->obs[2].L.i)), - 202266) - << "incorrect value for obs[2].L.i, expected 202266, is " - << last_msg_->obs[2].L.i; - EXPECT_EQ(get_asobs[2].P)>( - reinterpret_cast(&last_msg_->obs[2].P)), - 1149000000) - << "incorrect value for obs[2].P, expected 1149000000, is " - << last_msg_->obs[2].P; - EXPECT_EQ(get_asobs[2].cn0)>( - reinterpret_cast(&last_msg_->obs[2].cn0)), - 217) - << "incorrect value for obs[2].cn0, expected 217, is " - << last_msg_->obs[2].cn0; - EXPECT_EQ(get_asobs[2].lock)>( - reinterpret_cast(&last_msg_->obs[2].lock)), - 18913) - << "incorrect value for obs[2].lock, expected 18913, is " - << last_msg_->obs[2].lock; - EXPECT_EQ(get_asobs[2].sid.code)>( - reinterpret_cast(&last_msg_->obs[2].sid.code)), - 0) - << "incorrect value for obs[2].sid.code, expected 0, is " - << last_msg_->obs[2].sid.code; - EXPECT_EQ( - get_asobs[2].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[2].sid.reserved)), - 0) - << "incorrect value for obs[2].sid.reserved, expected 0, is " - << last_msg_->obs[2].sid.reserved; - EXPECT_EQ(get_asobs[2].sid.sat)>( - reinterpret_cast(&last_msg_->obs[2].sid.sat)), - 29) - << "incorrect value for obs[2].sid.sat, expected 29, is " - << last_msg_->obs[2].sid.sat; -} -class Test_legacy_auto_check_sbp_observation_MsgObsDepC2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgObsDepC2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_dep_c_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_dep_c_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgObsDepC2, Test) { - uint8_t encoded_frame[] = { - 85, 73, 0, 0, 0, 87, 8, 95, 183, 24, 106, 7, 32, 217, 251, 73, - 80, 9, 72, 248, 255, 30, 168, 113, 81, 4, 0, 0, 0, 211, 220, 96, - 70, 198, 107, 251, 255, 115, 195, 53, 144, 6, 0, 0, 0, 77, 61, 62, - 77, 40, 161, 243, 255, 130, 176, 93, 142, 7, 0, 0, 0, 1, 86, 190, - 77, 88, 77, 12, 0, 116, 199, 229, 213, 10, 0, 0, 0, 93, 85, 9, - 75, 64, 139, 20, 0, 120, 177, 196, 194, 12, 0, 0, 0, 141, 161, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_dep_c_t *test_msg = (msg_obs_dep_c_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.tow = 414670600; - test_msg->header.t.wn = 1898; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].L.f = 30; - test_msg->obs[0].L.i = -505847; - test_msg->obs[0].P = 1347025881; - test_msg->obs[0].cn0 = 168; - test_msg->obs[0].lock = 20849; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 4; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[1].L.f = 115; - test_msg->obs[1].L.i = -300090; - test_msg->obs[1].P = 1180753107; - test_msg->obs[1].cn0 = 195; - test_msg->obs[1].lock = 36917; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 6; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[2].L.f = 130; - test_msg->obs[2].L.i = -810712; - test_msg->obs[2].P = 1295924557; - test_msg->obs[2].cn0 = 176; - test_msg->obs[2].lock = 36445; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 7; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[3].L.f = 116; - test_msg->obs[3].L.i = 806232; - test_msg->obs[3].P = 1304319489; - test_msg->obs[3].cn0 = 199; - test_msg->obs[3].lock = 54757; - test_msg->obs[3].sid.code = 0; - test_msg->obs[3].sid.reserved = 0; - test_msg->obs[3].sid.sat = 10; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[4].L.f = 120; - test_msg->obs[4].L.i = 1346368; - test_msg->obs[4].P = 1258902877; - test_msg->obs[4].cn0 = 177; - test_msg->obs[4].lock = 49860; - test_msg->obs[4].sid.code = 0; - test_msg->obs[4].sid.reserved = 0; - test_msg->obs[4].sid.sat = 12; - - EXPECT_EQ(send_message(0x49, 0, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 0); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 32) - << "incorrect value for header.n_obs, expected 32, is " - << last_msg_->header.n_obs; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 414670600) - << "incorrect value for header.t.tow, expected 414670600, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 1898) - << "incorrect value for header.t.wn, expected 1898, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 30) - << "incorrect value for obs[0].L.f, expected 30, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - -505847) - << "incorrect value for obs[0].L.i, expected -505847, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 1347025881) - << "incorrect value for obs[0].P, expected 1347025881, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].cn0)>( - reinterpret_cast(&last_msg_->obs[0].cn0)), - 168) - << "incorrect value for obs[0].cn0, expected 168, is " - << last_msg_->obs[0].cn0; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 20849) - << "incorrect value for obs[0].lock, expected 20849, is " - << last_msg_->obs[0].lock; - EXPECT_EQ(get_asobs[0].sid.code)>( - reinterpret_cast(&last_msg_->obs[0].sid.code)), - 0) - << "incorrect value for obs[0].sid.code, expected 0, is " - << last_msg_->obs[0].sid.code; - EXPECT_EQ( - get_asobs[0].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[0].sid.reserved)), - 0) - << "incorrect value for obs[0].sid.reserved, expected 0, is " - << last_msg_->obs[0].sid.reserved; - EXPECT_EQ(get_asobs[0].sid.sat)>( - reinterpret_cast(&last_msg_->obs[0].sid.sat)), - 4) - << "incorrect value for obs[0].sid.sat, expected 4, is " - << last_msg_->obs[0].sid.sat; - EXPECT_EQ(get_asobs[1].L.f)>( - reinterpret_cast(&last_msg_->obs[1].L.f)), - 115) - << "incorrect value for obs[1].L.f, expected 115, is " - << last_msg_->obs[1].L.f; - EXPECT_EQ(get_asobs[1].L.i)>( - reinterpret_cast(&last_msg_->obs[1].L.i)), - -300090) - << "incorrect value for obs[1].L.i, expected -300090, is " - << last_msg_->obs[1].L.i; - EXPECT_EQ(get_asobs[1].P)>( - reinterpret_cast(&last_msg_->obs[1].P)), - 1180753107) - << "incorrect value for obs[1].P, expected 1180753107, is " - << last_msg_->obs[1].P; - EXPECT_EQ(get_asobs[1].cn0)>( - reinterpret_cast(&last_msg_->obs[1].cn0)), - 195) - << "incorrect value for obs[1].cn0, expected 195, is " - << last_msg_->obs[1].cn0; - EXPECT_EQ(get_asobs[1].lock)>( - reinterpret_cast(&last_msg_->obs[1].lock)), - 36917) - << "incorrect value for obs[1].lock, expected 36917, is " - << last_msg_->obs[1].lock; - EXPECT_EQ(get_asobs[1].sid.code)>( - reinterpret_cast(&last_msg_->obs[1].sid.code)), - 0) - << "incorrect value for obs[1].sid.code, expected 0, is " - << last_msg_->obs[1].sid.code; - EXPECT_EQ( - get_asobs[1].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[1].sid.reserved)), - 0) - << "incorrect value for obs[1].sid.reserved, expected 0, is " - << last_msg_->obs[1].sid.reserved; - EXPECT_EQ(get_asobs[1].sid.sat)>( - reinterpret_cast(&last_msg_->obs[1].sid.sat)), - 6) - << "incorrect value for obs[1].sid.sat, expected 6, is " - << last_msg_->obs[1].sid.sat; - EXPECT_EQ(get_asobs[2].L.f)>( - reinterpret_cast(&last_msg_->obs[2].L.f)), - 130) - << "incorrect value for obs[2].L.f, expected 130, is " - << last_msg_->obs[2].L.f; - EXPECT_EQ(get_asobs[2].L.i)>( - reinterpret_cast(&last_msg_->obs[2].L.i)), - -810712) - << "incorrect value for obs[2].L.i, expected -810712, is " - << last_msg_->obs[2].L.i; - EXPECT_EQ(get_asobs[2].P)>( - reinterpret_cast(&last_msg_->obs[2].P)), - 1295924557) - << "incorrect value for obs[2].P, expected 1295924557, is " - << last_msg_->obs[2].P; - EXPECT_EQ(get_asobs[2].cn0)>( - reinterpret_cast(&last_msg_->obs[2].cn0)), - 176) - << "incorrect value for obs[2].cn0, expected 176, is " - << last_msg_->obs[2].cn0; - EXPECT_EQ(get_asobs[2].lock)>( - reinterpret_cast(&last_msg_->obs[2].lock)), - 36445) - << "incorrect value for obs[2].lock, expected 36445, is " - << last_msg_->obs[2].lock; - EXPECT_EQ(get_asobs[2].sid.code)>( - reinterpret_cast(&last_msg_->obs[2].sid.code)), - 0) - << "incorrect value for obs[2].sid.code, expected 0, is " - << last_msg_->obs[2].sid.code; - EXPECT_EQ( - get_asobs[2].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[2].sid.reserved)), - 0) - << "incorrect value for obs[2].sid.reserved, expected 0, is " - << last_msg_->obs[2].sid.reserved; - EXPECT_EQ(get_asobs[2].sid.sat)>( - reinterpret_cast(&last_msg_->obs[2].sid.sat)), - 7) - << "incorrect value for obs[2].sid.sat, expected 7, is " - << last_msg_->obs[2].sid.sat; - EXPECT_EQ(get_asobs[3].L.f)>( - reinterpret_cast(&last_msg_->obs[3].L.f)), - 116) - << "incorrect value for obs[3].L.f, expected 116, is " - << last_msg_->obs[3].L.f; - EXPECT_EQ(get_asobs[3].L.i)>( - reinterpret_cast(&last_msg_->obs[3].L.i)), - 806232) - << "incorrect value for obs[3].L.i, expected 806232, is " - << last_msg_->obs[3].L.i; - EXPECT_EQ(get_asobs[3].P)>( - reinterpret_cast(&last_msg_->obs[3].P)), - 1304319489) - << "incorrect value for obs[3].P, expected 1304319489, is " - << last_msg_->obs[3].P; - EXPECT_EQ(get_asobs[3].cn0)>( - reinterpret_cast(&last_msg_->obs[3].cn0)), - 199) - << "incorrect value for obs[3].cn0, expected 199, is " - << last_msg_->obs[3].cn0; - EXPECT_EQ(get_asobs[3].lock)>( - reinterpret_cast(&last_msg_->obs[3].lock)), - 54757) - << "incorrect value for obs[3].lock, expected 54757, is " - << last_msg_->obs[3].lock; - EXPECT_EQ(get_asobs[3].sid.code)>( - reinterpret_cast(&last_msg_->obs[3].sid.code)), - 0) - << "incorrect value for obs[3].sid.code, expected 0, is " - << last_msg_->obs[3].sid.code; - EXPECT_EQ( - get_asobs[3].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[3].sid.reserved)), - 0) - << "incorrect value for obs[3].sid.reserved, expected 0, is " - << last_msg_->obs[3].sid.reserved; - EXPECT_EQ(get_asobs[3].sid.sat)>( - reinterpret_cast(&last_msg_->obs[3].sid.sat)), - 10) - << "incorrect value for obs[3].sid.sat, expected 10, is " - << last_msg_->obs[3].sid.sat; - EXPECT_EQ(get_asobs[4].L.f)>( - reinterpret_cast(&last_msg_->obs[4].L.f)), - 120) - << "incorrect value for obs[4].L.f, expected 120, is " - << last_msg_->obs[4].L.f; - EXPECT_EQ(get_asobs[4].L.i)>( - reinterpret_cast(&last_msg_->obs[4].L.i)), - 1346368) - << "incorrect value for obs[4].L.i, expected 1346368, is " - << last_msg_->obs[4].L.i; - EXPECT_EQ(get_asobs[4].P)>( - reinterpret_cast(&last_msg_->obs[4].P)), - 1258902877) - << "incorrect value for obs[4].P, expected 1258902877, is " - << last_msg_->obs[4].P; - EXPECT_EQ(get_asobs[4].cn0)>( - reinterpret_cast(&last_msg_->obs[4].cn0)), - 177) - << "incorrect value for obs[4].cn0, expected 177, is " - << last_msg_->obs[4].cn0; - EXPECT_EQ(get_asobs[4].lock)>( - reinterpret_cast(&last_msg_->obs[4].lock)), - 49860) - << "incorrect value for obs[4].lock, expected 49860, is " - << last_msg_->obs[4].lock; - EXPECT_EQ(get_asobs[4].sid.code)>( - reinterpret_cast(&last_msg_->obs[4].sid.code)), - 0) - << "incorrect value for obs[4].sid.code, expected 0, is " - << last_msg_->obs[4].sid.code; - EXPECT_EQ( - get_asobs[4].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[4].sid.reserved)), - 0) - << "incorrect value for obs[4].sid.reserved, expected 0, is " - << last_msg_->obs[4].sid.reserved; - EXPECT_EQ(get_asobs[4].sid.sat)>( - reinterpret_cast(&last_msg_->obs[4].sid.sat)), - 12) - << "incorrect value for obs[4].sid.sat, expected 12, is " - << last_msg_->obs[4].sid.sat; -} -class Test_legacy_auto_check_sbp_observation_MsgObsDepC3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgObsDepC3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_dep_c_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_dep_c_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgObsDepC3, Test) { - uint8_t encoded_frame[] = { - 85, 73, 0, 0, 0, 55, 8, 95, 183, 24, 106, 7, 33, 70, 167, 75, - 77, 140, 136, 23, 0, 90, 187, 158, 129, 16, 0, 0, 0, 232, 255, 155, - 69, 45, 175, 5, 0, 17, 208, 175, 56, 27, 0, 0, 0, 64, 89, 124, - 68, 45, 96, 3, 0, 75, 185, 73, 206, 29, 0, 0, 0, 220, 158, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_dep_c_t *test_msg = (msg_obs_dep_c_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 33; - test_msg->header.t.tow = 414670600; - test_msg->header.t.wn = 1898; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].L.f = 90; - test_msg->obs[0].L.i = 1542284; - test_msg->obs[0].P = 1296803654; - test_msg->obs[0].cn0 = 187; - test_msg->obs[0].lock = 33182; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 16; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[1].L.f = 17; - test_msg->obs[1].L.i = 372525; - test_msg->obs[1].P = 1167851496; - test_msg->obs[1].cn0 = 208; - test_msg->obs[1].lock = 14511; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 27; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[2].L.f = 75; - test_msg->obs[2].L.i = 221229; - test_msg->obs[2].P = 1149000000; - test_msg->obs[2].cn0 = 185; - test_msg->obs[2].lock = 52809; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 29; - - EXPECT_EQ(send_message(0x49, 0, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 0); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 33) - << "incorrect value for header.n_obs, expected 33, is " - << last_msg_->header.n_obs; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 414670600) - << "incorrect value for header.t.tow, expected 414670600, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 1898) - << "incorrect value for header.t.wn, expected 1898, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 90) - << "incorrect value for obs[0].L.f, expected 90, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - 1542284) - << "incorrect value for obs[0].L.i, expected 1542284, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 1296803654) - << "incorrect value for obs[0].P, expected 1296803654, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].cn0)>( - reinterpret_cast(&last_msg_->obs[0].cn0)), - 187) - << "incorrect value for obs[0].cn0, expected 187, is " - << last_msg_->obs[0].cn0; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 33182) - << "incorrect value for obs[0].lock, expected 33182, is " - << last_msg_->obs[0].lock; - EXPECT_EQ(get_asobs[0].sid.code)>( - reinterpret_cast(&last_msg_->obs[0].sid.code)), - 0) - << "incorrect value for obs[0].sid.code, expected 0, is " - << last_msg_->obs[0].sid.code; - EXPECT_EQ( - get_asobs[0].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[0].sid.reserved)), - 0) - << "incorrect value for obs[0].sid.reserved, expected 0, is " - << last_msg_->obs[0].sid.reserved; - EXPECT_EQ(get_asobs[0].sid.sat)>( - reinterpret_cast(&last_msg_->obs[0].sid.sat)), - 16) - << "incorrect value for obs[0].sid.sat, expected 16, is " - << last_msg_->obs[0].sid.sat; - EXPECT_EQ(get_asobs[1].L.f)>( - reinterpret_cast(&last_msg_->obs[1].L.f)), - 17) - << "incorrect value for obs[1].L.f, expected 17, is " - << last_msg_->obs[1].L.f; - EXPECT_EQ(get_asobs[1].L.i)>( - reinterpret_cast(&last_msg_->obs[1].L.i)), - 372525) - << "incorrect value for obs[1].L.i, expected 372525, is " - << last_msg_->obs[1].L.i; - EXPECT_EQ(get_asobs[1].P)>( - reinterpret_cast(&last_msg_->obs[1].P)), - 1167851496) - << "incorrect value for obs[1].P, expected 1167851496, is " - << last_msg_->obs[1].P; - EXPECT_EQ(get_asobs[1].cn0)>( - reinterpret_cast(&last_msg_->obs[1].cn0)), - 208) - << "incorrect value for obs[1].cn0, expected 208, is " - << last_msg_->obs[1].cn0; - EXPECT_EQ(get_asobs[1].lock)>( - reinterpret_cast(&last_msg_->obs[1].lock)), - 14511) - << "incorrect value for obs[1].lock, expected 14511, is " - << last_msg_->obs[1].lock; - EXPECT_EQ(get_asobs[1].sid.code)>( - reinterpret_cast(&last_msg_->obs[1].sid.code)), - 0) - << "incorrect value for obs[1].sid.code, expected 0, is " - << last_msg_->obs[1].sid.code; - EXPECT_EQ( - get_asobs[1].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[1].sid.reserved)), - 0) - << "incorrect value for obs[1].sid.reserved, expected 0, is " - << last_msg_->obs[1].sid.reserved; - EXPECT_EQ(get_asobs[1].sid.sat)>( - reinterpret_cast(&last_msg_->obs[1].sid.sat)), - 27) - << "incorrect value for obs[1].sid.sat, expected 27, is " - << last_msg_->obs[1].sid.sat; - EXPECT_EQ(get_asobs[2].L.f)>( - reinterpret_cast(&last_msg_->obs[2].L.f)), - 75) - << "incorrect value for obs[2].L.f, expected 75, is " - << last_msg_->obs[2].L.f; - EXPECT_EQ(get_asobs[2].L.i)>( - reinterpret_cast(&last_msg_->obs[2].L.i)), - 221229) - << "incorrect value for obs[2].L.i, expected 221229, is " - << last_msg_->obs[2].L.i; - EXPECT_EQ(get_asobs[2].P)>( - reinterpret_cast(&last_msg_->obs[2].P)), - 1149000000) - << "incorrect value for obs[2].P, expected 1149000000, is " - << last_msg_->obs[2].P; - EXPECT_EQ(get_asobs[2].cn0)>( - reinterpret_cast(&last_msg_->obs[2].cn0)), - 185) - << "incorrect value for obs[2].cn0, expected 185, is " - << last_msg_->obs[2].cn0; - EXPECT_EQ(get_asobs[2].lock)>( - reinterpret_cast(&last_msg_->obs[2].lock)), - 52809) - << "incorrect value for obs[2].lock, expected 52809, is " - << last_msg_->obs[2].lock; - EXPECT_EQ(get_asobs[2].sid.code)>( - reinterpret_cast(&last_msg_->obs[2].sid.code)), - 0) - << "incorrect value for obs[2].sid.code, expected 0, is " - << last_msg_->obs[2].sid.code; - EXPECT_EQ( - get_asobs[2].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[2].sid.reserved)), - 0) - << "incorrect value for obs[2].sid.reserved, expected 0, is " - << last_msg_->obs[2].sid.reserved; - EXPECT_EQ(get_asobs[2].sid.sat)>( - reinterpret_cast(&last_msg_->obs[2].sid.sat)), - 29) - << "incorrect value for obs[2].sid.sat, expected 29, is " - << last_msg_->obs[2].sid.sat; -} -class Test_legacy_auto_check_sbp_observation_MsgObsDepC4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgObsDepC4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_dep_c_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_dep_c_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgObsDepC4, Test) { - uint8_t encoded_frame[] = { - 85, 73, 0, 70, 152, 87, 208, 95, 183, 24, 106, 7, 32, 44, 8, 74, - 80, 86, 93, 247, 255, 57, 158, 229, 229, 4, 0, 0, 0, 224, 229, 96, - 70, 156, 146, 250, 255, 221, 200, 20, 28, 6, 0, 0, 0, 60, 82, 62, - 77, 93, 58, 242, 255, 39, 164, 180, 178, 7, 0, 0, 0, 222, 73, 190, - 77, 46, 39, 13, 0, 202, 181, 233, 164, 10, 0, 0, 0, 149, 64, 9, - 75, 114, 191, 21, 0, 249, 182, 196, 209, 12, 0, 0, 0, 112, 8, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_dep_c_t *test_msg = (msg_obs_dep_c_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.tow = 414670800; - test_msg->header.t.wn = 1898; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].L.f = 57; - test_msg->obs[0].L.i = -565930; - test_msg->obs[0].P = 1347029036; - test_msg->obs[0].cn0 = 158; - test_msg->obs[0].lock = 58853; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.reserved = 0; - test_msg->obs[0].sid.sat = 4; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[1].L.f = 221; - test_msg->obs[1].L.i = -355684; - test_msg->obs[1].P = 1180755424; - test_msg->obs[1].cn0 = 200; - test_msg->obs[1].lock = 7188; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.reserved = 0; - test_msg->obs[1].sid.sat = 6; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[2].L.f = 39; - test_msg->obs[2].L.i = -902563; - test_msg->obs[2].P = 1295929916; - test_msg->obs[2].cn0 = 164; - test_msg->obs[2].lock = 45748; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.reserved = 0; - test_msg->obs[2].sid.sat = 7; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[3].L.f = 202; - test_msg->obs[3].L.i = 861998; - test_msg->obs[3].P = 1304316382; - test_msg->obs[3].cn0 = 181; - test_msg->obs[3].lock = 42217; - test_msg->obs[3].sid.code = 0; - test_msg->obs[3].sid.reserved = 0; - test_msg->obs[3].sid.sat = 10; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[4].L.f = 249; - test_msg->obs[4].L.i = 1425266; - test_msg->obs[4].P = 1258897557; - test_msg->obs[4].cn0 = 182; - test_msg->obs[4].lock = 53700; - test_msg->obs[4].sid.code = 0; - test_msg->obs[4].sid.reserved = 0; - test_msg->obs[4].sid.sat = 12; - - EXPECT_EQ(send_message(0x49, 38982, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 38982); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 32) - << "incorrect value for header.n_obs, expected 32, is " - << last_msg_->header.n_obs; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 414670800) - << "incorrect value for header.t.tow, expected 414670800, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 1898) - << "incorrect value for header.t.wn, expected 1898, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 57) - << "incorrect value for obs[0].L.f, expected 57, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - -565930) - << "incorrect value for obs[0].L.i, expected -565930, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 1347029036) - << "incorrect value for obs[0].P, expected 1347029036, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].cn0)>( - reinterpret_cast(&last_msg_->obs[0].cn0)), - 158) - << "incorrect value for obs[0].cn0, expected 158, is " - << last_msg_->obs[0].cn0; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 58853) - << "incorrect value for obs[0].lock, expected 58853, is " - << last_msg_->obs[0].lock; - EXPECT_EQ(get_asobs[0].sid.code)>( - reinterpret_cast(&last_msg_->obs[0].sid.code)), - 0) - << "incorrect value for obs[0].sid.code, expected 0, is " - << last_msg_->obs[0].sid.code; - EXPECT_EQ( - get_asobs[0].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[0].sid.reserved)), - 0) - << "incorrect value for obs[0].sid.reserved, expected 0, is " - << last_msg_->obs[0].sid.reserved; - EXPECT_EQ(get_asobs[0].sid.sat)>( - reinterpret_cast(&last_msg_->obs[0].sid.sat)), - 4) - << "incorrect value for obs[0].sid.sat, expected 4, is " - << last_msg_->obs[0].sid.sat; - EXPECT_EQ(get_asobs[1].L.f)>( - reinterpret_cast(&last_msg_->obs[1].L.f)), - 221) - << "incorrect value for obs[1].L.f, expected 221, is " - << last_msg_->obs[1].L.f; - EXPECT_EQ(get_asobs[1].L.i)>( - reinterpret_cast(&last_msg_->obs[1].L.i)), - -355684) - << "incorrect value for obs[1].L.i, expected -355684, is " - << last_msg_->obs[1].L.i; - EXPECT_EQ(get_asobs[1].P)>( - reinterpret_cast(&last_msg_->obs[1].P)), - 1180755424) - << "incorrect value for obs[1].P, expected 1180755424, is " - << last_msg_->obs[1].P; - EXPECT_EQ(get_asobs[1].cn0)>( - reinterpret_cast(&last_msg_->obs[1].cn0)), - 200) - << "incorrect value for obs[1].cn0, expected 200, is " - << last_msg_->obs[1].cn0; - EXPECT_EQ(get_asobs[1].lock)>( - reinterpret_cast(&last_msg_->obs[1].lock)), - 7188) - << "incorrect value for obs[1].lock, expected 7188, is " - << last_msg_->obs[1].lock; - EXPECT_EQ(get_asobs[1].sid.code)>( - reinterpret_cast(&last_msg_->obs[1].sid.code)), - 0) - << "incorrect value for obs[1].sid.code, expected 0, is " - << last_msg_->obs[1].sid.code; - EXPECT_EQ( - get_asobs[1].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[1].sid.reserved)), - 0) - << "incorrect value for obs[1].sid.reserved, expected 0, is " - << last_msg_->obs[1].sid.reserved; - EXPECT_EQ(get_asobs[1].sid.sat)>( - reinterpret_cast(&last_msg_->obs[1].sid.sat)), - 6) - << "incorrect value for obs[1].sid.sat, expected 6, is " - << last_msg_->obs[1].sid.sat; - EXPECT_EQ(get_asobs[2].L.f)>( - reinterpret_cast(&last_msg_->obs[2].L.f)), - 39) - << "incorrect value for obs[2].L.f, expected 39, is " - << last_msg_->obs[2].L.f; - EXPECT_EQ(get_asobs[2].L.i)>( - reinterpret_cast(&last_msg_->obs[2].L.i)), - -902563) - << "incorrect value for obs[2].L.i, expected -902563, is " - << last_msg_->obs[2].L.i; - EXPECT_EQ(get_asobs[2].P)>( - reinterpret_cast(&last_msg_->obs[2].P)), - 1295929916) - << "incorrect value for obs[2].P, expected 1295929916, is " - << last_msg_->obs[2].P; - EXPECT_EQ(get_asobs[2].cn0)>( - reinterpret_cast(&last_msg_->obs[2].cn0)), - 164) - << "incorrect value for obs[2].cn0, expected 164, is " - << last_msg_->obs[2].cn0; - EXPECT_EQ(get_asobs[2].lock)>( - reinterpret_cast(&last_msg_->obs[2].lock)), - 45748) - << "incorrect value for obs[2].lock, expected 45748, is " - << last_msg_->obs[2].lock; - EXPECT_EQ(get_asobs[2].sid.code)>( - reinterpret_cast(&last_msg_->obs[2].sid.code)), - 0) - << "incorrect value for obs[2].sid.code, expected 0, is " - << last_msg_->obs[2].sid.code; - EXPECT_EQ( - get_asobs[2].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[2].sid.reserved)), - 0) - << "incorrect value for obs[2].sid.reserved, expected 0, is " - << last_msg_->obs[2].sid.reserved; - EXPECT_EQ(get_asobs[2].sid.sat)>( - reinterpret_cast(&last_msg_->obs[2].sid.sat)), - 7) - << "incorrect value for obs[2].sid.sat, expected 7, is " - << last_msg_->obs[2].sid.sat; - EXPECT_EQ(get_asobs[3].L.f)>( - reinterpret_cast(&last_msg_->obs[3].L.f)), - 202) - << "incorrect value for obs[3].L.f, expected 202, is " - << last_msg_->obs[3].L.f; - EXPECT_EQ(get_asobs[3].L.i)>( - reinterpret_cast(&last_msg_->obs[3].L.i)), - 861998) - << "incorrect value for obs[3].L.i, expected 861998, is " - << last_msg_->obs[3].L.i; - EXPECT_EQ(get_asobs[3].P)>( - reinterpret_cast(&last_msg_->obs[3].P)), - 1304316382) - << "incorrect value for obs[3].P, expected 1304316382, is " - << last_msg_->obs[3].P; - EXPECT_EQ(get_asobs[3].cn0)>( - reinterpret_cast(&last_msg_->obs[3].cn0)), - 181) - << "incorrect value for obs[3].cn0, expected 181, is " - << last_msg_->obs[3].cn0; - EXPECT_EQ(get_asobs[3].lock)>( - reinterpret_cast(&last_msg_->obs[3].lock)), - 42217) - << "incorrect value for obs[3].lock, expected 42217, is " - << last_msg_->obs[3].lock; - EXPECT_EQ(get_asobs[3].sid.code)>( - reinterpret_cast(&last_msg_->obs[3].sid.code)), - 0) - << "incorrect value for obs[3].sid.code, expected 0, is " - << last_msg_->obs[3].sid.code; - EXPECT_EQ( - get_asobs[3].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[3].sid.reserved)), - 0) - << "incorrect value for obs[3].sid.reserved, expected 0, is " - << last_msg_->obs[3].sid.reserved; - EXPECT_EQ(get_asobs[3].sid.sat)>( - reinterpret_cast(&last_msg_->obs[3].sid.sat)), - 10) - << "incorrect value for obs[3].sid.sat, expected 10, is " - << last_msg_->obs[3].sid.sat; - EXPECT_EQ(get_asobs[4].L.f)>( - reinterpret_cast(&last_msg_->obs[4].L.f)), - 249) - << "incorrect value for obs[4].L.f, expected 249, is " - << last_msg_->obs[4].L.f; - EXPECT_EQ(get_asobs[4].L.i)>( - reinterpret_cast(&last_msg_->obs[4].L.i)), - 1425266) - << "incorrect value for obs[4].L.i, expected 1425266, is " - << last_msg_->obs[4].L.i; - EXPECT_EQ(get_asobs[4].P)>( - reinterpret_cast(&last_msg_->obs[4].P)), - 1258897557) - << "incorrect value for obs[4].P, expected 1258897557, is " - << last_msg_->obs[4].P; - EXPECT_EQ(get_asobs[4].cn0)>( - reinterpret_cast(&last_msg_->obs[4].cn0)), - 182) - << "incorrect value for obs[4].cn0, expected 182, is " - << last_msg_->obs[4].cn0; - EXPECT_EQ(get_asobs[4].lock)>( - reinterpret_cast(&last_msg_->obs[4].lock)), - 53700) - << "incorrect value for obs[4].lock, expected 53700, is " - << last_msg_->obs[4].lock; - EXPECT_EQ(get_asobs[4].sid.code)>( - reinterpret_cast(&last_msg_->obs[4].sid.code)), - 0) - << "incorrect value for obs[4].sid.code, expected 0, is " - << last_msg_->obs[4].sid.code; - EXPECT_EQ( - get_asobs[4].sid.reserved)>( - reinterpret_cast(&last_msg_->obs[4].sid.reserved)), - 0) - << "incorrect value for obs[4].sid.reserved, expected 0, is " - << last_msg_->obs[4].sid.reserved; - EXPECT_EQ(get_asobs[4].sid.sat)>( - reinterpret_cast(&last_msg_->obs[4].sid.sat)), - 12) - << "incorrect value for obs[4].sid.sat, expected 12, is " - << last_msg_->obs[4].sid.sat; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgOsr.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgOsr.cc deleted file mode 100644 index 770fd24fa5..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgOsr.cc +++ /dev/null @@ -1,956 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgOsr.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgOsr0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgOsr0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_osr_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_osr_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgOsr0, Test) { - uint8_t encoded_frame[] = { - 85, 64, 6, 0, 0, 239, 248, 225, 233, 29, 0, 0, 0, 0, 104, - 8, 64, 75, 143, 241, 68, 230, 250, 62, 7, 66, 15, 3, 1, 0, - 13, 0, 7, 0, 7, 0, 206, 232, 105, 63, 236, 49, 170, 6, 75, - 15, 3, 13, 0, 13, 0, 3, 0, 3, 0, 45, 145, 198, 62, 33, - 7, 153, 6, 128, 15, 3, 14, 0, 13, 0, 3, 0, 3, 0, 89, - 132, 204, 67, 143, 46, 32, 7, 127, 15, 3, 15, 0, 13, 0, 5, - 0, 5, 0, 244, 254, 164, 60, 22, 176, 95, 6, 55, 15, 3, 17, - 0, 0, 0, 2, 0, 2, 0, 106, 157, 101, 62, 151, 214, 142, 6, - 108, 15, 3, 19, 0, 13, 0, 3, 0, 3, 0, 81, 237, 60, 63, - 181, 119, 165, 6, 206, 15, 3, 28, 0, 13, 0, 3, 0, 3, 0, - 134, 228, 110, 64, 183, 159, 197, 6, 200, 15, 3, 30, 0, 13, 0, - 3, 0, 3, 0, 53, 144, 241, 68, 78, 112, 165, 5, 170, 15, 3, - 1, 6, 21, 0, 7, 0, 7, 0, 251, 232, 105, 63, 163, 128, 49, - 5, 129, 15, 3, 13, 6, 21, 0, 3, 0, 3, 0, 112, 145, 198, - 62, 37, 32, 36, 5, 46, 15, 3, 14, 6, 21, 0, 3, 0, 3, - 0, 166, 132, 204, 67, 184, 112, 141, 5, 95, 15, 3, 15, 6, 21, - 0, 5, 0, 5, 0, 121, 227, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_osr_t *test_msg = (msg_osr_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 64; - test_msg->header.t.ns_residual = 0; - test_msg->header.t.tow = 501867000; - test_msg->header.t.wn = 2152; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].L.f = 66; - test_msg->obs[0].L.i = 121567974; - test_msg->obs[0].P = 1156681547; - test_msg->obs[0].flags = 3; - test_msg->obs[0].iono_std = 13; - test_msg->obs[0].lock = 15; - test_msg->obs[0].range_std = 7; - test_msg->obs[0].sid.code = 0; - test_msg->obs[0].sid.sat = 1; - test_msg->obs[0].tropo_std = 7; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[1].L.f = 75; - test_msg->obs[1].L.i = 111817196; - test_msg->obs[1].P = 1063905486; - test_msg->obs[1].flags = 3; - test_msg->obs[1].iono_std = 13; - test_msg->obs[1].lock = 15; - test_msg->obs[1].range_std = 3; - test_msg->obs[1].sid.code = 0; - test_msg->obs[1].sid.sat = 13; - test_msg->obs[1].tropo_std = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[2].L.f = 128; - test_msg->obs[2].L.i = 110692129; - test_msg->obs[2].P = 1053200685; - test_msg->obs[2].flags = 3; - test_msg->obs[2].iono_std = 13; - test_msg->obs[2].lock = 15; - test_msg->obs[2].range_std = 3; - test_msg->obs[2].sid.code = 0; - test_msg->obs[2].sid.sat = 14; - test_msg->obs[2].tropo_std = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[3].L.f = 127; - test_msg->obs[3].L.i = 119549583; - test_msg->obs[3].P = 1137476697; - test_msg->obs[3].flags = 3; - test_msg->obs[3].iono_std = 13; - test_msg->obs[3].lock = 15; - test_msg->obs[3].range_std = 5; - test_msg->obs[3].sid.code = 0; - test_msg->obs[3].sid.sat = 15; - test_msg->obs[3].tropo_std = 5; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[4].L.f = 55; - test_msg->obs[4].L.i = 106934294; - test_msg->obs[4].P = 1017446132; - test_msg->obs[4].flags = 3; - test_msg->obs[4].iono_std = 0; - test_msg->obs[4].lock = 15; - test_msg->obs[4].range_std = 2; - test_msg->obs[4].sid.code = 0; - test_msg->obs[4].sid.sat = 17; - test_msg->obs[4].tropo_std = 2; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[5].L.f = 108; - test_msg->obs[5].L.i = 110024343; - test_msg->obs[5].P = 1046846826; - test_msg->obs[5].flags = 3; - test_msg->obs[5].iono_std = 13; - test_msg->obs[5].lock = 15; - test_msg->obs[5].range_std = 3; - test_msg->obs[5].sid.code = 0; - test_msg->obs[5].sid.sat = 19; - test_msg->obs[5].tropo_std = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[6].L.f = 206; - test_msg->obs[6].L.i = 111507381; - test_msg->obs[6].P = 1060957521; - test_msg->obs[6].flags = 3; - test_msg->obs[6].iono_std = 13; - test_msg->obs[6].lock = 15; - test_msg->obs[6].range_std = 3; - test_msg->obs[6].sid.code = 0; - test_msg->obs[6].sid.sat = 28; - test_msg->obs[6].tropo_std = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[7].L.f = 200; - test_msg->obs[7].L.i = 113614775; - test_msg->obs[7].P = 1081009286; - test_msg->obs[7].flags = 3; - test_msg->obs[7].iono_std = 13; - test_msg->obs[7].lock = 15; - test_msg->obs[7].range_std = 3; - test_msg->obs[7].sid.code = 0; - test_msg->obs[7].sid.sat = 30; - test_msg->obs[7].tropo_std = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[8].L.f = 170; - test_msg->obs[8].L.i = 94728270; - test_msg->obs[8].P = 1156681781; - test_msg->obs[8].flags = 3; - test_msg->obs[8].iono_std = 21; - test_msg->obs[8].lock = 15; - test_msg->obs[8].range_std = 7; - test_msg->obs[8].sid.code = 6; - test_msg->obs[8].sid.sat = 1; - test_msg->obs[8].tropo_std = 7; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[9].L.f = 129; - test_msg->obs[9].L.i = 87130275; - test_msg->obs[9].P = 1063905531; - test_msg->obs[9].flags = 3; - test_msg->obs[9].iono_std = 21; - test_msg->obs[9].lock = 15; - test_msg->obs[9].range_std = 3; - test_msg->obs[9].sid.code = 6; - test_msg->obs[9].sid.sat = 13; - test_msg->obs[9].tropo_std = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[10].L.f = 46; - test_msg->obs[10].L.i = 86253605; - test_msg->obs[10].P = 1053200752; - test_msg->obs[10].flags = 3; - test_msg->obs[10].iono_std = 21; - test_msg->obs[10].lock = 15; - test_msg->obs[10].range_std = 3; - test_msg->obs[10].sid.code = 6; - test_msg->obs[10].sid.sat = 14; - test_msg->obs[10].tropo_std = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[11].L.f = 95; - test_msg->obs[11].L.i = 93155512; - test_msg->obs[11].P = 1137476774; - test_msg->obs[11].flags = 3; - test_msg->obs[11].iono_std = 21; - test_msg->obs[11].lock = 15; - test_msg->obs[11].range_std = 5; - test_msg->obs[11].sid.code = 6; - test_msg->obs[11].sid.sat = 15; - test_msg->obs[11].tropo_std = 5; - - EXPECT_EQ(send_message(0x640, 0, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 0); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 64) - << "incorrect value for header.n_obs, expected 64, is " - << last_msg_->header.n_obs; - EXPECT_EQ( - get_asheader.t.ns_residual)>( - reinterpret_cast(&last_msg_->header.t.ns_residual)), - 0) - << "incorrect value for header.t.ns_residual, expected 0, is " - << last_msg_->header.t.ns_residual; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 501867000) - << "incorrect value for header.t.tow, expected 501867000, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 2152) - << "incorrect value for header.t.wn, expected 2152, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 66) - << "incorrect value for obs[0].L.f, expected 66, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - 121567974) - << "incorrect value for obs[0].L.i, expected 121567974, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 1156681547) - << "incorrect value for obs[0].P, expected 1156681547, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].flags)>( - reinterpret_cast(&last_msg_->obs[0].flags)), - 3) - << "incorrect value for obs[0].flags, expected 3, is " - << last_msg_->obs[0].flags; - EXPECT_EQ(get_asobs[0].iono_std)>( - reinterpret_cast(&last_msg_->obs[0].iono_std)), - 13) - << "incorrect value for obs[0].iono_std, expected 13, is " - << last_msg_->obs[0].iono_std; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 15) - << "incorrect value for obs[0].lock, expected 15, is " - << last_msg_->obs[0].lock; - EXPECT_EQ( - get_asobs[0].range_std)>( - reinterpret_cast(&last_msg_->obs[0].range_std)), - 7) - << "incorrect value for obs[0].range_std, expected 7, is " - << last_msg_->obs[0].range_std; - EXPECT_EQ(get_asobs[0].sid.code)>( - reinterpret_cast(&last_msg_->obs[0].sid.code)), - 0) - << "incorrect value for obs[0].sid.code, expected 0, is " - << last_msg_->obs[0].sid.code; - EXPECT_EQ(get_asobs[0].sid.sat)>( - reinterpret_cast(&last_msg_->obs[0].sid.sat)), - 1) - << "incorrect value for obs[0].sid.sat, expected 1, is " - << last_msg_->obs[0].sid.sat; - EXPECT_EQ( - get_asobs[0].tropo_std)>( - reinterpret_cast(&last_msg_->obs[0].tropo_std)), - 7) - << "incorrect value for obs[0].tropo_std, expected 7, is " - << last_msg_->obs[0].tropo_std; - EXPECT_EQ(get_asobs[1].L.f)>( - reinterpret_cast(&last_msg_->obs[1].L.f)), - 75) - << "incorrect value for obs[1].L.f, expected 75, is " - << last_msg_->obs[1].L.f; - EXPECT_EQ(get_asobs[1].L.i)>( - reinterpret_cast(&last_msg_->obs[1].L.i)), - 111817196) - << "incorrect value for obs[1].L.i, expected 111817196, is " - << last_msg_->obs[1].L.i; - EXPECT_EQ(get_asobs[1].P)>( - reinterpret_cast(&last_msg_->obs[1].P)), - 1063905486) - << "incorrect value for obs[1].P, expected 1063905486, is " - << last_msg_->obs[1].P; - EXPECT_EQ(get_asobs[1].flags)>( - reinterpret_cast(&last_msg_->obs[1].flags)), - 3) - << "incorrect value for obs[1].flags, expected 3, is " - << last_msg_->obs[1].flags; - EXPECT_EQ(get_asobs[1].iono_std)>( - reinterpret_cast(&last_msg_->obs[1].iono_std)), - 13) - << "incorrect value for obs[1].iono_std, expected 13, is " - << last_msg_->obs[1].iono_std; - EXPECT_EQ(get_asobs[1].lock)>( - reinterpret_cast(&last_msg_->obs[1].lock)), - 15) - << "incorrect value for obs[1].lock, expected 15, is " - << last_msg_->obs[1].lock; - EXPECT_EQ( - get_asobs[1].range_std)>( - reinterpret_cast(&last_msg_->obs[1].range_std)), - 3) - << "incorrect value for obs[1].range_std, expected 3, is " - << last_msg_->obs[1].range_std; - EXPECT_EQ(get_asobs[1].sid.code)>( - reinterpret_cast(&last_msg_->obs[1].sid.code)), - 0) - << "incorrect value for obs[1].sid.code, expected 0, is " - << last_msg_->obs[1].sid.code; - EXPECT_EQ(get_asobs[1].sid.sat)>( - reinterpret_cast(&last_msg_->obs[1].sid.sat)), - 13) - << "incorrect value for obs[1].sid.sat, expected 13, is " - << last_msg_->obs[1].sid.sat; - EXPECT_EQ( - get_asobs[1].tropo_std)>( - reinterpret_cast(&last_msg_->obs[1].tropo_std)), - 3) - << "incorrect value for obs[1].tropo_std, expected 3, is " - << last_msg_->obs[1].tropo_std; - EXPECT_EQ(get_asobs[2].L.f)>( - reinterpret_cast(&last_msg_->obs[2].L.f)), - 128) - << "incorrect value for obs[2].L.f, expected 128, is " - << last_msg_->obs[2].L.f; - EXPECT_EQ(get_asobs[2].L.i)>( - reinterpret_cast(&last_msg_->obs[2].L.i)), - 110692129) - << "incorrect value for obs[2].L.i, expected 110692129, is " - << last_msg_->obs[2].L.i; - EXPECT_EQ(get_asobs[2].P)>( - reinterpret_cast(&last_msg_->obs[2].P)), - 1053200685) - << "incorrect value for obs[2].P, expected 1053200685, is " - << last_msg_->obs[2].P; - EXPECT_EQ(get_asobs[2].flags)>( - reinterpret_cast(&last_msg_->obs[2].flags)), - 3) - << "incorrect value for obs[2].flags, expected 3, is " - << last_msg_->obs[2].flags; - EXPECT_EQ(get_asobs[2].iono_std)>( - reinterpret_cast(&last_msg_->obs[2].iono_std)), - 13) - << "incorrect value for obs[2].iono_std, expected 13, is " - << last_msg_->obs[2].iono_std; - EXPECT_EQ(get_asobs[2].lock)>( - reinterpret_cast(&last_msg_->obs[2].lock)), - 15) - << "incorrect value for obs[2].lock, expected 15, is " - << last_msg_->obs[2].lock; - EXPECT_EQ( - get_asobs[2].range_std)>( - reinterpret_cast(&last_msg_->obs[2].range_std)), - 3) - << "incorrect value for obs[2].range_std, expected 3, is " - << last_msg_->obs[2].range_std; - EXPECT_EQ(get_asobs[2].sid.code)>( - reinterpret_cast(&last_msg_->obs[2].sid.code)), - 0) - << "incorrect value for obs[2].sid.code, expected 0, is " - << last_msg_->obs[2].sid.code; - EXPECT_EQ(get_asobs[2].sid.sat)>( - reinterpret_cast(&last_msg_->obs[2].sid.sat)), - 14) - << "incorrect value for obs[2].sid.sat, expected 14, is " - << last_msg_->obs[2].sid.sat; - EXPECT_EQ( - get_asobs[2].tropo_std)>( - reinterpret_cast(&last_msg_->obs[2].tropo_std)), - 3) - << "incorrect value for obs[2].tropo_std, expected 3, is " - << last_msg_->obs[2].tropo_std; - EXPECT_EQ(get_asobs[3].L.f)>( - reinterpret_cast(&last_msg_->obs[3].L.f)), - 127) - << "incorrect value for obs[3].L.f, expected 127, is " - << last_msg_->obs[3].L.f; - EXPECT_EQ(get_asobs[3].L.i)>( - reinterpret_cast(&last_msg_->obs[3].L.i)), - 119549583) - << "incorrect value for obs[3].L.i, expected 119549583, is " - << last_msg_->obs[3].L.i; - EXPECT_EQ(get_asobs[3].P)>( - reinterpret_cast(&last_msg_->obs[3].P)), - 1137476697) - << "incorrect value for obs[3].P, expected 1137476697, is " - << last_msg_->obs[3].P; - EXPECT_EQ(get_asobs[3].flags)>( - reinterpret_cast(&last_msg_->obs[3].flags)), - 3) - << "incorrect value for obs[3].flags, expected 3, is " - << last_msg_->obs[3].flags; - EXPECT_EQ(get_asobs[3].iono_std)>( - reinterpret_cast(&last_msg_->obs[3].iono_std)), - 13) - << "incorrect value for obs[3].iono_std, expected 13, is " - << last_msg_->obs[3].iono_std; - EXPECT_EQ(get_asobs[3].lock)>( - reinterpret_cast(&last_msg_->obs[3].lock)), - 15) - << "incorrect value for obs[3].lock, expected 15, is " - << last_msg_->obs[3].lock; - EXPECT_EQ( - get_asobs[3].range_std)>( - reinterpret_cast(&last_msg_->obs[3].range_std)), - 5) - << "incorrect value for obs[3].range_std, expected 5, is " - << last_msg_->obs[3].range_std; - EXPECT_EQ(get_asobs[3].sid.code)>( - reinterpret_cast(&last_msg_->obs[3].sid.code)), - 0) - << "incorrect value for obs[3].sid.code, expected 0, is " - << last_msg_->obs[3].sid.code; - EXPECT_EQ(get_asobs[3].sid.sat)>( - reinterpret_cast(&last_msg_->obs[3].sid.sat)), - 15) - << "incorrect value for obs[3].sid.sat, expected 15, is " - << last_msg_->obs[3].sid.sat; - EXPECT_EQ( - get_asobs[3].tropo_std)>( - reinterpret_cast(&last_msg_->obs[3].tropo_std)), - 5) - << "incorrect value for obs[3].tropo_std, expected 5, is " - << last_msg_->obs[3].tropo_std; - EXPECT_EQ(get_asobs[4].L.f)>( - reinterpret_cast(&last_msg_->obs[4].L.f)), - 55) - << "incorrect value for obs[4].L.f, expected 55, is " - << last_msg_->obs[4].L.f; - EXPECT_EQ(get_asobs[4].L.i)>( - reinterpret_cast(&last_msg_->obs[4].L.i)), - 106934294) - << "incorrect value for obs[4].L.i, expected 106934294, is " - << last_msg_->obs[4].L.i; - EXPECT_EQ(get_asobs[4].P)>( - reinterpret_cast(&last_msg_->obs[4].P)), - 1017446132) - << "incorrect value for obs[4].P, expected 1017446132, is " - << last_msg_->obs[4].P; - EXPECT_EQ(get_asobs[4].flags)>( - reinterpret_cast(&last_msg_->obs[4].flags)), - 3) - << "incorrect value for obs[4].flags, expected 3, is " - << last_msg_->obs[4].flags; - EXPECT_EQ(get_asobs[4].iono_std)>( - reinterpret_cast(&last_msg_->obs[4].iono_std)), - 0) - << "incorrect value for obs[4].iono_std, expected 0, is " - << last_msg_->obs[4].iono_std; - EXPECT_EQ(get_asobs[4].lock)>( - reinterpret_cast(&last_msg_->obs[4].lock)), - 15) - << "incorrect value for obs[4].lock, expected 15, is " - << last_msg_->obs[4].lock; - EXPECT_EQ( - get_asobs[4].range_std)>( - reinterpret_cast(&last_msg_->obs[4].range_std)), - 2) - << "incorrect value for obs[4].range_std, expected 2, is " - << last_msg_->obs[4].range_std; - EXPECT_EQ(get_asobs[4].sid.code)>( - reinterpret_cast(&last_msg_->obs[4].sid.code)), - 0) - << "incorrect value for obs[4].sid.code, expected 0, is " - << last_msg_->obs[4].sid.code; - EXPECT_EQ(get_asobs[4].sid.sat)>( - reinterpret_cast(&last_msg_->obs[4].sid.sat)), - 17) - << "incorrect value for obs[4].sid.sat, expected 17, is " - << last_msg_->obs[4].sid.sat; - EXPECT_EQ( - get_asobs[4].tropo_std)>( - reinterpret_cast(&last_msg_->obs[4].tropo_std)), - 2) - << "incorrect value for obs[4].tropo_std, expected 2, is " - << last_msg_->obs[4].tropo_std; - EXPECT_EQ(get_asobs[5].L.f)>( - reinterpret_cast(&last_msg_->obs[5].L.f)), - 108) - << "incorrect value for obs[5].L.f, expected 108, is " - << last_msg_->obs[5].L.f; - EXPECT_EQ(get_asobs[5].L.i)>( - reinterpret_cast(&last_msg_->obs[5].L.i)), - 110024343) - << "incorrect value for obs[5].L.i, expected 110024343, is " - << last_msg_->obs[5].L.i; - EXPECT_EQ(get_asobs[5].P)>( - reinterpret_cast(&last_msg_->obs[5].P)), - 1046846826) - << "incorrect value for obs[5].P, expected 1046846826, is " - << last_msg_->obs[5].P; - EXPECT_EQ(get_asobs[5].flags)>( - reinterpret_cast(&last_msg_->obs[5].flags)), - 3) - << "incorrect value for obs[5].flags, expected 3, is " - << last_msg_->obs[5].flags; - EXPECT_EQ(get_asobs[5].iono_std)>( - reinterpret_cast(&last_msg_->obs[5].iono_std)), - 13) - << "incorrect value for obs[5].iono_std, expected 13, is " - << last_msg_->obs[5].iono_std; - EXPECT_EQ(get_asobs[5].lock)>( - reinterpret_cast(&last_msg_->obs[5].lock)), - 15) - << "incorrect value for obs[5].lock, expected 15, is " - << last_msg_->obs[5].lock; - EXPECT_EQ( - get_asobs[5].range_std)>( - reinterpret_cast(&last_msg_->obs[5].range_std)), - 3) - << "incorrect value for obs[5].range_std, expected 3, is " - << last_msg_->obs[5].range_std; - EXPECT_EQ(get_asobs[5].sid.code)>( - reinterpret_cast(&last_msg_->obs[5].sid.code)), - 0) - << "incorrect value for obs[5].sid.code, expected 0, is " - << last_msg_->obs[5].sid.code; - EXPECT_EQ(get_asobs[5].sid.sat)>( - reinterpret_cast(&last_msg_->obs[5].sid.sat)), - 19) - << "incorrect value for obs[5].sid.sat, expected 19, is " - << last_msg_->obs[5].sid.sat; - EXPECT_EQ( - get_asobs[5].tropo_std)>( - reinterpret_cast(&last_msg_->obs[5].tropo_std)), - 3) - << "incorrect value for obs[5].tropo_std, expected 3, is " - << last_msg_->obs[5].tropo_std; - EXPECT_EQ(get_asobs[6].L.f)>( - reinterpret_cast(&last_msg_->obs[6].L.f)), - 206) - << "incorrect value for obs[6].L.f, expected 206, is " - << last_msg_->obs[6].L.f; - EXPECT_EQ(get_asobs[6].L.i)>( - reinterpret_cast(&last_msg_->obs[6].L.i)), - 111507381) - << "incorrect value for obs[6].L.i, expected 111507381, is " - << last_msg_->obs[6].L.i; - EXPECT_EQ(get_asobs[6].P)>( - reinterpret_cast(&last_msg_->obs[6].P)), - 1060957521) - << "incorrect value for obs[6].P, expected 1060957521, is " - << last_msg_->obs[6].P; - EXPECT_EQ(get_asobs[6].flags)>( - reinterpret_cast(&last_msg_->obs[6].flags)), - 3) - << "incorrect value for obs[6].flags, expected 3, is " - << last_msg_->obs[6].flags; - EXPECT_EQ(get_asobs[6].iono_std)>( - reinterpret_cast(&last_msg_->obs[6].iono_std)), - 13) - << "incorrect value for obs[6].iono_std, expected 13, is " - << last_msg_->obs[6].iono_std; - EXPECT_EQ(get_asobs[6].lock)>( - reinterpret_cast(&last_msg_->obs[6].lock)), - 15) - << "incorrect value for obs[6].lock, expected 15, is " - << last_msg_->obs[6].lock; - EXPECT_EQ( - get_asobs[6].range_std)>( - reinterpret_cast(&last_msg_->obs[6].range_std)), - 3) - << "incorrect value for obs[6].range_std, expected 3, is " - << last_msg_->obs[6].range_std; - EXPECT_EQ(get_asobs[6].sid.code)>( - reinterpret_cast(&last_msg_->obs[6].sid.code)), - 0) - << "incorrect value for obs[6].sid.code, expected 0, is " - << last_msg_->obs[6].sid.code; - EXPECT_EQ(get_asobs[6].sid.sat)>( - reinterpret_cast(&last_msg_->obs[6].sid.sat)), - 28) - << "incorrect value for obs[6].sid.sat, expected 28, is " - << last_msg_->obs[6].sid.sat; - EXPECT_EQ( - get_asobs[6].tropo_std)>( - reinterpret_cast(&last_msg_->obs[6].tropo_std)), - 3) - << "incorrect value for obs[6].tropo_std, expected 3, is " - << last_msg_->obs[6].tropo_std; - EXPECT_EQ(get_asobs[7].L.f)>( - reinterpret_cast(&last_msg_->obs[7].L.f)), - 200) - << "incorrect value for obs[7].L.f, expected 200, is " - << last_msg_->obs[7].L.f; - EXPECT_EQ(get_asobs[7].L.i)>( - reinterpret_cast(&last_msg_->obs[7].L.i)), - 113614775) - << "incorrect value for obs[7].L.i, expected 113614775, is " - << last_msg_->obs[7].L.i; - EXPECT_EQ(get_asobs[7].P)>( - reinterpret_cast(&last_msg_->obs[7].P)), - 1081009286) - << "incorrect value for obs[7].P, expected 1081009286, is " - << last_msg_->obs[7].P; - EXPECT_EQ(get_asobs[7].flags)>( - reinterpret_cast(&last_msg_->obs[7].flags)), - 3) - << "incorrect value for obs[7].flags, expected 3, is " - << last_msg_->obs[7].flags; - EXPECT_EQ(get_asobs[7].iono_std)>( - reinterpret_cast(&last_msg_->obs[7].iono_std)), - 13) - << "incorrect value for obs[7].iono_std, expected 13, is " - << last_msg_->obs[7].iono_std; - EXPECT_EQ(get_asobs[7].lock)>( - reinterpret_cast(&last_msg_->obs[7].lock)), - 15) - << "incorrect value for obs[7].lock, expected 15, is " - << last_msg_->obs[7].lock; - EXPECT_EQ( - get_asobs[7].range_std)>( - reinterpret_cast(&last_msg_->obs[7].range_std)), - 3) - << "incorrect value for obs[7].range_std, expected 3, is " - << last_msg_->obs[7].range_std; - EXPECT_EQ(get_asobs[7].sid.code)>( - reinterpret_cast(&last_msg_->obs[7].sid.code)), - 0) - << "incorrect value for obs[7].sid.code, expected 0, is " - << last_msg_->obs[7].sid.code; - EXPECT_EQ(get_asobs[7].sid.sat)>( - reinterpret_cast(&last_msg_->obs[7].sid.sat)), - 30) - << "incorrect value for obs[7].sid.sat, expected 30, is " - << last_msg_->obs[7].sid.sat; - EXPECT_EQ( - get_asobs[7].tropo_std)>( - reinterpret_cast(&last_msg_->obs[7].tropo_std)), - 3) - << "incorrect value for obs[7].tropo_std, expected 3, is " - << last_msg_->obs[7].tropo_std; - EXPECT_EQ(get_asobs[8].L.f)>( - reinterpret_cast(&last_msg_->obs[8].L.f)), - 170) - << "incorrect value for obs[8].L.f, expected 170, is " - << last_msg_->obs[8].L.f; - EXPECT_EQ(get_asobs[8].L.i)>( - reinterpret_cast(&last_msg_->obs[8].L.i)), - 94728270) - << "incorrect value for obs[8].L.i, expected 94728270, is " - << last_msg_->obs[8].L.i; - EXPECT_EQ(get_asobs[8].P)>( - reinterpret_cast(&last_msg_->obs[8].P)), - 1156681781) - << "incorrect value for obs[8].P, expected 1156681781, is " - << last_msg_->obs[8].P; - EXPECT_EQ(get_asobs[8].flags)>( - reinterpret_cast(&last_msg_->obs[8].flags)), - 3) - << "incorrect value for obs[8].flags, expected 3, is " - << last_msg_->obs[8].flags; - EXPECT_EQ(get_asobs[8].iono_std)>( - reinterpret_cast(&last_msg_->obs[8].iono_std)), - 21) - << "incorrect value for obs[8].iono_std, expected 21, is " - << last_msg_->obs[8].iono_std; - EXPECT_EQ(get_asobs[8].lock)>( - reinterpret_cast(&last_msg_->obs[8].lock)), - 15) - << "incorrect value for obs[8].lock, expected 15, is " - << last_msg_->obs[8].lock; - EXPECT_EQ( - get_asobs[8].range_std)>( - reinterpret_cast(&last_msg_->obs[8].range_std)), - 7) - << "incorrect value for obs[8].range_std, expected 7, is " - << last_msg_->obs[8].range_std; - EXPECT_EQ(get_asobs[8].sid.code)>( - reinterpret_cast(&last_msg_->obs[8].sid.code)), - 6) - << "incorrect value for obs[8].sid.code, expected 6, is " - << last_msg_->obs[8].sid.code; - EXPECT_EQ(get_asobs[8].sid.sat)>( - reinterpret_cast(&last_msg_->obs[8].sid.sat)), - 1) - << "incorrect value for obs[8].sid.sat, expected 1, is " - << last_msg_->obs[8].sid.sat; - EXPECT_EQ( - get_asobs[8].tropo_std)>( - reinterpret_cast(&last_msg_->obs[8].tropo_std)), - 7) - << "incorrect value for obs[8].tropo_std, expected 7, is " - << last_msg_->obs[8].tropo_std; - EXPECT_EQ(get_asobs[9].L.f)>( - reinterpret_cast(&last_msg_->obs[9].L.f)), - 129) - << "incorrect value for obs[9].L.f, expected 129, is " - << last_msg_->obs[9].L.f; - EXPECT_EQ(get_asobs[9].L.i)>( - reinterpret_cast(&last_msg_->obs[9].L.i)), - 87130275) - << "incorrect value for obs[9].L.i, expected 87130275, is " - << last_msg_->obs[9].L.i; - EXPECT_EQ(get_asobs[9].P)>( - reinterpret_cast(&last_msg_->obs[9].P)), - 1063905531) - << "incorrect value for obs[9].P, expected 1063905531, is " - << last_msg_->obs[9].P; - EXPECT_EQ(get_asobs[9].flags)>( - reinterpret_cast(&last_msg_->obs[9].flags)), - 3) - << "incorrect value for obs[9].flags, expected 3, is " - << last_msg_->obs[9].flags; - EXPECT_EQ(get_asobs[9].iono_std)>( - reinterpret_cast(&last_msg_->obs[9].iono_std)), - 21) - << "incorrect value for obs[9].iono_std, expected 21, is " - << last_msg_->obs[9].iono_std; - EXPECT_EQ(get_asobs[9].lock)>( - reinterpret_cast(&last_msg_->obs[9].lock)), - 15) - << "incorrect value for obs[9].lock, expected 15, is " - << last_msg_->obs[9].lock; - EXPECT_EQ( - get_asobs[9].range_std)>( - reinterpret_cast(&last_msg_->obs[9].range_std)), - 3) - << "incorrect value for obs[9].range_std, expected 3, is " - << last_msg_->obs[9].range_std; - EXPECT_EQ(get_asobs[9].sid.code)>( - reinterpret_cast(&last_msg_->obs[9].sid.code)), - 6) - << "incorrect value for obs[9].sid.code, expected 6, is " - << last_msg_->obs[9].sid.code; - EXPECT_EQ(get_asobs[9].sid.sat)>( - reinterpret_cast(&last_msg_->obs[9].sid.sat)), - 13) - << "incorrect value for obs[9].sid.sat, expected 13, is " - << last_msg_->obs[9].sid.sat; - EXPECT_EQ( - get_asobs[9].tropo_std)>( - reinterpret_cast(&last_msg_->obs[9].tropo_std)), - 3) - << "incorrect value for obs[9].tropo_std, expected 3, is " - << last_msg_->obs[9].tropo_std; - EXPECT_EQ(get_asobs[10].L.f)>( - reinterpret_cast(&last_msg_->obs[10].L.f)), - 46) - << "incorrect value for obs[10].L.f, expected 46, is " - << last_msg_->obs[10].L.f; - EXPECT_EQ(get_asobs[10].L.i)>( - reinterpret_cast(&last_msg_->obs[10].L.i)), - 86253605) - << "incorrect value for obs[10].L.i, expected 86253605, is " - << last_msg_->obs[10].L.i; - EXPECT_EQ(get_asobs[10].P)>( - reinterpret_cast(&last_msg_->obs[10].P)), - 1053200752) - << "incorrect value for obs[10].P, expected 1053200752, is " - << last_msg_->obs[10].P; - EXPECT_EQ(get_asobs[10].flags)>( - reinterpret_cast(&last_msg_->obs[10].flags)), - 3) - << "incorrect value for obs[10].flags, expected 3, is " - << last_msg_->obs[10].flags; - EXPECT_EQ( - get_asobs[10].iono_std)>( - reinterpret_cast(&last_msg_->obs[10].iono_std)), - 21) - << "incorrect value for obs[10].iono_std, expected 21, is " - << last_msg_->obs[10].iono_std; - EXPECT_EQ(get_asobs[10].lock)>( - reinterpret_cast(&last_msg_->obs[10].lock)), - 15) - << "incorrect value for obs[10].lock, expected 15, is " - << last_msg_->obs[10].lock; - EXPECT_EQ( - get_asobs[10].range_std)>( - reinterpret_cast(&last_msg_->obs[10].range_std)), - 3) - << "incorrect value for obs[10].range_std, expected 3, is " - << last_msg_->obs[10].range_std; - EXPECT_EQ( - get_asobs[10].sid.code)>( - reinterpret_cast(&last_msg_->obs[10].sid.code)), - 6) - << "incorrect value for obs[10].sid.code, expected 6, is " - << last_msg_->obs[10].sid.code; - EXPECT_EQ(get_asobs[10].sid.sat)>( - reinterpret_cast(&last_msg_->obs[10].sid.sat)), - 14) - << "incorrect value for obs[10].sid.sat, expected 14, is " - << last_msg_->obs[10].sid.sat; - EXPECT_EQ( - get_asobs[10].tropo_std)>( - reinterpret_cast(&last_msg_->obs[10].tropo_std)), - 3) - << "incorrect value for obs[10].tropo_std, expected 3, is " - << last_msg_->obs[10].tropo_std; - EXPECT_EQ(get_asobs[11].L.f)>( - reinterpret_cast(&last_msg_->obs[11].L.f)), - 95) - << "incorrect value for obs[11].L.f, expected 95, is " - << last_msg_->obs[11].L.f; - EXPECT_EQ(get_asobs[11].L.i)>( - reinterpret_cast(&last_msg_->obs[11].L.i)), - 93155512) - << "incorrect value for obs[11].L.i, expected 93155512, is " - << last_msg_->obs[11].L.i; - EXPECT_EQ(get_asobs[11].P)>( - reinterpret_cast(&last_msg_->obs[11].P)), - 1137476774) - << "incorrect value for obs[11].P, expected 1137476774, is " - << last_msg_->obs[11].P; - EXPECT_EQ(get_asobs[11].flags)>( - reinterpret_cast(&last_msg_->obs[11].flags)), - 3) - << "incorrect value for obs[11].flags, expected 3, is " - << last_msg_->obs[11].flags; - EXPECT_EQ( - get_asobs[11].iono_std)>( - reinterpret_cast(&last_msg_->obs[11].iono_std)), - 21) - << "incorrect value for obs[11].iono_std, expected 21, is " - << last_msg_->obs[11].iono_std; - EXPECT_EQ(get_asobs[11].lock)>( - reinterpret_cast(&last_msg_->obs[11].lock)), - 15) - << "incorrect value for obs[11].lock, expected 15, is " - << last_msg_->obs[11].lock; - EXPECT_EQ( - get_asobs[11].range_std)>( - reinterpret_cast(&last_msg_->obs[11].range_std)), - 5) - << "incorrect value for obs[11].range_std, expected 5, is " - << last_msg_->obs[11].range_std; - EXPECT_EQ( - get_asobs[11].sid.code)>( - reinterpret_cast(&last_msg_->obs[11].sid.code)), - 6) - << "incorrect value for obs[11].sid.code, expected 6, is " - << last_msg_->obs[11].sid.code; - EXPECT_EQ(get_asobs[11].sid.sat)>( - reinterpret_cast(&last_msg_->obs[11].sid.sat)), - 15) - << "incorrect value for obs[11].sid.sat, expected 15, is " - << last_msg_->obs[11].sid.sat; - EXPECT_EQ( - get_asobs[11].tropo_std)>( - reinterpret_cast(&last_msg_->obs[11].tropo_std)), - 5) - << "incorrect value for obs[11].tropo_std, expected 5, is " - << last_msg_->obs[11].tropo_std; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgSvAzEl.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgSvAzEl.cc deleted file mode 100644 index 0ac021084c..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgSvAzEl.cc +++ /dev/null @@ -1,1107 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgSvAzEl.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgSvAzEl0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgSvAzEl0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_sv_az_el_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_sv_az_el_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgSvAzEl0, Test) { - uint8_t encoded_frame[] = { - 85, 151, 0, 207, 121, 132, 8, 0, 160, 12, 10, 0, 139, 66, 13, 0, - 16, 1, 15, 0, 24, 25, 16, 0, 127, 18, 18, 0, 42, 53, 20, 0, - 31, 16, 23, 0, 12, 67, 24, 0, 47, 10, 26, 0, 116, 8, 27, 0, - 153, 43, 29, 0, 77, 10, 32, 0, 94, 26, 1, 3, 16, 58, 2, 3, - 108, 53, 8, 3, 17, 13, 17, 3, 165, 40, 23, 3, 63, 35, 24, 3, - 41, 73, 20, 12, 114, 26, 27, 12, 72, 54, 28, 12, 69, 3, 29, 12, - 158, 14, 30, 12, 152, 68, 32, 12, 120, 82, 2, 14, 131, 6, 4, 14, - 27, 44, 5, 14, 101, 21, 9, 14, 81, 65, 11, 14, 49, 56, 12, 14, - 59, 6, 30, 14, 154, 4, 36, 14, 165, 62, 168, 36, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_sv_az_el_t *test_msg = (msg_sv_az_el_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[0].az = 160; - test_msg->azel[0].el = 12; - test_msg->azel[0].sid.code = 0; - test_msg->azel[0].sid.sat = 8; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[1].az = 139; - test_msg->azel[1].el = 66; - test_msg->azel[1].sid.code = 0; - test_msg->azel[1].sid.sat = 10; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[2].az = 16; - test_msg->azel[2].el = 1; - test_msg->azel[2].sid.code = 0; - test_msg->azel[2].sid.sat = 13; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[3].az = 24; - test_msg->azel[3].el = 25; - test_msg->azel[3].sid.code = 0; - test_msg->azel[3].sid.sat = 15; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[4].az = 127; - test_msg->azel[4].el = 18; - test_msg->azel[4].sid.code = 0; - test_msg->azel[4].sid.sat = 16; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[5].az = 42; - test_msg->azel[5].el = 53; - test_msg->azel[5].sid.code = 0; - test_msg->azel[5].sid.sat = 18; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[6].az = 31; - test_msg->azel[6].el = 16; - test_msg->azel[6].sid.code = 0; - test_msg->azel[6].sid.sat = 20; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[7].az = 12; - test_msg->azel[7].el = 67; - test_msg->azel[7].sid.code = 0; - test_msg->azel[7].sid.sat = 23; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[8].az = 47; - test_msg->azel[8].el = 10; - test_msg->azel[8].sid.code = 0; - test_msg->azel[8].sid.sat = 24; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[9].az = 116; - test_msg->azel[9].el = 8; - test_msg->azel[9].sid.code = 0; - test_msg->azel[9].sid.sat = 26; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[10].az = 153; - test_msg->azel[10].el = 43; - test_msg->azel[10].sid.code = 0; - test_msg->azel[10].sid.sat = 27; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[11].az = 77; - test_msg->azel[11].el = 10; - test_msg->azel[11].sid.code = 0; - test_msg->azel[11].sid.sat = 29; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[12].az = 94; - test_msg->azel[12].el = 26; - test_msg->azel[12].sid.code = 0; - test_msg->azel[12].sid.sat = 32; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[13].az = 16; - test_msg->azel[13].el = 58; - test_msg->azel[13].sid.code = 3; - test_msg->azel[13].sid.sat = 1; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[14].az = 108; - test_msg->azel[14].el = 53; - test_msg->azel[14].sid.code = 3; - test_msg->azel[14].sid.sat = 2; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[15].az = 17; - test_msg->azel[15].el = 13; - test_msg->azel[15].sid.code = 3; - test_msg->azel[15].sid.sat = 8; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[16].az = 165; - test_msg->azel[16].el = 40; - test_msg->azel[16].sid.code = 3; - test_msg->azel[16].sid.sat = 17; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[17].az = 63; - test_msg->azel[17].el = 35; - test_msg->azel[17].sid.code = 3; - test_msg->azel[17].sid.sat = 23; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[18].az = 41; - test_msg->azel[18].el = 73; - test_msg->azel[18].sid.code = 3; - test_msg->azel[18].sid.sat = 24; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[19].az = 114; - test_msg->azel[19].el = 26; - test_msg->azel[19].sid.code = 12; - test_msg->azel[19].sid.sat = 20; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[20].az = 72; - test_msg->azel[20].el = 54; - test_msg->azel[20].sid.code = 12; - test_msg->azel[20].sid.sat = 27; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[21].az = 69; - test_msg->azel[21].el = 3; - test_msg->azel[21].sid.code = 12; - test_msg->azel[21].sid.sat = 28; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[22].az = 158; - test_msg->azel[22].el = 14; - test_msg->azel[22].sid.code = 12; - test_msg->azel[22].sid.sat = 29; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[23].az = 152; - test_msg->azel[23].el = 68; - test_msg->azel[23].sid.code = 12; - test_msg->azel[23].sid.sat = 30; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[24].az = 120; - test_msg->azel[24].el = 82; - test_msg->azel[24].sid.code = 12; - test_msg->azel[24].sid.sat = 32; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[25].az = 131; - test_msg->azel[25].el = 6; - test_msg->azel[25].sid.code = 14; - test_msg->azel[25].sid.sat = 2; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[26].az = 27; - test_msg->azel[26].el = 44; - test_msg->azel[26].sid.code = 14; - test_msg->azel[26].sid.sat = 4; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[27].az = 101; - test_msg->azel[27].el = 21; - test_msg->azel[27].sid.code = 14; - test_msg->azel[27].sid.sat = 5; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[28].az = 81; - test_msg->azel[28].el = 65; - test_msg->azel[28].sid.code = 14; - test_msg->azel[28].sid.sat = 9; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[29].az = 49; - test_msg->azel[29].el = 56; - test_msg->azel[29].sid.code = 14; - test_msg->azel[29].sid.sat = 11; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[30].az = 59; - test_msg->azel[30].el = 6; - test_msg->azel[30].sid.code = 14; - test_msg->azel[30].sid.sat = 12; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[31].az = 154; - test_msg->azel[31].el = 4; - test_msg->azel[31].sid.code = 14; - test_msg->azel[31].sid.sat = 30; - if (sizeof(test_msg->azel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->azel[0])); - } - test_msg->azel[32].az = 165; - test_msg->azel[32].el = 62; - test_msg->azel[32].sid.code = 14; - test_msg->azel[32].sid.sat = 36; - - EXPECT_EQ(send_message(0x97, 31183, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 31183); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asazel[0].az)>( - reinterpret_cast(&last_msg_->azel[0].az)), - 160) - << "incorrect value for azel[0].az, expected 160, is " - << last_msg_->azel[0].az; - EXPECT_EQ(get_asazel[0].el)>( - reinterpret_cast(&last_msg_->azel[0].el)), - 12) - << "incorrect value for azel[0].el, expected 12, is " - << last_msg_->azel[0].el; - EXPECT_EQ( - get_asazel[0].sid.code)>( - reinterpret_cast(&last_msg_->azel[0].sid.code)), - 0) - << "incorrect value for azel[0].sid.code, expected 0, is " - << last_msg_->azel[0].sid.code; - EXPECT_EQ(get_asazel[0].sid.sat)>( - reinterpret_cast(&last_msg_->azel[0].sid.sat)), - 8) - << "incorrect value for azel[0].sid.sat, expected 8, is " - << last_msg_->azel[0].sid.sat; - EXPECT_EQ(get_asazel[1].az)>( - reinterpret_cast(&last_msg_->azel[1].az)), - 139) - << "incorrect value for azel[1].az, expected 139, is " - << last_msg_->azel[1].az; - EXPECT_EQ(get_asazel[1].el)>( - reinterpret_cast(&last_msg_->azel[1].el)), - 66) - << "incorrect value for azel[1].el, expected 66, is " - << last_msg_->azel[1].el; - EXPECT_EQ( - get_asazel[1].sid.code)>( - reinterpret_cast(&last_msg_->azel[1].sid.code)), - 0) - << "incorrect value for azel[1].sid.code, expected 0, is " - << last_msg_->azel[1].sid.code; - EXPECT_EQ(get_asazel[1].sid.sat)>( - reinterpret_cast(&last_msg_->azel[1].sid.sat)), - 10) - << "incorrect value for azel[1].sid.sat, expected 10, is " - << last_msg_->azel[1].sid.sat; - EXPECT_EQ(get_asazel[2].az)>( - reinterpret_cast(&last_msg_->azel[2].az)), - 16) - << "incorrect value for azel[2].az, expected 16, is " - << last_msg_->azel[2].az; - EXPECT_EQ(get_asazel[2].el)>( - reinterpret_cast(&last_msg_->azel[2].el)), - 1) - << "incorrect value for azel[2].el, expected 1, is " - << last_msg_->azel[2].el; - EXPECT_EQ( - get_asazel[2].sid.code)>( - reinterpret_cast(&last_msg_->azel[2].sid.code)), - 0) - << "incorrect value for azel[2].sid.code, expected 0, is " - << last_msg_->azel[2].sid.code; - EXPECT_EQ(get_asazel[2].sid.sat)>( - reinterpret_cast(&last_msg_->azel[2].sid.sat)), - 13) - << "incorrect value for azel[2].sid.sat, expected 13, is " - << last_msg_->azel[2].sid.sat; - EXPECT_EQ(get_asazel[3].az)>( - reinterpret_cast(&last_msg_->azel[3].az)), - 24) - << "incorrect value for azel[3].az, expected 24, is " - << last_msg_->azel[3].az; - EXPECT_EQ(get_asazel[3].el)>( - reinterpret_cast(&last_msg_->azel[3].el)), - 25) - << "incorrect value for azel[3].el, expected 25, is " - << last_msg_->azel[3].el; - EXPECT_EQ( - get_asazel[3].sid.code)>( - reinterpret_cast(&last_msg_->azel[3].sid.code)), - 0) - << "incorrect value for azel[3].sid.code, expected 0, is " - << last_msg_->azel[3].sid.code; - EXPECT_EQ(get_asazel[3].sid.sat)>( - reinterpret_cast(&last_msg_->azel[3].sid.sat)), - 15) - << "incorrect value for azel[3].sid.sat, expected 15, is " - << last_msg_->azel[3].sid.sat; - EXPECT_EQ(get_asazel[4].az)>( - reinterpret_cast(&last_msg_->azel[4].az)), - 127) - << "incorrect value for azel[4].az, expected 127, is " - << last_msg_->azel[4].az; - EXPECT_EQ(get_asazel[4].el)>( - reinterpret_cast(&last_msg_->azel[4].el)), - 18) - << "incorrect value for azel[4].el, expected 18, is " - << last_msg_->azel[4].el; - EXPECT_EQ( - get_asazel[4].sid.code)>( - reinterpret_cast(&last_msg_->azel[4].sid.code)), - 0) - << "incorrect value for azel[4].sid.code, expected 0, is " - << last_msg_->azel[4].sid.code; - EXPECT_EQ(get_asazel[4].sid.sat)>( - reinterpret_cast(&last_msg_->azel[4].sid.sat)), - 16) - << "incorrect value for azel[4].sid.sat, expected 16, is " - << last_msg_->azel[4].sid.sat; - EXPECT_EQ(get_asazel[5].az)>( - reinterpret_cast(&last_msg_->azel[5].az)), - 42) - << "incorrect value for azel[5].az, expected 42, is " - << last_msg_->azel[5].az; - EXPECT_EQ(get_asazel[5].el)>( - reinterpret_cast(&last_msg_->azel[5].el)), - 53) - << "incorrect value for azel[5].el, expected 53, is " - << last_msg_->azel[5].el; - EXPECT_EQ( - get_asazel[5].sid.code)>( - reinterpret_cast(&last_msg_->azel[5].sid.code)), - 0) - << "incorrect value for azel[5].sid.code, expected 0, is " - << last_msg_->azel[5].sid.code; - EXPECT_EQ(get_asazel[5].sid.sat)>( - reinterpret_cast(&last_msg_->azel[5].sid.sat)), - 18) - << "incorrect value for azel[5].sid.sat, expected 18, is " - << last_msg_->azel[5].sid.sat; - EXPECT_EQ(get_asazel[6].az)>( - reinterpret_cast(&last_msg_->azel[6].az)), - 31) - << "incorrect value for azel[6].az, expected 31, is " - << last_msg_->azel[6].az; - EXPECT_EQ(get_asazel[6].el)>( - reinterpret_cast(&last_msg_->azel[6].el)), - 16) - << "incorrect value for azel[6].el, expected 16, is " - << last_msg_->azel[6].el; - EXPECT_EQ( - get_asazel[6].sid.code)>( - reinterpret_cast(&last_msg_->azel[6].sid.code)), - 0) - << "incorrect value for azel[6].sid.code, expected 0, is " - << last_msg_->azel[6].sid.code; - EXPECT_EQ(get_asazel[6].sid.sat)>( - reinterpret_cast(&last_msg_->azel[6].sid.sat)), - 20) - << "incorrect value for azel[6].sid.sat, expected 20, is " - << last_msg_->azel[6].sid.sat; - EXPECT_EQ(get_asazel[7].az)>( - reinterpret_cast(&last_msg_->azel[7].az)), - 12) - << "incorrect value for azel[7].az, expected 12, is " - << last_msg_->azel[7].az; - EXPECT_EQ(get_asazel[7].el)>( - reinterpret_cast(&last_msg_->azel[7].el)), - 67) - << "incorrect value for azel[7].el, expected 67, is " - << last_msg_->azel[7].el; - EXPECT_EQ( - get_asazel[7].sid.code)>( - reinterpret_cast(&last_msg_->azel[7].sid.code)), - 0) - << "incorrect value for azel[7].sid.code, expected 0, is " - << last_msg_->azel[7].sid.code; - EXPECT_EQ(get_asazel[7].sid.sat)>( - reinterpret_cast(&last_msg_->azel[7].sid.sat)), - 23) - << "incorrect value for azel[7].sid.sat, expected 23, is " - << last_msg_->azel[7].sid.sat; - EXPECT_EQ(get_asazel[8].az)>( - reinterpret_cast(&last_msg_->azel[8].az)), - 47) - << "incorrect value for azel[8].az, expected 47, is " - << last_msg_->azel[8].az; - EXPECT_EQ(get_asazel[8].el)>( - reinterpret_cast(&last_msg_->azel[8].el)), - 10) - << "incorrect value for azel[8].el, expected 10, is " - << last_msg_->azel[8].el; - EXPECT_EQ( - get_asazel[8].sid.code)>( - reinterpret_cast(&last_msg_->azel[8].sid.code)), - 0) - << "incorrect value for azel[8].sid.code, expected 0, is " - << last_msg_->azel[8].sid.code; - EXPECT_EQ(get_asazel[8].sid.sat)>( - reinterpret_cast(&last_msg_->azel[8].sid.sat)), - 24) - << "incorrect value for azel[8].sid.sat, expected 24, is " - << last_msg_->azel[8].sid.sat; - EXPECT_EQ(get_asazel[9].az)>( - reinterpret_cast(&last_msg_->azel[9].az)), - 116) - << "incorrect value for azel[9].az, expected 116, is " - << last_msg_->azel[9].az; - EXPECT_EQ(get_asazel[9].el)>( - reinterpret_cast(&last_msg_->azel[9].el)), - 8) - << "incorrect value for azel[9].el, expected 8, is " - << last_msg_->azel[9].el; - EXPECT_EQ( - get_asazel[9].sid.code)>( - reinterpret_cast(&last_msg_->azel[9].sid.code)), - 0) - << "incorrect value for azel[9].sid.code, expected 0, is " - << last_msg_->azel[9].sid.code; - EXPECT_EQ(get_asazel[9].sid.sat)>( - reinterpret_cast(&last_msg_->azel[9].sid.sat)), - 26) - << "incorrect value for azel[9].sid.sat, expected 26, is " - << last_msg_->azel[9].sid.sat; - EXPECT_EQ(get_asazel[10].az)>( - reinterpret_cast(&last_msg_->azel[10].az)), - 153) - << "incorrect value for azel[10].az, expected 153, is " - << last_msg_->azel[10].az; - EXPECT_EQ(get_asazel[10].el)>( - reinterpret_cast(&last_msg_->azel[10].el)), - 43) - << "incorrect value for azel[10].el, expected 43, is " - << last_msg_->azel[10].el; - EXPECT_EQ( - get_asazel[10].sid.code)>( - reinterpret_cast(&last_msg_->azel[10].sid.code)), - 0) - << "incorrect value for azel[10].sid.code, expected 0, is " - << last_msg_->azel[10].sid.code; - EXPECT_EQ( - get_asazel[10].sid.sat)>( - reinterpret_cast(&last_msg_->azel[10].sid.sat)), - 27) - << "incorrect value for azel[10].sid.sat, expected 27, is " - << last_msg_->azel[10].sid.sat; - EXPECT_EQ(get_asazel[11].az)>( - reinterpret_cast(&last_msg_->azel[11].az)), - 77) - << "incorrect value for azel[11].az, expected 77, is " - << last_msg_->azel[11].az; - EXPECT_EQ(get_asazel[11].el)>( - reinterpret_cast(&last_msg_->azel[11].el)), - 10) - << "incorrect value for azel[11].el, expected 10, is " - << last_msg_->azel[11].el; - EXPECT_EQ( - get_asazel[11].sid.code)>( - reinterpret_cast(&last_msg_->azel[11].sid.code)), - 0) - << "incorrect value for azel[11].sid.code, expected 0, is " - << last_msg_->azel[11].sid.code; - EXPECT_EQ( - get_asazel[11].sid.sat)>( - reinterpret_cast(&last_msg_->azel[11].sid.sat)), - 29) - << "incorrect value for azel[11].sid.sat, expected 29, is " - << last_msg_->azel[11].sid.sat; - EXPECT_EQ(get_asazel[12].az)>( - reinterpret_cast(&last_msg_->azel[12].az)), - 94) - << "incorrect value for azel[12].az, expected 94, is " - << last_msg_->azel[12].az; - EXPECT_EQ(get_asazel[12].el)>( - reinterpret_cast(&last_msg_->azel[12].el)), - 26) - << "incorrect value for azel[12].el, expected 26, is " - << last_msg_->azel[12].el; - EXPECT_EQ( - get_asazel[12].sid.code)>( - reinterpret_cast(&last_msg_->azel[12].sid.code)), - 0) - << "incorrect value for azel[12].sid.code, expected 0, is " - << last_msg_->azel[12].sid.code; - EXPECT_EQ( - get_asazel[12].sid.sat)>( - reinterpret_cast(&last_msg_->azel[12].sid.sat)), - 32) - << "incorrect value for azel[12].sid.sat, expected 32, is " - << last_msg_->azel[12].sid.sat; - EXPECT_EQ(get_asazel[13].az)>( - reinterpret_cast(&last_msg_->azel[13].az)), - 16) - << "incorrect value for azel[13].az, expected 16, is " - << last_msg_->azel[13].az; - EXPECT_EQ(get_asazel[13].el)>( - reinterpret_cast(&last_msg_->azel[13].el)), - 58) - << "incorrect value for azel[13].el, expected 58, is " - << last_msg_->azel[13].el; - EXPECT_EQ( - get_asazel[13].sid.code)>( - reinterpret_cast(&last_msg_->azel[13].sid.code)), - 3) - << "incorrect value for azel[13].sid.code, expected 3, is " - << last_msg_->azel[13].sid.code; - EXPECT_EQ( - get_asazel[13].sid.sat)>( - reinterpret_cast(&last_msg_->azel[13].sid.sat)), - 1) - << "incorrect value for azel[13].sid.sat, expected 1, is " - << last_msg_->azel[13].sid.sat; - EXPECT_EQ(get_asazel[14].az)>( - reinterpret_cast(&last_msg_->azel[14].az)), - 108) - << "incorrect value for azel[14].az, expected 108, is " - << last_msg_->azel[14].az; - EXPECT_EQ(get_asazel[14].el)>( - reinterpret_cast(&last_msg_->azel[14].el)), - 53) - << "incorrect value for azel[14].el, expected 53, is " - << last_msg_->azel[14].el; - EXPECT_EQ( - get_asazel[14].sid.code)>( - reinterpret_cast(&last_msg_->azel[14].sid.code)), - 3) - << "incorrect value for azel[14].sid.code, expected 3, is " - << last_msg_->azel[14].sid.code; - EXPECT_EQ( - get_asazel[14].sid.sat)>( - reinterpret_cast(&last_msg_->azel[14].sid.sat)), - 2) - << "incorrect value for azel[14].sid.sat, expected 2, is " - << last_msg_->azel[14].sid.sat; - EXPECT_EQ(get_asazel[15].az)>( - reinterpret_cast(&last_msg_->azel[15].az)), - 17) - << "incorrect value for azel[15].az, expected 17, is " - << last_msg_->azel[15].az; - EXPECT_EQ(get_asazel[15].el)>( - reinterpret_cast(&last_msg_->azel[15].el)), - 13) - << "incorrect value for azel[15].el, expected 13, is " - << last_msg_->azel[15].el; - EXPECT_EQ( - get_asazel[15].sid.code)>( - reinterpret_cast(&last_msg_->azel[15].sid.code)), - 3) - << "incorrect value for azel[15].sid.code, expected 3, is " - << last_msg_->azel[15].sid.code; - EXPECT_EQ( - get_asazel[15].sid.sat)>( - reinterpret_cast(&last_msg_->azel[15].sid.sat)), - 8) - << "incorrect value for azel[15].sid.sat, expected 8, is " - << last_msg_->azel[15].sid.sat; - EXPECT_EQ(get_asazel[16].az)>( - reinterpret_cast(&last_msg_->azel[16].az)), - 165) - << "incorrect value for azel[16].az, expected 165, is " - << last_msg_->azel[16].az; - EXPECT_EQ(get_asazel[16].el)>( - reinterpret_cast(&last_msg_->azel[16].el)), - 40) - << "incorrect value for azel[16].el, expected 40, is " - << last_msg_->azel[16].el; - EXPECT_EQ( - get_asazel[16].sid.code)>( - reinterpret_cast(&last_msg_->azel[16].sid.code)), - 3) - << "incorrect value for azel[16].sid.code, expected 3, is " - << last_msg_->azel[16].sid.code; - EXPECT_EQ( - get_asazel[16].sid.sat)>( - reinterpret_cast(&last_msg_->azel[16].sid.sat)), - 17) - << "incorrect value for azel[16].sid.sat, expected 17, is " - << last_msg_->azel[16].sid.sat; - EXPECT_EQ(get_asazel[17].az)>( - reinterpret_cast(&last_msg_->azel[17].az)), - 63) - << "incorrect value for azel[17].az, expected 63, is " - << last_msg_->azel[17].az; - EXPECT_EQ(get_asazel[17].el)>( - reinterpret_cast(&last_msg_->azel[17].el)), - 35) - << "incorrect value for azel[17].el, expected 35, is " - << last_msg_->azel[17].el; - EXPECT_EQ( - get_asazel[17].sid.code)>( - reinterpret_cast(&last_msg_->azel[17].sid.code)), - 3) - << "incorrect value for azel[17].sid.code, expected 3, is " - << last_msg_->azel[17].sid.code; - EXPECT_EQ( - get_asazel[17].sid.sat)>( - reinterpret_cast(&last_msg_->azel[17].sid.sat)), - 23) - << "incorrect value for azel[17].sid.sat, expected 23, is " - << last_msg_->azel[17].sid.sat; - EXPECT_EQ(get_asazel[18].az)>( - reinterpret_cast(&last_msg_->azel[18].az)), - 41) - << "incorrect value for azel[18].az, expected 41, is " - << last_msg_->azel[18].az; - EXPECT_EQ(get_asazel[18].el)>( - reinterpret_cast(&last_msg_->azel[18].el)), - 73) - << "incorrect value for azel[18].el, expected 73, is " - << last_msg_->azel[18].el; - EXPECT_EQ( - get_asazel[18].sid.code)>( - reinterpret_cast(&last_msg_->azel[18].sid.code)), - 3) - << "incorrect value for azel[18].sid.code, expected 3, is " - << last_msg_->azel[18].sid.code; - EXPECT_EQ( - get_asazel[18].sid.sat)>( - reinterpret_cast(&last_msg_->azel[18].sid.sat)), - 24) - << "incorrect value for azel[18].sid.sat, expected 24, is " - << last_msg_->azel[18].sid.sat; - EXPECT_EQ(get_asazel[19].az)>( - reinterpret_cast(&last_msg_->azel[19].az)), - 114) - << "incorrect value for azel[19].az, expected 114, is " - << last_msg_->azel[19].az; - EXPECT_EQ(get_asazel[19].el)>( - reinterpret_cast(&last_msg_->azel[19].el)), - 26) - << "incorrect value for azel[19].el, expected 26, is " - << last_msg_->azel[19].el; - EXPECT_EQ( - get_asazel[19].sid.code)>( - reinterpret_cast(&last_msg_->azel[19].sid.code)), - 12) - << "incorrect value for azel[19].sid.code, expected 12, is " - << last_msg_->azel[19].sid.code; - EXPECT_EQ( - get_asazel[19].sid.sat)>( - reinterpret_cast(&last_msg_->azel[19].sid.sat)), - 20) - << "incorrect value for azel[19].sid.sat, expected 20, is " - << last_msg_->azel[19].sid.sat; - EXPECT_EQ(get_asazel[20].az)>( - reinterpret_cast(&last_msg_->azel[20].az)), - 72) - << "incorrect value for azel[20].az, expected 72, is " - << last_msg_->azel[20].az; - EXPECT_EQ(get_asazel[20].el)>( - reinterpret_cast(&last_msg_->azel[20].el)), - 54) - << "incorrect value for azel[20].el, expected 54, is " - << last_msg_->azel[20].el; - EXPECT_EQ( - get_asazel[20].sid.code)>( - reinterpret_cast(&last_msg_->azel[20].sid.code)), - 12) - << "incorrect value for azel[20].sid.code, expected 12, is " - << last_msg_->azel[20].sid.code; - EXPECT_EQ( - get_asazel[20].sid.sat)>( - reinterpret_cast(&last_msg_->azel[20].sid.sat)), - 27) - << "incorrect value for azel[20].sid.sat, expected 27, is " - << last_msg_->azel[20].sid.sat; - EXPECT_EQ(get_asazel[21].az)>( - reinterpret_cast(&last_msg_->azel[21].az)), - 69) - << "incorrect value for azel[21].az, expected 69, is " - << last_msg_->azel[21].az; - EXPECT_EQ(get_asazel[21].el)>( - reinterpret_cast(&last_msg_->azel[21].el)), - 3) - << "incorrect value for azel[21].el, expected 3, is " - << last_msg_->azel[21].el; - EXPECT_EQ( - get_asazel[21].sid.code)>( - reinterpret_cast(&last_msg_->azel[21].sid.code)), - 12) - << "incorrect value for azel[21].sid.code, expected 12, is " - << last_msg_->azel[21].sid.code; - EXPECT_EQ( - get_asazel[21].sid.sat)>( - reinterpret_cast(&last_msg_->azel[21].sid.sat)), - 28) - << "incorrect value for azel[21].sid.sat, expected 28, is " - << last_msg_->azel[21].sid.sat; - EXPECT_EQ(get_asazel[22].az)>( - reinterpret_cast(&last_msg_->azel[22].az)), - 158) - << "incorrect value for azel[22].az, expected 158, is " - << last_msg_->azel[22].az; - EXPECT_EQ(get_asazel[22].el)>( - reinterpret_cast(&last_msg_->azel[22].el)), - 14) - << "incorrect value for azel[22].el, expected 14, is " - << last_msg_->azel[22].el; - EXPECT_EQ( - get_asazel[22].sid.code)>( - reinterpret_cast(&last_msg_->azel[22].sid.code)), - 12) - << "incorrect value for azel[22].sid.code, expected 12, is " - << last_msg_->azel[22].sid.code; - EXPECT_EQ( - get_asazel[22].sid.sat)>( - reinterpret_cast(&last_msg_->azel[22].sid.sat)), - 29) - << "incorrect value for azel[22].sid.sat, expected 29, is " - << last_msg_->azel[22].sid.sat; - EXPECT_EQ(get_asazel[23].az)>( - reinterpret_cast(&last_msg_->azel[23].az)), - 152) - << "incorrect value for azel[23].az, expected 152, is " - << last_msg_->azel[23].az; - EXPECT_EQ(get_asazel[23].el)>( - reinterpret_cast(&last_msg_->azel[23].el)), - 68) - << "incorrect value for azel[23].el, expected 68, is " - << last_msg_->azel[23].el; - EXPECT_EQ( - get_asazel[23].sid.code)>( - reinterpret_cast(&last_msg_->azel[23].sid.code)), - 12) - << "incorrect value for azel[23].sid.code, expected 12, is " - << last_msg_->azel[23].sid.code; - EXPECT_EQ( - get_asazel[23].sid.sat)>( - reinterpret_cast(&last_msg_->azel[23].sid.sat)), - 30) - << "incorrect value for azel[23].sid.sat, expected 30, is " - << last_msg_->azel[23].sid.sat; - EXPECT_EQ(get_asazel[24].az)>( - reinterpret_cast(&last_msg_->azel[24].az)), - 120) - << "incorrect value for azel[24].az, expected 120, is " - << last_msg_->azel[24].az; - EXPECT_EQ(get_asazel[24].el)>( - reinterpret_cast(&last_msg_->azel[24].el)), - 82) - << "incorrect value for azel[24].el, expected 82, is " - << last_msg_->azel[24].el; - EXPECT_EQ( - get_asazel[24].sid.code)>( - reinterpret_cast(&last_msg_->azel[24].sid.code)), - 12) - << "incorrect value for azel[24].sid.code, expected 12, is " - << last_msg_->azel[24].sid.code; - EXPECT_EQ( - get_asazel[24].sid.sat)>( - reinterpret_cast(&last_msg_->azel[24].sid.sat)), - 32) - << "incorrect value for azel[24].sid.sat, expected 32, is " - << last_msg_->azel[24].sid.sat; - EXPECT_EQ(get_asazel[25].az)>( - reinterpret_cast(&last_msg_->azel[25].az)), - 131) - << "incorrect value for azel[25].az, expected 131, is " - << last_msg_->azel[25].az; - EXPECT_EQ(get_asazel[25].el)>( - reinterpret_cast(&last_msg_->azel[25].el)), - 6) - << "incorrect value for azel[25].el, expected 6, is " - << last_msg_->azel[25].el; - EXPECT_EQ( - get_asazel[25].sid.code)>( - reinterpret_cast(&last_msg_->azel[25].sid.code)), - 14) - << "incorrect value for azel[25].sid.code, expected 14, is " - << last_msg_->azel[25].sid.code; - EXPECT_EQ( - get_asazel[25].sid.sat)>( - reinterpret_cast(&last_msg_->azel[25].sid.sat)), - 2) - << "incorrect value for azel[25].sid.sat, expected 2, is " - << last_msg_->azel[25].sid.sat; - EXPECT_EQ(get_asazel[26].az)>( - reinterpret_cast(&last_msg_->azel[26].az)), - 27) - << "incorrect value for azel[26].az, expected 27, is " - << last_msg_->azel[26].az; - EXPECT_EQ(get_asazel[26].el)>( - reinterpret_cast(&last_msg_->azel[26].el)), - 44) - << "incorrect value for azel[26].el, expected 44, is " - << last_msg_->azel[26].el; - EXPECT_EQ( - get_asazel[26].sid.code)>( - reinterpret_cast(&last_msg_->azel[26].sid.code)), - 14) - << "incorrect value for azel[26].sid.code, expected 14, is " - << last_msg_->azel[26].sid.code; - EXPECT_EQ( - get_asazel[26].sid.sat)>( - reinterpret_cast(&last_msg_->azel[26].sid.sat)), - 4) - << "incorrect value for azel[26].sid.sat, expected 4, is " - << last_msg_->azel[26].sid.sat; - EXPECT_EQ(get_asazel[27].az)>( - reinterpret_cast(&last_msg_->azel[27].az)), - 101) - << "incorrect value for azel[27].az, expected 101, is " - << last_msg_->azel[27].az; - EXPECT_EQ(get_asazel[27].el)>( - reinterpret_cast(&last_msg_->azel[27].el)), - 21) - << "incorrect value for azel[27].el, expected 21, is " - << last_msg_->azel[27].el; - EXPECT_EQ( - get_asazel[27].sid.code)>( - reinterpret_cast(&last_msg_->azel[27].sid.code)), - 14) - << "incorrect value for azel[27].sid.code, expected 14, is " - << last_msg_->azel[27].sid.code; - EXPECT_EQ( - get_asazel[27].sid.sat)>( - reinterpret_cast(&last_msg_->azel[27].sid.sat)), - 5) - << "incorrect value for azel[27].sid.sat, expected 5, is " - << last_msg_->azel[27].sid.sat; - EXPECT_EQ(get_asazel[28].az)>( - reinterpret_cast(&last_msg_->azel[28].az)), - 81) - << "incorrect value for azel[28].az, expected 81, is " - << last_msg_->azel[28].az; - EXPECT_EQ(get_asazel[28].el)>( - reinterpret_cast(&last_msg_->azel[28].el)), - 65) - << "incorrect value for azel[28].el, expected 65, is " - << last_msg_->azel[28].el; - EXPECT_EQ( - get_asazel[28].sid.code)>( - reinterpret_cast(&last_msg_->azel[28].sid.code)), - 14) - << "incorrect value for azel[28].sid.code, expected 14, is " - << last_msg_->azel[28].sid.code; - EXPECT_EQ( - get_asazel[28].sid.sat)>( - reinterpret_cast(&last_msg_->azel[28].sid.sat)), - 9) - << "incorrect value for azel[28].sid.sat, expected 9, is " - << last_msg_->azel[28].sid.sat; - EXPECT_EQ(get_asazel[29].az)>( - reinterpret_cast(&last_msg_->azel[29].az)), - 49) - << "incorrect value for azel[29].az, expected 49, is " - << last_msg_->azel[29].az; - EXPECT_EQ(get_asazel[29].el)>( - reinterpret_cast(&last_msg_->azel[29].el)), - 56) - << "incorrect value for azel[29].el, expected 56, is " - << last_msg_->azel[29].el; - EXPECT_EQ( - get_asazel[29].sid.code)>( - reinterpret_cast(&last_msg_->azel[29].sid.code)), - 14) - << "incorrect value for azel[29].sid.code, expected 14, is " - << last_msg_->azel[29].sid.code; - EXPECT_EQ( - get_asazel[29].sid.sat)>( - reinterpret_cast(&last_msg_->azel[29].sid.sat)), - 11) - << "incorrect value for azel[29].sid.sat, expected 11, is " - << last_msg_->azel[29].sid.sat; - EXPECT_EQ(get_asazel[30].az)>( - reinterpret_cast(&last_msg_->azel[30].az)), - 59) - << "incorrect value for azel[30].az, expected 59, is " - << last_msg_->azel[30].az; - EXPECT_EQ(get_asazel[30].el)>( - reinterpret_cast(&last_msg_->azel[30].el)), - 6) - << "incorrect value for azel[30].el, expected 6, is " - << last_msg_->azel[30].el; - EXPECT_EQ( - get_asazel[30].sid.code)>( - reinterpret_cast(&last_msg_->azel[30].sid.code)), - 14) - << "incorrect value for azel[30].sid.code, expected 14, is " - << last_msg_->azel[30].sid.code; - EXPECT_EQ( - get_asazel[30].sid.sat)>( - reinterpret_cast(&last_msg_->azel[30].sid.sat)), - 12) - << "incorrect value for azel[30].sid.sat, expected 12, is " - << last_msg_->azel[30].sid.sat; - EXPECT_EQ(get_asazel[31].az)>( - reinterpret_cast(&last_msg_->azel[31].az)), - 154) - << "incorrect value for azel[31].az, expected 154, is " - << last_msg_->azel[31].az; - EXPECT_EQ(get_asazel[31].el)>( - reinterpret_cast(&last_msg_->azel[31].el)), - 4) - << "incorrect value for azel[31].el, expected 4, is " - << last_msg_->azel[31].el; - EXPECT_EQ( - get_asazel[31].sid.code)>( - reinterpret_cast(&last_msg_->azel[31].sid.code)), - 14) - << "incorrect value for azel[31].sid.code, expected 14, is " - << last_msg_->azel[31].sid.code; - EXPECT_EQ( - get_asazel[31].sid.sat)>( - reinterpret_cast(&last_msg_->azel[31].sid.sat)), - 30) - << "incorrect value for azel[31].sid.sat, expected 30, is " - << last_msg_->azel[31].sid.sat; - EXPECT_EQ(get_asazel[32].az)>( - reinterpret_cast(&last_msg_->azel[32].az)), - 165) - << "incorrect value for azel[32].az, expected 165, is " - << last_msg_->azel[32].az; - EXPECT_EQ(get_asazel[32].el)>( - reinterpret_cast(&last_msg_->azel[32].el)), - 62) - << "incorrect value for azel[32].el, expected 62, is " - << last_msg_->azel[32].el; - EXPECT_EQ( - get_asazel[32].sid.code)>( - reinterpret_cast(&last_msg_->azel[32].sid.code)), - 14) - << "incorrect value for azel[32].sid.code, expected 14, is " - << last_msg_->azel[32].sid.code; - EXPECT_EQ( - get_asazel[32].sid.sat)>( - reinterpret_cast(&last_msg_->azel[32].sid.sat)), - 36) - << "incorrect value for azel[32].sid.sat, expected 36, is " - << last_msg_->azel[32].sid.sat; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_MsgSvConfigurationGpsDep.cc b/c/test/legacy/cpp/auto_check_sbp_observation_MsgSvConfigurationGpsDep.cc deleted file mode 100644 index 1fca4742dd..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_MsgSvConfigurationGpsDep.cc +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_MsgSvConfigurationGpsDep.yaml -// by generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_MsgSvConfigurationGpsDep0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_MsgSvConfigurationGpsDep0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_sv_configuration_gps_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_sv_configuration_gps_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_MsgSvConfigurationGpsDep0, Test) { - uint8_t encoded_frame[] = { - 85, 145, 0, 123, 0, 10, 0, 0, 0, 0, 0, 0, 66, 188, 101, 167, 18, 42, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_sv_configuration_gps_dep_t *test_msg = - (msg_sv_configuration_gps_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->l2c_mask = 2808462402; - test_msg->t_nmct.tow = 0; - test_msg->t_nmct.wn = 0; - - EXPECT_EQ(send_message(0x91, 123, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 123); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asl2c_mask)>( - reinterpret_cast(&last_msg_->l2c_mask)), - 2808462402) - << "incorrect value for l2c_mask, expected 2808462402, is " - << last_msg_->l2c_mask; - EXPECT_EQ(get_ast_nmct.tow)>( - reinterpret_cast(&last_msg_->t_nmct.tow)), - 0) - << "incorrect value for t_nmct.tow, expected 0, is " - << last_msg_->t_nmct.tow; - EXPECT_EQ(get_ast_nmct.wn)>( - reinterpret_cast(&last_msg_->t_nmct.wn)), - 0) - << "incorrect value for t_nmct.wn, expected 0, is " - << last_msg_->t_nmct.wn; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_msgEphemerisDepB.cc b/c/test/legacy/cpp/auto_check_sbp_observation_msgEphemerisDepB.cc deleted file mode 100644 index 5489e1a2cd..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_msgEphemerisDepB.cc +++ /dev/null @@ -1,1253 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_msgEphemerisDepB.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_msgEphemerisDepB0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_msgEphemerisDepB0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_msgEphemerisDepB0, Test) { - uint8_t encoded_frame[] = { - 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 0, 60, 190, 0, - 0, 0, 0, 0, 186, 82, 192, 0, 0, 0, 0, 0, 76, 109, 64, - 0, 0, 0, 0, 0, 132, 208, 190, 0, 0, 0, 0, 0, 254, 220, - 62, 0, 0, 0, 0, 0, 0, 113, 62, 0, 0, 0, 0, 0, 0, - 133, 190, 28, 36, 25, 81, 223, 254, 52, 62, 220, 116, 216, 39, 33, - 189, 3, 64, 0, 0, 0, 156, 177, 204, 134, 63, 0, 0, 160, 220, - 182, 33, 180, 64, 152, 225, 192, 44, 254, 76, 238, 191, 41, 150, 24, - 2, 148, 156, 65, 190, 252, 90, 119, 48, 15, 215, 240, 63, 124, 127, - 115, 94, 208, 16, 238, 63, 165, 115, 52, 74, 97, 167, 246, 189, 0, - 0, 0, 0, 192, 180, 229, 190, 0, 0, 0, 0, 0, 0, 112, 189, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, - 65, 46, 7, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 1, 1, - 3, 0, 225, 156, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_dep_b_t *test_msg = (msg_ephemeris_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = -1.035025343298912e-05; - test_msg->af1 = -9.094947017729282e-13; - test_msg->af2 = 0.0; - test_msg->c_ic = 6.332993507385254e-08; - test_msg->c_is = -1.564621925354004e-07; - test_msg->c_rc = 234.375; - test_msg->c_rs = -74.90625; - test_msg->c_uc = -3.937631845474243e-06; - test_msg->c_us = 6.9122761487960815e-06; - test_msg->dn = 4.8884179079418005e-09; - test_msg->ecc = 0.011132609914056957; - test_msg->healthy = 1; - test_msg->inc = 0.9395524830579087; - test_msg->inc_dot = -3.296565886629854e-10; - test_msg->iode = 0; - test_msg->m0 = 2.467348395627239; - test_msg->omega0 = -0.9468985437479658; - test_msg->omegadot = -8.201055892610478e-09; - test_msg->prn = 3; - test_msg->sqrta = 5153.714303970337; - test_msg->tgd = -6.51925802230835e-09; - test_msg->toc_tow = 410400.0; - test_msg->toc_wn = 1838; - test_msg->toe_tow = 410400.0; - test_msg->toe_wn = 1838; - test_msg->valid = 1; - test_msg->w = 1.0525047200405302; - - EXPECT_EQ(send_message(0x46, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - -1.0350253433e-05 * 100), 0.05) - << "incorrect value for af0, expected -1.0350253433e-05, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - -9.09494701773e-13 * 100), 0.05) - << "incorrect value for af1, expected -9.09494701773e-13, is " - << last_msg_->af1; - EXPECT_LT((last_msg_->af2 * 100 - 0.0 * 100), 0.05) - << "incorrect value for af2, expected 0.0, is " << last_msg_->af2; - EXPECT_LT((last_msg_->c_ic * 100 - 6.33299350739e-08 * 100), 0.05) - << "incorrect value for c_ic, expected 6.33299350739e-08, is " - << last_msg_->c_ic; - EXPECT_LT((last_msg_->c_is * 100 - -1.56462192535e-07 * 100), 0.05) - << "incorrect value for c_is, expected -1.56462192535e-07, is " - << last_msg_->c_is; - EXPECT_LT((last_msg_->c_rc * 100 - 234.375 * 100), 0.05) - << "incorrect value for c_rc, expected 234.375, is " << last_msg_->c_rc; - EXPECT_LT((last_msg_->c_rs * 100 - -74.90625 * 100), 0.05) - << "incorrect value for c_rs, expected -74.90625, is " << last_msg_->c_rs; - EXPECT_LT((last_msg_->c_uc * 100 - -3.93763184547e-06 * 100), 0.05) - << "incorrect value for c_uc, expected -3.93763184547e-06, is " - << last_msg_->c_uc; - EXPECT_LT((last_msg_->c_us * 100 - 6.9122761488e-06 * 100), 0.05) - << "incorrect value for c_us, expected 6.9122761488e-06, is " - << last_msg_->c_us; - EXPECT_LT((last_msg_->dn * 100 - 4.88841790794e-09 * 100), 0.05) - << "incorrect value for dn, expected 4.88841790794e-09, is " - << last_msg_->dn; - EXPECT_LT((last_msg_->ecc * 100 - 0.0111326099141 * 100), 0.05) - << "incorrect value for ecc, expected 0.0111326099141, is " - << last_msg_->ecc; - EXPECT_EQ(get_ashealthy)>( - reinterpret_cast(&last_msg_->healthy)), - 1) - << "incorrect value for healthy, expected 1, is " << last_msg_->healthy; - EXPECT_LT((last_msg_->inc * 100 - 0.939552483058 * 100), 0.05) - << "incorrect value for inc, expected 0.939552483058, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->inc_dot * 100 - -3.29656588663e-10 * 100), 0.05) - << "incorrect value for inc_dot, expected -3.29656588663e-10, is " - << last_msg_->inc_dot; - EXPECT_EQ(get_asiode)>( - reinterpret_cast(&last_msg_->iode)), - 0) - << "incorrect value for iode, expected 0, is " << last_msg_->iode; - EXPECT_LT((last_msg_->m0 * 100 - 2.46734839563 * 100), 0.05) - << "incorrect value for m0, expected 2.46734839563, is " << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - -0.946898543748 * 100), 0.05) - << "incorrect value for omega0, expected -0.946898543748, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -8.20105589261e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -8.20105589261e-09, is " - << last_msg_->omegadot; - EXPECT_EQ(get_asprn)>( - reinterpret_cast(&last_msg_->prn)), - 3) - << "incorrect value for prn, expected 3, is " << last_msg_->prn; - EXPECT_LT((last_msg_->sqrta * 100 - 5153.71430397 * 100), 0.05) - << "incorrect value for sqrta, expected 5153.71430397, is " - << last_msg_->sqrta; - EXPECT_LT((last_msg_->tgd * 100 - -6.51925802231e-09 * 100), 0.05) - << "incorrect value for tgd, expected -6.51925802231e-09, is " - << last_msg_->tgd; - EXPECT_LT((last_msg_->toc_tow * 100 - 410400.0 * 100), 0.05) - << "incorrect value for toc_tow, expected 410400.0, is " - << last_msg_->toc_tow; - EXPECT_EQ(get_astoc_wn)>( - reinterpret_cast(&last_msg_->toc_wn)), - 1838) - << "incorrect value for toc_wn, expected 1838, is " << last_msg_->toc_wn; - EXPECT_LT((last_msg_->toe_tow * 100 - 410400.0 * 100), 0.05) - << "incorrect value for toe_tow, expected 410400.0, is " - << last_msg_->toe_tow; - EXPECT_EQ(get_astoe_wn)>( - reinterpret_cast(&last_msg_->toe_wn)), - 1838) - << "incorrect value for toe_wn, expected 1838, is " << last_msg_->toe_wn; - EXPECT_EQ(get_asvalid)>( - reinterpret_cast(&last_msg_->valid)), - 1) - << "incorrect value for valid, expected 1, is " << last_msg_->valid; - EXPECT_LT((last_msg_->w * 100 - 1.05250472004 * 100), 0.05) - << "incorrect value for w, expected 1.05250472004, is " << last_msg_->w; -} -class Test_legacy_auto_check_sbp_observation_msgEphemerisDepB1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_msgEphemerisDepB1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_msgEphemerisDepB1, Test) { - uint8_t encoded_frame[] = { - 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 0, 68, 190, 0, - 0, 0, 0, 0, 72, 66, 64, 0, 0, 0, 0, 128, 188, 115, 64, - 0, 0, 0, 0, 0, 80, 193, 62, 0, 0, 0, 0, 0, 164, 204, - 62, 0, 0, 0, 0, 0, 0, 130, 62, 0, 0, 0, 0, 0, 0, - 128, 62, 72, 181, 127, 6, 208, 225, 52, 62, 158, 174, 129, 91, 27, - 105, 249, 191, 0, 0, 0, 96, 204, 57, 128, 63, 0, 0, 160, 35, - 146, 33, 180, 64, 247, 169, 1, 36, 133, 206, 243, 63, 79, 11, 109, - 92, 156, 208, 65, 190, 103, 78, 3, 253, 223, 147, 255, 191, 164, 214, - 90, 250, 218, 240, 238, 63, 94, 239, 187, 37, 36, 10, 242, 61, 0, - 0, 0, 0, 176, 91, 19, 63, 0, 0, 0, 0, 0, 0, 137, 189, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, - 65, 46, 7, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 1, 1, - 13, 0, 180, 21, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_dep_b_t *test_msg = (msg_ephemeris_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = 7.384549826383591e-05; - test_msg->af1 = -2.8421709430404007e-12; - test_msg->af2 = 0.0; - test_msg->c_ic = 1.341104507446289e-07; - test_msg->c_is = 1.1920928955078125e-07; - test_msg->c_rc = 315.78125; - test_msg->c_rs = 36.5625; - test_msg->c_uc = 2.0638108253479004e-06; - test_msg->c_us = 3.4142285585403442e-06; - test_msg->dn = 4.86198823561129e-09; - test_msg->ecc = 0.007922741584479809; - test_msg->healthy = 1; - test_msg->inc = 0.9669012918227122; - test_msg->inc_dot = 2.6251093463412166e-10; - test_msg->iode = 0; - test_msg->m0 = -1.588160855720083; - test_msg->omega0 = 1.237919941568746; - test_msg->omegadot = -8.295702692172441e-09; - test_msg->prn = 13; - test_msg->sqrta = 5153.57085609436; - test_msg->tgd = -9.313225746154785e-09; - test_msg->toc_tow = 410400.0; - test_msg->toc_wn = 1838; - test_msg->toe_tow = 410400.0; - test_msg->toe_wn = 1838; - test_msg->valid = 1; - test_msg->w = -1.9736022837941165; - - EXPECT_EQ(send_message(0x46, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - 7.38454982638e-05 * 100), 0.05) - << "incorrect value for af0, expected 7.38454982638e-05, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - -2.84217094304e-12 * 100), 0.05) - << "incorrect value for af1, expected -2.84217094304e-12, is " - << last_msg_->af1; - EXPECT_LT((last_msg_->af2 * 100 - 0.0 * 100), 0.05) - << "incorrect value for af2, expected 0.0, is " << last_msg_->af2; - EXPECT_LT((last_msg_->c_ic * 100 - 1.34110450745e-07 * 100), 0.05) - << "incorrect value for c_ic, expected 1.34110450745e-07, is " - << last_msg_->c_ic; - EXPECT_LT((last_msg_->c_is * 100 - 1.19209289551e-07 * 100), 0.05) - << "incorrect value for c_is, expected 1.19209289551e-07, is " - << last_msg_->c_is; - EXPECT_LT((last_msg_->c_rc * 100 - 315.78125 * 100), 0.05) - << "incorrect value for c_rc, expected 315.78125, is " << last_msg_->c_rc; - EXPECT_LT((last_msg_->c_rs * 100 - 36.5625 * 100), 0.05) - << "incorrect value for c_rs, expected 36.5625, is " << last_msg_->c_rs; - EXPECT_LT((last_msg_->c_uc * 100 - 2.06381082535e-06 * 100), 0.05) - << "incorrect value for c_uc, expected 2.06381082535e-06, is " - << last_msg_->c_uc; - EXPECT_LT((last_msg_->c_us * 100 - 3.41422855854e-06 * 100), 0.05) - << "incorrect value for c_us, expected 3.41422855854e-06, is " - << last_msg_->c_us; - EXPECT_LT((last_msg_->dn * 100 - 4.86198823561e-09 * 100), 0.05) - << "incorrect value for dn, expected 4.86198823561e-09, is " - << last_msg_->dn; - EXPECT_LT((last_msg_->ecc * 100 - 0.00792274158448 * 100), 0.05) - << "incorrect value for ecc, expected 0.00792274158448, is " - << last_msg_->ecc; - EXPECT_EQ(get_ashealthy)>( - reinterpret_cast(&last_msg_->healthy)), - 1) - << "incorrect value for healthy, expected 1, is " << last_msg_->healthy; - EXPECT_LT((last_msg_->inc * 100 - 0.966901291823 * 100), 0.05) - << "incorrect value for inc, expected 0.966901291823, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->inc_dot * 100 - 2.62510934634e-10 * 100), 0.05) - << "incorrect value for inc_dot, expected 2.62510934634e-10, is " - << last_msg_->inc_dot; - EXPECT_EQ(get_asiode)>( - reinterpret_cast(&last_msg_->iode)), - 0) - << "incorrect value for iode, expected 0, is " << last_msg_->iode; - EXPECT_LT((last_msg_->m0 * 100 - -1.58816085572 * 100), 0.05) - << "incorrect value for m0, expected -1.58816085572, is " - << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - 1.23791994157 * 100), 0.05) - << "incorrect value for omega0, expected 1.23791994157, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -8.29570269217e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -8.29570269217e-09, is " - << last_msg_->omegadot; - EXPECT_EQ(get_asprn)>( - reinterpret_cast(&last_msg_->prn)), - 13) - << "incorrect value for prn, expected 13, is " << last_msg_->prn; - EXPECT_LT((last_msg_->sqrta * 100 - 5153.57085609 * 100), 0.05) - << "incorrect value for sqrta, expected 5153.57085609, is " - << last_msg_->sqrta; - EXPECT_LT((last_msg_->tgd * 100 - -9.31322574615e-09 * 100), 0.05) - << "incorrect value for tgd, expected -9.31322574615e-09, is " - << last_msg_->tgd; - EXPECT_LT((last_msg_->toc_tow * 100 - 410400.0 * 100), 0.05) - << "incorrect value for toc_tow, expected 410400.0, is " - << last_msg_->toc_tow; - EXPECT_EQ(get_astoc_wn)>( - reinterpret_cast(&last_msg_->toc_wn)), - 1838) - << "incorrect value for toc_wn, expected 1838, is " << last_msg_->toc_wn; - EXPECT_LT((last_msg_->toe_tow * 100 - 410400.0 * 100), 0.05) - << "incorrect value for toe_tow, expected 410400.0, is " - << last_msg_->toe_tow; - EXPECT_EQ(get_astoe_wn)>( - reinterpret_cast(&last_msg_->toe_wn)), - 1838) - << "incorrect value for toe_wn, expected 1838, is " << last_msg_->toe_wn; - EXPECT_EQ(get_asvalid)>( - reinterpret_cast(&last_msg_->valid)), - 1) - << "incorrect value for valid, expected 1, is " << last_msg_->valid; - EXPECT_LT((last_msg_->w * 100 - -1.97360228379 * 100), 0.05) - << "incorrect value for w, expected -1.97360228379, is " << last_msg_->w; -} -class Test_legacy_auto_check_sbp_observation_msgEphemerisDepB2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_msgEphemerisDepB2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_msgEphemerisDepB2, Test) { - uint8_t encoded_frame[] = { - 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 0, 56, 62, 0, - 0, 0, 0, 0, 40, 81, 192, 0, 0, 0, 0, 0, 129, 109, 64, - 0, 0, 0, 0, 0, 28, 205, 190, 0, 0, 0, 0, 0, 76, 223, - 62, 0, 0, 0, 0, 0, 0, 105, 190, 0, 0, 0, 0, 0, 0, - 92, 190, 134, 161, 223, 255, 243, 43, 51, 62, 146, 176, 113, 142, 234, - 164, 5, 64, 0, 0, 0, 56, 175, 140, 112, 63, 0, 0, 192, 90, - 171, 33, 180, 64, 36, 38, 237, 255, 200, 160, 237, 191, 204, 92, 63, - 154, 49, 91, 65, 190, 125, 94, 251, 132, 52, 61, 216, 63, 2, 139, - 28, 27, 231, 199, 238, 63, 124, 183, 4, 180, 194, 30, 247, 189, 0, - 0, 0, 0, 0, 104, 222, 190, 0, 0, 0, 0, 0, 0, 96, 61, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, - 65, 46, 7, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 1, 1, - 0, 0, 222, 152, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_dep_b_t *test_msg = (msg_ephemeris_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = -7.249414920806885e-06; - test_msg->af1 = 4.547473508864641e-13; - test_msg->af2 = 0.0; - test_msg->c_ic = -4.6566128730773926e-08; - test_msg->c_is = -2.60770320892334e-08; - test_msg->c_rc = 236.03125; - test_msg->c_rs = -68.625; - test_msg->c_uc = -3.470107913017273e-06; - test_msg->c_us = 7.461756467819214e-06; - test_msg->dn = 4.4637573619826565e-09; - test_msg->ecc = 0.004040417145006359; - test_msg->healthy = 1; - test_msg->inc = 0.9619021920701416; - test_msg->inc_dot = -3.3644258561271105e-10; - test_msg->iode = 0; - test_msg->m0 = 2.7055255058713295; - test_msg->omega0 = -0.9258770941316397; - test_msg->omegadot = -8.082122367123182e-09; - test_msg->prn = 0; - test_msg->sqrta = 5153.669353485107; - test_msg->tgd = 5.587935447692871e-09; - test_msg->toc_tow = 410400.0; - test_msg->toc_wn = 1838; - test_msg->toe_tow = 410400.0; - test_msg->toe_wn = 1838; - test_msg->valid = 1; - test_msg->w = 0.37873566614641857; - - EXPECT_EQ(send_message(0x46, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - -7.24941492081e-06 * 100), 0.05) - << "incorrect value for af0, expected -7.24941492081e-06, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - 4.54747350886e-13 * 100), 0.05) - << "incorrect value for af1, expected 4.54747350886e-13, is " - << last_msg_->af1; - EXPECT_LT((last_msg_->af2 * 100 - 0.0 * 100), 0.05) - << "incorrect value for af2, expected 0.0, is " << last_msg_->af2; - EXPECT_LT((last_msg_->c_ic * 100 - -4.65661287308e-08 * 100), 0.05) - << "incorrect value for c_ic, expected -4.65661287308e-08, is " - << last_msg_->c_ic; - EXPECT_LT((last_msg_->c_is * 100 - -2.60770320892e-08 * 100), 0.05) - << "incorrect value for c_is, expected -2.60770320892e-08, is " - << last_msg_->c_is; - EXPECT_LT((last_msg_->c_rc * 100 - 236.03125 * 100), 0.05) - << "incorrect value for c_rc, expected 236.03125, is " << last_msg_->c_rc; - EXPECT_LT((last_msg_->c_rs * 100 - -68.625 * 100), 0.05) - << "incorrect value for c_rs, expected -68.625, is " << last_msg_->c_rs; - EXPECT_LT((last_msg_->c_uc * 100 - -3.47010791302e-06 * 100), 0.05) - << "incorrect value for c_uc, expected -3.47010791302e-06, is " - << last_msg_->c_uc; - EXPECT_LT((last_msg_->c_us * 100 - 7.46175646782e-06 * 100), 0.05) - << "incorrect value for c_us, expected 7.46175646782e-06, is " - << last_msg_->c_us; - EXPECT_LT((last_msg_->dn * 100 - 4.46375736198e-09 * 100), 0.05) - << "incorrect value for dn, expected 4.46375736198e-09, is " - << last_msg_->dn; - EXPECT_LT((last_msg_->ecc * 100 - 0.00404041714501 * 100), 0.05) - << "incorrect value for ecc, expected 0.00404041714501, is " - << last_msg_->ecc; - EXPECT_EQ(get_ashealthy)>( - reinterpret_cast(&last_msg_->healthy)), - 1) - << "incorrect value for healthy, expected 1, is " << last_msg_->healthy; - EXPECT_LT((last_msg_->inc * 100 - 0.96190219207 * 100), 0.05) - << "incorrect value for inc, expected 0.96190219207, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->inc_dot * 100 - -3.36442585613e-10 * 100), 0.05) - << "incorrect value for inc_dot, expected -3.36442585613e-10, is " - << last_msg_->inc_dot; - EXPECT_EQ(get_asiode)>( - reinterpret_cast(&last_msg_->iode)), - 0) - << "incorrect value for iode, expected 0, is " << last_msg_->iode; - EXPECT_LT((last_msg_->m0 * 100 - 2.70552550587 * 100), 0.05) - << "incorrect value for m0, expected 2.70552550587, is " << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - -0.925877094132 * 100), 0.05) - << "incorrect value for omega0, expected -0.925877094132, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -8.08212236712e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -8.08212236712e-09, is " - << last_msg_->omegadot; - EXPECT_EQ(get_asprn)>( - reinterpret_cast(&last_msg_->prn)), - 0) - << "incorrect value for prn, expected 0, is " << last_msg_->prn; - EXPECT_LT((last_msg_->sqrta * 100 - 5153.66935349 * 100), 0.05) - << "incorrect value for sqrta, expected 5153.66935349, is " - << last_msg_->sqrta; - EXPECT_LT((last_msg_->tgd * 100 - 5.58793544769e-09 * 100), 0.05) - << "incorrect value for tgd, expected 5.58793544769e-09, is " - << last_msg_->tgd; - EXPECT_LT((last_msg_->toc_tow * 100 - 410400.0 * 100), 0.05) - << "incorrect value for toc_tow, expected 410400.0, is " - << last_msg_->toc_tow; - EXPECT_EQ(get_astoc_wn)>( - reinterpret_cast(&last_msg_->toc_wn)), - 1838) - << "incorrect value for toc_wn, expected 1838, is " << last_msg_->toc_wn; - EXPECT_LT((last_msg_->toe_tow * 100 - 410400.0 * 100), 0.05) - << "incorrect value for toe_tow, expected 410400.0, is " - << last_msg_->toe_tow; - EXPECT_EQ(get_astoe_wn)>( - reinterpret_cast(&last_msg_->toe_wn)), - 1838) - << "incorrect value for toe_wn, expected 1838, is " << last_msg_->toe_wn; - EXPECT_EQ(get_asvalid)>( - reinterpret_cast(&last_msg_->valid)), - 1) - << "incorrect value for valid, expected 1, is " << last_msg_->valid; - EXPECT_LT((last_msg_->w * 100 - 0.378735666146 * 100), 0.05) - << "incorrect value for w, expected 0.378735666146, is " << last_msg_->w; -} -class Test_legacy_auto_check_sbp_observation_msgEphemerisDepB3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_msgEphemerisDepB3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_msgEphemerisDepB3, Test) { - uint8_t encoded_frame[] = { - 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 0, 68, 190, 0, - 0, 0, 0, 0, 72, 66, 64, 0, 0, 0, 0, 128, 188, 115, 64, - 0, 0, 0, 0, 0, 80, 193, 62, 0, 0, 0, 0, 0, 164, 204, - 62, 0, 0, 0, 0, 0, 0, 130, 62, 0, 0, 0, 0, 0, 0, - 128, 62, 72, 181, 127, 6, 208, 225, 52, 62, 158, 174, 129, 91, 27, - 105, 249, 191, 0, 0, 0, 96, 204, 57, 128, 63, 0, 0, 160, 35, - 146, 33, 180, 64, 247, 169, 1, 36, 133, 206, 243, 63, 79, 11, 109, - 92, 156, 208, 65, 190, 103, 78, 3, 253, 223, 147, 255, 191, 164, 214, - 90, 250, 218, 240, 238, 63, 94, 239, 187, 37, 36, 10, 242, 61, 0, - 0, 0, 0, 176, 91, 19, 63, 0, 0, 0, 0, 0, 0, 137, 189, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, - 65, 46, 7, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 1, 1, - 13, 0, 180, 21, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_dep_b_t *test_msg = (msg_ephemeris_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = 7.384549826383591e-05; - test_msg->af1 = -2.8421709430404007e-12; - test_msg->af2 = 0.0; - test_msg->c_ic = 1.341104507446289e-07; - test_msg->c_is = 1.1920928955078125e-07; - test_msg->c_rc = 315.78125; - test_msg->c_rs = 36.5625; - test_msg->c_uc = 2.0638108253479004e-06; - test_msg->c_us = 3.4142285585403442e-06; - test_msg->dn = 4.86198823561129e-09; - test_msg->ecc = 0.007922741584479809; - test_msg->healthy = 1; - test_msg->inc = 0.9669012918227122; - test_msg->inc_dot = 2.6251093463412166e-10; - test_msg->iode = 0; - test_msg->m0 = -1.588160855720083; - test_msg->omega0 = 1.237919941568746; - test_msg->omegadot = -8.295702692172441e-09; - test_msg->prn = 13; - test_msg->sqrta = 5153.57085609436; - test_msg->tgd = -9.313225746154785e-09; - test_msg->toc_tow = 410400.0; - test_msg->toc_wn = 1838; - test_msg->toe_tow = 410400.0; - test_msg->toe_wn = 1838; - test_msg->valid = 1; - test_msg->w = -1.9736022837941165; - - EXPECT_EQ(send_message(0x46, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - 7.38454982638e-05 * 100), 0.05) - << "incorrect value for af0, expected 7.38454982638e-05, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - -2.84217094304e-12 * 100), 0.05) - << "incorrect value for af1, expected -2.84217094304e-12, is " - << last_msg_->af1; - EXPECT_LT((last_msg_->af2 * 100 - 0.0 * 100), 0.05) - << "incorrect value for af2, expected 0.0, is " << last_msg_->af2; - EXPECT_LT((last_msg_->c_ic * 100 - 1.34110450745e-07 * 100), 0.05) - << "incorrect value for c_ic, expected 1.34110450745e-07, is " - << last_msg_->c_ic; - EXPECT_LT((last_msg_->c_is * 100 - 1.19209289551e-07 * 100), 0.05) - << "incorrect value for c_is, expected 1.19209289551e-07, is " - << last_msg_->c_is; - EXPECT_LT((last_msg_->c_rc * 100 - 315.78125 * 100), 0.05) - << "incorrect value for c_rc, expected 315.78125, is " << last_msg_->c_rc; - EXPECT_LT((last_msg_->c_rs * 100 - 36.5625 * 100), 0.05) - << "incorrect value for c_rs, expected 36.5625, is " << last_msg_->c_rs; - EXPECT_LT((last_msg_->c_uc * 100 - 2.06381082535e-06 * 100), 0.05) - << "incorrect value for c_uc, expected 2.06381082535e-06, is " - << last_msg_->c_uc; - EXPECT_LT((last_msg_->c_us * 100 - 3.41422855854e-06 * 100), 0.05) - << "incorrect value for c_us, expected 3.41422855854e-06, is " - << last_msg_->c_us; - EXPECT_LT((last_msg_->dn * 100 - 4.86198823561e-09 * 100), 0.05) - << "incorrect value for dn, expected 4.86198823561e-09, is " - << last_msg_->dn; - EXPECT_LT((last_msg_->ecc * 100 - 0.00792274158448 * 100), 0.05) - << "incorrect value for ecc, expected 0.00792274158448, is " - << last_msg_->ecc; - EXPECT_EQ(get_ashealthy)>( - reinterpret_cast(&last_msg_->healthy)), - 1) - << "incorrect value for healthy, expected 1, is " << last_msg_->healthy; - EXPECT_LT((last_msg_->inc * 100 - 0.966901291823 * 100), 0.05) - << "incorrect value for inc, expected 0.966901291823, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->inc_dot * 100 - 2.62510934634e-10 * 100), 0.05) - << "incorrect value for inc_dot, expected 2.62510934634e-10, is " - << last_msg_->inc_dot; - EXPECT_EQ(get_asiode)>( - reinterpret_cast(&last_msg_->iode)), - 0) - << "incorrect value for iode, expected 0, is " << last_msg_->iode; - EXPECT_LT((last_msg_->m0 * 100 - -1.58816085572 * 100), 0.05) - << "incorrect value for m0, expected -1.58816085572, is " - << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - 1.23791994157 * 100), 0.05) - << "incorrect value for omega0, expected 1.23791994157, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -8.29570269217e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -8.29570269217e-09, is " - << last_msg_->omegadot; - EXPECT_EQ(get_asprn)>( - reinterpret_cast(&last_msg_->prn)), - 13) - << "incorrect value for prn, expected 13, is " << last_msg_->prn; - EXPECT_LT((last_msg_->sqrta * 100 - 5153.57085609 * 100), 0.05) - << "incorrect value for sqrta, expected 5153.57085609, is " - << last_msg_->sqrta; - EXPECT_LT((last_msg_->tgd * 100 - -9.31322574615e-09 * 100), 0.05) - << "incorrect value for tgd, expected -9.31322574615e-09, is " - << last_msg_->tgd; - EXPECT_LT((last_msg_->toc_tow * 100 - 410400.0 * 100), 0.05) - << "incorrect value for toc_tow, expected 410400.0, is " - << last_msg_->toc_tow; - EXPECT_EQ(get_astoc_wn)>( - reinterpret_cast(&last_msg_->toc_wn)), - 1838) - << "incorrect value for toc_wn, expected 1838, is " << last_msg_->toc_wn; - EXPECT_LT((last_msg_->toe_tow * 100 - 410400.0 * 100), 0.05) - << "incorrect value for toe_tow, expected 410400.0, is " - << last_msg_->toe_tow; - EXPECT_EQ(get_astoe_wn)>( - reinterpret_cast(&last_msg_->toe_wn)), - 1838) - << "incorrect value for toe_wn, expected 1838, is " << last_msg_->toe_wn; - EXPECT_EQ(get_asvalid)>( - reinterpret_cast(&last_msg_->valid)), - 1) - << "incorrect value for valid, expected 1, is " << last_msg_->valid; - EXPECT_LT((last_msg_->w * 100 - -1.97360228379 * 100), 0.05) - << "incorrect value for w, expected -1.97360228379, is " << last_msg_->w; -} -class Test_legacy_auto_check_sbp_observation_msgEphemerisDepB4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_msgEphemerisDepB4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_msgEphemerisDepB4, Test) { - uint8_t encoded_frame[] = { - 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 128, 85, 190, 0, - 0, 0, 0, 0, 156, 69, 64, 0, 0, 0, 0, 128, 19, 115, 64, - 0, 0, 0, 0, 0, 160, 193, 62, 0, 0, 0, 0, 0, 152, 207, - 62, 0, 0, 0, 0, 0, 0, 97, 190, 0, 0, 0, 0, 0, 192, - 139, 190, 26, 26, 13, 149, 16, 152, 54, 62, 104, 7, 46, 214, 75, - 84, 5, 192, 0, 0, 0, 128, 230, 82, 132, 63, 0, 0, 160, 252, - 162, 33, 180, 64, 73, 6, 130, 54, 217, 171, 242, 63, 81, 224, 163, - 123, 238, 42, 66, 190, 206, 43, 141, 67, 243, 157, 5, 192, 113, 179, - 153, 187, 43, 92, 238, 63, 254, 236, 31, 43, 224, 157, 244, 61, 0, - 0, 0, 0, 232, 4, 26, 191, 0, 0, 0, 0, 0, 0, 134, 189, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, - 65, 46, 7, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 1, 1, - 22, 0, 99, 61, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_dep_b_t *test_msg = (msg_ephemeris_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = -9.925523772835732e-05; - test_msg->af1 = -2.5011104298755527e-12; - test_msg->af2 = 0.0; - test_msg->c_ic = -3.166496753692627e-08; - test_msg->c_is = -2.0675361156463623e-07; - test_msg->c_rc = 305.21875; - test_msg->c_rs = 43.21875; - test_msg->c_uc = 2.1010637283325195e-06; - test_msg->c_us = 3.766268491744995e-06; - test_msg->dn = 5.26057626697412e-09; - test_msg->ecc = 0.009923744946718216; - test_msg->healthy = 1; - test_msg->inc = 0.9487513221807672; - test_msg->inc_dot = 3.000124967247105e-10; - test_msg->iode = 0; - test_msg->m0 = -2.666160271911327; - test_msg->omega0 = 1.1669551972594425; - test_msg->omegadot = -8.45999524990264e-09; - test_msg->prn = 22; - test_msg->sqrta = 5153.636667251587; - test_msg->tgd = -2.0023435354232788e-08; - test_msg->toc_tow = 410400.0; - test_msg->toc_wn = 1838; - test_msg->toe_tow = 410400.0; - test_msg->toe_wn = 1838; - test_msg->valid = 1; - test_msg->w = -2.7021241452652935; - - EXPECT_EQ(send_message(0x46, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - -9.92552377284e-05 * 100), 0.05) - << "incorrect value for af0, expected -9.92552377284e-05, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - -2.50111042988e-12 * 100), 0.05) - << "incorrect value for af1, expected -2.50111042988e-12, is " - << last_msg_->af1; - EXPECT_LT((last_msg_->af2 * 100 - 0.0 * 100), 0.05) - << "incorrect value for af2, expected 0.0, is " << last_msg_->af2; - EXPECT_LT((last_msg_->c_ic * 100 - -3.16649675369e-08 * 100), 0.05) - << "incorrect value for c_ic, expected -3.16649675369e-08, is " - << last_msg_->c_ic; - EXPECT_LT((last_msg_->c_is * 100 - -2.06753611565e-07 * 100), 0.05) - << "incorrect value for c_is, expected -2.06753611565e-07, is " - << last_msg_->c_is; - EXPECT_LT((last_msg_->c_rc * 100 - 305.21875 * 100), 0.05) - << "incorrect value for c_rc, expected 305.21875, is " << last_msg_->c_rc; - EXPECT_LT((last_msg_->c_rs * 100 - 43.21875 * 100), 0.05) - << "incorrect value for c_rs, expected 43.21875, is " << last_msg_->c_rs; - EXPECT_LT((last_msg_->c_uc * 100 - 2.10106372833e-06 * 100), 0.05) - << "incorrect value for c_uc, expected 2.10106372833e-06, is " - << last_msg_->c_uc; - EXPECT_LT((last_msg_->c_us * 100 - 3.76626849174e-06 * 100), 0.05) - << "incorrect value for c_us, expected 3.76626849174e-06, is " - << last_msg_->c_us; - EXPECT_LT((last_msg_->dn * 100 - 5.26057626697e-09 * 100), 0.05) - << "incorrect value for dn, expected 5.26057626697e-09, is " - << last_msg_->dn; - EXPECT_LT((last_msg_->ecc * 100 - 0.00992374494672 * 100), 0.05) - << "incorrect value for ecc, expected 0.00992374494672, is " - << last_msg_->ecc; - EXPECT_EQ(get_ashealthy)>( - reinterpret_cast(&last_msg_->healthy)), - 1) - << "incorrect value for healthy, expected 1, is " << last_msg_->healthy; - EXPECT_LT((last_msg_->inc * 100 - 0.948751322181 * 100), 0.05) - << "incorrect value for inc, expected 0.948751322181, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->inc_dot * 100 - 3.00012496725e-10 * 100), 0.05) - << "incorrect value for inc_dot, expected 3.00012496725e-10, is " - << last_msg_->inc_dot; - EXPECT_EQ(get_asiode)>( - reinterpret_cast(&last_msg_->iode)), - 0) - << "incorrect value for iode, expected 0, is " << last_msg_->iode; - EXPECT_LT((last_msg_->m0 * 100 - -2.66616027191 * 100), 0.05) - << "incorrect value for m0, expected -2.66616027191, is " - << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - 1.16695519726 * 100), 0.05) - << "incorrect value for omega0, expected 1.16695519726, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -8.4599952499e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -8.4599952499e-09, is " - << last_msg_->omegadot; - EXPECT_EQ(get_asprn)>( - reinterpret_cast(&last_msg_->prn)), - 22) - << "incorrect value for prn, expected 22, is " << last_msg_->prn; - EXPECT_LT((last_msg_->sqrta * 100 - 5153.63666725 * 100), 0.05) - << "incorrect value for sqrta, expected 5153.63666725, is " - << last_msg_->sqrta; - EXPECT_LT((last_msg_->tgd * 100 - -2.00234353542e-08 * 100), 0.05) - << "incorrect value for tgd, expected -2.00234353542e-08, is " - << last_msg_->tgd; - EXPECT_LT((last_msg_->toc_tow * 100 - 410400.0 * 100), 0.05) - << "incorrect value for toc_tow, expected 410400.0, is " - << last_msg_->toc_tow; - EXPECT_EQ(get_astoc_wn)>( - reinterpret_cast(&last_msg_->toc_wn)), - 1838) - << "incorrect value for toc_wn, expected 1838, is " << last_msg_->toc_wn; - EXPECT_LT((last_msg_->toe_tow * 100 - 410400.0 * 100), 0.05) - << "incorrect value for toe_tow, expected 410400.0, is " - << last_msg_->toe_tow; - EXPECT_EQ(get_astoe_wn)>( - reinterpret_cast(&last_msg_->toe_wn)), - 1838) - << "incorrect value for toe_wn, expected 1838, is " << last_msg_->toe_wn; - EXPECT_EQ(get_asvalid)>( - reinterpret_cast(&last_msg_->valid)), - 1) - << "incorrect value for valid, expected 1, is " << last_msg_->valid; - EXPECT_LT((last_msg_->w * 100 - -2.70212414527 * 100), 0.05) - << "incorrect value for w, expected -2.70212414527, is " << last_msg_->w; -} -class Test_legacy_auto_check_sbp_observation_msgEphemerisDepB5 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_msgEphemerisDepB5() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_msgEphemerisDepB5, Test) { - uint8_t encoded_frame[] = { - 85, 70, 0, 195, 4, 176, 0, 0, 0, 0, 0, 0, 77, 190, 0, - 0, 0, 0, 0, 122, 83, 192, 0, 0, 0, 0, 0, 233, 110, 64, - 0, 0, 0, 0, 0, 60, 207, 190, 0, 0, 0, 0, 0, 28, 222, - 62, 0, 0, 0, 0, 0, 128, 120, 62, 0, 0, 0, 0, 0, 0, - 108, 62, 10, 230, 183, 140, 214, 230, 50, 62, 54, 86, 196, 164, 252, - 10, 255, 63, 0, 0, 0, 36, 247, 191, 128, 63, 0, 0, 160, 5, - 193, 33, 180, 64, 186, 138, 81, 129, 88, 239, 1, 64, 94, 210, 120, - 170, 106, 25, 65, 190, 103, 213, 32, 155, 227, 194, 224, 191, 156, 47, - 104, 93, 101, 55, 239, 63, 196, 83, 100, 254, 51, 54, 4, 190, 0, - 0, 0, 0, 50, 242, 52, 63, 0, 0, 0, 0, 0, 0, 114, 189, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 12, 25, - 65, 46, 7, 0, 0, 0, 0, 128, 12, 25, 65, 46, 7, 1, 1, - 30, 0, 170, 33, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_dep_b_t *test_msg = (msg_ephemeris_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = 0.0003196117468178272; - test_msg->af1 = -1.0231815394945443e-12; - test_msg->af2 = 0.0; - test_msg->c_ic = 9.12696123123169e-08; - test_msg->c_is = 5.21540641784668e-08; - test_msg->c_rc = 247.28125; - test_msg->c_rs = -77.90625; - test_msg->c_uc = -3.723427653312683e-06; - test_msg->c_us = 7.178634405136108e-06; - test_msg->dn = 4.400897600764146e-09; - test_msg->ecc = 0.008178644930012524; - test_msg->healthy = 1; - test_msg->inc = 0.9755122017245301; - test_msg->inc_dot = -5.882387882209502e-10; - test_msg->iode = 0; - test_msg->m0 = 1.9401823459824192; - test_msg->omega0 = 2.241868028927766; - test_msg->omegadot = -7.962474526167494e-09; - test_msg->prn = 30; - test_msg->sqrta = 5153.7539920806885; - test_msg->tgd = -1.3504177331924438e-08; - test_msg->toc_tow = 410400.0; - test_msg->toc_wn = 1838; - test_msg->toe_tow = 410400.0; - test_msg->toe_wn = 1838; - test_msg->valid = 1; - test_msg->w = -0.5237901716088061; - - EXPECT_EQ(send_message(0x46, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - 0.000319611746818 * 100), 0.05) - << "incorrect value for af0, expected 0.000319611746818, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - -1.02318153949e-12 * 100), 0.05) - << "incorrect value for af1, expected -1.02318153949e-12, is " - << last_msg_->af1; - EXPECT_LT((last_msg_->af2 * 100 - 0.0 * 100), 0.05) - << "incorrect value for af2, expected 0.0, is " << last_msg_->af2; - EXPECT_LT((last_msg_->c_ic * 100 - 9.12696123123e-08 * 100), 0.05) - << "incorrect value for c_ic, expected 9.12696123123e-08, is " - << last_msg_->c_ic; - EXPECT_LT((last_msg_->c_is * 100 - 5.21540641785e-08 * 100), 0.05) - << "incorrect value for c_is, expected 5.21540641785e-08, is " - << last_msg_->c_is; - EXPECT_LT((last_msg_->c_rc * 100 - 247.28125 * 100), 0.05) - << "incorrect value for c_rc, expected 247.28125, is " << last_msg_->c_rc; - EXPECT_LT((last_msg_->c_rs * 100 - -77.90625 * 100), 0.05) - << "incorrect value for c_rs, expected -77.90625, is " << last_msg_->c_rs; - EXPECT_LT((last_msg_->c_uc * 100 - -3.72342765331e-06 * 100), 0.05) - << "incorrect value for c_uc, expected -3.72342765331e-06, is " - << last_msg_->c_uc; - EXPECT_LT((last_msg_->c_us * 100 - 7.17863440514e-06 * 100), 0.05) - << "incorrect value for c_us, expected 7.17863440514e-06, is " - << last_msg_->c_us; - EXPECT_LT((last_msg_->dn * 100 - 4.40089760076e-09 * 100), 0.05) - << "incorrect value for dn, expected 4.40089760076e-09, is " - << last_msg_->dn; - EXPECT_LT((last_msg_->ecc * 100 - 0.00817864493001 * 100), 0.05) - << "incorrect value for ecc, expected 0.00817864493001, is " - << last_msg_->ecc; - EXPECT_EQ(get_ashealthy)>( - reinterpret_cast(&last_msg_->healthy)), - 1) - << "incorrect value for healthy, expected 1, is " << last_msg_->healthy; - EXPECT_LT((last_msg_->inc * 100 - 0.975512201725 * 100), 0.05) - << "incorrect value for inc, expected 0.975512201725, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->inc_dot * 100 - -5.88238788221e-10 * 100), 0.05) - << "incorrect value for inc_dot, expected -5.88238788221e-10, is " - << last_msg_->inc_dot; - EXPECT_EQ(get_asiode)>( - reinterpret_cast(&last_msg_->iode)), - 0) - << "incorrect value for iode, expected 0, is " << last_msg_->iode; - EXPECT_LT((last_msg_->m0 * 100 - 1.94018234598 * 100), 0.05) - << "incorrect value for m0, expected 1.94018234598, is " << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - 2.24186802893 * 100), 0.05) - << "incorrect value for omega0, expected 2.24186802893, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -7.96247452617e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -7.96247452617e-09, is " - << last_msg_->omegadot; - EXPECT_EQ(get_asprn)>( - reinterpret_cast(&last_msg_->prn)), - 30) - << "incorrect value for prn, expected 30, is " << last_msg_->prn; - EXPECT_LT((last_msg_->sqrta * 100 - 5153.75399208 * 100), 0.05) - << "incorrect value for sqrta, expected 5153.75399208, is " - << last_msg_->sqrta; - EXPECT_LT((last_msg_->tgd * 100 - -1.35041773319e-08 * 100), 0.05) - << "incorrect value for tgd, expected -1.35041773319e-08, is " - << last_msg_->tgd; - EXPECT_LT((last_msg_->toc_tow * 100 - 410400.0 * 100), 0.05) - << "incorrect value for toc_tow, expected 410400.0, is " - << last_msg_->toc_tow; - EXPECT_EQ(get_astoc_wn)>( - reinterpret_cast(&last_msg_->toc_wn)), - 1838) - << "incorrect value for toc_wn, expected 1838, is " << last_msg_->toc_wn; - EXPECT_LT((last_msg_->toe_tow * 100 - 410400.0 * 100), 0.05) - << "incorrect value for toe_tow, expected 410400.0, is " - << last_msg_->toe_tow; - EXPECT_EQ(get_astoe_wn)>( - reinterpret_cast(&last_msg_->toe_wn)), - 1838) - << "incorrect value for toe_wn, expected 1838, is " << last_msg_->toe_wn; - EXPECT_EQ(get_asvalid)>( - reinterpret_cast(&last_msg_->valid)), - 1) - << "incorrect value for valid, expected 1, is " << last_msg_->valid; - EXPECT_LT((last_msg_->w * 100 - -0.523790171609 * 100), 0.05) - << "incorrect value for w, expected -0.523790171609, is " << last_msg_->w; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_msgEphemerisQzss.cc b/c/test/legacy/cpp/auto_check_sbp_observation_msgEphemerisQzss.cc deleted file mode 100644 index 9d19672649..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_msgEphemerisQzss.cc +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_msgEphemerisQzss.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_msgEphemerisQzss0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_msgEphemerisQzss0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ephemeris_qzss_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ephemeris_qzss_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_msgEphemerisQzss0, Test) { - uint8_t encoded_frame[] = { - 85, 142, 0, 128, 240, 139, 193, 31, 208, 221, 6, 0, 106, 8, 0, - 0, 0, 64, 64, 56, 0, 0, 0, 0, 0, 0, 192, 177, 0, 232, - 228, 195, 0, 160, 19, 194, 0, 224, 135, 183, 0, 96, 10, 55, 0, - 192, 157, 181, 0, 0, 46, 52, 167, 72, 107, 105, 179, 1, 39, 62, - 15, 224, 158, 211, 241, 164, 211, 63, 0, 0, 0, 24, 251, 83, 179, - 63, 0, 0, 0, 34, 44, 93, 185, 64, 143, 62, 206, 232, 193, 181, - 242, 191, 207, 216, 69, 106, 98, 255, 39, 190, 65, 132, 95, 22, 48, - 15, 249, 191, 249, 82, 67, 94, 30, 100, 231, 63, 117, 167, 187, 233, - 187, 253, 181, 61, 160, 129, 193, 185, 0, 0, 168, 172, 0, 0, 0, - 0, 208, 221, 6, 0, 106, 8, 49, 49, 3, 126, 23, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ephemeris_qzss_t *test_msg = (msg_ephemeris_qzss_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->af0 = -0.00036908406764268875; - test_msg->af1 = -4.774847184307873e-12; - test_msg->af2 = 0.0; - test_msg->c_ic = -1.1753290891647339e-06; - test_msg->c_is = 1.6205012798309326e-07; - test_msg->c_rc = -36.90625; - test_msg->c_rs = -457.8125; - test_msg->c_uc = -1.6197562217712402e-05; - test_msg->c_us = 8.247792720794678e-06; - test_msg->common.fit_interval = 14400; - test_msg->common.health_bits = 0; - test_msg->common.sid.code = 31; - test_msg->common.sid.sat = 193; - test_msg->common.toe.tow = 450000; - test_msg->common.toe.wn = 2154; - test_msg->common.ura = 2.0; - test_msg->common.valid = 0; - test_msg->dn = 2.678325848736433e-09; - test_msg->ecc = 0.07550019584596157; - test_msg->inc = 0.7309715119432375; - test_msg->inc_dot = 2.0000833114980698e-11; - test_msg->iodc = 817; - test_msg->iode = 49; - test_msg->m0 = 0.30694242158961144; - test_msg->omega0 = -1.1693743795366662; - test_msg->omegadot = -2.7936877968817684e-09; - test_msg->sqrta = 6493.172393798828; - test_msg->tgd = -5.587935447692871e-09; - test_msg->toc.tow = 450000; - test_msg->toc.wn = 2154; - test_msg->w = -1.5662079690885238; - - EXPECT_EQ(send_message(0x8e, 61568, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 61568); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->af0 * 100 - -0.000369084067643 * 100), 0.05) - << "incorrect value for af0, expected -0.000369084067643, is " - << last_msg_->af0; - EXPECT_LT((last_msg_->af1 * 100 - -4.77484718431e-12 * 100), 0.05) - << "incorrect value for af1, expected -4.77484718431e-12, is " - << last_msg_->af1; - EXPECT_LT((last_msg_->af2 * 100 - 0.0 * 100), 0.05) - << "incorrect value for af2, expected 0.0, is " << last_msg_->af2; - EXPECT_LT((last_msg_->c_ic * 100 - -1.17532908916e-06 * 100), 0.05) - << "incorrect value for c_ic, expected -1.17532908916e-06, is " - << last_msg_->c_ic; - EXPECT_LT((last_msg_->c_is * 100 - 1.62050127983e-07 * 100), 0.05) - << "incorrect value for c_is, expected 1.62050127983e-07, is " - << last_msg_->c_is; - EXPECT_LT((last_msg_->c_rc * 100 - -36.90625 * 100), 0.05) - << "incorrect value for c_rc, expected -36.90625, is " << last_msg_->c_rc; - EXPECT_LT((last_msg_->c_rs * 100 - -457.8125 * 100), 0.05) - << "incorrect value for c_rs, expected -457.8125, is " << last_msg_->c_rs; - EXPECT_LT((last_msg_->c_uc * 100 - -1.61975622177e-05 * 100), 0.05) - << "incorrect value for c_uc, expected -1.61975622177e-05, is " - << last_msg_->c_uc; - EXPECT_LT((last_msg_->c_us * 100 - 8.24779272079e-06 * 100), 0.05) - << "incorrect value for c_us, expected 8.24779272079e-06, is " - << last_msg_->c_us; - EXPECT_EQ( - get_ascommon.fit_interval)>( - reinterpret_cast(&last_msg_->common.fit_interval)), - 14400) - << "incorrect value for common.fit_interval, expected 14400, is " - << last_msg_->common.fit_interval; - EXPECT_EQ( - get_ascommon.health_bits)>( - reinterpret_cast(&last_msg_->common.health_bits)), - 0) - << "incorrect value for common.health_bits, expected 0, is " - << last_msg_->common.health_bits; - EXPECT_EQ(get_ascommon.sid.code)>( - reinterpret_cast(&last_msg_->common.sid.code)), - 31) - << "incorrect value for common.sid.code, expected 31, is " - << last_msg_->common.sid.code; - EXPECT_EQ(get_ascommon.sid.sat)>( - reinterpret_cast(&last_msg_->common.sid.sat)), - 193) - << "incorrect value for common.sid.sat, expected 193, is " - << last_msg_->common.sid.sat; - EXPECT_EQ(get_ascommon.toe.tow)>( - reinterpret_cast(&last_msg_->common.toe.tow)), - 450000) - << "incorrect value for common.toe.tow, expected 450000, is " - << last_msg_->common.toe.tow; - EXPECT_EQ(get_ascommon.toe.wn)>( - reinterpret_cast(&last_msg_->common.toe.wn)), - 2154) - << "incorrect value for common.toe.wn, expected 2154, is " - << last_msg_->common.toe.wn; - EXPECT_LT((last_msg_->common.ura * 100 - 2.0 * 100), 0.05) - << "incorrect value for common.ura, expected 2.0, is " - << last_msg_->common.ura; - EXPECT_EQ(get_ascommon.valid)>( - reinterpret_cast(&last_msg_->common.valid)), - 0) - << "incorrect value for common.valid, expected 0, is " - << last_msg_->common.valid; - EXPECT_LT((last_msg_->dn * 100 - 2.67832584874e-09 * 100), 0.05) - << "incorrect value for dn, expected 2.67832584874e-09, is " - << last_msg_->dn; - EXPECT_LT((last_msg_->ecc * 100 - 0.075500195846 * 100), 0.05) - << "incorrect value for ecc, expected 0.075500195846, is " - << last_msg_->ecc; - EXPECT_LT((last_msg_->inc * 100 - 0.730971511943 * 100), 0.05) - << "incorrect value for inc, expected 0.730971511943, is " - << last_msg_->inc; - EXPECT_LT((last_msg_->inc_dot * 100 - 2.0000833115e-11 * 100), 0.05) - << "incorrect value for inc_dot, expected 2.0000833115e-11, is " - << last_msg_->inc_dot; - EXPECT_EQ(get_asiodc)>( - reinterpret_cast(&last_msg_->iodc)), - 817) - << "incorrect value for iodc, expected 817, is " << last_msg_->iodc; - EXPECT_EQ(get_asiode)>( - reinterpret_cast(&last_msg_->iode)), - 49) - << "incorrect value for iode, expected 49, is " << last_msg_->iode; - EXPECT_LT((last_msg_->m0 * 100 - 0.30694242159 * 100), 0.05) - << "incorrect value for m0, expected 0.30694242159, is " << last_msg_->m0; - EXPECT_LT((last_msg_->omega0 * 100 - -1.16937437954 * 100), 0.05) - << "incorrect value for omega0, expected -1.16937437954, is " - << last_msg_->omega0; - EXPECT_LT((last_msg_->omegadot * 100 - -2.79368779688e-09 * 100), 0.05) - << "incorrect value for omegadot, expected -2.79368779688e-09, is " - << last_msg_->omegadot; - EXPECT_LT((last_msg_->sqrta * 100 - 6493.1723938 * 100), 0.05) - << "incorrect value for sqrta, expected 6493.1723938, is " - << last_msg_->sqrta; - EXPECT_LT((last_msg_->tgd * 100 - -5.58793544769e-09 * 100), 0.05) - << "incorrect value for tgd, expected -5.58793544769e-09, is " - << last_msg_->tgd; - EXPECT_EQ(get_astoc.tow)>( - reinterpret_cast(&last_msg_->toc.tow)), - 450000) - << "incorrect value for toc.tow, expected 450000, is " - << last_msg_->toc.tow; - EXPECT_EQ(get_astoc.wn)>( - reinterpret_cast(&last_msg_->toc.wn)), - 2154) - << "incorrect value for toc.wn, expected 2154, is " << last_msg_->toc.wn; - EXPECT_LT((last_msg_->w * 100 - -1.56620796909 * 100), 0.05) - << "incorrect value for w, expected -1.56620796909, is " << last_msg_->w; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_observation_msgObsDepA.cc b/c/test/legacy/cpp/auto_check_sbp_observation_msgObsDepA.cc deleted file mode 100644 index d6f99ddd60..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_observation_msgObsDepA.cc +++ /dev/null @@ -1,1698 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/observation/test_msgObsDepA.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_observation_msgObsDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_msgObsDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_msgObsDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 69, 0, 195, 4, 98, 56, 158, 67, 24, 46, 7, 32, 56, - 235, 249, 121, 244, 114, 255, 255, 33, 46, 67, 218, 0, 238, 203, - 70, 124, 22, 25, 3, 0, 98, 43, 184, 157, 2, 176, 133, 197, - 125, 126, 71, 253, 255, 185, 39, 68, 55, 3, 60, 173, 162, 131, - 98, 231, 253, 255, 139, 30, 33, 16, 10, 128, 178, 248, 136, 42, - 113, 253, 255, 40, 20, 42, 71, 13, 246, 246, 17, 135, 255, 51, - 3, 0, 64, 27, 108, 249, 22, 210, 41, 114, 118, 131, 48, 255, - 255, 31, 52, 226, 58, 30, 23, 217, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_dep_a_t *test_msg = (msg_obs_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.tow = 407084600; - test_msg->header.t.wn = 1838; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].L.f = 33; - test_msg->obs[0].L.i = -36108; - test_msg->obs[0].P = 2046421816; - test_msg->obs[0].cn0 = 46; - test_msg->obs[0].lock = 55875; - test_msg->obs[0].prn = 0; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[1].L.f = 98; - test_msg->obs[1].L.i = 203030; - test_msg->obs[1].P = 2085014510; - test_msg->obs[1].cn0 = 43; - test_msg->obs[1].lock = 40376; - test_msg->obs[1].prn = 2; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[2].L.f = 185; - test_msg->obs[2].L.i = -178306; - test_msg->obs[2].P = 2110096816; - test_msg->obs[2].cn0 = 39; - test_msg->obs[2].lock = 14148; - test_msg->obs[2].prn = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[3].L.f = 139; - test_msg->obs[3].L.i = -137374; - test_msg->obs[3].P = 2208476476; - test_msg->obs[3].cn0 = 30; - test_msg->obs[3].lock = 4129; - test_msg->obs[3].prn = 10; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[4].L.f = 40; - test_msg->obs[4].L.i = -167638; - test_msg->obs[4].P = 2298000000; - test_msg->obs[4].cn0 = 20; - test_msg->obs[4].lock = 18218; - test_msg->obs[4].prn = 13; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[5].L.f = 64; - test_msg->obs[5].L.i = 209919; - test_msg->obs[5].P = 2266101494; - test_msg->obs[5].cn0 = 27; - test_msg->obs[5].lock = 63852; - test_msg->obs[5].prn = 22; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[6].L.f = 31; - test_msg->obs[6].L.i = -53117; - test_msg->obs[6].P = 1987193298; - test_msg->obs[6].cn0 = 52; - test_msg->obs[6].lock = 15074; - test_msg->obs[6].prn = 30; - - EXPECT_EQ(send_message(0x45, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 32) - << "incorrect value for header.n_obs, expected 32, is " - << last_msg_->header.n_obs; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 407084600) - << "incorrect value for header.t.tow, expected 407084600, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 1838) - << "incorrect value for header.t.wn, expected 1838, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 33) - << "incorrect value for obs[0].L.f, expected 33, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - -36108) - << "incorrect value for obs[0].L.i, expected -36108, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 2046421816) - << "incorrect value for obs[0].P, expected 2046421816, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].cn0)>( - reinterpret_cast(&last_msg_->obs[0].cn0)), - 46) - << "incorrect value for obs[0].cn0, expected 46, is " - << last_msg_->obs[0].cn0; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 55875) - << "incorrect value for obs[0].lock, expected 55875, is " - << last_msg_->obs[0].lock; - EXPECT_EQ(get_asobs[0].prn)>( - reinterpret_cast(&last_msg_->obs[0].prn)), - 0) - << "incorrect value for obs[0].prn, expected 0, is " - << last_msg_->obs[0].prn; - EXPECT_EQ(get_asobs[1].L.f)>( - reinterpret_cast(&last_msg_->obs[1].L.f)), - 98) - << "incorrect value for obs[1].L.f, expected 98, is " - << last_msg_->obs[1].L.f; - EXPECT_EQ(get_asobs[1].L.i)>( - reinterpret_cast(&last_msg_->obs[1].L.i)), - 203030) - << "incorrect value for obs[1].L.i, expected 203030, is " - << last_msg_->obs[1].L.i; - EXPECT_EQ(get_asobs[1].P)>( - reinterpret_cast(&last_msg_->obs[1].P)), - 2085014510) - << "incorrect value for obs[1].P, expected 2085014510, is " - << last_msg_->obs[1].P; - EXPECT_EQ(get_asobs[1].cn0)>( - reinterpret_cast(&last_msg_->obs[1].cn0)), - 43) - << "incorrect value for obs[1].cn0, expected 43, is " - << last_msg_->obs[1].cn0; - EXPECT_EQ(get_asobs[1].lock)>( - reinterpret_cast(&last_msg_->obs[1].lock)), - 40376) - << "incorrect value for obs[1].lock, expected 40376, is " - << last_msg_->obs[1].lock; - EXPECT_EQ(get_asobs[1].prn)>( - reinterpret_cast(&last_msg_->obs[1].prn)), - 2) - << "incorrect value for obs[1].prn, expected 2, is " - << last_msg_->obs[1].prn; - EXPECT_EQ(get_asobs[2].L.f)>( - reinterpret_cast(&last_msg_->obs[2].L.f)), - 185) - << "incorrect value for obs[2].L.f, expected 185, is " - << last_msg_->obs[2].L.f; - EXPECT_EQ(get_asobs[2].L.i)>( - reinterpret_cast(&last_msg_->obs[2].L.i)), - -178306) - << "incorrect value for obs[2].L.i, expected -178306, is " - << last_msg_->obs[2].L.i; - EXPECT_EQ(get_asobs[2].P)>( - reinterpret_cast(&last_msg_->obs[2].P)), - 2110096816) - << "incorrect value for obs[2].P, expected 2110096816, is " - << last_msg_->obs[2].P; - EXPECT_EQ(get_asobs[2].cn0)>( - reinterpret_cast(&last_msg_->obs[2].cn0)), - 39) - << "incorrect value for obs[2].cn0, expected 39, is " - << last_msg_->obs[2].cn0; - EXPECT_EQ(get_asobs[2].lock)>( - reinterpret_cast(&last_msg_->obs[2].lock)), - 14148) - << "incorrect value for obs[2].lock, expected 14148, is " - << last_msg_->obs[2].lock; - EXPECT_EQ(get_asobs[2].prn)>( - reinterpret_cast(&last_msg_->obs[2].prn)), - 3) - << "incorrect value for obs[2].prn, expected 3, is " - << last_msg_->obs[2].prn; - EXPECT_EQ(get_asobs[3].L.f)>( - reinterpret_cast(&last_msg_->obs[3].L.f)), - 139) - << "incorrect value for obs[3].L.f, expected 139, is " - << last_msg_->obs[3].L.f; - EXPECT_EQ(get_asobs[3].L.i)>( - reinterpret_cast(&last_msg_->obs[3].L.i)), - -137374) - << "incorrect value for obs[3].L.i, expected -137374, is " - << last_msg_->obs[3].L.i; - EXPECT_EQ(get_asobs[3].P)>( - reinterpret_cast(&last_msg_->obs[3].P)), - 2208476476) - << "incorrect value for obs[3].P, expected 2208476476, is " - << last_msg_->obs[3].P; - EXPECT_EQ(get_asobs[3].cn0)>( - reinterpret_cast(&last_msg_->obs[3].cn0)), - 30) - << "incorrect value for obs[3].cn0, expected 30, is " - << last_msg_->obs[3].cn0; - EXPECT_EQ(get_asobs[3].lock)>( - reinterpret_cast(&last_msg_->obs[3].lock)), - 4129) - << "incorrect value for obs[3].lock, expected 4129, is " - << last_msg_->obs[3].lock; - EXPECT_EQ(get_asobs[3].prn)>( - reinterpret_cast(&last_msg_->obs[3].prn)), - 10) - << "incorrect value for obs[3].prn, expected 10, is " - << last_msg_->obs[3].prn; - EXPECT_EQ(get_asobs[4].L.f)>( - reinterpret_cast(&last_msg_->obs[4].L.f)), - 40) - << "incorrect value for obs[4].L.f, expected 40, is " - << last_msg_->obs[4].L.f; - EXPECT_EQ(get_asobs[4].L.i)>( - reinterpret_cast(&last_msg_->obs[4].L.i)), - -167638) - << "incorrect value for obs[4].L.i, expected -167638, is " - << last_msg_->obs[4].L.i; - EXPECT_EQ(get_asobs[4].P)>( - reinterpret_cast(&last_msg_->obs[4].P)), - 2298000000) - << "incorrect value for obs[4].P, expected 2298000000, is " - << last_msg_->obs[4].P; - EXPECT_EQ(get_asobs[4].cn0)>( - reinterpret_cast(&last_msg_->obs[4].cn0)), - 20) - << "incorrect value for obs[4].cn0, expected 20, is " - << last_msg_->obs[4].cn0; - EXPECT_EQ(get_asobs[4].lock)>( - reinterpret_cast(&last_msg_->obs[4].lock)), - 18218) - << "incorrect value for obs[4].lock, expected 18218, is " - << last_msg_->obs[4].lock; - EXPECT_EQ(get_asobs[4].prn)>( - reinterpret_cast(&last_msg_->obs[4].prn)), - 13) - << "incorrect value for obs[4].prn, expected 13, is " - << last_msg_->obs[4].prn; - EXPECT_EQ(get_asobs[5].L.f)>( - reinterpret_cast(&last_msg_->obs[5].L.f)), - 64) - << "incorrect value for obs[5].L.f, expected 64, is " - << last_msg_->obs[5].L.f; - EXPECT_EQ(get_asobs[5].L.i)>( - reinterpret_cast(&last_msg_->obs[5].L.i)), - 209919) - << "incorrect value for obs[5].L.i, expected 209919, is " - << last_msg_->obs[5].L.i; - EXPECT_EQ(get_asobs[5].P)>( - reinterpret_cast(&last_msg_->obs[5].P)), - 2266101494) - << "incorrect value for obs[5].P, expected 2266101494, is " - << last_msg_->obs[5].P; - EXPECT_EQ(get_asobs[5].cn0)>( - reinterpret_cast(&last_msg_->obs[5].cn0)), - 27) - << "incorrect value for obs[5].cn0, expected 27, is " - << last_msg_->obs[5].cn0; - EXPECT_EQ(get_asobs[5].lock)>( - reinterpret_cast(&last_msg_->obs[5].lock)), - 63852) - << "incorrect value for obs[5].lock, expected 63852, is " - << last_msg_->obs[5].lock; - EXPECT_EQ(get_asobs[5].prn)>( - reinterpret_cast(&last_msg_->obs[5].prn)), - 22) - << "incorrect value for obs[5].prn, expected 22, is " - << last_msg_->obs[5].prn; - EXPECT_EQ(get_asobs[6].L.f)>( - reinterpret_cast(&last_msg_->obs[6].L.f)), - 31) - << "incorrect value for obs[6].L.f, expected 31, is " - << last_msg_->obs[6].L.f; - EXPECT_EQ(get_asobs[6].L.i)>( - reinterpret_cast(&last_msg_->obs[6].L.i)), - -53117) - << "incorrect value for obs[6].L.i, expected -53117, is " - << last_msg_->obs[6].L.i; - EXPECT_EQ(get_asobs[6].P)>( - reinterpret_cast(&last_msg_->obs[6].P)), - 1987193298) - << "incorrect value for obs[6].P, expected 1987193298, is " - << last_msg_->obs[6].P; - EXPECT_EQ(get_asobs[6].cn0)>( - reinterpret_cast(&last_msg_->obs[6].cn0)), - 52) - << "incorrect value for obs[6].cn0, expected 52, is " - << last_msg_->obs[6].cn0; - EXPECT_EQ(get_asobs[6].lock)>( - reinterpret_cast(&last_msg_->obs[6].lock)), - 15074) - << "incorrect value for obs[6].lock, expected 15074, is " - << last_msg_->obs[6].lock; - EXPECT_EQ(get_asobs[6].prn)>( - reinterpret_cast(&last_msg_->obs[6].prn)), - 30) - << "incorrect value for obs[6].prn, expected 30, is " - << last_msg_->obs[6].prn; -} -class Test_legacy_auto_check_sbp_observation_msgObsDepA1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_msgObsDepA1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_msgObsDepA1, Test) { - uint8_t encoded_frame[] = { - 85, 69, 0, 195, 4, 20, 56, 158, 67, 24, 46, 7, 33, 84, - 52, 164, 117, 102, 32, 0, 0, 147, 62, 62, 250, 31, 234, 14, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_dep_a_t *test_msg = (msg_obs_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 33; - test_msg->header.t.tow = 407084600; - test_msg->header.t.wn = 1838; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].L.f = 147; - test_msg->obs[0].L.i = 8294; - test_msg->obs[0].P = 1973695572; - test_msg->obs[0].cn0 = 62; - test_msg->obs[0].lock = 64062; - test_msg->obs[0].prn = 31; - - EXPECT_EQ(send_message(0x45, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 33) - << "incorrect value for header.n_obs, expected 33, is " - << last_msg_->header.n_obs; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 407084600) - << "incorrect value for header.t.tow, expected 407084600, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 1838) - << "incorrect value for header.t.wn, expected 1838, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 147) - << "incorrect value for obs[0].L.f, expected 147, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - 8294) - << "incorrect value for obs[0].L.i, expected 8294, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 1973695572) - << "incorrect value for obs[0].P, expected 1973695572, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].cn0)>( - reinterpret_cast(&last_msg_->obs[0].cn0)), - 62) - << "incorrect value for obs[0].cn0, expected 62, is " - << last_msg_->obs[0].cn0; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 64062) - << "incorrect value for obs[0].lock, expected 64062, is " - << last_msg_->obs[0].lock; - EXPECT_EQ(get_asobs[0].prn)>( - reinterpret_cast(&last_msg_->obs[0].prn)), - 31) - << "incorrect value for obs[0].prn, expected 31, is " - << last_msg_->obs[0].prn; -} -class Test_legacy_auto_check_sbp_observation_msgObsDepA2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_msgObsDepA2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_msgObsDepA2, Test) { - uint8_t encoded_frame[] = { - 85, 69, 0, 195, 4, 98, 0, 159, 67, 24, 46, 7, 32, 32, - 209, 249, 121, 145, 114, 255, 255, 141, 45, 67, 218, 0, 177, 128, - 70, 124, 79, 27, 3, 0, 159, 44, 184, 157, 2, 59, 135, 197, - 125, 175, 69, 253, 255, 77, 40, 68, 55, 3, 211, 172, 162, 131, - 177, 229, 253, 255, 20, 31, 33, 16, 10, 128, 178, 248, 136, 116, - 111, 253, 255, 94, 21, 42, 71, 13, 182, 173, 17, 135, 37, 54, - 3, 0, 214, 27, 108, 249, 22, 91, 20, 114, 118, 240, 47, 255, - 255, 129, 52, 226, 58, 30, 200, 119, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_dep_a_t *test_msg = (msg_obs_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 32; - test_msg->header.t.tow = 407084800; - test_msg->header.t.wn = 1838; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].L.f = 141; - test_msg->obs[0].L.i = -36207; - test_msg->obs[0].P = 2046415136; - test_msg->obs[0].cn0 = 45; - test_msg->obs[0].lock = 55875; - test_msg->obs[0].prn = 0; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[1].L.f = 159; - test_msg->obs[1].L.i = 203599; - test_msg->obs[1].P = 2084995249; - test_msg->obs[1].cn0 = 44; - test_msg->obs[1].lock = 40376; - test_msg->obs[1].prn = 2; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[2].L.f = 77; - test_msg->obs[2].L.i = -178769; - test_msg->obs[2].P = 2110097211; - test_msg->obs[2].cn0 = 40; - test_msg->obs[2].lock = 14148; - test_msg->obs[2].prn = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[3].L.f = 20; - test_msg->obs[3].L.i = -137807; - test_msg->obs[3].P = 2208476371; - test_msg->obs[3].cn0 = 31; - test_msg->obs[3].lock = 4129; - test_msg->obs[3].prn = 10; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[4].L.f = 94; - test_msg->obs[4].L.i = -168076; - test_msg->obs[4].P = 2298000000; - test_msg->obs[4].cn0 = 21; - test_msg->obs[4].lock = 18218; - test_msg->obs[4].prn = 13; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[5].L.f = 214; - test_msg->obs[5].L.i = 210469; - test_msg->obs[5].P = 2266082742; - test_msg->obs[5].cn0 = 27; - test_msg->obs[5].lock = 63852; - test_msg->obs[5].prn = 22; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[6].L.f = 129; - test_msg->obs[6].L.i = -53264; - test_msg->obs[6].P = 1987187803; - test_msg->obs[6].cn0 = 52; - test_msg->obs[6].lock = 15074; - test_msg->obs[6].prn = 30; - - EXPECT_EQ(send_message(0x45, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 32) - << "incorrect value for header.n_obs, expected 32, is " - << last_msg_->header.n_obs; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 407084800) - << "incorrect value for header.t.tow, expected 407084800, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 1838) - << "incorrect value for header.t.wn, expected 1838, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 141) - << "incorrect value for obs[0].L.f, expected 141, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - -36207) - << "incorrect value for obs[0].L.i, expected -36207, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 2046415136) - << "incorrect value for obs[0].P, expected 2046415136, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].cn0)>( - reinterpret_cast(&last_msg_->obs[0].cn0)), - 45) - << "incorrect value for obs[0].cn0, expected 45, is " - << last_msg_->obs[0].cn0; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 55875) - << "incorrect value for obs[0].lock, expected 55875, is " - << last_msg_->obs[0].lock; - EXPECT_EQ(get_asobs[0].prn)>( - reinterpret_cast(&last_msg_->obs[0].prn)), - 0) - << "incorrect value for obs[0].prn, expected 0, is " - << last_msg_->obs[0].prn; - EXPECT_EQ(get_asobs[1].L.f)>( - reinterpret_cast(&last_msg_->obs[1].L.f)), - 159) - << "incorrect value for obs[1].L.f, expected 159, is " - << last_msg_->obs[1].L.f; - EXPECT_EQ(get_asobs[1].L.i)>( - reinterpret_cast(&last_msg_->obs[1].L.i)), - 203599) - << "incorrect value for obs[1].L.i, expected 203599, is " - << last_msg_->obs[1].L.i; - EXPECT_EQ(get_asobs[1].P)>( - reinterpret_cast(&last_msg_->obs[1].P)), - 2084995249) - << "incorrect value for obs[1].P, expected 2084995249, is " - << last_msg_->obs[1].P; - EXPECT_EQ(get_asobs[1].cn0)>( - reinterpret_cast(&last_msg_->obs[1].cn0)), - 44) - << "incorrect value for obs[1].cn0, expected 44, is " - << last_msg_->obs[1].cn0; - EXPECT_EQ(get_asobs[1].lock)>( - reinterpret_cast(&last_msg_->obs[1].lock)), - 40376) - << "incorrect value for obs[1].lock, expected 40376, is " - << last_msg_->obs[1].lock; - EXPECT_EQ(get_asobs[1].prn)>( - reinterpret_cast(&last_msg_->obs[1].prn)), - 2) - << "incorrect value for obs[1].prn, expected 2, is " - << last_msg_->obs[1].prn; - EXPECT_EQ(get_asobs[2].L.f)>( - reinterpret_cast(&last_msg_->obs[2].L.f)), - 77) - << "incorrect value for obs[2].L.f, expected 77, is " - << last_msg_->obs[2].L.f; - EXPECT_EQ(get_asobs[2].L.i)>( - reinterpret_cast(&last_msg_->obs[2].L.i)), - -178769) - << "incorrect value for obs[2].L.i, expected -178769, is " - << last_msg_->obs[2].L.i; - EXPECT_EQ(get_asobs[2].P)>( - reinterpret_cast(&last_msg_->obs[2].P)), - 2110097211) - << "incorrect value for obs[2].P, expected 2110097211, is " - << last_msg_->obs[2].P; - EXPECT_EQ(get_asobs[2].cn0)>( - reinterpret_cast(&last_msg_->obs[2].cn0)), - 40) - << "incorrect value for obs[2].cn0, expected 40, is " - << last_msg_->obs[2].cn0; - EXPECT_EQ(get_asobs[2].lock)>( - reinterpret_cast(&last_msg_->obs[2].lock)), - 14148) - << "incorrect value for obs[2].lock, expected 14148, is " - << last_msg_->obs[2].lock; - EXPECT_EQ(get_asobs[2].prn)>( - reinterpret_cast(&last_msg_->obs[2].prn)), - 3) - << "incorrect value for obs[2].prn, expected 3, is " - << last_msg_->obs[2].prn; - EXPECT_EQ(get_asobs[3].L.f)>( - reinterpret_cast(&last_msg_->obs[3].L.f)), - 20) - << "incorrect value for obs[3].L.f, expected 20, is " - << last_msg_->obs[3].L.f; - EXPECT_EQ(get_asobs[3].L.i)>( - reinterpret_cast(&last_msg_->obs[3].L.i)), - -137807) - << "incorrect value for obs[3].L.i, expected -137807, is " - << last_msg_->obs[3].L.i; - EXPECT_EQ(get_asobs[3].P)>( - reinterpret_cast(&last_msg_->obs[3].P)), - 2208476371) - << "incorrect value for obs[3].P, expected 2208476371, is " - << last_msg_->obs[3].P; - EXPECT_EQ(get_asobs[3].cn0)>( - reinterpret_cast(&last_msg_->obs[3].cn0)), - 31) - << "incorrect value for obs[3].cn0, expected 31, is " - << last_msg_->obs[3].cn0; - EXPECT_EQ(get_asobs[3].lock)>( - reinterpret_cast(&last_msg_->obs[3].lock)), - 4129) - << "incorrect value for obs[3].lock, expected 4129, is " - << last_msg_->obs[3].lock; - EXPECT_EQ(get_asobs[3].prn)>( - reinterpret_cast(&last_msg_->obs[3].prn)), - 10) - << "incorrect value for obs[3].prn, expected 10, is " - << last_msg_->obs[3].prn; - EXPECT_EQ(get_asobs[4].L.f)>( - reinterpret_cast(&last_msg_->obs[4].L.f)), - 94) - << "incorrect value for obs[4].L.f, expected 94, is " - << last_msg_->obs[4].L.f; - EXPECT_EQ(get_asobs[4].L.i)>( - reinterpret_cast(&last_msg_->obs[4].L.i)), - -168076) - << "incorrect value for obs[4].L.i, expected -168076, is " - << last_msg_->obs[4].L.i; - EXPECT_EQ(get_asobs[4].P)>( - reinterpret_cast(&last_msg_->obs[4].P)), - 2298000000) - << "incorrect value for obs[4].P, expected 2298000000, is " - << last_msg_->obs[4].P; - EXPECT_EQ(get_asobs[4].cn0)>( - reinterpret_cast(&last_msg_->obs[4].cn0)), - 21) - << "incorrect value for obs[4].cn0, expected 21, is " - << last_msg_->obs[4].cn0; - EXPECT_EQ(get_asobs[4].lock)>( - reinterpret_cast(&last_msg_->obs[4].lock)), - 18218) - << "incorrect value for obs[4].lock, expected 18218, is " - << last_msg_->obs[4].lock; - EXPECT_EQ(get_asobs[4].prn)>( - reinterpret_cast(&last_msg_->obs[4].prn)), - 13) - << "incorrect value for obs[4].prn, expected 13, is " - << last_msg_->obs[4].prn; - EXPECT_EQ(get_asobs[5].L.f)>( - reinterpret_cast(&last_msg_->obs[5].L.f)), - 214) - << "incorrect value for obs[5].L.f, expected 214, is " - << last_msg_->obs[5].L.f; - EXPECT_EQ(get_asobs[5].L.i)>( - reinterpret_cast(&last_msg_->obs[5].L.i)), - 210469) - << "incorrect value for obs[5].L.i, expected 210469, is " - << last_msg_->obs[5].L.i; - EXPECT_EQ(get_asobs[5].P)>( - reinterpret_cast(&last_msg_->obs[5].P)), - 2266082742) - << "incorrect value for obs[5].P, expected 2266082742, is " - << last_msg_->obs[5].P; - EXPECT_EQ(get_asobs[5].cn0)>( - reinterpret_cast(&last_msg_->obs[5].cn0)), - 27) - << "incorrect value for obs[5].cn0, expected 27, is " - << last_msg_->obs[5].cn0; - EXPECT_EQ(get_asobs[5].lock)>( - reinterpret_cast(&last_msg_->obs[5].lock)), - 63852) - << "incorrect value for obs[5].lock, expected 63852, is " - << last_msg_->obs[5].lock; - EXPECT_EQ(get_asobs[5].prn)>( - reinterpret_cast(&last_msg_->obs[5].prn)), - 22) - << "incorrect value for obs[5].prn, expected 22, is " - << last_msg_->obs[5].prn; - EXPECT_EQ(get_asobs[6].L.f)>( - reinterpret_cast(&last_msg_->obs[6].L.f)), - 129) - << "incorrect value for obs[6].L.f, expected 129, is " - << last_msg_->obs[6].L.f; - EXPECT_EQ(get_asobs[6].L.i)>( - reinterpret_cast(&last_msg_->obs[6].L.i)), - -53264) - << "incorrect value for obs[6].L.i, expected -53264, is " - << last_msg_->obs[6].L.i; - EXPECT_EQ(get_asobs[6].P)>( - reinterpret_cast(&last_msg_->obs[6].P)), - 1987187803) - << "incorrect value for obs[6].P, expected 1987187803, is " - << last_msg_->obs[6].P; - EXPECT_EQ(get_asobs[6].cn0)>( - reinterpret_cast(&last_msg_->obs[6].cn0)), - 52) - << "incorrect value for obs[6].cn0, expected 52, is " - << last_msg_->obs[6].cn0; - EXPECT_EQ(get_asobs[6].lock)>( - reinterpret_cast(&last_msg_->obs[6].lock)), - 15074) - << "incorrect value for obs[6].lock, expected 15074, is " - << last_msg_->obs[6].lock; - EXPECT_EQ(get_asobs[6].prn)>( - reinterpret_cast(&last_msg_->obs[6].prn)), - 30) - << "incorrect value for obs[6].prn, expected 30, is " - << last_msg_->obs[6].prn; -} -class Test_legacy_auto_check_sbp_observation_msgObsDepA3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_msgObsDepA3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_msgObsDepA3, Test) { - uint8_t encoded_frame[] = { - 85, 69, 0, 195, 4, 20, 0, 159, 67, 24, 46, 7, 33, 49, - 19, 164, 117, 120, 32, 0, 0, 222, 63, 62, 250, 31, 11, 231, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_dep_a_t *test_msg = (msg_obs_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 33; - test_msg->header.t.tow = 407084800; - test_msg->header.t.wn = 1838; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].L.f = 222; - test_msg->obs[0].L.i = 8312; - test_msg->obs[0].P = 1973687089; - test_msg->obs[0].cn0 = 63; - test_msg->obs[0].lock = 64062; - test_msg->obs[0].prn = 31; - - EXPECT_EQ(send_message(0x45, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 33) - << "incorrect value for header.n_obs, expected 33, is " - << last_msg_->header.n_obs; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 407084800) - << "incorrect value for header.t.tow, expected 407084800, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 1838) - << "incorrect value for header.t.wn, expected 1838, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 222) - << "incorrect value for obs[0].L.f, expected 222, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - 8312) - << "incorrect value for obs[0].L.i, expected 8312, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 1973687089) - << "incorrect value for obs[0].P, expected 1973687089, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].cn0)>( - reinterpret_cast(&last_msg_->obs[0].cn0)), - 63) - << "incorrect value for obs[0].cn0, expected 63, is " - << last_msg_->obs[0].cn0; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 64062) - << "incorrect value for obs[0].lock, expected 64062, is " - << last_msg_->obs[0].lock; - EXPECT_EQ(get_asobs[0].prn)>( - reinterpret_cast(&last_msg_->obs[0].prn)), - 31) - << "incorrect value for obs[0].prn, expected 31, is " - << last_msg_->obs[0].prn; -} -class Test_legacy_auto_check_sbp_observation_msgObsDepA4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_msgObsDepA4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_msgObsDepA4, Test) { - uint8_t encoded_frame[] = { - 85, 69, 0, 195, 4, 72, 96, 162, 68, 24, 46, 7, 16, 87, - 132, 217, 121, 121, 148, 255, 255, 189, 43, 175, 147, 0, 132, 64, - 200, 125, 106, 31, 254, 255, 1, 41, 14, 177, 3, 128, 178, 248, - 136, 70, 68, 254, 255, 166, 18, 184, 133, 13, 24, 127, 178, 134, - 6, 25, 2, 0, 249, 28, 33, 96, 22, 170, 104, 86, 118, 67, - 112, 255, 255, 203, 56, 208, 88, 30, 43, 107, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_dep_a_t *test_msg = (msg_obs_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 16; - test_msg->header.t.tow = 407151200; - test_msg->header.t.wn = 1838; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].L.f = 189; - test_msg->obs[0].L.i = -27527; - test_msg->obs[0].P = 2044298327; - test_msg->obs[0].cn0 = 43; - test_msg->obs[0].lock = 37807; - test_msg->obs[0].prn = 0; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[1].L.f = 1; - test_msg->obs[1].L.i = -123030; - test_msg->obs[1].P = 2110275716; - test_msg->obs[1].cn0 = 41; - test_msg->obs[1].lock = 45326; - test_msg->obs[1].prn = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[2].L.f = 166; - test_msg->obs[2].L.i = -113594; - test_msg->obs[2].P = 2298000000; - test_msg->obs[2].cn0 = 18; - test_msg->obs[2].lock = 34232; - test_msg->obs[2].prn = 13; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[3].L.f = 249; - test_msg->obs[3].L.i = 137478; - test_msg->obs[3].P = 2259844888; - test_msg->obs[3].cn0 = 28; - test_msg->obs[3].lock = 24609; - test_msg->obs[3].prn = 22; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[4].L.f = 203; - test_msg->obs[4].L.i = -36797; - test_msg->obs[4].P = 1985374378; - test_msg->obs[4].cn0 = 56; - test_msg->obs[4].lock = 22736; - test_msg->obs[4].prn = 30; - - EXPECT_EQ(send_message(0x45, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 16) - << "incorrect value for header.n_obs, expected 16, is " - << last_msg_->header.n_obs; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 407151200) - << "incorrect value for header.t.tow, expected 407151200, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 1838) - << "incorrect value for header.t.wn, expected 1838, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 189) - << "incorrect value for obs[0].L.f, expected 189, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - -27527) - << "incorrect value for obs[0].L.i, expected -27527, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 2044298327) - << "incorrect value for obs[0].P, expected 2044298327, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].cn0)>( - reinterpret_cast(&last_msg_->obs[0].cn0)), - 43) - << "incorrect value for obs[0].cn0, expected 43, is " - << last_msg_->obs[0].cn0; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 37807) - << "incorrect value for obs[0].lock, expected 37807, is " - << last_msg_->obs[0].lock; - EXPECT_EQ(get_asobs[0].prn)>( - reinterpret_cast(&last_msg_->obs[0].prn)), - 0) - << "incorrect value for obs[0].prn, expected 0, is " - << last_msg_->obs[0].prn; - EXPECT_EQ(get_asobs[1].L.f)>( - reinterpret_cast(&last_msg_->obs[1].L.f)), - 1) - << "incorrect value for obs[1].L.f, expected 1, is " - << last_msg_->obs[1].L.f; - EXPECT_EQ(get_asobs[1].L.i)>( - reinterpret_cast(&last_msg_->obs[1].L.i)), - -123030) - << "incorrect value for obs[1].L.i, expected -123030, is " - << last_msg_->obs[1].L.i; - EXPECT_EQ(get_asobs[1].P)>( - reinterpret_cast(&last_msg_->obs[1].P)), - 2110275716) - << "incorrect value for obs[1].P, expected 2110275716, is " - << last_msg_->obs[1].P; - EXPECT_EQ(get_asobs[1].cn0)>( - reinterpret_cast(&last_msg_->obs[1].cn0)), - 41) - << "incorrect value for obs[1].cn0, expected 41, is " - << last_msg_->obs[1].cn0; - EXPECT_EQ(get_asobs[1].lock)>( - reinterpret_cast(&last_msg_->obs[1].lock)), - 45326) - << "incorrect value for obs[1].lock, expected 45326, is " - << last_msg_->obs[1].lock; - EXPECT_EQ(get_asobs[1].prn)>( - reinterpret_cast(&last_msg_->obs[1].prn)), - 3) - << "incorrect value for obs[1].prn, expected 3, is " - << last_msg_->obs[1].prn; - EXPECT_EQ(get_asobs[2].L.f)>( - reinterpret_cast(&last_msg_->obs[2].L.f)), - 166) - << "incorrect value for obs[2].L.f, expected 166, is " - << last_msg_->obs[2].L.f; - EXPECT_EQ(get_asobs[2].L.i)>( - reinterpret_cast(&last_msg_->obs[2].L.i)), - -113594) - << "incorrect value for obs[2].L.i, expected -113594, is " - << last_msg_->obs[2].L.i; - EXPECT_EQ(get_asobs[2].P)>( - reinterpret_cast(&last_msg_->obs[2].P)), - 2298000000) - << "incorrect value for obs[2].P, expected 2298000000, is " - << last_msg_->obs[2].P; - EXPECT_EQ(get_asobs[2].cn0)>( - reinterpret_cast(&last_msg_->obs[2].cn0)), - 18) - << "incorrect value for obs[2].cn0, expected 18, is " - << last_msg_->obs[2].cn0; - EXPECT_EQ(get_asobs[2].lock)>( - reinterpret_cast(&last_msg_->obs[2].lock)), - 34232) - << "incorrect value for obs[2].lock, expected 34232, is " - << last_msg_->obs[2].lock; - EXPECT_EQ(get_asobs[2].prn)>( - reinterpret_cast(&last_msg_->obs[2].prn)), - 13) - << "incorrect value for obs[2].prn, expected 13, is " - << last_msg_->obs[2].prn; - EXPECT_EQ(get_asobs[3].L.f)>( - reinterpret_cast(&last_msg_->obs[3].L.f)), - 249) - << "incorrect value for obs[3].L.f, expected 249, is " - << last_msg_->obs[3].L.f; - EXPECT_EQ(get_asobs[3].L.i)>( - reinterpret_cast(&last_msg_->obs[3].L.i)), - 137478) - << "incorrect value for obs[3].L.i, expected 137478, is " - << last_msg_->obs[3].L.i; - EXPECT_EQ(get_asobs[3].P)>( - reinterpret_cast(&last_msg_->obs[3].P)), - 2259844888) - << "incorrect value for obs[3].P, expected 2259844888, is " - << last_msg_->obs[3].P; - EXPECT_EQ(get_asobs[3].cn0)>( - reinterpret_cast(&last_msg_->obs[3].cn0)), - 28) - << "incorrect value for obs[3].cn0, expected 28, is " - << last_msg_->obs[3].cn0; - EXPECT_EQ(get_asobs[3].lock)>( - reinterpret_cast(&last_msg_->obs[3].lock)), - 24609) - << "incorrect value for obs[3].lock, expected 24609, is " - << last_msg_->obs[3].lock; - EXPECT_EQ(get_asobs[3].prn)>( - reinterpret_cast(&last_msg_->obs[3].prn)), - 22) - << "incorrect value for obs[3].prn, expected 22, is " - << last_msg_->obs[3].prn; - EXPECT_EQ(get_asobs[4].L.f)>( - reinterpret_cast(&last_msg_->obs[4].L.f)), - 203) - << "incorrect value for obs[4].L.f, expected 203, is " - << last_msg_->obs[4].L.f; - EXPECT_EQ(get_asobs[4].L.i)>( - reinterpret_cast(&last_msg_->obs[4].L.i)), - -36797) - << "incorrect value for obs[4].L.i, expected -36797, is " - << last_msg_->obs[4].L.i; - EXPECT_EQ(get_asobs[4].P)>( - reinterpret_cast(&last_msg_->obs[4].P)), - 1985374378) - << "incorrect value for obs[4].P, expected 1985374378, is " - << last_msg_->obs[4].P; - EXPECT_EQ(get_asobs[4].cn0)>( - reinterpret_cast(&last_msg_->obs[4].cn0)), - 56) - << "incorrect value for obs[4].cn0, expected 56, is " - << last_msg_->obs[4].cn0; - EXPECT_EQ(get_asobs[4].lock)>( - reinterpret_cast(&last_msg_->obs[4].lock)), - 22736) - << "incorrect value for obs[4].lock, expected 22736, is " - << last_msg_->obs[4].lock; - EXPECT_EQ(get_asobs[4].prn)>( - reinterpret_cast(&last_msg_->obs[4].prn)), - 30) - << "incorrect value for obs[4].prn, expected 30, is " - << last_msg_->obs[4].prn; -} -class Test_legacy_auto_check_sbp_observation_msgObsDepA5 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_observation_msgObsDepA5() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_obs_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_observation_msgObsDepA5, Test) { - uint8_t encoded_frame[] = { - 85, 69, 0, 195, 4, 72, 40, 163, 68, 24, 46, 7, 16, 132, - 107, 217, 121, 14, 148, 255, 255, 1, 44, 175, 147, 0, 129, 66, - 200, 125, 148, 29, 254, 255, 153, 41, 14, 177, 3, 128, 178, 248, - 136, 143, 66, 254, 255, 222, 18, 184, 133, 13, 158, 53, 178, 134, - 42, 27, 2, 0, 237, 30, 33, 96, 22, 38, 83, 86, 118, 168, - 111, 255, 255, 45, 56, 208, 88, 30, 1, 175, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_obs_dep_a_t *test_msg = (msg_obs_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.n_obs = 16; - test_msg->header.t.tow = 407151400; - test_msg->header.t.wn = 1838; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[0].L.f = 1; - test_msg->obs[0].L.i = -27634; - test_msg->obs[0].P = 2044291972; - test_msg->obs[0].cn0 = 44; - test_msg->obs[0].lock = 37807; - test_msg->obs[0].prn = 0; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[1].L.f = 153; - test_msg->obs[1].L.i = -123500; - test_msg->obs[1].P = 2110276225; - test_msg->obs[1].cn0 = 41; - test_msg->obs[1].lock = 45326; - test_msg->obs[1].prn = 3; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[2].L.f = 222; - test_msg->obs[2].L.i = -114033; - test_msg->obs[2].P = 2298000000; - test_msg->obs[2].cn0 = 18; - test_msg->obs[2].lock = 34232; - test_msg->obs[2].prn = 13; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[3].L.f = 237; - test_msg->obs[3].L.i = 138026; - test_msg->obs[3].P = 2259826078; - test_msg->obs[3].cn0 = 30; - test_msg->obs[3].lock = 24609; - test_msg->obs[3].prn = 22; - if (sizeof(test_msg->obs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->obs[0])); - } - test_msg->obs[4].L.f = 45; - test_msg->obs[4].L.i = -36952; - test_msg->obs[4].P = 1985368870; - test_msg->obs[4].cn0 = 56; - test_msg->obs[4].lock = 22736; - test_msg->obs[4].prn = 30; - - EXPECT_EQ(send_message(0x45, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.n_obs)>( - reinterpret_cast(&last_msg_->header.n_obs)), - 16) - << "incorrect value for header.n_obs, expected 16, is " - << last_msg_->header.n_obs; - EXPECT_EQ(get_asheader.t.tow)>( - reinterpret_cast(&last_msg_->header.t.tow)), - 407151400) - << "incorrect value for header.t.tow, expected 407151400, is " - << last_msg_->header.t.tow; - EXPECT_EQ(get_asheader.t.wn)>( - reinterpret_cast(&last_msg_->header.t.wn)), - 1838) - << "incorrect value for header.t.wn, expected 1838, is " - << last_msg_->header.t.wn; - EXPECT_EQ(get_asobs[0].L.f)>( - reinterpret_cast(&last_msg_->obs[0].L.f)), - 1) - << "incorrect value for obs[0].L.f, expected 1, is " - << last_msg_->obs[0].L.f; - EXPECT_EQ(get_asobs[0].L.i)>( - reinterpret_cast(&last_msg_->obs[0].L.i)), - -27634) - << "incorrect value for obs[0].L.i, expected -27634, is " - << last_msg_->obs[0].L.i; - EXPECT_EQ(get_asobs[0].P)>( - reinterpret_cast(&last_msg_->obs[0].P)), - 2044291972) - << "incorrect value for obs[0].P, expected 2044291972, is " - << last_msg_->obs[0].P; - EXPECT_EQ(get_asobs[0].cn0)>( - reinterpret_cast(&last_msg_->obs[0].cn0)), - 44) - << "incorrect value for obs[0].cn0, expected 44, is " - << last_msg_->obs[0].cn0; - EXPECT_EQ(get_asobs[0].lock)>( - reinterpret_cast(&last_msg_->obs[0].lock)), - 37807) - << "incorrect value for obs[0].lock, expected 37807, is " - << last_msg_->obs[0].lock; - EXPECT_EQ(get_asobs[0].prn)>( - reinterpret_cast(&last_msg_->obs[0].prn)), - 0) - << "incorrect value for obs[0].prn, expected 0, is " - << last_msg_->obs[0].prn; - EXPECT_EQ(get_asobs[1].L.f)>( - reinterpret_cast(&last_msg_->obs[1].L.f)), - 153) - << "incorrect value for obs[1].L.f, expected 153, is " - << last_msg_->obs[1].L.f; - EXPECT_EQ(get_asobs[1].L.i)>( - reinterpret_cast(&last_msg_->obs[1].L.i)), - -123500) - << "incorrect value for obs[1].L.i, expected -123500, is " - << last_msg_->obs[1].L.i; - EXPECT_EQ(get_asobs[1].P)>( - reinterpret_cast(&last_msg_->obs[1].P)), - 2110276225) - << "incorrect value for obs[1].P, expected 2110276225, is " - << last_msg_->obs[1].P; - EXPECT_EQ(get_asobs[1].cn0)>( - reinterpret_cast(&last_msg_->obs[1].cn0)), - 41) - << "incorrect value for obs[1].cn0, expected 41, is " - << last_msg_->obs[1].cn0; - EXPECT_EQ(get_asobs[1].lock)>( - reinterpret_cast(&last_msg_->obs[1].lock)), - 45326) - << "incorrect value for obs[1].lock, expected 45326, is " - << last_msg_->obs[1].lock; - EXPECT_EQ(get_asobs[1].prn)>( - reinterpret_cast(&last_msg_->obs[1].prn)), - 3) - << "incorrect value for obs[1].prn, expected 3, is " - << last_msg_->obs[1].prn; - EXPECT_EQ(get_asobs[2].L.f)>( - reinterpret_cast(&last_msg_->obs[2].L.f)), - 222) - << "incorrect value for obs[2].L.f, expected 222, is " - << last_msg_->obs[2].L.f; - EXPECT_EQ(get_asobs[2].L.i)>( - reinterpret_cast(&last_msg_->obs[2].L.i)), - -114033) - << "incorrect value for obs[2].L.i, expected -114033, is " - << last_msg_->obs[2].L.i; - EXPECT_EQ(get_asobs[2].P)>( - reinterpret_cast(&last_msg_->obs[2].P)), - 2298000000) - << "incorrect value for obs[2].P, expected 2298000000, is " - << last_msg_->obs[2].P; - EXPECT_EQ(get_asobs[2].cn0)>( - reinterpret_cast(&last_msg_->obs[2].cn0)), - 18) - << "incorrect value for obs[2].cn0, expected 18, is " - << last_msg_->obs[2].cn0; - EXPECT_EQ(get_asobs[2].lock)>( - reinterpret_cast(&last_msg_->obs[2].lock)), - 34232) - << "incorrect value for obs[2].lock, expected 34232, is " - << last_msg_->obs[2].lock; - EXPECT_EQ(get_asobs[2].prn)>( - reinterpret_cast(&last_msg_->obs[2].prn)), - 13) - << "incorrect value for obs[2].prn, expected 13, is " - << last_msg_->obs[2].prn; - EXPECT_EQ(get_asobs[3].L.f)>( - reinterpret_cast(&last_msg_->obs[3].L.f)), - 237) - << "incorrect value for obs[3].L.f, expected 237, is " - << last_msg_->obs[3].L.f; - EXPECT_EQ(get_asobs[3].L.i)>( - reinterpret_cast(&last_msg_->obs[3].L.i)), - 138026) - << "incorrect value for obs[3].L.i, expected 138026, is " - << last_msg_->obs[3].L.i; - EXPECT_EQ(get_asobs[3].P)>( - reinterpret_cast(&last_msg_->obs[3].P)), - 2259826078) - << "incorrect value for obs[3].P, expected 2259826078, is " - << last_msg_->obs[3].P; - EXPECT_EQ(get_asobs[3].cn0)>( - reinterpret_cast(&last_msg_->obs[3].cn0)), - 30) - << "incorrect value for obs[3].cn0, expected 30, is " - << last_msg_->obs[3].cn0; - EXPECT_EQ(get_asobs[3].lock)>( - reinterpret_cast(&last_msg_->obs[3].lock)), - 24609) - << "incorrect value for obs[3].lock, expected 24609, is " - << last_msg_->obs[3].lock; - EXPECT_EQ(get_asobs[3].prn)>( - reinterpret_cast(&last_msg_->obs[3].prn)), - 22) - << "incorrect value for obs[3].prn, expected 22, is " - << last_msg_->obs[3].prn; - EXPECT_EQ(get_asobs[4].L.f)>( - reinterpret_cast(&last_msg_->obs[4].L.f)), - 45) - << "incorrect value for obs[4].L.f, expected 45, is " - << last_msg_->obs[4].L.f; - EXPECT_EQ(get_asobs[4].L.i)>( - reinterpret_cast(&last_msg_->obs[4].L.i)), - -36952) - << "incorrect value for obs[4].L.i, expected -36952, is " - << last_msg_->obs[4].L.i; - EXPECT_EQ(get_asobs[4].P)>( - reinterpret_cast(&last_msg_->obs[4].P)), - 1985368870) - << "incorrect value for obs[4].P, expected 1985368870, is " - << last_msg_->obs[4].P; - EXPECT_EQ(get_asobs[4].cn0)>( - reinterpret_cast(&last_msg_->obs[4].cn0)), - 56) - << "incorrect value for obs[4].cn0, expected 56, is " - << last_msg_->obs[4].cn0; - EXPECT_EQ(get_asobs[4].lock)>( - reinterpret_cast(&last_msg_->obs[4].lock)), - 22736) - << "incorrect value for obs[4].lock, expected 22736, is " - << last_msg_->obs[4].lock; - EXPECT_EQ(get_asobs[4].prn)>( - reinterpret_cast(&last_msg_->obs[4].prn)), - 30) - << "incorrect value for obs[4].prn, expected 30, is " - << last_msg_->obs[4].prn; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_orientation_MsgAngularRate.cc b/c/test/legacy/cpp/auto_check_sbp_orientation_MsgAngularRate.cc deleted file mode 100644 index bec452312b..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_orientation_MsgAngularRate.cc +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/orientation/test_MsgAngularRate.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_orientation_MsgAngularRate0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_orientation_MsgAngularRate0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_angular_rate_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_angular_rate_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_orientation_MsgAngularRate0, Test) { - uint8_t encoded_frame[] = { - 85, 34, 2, 66, 0, 17, 2, 0, 0, 0, 2, 0, 0, - 0, 5, 0, 0, 0, 2, 0, 0, 0, 0, 88, 70, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_angular_rate_t *test_msg = (msg_angular_rate_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->tow = 2; - test_msg->x = 2; - test_msg->y = 5; - test_msg->z = 2; - - EXPECT_EQ(send_message(0x222, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 2) - << "incorrect value for tow, expected 2, is " << last_msg_->tow; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - 2) - << "incorrect value for x, expected 2, is " << last_msg_->x; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - 5) - << "incorrect value for y, expected 5, is " << last_msg_->y; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 2) - << "incorrect value for z, expected 2, is " << last_msg_->z; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_orientation_MsgBaselineHeading.cc b/c/test/legacy/cpp/auto_check_sbp_orientation_MsgBaselineHeading.cc deleted file mode 100644 index 26d545bb42..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_orientation_MsgBaselineHeading.cc +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/orientation/test_MsgBaselineHeading.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_orientation_MsgBaselineHeading0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_orientation_MsgBaselineHeading0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_baseline_heading_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_baseline_heading_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_orientation_MsgBaselineHeading0, Test) { - uint8_t encoded_frame[] = { - 85, 15, 2, 211, 93, 10, 156, 45, 13, - 196, 44, 84, 197, 61, 91, 91, 224, 254, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_baseline_heading_t *test_msg = (msg_baseline_heading_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 91; - test_msg->heading = 1036342316; - test_msg->n_sats = 91; - test_msg->tow = 3289197980; - - EXPECT_EQ(send_message(0x20f, 24019, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 24019); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 91) - << "incorrect value for flags, expected 91, is " << last_msg_->flags; - EXPECT_EQ(get_asheading)>( - reinterpret_cast(&last_msg_->heading)), - 1036342316) - << "incorrect value for heading, expected 1036342316, is " - << last_msg_->heading; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 91) - << "incorrect value for n_sats, expected 91, is " << last_msg_->n_sats; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 3289197980) - << "incorrect value for tow, expected 3289197980, is " << last_msg_->tow; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_orientation_MsgOrientEuler.cc b/c/test/legacy/cpp/auto_check_sbp_orientation_MsgOrientEuler.cc deleted file mode 100644 index 65ee5d283d..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_orientation_MsgOrientEuler.cc +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/orientation/test_MsgOrientEuler.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_orientation_MsgOrientEuler0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_orientation_MsgOrientEuler0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_orient_euler_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_orient_euler_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_orientation_MsgOrientEuler0, Test) { - uint8_t encoded_frame[] = { - 85, 33, 2, 66, 0, 29, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 8, - 0, 0, 0, 0, 0, 224, 64, 0, 0, 64, 64, 0, 0, 224, 64, 3, 44, 226, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_orient_euler_t *test_msg = (msg_orient_euler_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 3; - test_msg->pitch = 2; - test_msg->pitch_accuracy = 3.0; - test_msg->roll = 1; - test_msg->roll_accuracy = 7.0; - test_msg->tow = 1; - test_msg->yaw = 8; - test_msg->yaw_accuracy = 7.0; - - EXPECT_EQ(send_message(0x221, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 3) - << "incorrect value for flags, expected 3, is " << last_msg_->flags; - EXPECT_EQ(get_aspitch)>( - reinterpret_cast(&last_msg_->pitch)), - 2) - << "incorrect value for pitch, expected 2, is " << last_msg_->pitch; - EXPECT_LT((last_msg_->pitch_accuracy * 100 - 3.0 * 100), 0.05) - << "incorrect value for pitch_accuracy, expected 3.0, is " - << last_msg_->pitch_accuracy; - EXPECT_EQ(get_asroll)>( - reinterpret_cast(&last_msg_->roll)), - 1) - << "incorrect value for roll, expected 1, is " << last_msg_->roll; - EXPECT_LT((last_msg_->roll_accuracy * 100 - 7.0 * 100), 0.05) - << "incorrect value for roll_accuracy, expected 7.0, is " - << last_msg_->roll_accuracy; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 1) - << "incorrect value for tow, expected 1, is " << last_msg_->tow; - EXPECT_EQ(get_asyaw)>( - reinterpret_cast(&last_msg_->yaw)), - 8) - << "incorrect value for yaw, expected 8, is " << last_msg_->yaw; - EXPECT_LT((last_msg_->yaw_accuracy * 100 - 7.0 * 100), 0.05) - << "incorrect value for yaw_accuracy, expected 7.0, is " - << last_msg_->yaw_accuracy; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_orientation_MsgOrientQuat.cc b/c/test/legacy/cpp/auto_check_sbp_orientation_MsgOrientQuat.cc deleted file mode 100644 index bd02837025..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_orientation_MsgOrientQuat.cc +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/orientation/test_MsgOrientQuat.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_orientation_MsgOrientQuat0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_orientation_MsgOrientQuat0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_orient_quat_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_orient_quat_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_orientation_MsgOrientQuat0, Test) { - uint8_t encoded_frame[] = { - 85, 32, 2, 66, 0, 37, 0, 0, 0, 0, 3, 0, 0, 0, 7, - 0, 0, 0, 8, 0, 0, 0, 4, 0, 0, 0, 0, 0, 64, 64, - 0, 0, 128, 64, 0, 0, 0, 65, 0, 0, 64, 64, 1, 186, 6, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_orient_quat_t *test_msg = (msg_orient_quat_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 1; - test_msg->tow = 0; - test_msg->w = 3; - test_msg->w_accuracy = 3.0; - test_msg->x = 7; - test_msg->x_accuracy = 4.0; - test_msg->y = 8; - test_msg->y_accuracy = 8.0; - test_msg->z = 4; - test_msg->z_accuracy = 3.0; - - EXPECT_EQ(send_message(0x220, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 0) - << "incorrect value for tow, expected 0, is " << last_msg_->tow; - EXPECT_EQ(get_asw)>( - reinterpret_cast(&last_msg_->w)), - 3) - << "incorrect value for w, expected 3, is " << last_msg_->w; - EXPECT_LT((last_msg_->w_accuracy * 100 - 3.0 * 100), 0.05) - << "incorrect value for w_accuracy, expected 3.0, is " - << last_msg_->w_accuracy; - EXPECT_EQ(get_asx)>( - reinterpret_cast(&last_msg_->x)), - 7) - << "incorrect value for x, expected 7, is " << last_msg_->x; - EXPECT_LT((last_msg_->x_accuracy * 100 - 4.0 * 100), 0.05) - << "incorrect value for x_accuracy, expected 4.0, is " - << last_msg_->x_accuracy; - EXPECT_EQ(get_asy)>( - reinterpret_cast(&last_msg_->y)), - 8) - << "incorrect value for y, expected 8, is " << last_msg_->y; - EXPECT_LT((last_msg_->y_accuracy * 100 - 8.0 * 100), 0.05) - << "incorrect value for y_accuracy, expected 8.0, is " - << last_msg_->y_accuracy; - EXPECT_EQ(get_asz)>( - reinterpret_cast(&last_msg_->z)), - 4) - << "incorrect value for z, expected 4, is " << last_msg_->z; - EXPECT_LT((last_msg_->z_accuracy * 100 - 3.0 * 100), 0.05) - << "incorrect value for z_accuracy, expected 3.0, is " - << last_msg_->z_accuracy; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgAlmanac.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgAlmanac.cc deleted file mode 100644 index 4ef4a05dfd..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgAlmanac.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgAlmanac.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCellModemStatus.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCellModemStatus.cc deleted file mode 100644 index a57717b4e9..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCellModemStatus.cc +++ /dev/null @@ -1,2648 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgCellModemStatus.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgCellModemStatus0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgCellModemStatus0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_cell_modem_status_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_cell_modem_status_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgCellModemStatus0, Test) { - uint8_t encoded_frame[] = { - 85, 190, 0, 19, 27, 255, 103, 205, 48, 6, 70, 123, 242, 46, 52, - 64, 176, 154, 98, 43, 132, 196, 89, 253, 161, 250, 174, 204, 110, 47, - 38, 187, 63, 102, 177, 162, 49, 80, 194, 37, 107, 60, 225, 52, 101, - 178, 142, 246, 21, 17, 93, 75, 169, 86, 16, 209, 80, 243, 30, 206, - 220, 206, 115, 47, 154, 91, 227, 88, 11, 1, 85, 146, 100, 190, 232, - 207, 61, 61, 201, 220, 31, 78, 34, 57, 82, 59, 104, 65, 221, 0, - 43, 210, 9, 32, 122, 29, 237, 11, 151, 223, 18, 81, 204, 172, 234, - 127, 3, 82, 133, 169, 12, 176, 193, 0, 24, 121, 85, 55, 214, 198, - 75, 234, 179, 214, 85, 94, 115, 21, 73, 121, 75, 46, 158, 63, 100, - 122, 213, 20, 85, 212, 131, 50, 224, 218, 215, 215, 149, 2, 19, 129, - 39, 164, 5, 175, 6, 62, 51, 78, 66, 248, 116, 88, 90, 128, 226, - 177, 0, 47, 140, 33, 126, 221, 110, 144, 97, 74, 250, 181, 199, 27, - 176, 65, 185, 110, 92, 34, 44, 131, 96, 178, 40, 176, 4, 90, 36, - 7, 180, 244, 244, 23, 108, 171, 204, 196, 61, 51, 179, 242, 156, 81, - 83, 16, 15, 134, 40, 245, 253, 150, 94, 150, 144, 197, 113, 5, 141, - 232, 33, 101, 231, 38, 75, 178, 243, 119, 1, 248, 218, 86, 7, 88, - 197, 148, 240, 227, 2, 65, 173, 122, 143, 251, 156, 217, 67, 239, 219, - 31, 224, 176, 129, 81, 80, 40, 230, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_cell_modem_status_t *test_msg = - (msg_cell_modem_status_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[0] = 123; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[1] = 242; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[2] = 46; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[3] = 52; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[4] = 64; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[5] = 176; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[6] = 154; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[7] = 98; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[8] = 43; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[9] = 132; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[10] = 196; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[11] = 89; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[12] = 253; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[13] = 161; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[14] = 250; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[15] = 174; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[16] = 204; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[17] = 110; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[18] = 47; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[19] = 38; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[20] = 187; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[21] = 63; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[22] = 102; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[23] = 177; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[24] = 162; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[25] = 49; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[26] = 80; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[27] = 194; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[28] = 37; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[29] = 107; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[30] = 60; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[31] = 225; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[32] = 52; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[33] = 101; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[34] = 178; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[35] = 142; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[36] = 246; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[37] = 21; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[38] = 17; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[39] = 93; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[40] = 75; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[41] = 169; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[42] = 86; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[43] = 16; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[44] = 209; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[45] = 80; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[46] = 243; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[47] = 30; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[48] = 206; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[49] = 220; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[50] = 206; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[51] = 115; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[52] = 47; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[53] = 154; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[54] = 91; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[55] = 227; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[56] = 88; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[57] = 11; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[58] = 1; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[59] = 85; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[60] = 146; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[61] = 100; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[62] = 190; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[63] = 232; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[64] = 207; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[65] = 61; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[66] = 61; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[67] = 201; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[68] = 220; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[69] = 31; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[70] = 78; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[71] = 34; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[72] = 57; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[73] = 82; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[74] = 59; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[75] = 104; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[76] = 65; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[77] = 221; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[78] = 0; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[79] = 43; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[80] = 210; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[81] = 9; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[82] = 32; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[83] = 122; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[84] = 29; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[85] = 237; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[86] = 11; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[87] = 151; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[88] = 223; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[89] = 18; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[90] = 81; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[91] = 204; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[92] = 172; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[93] = 234; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[94] = 127; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[95] = 3; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[96] = 82; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[97] = 133; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[98] = 169; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[99] = 12; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[100] = 176; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[101] = 193; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[102] = 0; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[103] = 24; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[104] = 121; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[105] = 85; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[106] = 55; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[107] = 214; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[108] = 198; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[109] = 75; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[110] = 234; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[111] = 179; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[112] = 214; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[113] = 85; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[114] = 94; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[115] = 115; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[116] = 21; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[117] = 73; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[118] = 121; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[119] = 75; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[120] = 46; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[121] = 158; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[122] = 63; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[123] = 100; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[124] = 122; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[125] = 213; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[126] = 20; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[127] = 85; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[128] = 212; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[129] = 131; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[130] = 50; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[131] = 224; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[132] = 218; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[133] = 215; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[134] = 215; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[135] = 149; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[136] = 2; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[137] = 19; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[138] = 129; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[139] = 39; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[140] = 164; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[141] = 5; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[142] = 175; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[143] = 6; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[144] = 62; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[145] = 51; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[146] = 78; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[147] = 66; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[148] = 248; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[149] = 116; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[150] = 88; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[151] = 90; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[152] = 128; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[153] = 226; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[154] = 177; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[155] = 0; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[156] = 47; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[157] = 140; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[158] = 33; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[159] = 126; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[160] = 221; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[161] = 110; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[162] = 144; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[163] = 97; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[164] = 74; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[165] = 250; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[166] = 181; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[167] = 199; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[168] = 27; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[169] = 176; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[170] = 65; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[171] = 185; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[172] = 110; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[173] = 92; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[174] = 34; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[175] = 44; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[176] = 131; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[177] = 96; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[178] = 178; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[179] = 40; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[180] = 176; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[181] = 4; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[182] = 90; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[183] = 36; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[184] = 7; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[185] = 180; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[186] = 244; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[187] = 244; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[188] = 23; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[189] = 108; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[190] = 171; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[191] = 204; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[192] = 196; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[193] = 61; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[194] = 51; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[195] = 179; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[196] = 242; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[197] = 156; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[198] = 81; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[199] = 83; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[200] = 16; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[201] = 15; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[202] = 134; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[203] = 40; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[204] = 245; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[205] = 253; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[206] = 150; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[207] = 94; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[208] = 150; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[209] = 144; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[210] = 197; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[211] = 113; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[212] = 5; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[213] = 141; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[214] = 232; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[215] = 33; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[216] = 101; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[217] = 231; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[218] = 38; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[219] = 75; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[220] = 178; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[221] = 243; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[222] = 119; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[223] = 1; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[224] = 248; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[225] = 218; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[226] = 86; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[227] = 7; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[228] = 88; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[229] = 197; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[230] = 148; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[231] = 240; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[232] = 227; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[233] = 2; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[234] = 65; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[235] = 173; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[236] = 122; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[237] = 143; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[238] = 251; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[239] = 156; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[240] = 217; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[241] = 67; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[242] = 239; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[243] = 219; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[244] = 31; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[245] = 224; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[246] = 176; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[247] = 129; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[248] = 81; - if (sizeof(test_msg->reserved) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->reserved[0])); - } - test_msg->reserved[249] = 80; - test_msg->signal_error_rate = 8588.2001953125; - test_msg->signal_strength = 103; - - EXPECT_EQ(send_message(0xbe, 6931, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 6931); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asreserved[0])>( - reinterpret_cast(&last_msg_->reserved[0])), - 123) - << "incorrect value for reserved[0], expected 123, is " - << last_msg_->reserved[0]; - EXPECT_EQ(get_asreserved[1])>( - reinterpret_cast(&last_msg_->reserved[1])), - 242) - << "incorrect value for reserved[1], expected 242, is " - << last_msg_->reserved[1]; - EXPECT_EQ(get_asreserved[2])>( - reinterpret_cast(&last_msg_->reserved[2])), - 46) - << "incorrect value for reserved[2], expected 46, is " - << last_msg_->reserved[2]; - EXPECT_EQ(get_asreserved[3])>( - reinterpret_cast(&last_msg_->reserved[3])), - 52) - << "incorrect value for reserved[3], expected 52, is " - << last_msg_->reserved[3]; - EXPECT_EQ(get_asreserved[4])>( - reinterpret_cast(&last_msg_->reserved[4])), - 64) - << "incorrect value for reserved[4], expected 64, is " - << last_msg_->reserved[4]; - EXPECT_EQ(get_asreserved[5])>( - reinterpret_cast(&last_msg_->reserved[5])), - 176) - << "incorrect value for reserved[5], expected 176, is " - << last_msg_->reserved[5]; - EXPECT_EQ(get_asreserved[6])>( - reinterpret_cast(&last_msg_->reserved[6])), - 154) - << "incorrect value for reserved[6], expected 154, is " - << last_msg_->reserved[6]; - EXPECT_EQ(get_asreserved[7])>( - reinterpret_cast(&last_msg_->reserved[7])), - 98) - << "incorrect value for reserved[7], expected 98, is " - << last_msg_->reserved[7]; - EXPECT_EQ(get_asreserved[8])>( - reinterpret_cast(&last_msg_->reserved[8])), - 43) - << "incorrect value for reserved[8], expected 43, is " - << last_msg_->reserved[8]; - EXPECT_EQ(get_asreserved[9])>( - reinterpret_cast(&last_msg_->reserved[9])), - 132) - << "incorrect value for reserved[9], expected 132, is " - << last_msg_->reserved[9]; - EXPECT_EQ(get_asreserved[10])>( - reinterpret_cast(&last_msg_->reserved[10])), - 196) - << "incorrect value for reserved[10], expected 196, is " - << last_msg_->reserved[10]; - EXPECT_EQ(get_asreserved[11])>( - reinterpret_cast(&last_msg_->reserved[11])), - 89) - << "incorrect value for reserved[11], expected 89, is " - << last_msg_->reserved[11]; - EXPECT_EQ(get_asreserved[12])>( - reinterpret_cast(&last_msg_->reserved[12])), - 253) - << "incorrect value for reserved[12], expected 253, is " - << last_msg_->reserved[12]; - EXPECT_EQ(get_asreserved[13])>( - reinterpret_cast(&last_msg_->reserved[13])), - 161) - << "incorrect value for reserved[13], expected 161, is " - << last_msg_->reserved[13]; - EXPECT_EQ(get_asreserved[14])>( - reinterpret_cast(&last_msg_->reserved[14])), - 250) - << "incorrect value for reserved[14], expected 250, is " - << last_msg_->reserved[14]; - EXPECT_EQ(get_asreserved[15])>( - reinterpret_cast(&last_msg_->reserved[15])), - 174) - << "incorrect value for reserved[15], expected 174, is " - << last_msg_->reserved[15]; - EXPECT_EQ(get_asreserved[16])>( - reinterpret_cast(&last_msg_->reserved[16])), - 204) - << "incorrect value for reserved[16], expected 204, is " - << last_msg_->reserved[16]; - EXPECT_EQ(get_asreserved[17])>( - reinterpret_cast(&last_msg_->reserved[17])), - 110) - << "incorrect value for reserved[17], expected 110, is " - << last_msg_->reserved[17]; - EXPECT_EQ(get_asreserved[18])>( - reinterpret_cast(&last_msg_->reserved[18])), - 47) - << "incorrect value for reserved[18], expected 47, is " - << last_msg_->reserved[18]; - EXPECT_EQ(get_asreserved[19])>( - reinterpret_cast(&last_msg_->reserved[19])), - 38) - << "incorrect value for reserved[19], expected 38, is " - << last_msg_->reserved[19]; - EXPECT_EQ(get_asreserved[20])>( - reinterpret_cast(&last_msg_->reserved[20])), - 187) - << "incorrect value for reserved[20], expected 187, is " - << last_msg_->reserved[20]; - EXPECT_EQ(get_asreserved[21])>( - reinterpret_cast(&last_msg_->reserved[21])), - 63) - << "incorrect value for reserved[21], expected 63, is " - << last_msg_->reserved[21]; - EXPECT_EQ(get_asreserved[22])>( - reinterpret_cast(&last_msg_->reserved[22])), - 102) - << "incorrect value for reserved[22], expected 102, is " - << last_msg_->reserved[22]; - EXPECT_EQ(get_asreserved[23])>( - reinterpret_cast(&last_msg_->reserved[23])), - 177) - << "incorrect value for reserved[23], expected 177, is " - << last_msg_->reserved[23]; - EXPECT_EQ(get_asreserved[24])>( - reinterpret_cast(&last_msg_->reserved[24])), - 162) - << "incorrect value for reserved[24], expected 162, is " - << last_msg_->reserved[24]; - EXPECT_EQ(get_asreserved[25])>( - reinterpret_cast(&last_msg_->reserved[25])), - 49) - << "incorrect value for reserved[25], expected 49, is " - << last_msg_->reserved[25]; - EXPECT_EQ(get_asreserved[26])>( - reinterpret_cast(&last_msg_->reserved[26])), - 80) - << "incorrect value for reserved[26], expected 80, is " - << last_msg_->reserved[26]; - EXPECT_EQ(get_asreserved[27])>( - reinterpret_cast(&last_msg_->reserved[27])), - 194) - << "incorrect value for reserved[27], expected 194, is " - << last_msg_->reserved[27]; - EXPECT_EQ(get_asreserved[28])>( - reinterpret_cast(&last_msg_->reserved[28])), - 37) - << "incorrect value for reserved[28], expected 37, is " - << last_msg_->reserved[28]; - EXPECT_EQ(get_asreserved[29])>( - reinterpret_cast(&last_msg_->reserved[29])), - 107) - << "incorrect value for reserved[29], expected 107, is " - << last_msg_->reserved[29]; - EXPECT_EQ(get_asreserved[30])>( - reinterpret_cast(&last_msg_->reserved[30])), - 60) - << "incorrect value for reserved[30], expected 60, is " - << last_msg_->reserved[30]; - EXPECT_EQ(get_asreserved[31])>( - reinterpret_cast(&last_msg_->reserved[31])), - 225) - << "incorrect value for reserved[31], expected 225, is " - << last_msg_->reserved[31]; - EXPECT_EQ(get_asreserved[32])>( - reinterpret_cast(&last_msg_->reserved[32])), - 52) - << "incorrect value for reserved[32], expected 52, is " - << last_msg_->reserved[32]; - EXPECT_EQ(get_asreserved[33])>( - reinterpret_cast(&last_msg_->reserved[33])), - 101) - << "incorrect value for reserved[33], expected 101, is " - << last_msg_->reserved[33]; - EXPECT_EQ(get_asreserved[34])>( - reinterpret_cast(&last_msg_->reserved[34])), - 178) - << "incorrect value for reserved[34], expected 178, is " - << last_msg_->reserved[34]; - EXPECT_EQ(get_asreserved[35])>( - reinterpret_cast(&last_msg_->reserved[35])), - 142) - << "incorrect value for reserved[35], expected 142, is " - << last_msg_->reserved[35]; - EXPECT_EQ(get_asreserved[36])>( - reinterpret_cast(&last_msg_->reserved[36])), - 246) - << "incorrect value for reserved[36], expected 246, is " - << last_msg_->reserved[36]; - EXPECT_EQ(get_asreserved[37])>( - reinterpret_cast(&last_msg_->reserved[37])), - 21) - << "incorrect value for reserved[37], expected 21, is " - << last_msg_->reserved[37]; - EXPECT_EQ(get_asreserved[38])>( - reinterpret_cast(&last_msg_->reserved[38])), - 17) - << "incorrect value for reserved[38], expected 17, is " - << last_msg_->reserved[38]; - EXPECT_EQ(get_asreserved[39])>( - reinterpret_cast(&last_msg_->reserved[39])), - 93) - << "incorrect value for reserved[39], expected 93, is " - << last_msg_->reserved[39]; - EXPECT_EQ(get_asreserved[40])>( - reinterpret_cast(&last_msg_->reserved[40])), - 75) - << "incorrect value for reserved[40], expected 75, is " - << last_msg_->reserved[40]; - EXPECT_EQ(get_asreserved[41])>( - reinterpret_cast(&last_msg_->reserved[41])), - 169) - << "incorrect value for reserved[41], expected 169, is " - << last_msg_->reserved[41]; - EXPECT_EQ(get_asreserved[42])>( - reinterpret_cast(&last_msg_->reserved[42])), - 86) - << "incorrect value for reserved[42], expected 86, is " - << last_msg_->reserved[42]; - EXPECT_EQ(get_asreserved[43])>( - reinterpret_cast(&last_msg_->reserved[43])), - 16) - << "incorrect value for reserved[43], expected 16, is " - << last_msg_->reserved[43]; - EXPECT_EQ(get_asreserved[44])>( - reinterpret_cast(&last_msg_->reserved[44])), - 209) - << "incorrect value for reserved[44], expected 209, is " - << last_msg_->reserved[44]; - EXPECT_EQ(get_asreserved[45])>( - reinterpret_cast(&last_msg_->reserved[45])), - 80) - << "incorrect value for reserved[45], expected 80, is " - << last_msg_->reserved[45]; - EXPECT_EQ(get_asreserved[46])>( - reinterpret_cast(&last_msg_->reserved[46])), - 243) - << "incorrect value for reserved[46], expected 243, is " - << last_msg_->reserved[46]; - EXPECT_EQ(get_asreserved[47])>( - reinterpret_cast(&last_msg_->reserved[47])), - 30) - << "incorrect value for reserved[47], expected 30, is " - << last_msg_->reserved[47]; - EXPECT_EQ(get_asreserved[48])>( - reinterpret_cast(&last_msg_->reserved[48])), - 206) - << "incorrect value for reserved[48], expected 206, is " - << last_msg_->reserved[48]; - EXPECT_EQ(get_asreserved[49])>( - reinterpret_cast(&last_msg_->reserved[49])), - 220) - << "incorrect value for reserved[49], expected 220, is " - << last_msg_->reserved[49]; - EXPECT_EQ(get_asreserved[50])>( - reinterpret_cast(&last_msg_->reserved[50])), - 206) - << "incorrect value for reserved[50], expected 206, is " - << last_msg_->reserved[50]; - EXPECT_EQ(get_asreserved[51])>( - reinterpret_cast(&last_msg_->reserved[51])), - 115) - << "incorrect value for reserved[51], expected 115, is " - << last_msg_->reserved[51]; - EXPECT_EQ(get_asreserved[52])>( - reinterpret_cast(&last_msg_->reserved[52])), - 47) - << "incorrect value for reserved[52], expected 47, is " - << last_msg_->reserved[52]; - EXPECT_EQ(get_asreserved[53])>( - reinterpret_cast(&last_msg_->reserved[53])), - 154) - << "incorrect value for reserved[53], expected 154, is " - << last_msg_->reserved[53]; - EXPECT_EQ(get_asreserved[54])>( - reinterpret_cast(&last_msg_->reserved[54])), - 91) - << "incorrect value for reserved[54], expected 91, is " - << last_msg_->reserved[54]; - EXPECT_EQ(get_asreserved[55])>( - reinterpret_cast(&last_msg_->reserved[55])), - 227) - << "incorrect value for reserved[55], expected 227, is " - << last_msg_->reserved[55]; - EXPECT_EQ(get_asreserved[56])>( - reinterpret_cast(&last_msg_->reserved[56])), - 88) - << "incorrect value for reserved[56], expected 88, is " - << last_msg_->reserved[56]; - EXPECT_EQ(get_asreserved[57])>( - reinterpret_cast(&last_msg_->reserved[57])), - 11) - << "incorrect value for reserved[57], expected 11, is " - << last_msg_->reserved[57]; - EXPECT_EQ(get_asreserved[58])>( - reinterpret_cast(&last_msg_->reserved[58])), - 1) - << "incorrect value for reserved[58], expected 1, is " - << last_msg_->reserved[58]; - EXPECT_EQ(get_asreserved[59])>( - reinterpret_cast(&last_msg_->reserved[59])), - 85) - << "incorrect value for reserved[59], expected 85, is " - << last_msg_->reserved[59]; - EXPECT_EQ(get_asreserved[60])>( - reinterpret_cast(&last_msg_->reserved[60])), - 146) - << "incorrect value for reserved[60], expected 146, is " - << last_msg_->reserved[60]; - EXPECT_EQ(get_asreserved[61])>( - reinterpret_cast(&last_msg_->reserved[61])), - 100) - << "incorrect value for reserved[61], expected 100, is " - << last_msg_->reserved[61]; - EXPECT_EQ(get_asreserved[62])>( - reinterpret_cast(&last_msg_->reserved[62])), - 190) - << "incorrect value for reserved[62], expected 190, is " - << last_msg_->reserved[62]; - EXPECT_EQ(get_asreserved[63])>( - reinterpret_cast(&last_msg_->reserved[63])), - 232) - << "incorrect value for reserved[63], expected 232, is " - << last_msg_->reserved[63]; - EXPECT_EQ(get_asreserved[64])>( - reinterpret_cast(&last_msg_->reserved[64])), - 207) - << "incorrect value for reserved[64], expected 207, is " - << last_msg_->reserved[64]; - EXPECT_EQ(get_asreserved[65])>( - reinterpret_cast(&last_msg_->reserved[65])), - 61) - << "incorrect value for reserved[65], expected 61, is " - << last_msg_->reserved[65]; - EXPECT_EQ(get_asreserved[66])>( - reinterpret_cast(&last_msg_->reserved[66])), - 61) - << "incorrect value for reserved[66], expected 61, is " - << last_msg_->reserved[66]; - EXPECT_EQ(get_asreserved[67])>( - reinterpret_cast(&last_msg_->reserved[67])), - 201) - << "incorrect value for reserved[67], expected 201, is " - << last_msg_->reserved[67]; - EXPECT_EQ(get_asreserved[68])>( - reinterpret_cast(&last_msg_->reserved[68])), - 220) - << "incorrect value for reserved[68], expected 220, is " - << last_msg_->reserved[68]; - EXPECT_EQ(get_asreserved[69])>( - reinterpret_cast(&last_msg_->reserved[69])), - 31) - << "incorrect value for reserved[69], expected 31, is " - << last_msg_->reserved[69]; - EXPECT_EQ(get_asreserved[70])>( - reinterpret_cast(&last_msg_->reserved[70])), - 78) - << "incorrect value for reserved[70], expected 78, is " - << last_msg_->reserved[70]; - EXPECT_EQ(get_asreserved[71])>( - reinterpret_cast(&last_msg_->reserved[71])), - 34) - << "incorrect value for reserved[71], expected 34, is " - << last_msg_->reserved[71]; - EXPECT_EQ(get_asreserved[72])>( - reinterpret_cast(&last_msg_->reserved[72])), - 57) - << "incorrect value for reserved[72], expected 57, is " - << last_msg_->reserved[72]; - EXPECT_EQ(get_asreserved[73])>( - reinterpret_cast(&last_msg_->reserved[73])), - 82) - << "incorrect value for reserved[73], expected 82, is " - << last_msg_->reserved[73]; - EXPECT_EQ(get_asreserved[74])>( - reinterpret_cast(&last_msg_->reserved[74])), - 59) - << "incorrect value for reserved[74], expected 59, is " - << last_msg_->reserved[74]; - EXPECT_EQ(get_asreserved[75])>( - reinterpret_cast(&last_msg_->reserved[75])), - 104) - << "incorrect value for reserved[75], expected 104, is " - << last_msg_->reserved[75]; - EXPECT_EQ(get_asreserved[76])>( - reinterpret_cast(&last_msg_->reserved[76])), - 65) - << "incorrect value for reserved[76], expected 65, is " - << last_msg_->reserved[76]; - EXPECT_EQ(get_asreserved[77])>( - reinterpret_cast(&last_msg_->reserved[77])), - 221) - << "incorrect value for reserved[77], expected 221, is " - << last_msg_->reserved[77]; - EXPECT_EQ(get_asreserved[78])>( - reinterpret_cast(&last_msg_->reserved[78])), - 0) - << "incorrect value for reserved[78], expected 0, is " - << last_msg_->reserved[78]; - EXPECT_EQ(get_asreserved[79])>( - reinterpret_cast(&last_msg_->reserved[79])), - 43) - << "incorrect value for reserved[79], expected 43, is " - << last_msg_->reserved[79]; - EXPECT_EQ(get_asreserved[80])>( - reinterpret_cast(&last_msg_->reserved[80])), - 210) - << "incorrect value for reserved[80], expected 210, is " - << last_msg_->reserved[80]; - EXPECT_EQ(get_asreserved[81])>( - reinterpret_cast(&last_msg_->reserved[81])), - 9) - << "incorrect value for reserved[81], expected 9, is " - << last_msg_->reserved[81]; - EXPECT_EQ(get_asreserved[82])>( - reinterpret_cast(&last_msg_->reserved[82])), - 32) - << "incorrect value for reserved[82], expected 32, is " - << last_msg_->reserved[82]; - EXPECT_EQ(get_asreserved[83])>( - reinterpret_cast(&last_msg_->reserved[83])), - 122) - << "incorrect value for reserved[83], expected 122, is " - << last_msg_->reserved[83]; - EXPECT_EQ(get_asreserved[84])>( - reinterpret_cast(&last_msg_->reserved[84])), - 29) - << "incorrect value for reserved[84], expected 29, is " - << last_msg_->reserved[84]; - EXPECT_EQ(get_asreserved[85])>( - reinterpret_cast(&last_msg_->reserved[85])), - 237) - << "incorrect value for reserved[85], expected 237, is " - << last_msg_->reserved[85]; - EXPECT_EQ(get_asreserved[86])>( - reinterpret_cast(&last_msg_->reserved[86])), - 11) - << "incorrect value for reserved[86], expected 11, is " - << last_msg_->reserved[86]; - EXPECT_EQ(get_asreserved[87])>( - reinterpret_cast(&last_msg_->reserved[87])), - 151) - << "incorrect value for reserved[87], expected 151, is " - << last_msg_->reserved[87]; - EXPECT_EQ(get_asreserved[88])>( - reinterpret_cast(&last_msg_->reserved[88])), - 223) - << "incorrect value for reserved[88], expected 223, is " - << last_msg_->reserved[88]; - EXPECT_EQ(get_asreserved[89])>( - reinterpret_cast(&last_msg_->reserved[89])), - 18) - << "incorrect value for reserved[89], expected 18, is " - << last_msg_->reserved[89]; - EXPECT_EQ(get_asreserved[90])>( - reinterpret_cast(&last_msg_->reserved[90])), - 81) - << "incorrect value for reserved[90], expected 81, is " - << last_msg_->reserved[90]; - EXPECT_EQ(get_asreserved[91])>( - reinterpret_cast(&last_msg_->reserved[91])), - 204) - << "incorrect value for reserved[91], expected 204, is " - << last_msg_->reserved[91]; - EXPECT_EQ(get_asreserved[92])>( - reinterpret_cast(&last_msg_->reserved[92])), - 172) - << "incorrect value for reserved[92], expected 172, is " - << last_msg_->reserved[92]; - EXPECT_EQ(get_asreserved[93])>( - reinterpret_cast(&last_msg_->reserved[93])), - 234) - << "incorrect value for reserved[93], expected 234, is " - << last_msg_->reserved[93]; - EXPECT_EQ(get_asreserved[94])>( - reinterpret_cast(&last_msg_->reserved[94])), - 127) - << "incorrect value for reserved[94], expected 127, is " - << last_msg_->reserved[94]; - EXPECT_EQ(get_asreserved[95])>( - reinterpret_cast(&last_msg_->reserved[95])), - 3) - << "incorrect value for reserved[95], expected 3, is " - << last_msg_->reserved[95]; - EXPECT_EQ(get_asreserved[96])>( - reinterpret_cast(&last_msg_->reserved[96])), - 82) - << "incorrect value for reserved[96], expected 82, is " - << last_msg_->reserved[96]; - EXPECT_EQ(get_asreserved[97])>( - reinterpret_cast(&last_msg_->reserved[97])), - 133) - << "incorrect value for reserved[97], expected 133, is " - << last_msg_->reserved[97]; - EXPECT_EQ(get_asreserved[98])>( - reinterpret_cast(&last_msg_->reserved[98])), - 169) - << "incorrect value for reserved[98], expected 169, is " - << last_msg_->reserved[98]; - EXPECT_EQ(get_asreserved[99])>( - reinterpret_cast(&last_msg_->reserved[99])), - 12) - << "incorrect value for reserved[99], expected 12, is " - << last_msg_->reserved[99]; - EXPECT_EQ(get_asreserved[100])>( - reinterpret_cast(&last_msg_->reserved[100])), - 176) - << "incorrect value for reserved[100], expected 176, is " - << last_msg_->reserved[100]; - EXPECT_EQ(get_asreserved[101])>( - reinterpret_cast(&last_msg_->reserved[101])), - 193) - << "incorrect value for reserved[101], expected 193, is " - << last_msg_->reserved[101]; - EXPECT_EQ(get_asreserved[102])>( - reinterpret_cast(&last_msg_->reserved[102])), - 0) - << "incorrect value for reserved[102], expected 0, is " - << last_msg_->reserved[102]; - EXPECT_EQ(get_asreserved[103])>( - reinterpret_cast(&last_msg_->reserved[103])), - 24) - << "incorrect value for reserved[103], expected 24, is " - << last_msg_->reserved[103]; - EXPECT_EQ(get_asreserved[104])>( - reinterpret_cast(&last_msg_->reserved[104])), - 121) - << "incorrect value for reserved[104], expected 121, is " - << last_msg_->reserved[104]; - EXPECT_EQ(get_asreserved[105])>( - reinterpret_cast(&last_msg_->reserved[105])), - 85) - << "incorrect value for reserved[105], expected 85, is " - << last_msg_->reserved[105]; - EXPECT_EQ(get_asreserved[106])>( - reinterpret_cast(&last_msg_->reserved[106])), - 55) - << "incorrect value for reserved[106], expected 55, is " - << last_msg_->reserved[106]; - EXPECT_EQ(get_asreserved[107])>( - reinterpret_cast(&last_msg_->reserved[107])), - 214) - << "incorrect value for reserved[107], expected 214, is " - << last_msg_->reserved[107]; - EXPECT_EQ(get_asreserved[108])>( - reinterpret_cast(&last_msg_->reserved[108])), - 198) - << "incorrect value for reserved[108], expected 198, is " - << last_msg_->reserved[108]; - EXPECT_EQ(get_asreserved[109])>( - reinterpret_cast(&last_msg_->reserved[109])), - 75) - << "incorrect value for reserved[109], expected 75, is " - << last_msg_->reserved[109]; - EXPECT_EQ(get_asreserved[110])>( - reinterpret_cast(&last_msg_->reserved[110])), - 234) - << "incorrect value for reserved[110], expected 234, is " - << last_msg_->reserved[110]; - EXPECT_EQ(get_asreserved[111])>( - reinterpret_cast(&last_msg_->reserved[111])), - 179) - << "incorrect value for reserved[111], expected 179, is " - << last_msg_->reserved[111]; - EXPECT_EQ(get_asreserved[112])>( - reinterpret_cast(&last_msg_->reserved[112])), - 214) - << "incorrect value for reserved[112], expected 214, is " - << last_msg_->reserved[112]; - EXPECT_EQ(get_asreserved[113])>( - reinterpret_cast(&last_msg_->reserved[113])), - 85) - << "incorrect value for reserved[113], expected 85, is " - << last_msg_->reserved[113]; - EXPECT_EQ(get_asreserved[114])>( - reinterpret_cast(&last_msg_->reserved[114])), - 94) - << "incorrect value for reserved[114], expected 94, is " - << last_msg_->reserved[114]; - EXPECT_EQ(get_asreserved[115])>( - reinterpret_cast(&last_msg_->reserved[115])), - 115) - << "incorrect value for reserved[115], expected 115, is " - << last_msg_->reserved[115]; - EXPECT_EQ(get_asreserved[116])>( - reinterpret_cast(&last_msg_->reserved[116])), - 21) - << "incorrect value for reserved[116], expected 21, is " - << last_msg_->reserved[116]; - EXPECT_EQ(get_asreserved[117])>( - reinterpret_cast(&last_msg_->reserved[117])), - 73) - << "incorrect value for reserved[117], expected 73, is " - << last_msg_->reserved[117]; - EXPECT_EQ(get_asreserved[118])>( - reinterpret_cast(&last_msg_->reserved[118])), - 121) - << "incorrect value for reserved[118], expected 121, is " - << last_msg_->reserved[118]; - EXPECT_EQ(get_asreserved[119])>( - reinterpret_cast(&last_msg_->reserved[119])), - 75) - << "incorrect value for reserved[119], expected 75, is " - << last_msg_->reserved[119]; - EXPECT_EQ(get_asreserved[120])>( - reinterpret_cast(&last_msg_->reserved[120])), - 46) - << "incorrect value for reserved[120], expected 46, is " - << last_msg_->reserved[120]; - EXPECT_EQ(get_asreserved[121])>( - reinterpret_cast(&last_msg_->reserved[121])), - 158) - << "incorrect value for reserved[121], expected 158, is " - << last_msg_->reserved[121]; - EXPECT_EQ(get_asreserved[122])>( - reinterpret_cast(&last_msg_->reserved[122])), - 63) - << "incorrect value for reserved[122], expected 63, is " - << last_msg_->reserved[122]; - EXPECT_EQ(get_asreserved[123])>( - reinterpret_cast(&last_msg_->reserved[123])), - 100) - << "incorrect value for reserved[123], expected 100, is " - << last_msg_->reserved[123]; - EXPECT_EQ(get_asreserved[124])>( - reinterpret_cast(&last_msg_->reserved[124])), - 122) - << "incorrect value for reserved[124], expected 122, is " - << last_msg_->reserved[124]; - EXPECT_EQ(get_asreserved[125])>( - reinterpret_cast(&last_msg_->reserved[125])), - 213) - << "incorrect value for reserved[125], expected 213, is " - << last_msg_->reserved[125]; - EXPECT_EQ(get_asreserved[126])>( - reinterpret_cast(&last_msg_->reserved[126])), - 20) - << "incorrect value for reserved[126], expected 20, is " - << last_msg_->reserved[126]; - EXPECT_EQ(get_asreserved[127])>( - reinterpret_cast(&last_msg_->reserved[127])), - 85) - << "incorrect value for reserved[127], expected 85, is " - << last_msg_->reserved[127]; - EXPECT_EQ(get_asreserved[128])>( - reinterpret_cast(&last_msg_->reserved[128])), - 212) - << "incorrect value for reserved[128], expected 212, is " - << last_msg_->reserved[128]; - EXPECT_EQ(get_asreserved[129])>( - reinterpret_cast(&last_msg_->reserved[129])), - 131) - << "incorrect value for reserved[129], expected 131, is " - << last_msg_->reserved[129]; - EXPECT_EQ(get_asreserved[130])>( - reinterpret_cast(&last_msg_->reserved[130])), - 50) - << "incorrect value for reserved[130], expected 50, is " - << last_msg_->reserved[130]; - EXPECT_EQ(get_asreserved[131])>( - reinterpret_cast(&last_msg_->reserved[131])), - 224) - << "incorrect value for reserved[131], expected 224, is " - << last_msg_->reserved[131]; - EXPECT_EQ(get_asreserved[132])>( - reinterpret_cast(&last_msg_->reserved[132])), - 218) - << "incorrect value for reserved[132], expected 218, is " - << last_msg_->reserved[132]; - EXPECT_EQ(get_asreserved[133])>( - reinterpret_cast(&last_msg_->reserved[133])), - 215) - << "incorrect value for reserved[133], expected 215, is " - << last_msg_->reserved[133]; - EXPECT_EQ(get_asreserved[134])>( - reinterpret_cast(&last_msg_->reserved[134])), - 215) - << "incorrect value for reserved[134], expected 215, is " - << last_msg_->reserved[134]; - EXPECT_EQ(get_asreserved[135])>( - reinterpret_cast(&last_msg_->reserved[135])), - 149) - << "incorrect value for reserved[135], expected 149, is " - << last_msg_->reserved[135]; - EXPECT_EQ(get_asreserved[136])>( - reinterpret_cast(&last_msg_->reserved[136])), - 2) - << "incorrect value for reserved[136], expected 2, is " - << last_msg_->reserved[136]; - EXPECT_EQ(get_asreserved[137])>( - reinterpret_cast(&last_msg_->reserved[137])), - 19) - << "incorrect value for reserved[137], expected 19, is " - << last_msg_->reserved[137]; - EXPECT_EQ(get_asreserved[138])>( - reinterpret_cast(&last_msg_->reserved[138])), - 129) - << "incorrect value for reserved[138], expected 129, is " - << last_msg_->reserved[138]; - EXPECT_EQ(get_asreserved[139])>( - reinterpret_cast(&last_msg_->reserved[139])), - 39) - << "incorrect value for reserved[139], expected 39, is " - << last_msg_->reserved[139]; - EXPECT_EQ(get_asreserved[140])>( - reinterpret_cast(&last_msg_->reserved[140])), - 164) - << "incorrect value for reserved[140], expected 164, is " - << last_msg_->reserved[140]; - EXPECT_EQ(get_asreserved[141])>( - reinterpret_cast(&last_msg_->reserved[141])), - 5) - << "incorrect value for reserved[141], expected 5, is " - << last_msg_->reserved[141]; - EXPECT_EQ(get_asreserved[142])>( - reinterpret_cast(&last_msg_->reserved[142])), - 175) - << "incorrect value for reserved[142], expected 175, is " - << last_msg_->reserved[142]; - EXPECT_EQ(get_asreserved[143])>( - reinterpret_cast(&last_msg_->reserved[143])), - 6) - << "incorrect value for reserved[143], expected 6, is " - << last_msg_->reserved[143]; - EXPECT_EQ(get_asreserved[144])>( - reinterpret_cast(&last_msg_->reserved[144])), - 62) - << "incorrect value for reserved[144], expected 62, is " - << last_msg_->reserved[144]; - EXPECT_EQ(get_asreserved[145])>( - reinterpret_cast(&last_msg_->reserved[145])), - 51) - << "incorrect value for reserved[145], expected 51, is " - << last_msg_->reserved[145]; - EXPECT_EQ(get_asreserved[146])>( - reinterpret_cast(&last_msg_->reserved[146])), - 78) - << "incorrect value for reserved[146], expected 78, is " - << last_msg_->reserved[146]; - EXPECT_EQ(get_asreserved[147])>( - reinterpret_cast(&last_msg_->reserved[147])), - 66) - << "incorrect value for reserved[147], expected 66, is " - << last_msg_->reserved[147]; - EXPECT_EQ(get_asreserved[148])>( - reinterpret_cast(&last_msg_->reserved[148])), - 248) - << "incorrect value for reserved[148], expected 248, is " - << last_msg_->reserved[148]; - EXPECT_EQ(get_asreserved[149])>( - reinterpret_cast(&last_msg_->reserved[149])), - 116) - << "incorrect value for reserved[149], expected 116, is " - << last_msg_->reserved[149]; - EXPECT_EQ(get_asreserved[150])>( - reinterpret_cast(&last_msg_->reserved[150])), - 88) - << "incorrect value for reserved[150], expected 88, is " - << last_msg_->reserved[150]; - EXPECT_EQ(get_asreserved[151])>( - reinterpret_cast(&last_msg_->reserved[151])), - 90) - << "incorrect value for reserved[151], expected 90, is " - << last_msg_->reserved[151]; - EXPECT_EQ(get_asreserved[152])>( - reinterpret_cast(&last_msg_->reserved[152])), - 128) - << "incorrect value for reserved[152], expected 128, is " - << last_msg_->reserved[152]; - EXPECT_EQ(get_asreserved[153])>( - reinterpret_cast(&last_msg_->reserved[153])), - 226) - << "incorrect value for reserved[153], expected 226, is " - << last_msg_->reserved[153]; - EXPECT_EQ(get_asreserved[154])>( - reinterpret_cast(&last_msg_->reserved[154])), - 177) - << "incorrect value for reserved[154], expected 177, is " - << last_msg_->reserved[154]; - EXPECT_EQ(get_asreserved[155])>( - reinterpret_cast(&last_msg_->reserved[155])), - 0) - << "incorrect value for reserved[155], expected 0, is " - << last_msg_->reserved[155]; - EXPECT_EQ(get_asreserved[156])>( - reinterpret_cast(&last_msg_->reserved[156])), - 47) - << "incorrect value for reserved[156], expected 47, is " - << last_msg_->reserved[156]; - EXPECT_EQ(get_asreserved[157])>( - reinterpret_cast(&last_msg_->reserved[157])), - 140) - << "incorrect value for reserved[157], expected 140, is " - << last_msg_->reserved[157]; - EXPECT_EQ(get_asreserved[158])>( - reinterpret_cast(&last_msg_->reserved[158])), - 33) - << "incorrect value for reserved[158], expected 33, is " - << last_msg_->reserved[158]; - EXPECT_EQ(get_asreserved[159])>( - reinterpret_cast(&last_msg_->reserved[159])), - 126) - << "incorrect value for reserved[159], expected 126, is " - << last_msg_->reserved[159]; - EXPECT_EQ(get_asreserved[160])>( - reinterpret_cast(&last_msg_->reserved[160])), - 221) - << "incorrect value for reserved[160], expected 221, is " - << last_msg_->reserved[160]; - EXPECT_EQ(get_asreserved[161])>( - reinterpret_cast(&last_msg_->reserved[161])), - 110) - << "incorrect value for reserved[161], expected 110, is " - << last_msg_->reserved[161]; - EXPECT_EQ(get_asreserved[162])>( - reinterpret_cast(&last_msg_->reserved[162])), - 144) - << "incorrect value for reserved[162], expected 144, is " - << last_msg_->reserved[162]; - EXPECT_EQ(get_asreserved[163])>( - reinterpret_cast(&last_msg_->reserved[163])), - 97) - << "incorrect value for reserved[163], expected 97, is " - << last_msg_->reserved[163]; - EXPECT_EQ(get_asreserved[164])>( - reinterpret_cast(&last_msg_->reserved[164])), - 74) - << "incorrect value for reserved[164], expected 74, is " - << last_msg_->reserved[164]; - EXPECT_EQ(get_asreserved[165])>( - reinterpret_cast(&last_msg_->reserved[165])), - 250) - << "incorrect value for reserved[165], expected 250, is " - << last_msg_->reserved[165]; - EXPECT_EQ(get_asreserved[166])>( - reinterpret_cast(&last_msg_->reserved[166])), - 181) - << "incorrect value for reserved[166], expected 181, is " - << last_msg_->reserved[166]; - EXPECT_EQ(get_asreserved[167])>( - reinterpret_cast(&last_msg_->reserved[167])), - 199) - << "incorrect value for reserved[167], expected 199, is " - << last_msg_->reserved[167]; - EXPECT_EQ(get_asreserved[168])>( - reinterpret_cast(&last_msg_->reserved[168])), - 27) - << "incorrect value for reserved[168], expected 27, is " - << last_msg_->reserved[168]; - EXPECT_EQ(get_asreserved[169])>( - reinterpret_cast(&last_msg_->reserved[169])), - 176) - << "incorrect value for reserved[169], expected 176, is " - << last_msg_->reserved[169]; - EXPECT_EQ(get_asreserved[170])>( - reinterpret_cast(&last_msg_->reserved[170])), - 65) - << "incorrect value for reserved[170], expected 65, is " - << last_msg_->reserved[170]; - EXPECT_EQ(get_asreserved[171])>( - reinterpret_cast(&last_msg_->reserved[171])), - 185) - << "incorrect value for reserved[171], expected 185, is " - << last_msg_->reserved[171]; - EXPECT_EQ(get_asreserved[172])>( - reinterpret_cast(&last_msg_->reserved[172])), - 110) - << "incorrect value for reserved[172], expected 110, is " - << last_msg_->reserved[172]; - EXPECT_EQ(get_asreserved[173])>( - reinterpret_cast(&last_msg_->reserved[173])), - 92) - << "incorrect value for reserved[173], expected 92, is " - << last_msg_->reserved[173]; - EXPECT_EQ(get_asreserved[174])>( - reinterpret_cast(&last_msg_->reserved[174])), - 34) - << "incorrect value for reserved[174], expected 34, is " - << last_msg_->reserved[174]; - EXPECT_EQ(get_asreserved[175])>( - reinterpret_cast(&last_msg_->reserved[175])), - 44) - << "incorrect value for reserved[175], expected 44, is " - << last_msg_->reserved[175]; - EXPECT_EQ(get_asreserved[176])>( - reinterpret_cast(&last_msg_->reserved[176])), - 131) - << "incorrect value for reserved[176], expected 131, is " - << last_msg_->reserved[176]; - EXPECT_EQ(get_asreserved[177])>( - reinterpret_cast(&last_msg_->reserved[177])), - 96) - << "incorrect value for reserved[177], expected 96, is " - << last_msg_->reserved[177]; - EXPECT_EQ(get_asreserved[178])>( - reinterpret_cast(&last_msg_->reserved[178])), - 178) - << "incorrect value for reserved[178], expected 178, is " - << last_msg_->reserved[178]; - EXPECT_EQ(get_asreserved[179])>( - reinterpret_cast(&last_msg_->reserved[179])), - 40) - << "incorrect value for reserved[179], expected 40, is " - << last_msg_->reserved[179]; - EXPECT_EQ(get_asreserved[180])>( - reinterpret_cast(&last_msg_->reserved[180])), - 176) - << "incorrect value for reserved[180], expected 176, is " - << last_msg_->reserved[180]; - EXPECT_EQ(get_asreserved[181])>( - reinterpret_cast(&last_msg_->reserved[181])), - 4) - << "incorrect value for reserved[181], expected 4, is " - << last_msg_->reserved[181]; - EXPECT_EQ(get_asreserved[182])>( - reinterpret_cast(&last_msg_->reserved[182])), - 90) - << "incorrect value for reserved[182], expected 90, is " - << last_msg_->reserved[182]; - EXPECT_EQ(get_asreserved[183])>( - reinterpret_cast(&last_msg_->reserved[183])), - 36) - << "incorrect value for reserved[183], expected 36, is " - << last_msg_->reserved[183]; - EXPECT_EQ(get_asreserved[184])>( - reinterpret_cast(&last_msg_->reserved[184])), - 7) - << "incorrect value for reserved[184], expected 7, is " - << last_msg_->reserved[184]; - EXPECT_EQ(get_asreserved[185])>( - reinterpret_cast(&last_msg_->reserved[185])), - 180) - << "incorrect value for reserved[185], expected 180, is " - << last_msg_->reserved[185]; - EXPECT_EQ(get_asreserved[186])>( - reinterpret_cast(&last_msg_->reserved[186])), - 244) - << "incorrect value for reserved[186], expected 244, is " - << last_msg_->reserved[186]; - EXPECT_EQ(get_asreserved[187])>( - reinterpret_cast(&last_msg_->reserved[187])), - 244) - << "incorrect value for reserved[187], expected 244, is " - << last_msg_->reserved[187]; - EXPECT_EQ(get_asreserved[188])>( - reinterpret_cast(&last_msg_->reserved[188])), - 23) - << "incorrect value for reserved[188], expected 23, is " - << last_msg_->reserved[188]; - EXPECT_EQ(get_asreserved[189])>( - reinterpret_cast(&last_msg_->reserved[189])), - 108) - << "incorrect value for reserved[189], expected 108, is " - << last_msg_->reserved[189]; - EXPECT_EQ(get_asreserved[190])>( - reinterpret_cast(&last_msg_->reserved[190])), - 171) - << "incorrect value for reserved[190], expected 171, is " - << last_msg_->reserved[190]; - EXPECT_EQ(get_asreserved[191])>( - reinterpret_cast(&last_msg_->reserved[191])), - 204) - << "incorrect value for reserved[191], expected 204, is " - << last_msg_->reserved[191]; - EXPECT_EQ(get_asreserved[192])>( - reinterpret_cast(&last_msg_->reserved[192])), - 196) - << "incorrect value for reserved[192], expected 196, is " - << last_msg_->reserved[192]; - EXPECT_EQ(get_asreserved[193])>( - reinterpret_cast(&last_msg_->reserved[193])), - 61) - << "incorrect value for reserved[193], expected 61, is " - << last_msg_->reserved[193]; - EXPECT_EQ(get_asreserved[194])>( - reinterpret_cast(&last_msg_->reserved[194])), - 51) - << "incorrect value for reserved[194], expected 51, is " - << last_msg_->reserved[194]; - EXPECT_EQ(get_asreserved[195])>( - reinterpret_cast(&last_msg_->reserved[195])), - 179) - << "incorrect value for reserved[195], expected 179, is " - << last_msg_->reserved[195]; - EXPECT_EQ(get_asreserved[196])>( - reinterpret_cast(&last_msg_->reserved[196])), - 242) - << "incorrect value for reserved[196], expected 242, is " - << last_msg_->reserved[196]; - EXPECT_EQ(get_asreserved[197])>( - reinterpret_cast(&last_msg_->reserved[197])), - 156) - << "incorrect value for reserved[197], expected 156, is " - << last_msg_->reserved[197]; - EXPECT_EQ(get_asreserved[198])>( - reinterpret_cast(&last_msg_->reserved[198])), - 81) - << "incorrect value for reserved[198], expected 81, is " - << last_msg_->reserved[198]; - EXPECT_EQ(get_asreserved[199])>( - reinterpret_cast(&last_msg_->reserved[199])), - 83) - << "incorrect value for reserved[199], expected 83, is " - << last_msg_->reserved[199]; - EXPECT_EQ(get_asreserved[200])>( - reinterpret_cast(&last_msg_->reserved[200])), - 16) - << "incorrect value for reserved[200], expected 16, is " - << last_msg_->reserved[200]; - EXPECT_EQ(get_asreserved[201])>( - reinterpret_cast(&last_msg_->reserved[201])), - 15) - << "incorrect value for reserved[201], expected 15, is " - << last_msg_->reserved[201]; - EXPECT_EQ(get_asreserved[202])>( - reinterpret_cast(&last_msg_->reserved[202])), - 134) - << "incorrect value for reserved[202], expected 134, is " - << last_msg_->reserved[202]; - EXPECT_EQ(get_asreserved[203])>( - reinterpret_cast(&last_msg_->reserved[203])), - 40) - << "incorrect value for reserved[203], expected 40, is " - << last_msg_->reserved[203]; - EXPECT_EQ(get_asreserved[204])>( - reinterpret_cast(&last_msg_->reserved[204])), - 245) - << "incorrect value for reserved[204], expected 245, is " - << last_msg_->reserved[204]; - EXPECT_EQ(get_asreserved[205])>( - reinterpret_cast(&last_msg_->reserved[205])), - 253) - << "incorrect value for reserved[205], expected 253, is " - << last_msg_->reserved[205]; - EXPECT_EQ(get_asreserved[206])>( - reinterpret_cast(&last_msg_->reserved[206])), - 150) - << "incorrect value for reserved[206], expected 150, is " - << last_msg_->reserved[206]; - EXPECT_EQ(get_asreserved[207])>( - reinterpret_cast(&last_msg_->reserved[207])), - 94) - << "incorrect value for reserved[207], expected 94, is " - << last_msg_->reserved[207]; - EXPECT_EQ(get_asreserved[208])>( - reinterpret_cast(&last_msg_->reserved[208])), - 150) - << "incorrect value for reserved[208], expected 150, is " - << last_msg_->reserved[208]; - EXPECT_EQ(get_asreserved[209])>( - reinterpret_cast(&last_msg_->reserved[209])), - 144) - << "incorrect value for reserved[209], expected 144, is " - << last_msg_->reserved[209]; - EXPECT_EQ(get_asreserved[210])>( - reinterpret_cast(&last_msg_->reserved[210])), - 197) - << "incorrect value for reserved[210], expected 197, is " - << last_msg_->reserved[210]; - EXPECT_EQ(get_asreserved[211])>( - reinterpret_cast(&last_msg_->reserved[211])), - 113) - << "incorrect value for reserved[211], expected 113, is " - << last_msg_->reserved[211]; - EXPECT_EQ(get_asreserved[212])>( - reinterpret_cast(&last_msg_->reserved[212])), - 5) - << "incorrect value for reserved[212], expected 5, is " - << last_msg_->reserved[212]; - EXPECT_EQ(get_asreserved[213])>( - reinterpret_cast(&last_msg_->reserved[213])), - 141) - << "incorrect value for reserved[213], expected 141, is " - << last_msg_->reserved[213]; - EXPECT_EQ(get_asreserved[214])>( - reinterpret_cast(&last_msg_->reserved[214])), - 232) - << "incorrect value for reserved[214], expected 232, is " - << last_msg_->reserved[214]; - EXPECT_EQ(get_asreserved[215])>( - reinterpret_cast(&last_msg_->reserved[215])), - 33) - << "incorrect value for reserved[215], expected 33, is " - << last_msg_->reserved[215]; - EXPECT_EQ(get_asreserved[216])>( - reinterpret_cast(&last_msg_->reserved[216])), - 101) - << "incorrect value for reserved[216], expected 101, is " - << last_msg_->reserved[216]; - EXPECT_EQ(get_asreserved[217])>( - reinterpret_cast(&last_msg_->reserved[217])), - 231) - << "incorrect value for reserved[217], expected 231, is " - << last_msg_->reserved[217]; - EXPECT_EQ(get_asreserved[218])>( - reinterpret_cast(&last_msg_->reserved[218])), - 38) - << "incorrect value for reserved[218], expected 38, is " - << last_msg_->reserved[218]; - EXPECT_EQ(get_asreserved[219])>( - reinterpret_cast(&last_msg_->reserved[219])), - 75) - << "incorrect value for reserved[219], expected 75, is " - << last_msg_->reserved[219]; - EXPECT_EQ(get_asreserved[220])>( - reinterpret_cast(&last_msg_->reserved[220])), - 178) - << "incorrect value for reserved[220], expected 178, is " - << last_msg_->reserved[220]; - EXPECT_EQ(get_asreserved[221])>( - reinterpret_cast(&last_msg_->reserved[221])), - 243) - << "incorrect value for reserved[221], expected 243, is " - << last_msg_->reserved[221]; - EXPECT_EQ(get_asreserved[222])>( - reinterpret_cast(&last_msg_->reserved[222])), - 119) - << "incorrect value for reserved[222], expected 119, is " - << last_msg_->reserved[222]; - EXPECT_EQ(get_asreserved[223])>( - reinterpret_cast(&last_msg_->reserved[223])), - 1) - << "incorrect value for reserved[223], expected 1, is " - << last_msg_->reserved[223]; - EXPECT_EQ(get_asreserved[224])>( - reinterpret_cast(&last_msg_->reserved[224])), - 248) - << "incorrect value for reserved[224], expected 248, is " - << last_msg_->reserved[224]; - EXPECT_EQ(get_asreserved[225])>( - reinterpret_cast(&last_msg_->reserved[225])), - 218) - << "incorrect value for reserved[225], expected 218, is " - << last_msg_->reserved[225]; - EXPECT_EQ(get_asreserved[226])>( - reinterpret_cast(&last_msg_->reserved[226])), - 86) - << "incorrect value for reserved[226], expected 86, is " - << last_msg_->reserved[226]; - EXPECT_EQ(get_asreserved[227])>( - reinterpret_cast(&last_msg_->reserved[227])), - 7) - << "incorrect value for reserved[227], expected 7, is " - << last_msg_->reserved[227]; - EXPECT_EQ(get_asreserved[228])>( - reinterpret_cast(&last_msg_->reserved[228])), - 88) - << "incorrect value for reserved[228], expected 88, is " - << last_msg_->reserved[228]; - EXPECT_EQ(get_asreserved[229])>( - reinterpret_cast(&last_msg_->reserved[229])), - 197) - << "incorrect value for reserved[229], expected 197, is " - << last_msg_->reserved[229]; - EXPECT_EQ(get_asreserved[230])>( - reinterpret_cast(&last_msg_->reserved[230])), - 148) - << "incorrect value for reserved[230], expected 148, is " - << last_msg_->reserved[230]; - EXPECT_EQ(get_asreserved[231])>( - reinterpret_cast(&last_msg_->reserved[231])), - 240) - << "incorrect value for reserved[231], expected 240, is " - << last_msg_->reserved[231]; - EXPECT_EQ(get_asreserved[232])>( - reinterpret_cast(&last_msg_->reserved[232])), - 227) - << "incorrect value for reserved[232], expected 227, is " - << last_msg_->reserved[232]; - EXPECT_EQ(get_asreserved[233])>( - reinterpret_cast(&last_msg_->reserved[233])), - 2) - << "incorrect value for reserved[233], expected 2, is " - << last_msg_->reserved[233]; - EXPECT_EQ(get_asreserved[234])>( - reinterpret_cast(&last_msg_->reserved[234])), - 65) - << "incorrect value for reserved[234], expected 65, is " - << last_msg_->reserved[234]; - EXPECT_EQ(get_asreserved[235])>( - reinterpret_cast(&last_msg_->reserved[235])), - 173) - << "incorrect value for reserved[235], expected 173, is " - << last_msg_->reserved[235]; - EXPECT_EQ(get_asreserved[236])>( - reinterpret_cast(&last_msg_->reserved[236])), - 122) - << "incorrect value for reserved[236], expected 122, is " - << last_msg_->reserved[236]; - EXPECT_EQ(get_asreserved[237])>( - reinterpret_cast(&last_msg_->reserved[237])), - 143) - << "incorrect value for reserved[237], expected 143, is " - << last_msg_->reserved[237]; - EXPECT_EQ(get_asreserved[238])>( - reinterpret_cast(&last_msg_->reserved[238])), - 251) - << "incorrect value for reserved[238], expected 251, is " - << last_msg_->reserved[238]; - EXPECT_EQ(get_asreserved[239])>( - reinterpret_cast(&last_msg_->reserved[239])), - 156) - << "incorrect value for reserved[239], expected 156, is " - << last_msg_->reserved[239]; - EXPECT_EQ(get_asreserved[240])>( - reinterpret_cast(&last_msg_->reserved[240])), - 217) - << "incorrect value for reserved[240], expected 217, is " - << last_msg_->reserved[240]; - EXPECT_EQ(get_asreserved[241])>( - reinterpret_cast(&last_msg_->reserved[241])), - 67) - << "incorrect value for reserved[241], expected 67, is " - << last_msg_->reserved[241]; - EXPECT_EQ(get_asreserved[242])>( - reinterpret_cast(&last_msg_->reserved[242])), - 239) - << "incorrect value for reserved[242], expected 239, is " - << last_msg_->reserved[242]; - EXPECT_EQ(get_asreserved[243])>( - reinterpret_cast(&last_msg_->reserved[243])), - 219) - << "incorrect value for reserved[243], expected 219, is " - << last_msg_->reserved[243]; - EXPECT_EQ(get_asreserved[244])>( - reinterpret_cast(&last_msg_->reserved[244])), - 31) - << "incorrect value for reserved[244], expected 31, is " - << last_msg_->reserved[244]; - EXPECT_EQ(get_asreserved[245])>( - reinterpret_cast(&last_msg_->reserved[245])), - 224) - << "incorrect value for reserved[245], expected 224, is " - << last_msg_->reserved[245]; - EXPECT_EQ(get_asreserved[246])>( - reinterpret_cast(&last_msg_->reserved[246])), - 176) - << "incorrect value for reserved[246], expected 176, is " - << last_msg_->reserved[246]; - EXPECT_EQ(get_asreserved[247])>( - reinterpret_cast(&last_msg_->reserved[247])), - 129) - << "incorrect value for reserved[247], expected 129, is " - << last_msg_->reserved[247]; - EXPECT_EQ(get_asreserved[248])>( - reinterpret_cast(&last_msg_->reserved[248])), - 81) - << "incorrect value for reserved[248], expected 81, is " - << last_msg_->reserved[248]; - EXPECT_EQ(get_asreserved[249])>( - reinterpret_cast(&last_msg_->reserved[249])), - 80) - << "incorrect value for reserved[249], expected 80, is " - << last_msg_->reserved[249]; - EXPECT_LT((last_msg_->signal_error_rate * 100 - 8588.20019531 * 100), 0.05) - << "incorrect value for signal_error_rate, expected 8588.20019531, is " - << last_msg_->signal_error_rate; - EXPECT_EQ(get_assignal_strength)>( - reinterpret_cast(&last_msg_->signal_strength)), - 103) - << "incorrect value for signal_strength, expected 103, is " - << last_msg_->signal_strength; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCommandOutput.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCommandOutput.cc deleted file mode 100644 index 9e8476987e..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCommandOutput.cc +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgCommandOutput.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgCommandOutput0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgCommandOutput0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_command_output_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_command_output_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgCommandOutput0, Test) { - uint8_t encoded_frame[] = { - 85, 188, 0, 50, 84, 20, 126, 164, 116, 149, 83, 111, 109, 101, - 32, 111, 117, 116, 112, 117, 116, 32, 116, 101, 120, 116, 11, 109, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_command_output_t *test_msg = (msg_command_output_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = {(char)83, (char)111, (char)109, (char)101, - (char)32, (char)111, (char)117, (char)116, - (char)112, (char)117, (char)116, (char)32, - (char)116, (char)101, (char)120, (char)116}; - memcpy(test_msg->line, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->line) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->sequence = 2507449470; - - EXPECT_EQ(send_message(0xbc, 21554, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 21554); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = {(char)83, (char)111, (char)109, (char)101, - (char)32, (char)111, (char)117, (char)116, - (char)112, (char)117, (char)116, (char)32, - (char)116, (char)101, (char)120, (char)116}; - EXPECT_EQ(memcmp(last_msg_->line, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->line, expected string '" - << check_string << "', is '" << last_msg_->line << "'"; - } - EXPECT_EQ(get_assequence)>( - reinterpret_cast(&last_msg_->sequence)), - 2507449470) - << "incorrect value for sequence, expected 2507449470, is " - << last_msg_->sequence; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCommandReq.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCommandReq.cc deleted file mode 100644 index 4acd93461d..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCommandReq.cc +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgCommandReq.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgCommandReq0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgCommandReq0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_command_req_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_command_req_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgCommandReq0, Test) { - uint8_t encoded_frame[] = { - 85, 184, 0, 170, 184, 31, 51, 77, 163, 104, 47, 112, 97, - 116, 104, 47, 116, 111, 47, 99, 111, 109, 109, 97, 110, 100, - 32, 119, 105, 116, 104, 32, 97, 114, 103, 115, 0, 38, 24, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_command_req_t *test_msg = (msg_command_req_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)99, (char)111, (char)109, - (char)109, (char)97, (char)110, (char)100, (char)32, (char)119, - (char)105, (char)116, (char)104, (char)32, (char)97, (char)114, - (char)103, (char)115, (char)0}; - memcpy(test_msg->command, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->command) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->sequence = 1755532595; - - EXPECT_EQ(send_message(0xb8, 47274, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 47274); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)47, (char)112, (char)97, (char)116, (char)104, (char)47, - (char)116, (char)111, (char)47, (char)99, (char)111, (char)109, - (char)109, (char)97, (char)110, (char)100, (char)32, (char)119, - (char)105, (char)116, (char)104, (char)32, (char)97, (char)114, - (char)103, (char)115, (char)0}; - EXPECT_EQ(memcmp(last_msg_->command, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->command, expected string '" - << check_string << "', is '" << last_msg_->command << "'"; - } - EXPECT_EQ(get_assequence)>( - reinterpret_cast(&last_msg_->sequence)), - 1755532595) - << "incorrect value for sequence, expected 1755532595, is " - << last_msg_->sequence; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCommandResp.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCommandResp.cc deleted file mode 100644 index 00180c0c2c..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCommandResp.cc +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgCommandResp.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgCommandResp0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgCommandResp0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_command_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_command_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgCommandResp0, Test) { - uint8_t encoded_frame[] = { - 85, 185, 0, 57, 206, 8, 118, 215, 131, 160, 210, 110, 150, 103, 164, 240, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_command_resp_t *test_msg = (msg_command_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->code = 1737912018; - test_msg->sequence = 2692994934; - - EXPECT_EQ(send_message(0xb9, 52793, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 52793); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascode)>( - reinterpret_cast(&last_msg_->code)), - 1737912018) - << "incorrect value for code, expected 1737912018, is " - << last_msg_->code; - EXPECT_EQ(get_assequence)>( - reinterpret_cast(&last_msg_->sequence)), - 2692994934) - << "incorrect value for sequence, expected 2692994934, is " - << last_msg_->sequence; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCwResults.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCwResults.cc deleted file mode 100644 index 6425701ca6..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCwResults.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgCwResults.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCwStart.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCwStart.cc deleted file mode 100644 index 8b3e05c647..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgCwStart.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgCwStart.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgDeviceMonitor.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgDeviceMonitor.cc deleted file mode 100644 index b3e793dfbf..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgDeviceMonitor.cc +++ /dev/null @@ -1,598 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgDeviceMonitor.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgDeviceMonitor0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgDeviceMonitor0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_device_monitor_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_device_monitor_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgDeviceMonitor0, Test) { - uint8_t encoded_frame[] = { - 85, 181, 0, 95, 66, 10, 241, 216, 219, - 3, 253, 6, 21, 24, 168, 18, 207, 233, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_device_monitor_t *test_msg = (msg_device_monitor_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cpu_temperature = 6165; - test_msg->cpu_vaux = 1789; - test_msg->cpu_vint = 987; - test_msg->dev_vin = -9999; - test_msg->fe_temperature = 4776; - - EXPECT_EQ(send_message(0xb5, 16991, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 16991); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascpu_temperature)>( - reinterpret_cast(&last_msg_->cpu_temperature)), - 6165) - << "incorrect value for cpu_temperature, expected 6165, is " - << last_msg_->cpu_temperature; - EXPECT_EQ(get_ascpu_vaux)>( - reinterpret_cast(&last_msg_->cpu_vaux)), - 1789) - << "incorrect value for cpu_vaux, expected 1789, is " - << last_msg_->cpu_vaux; - EXPECT_EQ(get_ascpu_vint)>( - reinterpret_cast(&last_msg_->cpu_vint)), - 987) - << "incorrect value for cpu_vint, expected 987, is " - << last_msg_->cpu_vint; - EXPECT_EQ(get_asdev_vin)>( - reinterpret_cast(&last_msg_->dev_vin)), - -9999) - << "incorrect value for dev_vin, expected -9999, is " - << last_msg_->dev_vin; - EXPECT_EQ(get_asfe_temperature)>( - reinterpret_cast(&last_msg_->fe_temperature)), - 4776) - << "incorrect value for fe_temperature, expected 4776, is " - << last_msg_->fe_temperature; -} -class Test_legacy_auto_check_sbp_piksi_MsgDeviceMonitor1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgDeviceMonitor1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_device_monitor_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_device_monitor_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgDeviceMonitor1, Test) { - uint8_t encoded_frame[] = { - 85, 181, 0, 95, 66, 10, 241, 216, 219, - 3, 254, 6, 24, 24, 168, 18, 169, 30, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_device_monitor_t *test_msg = (msg_device_monitor_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cpu_temperature = 6168; - test_msg->cpu_vaux = 1790; - test_msg->cpu_vint = 987; - test_msg->dev_vin = -9999; - test_msg->fe_temperature = 4776; - - EXPECT_EQ(send_message(0xb5, 16991, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 16991); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascpu_temperature)>( - reinterpret_cast(&last_msg_->cpu_temperature)), - 6168) - << "incorrect value for cpu_temperature, expected 6168, is " - << last_msg_->cpu_temperature; - EXPECT_EQ(get_ascpu_vaux)>( - reinterpret_cast(&last_msg_->cpu_vaux)), - 1790) - << "incorrect value for cpu_vaux, expected 1790, is " - << last_msg_->cpu_vaux; - EXPECT_EQ(get_ascpu_vint)>( - reinterpret_cast(&last_msg_->cpu_vint)), - 987) - << "incorrect value for cpu_vint, expected 987, is " - << last_msg_->cpu_vint; - EXPECT_EQ(get_asdev_vin)>( - reinterpret_cast(&last_msg_->dev_vin)), - -9999) - << "incorrect value for dev_vin, expected -9999, is " - << last_msg_->dev_vin; - EXPECT_EQ(get_asfe_temperature)>( - reinterpret_cast(&last_msg_->fe_temperature)), - 4776) - << "incorrect value for fe_temperature, expected 4776, is " - << last_msg_->fe_temperature; -} -class Test_legacy_auto_check_sbp_piksi_MsgDeviceMonitor2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgDeviceMonitor2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_device_monitor_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_device_monitor_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgDeviceMonitor2, Test) { - uint8_t encoded_frame[] = { - 85, 181, 0, 95, 66, 10, 241, 216, 219, - 3, 253, 6, 22, 24, 168, 18, 19, 114, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_device_monitor_t *test_msg = (msg_device_monitor_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cpu_temperature = 6166; - test_msg->cpu_vaux = 1789; - test_msg->cpu_vint = 987; - test_msg->dev_vin = -9999; - test_msg->fe_temperature = 4776; - - EXPECT_EQ(send_message(0xb5, 16991, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 16991); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascpu_temperature)>( - reinterpret_cast(&last_msg_->cpu_temperature)), - 6166) - << "incorrect value for cpu_temperature, expected 6166, is " - << last_msg_->cpu_temperature; - EXPECT_EQ(get_ascpu_vaux)>( - reinterpret_cast(&last_msg_->cpu_vaux)), - 1789) - << "incorrect value for cpu_vaux, expected 1789, is " - << last_msg_->cpu_vaux; - EXPECT_EQ(get_ascpu_vint)>( - reinterpret_cast(&last_msg_->cpu_vint)), - 987) - << "incorrect value for cpu_vint, expected 987, is " - << last_msg_->cpu_vint; - EXPECT_EQ(get_asdev_vin)>( - reinterpret_cast(&last_msg_->dev_vin)), - -9999) - << "incorrect value for dev_vin, expected -9999, is " - << last_msg_->dev_vin; - EXPECT_EQ(get_asfe_temperature)>( - reinterpret_cast(&last_msg_->fe_temperature)), - 4776) - << "incorrect value for fe_temperature, expected 4776, is " - << last_msg_->fe_temperature; -} -class Test_legacy_auto_check_sbp_piksi_MsgDeviceMonitor3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgDeviceMonitor3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_device_monitor_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_device_monitor_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgDeviceMonitor3, Test) { - uint8_t encoded_frame[] = { - 85, 181, 0, 95, 66, 10, 241, 216, 218, - 3, 252, 6, 6, 24, 168, 18, 199, 107, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_device_monitor_t *test_msg = (msg_device_monitor_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cpu_temperature = 6150; - test_msg->cpu_vaux = 1788; - test_msg->cpu_vint = 986; - test_msg->dev_vin = -9999; - test_msg->fe_temperature = 4776; - - EXPECT_EQ(send_message(0xb5, 16991, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 16991); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascpu_temperature)>( - reinterpret_cast(&last_msg_->cpu_temperature)), - 6150) - << "incorrect value for cpu_temperature, expected 6150, is " - << last_msg_->cpu_temperature; - EXPECT_EQ(get_ascpu_vaux)>( - reinterpret_cast(&last_msg_->cpu_vaux)), - 1788) - << "incorrect value for cpu_vaux, expected 1788, is " - << last_msg_->cpu_vaux; - EXPECT_EQ(get_ascpu_vint)>( - reinterpret_cast(&last_msg_->cpu_vint)), - 986) - << "incorrect value for cpu_vint, expected 986, is " - << last_msg_->cpu_vint; - EXPECT_EQ(get_asdev_vin)>( - reinterpret_cast(&last_msg_->dev_vin)), - -9999) - << "incorrect value for dev_vin, expected -9999, is " - << last_msg_->dev_vin; - EXPECT_EQ(get_asfe_temperature)>( - reinterpret_cast(&last_msg_->fe_temperature)), - 4776) - << "incorrect value for fe_temperature, expected 4776, is " - << last_msg_->fe_temperature; -} -class Test_legacy_auto_check_sbp_piksi_MsgDeviceMonitor4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgDeviceMonitor4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_device_monitor_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_device_monitor_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgDeviceMonitor4, Test) { - uint8_t encoded_frame[] = { - 85, 181, 0, 95, 66, 10, 241, 216, 220, - 3, 253, 6, 235, 23, 168, 18, 241, 63, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_device_monitor_t *test_msg = (msg_device_monitor_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cpu_temperature = 6123; - test_msg->cpu_vaux = 1789; - test_msg->cpu_vint = 988; - test_msg->dev_vin = -9999; - test_msg->fe_temperature = 4776; - - EXPECT_EQ(send_message(0xb5, 16991, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 16991); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascpu_temperature)>( - reinterpret_cast(&last_msg_->cpu_temperature)), - 6123) - << "incorrect value for cpu_temperature, expected 6123, is " - << last_msg_->cpu_temperature; - EXPECT_EQ(get_ascpu_vaux)>( - reinterpret_cast(&last_msg_->cpu_vaux)), - 1789) - << "incorrect value for cpu_vaux, expected 1789, is " - << last_msg_->cpu_vaux; - EXPECT_EQ(get_ascpu_vint)>( - reinterpret_cast(&last_msg_->cpu_vint)), - 988) - << "incorrect value for cpu_vint, expected 988, is " - << last_msg_->cpu_vint; - EXPECT_EQ(get_asdev_vin)>( - reinterpret_cast(&last_msg_->dev_vin)), - -9999) - << "incorrect value for dev_vin, expected -9999, is " - << last_msg_->dev_vin; - EXPECT_EQ(get_asfe_temperature)>( - reinterpret_cast(&last_msg_->fe_temperature)), - 4776) - << "incorrect value for fe_temperature, expected 4776, is " - << last_msg_->fe_temperature; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgFrontEndGain.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgFrontEndGain.cc deleted file mode 100644 index 8277f4cda8..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgFrontEndGain.cc +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgFrontEndGain.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgFrontEndGain0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgFrontEndGain0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_front_end_gain_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_front_end_gain_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgFrontEndGain0, Test) { - uint8_t encoded_frame[] = { - 85, 191, 0, 175, 245, 16, 41, 133, 134, 10, 105, 20, - 38, 38, 246, 233, 216, 80, 187, 213, 85, 2, 235, 135, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_front_end_gain_t *test_msg = (msg_front_end_gain_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->if_gain) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->if_gain[0])); - } - test_msg->if_gain[0] = -10; - if (sizeof(test_msg->if_gain) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->if_gain[0])); - } - test_msg->if_gain[1] = -23; - if (sizeof(test_msg->if_gain) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->if_gain[0])); - } - test_msg->if_gain[2] = -40; - if (sizeof(test_msg->if_gain) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->if_gain[0])); - } - test_msg->if_gain[3] = 80; - if (sizeof(test_msg->if_gain) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->if_gain[0])); - } - test_msg->if_gain[4] = -69; - if (sizeof(test_msg->if_gain) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->if_gain[0])); - } - test_msg->if_gain[5] = -43; - if (sizeof(test_msg->if_gain) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->if_gain[0])); - } - test_msg->if_gain[6] = 85; - if (sizeof(test_msg->if_gain) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->if_gain[0])); - } - test_msg->if_gain[7] = 2; - if (sizeof(test_msg->rf_gain) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rf_gain[0])); - } - test_msg->rf_gain[0] = 41; - if (sizeof(test_msg->rf_gain) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rf_gain[0])); - } - test_msg->rf_gain[1] = -123; - if (sizeof(test_msg->rf_gain) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rf_gain[0])); - } - test_msg->rf_gain[2] = -122; - if (sizeof(test_msg->rf_gain) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rf_gain[0])); - } - test_msg->rf_gain[3] = 10; - if (sizeof(test_msg->rf_gain) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rf_gain[0])); - } - test_msg->rf_gain[4] = 105; - if (sizeof(test_msg->rf_gain) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rf_gain[0])); - } - test_msg->rf_gain[5] = 20; - if (sizeof(test_msg->rf_gain) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rf_gain[0])); - } - test_msg->rf_gain[6] = 38; - if (sizeof(test_msg->rf_gain) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rf_gain[0])); - } - test_msg->rf_gain[7] = 38; - - EXPECT_EQ(send_message(0xbf, 62895, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 62895); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asif_gain[0])>( - reinterpret_cast(&last_msg_->if_gain[0])), - -10) - << "incorrect value for if_gain[0], expected -10, is " - << last_msg_->if_gain[0]; - EXPECT_EQ(get_asif_gain[1])>( - reinterpret_cast(&last_msg_->if_gain[1])), - -23) - << "incorrect value for if_gain[1], expected -23, is " - << last_msg_->if_gain[1]; - EXPECT_EQ(get_asif_gain[2])>( - reinterpret_cast(&last_msg_->if_gain[2])), - -40) - << "incorrect value for if_gain[2], expected -40, is " - << last_msg_->if_gain[2]; - EXPECT_EQ(get_asif_gain[3])>( - reinterpret_cast(&last_msg_->if_gain[3])), - 80) - << "incorrect value for if_gain[3], expected 80, is " - << last_msg_->if_gain[3]; - EXPECT_EQ(get_asif_gain[4])>( - reinterpret_cast(&last_msg_->if_gain[4])), - -69) - << "incorrect value for if_gain[4], expected -69, is " - << last_msg_->if_gain[4]; - EXPECT_EQ(get_asif_gain[5])>( - reinterpret_cast(&last_msg_->if_gain[5])), - -43) - << "incorrect value for if_gain[5], expected -43, is " - << last_msg_->if_gain[5]; - EXPECT_EQ(get_asif_gain[6])>( - reinterpret_cast(&last_msg_->if_gain[6])), - 85) - << "incorrect value for if_gain[6], expected 85, is " - << last_msg_->if_gain[6]; - EXPECT_EQ(get_asif_gain[7])>( - reinterpret_cast(&last_msg_->if_gain[7])), - 2) - << "incorrect value for if_gain[7], expected 2, is " - << last_msg_->if_gain[7]; - EXPECT_EQ(get_asrf_gain[0])>( - reinterpret_cast(&last_msg_->rf_gain[0])), - 41) - << "incorrect value for rf_gain[0], expected 41, is " - << last_msg_->rf_gain[0]; - EXPECT_EQ(get_asrf_gain[1])>( - reinterpret_cast(&last_msg_->rf_gain[1])), - -123) - << "incorrect value for rf_gain[1], expected -123, is " - << last_msg_->rf_gain[1]; - EXPECT_EQ(get_asrf_gain[2])>( - reinterpret_cast(&last_msg_->rf_gain[2])), - -122) - << "incorrect value for rf_gain[2], expected -122, is " - << last_msg_->rf_gain[2]; - EXPECT_EQ(get_asrf_gain[3])>( - reinterpret_cast(&last_msg_->rf_gain[3])), - 10) - << "incorrect value for rf_gain[3], expected 10, is " - << last_msg_->rf_gain[3]; - EXPECT_EQ(get_asrf_gain[4])>( - reinterpret_cast(&last_msg_->rf_gain[4])), - 105) - << "incorrect value for rf_gain[4], expected 105, is " - << last_msg_->rf_gain[4]; - EXPECT_EQ(get_asrf_gain[5])>( - reinterpret_cast(&last_msg_->rf_gain[5])), - 20) - << "incorrect value for rf_gain[5], expected 20, is " - << last_msg_->rf_gain[5]; - EXPECT_EQ(get_asrf_gain[6])>( - reinterpret_cast(&last_msg_->rf_gain[6])), - 38) - << "incorrect value for rf_gain[6], expected 38, is " - << last_msg_->rf_gain[6]; - EXPECT_EQ(get_asrf_gain[7])>( - reinterpret_cast(&last_msg_->rf_gain[7])), - 38) - << "incorrect value for rf_gain[7], expected 38, is " - << last_msg_->rf_gain[7]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgIarState.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgIarState.cc deleted file mode 100644 index 35c9784d63..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgIarState.cc +++ /dev/null @@ -1,644 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgIarState.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgIarState0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgIarState0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_iar_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_iar_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgIarState0, Test) { - uint8_t encoded_frame[] = { - 85, 25, 0, 246, 215, 4, 1, 0, 0, 0, 216, 140, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_iar_state_t *test_msg = (msg_iar_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->num_hyps = 1; - - EXPECT_EQ(send_message(0x19, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asnum_hyps)>( - reinterpret_cast(&last_msg_->num_hyps)), - 1) - << "incorrect value for num_hyps, expected 1, is " << last_msg_->num_hyps; -} -class Test_legacy_auto_check_sbp_piksi_MsgIarState1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgIarState1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_iar_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_iar_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgIarState1, Test) { - uint8_t encoded_frame[] = { - 85, 25, 0, 195, 4, 4, 0, 0, 0, 0, 18, 176, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_iar_state_t *test_msg = (msg_iar_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->num_hyps = 0; - - EXPECT_EQ(send_message(0x19, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asnum_hyps)>( - reinterpret_cast(&last_msg_->num_hyps)), - 0) - << "incorrect value for num_hyps, expected 0, is " << last_msg_->num_hyps; -} -class Test_legacy_auto_check_sbp_piksi_MsgIarState2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgIarState2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_iar_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_iar_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgIarState2, Test) { - uint8_t encoded_frame[] = { - 85, 25, 0, 195, 4, 4, 1, 0, 0, 0, 166, 198, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_iar_state_t *test_msg = (msg_iar_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->num_hyps = 1; - - EXPECT_EQ(send_message(0x19, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asnum_hyps)>( - reinterpret_cast(&last_msg_->num_hyps)), - 1) - << "incorrect value for num_hyps, expected 1, is " << last_msg_->num_hyps; -} -class Test_legacy_auto_check_sbp_piksi_MsgIarState3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgIarState3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_iar_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_iar_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgIarState3, Test) { - uint8_t encoded_frame[] = { - 85, 25, 0, 195, 4, 4, 217, 2, 0, 0, 6, 133, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_iar_state_t *test_msg = (msg_iar_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->num_hyps = 729; - - EXPECT_EQ(send_message(0x19, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asnum_hyps)>( - reinterpret_cast(&last_msg_->num_hyps)), - 729) - << "incorrect value for num_hyps, expected 729, is " - << last_msg_->num_hyps; -} -class Test_legacy_auto_check_sbp_piksi_MsgIarState4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgIarState4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_iar_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_iar_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgIarState4, Test) { - uint8_t encoded_frame[] = { - 85, 25, 0, 195, 4, 4, 216, 2, 0, 0, 178, 243, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_iar_state_t *test_msg = (msg_iar_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->num_hyps = 728; - - EXPECT_EQ(send_message(0x19, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asnum_hyps)>( - reinterpret_cast(&last_msg_->num_hyps)), - 728) - << "incorrect value for num_hyps, expected 728, is " - << last_msg_->num_hyps; -} -class Test_legacy_auto_check_sbp_piksi_MsgIarState5 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgIarState5() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_iar_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_iar_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgIarState5, Test) { - uint8_t encoded_frame[] = { - 85, 25, 0, 195, 4, 4, 215, 2, 0, 0, 92, 39, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_iar_state_t *test_msg = (msg_iar_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->num_hyps = 727; - - EXPECT_EQ(send_message(0x19, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asnum_hyps)>( - reinterpret_cast(&last_msg_->num_hyps)), - 727) - << "incorrect value for num_hyps, expected 727, is " - << last_msg_->num_hyps; -} -class Test_legacy_auto_check_sbp_piksi_MsgIarState6 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgIarState6() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_iar_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_iar_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgIarState6, Test) { - uint8_t encoded_frame[] = { - 85, 25, 0, 195, 4, 4, 211, 2, 0, 0, 173, 237, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_iar_state_t *test_msg = (msg_iar_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->num_hyps = 723; - - EXPECT_EQ(send_message(0x19, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asnum_hyps)>( - reinterpret_cast(&last_msg_->num_hyps)), - 723) - << "incorrect value for num_hyps, expected 723, is " - << last_msg_->num_hyps; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgInitBaseDep.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgInitBaseDep.cc deleted file mode 100644 index e36dbe21fa..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgInitBaseDep.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgInitBaseDep.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgMaskSatellite.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgMaskSatellite.cc deleted file mode 100644 index 20b8ce2392..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgMaskSatellite.cc +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgMaskSatellite.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgMaskSatellite0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgMaskSatellite0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_mask_satellite_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_mask_satellite_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgMaskSatellite0, Test) { - uint8_t encoded_frame[] = { - 85, 43, 0, 173, 151, 3, 183, 87, 57, 19, 147, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_mask_satellite_t *test_msg = (msg_mask_satellite_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->mask = 183; - test_msg->sid.code = 57; - test_msg->sid.sat = 87; - - EXPECT_EQ(send_message(0x2b, 38829, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 38829); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asmask)>( - reinterpret_cast(&last_msg_->mask)), - 183) - << "incorrect value for mask, expected 183, is " << last_msg_->mask; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 57) - << "incorrect value for sid.code, expected 57, is " - << last_msg_->sid.code; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 87) - << "incorrect value for sid.sat, expected 87, is " << last_msg_->sid.sat; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgMaskSatelliteDep.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgMaskSatelliteDep.cc deleted file mode 100644 index 4f31db59b9..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgMaskSatelliteDep.cc +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgMaskSatelliteDep.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgMaskSatelliteDep0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgMaskSatelliteDep0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_mask_satellite_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_mask_satellite_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgMaskSatelliteDep0, Test) { - uint8_t encoded_frame[] = { - 85, 27, 0, 187, 134, 5, 33, 2, 153, 95, 4, 29, 188, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_mask_satellite_dep_t *test_msg = - (msg_mask_satellite_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->mask = 33; - test_msg->sid.code = 95; - test_msg->sid.reserved = 4; - test_msg->sid.sat = 39170; - - EXPECT_EQ(send_message(0x1b, 34491, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 34491); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asmask)>( - reinterpret_cast(&last_msg_->mask)), - 33) - << "incorrect value for mask, expected 33, is " << last_msg_->mask; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 95) - << "incorrect value for sid.code, expected 95, is " - << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 4) - << "incorrect value for sid.reserved, expected 4, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 39170) - << "incorrect value for sid.sat, expected 39170, is " - << last_msg_->sid.sat; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgNetworkBandwidthUsage.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgNetworkBandwidthUsage.cc deleted file mode 100644 index 494e4575ef..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgNetworkBandwidthUsage.cc +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgNetworkBandwidthUsage.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgNetworkBandwidthUsage0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgNetworkBandwidthUsage0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_network_bandwidth_usage_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_network_bandwidth_usage_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgNetworkBandwidthUsage0, Test) { - uint8_t encoded_frame[] = { - 85, 189, 0, 207, 121, 200, 94, 105, 178, 128, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 99, 97, 110, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 94, 105, 178, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 97, 110, 49, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 94, 105, 178, 128, - 0, 0, 0, 0, 165, 235, 94, 203, 0, 0, 0, 0, 237, 14, 148, - 240, 184, 220, 202, 218, 101, 116, 104, 48, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 94, 105, 178, 128, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 108, 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 94, 105, 178, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 115, 105, 116, 48, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 133, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_network_bandwidth_usage_t *test_msg = - (msg_network_bandwidth_usage_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->interfaces) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->interfaces[0])); - } - test_msg->interfaces[0].duration = 2159176030; - { - const char assign_string[] = {(char)99, (char)97, (char)110, (char)48, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->interfaces[0].interface_name, assign_string, - sizeof(assign_string)); - if (sizeof(test_msg->interfaces[0].interface_name) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->interfaces[0].rx_bytes = 0; - test_msg->interfaces[0].total_bytes = 0; - test_msg->interfaces[0].tx_bytes = 0; - if (sizeof(test_msg->interfaces) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->interfaces[0])); - } - test_msg->interfaces[1].duration = 2159176030; - { - const char assign_string[] = {(char)99, (char)97, (char)110, (char)49, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->interfaces[1].interface_name, assign_string, - sizeof(assign_string)); - if (sizeof(test_msg->interfaces[1].interface_name) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->interfaces[1].rx_bytes = 0; - test_msg->interfaces[1].total_bytes = 0; - test_msg->interfaces[1].tx_bytes = 0; - if (sizeof(test_msg->interfaces) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->interfaces[0])); - } - test_msg->interfaces[2].duration = 2159176030; - { - const char assign_string[] = {(char)101, (char)116, (char)104, (char)48, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->interfaces[2].interface_name, assign_string, - sizeof(assign_string)); - if (sizeof(test_msg->interfaces[2].interface_name) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->interfaces[2].rx_bytes = 4036234989; - test_msg->interfaces[2].total_bytes = 3411995557; - test_msg->interfaces[2].tx_bytes = 3670727864; - if (sizeof(test_msg->interfaces) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->interfaces[0])); - } - test_msg->interfaces[3].duration = 2159176030; - { - const char assign_string[] = {(char)108, (char)111, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->interfaces[3].interface_name, assign_string, - sizeof(assign_string)); - if (sizeof(test_msg->interfaces[3].interface_name) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->interfaces[3].rx_bytes = 0; - test_msg->interfaces[3].total_bytes = 0; - test_msg->interfaces[3].tx_bytes = 0; - if (sizeof(test_msg->interfaces) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->interfaces[0])); - } - test_msg->interfaces[4].duration = 2159176030; - { - const char assign_string[] = {(char)115, (char)105, (char)116, (char)48, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->interfaces[4].interface_name, assign_string, - sizeof(assign_string)); - if (sizeof(test_msg->interfaces[4].interface_name) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->interfaces[4].rx_bytes = 0; - test_msg->interfaces[4].total_bytes = 0; - test_msg->interfaces[4].tx_bytes = 0; - - EXPECT_EQ(send_message(0xBD, 31183, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 31183); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asinterfaces[0].duration)>( - reinterpret_cast( - &last_msg_->interfaces[0].duration)), - 2159176030) - << "incorrect value for interfaces[0].duration, expected 2159176030, is " - << last_msg_->interfaces[0].duration; - { - const char check_string[] = {(char)99, (char)97, (char)110, (char)48, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->interfaces[0].interface_name, check_string, - sizeof(check_string)), - 0) - << "incorrect value for last_msg_->interfaces[0].interface_name, " - "expected string '" - << check_string << "', is '" << last_msg_->interfaces[0].interface_name - << "'"; - } - EXPECT_EQ(get_asinterfaces[0].rx_bytes)>( - reinterpret_cast( - &last_msg_->interfaces[0].rx_bytes)), - 0) - << "incorrect value for interfaces[0].rx_bytes, expected 0, is " - << last_msg_->interfaces[0].rx_bytes; - EXPECT_EQ(get_asinterfaces[0].total_bytes)>( - reinterpret_cast( - &last_msg_->interfaces[0].total_bytes)), - 0) - << "incorrect value for interfaces[0].total_bytes, expected 0, is " - << last_msg_->interfaces[0].total_bytes; - EXPECT_EQ(get_asinterfaces[0].tx_bytes)>( - reinterpret_cast( - &last_msg_->interfaces[0].tx_bytes)), - 0) - << "incorrect value for interfaces[0].tx_bytes, expected 0, is " - << last_msg_->interfaces[0].tx_bytes; - EXPECT_EQ(get_asinterfaces[1].duration)>( - reinterpret_cast( - &last_msg_->interfaces[1].duration)), - 2159176030) - << "incorrect value for interfaces[1].duration, expected 2159176030, is " - << last_msg_->interfaces[1].duration; - { - const char check_string[] = {(char)99, (char)97, (char)110, (char)49, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->interfaces[1].interface_name, check_string, - sizeof(check_string)), - 0) - << "incorrect value for last_msg_->interfaces[1].interface_name, " - "expected string '" - << check_string << "', is '" << last_msg_->interfaces[1].interface_name - << "'"; - } - EXPECT_EQ(get_asinterfaces[1].rx_bytes)>( - reinterpret_cast( - &last_msg_->interfaces[1].rx_bytes)), - 0) - << "incorrect value for interfaces[1].rx_bytes, expected 0, is " - << last_msg_->interfaces[1].rx_bytes; - EXPECT_EQ(get_asinterfaces[1].total_bytes)>( - reinterpret_cast( - &last_msg_->interfaces[1].total_bytes)), - 0) - << "incorrect value for interfaces[1].total_bytes, expected 0, is " - << last_msg_->interfaces[1].total_bytes; - EXPECT_EQ(get_asinterfaces[1].tx_bytes)>( - reinterpret_cast( - &last_msg_->interfaces[1].tx_bytes)), - 0) - << "incorrect value for interfaces[1].tx_bytes, expected 0, is " - << last_msg_->interfaces[1].tx_bytes; - EXPECT_EQ(get_asinterfaces[2].duration)>( - reinterpret_cast( - &last_msg_->interfaces[2].duration)), - 2159176030) - << "incorrect value for interfaces[2].duration, expected 2159176030, is " - << last_msg_->interfaces[2].duration; - { - const char check_string[] = {(char)101, (char)116, (char)104, (char)48, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->interfaces[2].interface_name, check_string, - sizeof(check_string)), - 0) - << "incorrect value for last_msg_->interfaces[2].interface_name, " - "expected string '" - << check_string << "', is '" << last_msg_->interfaces[2].interface_name - << "'"; - } - EXPECT_EQ(get_asinterfaces[2].rx_bytes)>( - reinterpret_cast( - &last_msg_->interfaces[2].rx_bytes)), - 4036234989) - << "incorrect value for interfaces[2].rx_bytes, expected 4036234989, is " - << last_msg_->interfaces[2].rx_bytes; - EXPECT_EQ(get_asinterfaces[2].total_bytes)>( - reinterpret_cast( - &last_msg_->interfaces[2].total_bytes)), - 3411995557) - << "incorrect value for interfaces[2].total_bytes, expected 3411995557, " - "is " - << last_msg_->interfaces[2].total_bytes; - EXPECT_EQ(get_asinterfaces[2].tx_bytes)>( - reinterpret_cast( - &last_msg_->interfaces[2].tx_bytes)), - 3670727864) - << "incorrect value for interfaces[2].tx_bytes, expected 3670727864, is " - << last_msg_->interfaces[2].tx_bytes; - EXPECT_EQ(get_asinterfaces[3].duration)>( - reinterpret_cast( - &last_msg_->interfaces[3].duration)), - 2159176030) - << "incorrect value for interfaces[3].duration, expected 2159176030, is " - << last_msg_->interfaces[3].duration; - { - const char check_string[] = {(char)108, (char)111, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->interfaces[3].interface_name, check_string, - sizeof(check_string)), - 0) - << "incorrect value for last_msg_->interfaces[3].interface_name, " - "expected string '" - << check_string << "', is '" << last_msg_->interfaces[3].interface_name - << "'"; - } - EXPECT_EQ(get_asinterfaces[3].rx_bytes)>( - reinterpret_cast( - &last_msg_->interfaces[3].rx_bytes)), - 0) - << "incorrect value for interfaces[3].rx_bytes, expected 0, is " - << last_msg_->interfaces[3].rx_bytes; - EXPECT_EQ(get_asinterfaces[3].total_bytes)>( - reinterpret_cast( - &last_msg_->interfaces[3].total_bytes)), - 0) - << "incorrect value for interfaces[3].total_bytes, expected 0, is " - << last_msg_->interfaces[3].total_bytes; - EXPECT_EQ(get_asinterfaces[3].tx_bytes)>( - reinterpret_cast( - &last_msg_->interfaces[3].tx_bytes)), - 0) - << "incorrect value for interfaces[3].tx_bytes, expected 0, is " - << last_msg_->interfaces[3].tx_bytes; - EXPECT_EQ(get_asinterfaces[4].duration)>( - reinterpret_cast( - &last_msg_->interfaces[4].duration)), - 2159176030) - << "incorrect value for interfaces[4].duration, expected 2159176030, is " - << last_msg_->interfaces[4].duration; - { - const char check_string[] = {(char)115, (char)105, (char)116, (char)48, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->interfaces[4].interface_name, check_string, - sizeof(check_string)), - 0) - << "incorrect value for last_msg_->interfaces[4].interface_name, " - "expected string '" - << check_string << "', is '" << last_msg_->interfaces[4].interface_name - << "'"; - } - EXPECT_EQ(get_asinterfaces[4].rx_bytes)>( - reinterpret_cast( - &last_msg_->interfaces[4].rx_bytes)), - 0) - << "incorrect value for interfaces[4].rx_bytes, expected 0, is " - << last_msg_->interfaces[4].rx_bytes; - EXPECT_EQ(get_asinterfaces[4].total_bytes)>( - reinterpret_cast( - &last_msg_->interfaces[4].total_bytes)), - 0) - << "incorrect value for interfaces[4].total_bytes, expected 0, is " - << last_msg_->interfaces[4].total_bytes; - EXPECT_EQ(get_asinterfaces[4].tx_bytes)>( - reinterpret_cast( - &last_msg_->interfaces[4].tx_bytes)), - 0) - << "incorrect value for interfaces[4].tx_bytes, expected 0, is " - << last_msg_->interfaces[4].tx_bytes; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgNetworkStateReq.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgNetworkStateReq.cc deleted file mode 100644 index 744925edaf..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgNetworkStateReq.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgNetworkStateReq.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgNetworkStateResp.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgNetworkStateResp.cc deleted file mode 100644 index 8a1e060b2b..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgNetworkStateResp.cc +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgNetworkStateResp.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgNetworkStateResp0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgNetworkStateResp0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_network_state_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_network_state_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgNetworkStateResp0, Test) { - uint8_t encoded_frame[] = { - 85, 187, 0, 40, 15, 50, 143, 241, 84, 180, 152, 194, 137, 32, 44, - 114, 147, 68, 222, 92, 192, 78, 235, 63, 208, 114, 53, 183, 24, 244, - 231, 26, 105, 25, 136, 3, 105, 102, 48, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 195, 229, 80, 147, 118, 193, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_network_state_resp_t *test_msg = - (msg_network_state_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 2471552451; - { - const char assign_string[] = {(char)105, (char)102, (char)48, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->interface_name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->interface_name) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - if (sizeof(test_msg->ipv4_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv4_address[0])); - } - test_msg->ipv4_address[0] = 143; - if (sizeof(test_msg->ipv4_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv4_address[0])); - } - test_msg->ipv4_address[1] = 241; - if (sizeof(test_msg->ipv4_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv4_address[0])); - } - test_msg->ipv4_address[2] = 84; - if (sizeof(test_msg->ipv4_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv4_address[0])); - } - test_msg->ipv4_address[3] = 180; - test_msg->ipv4_mask_size = 152; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv6_address[0])); - } - test_msg->ipv6_address[0] = 194; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv6_address[0])); - } - test_msg->ipv6_address[1] = 137; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv6_address[0])); - } - test_msg->ipv6_address[2] = 32; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv6_address[0])); - } - test_msg->ipv6_address[3] = 44; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv6_address[0])); - } - test_msg->ipv6_address[4] = 114; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv6_address[0])); - } - test_msg->ipv6_address[5] = 147; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv6_address[0])); - } - test_msg->ipv6_address[6] = 68; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv6_address[0])); - } - test_msg->ipv6_address[7] = 222; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv6_address[0])); - } - test_msg->ipv6_address[8] = 92; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv6_address[0])); - } - test_msg->ipv6_address[9] = 192; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv6_address[0])); - } - test_msg->ipv6_address[10] = 78; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv6_address[0])); - } - test_msg->ipv6_address[11] = 235; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv6_address[0])); - } - test_msg->ipv6_address[12] = 63; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv6_address[0])); - } - test_msg->ipv6_address[13] = 208; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv6_address[0])); - } - test_msg->ipv6_address[14] = 114; - if (sizeof(test_msg->ipv6_address) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->ipv6_address[0])); - } - test_msg->ipv6_address[15] = 53; - test_msg->ipv6_mask_size = 183; - test_msg->rx_bytes = 451408920; - test_msg->tx_bytes = 59251049; - - EXPECT_EQ(send_message(0xbb, 3880, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 3880); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 2471552451) - << "incorrect value for flags, expected 2471552451, is " - << last_msg_->flags; - { - const char check_string[] = {(char)105, (char)102, (char)48, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ( - memcmp(last_msg_->interface_name, check_string, sizeof(check_string)), - 0) - << "incorrect value for last_msg_->interface_name, expected string '" - << check_string << "', is '" << last_msg_->interface_name << "'"; - } - EXPECT_EQ(get_asipv4_address[0])>( - reinterpret_cast(&last_msg_->ipv4_address[0])), - 143) - << "incorrect value for ipv4_address[0], expected 143, is " - << last_msg_->ipv4_address[0]; - EXPECT_EQ(get_asipv4_address[1])>( - reinterpret_cast(&last_msg_->ipv4_address[1])), - 241) - << "incorrect value for ipv4_address[1], expected 241, is " - << last_msg_->ipv4_address[1]; - EXPECT_EQ(get_asipv4_address[2])>( - reinterpret_cast(&last_msg_->ipv4_address[2])), - 84) - << "incorrect value for ipv4_address[2], expected 84, is " - << last_msg_->ipv4_address[2]; - EXPECT_EQ(get_asipv4_address[3])>( - reinterpret_cast(&last_msg_->ipv4_address[3])), - 180) - << "incorrect value for ipv4_address[3], expected 180, is " - << last_msg_->ipv4_address[3]; - EXPECT_EQ(get_asipv4_mask_size)>( - reinterpret_cast(&last_msg_->ipv4_mask_size)), - 152) - << "incorrect value for ipv4_mask_size, expected 152, is " - << last_msg_->ipv4_mask_size; - EXPECT_EQ(get_asipv6_address[0])>( - reinterpret_cast(&last_msg_->ipv6_address[0])), - 194) - << "incorrect value for ipv6_address[0], expected 194, is " - << last_msg_->ipv6_address[0]; - EXPECT_EQ(get_asipv6_address[1])>( - reinterpret_cast(&last_msg_->ipv6_address[1])), - 137) - << "incorrect value for ipv6_address[1], expected 137, is " - << last_msg_->ipv6_address[1]; - EXPECT_EQ(get_asipv6_address[2])>( - reinterpret_cast(&last_msg_->ipv6_address[2])), - 32) - << "incorrect value for ipv6_address[2], expected 32, is " - << last_msg_->ipv6_address[2]; - EXPECT_EQ(get_asipv6_address[3])>( - reinterpret_cast(&last_msg_->ipv6_address[3])), - 44) - << "incorrect value for ipv6_address[3], expected 44, is " - << last_msg_->ipv6_address[3]; - EXPECT_EQ(get_asipv6_address[4])>( - reinterpret_cast(&last_msg_->ipv6_address[4])), - 114) - << "incorrect value for ipv6_address[4], expected 114, is " - << last_msg_->ipv6_address[4]; - EXPECT_EQ(get_asipv6_address[5])>( - reinterpret_cast(&last_msg_->ipv6_address[5])), - 147) - << "incorrect value for ipv6_address[5], expected 147, is " - << last_msg_->ipv6_address[5]; - EXPECT_EQ(get_asipv6_address[6])>( - reinterpret_cast(&last_msg_->ipv6_address[6])), - 68) - << "incorrect value for ipv6_address[6], expected 68, is " - << last_msg_->ipv6_address[6]; - EXPECT_EQ(get_asipv6_address[7])>( - reinterpret_cast(&last_msg_->ipv6_address[7])), - 222) - << "incorrect value for ipv6_address[7], expected 222, is " - << last_msg_->ipv6_address[7]; - EXPECT_EQ(get_asipv6_address[8])>( - reinterpret_cast(&last_msg_->ipv6_address[8])), - 92) - << "incorrect value for ipv6_address[8], expected 92, is " - << last_msg_->ipv6_address[8]; - EXPECT_EQ(get_asipv6_address[9])>( - reinterpret_cast(&last_msg_->ipv6_address[9])), - 192) - << "incorrect value for ipv6_address[9], expected 192, is " - << last_msg_->ipv6_address[9]; - EXPECT_EQ( - get_asipv6_address[10])>( - reinterpret_cast(&last_msg_->ipv6_address[10])), - 78) - << "incorrect value for ipv6_address[10], expected 78, is " - << last_msg_->ipv6_address[10]; - EXPECT_EQ( - get_asipv6_address[11])>( - reinterpret_cast(&last_msg_->ipv6_address[11])), - 235) - << "incorrect value for ipv6_address[11], expected 235, is " - << last_msg_->ipv6_address[11]; - EXPECT_EQ( - get_asipv6_address[12])>( - reinterpret_cast(&last_msg_->ipv6_address[12])), - 63) - << "incorrect value for ipv6_address[12], expected 63, is " - << last_msg_->ipv6_address[12]; - EXPECT_EQ( - get_asipv6_address[13])>( - reinterpret_cast(&last_msg_->ipv6_address[13])), - 208) - << "incorrect value for ipv6_address[13], expected 208, is " - << last_msg_->ipv6_address[13]; - EXPECT_EQ( - get_asipv6_address[14])>( - reinterpret_cast(&last_msg_->ipv6_address[14])), - 114) - << "incorrect value for ipv6_address[14], expected 114, is " - << last_msg_->ipv6_address[14]; - EXPECT_EQ( - get_asipv6_address[15])>( - reinterpret_cast(&last_msg_->ipv6_address[15])), - 53) - << "incorrect value for ipv6_address[15], expected 53, is " - << last_msg_->ipv6_address[15]; - EXPECT_EQ(get_asipv6_mask_size)>( - reinterpret_cast(&last_msg_->ipv6_mask_size)), - 183) - << "incorrect value for ipv6_mask_size, expected 183, is " - << last_msg_->ipv6_mask_size; - EXPECT_EQ(get_asrx_bytes)>( - reinterpret_cast(&last_msg_->rx_bytes)), - 451408920) - << "incorrect value for rx_bytes, expected 451408920, is " - << last_msg_->rx_bytes; - EXPECT_EQ(get_astx_bytes)>( - reinterpret_cast(&last_msg_->tx_bytes)), - 59251049) - << "incorrect value for tx_bytes, expected 59251049, is " - << last_msg_->tx_bytes; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgReset.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgReset.cc deleted file mode 100644 index bcde2e7b27..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgReset.cc +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgReset.yaml by generate.py. Do not -// modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgReset0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgReset0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_reset_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_reset_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgReset0, Test) { - uint8_t encoded_frame[] = { - 85, 182, 0, 63, 210, 4, 88, 248, 238, 19, 74, 207, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_reset_t *test_msg = (msg_reset_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 334428248; - - EXPECT_EQ(send_message(0xb6, 53823, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 53823); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 334428248) - << "incorrect value for flags, expected 334428248, is " - << last_msg_->flags; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgResetDep.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgResetDep.cc deleted file mode 100644 index b74323f1ee..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgResetDep.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgResetDep.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgResetFilters.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgResetFilters.cc deleted file mode 100644 index f8e7898979..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgResetFilters.cc +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgResetFilters.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgResetFilters0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgResetFilters0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_reset_filters_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_reset_filters_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgResetFilters0, Test) { - uint8_t encoded_frame[] = { - 85, 34, 0, 81, 200, 1, 100, 130, 45, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_reset_filters_t *test_msg = (msg_reset_filters_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->filter = 100; - - EXPECT_EQ(send_message(0x22, 51281, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 51281); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asfilter)>( - reinterpret_cast(&last_msg_->filter)), - 100) - << "incorrect value for filter, expected 100, is " << last_msg_->filter; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgSetTime.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgSetTime.cc deleted file mode 100644 index 53293d58ea..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgSetTime.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgSetTime.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgSpecan.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgSpecan.cc deleted file mode 100644 index 37058ff67d..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgSpecan.cc +++ /dev/null @@ -1,2899 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgSpecan.yaml by generate.py. Do not -// modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgSpecan0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgSpecan0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_specan_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_specan_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgSpecan0, Test) { - uint8_t encoded_frame[] = { - 85, 81, 0, 28, 212, 255, 74, 137, 71, 245, 34, 73, 12, 221, 215, - 167, 211, 19, 154, 201, 241, 69, 205, 136, 0, 70, 51, 67, 108, 69, - 102, 38, 166, 68, 100, 179, 185, 17, 175, 49, 193, 228, 228, 47, 33, - 24, 141, 177, 18, 99, 246, 121, 61, 40, 91, 145, 223, 167, 174, 9, - 116, 11, 247, 84, 49, 153, 205, 2, 230, 194, 218, 241, 101, 107, 45, - 137, 93, 114, 230, 43, 224, 23, 74, 209, 199, 211, 130, 89, 220, 163, - 68, 20, 253, 7, 206, 50, 129, 116, 194, 23, 31, 226, 217, 157, 205, - 221, 5, 224, 92, 82, 109, 223, 195, 233, 165, 1, 82, 141, 157, 177, - 169, 244, 131, 96, 109, 111, 253, 149, 28, 225, 225, 72, 158, 158, 210, - 196, 206, 70, 63, 225, 184, 150, 174, 240, 45, 146, 59, 82, 194, 4, - 179, 148, 66, 254, 115, 77, 30, 46, 4, 204, 37, 200, 121, 18, 17, - 171, 102, 163, 175, 50, 66, 101, 69, 13, 223, 172, 160, 233, 220, 101, - 237, 156, 62, 117, 47, 143, 94, 135, 22, 155, 113, 110, 15, 243, 141, - 227, 46, 143, 227, 209, 249, 2, 153, 168, 131, 249, 160, 88, 38, 117, - 129, 57, 40, 109, 209, 177, 38, 47, 12, 15, 16, 9, 175, 69, 70, - 182, 239, 117, 135, 6, 71, 99, 230, 115, 2, 71, 165, 228, 123, 210, - 168, 90, 124, 20, 7, 220, 144, 168, 69, 22, 72, 162, 69, 111, 91, - 251, 72, 220, 28, 119, 150, 95, 2, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_specan_t *test_msg = (msg_specan_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->amplitude_ref = 3780.199951171875; - test_msg->amplitude_unit = 1329.199951171875; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[0] = 100; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[1] = 179; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[2] = 185; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[3] = 17; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[4] = 175; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[5] = 49; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[6] = 193; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[7] = 228; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[8] = 228; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[9] = 47; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[10] = 33; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[11] = 24; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[12] = 141; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[13] = 177; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[14] = 18; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[15] = 99; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[16] = 246; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[17] = 121; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[18] = 61; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[19] = 40; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[20] = 91; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[21] = 145; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[22] = 223; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[23] = 167; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[24] = 174; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[25] = 9; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[26] = 116; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[27] = 11; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[28] = 247; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[29] = 84; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[30] = 49; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[31] = 153; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[32] = 205; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[33] = 2; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[34] = 230; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[35] = 194; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[36] = 218; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[37] = 241; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[38] = 101; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[39] = 107; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[40] = 45; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[41] = 137; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[42] = 93; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[43] = 114; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[44] = 230; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[45] = 43; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[46] = 224; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[47] = 23; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[48] = 74; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[49] = 209; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[50] = 199; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[51] = 211; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[52] = 130; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[53] = 89; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[54] = 220; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[55] = 163; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[56] = 68; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[57] = 20; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[58] = 253; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[59] = 7; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[60] = 206; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[61] = 50; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[62] = 129; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[63] = 116; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[64] = 194; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[65] = 23; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[66] = 31; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[67] = 226; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[68] = 217; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[69] = 157; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[70] = 205; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[71] = 221; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[72] = 5; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[73] = 224; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[74] = 92; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[75] = 82; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[76] = 109; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[77] = 223; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[78] = 195; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[79] = 233; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[80] = 165; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[81] = 1; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[82] = 82; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[83] = 141; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[84] = 157; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[85] = 177; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[86] = 169; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[87] = 244; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[88] = 131; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[89] = 96; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[90] = 109; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[91] = 111; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[92] = 253; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[93] = 149; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[94] = 28; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[95] = 225; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[96] = 225; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[97] = 72; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[98] = 158; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[99] = 158; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[100] = 210; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[101] = 196; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[102] = 206; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[103] = 70; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[104] = 63; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[105] = 225; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[106] = 184; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[107] = 150; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[108] = 174; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[109] = 240; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[110] = 45; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[111] = 146; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[112] = 59; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[113] = 82; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[114] = 194; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[115] = 4; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[116] = 179; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[117] = 148; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[118] = 66; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[119] = 254; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[120] = 115; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[121] = 77; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[122] = 30; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[123] = 46; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[124] = 4; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[125] = 204; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[126] = 37; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[127] = 200; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[128] = 121; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[129] = 18; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[130] = 17; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[131] = 171; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[132] = 102; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[133] = 163; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[134] = 175; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[135] = 50; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[136] = 66; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[137] = 101; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[138] = 69; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[139] = 13; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[140] = 223; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[141] = 172; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[142] = 160; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[143] = 233; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[144] = 220; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[145] = 101; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[146] = 237; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[147] = 156; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[148] = 62; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[149] = 117; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[150] = 47; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[151] = 143; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[152] = 94; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[153] = 135; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[154] = 22; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[155] = 155; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[156] = 113; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[157] = 110; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[158] = 15; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[159] = 243; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[160] = 141; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[161] = 227; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[162] = 46; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[163] = 143; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[164] = 227; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[165] = 209; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[166] = 249; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[167] = 2; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[168] = 153; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[169] = 168; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[170] = 131; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[171] = 249; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[172] = 160; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[173] = 88; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[174] = 38; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[175] = 117; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[176] = 129; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[177] = 57; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[178] = 40; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[179] = 109; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[180] = 209; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[181] = 177; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[182] = 38; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[183] = 47; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[184] = 12; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[185] = 15; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[186] = 16; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[187] = 9; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[188] = 175; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[189] = 69; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[190] = 70; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[191] = 182; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[192] = 239; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[193] = 117; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[194] = 135; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[195] = 6; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[196] = 71; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[197] = 99; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[198] = 230; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[199] = 115; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[200] = 2; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[201] = 71; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[202] = 165; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[203] = 228; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[204] = 123; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[205] = 210; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[206] = 168; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[207] = 90; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[208] = 124; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[209] = 20; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[210] = 7; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[211] = 220; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[212] = 144; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[213] = 168; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[214] = 69; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[215] = 22; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[216] = 72; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[217] = 162; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[218] = 69; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[219] = 111; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[220] = 91; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[221] = 251; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[222] = 72; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[223] = 220; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[224] = 28; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[225] = 119; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[226] = 150; - test_msg->channel_tag = 35146; - test_msg->freq_ref = 7737.2001953125; - test_msg->freq_step = 8226.2001953125; - test_msg->t.ns_residual = -1479025396; - test_msg->t.tow = 1227027783; - test_msg->t.wn = 5075; - - EXPECT_EQ(send_message(0x51, 54300, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 54300); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->amplitude_ref * 100 - 3780.19995117 * 100), 0.05) - << "incorrect value for amplitude_ref, expected 3780.19995117, is " - << last_msg_->amplitude_ref; - EXPECT_LT((last_msg_->amplitude_unit * 100 - 1329.19995117 * 100), 0.05) - << "incorrect value for amplitude_unit, expected 1329.19995117, is " - << last_msg_->amplitude_unit; - EXPECT_EQ( - get_asamplitude_value[0])>( - reinterpret_cast(&last_msg_->amplitude_value[0])), - 100) - << "incorrect value for amplitude_value[0], expected 100, is " - << last_msg_->amplitude_value[0]; - EXPECT_EQ( - get_asamplitude_value[1])>( - reinterpret_cast(&last_msg_->amplitude_value[1])), - 179) - << "incorrect value for amplitude_value[1], expected 179, is " - << last_msg_->amplitude_value[1]; - EXPECT_EQ( - get_asamplitude_value[2])>( - reinterpret_cast(&last_msg_->amplitude_value[2])), - 185) - << "incorrect value for amplitude_value[2], expected 185, is " - << last_msg_->amplitude_value[2]; - EXPECT_EQ( - get_asamplitude_value[3])>( - reinterpret_cast(&last_msg_->amplitude_value[3])), - 17) - << "incorrect value for amplitude_value[3], expected 17, is " - << last_msg_->amplitude_value[3]; - EXPECT_EQ( - get_asamplitude_value[4])>( - reinterpret_cast(&last_msg_->amplitude_value[4])), - 175) - << "incorrect value for amplitude_value[4], expected 175, is " - << last_msg_->amplitude_value[4]; - EXPECT_EQ( - get_asamplitude_value[5])>( - reinterpret_cast(&last_msg_->amplitude_value[5])), - 49) - << "incorrect value for amplitude_value[5], expected 49, is " - << last_msg_->amplitude_value[5]; - EXPECT_EQ( - get_asamplitude_value[6])>( - reinterpret_cast(&last_msg_->amplitude_value[6])), - 193) - << "incorrect value for amplitude_value[6], expected 193, is " - << last_msg_->amplitude_value[6]; - EXPECT_EQ( - get_asamplitude_value[7])>( - reinterpret_cast(&last_msg_->amplitude_value[7])), - 228) - << "incorrect value for amplitude_value[7], expected 228, is " - << last_msg_->amplitude_value[7]; - EXPECT_EQ( - get_asamplitude_value[8])>( - reinterpret_cast(&last_msg_->amplitude_value[8])), - 228) - << "incorrect value for amplitude_value[8], expected 228, is " - << last_msg_->amplitude_value[8]; - EXPECT_EQ( - get_asamplitude_value[9])>( - reinterpret_cast(&last_msg_->amplitude_value[9])), - 47) - << "incorrect value for amplitude_value[9], expected 47, is " - << last_msg_->amplitude_value[9]; - EXPECT_EQ( - get_asamplitude_value[10])>( - reinterpret_cast(&last_msg_->amplitude_value[10])), - 33) - << "incorrect value for amplitude_value[10], expected 33, is " - << last_msg_->amplitude_value[10]; - EXPECT_EQ( - get_asamplitude_value[11])>( - reinterpret_cast(&last_msg_->amplitude_value[11])), - 24) - << "incorrect value for amplitude_value[11], expected 24, is " - << last_msg_->amplitude_value[11]; - EXPECT_EQ( - get_asamplitude_value[12])>( - reinterpret_cast(&last_msg_->amplitude_value[12])), - 141) - << "incorrect value for amplitude_value[12], expected 141, is " - << last_msg_->amplitude_value[12]; - EXPECT_EQ( - get_asamplitude_value[13])>( - reinterpret_cast(&last_msg_->amplitude_value[13])), - 177) - << "incorrect value for amplitude_value[13], expected 177, is " - << last_msg_->amplitude_value[13]; - EXPECT_EQ( - get_asamplitude_value[14])>( - reinterpret_cast(&last_msg_->amplitude_value[14])), - 18) - << "incorrect value for amplitude_value[14], expected 18, is " - << last_msg_->amplitude_value[14]; - EXPECT_EQ( - get_asamplitude_value[15])>( - reinterpret_cast(&last_msg_->amplitude_value[15])), - 99) - << "incorrect value for amplitude_value[15], expected 99, is " - << last_msg_->amplitude_value[15]; - EXPECT_EQ( - get_asamplitude_value[16])>( - reinterpret_cast(&last_msg_->amplitude_value[16])), - 246) - << "incorrect value for amplitude_value[16], expected 246, is " - << last_msg_->amplitude_value[16]; - EXPECT_EQ( - get_asamplitude_value[17])>( - reinterpret_cast(&last_msg_->amplitude_value[17])), - 121) - << "incorrect value for amplitude_value[17], expected 121, is " - << last_msg_->amplitude_value[17]; - EXPECT_EQ( - get_asamplitude_value[18])>( - reinterpret_cast(&last_msg_->amplitude_value[18])), - 61) - << "incorrect value for amplitude_value[18], expected 61, is " - << last_msg_->amplitude_value[18]; - EXPECT_EQ( - get_asamplitude_value[19])>( - reinterpret_cast(&last_msg_->amplitude_value[19])), - 40) - << "incorrect value for amplitude_value[19], expected 40, is " - << last_msg_->amplitude_value[19]; - EXPECT_EQ( - get_asamplitude_value[20])>( - reinterpret_cast(&last_msg_->amplitude_value[20])), - 91) - << "incorrect value for amplitude_value[20], expected 91, is " - << last_msg_->amplitude_value[20]; - EXPECT_EQ( - get_asamplitude_value[21])>( - reinterpret_cast(&last_msg_->amplitude_value[21])), - 145) - << "incorrect value for amplitude_value[21], expected 145, is " - << last_msg_->amplitude_value[21]; - EXPECT_EQ( - get_asamplitude_value[22])>( - reinterpret_cast(&last_msg_->amplitude_value[22])), - 223) - << "incorrect value for amplitude_value[22], expected 223, is " - << last_msg_->amplitude_value[22]; - EXPECT_EQ( - get_asamplitude_value[23])>( - reinterpret_cast(&last_msg_->amplitude_value[23])), - 167) - << "incorrect value for amplitude_value[23], expected 167, is " - << last_msg_->amplitude_value[23]; - EXPECT_EQ( - get_asamplitude_value[24])>( - reinterpret_cast(&last_msg_->amplitude_value[24])), - 174) - << "incorrect value for amplitude_value[24], expected 174, is " - << last_msg_->amplitude_value[24]; - EXPECT_EQ( - get_asamplitude_value[25])>( - reinterpret_cast(&last_msg_->amplitude_value[25])), - 9) - << "incorrect value for amplitude_value[25], expected 9, is " - << last_msg_->amplitude_value[25]; - EXPECT_EQ( - get_asamplitude_value[26])>( - reinterpret_cast(&last_msg_->amplitude_value[26])), - 116) - << "incorrect value for amplitude_value[26], expected 116, is " - << last_msg_->amplitude_value[26]; - EXPECT_EQ( - get_asamplitude_value[27])>( - reinterpret_cast(&last_msg_->amplitude_value[27])), - 11) - << "incorrect value for amplitude_value[27], expected 11, is " - << last_msg_->amplitude_value[27]; - EXPECT_EQ( - get_asamplitude_value[28])>( - reinterpret_cast(&last_msg_->amplitude_value[28])), - 247) - << "incorrect value for amplitude_value[28], expected 247, is " - << last_msg_->amplitude_value[28]; - EXPECT_EQ( - get_asamplitude_value[29])>( - reinterpret_cast(&last_msg_->amplitude_value[29])), - 84) - << "incorrect value for amplitude_value[29], expected 84, is " - << last_msg_->amplitude_value[29]; - EXPECT_EQ( - get_asamplitude_value[30])>( - reinterpret_cast(&last_msg_->amplitude_value[30])), - 49) - << "incorrect value for amplitude_value[30], expected 49, is " - << last_msg_->amplitude_value[30]; - EXPECT_EQ( - get_asamplitude_value[31])>( - reinterpret_cast(&last_msg_->amplitude_value[31])), - 153) - << "incorrect value for amplitude_value[31], expected 153, is " - << last_msg_->amplitude_value[31]; - EXPECT_EQ( - get_asamplitude_value[32])>( - reinterpret_cast(&last_msg_->amplitude_value[32])), - 205) - << "incorrect value for amplitude_value[32], expected 205, is " - << last_msg_->amplitude_value[32]; - EXPECT_EQ( - get_asamplitude_value[33])>( - reinterpret_cast(&last_msg_->amplitude_value[33])), - 2) - << "incorrect value for amplitude_value[33], expected 2, is " - << last_msg_->amplitude_value[33]; - EXPECT_EQ( - get_asamplitude_value[34])>( - reinterpret_cast(&last_msg_->amplitude_value[34])), - 230) - << "incorrect value for amplitude_value[34], expected 230, is " - << last_msg_->amplitude_value[34]; - EXPECT_EQ( - get_asamplitude_value[35])>( - reinterpret_cast(&last_msg_->amplitude_value[35])), - 194) - << "incorrect value for amplitude_value[35], expected 194, is " - << last_msg_->amplitude_value[35]; - EXPECT_EQ( - get_asamplitude_value[36])>( - reinterpret_cast(&last_msg_->amplitude_value[36])), - 218) - << "incorrect value for amplitude_value[36], expected 218, is " - << last_msg_->amplitude_value[36]; - EXPECT_EQ( - get_asamplitude_value[37])>( - reinterpret_cast(&last_msg_->amplitude_value[37])), - 241) - << "incorrect value for amplitude_value[37], expected 241, is " - << last_msg_->amplitude_value[37]; - EXPECT_EQ( - get_asamplitude_value[38])>( - reinterpret_cast(&last_msg_->amplitude_value[38])), - 101) - << "incorrect value for amplitude_value[38], expected 101, is " - << last_msg_->amplitude_value[38]; - EXPECT_EQ( - get_asamplitude_value[39])>( - reinterpret_cast(&last_msg_->amplitude_value[39])), - 107) - << "incorrect value for amplitude_value[39], expected 107, is " - << last_msg_->amplitude_value[39]; - EXPECT_EQ( - get_asamplitude_value[40])>( - reinterpret_cast(&last_msg_->amplitude_value[40])), - 45) - << "incorrect value for amplitude_value[40], expected 45, is " - << last_msg_->amplitude_value[40]; - EXPECT_EQ( - get_asamplitude_value[41])>( - reinterpret_cast(&last_msg_->amplitude_value[41])), - 137) - << "incorrect value for amplitude_value[41], expected 137, is " - << last_msg_->amplitude_value[41]; - EXPECT_EQ( - get_asamplitude_value[42])>( - reinterpret_cast(&last_msg_->amplitude_value[42])), - 93) - << "incorrect value for amplitude_value[42], expected 93, is " - << last_msg_->amplitude_value[42]; - EXPECT_EQ( - get_asamplitude_value[43])>( - reinterpret_cast(&last_msg_->amplitude_value[43])), - 114) - << "incorrect value for amplitude_value[43], expected 114, is " - << last_msg_->amplitude_value[43]; - EXPECT_EQ( - get_asamplitude_value[44])>( - reinterpret_cast(&last_msg_->amplitude_value[44])), - 230) - << "incorrect value for amplitude_value[44], expected 230, is " - << last_msg_->amplitude_value[44]; - EXPECT_EQ( - get_asamplitude_value[45])>( - reinterpret_cast(&last_msg_->amplitude_value[45])), - 43) - << "incorrect value for amplitude_value[45], expected 43, is " - << last_msg_->amplitude_value[45]; - EXPECT_EQ( - get_asamplitude_value[46])>( - reinterpret_cast(&last_msg_->amplitude_value[46])), - 224) - << "incorrect value for amplitude_value[46], expected 224, is " - << last_msg_->amplitude_value[46]; - EXPECT_EQ( - get_asamplitude_value[47])>( - reinterpret_cast(&last_msg_->amplitude_value[47])), - 23) - << "incorrect value for amplitude_value[47], expected 23, is " - << last_msg_->amplitude_value[47]; - EXPECT_EQ( - get_asamplitude_value[48])>( - reinterpret_cast(&last_msg_->amplitude_value[48])), - 74) - << "incorrect value for amplitude_value[48], expected 74, is " - << last_msg_->amplitude_value[48]; - EXPECT_EQ( - get_asamplitude_value[49])>( - reinterpret_cast(&last_msg_->amplitude_value[49])), - 209) - << "incorrect value for amplitude_value[49], expected 209, is " - << last_msg_->amplitude_value[49]; - EXPECT_EQ( - get_asamplitude_value[50])>( - reinterpret_cast(&last_msg_->amplitude_value[50])), - 199) - << "incorrect value for amplitude_value[50], expected 199, is " - << last_msg_->amplitude_value[50]; - EXPECT_EQ( - get_asamplitude_value[51])>( - reinterpret_cast(&last_msg_->amplitude_value[51])), - 211) - << "incorrect value for amplitude_value[51], expected 211, is " - << last_msg_->amplitude_value[51]; - EXPECT_EQ( - get_asamplitude_value[52])>( - reinterpret_cast(&last_msg_->amplitude_value[52])), - 130) - << "incorrect value for amplitude_value[52], expected 130, is " - << last_msg_->amplitude_value[52]; - EXPECT_EQ( - get_asamplitude_value[53])>( - reinterpret_cast(&last_msg_->amplitude_value[53])), - 89) - << "incorrect value for amplitude_value[53], expected 89, is " - << last_msg_->amplitude_value[53]; - EXPECT_EQ( - get_asamplitude_value[54])>( - reinterpret_cast(&last_msg_->amplitude_value[54])), - 220) - << "incorrect value for amplitude_value[54], expected 220, is " - << last_msg_->amplitude_value[54]; - EXPECT_EQ( - get_asamplitude_value[55])>( - reinterpret_cast(&last_msg_->amplitude_value[55])), - 163) - << "incorrect value for amplitude_value[55], expected 163, is " - << last_msg_->amplitude_value[55]; - EXPECT_EQ( - get_asamplitude_value[56])>( - reinterpret_cast(&last_msg_->amplitude_value[56])), - 68) - << "incorrect value for amplitude_value[56], expected 68, is " - << last_msg_->amplitude_value[56]; - EXPECT_EQ( - get_asamplitude_value[57])>( - reinterpret_cast(&last_msg_->amplitude_value[57])), - 20) - << "incorrect value for amplitude_value[57], expected 20, is " - << last_msg_->amplitude_value[57]; - EXPECT_EQ( - get_asamplitude_value[58])>( - reinterpret_cast(&last_msg_->amplitude_value[58])), - 253) - << "incorrect value for amplitude_value[58], expected 253, is " - << last_msg_->amplitude_value[58]; - EXPECT_EQ( - get_asamplitude_value[59])>( - reinterpret_cast(&last_msg_->amplitude_value[59])), - 7) - << "incorrect value for amplitude_value[59], expected 7, is " - << last_msg_->amplitude_value[59]; - EXPECT_EQ( - get_asamplitude_value[60])>( - reinterpret_cast(&last_msg_->amplitude_value[60])), - 206) - << "incorrect value for amplitude_value[60], expected 206, is " - << last_msg_->amplitude_value[60]; - EXPECT_EQ( - get_asamplitude_value[61])>( - reinterpret_cast(&last_msg_->amplitude_value[61])), - 50) - << "incorrect value for amplitude_value[61], expected 50, is " - << last_msg_->amplitude_value[61]; - EXPECT_EQ( - get_asamplitude_value[62])>( - reinterpret_cast(&last_msg_->amplitude_value[62])), - 129) - << "incorrect value for amplitude_value[62], expected 129, is " - << last_msg_->amplitude_value[62]; - EXPECT_EQ( - get_asamplitude_value[63])>( - reinterpret_cast(&last_msg_->amplitude_value[63])), - 116) - << "incorrect value for amplitude_value[63], expected 116, is " - << last_msg_->amplitude_value[63]; - EXPECT_EQ( - get_asamplitude_value[64])>( - reinterpret_cast(&last_msg_->amplitude_value[64])), - 194) - << "incorrect value for amplitude_value[64], expected 194, is " - << last_msg_->amplitude_value[64]; - EXPECT_EQ( - get_asamplitude_value[65])>( - reinterpret_cast(&last_msg_->amplitude_value[65])), - 23) - << "incorrect value for amplitude_value[65], expected 23, is " - << last_msg_->amplitude_value[65]; - EXPECT_EQ( - get_asamplitude_value[66])>( - reinterpret_cast(&last_msg_->amplitude_value[66])), - 31) - << "incorrect value for amplitude_value[66], expected 31, is " - << last_msg_->amplitude_value[66]; - EXPECT_EQ( - get_asamplitude_value[67])>( - reinterpret_cast(&last_msg_->amplitude_value[67])), - 226) - << "incorrect value for amplitude_value[67], expected 226, is " - << last_msg_->amplitude_value[67]; - EXPECT_EQ( - get_asamplitude_value[68])>( - reinterpret_cast(&last_msg_->amplitude_value[68])), - 217) - << "incorrect value for amplitude_value[68], expected 217, is " - << last_msg_->amplitude_value[68]; - EXPECT_EQ( - get_asamplitude_value[69])>( - reinterpret_cast(&last_msg_->amplitude_value[69])), - 157) - << "incorrect value for amplitude_value[69], expected 157, is " - << last_msg_->amplitude_value[69]; - EXPECT_EQ( - get_asamplitude_value[70])>( - reinterpret_cast(&last_msg_->amplitude_value[70])), - 205) - << "incorrect value for amplitude_value[70], expected 205, is " - << last_msg_->amplitude_value[70]; - EXPECT_EQ( - get_asamplitude_value[71])>( - reinterpret_cast(&last_msg_->amplitude_value[71])), - 221) - << "incorrect value for amplitude_value[71], expected 221, is " - << last_msg_->amplitude_value[71]; - EXPECT_EQ( - get_asamplitude_value[72])>( - reinterpret_cast(&last_msg_->amplitude_value[72])), - 5) - << "incorrect value for amplitude_value[72], expected 5, is " - << last_msg_->amplitude_value[72]; - EXPECT_EQ( - get_asamplitude_value[73])>( - reinterpret_cast(&last_msg_->amplitude_value[73])), - 224) - << "incorrect value for amplitude_value[73], expected 224, is " - << last_msg_->amplitude_value[73]; - EXPECT_EQ( - get_asamplitude_value[74])>( - reinterpret_cast(&last_msg_->amplitude_value[74])), - 92) - << "incorrect value for amplitude_value[74], expected 92, is " - << last_msg_->amplitude_value[74]; - EXPECT_EQ( - get_asamplitude_value[75])>( - reinterpret_cast(&last_msg_->amplitude_value[75])), - 82) - << "incorrect value for amplitude_value[75], expected 82, is " - << last_msg_->amplitude_value[75]; - EXPECT_EQ( - get_asamplitude_value[76])>( - reinterpret_cast(&last_msg_->amplitude_value[76])), - 109) - << "incorrect value for amplitude_value[76], expected 109, is " - << last_msg_->amplitude_value[76]; - EXPECT_EQ( - get_asamplitude_value[77])>( - reinterpret_cast(&last_msg_->amplitude_value[77])), - 223) - << "incorrect value for amplitude_value[77], expected 223, is " - << last_msg_->amplitude_value[77]; - EXPECT_EQ( - get_asamplitude_value[78])>( - reinterpret_cast(&last_msg_->amplitude_value[78])), - 195) - << "incorrect value for amplitude_value[78], expected 195, is " - << last_msg_->amplitude_value[78]; - EXPECT_EQ( - get_asamplitude_value[79])>( - reinterpret_cast(&last_msg_->amplitude_value[79])), - 233) - << "incorrect value for amplitude_value[79], expected 233, is " - << last_msg_->amplitude_value[79]; - EXPECT_EQ( - get_asamplitude_value[80])>( - reinterpret_cast(&last_msg_->amplitude_value[80])), - 165) - << "incorrect value for amplitude_value[80], expected 165, is " - << last_msg_->amplitude_value[80]; - EXPECT_EQ( - get_asamplitude_value[81])>( - reinterpret_cast(&last_msg_->amplitude_value[81])), - 1) - << "incorrect value for amplitude_value[81], expected 1, is " - << last_msg_->amplitude_value[81]; - EXPECT_EQ( - get_asamplitude_value[82])>( - reinterpret_cast(&last_msg_->amplitude_value[82])), - 82) - << "incorrect value for amplitude_value[82], expected 82, is " - << last_msg_->amplitude_value[82]; - EXPECT_EQ( - get_asamplitude_value[83])>( - reinterpret_cast(&last_msg_->amplitude_value[83])), - 141) - << "incorrect value for amplitude_value[83], expected 141, is " - << last_msg_->amplitude_value[83]; - EXPECT_EQ( - get_asamplitude_value[84])>( - reinterpret_cast(&last_msg_->amplitude_value[84])), - 157) - << "incorrect value for amplitude_value[84], expected 157, is " - << last_msg_->amplitude_value[84]; - EXPECT_EQ( - get_asamplitude_value[85])>( - reinterpret_cast(&last_msg_->amplitude_value[85])), - 177) - << "incorrect value for amplitude_value[85], expected 177, is " - << last_msg_->amplitude_value[85]; - EXPECT_EQ( - get_asamplitude_value[86])>( - reinterpret_cast(&last_msg_->amplitude_value[86])), - 169) - << "incorrect value for amplitude_value[86], expected 169, is " - << last_msg_->amplitude_value[86]; - EXPECT_EQ( - get_asamplitude_value[87])>( - reinterpret_cast(&last_msg_->amplitude_value[87])), - 244) - << "incorrect value for amplitude_value[87], expected 244, is " - << last_msg_->amplitude_value[87]; - EXPECT_EQ( - get_asamplitude_value[88])>( - reinterpret_cast(&last_msg_->amplitude_value[88])), - 131) - << "incorrect value for amplitude_value[88], expected 131, is " - << last_msg_->amplitude_value[88]; - EXPECT_EQ( - get_asamplitude_value[89])>( - reinterpret_cast(&last_msg_->amplitude_value[89])), - 96) - << "incorrect value for amplitude_value[89], expected 96, is " - << last_msg_->amplitude_value[89]; - EXPECT_EQ( - get_asamplitude_value[90])>( - reinterpret_cast(&last_msg_->amplitude_value[90])), - 109) - << "incorrect value for amplitude_value[90], expected 109, is " - << last_msg_->amplitude_value[90]; - EXPECT_EQ( - get_asamplitude_value[91])>( - reinterpret_cast(&last_msg_->amplitude_value[91])), - 111) - << "incorrect value for amplitude_value[91], expected 111, is " - << last_msg_->amplitude_value[91]; - EXPECT_EQ( - get_asamplitude_value[92])>( - reinterpret_cast(&last_msg_->amplitude_value[92])), - 253) - << "incorrect value for amplitude_value[92], expected 253, is " - << last_msg_->amplitude_value[92]; - EXPECT_EQ( - get_asamplitude_value[93])>( - reinterpret_cast(&last_msg_->amplitude_value[93])), - 149) - << "incorrect value for amplitude_value[93], expected 149, is " - << last_msg_->amplitude_value[93]; - EXPECT_EQ( - get_asamplitude_value[94])>( - reinterpret_cast(&last_msg_->amplitude_value[94])), - 28) - << "incorrect value for amplitude_value[94], expected 28, is " - << last_msg_->amplitude_value[94]; - EXPECT_EQ( - get_asamplitude_value[95])>( - reinterpret_cast(&last_msg_->amplitude_value[95])), - 225) - << "incorrect value for amplitude_value[95], expected 225, is " - << last_msg_->amplitude_value[95]; - EXPECT_EQ( - get_asamplitude_value[96])>( - reinterpret_cast(&last_msg_->amplitude_value[96])), - 225) - << "incorrect value for amplitude_value[96], expected 225, is " - << last_msg_->amplitude_value[96]; - EXPECT_EQ( - get_asamplitude_value[97])>( - reinterpret_cast(&last_msg_->amplitude_value[97])), - 72) - << "incorrect value for amplitude_value[97], expected 72, is " - << last_msg_->amplitude_value[97]; - EXPECT_EQ( - get_asamplitude_value[98])>( - reinterpret_cast(&last_msg_->amplitude_value[98])), - 158) - << "incorrect value for amplitude_value[98], expected 158, is " - << last_msg_->amplitude_value[98]; - EXPECT_EQ( - get_asamplitude_value[99])>( - reinterpret_cast(&last_msg_->amplitude_value[99])), - 158) - << "incorrect value for amplitude_value[99], expected 158, is " - << last_msg_->amplitude_value[99]; - EXPECT_EQ( - get_asamplitude_value[100])>( - reinterpret_cast(&last_msg_->amplitude_value[100])), - 210) - << "incorrect value for amplitude_value[100], expected 210, is " - << last_msg_->amplitude_value[100]; - EXPECT_EQ( - get_asamplitude_value[101])>( - reinterpret_cast(&last_msg_->amplitude_value[101])), - 196) - << "incorrect value for amplitude_value[101], expected 196, is " - << last_msg_->amplitude_value[101]; - EXPECT_EQ( - get_asamplitude_value[102])>( - reinterpret_cast(&last_msg_->amplitude_value[102])), - 206) - << "incorrect value for amplitude_value[102], expected 206, is " - << last_msg_->amplitude_value[102]; - EXPECT_EQ( - get_asamplitude_value[103])>( - reinterpret_cast(&last_msg_->amplitude_value[103])), - 70) - << "incorrect value for amplitude_value[103], expected 70, is " - << last_msg_->amplitude_value[103]; - EXPECT_EQ( - get_asamplitude_value[104])>( - reinterpret_cast(&last_msg_->amplitude_value[104])), - 63) - << "incorrect value for amplitude_value[104], expected 63, is " - << last_msg_->amplitude_value[104]; - EXPECT_EQ( - get_asamplitude_value[105])>( - reinterpret_cast(&last_msg_->amplitude_value[105])), - 225) - << "incorrect value for amplitude_value[105], expected 225, is " - << last_msg_->amplitude_value[105]; - EXPECT_EQ( - get_asamplitude_value[106])>( - reinterpret_cast(&last_msg_->amplitude_value[106])), - 184) - << "incorrect value for amplitude_value[106], expected 184, is " - << last_msg_->amplitude_value[106]; - EXPECT_EQ( - get_asamplitude_value[107])>( - reinterpret_cast(&last_msg_->amplitude_value[107])), - 150) - << "incorrect value for amplitude_value[107], expected 150, is " - << last_msg_->amplitude_value[107]; - EXPECT_EQ( - get_asamplitude_value[108])>( - reinterpret_cast(&last_msg_->amplitude_value[108])), - 174) - << "incorrect value for amplitude_value[108], expected 174, is " - << last_msg_->amplitude_value[108]; - EXPECT_EQ( - get_asamplitude_value[109])>( - reinterpret_cast(&last_msg_->amplitude_value[109])), - 240) - << "incorrect value for amplitude_value[109], expected 240, is " - << last_msg_->amplitude_value[109]; - EXPECT_EQ( - get_asamplitude_value[110])>( - reinterpret_cast(&last_msg_->amplitude_value[110])), - 45) - << "incorrect value for amplitude_value[110], expected 45, is " - << last_msg_->amplitude_value[110]; - EXPECT_EQ( - get_asamplitude_value[111])>( - reinterpret_cast(&last_msg_->amplitude_value[111])), - 146) - << "incorrect value for amplitude_value[111], expected 146, is " - << last_msg_->amplitude_value[111]; - EXPECT_EQ( - get_asamplitude_value[112])>( - reinterpret_cast(&last_msg_->amplitude_value[112])), - 59) - << "incorrect value for amplitude_value[112], expected 59, is " - << last_msg_->amplitude_value[112]; - EXPECT_EQ( - get_asamplitude_value[113])>( - reinterpret_cast(&last_msg_->amplitude_value[113])), - 82) - << "incorrect value for amplitude_value[113], expected 82, is " - << last_msg_->amplitude_value[113]; - EXPECT_EQ( - get_asamplitude_value[114])>( - reinterpret_cast(&last_msg_->amplitude_value[114])), - 194) - << "incorrect value for amplitude_value[114], expected 194, is " - << last_msg_->amplitude_value[114]; - EXPECT_EQ( - get_asamplitude_value[115])>( - reinterpret_cast(&last_msg_->amplitude_value[115])), - 4) - << "incorrect value for amplitude_value[115], expected 4, is " - << last_msg_->amplitude_value[115]; - EXPECT_EQ( - get_asamplitude_value[116])>( - reinterpret_cast(&last_msg_->amplitude_value[116])), - 179) - << "incorrect value for amplitude_value[116], expected 179, is " - << last_msg_->amplitude_value[116]; - EXPECT_EQ( - get_asamplitude_value[117])>( - reinterpret_cast(&last_msg_->amplitude_value[117])), - 148) - << "incorrect value for amplitude_value[117], expected 148, is " - << last_msg_->amplitude_value[117]; - EXPECT_EQ( - get_asamplitude_value[118])>( - reinterpret_cast(&last_msg_->amplitude_value[118])), - 66) - << "incorrect value for amplitude_value[118], expected 66, is " - << last_msg_->amplitude_value[118]; - EXPECT_EQ( - get_asamplitude_value[119])>( - reinterpret_cast(&last_msg_->amplitude_value[119])), - 254) - << "incorrect value for amplitude_value[119], expected 254, is " - << last_msg_->amplitude_value[119]; - EXPECT_EQ( - get_asamplitude_value[120])>( - reinterpret_cast(&last_msg_->amplitude_value[120])), - 115) - << "incorrect value for amplitude_value[120], expected 115, is " - << last_msg_->amplitude_value[120]; - EXPECT_EQ( - get_asamplitude_value[121])>( - reinterpret_cast(&last_msg_->amplitude_value[121])), - 77) - << "incorrect value for amplitude_value[121], expected 77, is " - << last_msg_->amplitude_value[121]; - EXPECT_EQ( - get_asamplitude_value[122])>( - reinterpret_cast(&last_msg_->amplitude_value[122])), - 30) - << "incorrect value for amplitude_value[122], expected 30, is " - << last_msg_->amplitude_value[122]; - EXPECT_EQ( - get_asamplitude_value[123])>( - reinterpret_cast(&last_msg_->amplitude_value[123])), - 46) - << "incorrect value for amplitude_value[123], expected 46, is " - << last_msg_->amplitude_value[123]; - EXPECT_EQ( - get_asamplitude_value[124])>( - reinterpret_cast(&last_msg_->amplitude_value[124])), - 4) - << "incorrect value for amplitude_value[124], expected 4, is " - << last_msg_->amplitude_value[124]; - EXPECT_EQ( - get_asamplitude_value[125])>( - reinterpret_cast(&last_msg_->amplitude_value[125])), - 204) - << "incorrect value for amplitude_value[125], expected 204, is " - << last_msg_->amplitude_value[125]; - EXPECT_EQ( - get_asamplitude_value[126])>( - reinterpret_cast(&last_msg_->amplitude_value[126])), - 37) - << "incorrect value for amplitude_value[126], expected 37, is " - << last_msg_->amplitude_value[126]; - EXPECT_EQ( - get_asamplitude_value[127])>( - reinterpret_cast(&last_msg_->amplitude_value[127])), - 200) - << "incorrect value for amplitude_value[127], expected 200, is " - << last_msg_->amplitude_value[127]; - EXPECT_EQ( - get_asamplitude_value[128])>( - reinterpret_cast(&last_msg_->amplitude_value[128])), - 121) - << "incorrect value for amplitude_value[128], expected 121, is " - << last_msg_->amplitude_value[128]; - EXPECT_EQ( - get_asamplitude_value[129])>( - reinterpret_cast(&last_msg_->amplitude_value[129])), - 18) - << "incorrect value for amplitude_value[129], expected 18, is " - << last_msg_->amplitude_value[129]; - EXPECT_EQ( - get_asamplitude_value[130])>( - reinterpret_cast(&last_msg_->amplitude_value[130])), - 17) - << "incorrect value for amplitude_value[130], expected 17, is " - << last_msg_->amplitude_value[130]; - EXPECT_EQ( - get_asamplitude_value[131])>( - reinterpret_cast(&last_msg_->amplitude_value[131])), - 171) - << "incorrect value for amplitude_value[131], expected 171, is " - << last_msg_->amplitude_value[131]; - EXPECT_EQ( - get_asamplitude_value[132])>( - reinterpret_cast(&last_msg_->amplitude_value[132])), - 102) - << "incorrect value for amplitude_value[132], expected 102, is " - << last_msg_->amplitude_value[132]; - EXPECT_EQ( - get_asamplitude_value[133])>( - reinterpret_cast(&last_msg_->amplitude_value[133])), - 163) - << "incorrect value for amplitude_value[133], expected 163, is " - << last_msg_->amplitude_value[133]; - EXPECT_EQ( - get_asamplitude_value[134])>( - reinterpret_cast(&last_msg_->amplitude_value[134])), - 175) - << "incorrect value for amplitude_value[134], expected 175, is " - << last_msg_->amplitude_value[134]; - EXPECT_EQ( - get_asamplitude_value[135])>( - reinterpret_cast(&last_msg_->amplitude_value[135])), - 50) - << "incorrect value for amplitude_value[135], expected 50, is " - << last_msg_->amplitude_value[135]; - EXPECT_EQ( - get_asamplitude_value[136])>( - reinterpret_cast(&last_msg_->amplitude_value[136])), - 66) - << "incorrect value for amplitude_value[136], expected 66, is " - << last_msg_->amplitude_value[136]; - EXPECT_EQ( - get_asamplitude_value[137])>( - reinterpret_cast(&last_msg_->amplitude_value[137])), - 101) - << "incorrect value for amplitude_value[137], expected 101, is " - << last_msg_->amplitude_value[137]; - EXPECT_EQ( - get_asamplitude_value[138])>( - reinterpret_cast(&last_msg_->amplitude_value[138])), - 69) - << "incorrect value for amplitude_value[138], expected 69, is " - << last_msg_->amplitude_value[138]; - EXPECT_EQ( - get_asamplitude_value[139])>( - reinterpret_cast(&last_msg_->amplitude_value[139])), - 13) - << "incorrect value for amplitude_value[139], expected 13, is " - << last_msg_->amplitude_value[139]; - EXPECT_EQ( - get_asamplitude_value[140])>( - reinterpret_cast(&last_msg_->amplitude_value[140])), - 223) - << "incorrect value for amplitude_value[140], expected 223, is " - << last_msg_->amplitude_value[140]; - EXPECT_EQ( - get_asamplitude_value[141])>( - reinterpret_cast(&last_msg_->amplitude_value[141])), - 172) - << "incorrect value for amplitude_value[141], expected 172, is " - << last_msg_->amplitude_value[141]; - EXPECT_EQ( - get_asamplitude_value[142])>( - reinterpret_cast(&last_msg_->amplitude_value[142])), - 160) - << "incorrect value for amplitude_value[142], expected 160, is " - << last_msg_->amplitude_value[142]; - EXPECT_EQ( - get_asamplitude_value[143])>( - reinterpret_cast(&last_msg_->amplitude_value[143])), - 233) - << "incorrect value for amplitude_value[143], expected 233, is " - << last_msg_->amplitude_value[143]; - EXPECT_EQ( - get_asamplitude_value[144])>( - reinterpret_cast(&last_msg_->amplitude_value[144])), - 220) - << "incorrect value for amplitude_value[144], expected 220, is " - << last_msg_->amplitude_value[144]; - EXPECT_EQ( - get_asamplitude_value[145])>( - reinterpret_cast(&last_msg_->amplitude_value[145])), - 101) - << "incorrect value for amplitude_value[145], expected 101, is " - << last_msg_->amplitude_value[145]; - EXPECT_EQ( - get_asamplitude_value[146])>( - reinterpret_cast(&last_msg_->amplitude_value[146])), - 237) - << "incorrect value for amplitude_value[146], expected 237, is " - << last_msg_->amplitude_value[146]; - EXPECT_EQ( - get_asamplitude_value[147])>( - reinterpret_cast(&last_msg_->amplitude_value[147])), - 156) - << "incorrect value for amplitude_value[147], expected 156, is " - << last_msg_->amplitude_value[147]; - EXPECT_EQ( - get_asamplitude_value[148])>( - reinterpret_cast(&last_msg_->amplitude_value[148])), - 62) - << "incorrect value for amplitude_value[148], expected 62, is " - << last_msg_->amplitude_value[148]; - EXPECT_EQ( - get_asamplitude_value[149])>( - reinterpret_cast(&last_msg_->amplitude_value[149])), - 117) - << "incorrect value for amplitude_value[149], expected 117, is " - << last_msg_->amplitude_value[149]; - EXPECT_EQ( - get_asamplitude_value[150])>( - reinterpret_cast(&last_msg_->amplitude_value[150])), - 47) - << "incorrect value for amplitude_value[150], expected 47, is " - << last_msg_->amplitude_value[150]; - EXPECT_EQ( - get_asamplitude_value[151])>( - reinterpret_cast(&last_msg_->amplitude_value[151])), - 143) - << "incorrect value for amplitude_value[151], expected 143, is " - << last_msg_->amplitude_value[151]; - EXPECT_EQ( - get_asamplitude_value[152])>( - reinterpret_cast(&last_msg_->amplitude_value[152])), - 94) - << "incorrect value for amplitude_value[152], expected 94, is " - << last_msg_->amplitude_value[152]; - EXPECT_EQ( - get_asamplitude_value[153])>( - reinterpret_cast(&last_msg_->amplitude_value[153])), - 135) - << "incorrect value for amplitude_value[153], expected 135, is " - << last_msg_->amplitude_value[153]; - EXPECT_EQ( - get_asamplitude_value[154])>( - reinterpret_cast(&last_msg_->amplitude_value[154])), - 22) - << "incorrect value for amplitude_value[154], expected 22, is " - << last_msg_->amplitude_value[154]; - EXPECT_EQ( - get_asamplitude_value[155])>( - reinterpret_cast(&last_msg_->amplitude_value[155])), - 155) - << "incorrect value for amplitude_value[155], expected 155, is " - << last_msg_->amplitude_value[155]; - EXPECT_EQ( - get_asamplitude_value[156])>( - reinterpret_cast(&last_msg_->amplitude_value[156])), - 113) - << "incorrect value for amplitude_value[156], expected 113, is " - << last_msg_->amplitude_value[156]; - EXPECT_EQ( - get_asamplitude_value[157])>( - reinterpret_cast(&last_msg_->amplitude_value[157])), - 110) - << "incorrect value for amplitude_value[157], expected 110, is " - << last_msg_->amplitude_value[157]; - EXPECT_EQ( - get_asamplitude_value[158])>( - reinterpret_cast(&last_msg_->amplitude_value[158])), - 15) - << "incorrect value for amplitude_value[158], expected 15, is " - << last_msg_->amplitude_value[158]; - EXPECT_EQ( - get_asamplitude_value[159])>( - reinterpret_cast(&last_msg_->amplitude_value[159])), - 243) - << "incorrect value for amplitude_value[159], expected 243, is " - << last_msg_->amplitude_value[159]; - EXPECT_EQ( - get_asamplitude_value[160])>( - reinterpret_cast(&last_msg_->amplitude_value[160])), - 141) - << "incorrect value for amplitude_value[160], expected 141, is " - << last_msg_->amplitude_value[160]; - EXPECT_EQ( - get_asamplitude_value[161])>( - reinterpret_cast(&last_msg_->amplitude_value[161])), - 227) - << "incorrect value for amplitude_value[161], expected 227, is " - << last_msg_->amplitude_value[161]; - EXPECT_EQ( - get_asamplitude_value[162])>( - reinterpret_cast(&last_msg_->amplitude_value[162])), - 46) - << "incorrect value for amplitude_value[162], expected 46, is " - << last_msg_->amplitude_value[162]; - EXPECT_EQ( - get_asamplitude_value[163])>( - reinterpret_cast(&last_msg_->amplitude_value[163])), - 143) - << "incorrect value for amplitude_value[163], expected 143, is " - << last_msg_->amplitude_value[163]; - EXPECT_EQ( - get_asamplitude_value[164])>( - reinterpret_cast(&last_msg_->amplitude_value[164])), - 227) - << "incorrect value for amplitude_value[164], expected 227, is " - << last_msg_->amplitude_value[164]; - EXPECT_EQ( - get_asamplitude_value[165])>( - reinterpret_cast(&last_msg_->amplitude_value[165])), - 209) - << "incorrect value for amplitude_value[165], expected 209, is " - << last_msg_->amplitude_value[165]; - EXPECT_EQ( - get_asamplitude_value[166])>( - reinterpret_cast(&last_msg_->amplitude_value[166])), - 249) - << "incorrect value for amplitude_value[166], expected 249, is " - << last_msg_->amplitude_value[166]; - EXPECT_EQ( - get_asamplitude_value[167])>( - reinterpret_cast(&last_msg_->amplitude_value[167])), - 2) - << "incorrect value for amplitude_value[167], expected 2, is " - << last_msg_->amplitude_value[167]; - EXPECT_EQ( - get_asamplitude_value[168])>( - reinterpret_cast(&last_msg_->amplitude_value[168])), - 153) - << "incorrect value for amplitude_value[168], expected 153, is " - << last_msg_->amplitude_value[168]; - EXPECT_EQ( - get_asamplitude_value[169])>( - reinterpret_cast(&last_msg_->amplitude_value[169])), - 168) - << "incorrect value for amplitude_value[169], expected 168, is " - << last_msg_->amplitude_value[169]; - EXPECT_EQ( - get_asamplitude_value[170])>( - reinterpret_cast(&last_msg_->amplitude_value[170])), - 131) - << "incorrect value for amplitude_value[170], expected 131, is " - << last_msg_->amplitude_value[170]; - EXPECT_EQ( - get_asamplitude_value[171])>( - reinterpret_cast(&last_msg_->amplitude_value[171])), - 249) - << "incorrect value for amplitude_value[171], expected 249, is " - << last_msg_->amplitude_value[171]; - EXPECT_EQ( - get_asamplitude_value[172])>( - reinterpret_cast(&last_msg_->amplitude_value[172])), - 160) - << "incorrect value for amplitude_value[172], expected 160, is " - << last_msg_->amplitude_value[172]; - EXPECT_EQ( - get_asamplitude_value[173])>( - reinterpret_cast(&last_msg_->amplitude_value[173])), - 88) - << "incorrect value for amplitude_value[173], expected 88, is " - << last_msg_->amplitude_value[173]; - EXPECT_EQ( - get_asamplitude_value[174])>( - reinterpret_cast(&last_msg_->amplitude_value[174])), - 38) - << "incorrect value for amplitude_value[174], expected 38, is " - << last_msg_->amplitude_value[174]; - EXPECT_EQ( - get_asamplitude_value[175])>( - reinterpret_cast(&last_msg_->amplitude_value[175])), - 117) - << "incorrect value for amplitude_value[175], expected 117, is " - << last_msg_->amplitude_value[175]; - EXPECT_EQ( - get_asamplitude_value[176])>( - reinterpret_cast(&last_msg_->amplitude_value[176])), - 129) - << "incorrect value for amplitude_value[176], expected 129, is " - << last_msg_->amplitude_value[176]; - EXPECT_EQ( - get_asamplitude_value[177])>( - reinterpret_cast(&last_msg_->amplitude_value[177])), - 57) - << "incorrect value for amplitude_value[177], expected 57, is " - << last_msg_->amplitude_value[177]; - EXPECT_EQ( - get_asamplitude_value[178])>( - reinterpret_cast(&last_msg_->amplitude_value[178])), - 40) - << "incorrect value for amplitude_value[178], expected 40, is " - << last_msg_->amplitude_value[178]; - EXPECT_EQ( - get_asamplitude_value[179])>( - reinterpret_cast(&last_msg_->amplitude_value[179])), - 109) - << "incorrect value for amplitude_value[179], expected 109, is " - << last_msg_->amplitude_value[179]; - EXPECT_EQ( - get_asamplitude_value[180])>( - reinterpret_cast(&last_msg_->amplitude_value[180])), - 209) - << "incorrect value for amplitude_value[180], expected 209, is " - << last_msg_->amplitude_value[180]; - EXPECT_EQ( - get_asamplitude_value[181])>( - reinterpret_cast(&last_msg_->amplitude_value[181])), - 177) - << "incorrect value for amplitude_value[181], expected 177, is " - << last_msg_->amplitude_value[181]; - EXPECT_EQ( - get_asamplitude_value[182])>( - reinterpret_cast(&last_msg_->amplitude_value[182])), - 38) - << "incorrect value for amplitude_value[182], expected 38, is " - << last_msg_->amplitude_value[182]; - EXPECT_EQ( - get_asamplitude_value[183])>( - reinterpret_cast(&last_msg_->amplitude_value[183])), - 47) - << "incorrect value for amplitude_value[183], expected 47, is " - << last_msg_->amplitude_value[183]; - EXPECT_EQ( - get_asamplitude_value[184])>( - reinterpret_cast(&last_msg_->amplitude_value[184])), - 12) - << "incorrect value for amplitude_value[184], expected 12, is " - << last_msg_->amplitude_value[184]; - EXPECT_EQ( - get_asamplitude_value[185])>( - reinterpret_cast(&last_msg_->amplitude_value[185])), - 15) - << "incorrect value for amplitude_value[185], expected 15, is " - << last_msg_->amplitude_value[185]; - EXPECT_EQ( - get_asamplitude_value[186])>( - reinterpret_cast(&last_msg_->amplitude_value[186])), - 16) - << "incorrect value for amplitude_value[186], expected 16, is " - << last_msg_->amplitude_value[186]; - EXPECT_EQ( - get_asamplitude_value[187])>( - reinterpret_cast(&last_msg_->amplitude_value[187])), - 9) - << "incorrect value for amplitude_value[187], expected 9, is " - << last_msg_->amplitude_value[187]; - EXPECT_EQ( - get_asamplitude_value[188])>( - reinterpret_cast(&last_msg_->amplitude_value[188])), - 175) - << "incorrect value for amplitude_value[188], expected 175, is " - << last_msg_->amplitude_value[188]; - EXPECT_EQ( - get_asamplitude_value[189])>( - reinterpret_cast(&last_msg_->amplitude_value[189])), - 69) - << "incorrect value for amplitude_value[189], expected 69, is " - << last_msg_->amplitude_value[189]; - EXPECT_EQ( - get_asamplitude_value[190])>( - reinterpret_cast(&last_msg_->amplitude_value[190])), - 70) - << "incorrect value for amplitude_value[190], expected 70, is " - << last_msg_->amplitude_value[190]; - EXPECT_EQ( - get_asamplitude_value[191])>( - reinterpret_cast(&last_msg_->amplitude_value[191])), - 182) - << "incorrect value for amplitude_value[191], expected 182, is " - << last_msg_->amplitude_value[191]; - EXPECT_EQ( - get_asamplitude_value[192])>( - reinterpret_cast(&last_msg_->amplitude_value[192])), - 239) - << "incorrect value for amplitude_value[192], expected 239, is " - << last_msg_->amplitude_value[192]; - EXPECT_EQ( - get_asamplitude_value[193])>( - reinterpret_cast(&last_msg_->amplitude_value[193])), - 117) - << "incorrect value for amplitude_value[193], expected 117, is " - << last_msg_->amplitude_value[193]; - EXPECT_EQ( - get_asamplitude_value[194])>( - reinterpret_cast(&last_msg_->amplitude_value[194])), - 135) - << "incorrect value for amplitude_value[194], expected 135, is " - << last_msg_->amplitude_value[194]; - EXPECT_EQ( - get_asamplitude_value[195])>( - reinterpret_cast(&last_msg_->amplitude_value[195])), - 6) - << "incorrect value for amplitude_value[195], expected 6, is " - << last_msg_->amplitude_value[195]; - EXPECT_EQ( - get_asamplitude_value[196])>( - reinterpret_cast(&last_msg_->amplitude_value[196])), - 71) - << "incorrect value for amplitude_value[196], expected 71, is " - << last_msg_->amplitude_value[196]; - EXPECT_EQ( - get_asamplitude_value[197])>( - reinterpret_cast(&last_msg_->amplitude_value[197])), - 99) - << "incorrect value for amplitude_value[197], expected 99, is " - << last_msg_->amplitude_value[197]; - EXPECT_EQ( - get_asamplitude_value[198])>( - reinterpret_cast(&last_msg_->amplitude_value[198])), - 230) - << "incorrect value for amplitude_value[198], expected 230, is " - << last_msg_->amplitude_value[198]; - EXPECT_EQ( - get_asamplitude_value[199])>( - reinterpret_cast(&last_msg_->amplitude_value[199])), - 115) - << "incorrect value for amplitude_value[199], expected 115, is " - << last_msg_->amplitude_value[199]; - EXPECT_EQ( - get_asamplitude_value[200])>( - reinterpret_cast(&last_msg_->amplitude_value[200])), - 2) - << "incorrect value for amplitude_value[200], expected 2, is " - << last_msg_->amplitude_value[200]; - EXPECT_EQ( - get_asamplitude_value[201])>( - reinterpret_cast(&last_msg_->amplitude_value[201])), - 71) - << "incorrect value for amplitude_value[201], expected 71, is " - << last_msg_->amplitude_value[201]; - EXPECT_EQ( - get_asamplitude_value[202])>( - reinterpret_cast(&last_msg_->amplitude_value[202])), - 165) - << "incorrect value for amplitude_value[202], expected 165, is " - << last_msg_->amplitude_value[202]; - EXPECT_EQ( - get_asamplitude_value[203])>( - reinterpret_cast(&last_msg_->amplitude_value[203])), - 228) - << "incorrect value for amplitude_value[203], expected 228, is " - << last_msg_->amplitude_value[203]; - EXPECT_EQ( - get_asamplitude_value[204])>( - reinterpret_cast(&last_msg_->amplitude_value[204])), - 123) - << "incorrect value for amplitude_value[204], expected 123, is " - << last_msg_->amplitude_value[204]; - EXPECT_EQ( - get_asamplitude_value[205])>( - reinterpret_cast(&last_msg_->amplitude_value[205])), - 210) - << "incorrect value for amplitude_value[205], expected 210, is " - << last_msg_->amplitude_value[205]; - EXPECT_EQ( - get_asamplitude_value[206])>( - reinterpret_cast(&last_msg_->amplitude_value[206])), - 168) - << "incorrect value for amplitude_value[206], expected 168, is " - << last_msg_->amplitude_value[206]; - EXPECT_EQ( - get_asamplitude_value[207])>( - reinterpret_cast(&last_msg_->amplitude_value[207])), - 90) - << "incorrect value for amplitude_value[207], expected 90, is " - << last_msg_->amplitude_value[207]; - EXPECT_EQ( - get_asamplitude_value[208])>( - reinterpret_cast(&last_msg_->amplitude_value[208])), - 124) - << "incorrect value for amplitude_value[208], expected 124, is " - << last_msg_->amplitude_value[208]; - EXPECT_EQ( - get_asamplitude_value[209])>( - reinterpret_cast(&last_msg_->amplitude_value[209])), - 20) - << "incorrect value for amplitude_value[209], expected 20, is " - << last_msg_->amplitude_value[209]; - EXPECT_EQ( - get_asamplitude_value[210])>( - reinterpret_cast(&last_msg_->amplitude_value[210])), - 7) - << "incorrect value for amplitude_value[210], expected 7, is " - << last_msg_->amplitude_value[210]; - EXPECT_EQ( - get_asamplitude_value[211])>( - reinterpret_cast(&last_msg_->amplitude_value[211])), - 220) - << "incorrect value for amplitude_value[211], expected 220, is " - << last_msg_->amplitude_value[211]; - EXPECT_EQ( - get_asamplitude_value[212])>( - reinterpret_cast(&last_msg_->amplitude_value[212])), - 144) - << "incorrect value for amplitude_value[212], expected 144, is " - << last_msg_->amplitude_value[212]; - EXPECT_EQ( - get_asamplitude_value[213])>( - reinterpret_cast(&last_msg_->amplitude_value[213])), - 168) - << "incorrect value for amplitude_value[213], expected 168, is " - << last_msg_->amplitude_value[213]; - EXPECT_EQ( - get_asamplitude_value[214])>( - reinterpret_cast(&last_msg_->amplitude_value[214])), - 69) - << "incorrect value for amplitude_value[214], expected 69, is " - << last_msg_->amplitude_value[214]; - EXPECT_EQ( - get_asamplitude_value[215])>( - reinterpret_cast(&last_msg_->amplitude_value[215])), - 22) - << "incorrect value for amplitude_value[215], expected 22, is " - << last_msg_->amplitude_value[215]; - EXPECT_EQ( - get_asamplitude_value[216])>( - reinterpret_cast(&last_msg_->amplitude_value[216])), - 72) - << "incorrect value for amplitude_value[216], expected 72, is " - << last_msg_->amplitude_value[216]; - EXPECT_EQ( - get_asamplitude_value[217])>( - reinterpret_cast(&last_msg_->amplitude_value[217])), - 162) - << "incorrect value for amplitude_value[217], expected 162, is " - << last_msg_->amplitude_value[217]; - EXPECT_EQ( - get_asamplitude_value[218])>( - reinterpret_cast(&last_msg_->amplitude_value[218])), - 69) - << "incorrect value for amplitude_value[218], expected 69, is " - << last_msg_->amplitude_value[218]; - EXPECT_EQ( - get_asamplitude_value[219])>( - reinterpret_cast(&last_msg_->amplitude_value[219])), - 111) - << "incorrect value for amplitude_value[219], expected 111, is " - << last_msg_->amplitude_value[219]; - EXPECT_EQ( - get_asamplitude_value[220])>( - reinterpret_cast(&last_msg_->amplitude_value[220])), - 91) - << "incorrect value for amplitude_value[220], expected 91, is " - << last_msg_->amplitude_value[220]; - EXPECT_EQ( - get_asamplitude_value[221])>( - reinterpret_cast(&last_msg_->amplitude_value[221])), - 251) - << "incorrect value for amplitude_value[221], expected 251, is " - << last_msg_->amplitude_value[221]; - EXPECT_EQ( - get_asamplitude_value[222])>( - reinterpret_cast(&last_msg_->amplitude_value[222])), - 72) - << "incorrect value for amplitude_value[222], expected 72, is " - << last_msg_->amplitude_value[222]; - EXPECT_EQ( - get_asamplitude_value[223])>( - reinterpret_cast(&last_msg_->amplitude_value[223])), - 220) - << "incorrect value for amplitude_value[223], expected 220, is " - << last_msg_->amplitude_value[223]; - EXPECT_EQ( - get_asamplitude_value[224])>( - reinterpret_cast(&last_msg_->amplitude_value[224])), - 28) - << "incorrect value for amplitude_value[224], expected 28, is " - << last_msg_->amplitude_value[224]; - EXPECT_EQ( - get_asamplitude_value[225])>( - reinterpret_cast(&last_msg_->amplitude_value[225])), - 119) - << "incorrect value for amplitude_value[225], expected 119, is " - << last_msg_->amplitude_value[225]; - EXPECT_EQ( - get_asamplitude_value[226])>( - reinterpret_cast(&last_msg_->amplitude_value[226])), - 150) - << "incorrect value for amplitude_value[226], expected 150, is " - << last_msg_->amplitude_value[226]; - EXPECT_EQ(get_aschannel_tag)>( - reinterpret_cast(&last_msg_->channel_tag)), - 35146) - << "incorrect value for channel_tag, expected 35146, is " - << last_msg_->channel_tag; - EXPECT_LT((last_msg_->freq_ref * 100 - 7737.20019531 * 100), 0.05) - << "incorrect value for freq_ref, expected 7737.20019531, is " - << last_msg_->freq_ref; - EXPECT_LT((last_msg_->freq_step * 100 - 8226.20019531 * 100), 0.05) - << "incorrect value for freq_step, expected 8226.20019531, is " - << last_msg_->freq_step; - EXPECT_EQ(get_ast.ns_residual)>( - reinterpret_cast(&last_msg_->t.ns_residual)), - -1479025396) - << "incorrect value for t.ns_residual, expected -1479025396, is " - << last_msg_->t.ns_residual; - EXPECT_EQ(get_ast.tow)>( - reinterpret_cast(&last_msg_->t.tow)), - 1227027783) - << "incorrect value for t.tow, expected 1227027783, is " - << last_msg_->t.tow; - EXPECT_EQ(get_ast.wn)>( - reinterpret_cast(&last_msg_->t.wn)), - 5075) - << "incorrect value for t.wn, expected 5075, is " << last_msg_->t.wn; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgSpecanDep.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgSpecanDep.cc deleted file mode 100644 index 8a9ae02056..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgSpecanDep.cc +++ /dev/null @@ -1,2941 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgSpecanDep.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgSpecanDep0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgSpecanDep0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_specan_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_specan_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgSpecanDep0, Test) { - uint8_t encoded_frame[] = { - 85, 80, 0, 112, 217, 255, 246, 22, 221, 56, 37, 59, 45, 27, 154, - 97, 198, 69, 154, 1, 144, 69, 205, 20, 18, 70, 51, 211, 89, 69, - 240, 14, 179, 186, 227, 244, 173, 240, 182, 71, 166, 117, 196, 13, 44, - 27, 33, 28, 67, 254, 3, 249, 92, 44, 122, 169, 77, 186, 68, 135, - 63, 168, 162, 89, 36, 186, 99, 63, 105, 116, 216, 44, 67, 212, 156, - 75, 81, 53, 250, 225, 23, 205, 26, 34, 119, 50, 101, 64, 7, 231, - 124, 183, 203, 102, 234, 84, 83, 208, 23, 68, 54, 179, 98, 96, 116, - 244, 246, 94, 104, 94, 13, 56, 210, 18, 191, 22, 133, 81, 153, 159, - 161, 219, 59, 21, 164, 121, 145, 203, 171, 132, 57, 180, 102, 101, 11, - 229, 175, 145, 73, 72, 124, 4, 184, 228, 61, 234, 218, 62, 226, 217, - 193, 7, 109, 44, 83, 201, 20, 101, 9, 140, 186, 162, 81, 91, 30, - 231, 161, 81, 216, 114, 60, 231, 163, 163, 49, 237, 244, 185, 240, 89, - 143, 174, 165, 211, 241, 13, 16, 61, 141, 101, 89, 37, 117, 189, 86, - 118, 176, 228, 12, 14, 119, 135, 129, 243, 50, 29, 207, 198, 117, 100, - 225, 6, 139, 110, 39, 210, 68, 199, 43, 132, 64, 17, 51, 173, 181, - 12, 140, 16, 247, 84, 183, 105, 39, 157, 77, 30, 205, 194, 59, 64, - 241, 183, 238, 105, 181, 170, 45, 8, 166, 164, 238, 83, 148, 173, 108, - 228, 67, 89, 189, 67, 26, 39, 216, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_specan_dep_t *test_msg = (msg_specan_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->amplitude_ref = 9349.2001953125; - test_msg->amplitude_unit = 3485.199951171875; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[0] = 240; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[1] = 14; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[2] = 179; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[3] = 186; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[4] = 227; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[5] = 244; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[6] = 173; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[7] = 240; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[8] = 182; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[9] = 71; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[10] = 166; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[11] = 117; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[12] = 196; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[13] = 13; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[14] = 44; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[15] = 27; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[16] = 33; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[17] = 28; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[18] = 67; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[19] = 254; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[20] = 3; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[21] = 249; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[22] = 92; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[23] = 44; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[24] = 122; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[25] = 169; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[26] = 77; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[27] = 186; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[28] = 68; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[29] = 135; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[30] = 63; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[31] = 168; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[32] = 162; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[33] = 89; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[34] = 36; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[35] = 186; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[36] = 99; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[37] = 63; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[38] = 105; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[39] = 116; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[40] = 216; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[41] = 44; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[42] = 67; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[43] = 212; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[44] = 156; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[45] = 75; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[46] = 81; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[47] = 53; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[48] = 250; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[49] = 225; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[50] = 23; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[51] = 205; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[52] = 26; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[53] = 34; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[54] = 119; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[55] = 50; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[56] = 101; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[57] = 64; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[58] = 7; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[59] = 231; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[60] = 124; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[61] = 183; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[62] = 203; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[63] = 102; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[64] = 234; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[65] = 84; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[66] = 83; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[67] = 208; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[68] = 23; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[69] = 68; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[70] = 54; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[71] = 179; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[72] = 98; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[73] = 96; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[74] = 116; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[75] = 244; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[76] = 246; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[77] = 94; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[78] = 104; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[79] = 94; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[80] = 13; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[81] = 56; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[82] = 210; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[83] = 18; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[84] = 191; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[85] = 22; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[86] = 133; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[87] = 81; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[88] = 153; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[89] = 159; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[90] = 161; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[91] = 219; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[92] = 59; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[93] = 21; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[94] = 164; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[95] = 121; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[96] = 145; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[97] = 203; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[98] = 171; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[99] = 132; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[100] = 57; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[101] = 180; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[102] = 102; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[103] = 101; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[104] = 11; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[105] = 229; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[106] = 175; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[107] = 145; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[108] = 73; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[109] = 72; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[110] = 124; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[111] = 4; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[112] = 184; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[113] = 228; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[114] = 61; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[115] = 234; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[116] = 218; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[117] = 62; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[118] = 226; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[119] = 217; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[120] = 193; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[121] = 7; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[122] = 109; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[123] = 44; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[124] = 83; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[125] = 201; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[126] = 20; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[127] = 101; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[128] = 9; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[129] = 140; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[130] = 186; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[131] = 162; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[132] = 81; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[133] = 91; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[134] = 30; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[135] = 231; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[136] = 161; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[137] = 81; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[138] = 216; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[139] = 114; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[140] = 60; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[141] = 231; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[142] = 163; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[143] = 163; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[144] = 49; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[145] = 237; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[146] = 244; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[147] = 185; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[148] = 240; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[149] = 89; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[150] = 143; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[151] = 174; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[152] = 165; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[153] = 211; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[154] = 241; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[155] = 13; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[156] = 16; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[157] = 61; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[158] = 141; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[159] = 101; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[160] = 89; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[161] = 37; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[162] = 117; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[163] = 189; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[164] = 86; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[165] = 118; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[166] = 176; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[167] = 228; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[168] = 12; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[169] = 14; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[170] = 119; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[171] = 135; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[172] = 129; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[173] = 243; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[174] = 50; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[175] = 29; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[176] = 207; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[177] = 198; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[178] = 117; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[179] = 100; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[180] = 225; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[181] = 6; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[182] = 139; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[183] = 110; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[184] = 39; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[185] = 210; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[186] = 68; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[187] = 199; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[188] = 43; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[189] = 132; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[190] = 64; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[191] = 17; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[192] = 51; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[193] = 173; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[194] = 181; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[195] = 12; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[196] = 140; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[197] = 16; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[198] = 247; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[199] = 84; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[200] = 183; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[201] = 105; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[202] = 39; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[203] = 157; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[204] = 77; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[205] = 30; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[206] = 205; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[207] = 194; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[208] = 59; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[209] = 64; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[210] = 241; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[211] = 183; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[212] = 238; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[213] = 105; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[214] = 181; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[215] = 170; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[216] = 45; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[217] = 8; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[218] = 166; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[219] = 164; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[220] = 238; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[221] = 83; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[222] = 148; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[223] = 173; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[224] = 108; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[225] = 228; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[226] = 67; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[227] = 89; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[228] = 189; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[229] = 67; - if (sizeof(test_msg->amplitude_value) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->amplitude_value[0])); - } - test_msg->amplitude_value[230] = 26; - test_msg->channel_tag = 5878; - test_msg->freq_ref = 6348.2001953125; - test_msg->freq_step = 4608.2001953125; - test_msg->t.tow = 992295133; - test_msg->t.wn = 6957; - - EXPECT_EQ(send_message(0x50, 55664, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55664); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->amplitude_ref * 100 - 9349.20019531 * 100), 0.05) - << "incorrect value for amplitude_ref, expected 9349.20019531, is " - << last_msg_->amplitude_ref; - EXPECT_LT((last_msg_->amplitude_unit * 100 - 3485.19995117 * 100), 0.05) - << "incorrect value for amplitude_unit, expected 3485.19995117, is " - << last_msg_->amplitude_unit; - EXPECT_EQ( - get_asamplitude_value[0])>( - reinterpret_cast(&last_msg_->amplitude_value[0])), - 240) - << "incorrect value for amplitude_value[0], expected 240, is " - << last_msg_->amplitude_value[0]; - EXPECT_EQ( - get_asamplitude_value[1])>( - reinterpret_cast(&last_msg_->amplitude_value[1])), - 14) - << "incorrect value for amplitude_value[1], expected 14, is " - << last_msg_->amplitude_value[1]; - EXPECT_EQ( - get_asamplitude_value[2])>( - reinterpret_cast(&last_msg_->amplitude_value[2])), - 179) - << "incorrect value for amplitude_value[2], expected 179, is " - << last_msg_->amplitude_value[2]; - EXPECT_EQ( - get_asamplitude_value[3])>( - reinterpret_cast(&last_msg_->amplitude_value[3])), - 186) - << "incorrect value for amplitude_value[3], expected 186, is " - << last_msg_->amplitude_value[3]; - EXPECT_EQ( - get_asamplitude_value[4])>( - reinterpret_cast(&last_msg_->amplitude_value[4])), - 227) - << "incorrect value for amplitude_value[4], expected 227, is " - << last_msg_->amplitude_value[4]; - EXPECT_EQ( - get_asamplitude_value[5])>( - reinterpret_cast(&last_msg_->amplitude_value[5])), - 244) - << "incorrect value for amplitude_value[5], expected 244, is " - << last_msg_->amplitude_value[5]; - EXPECT_EQ( - get_asamplitude_value[6])>( - reinterpret_cast(&last_msg_->amplitude_value[6])), - 173) - << "incorrect value for amplitude_value[6], expected 173, is " - << last_msg_->amplitude_value[6]; - EXPECT_EQ( - get_asamplitude_value[7])>( - reinterpret_cast(&last_msg_->amplitude_value[7])), - 240) - << "incorrect value for amplitude_value[7], expected 240, is " - << last_msg_->amplitude_value[7]; - EXPECT_EQ( - get_asamplitude_value[8])>( - reinterpret_cast(&last_msg_->amplitude_value[8])), - 182) - << "incorrect value for amplitude_value[8], expected 182, is " - << last_msg_->amplitude_value[8]; - EXPECT_EQ( - get_asamplitude_value[9])>( - reinterpret_cast(&last_msg_->amplitude_value[9])), - 71) - << "incorrect value for amplitude_value[9], expected 71, is " - << last_msg_->amplitude_value[9]; - EXPECT_EQ( - get_asamplitude_value[10])>( - reinterpret_cast(&last_msg_->amplitude_value[10])), - 166) - << "incorrect value for amplitude_value[10], expected 166, is " - << last_msg_->amplitude_value[10]; - EXPECT_EQ( - get_asamplitude_value[11])>( - reinterpret_cast(&last_msg_->amplitude_value[11])), - 117) - << "incorrect value for amplitude_value[11], expected 117, is " - << last_msg_->amplitude_value[11]; - EXPECT_EQ( - get_asamplitude_value[12])>( - reinterpret_cast(&last_msg_->amplitude_value[12])), - 196) - << "incorrect value for amplitude_value[12], expected 196, is " - << last_msg_->amplitude_value[12]; - EXPECT_EQ( - get_asamplitude_value[13])>( - reinterpret_cast(&last_msg_->amplitude_value[13])), - 13) - << "incorrect value for amplitude_value[13], expected 13, is " - << last_msg_->amplitude_value[13]; - EXPECT_EQ( - get_asamplitude_value[14])>( - reinterpret_cast(&last_msg_->amplitude_value[14])), - 44) - << "incorrect value for amplitude_value[14], expected 44, is " - << last_msg_->amplitude_value[14]; - EXPECT_EQ( - get_asamplitude_value[15])>( - reinterpret_cast(&last_msg_->amplitude_value[15])), - 27) - << "incorrect value for amplitude_value[15], expected 27, is " - << last_msg_->amplitude_value[15]; - EXPECT_EQ( - get_asamplitude_value[16])>( - reinterpret_cast(&last_msg_->amplitude_value[16])), - 33) - << "incorrect value for amplitude_value[16], expected 33, is " - << last_msg_->amplitude_value[16]; - EXPECT_EQ( - get_asamplitude_value[17])>( - reinterpret_cast(&last_msg_->amplitude_value[17])), - 28) - << "incorrect value for amplitude_value[17], expected 28, is " - << last_msg_->amplitude_value[17]; - EXPECT_EQ( - get_asamplitude_value[18])>( - reinterpret_cast(&last_msg_->amplitude_value[18])), - 67) - << "incorrect value for amplitude_value[18], expected 67, is " - << last_msg_->amplitude_value[18]; - EXPECT_EQ( - get_asamplitude_value[19])>( - reinterpret_cast(&last_msg_->amplitude_value[19])), - 254) - << "incorrect value for amplitude_value[19], expected 254, is " - << last_msg_->amplitude_value[19]; - EXPECT_EQ( - get_asamplitude_value[20])>( - reinterpret_cast(&last_msg_->amplitude_value[20])), - 3) - << "incorrect value for amplitude_value[20], expected 3, is " - << last_msg_->amplitude_value[20]; - EXPECT_EQ( - get_asamplitude_value[21])>( - reinterpret_cast(&last_msg_->amplitude_value[21])), - 249) - << "incorrect value for amplitude_value[21], expected 249, is " - << last_msg_->amplitude_value[21]; - EXPECT_EQ( - get_asamplitude_value[22])>( - reinterpret_cast(&last_msg_->amplitude_value[22])), - 92) - << "incorrect value for amplitude_value[22], expected 92, is " - << last_msg_->amplitude_value[22]; - EXPECT_EQ( - get_asamplitude_value[23])>( - reinterpret_cast(&last_msg_->amplitude_value[23])), - 44) - << "incorrect value for amplitude_value[23], expected 44, is " - << last_msg_->amplitude_value[23]; - EXPECT_EQ( - get_asamplitude_value[24])>( - reinterpret_cast(&last_msg_->amplitude_value[24])), - 122) - << "incorrect value for amplitude_value[24], expected 122, is " - << last_msg_->amplitude_value[24]; - EXPECT_EQ( - get_asamplitude_value[25])>( - reinterpret_cast(&last_msg_->amplitude_value[25])), - 169) - << "incorrect value for amplitude_value[25], expected 169, is " - << last_msg_->amplitude_value[25]; - EXPECT_EQ( - get_asamplitude_value[26])>( - reinterpret_cast(&last_msg_->amplitude_value[26])), - 77) - << "incorrect value for amplitude_value[26], expected 77, is " - << last_msg_->amplitude_value[26]; - EXPECT_EQ( - get_asamplitude_value[27])>( - reinterpret_cast(&last_msg_->amplitude_value[27])), - 186) - << "incorrect value for amplitude_value[27], expected 186, is " - << last_msg_->amplitude_value[27]; - EXPECT_EQ( - get_asamplitude_value[28])>( - reinterpret_cast(&last_msg_->amplitude_value[28])), - 68) - << "incorrect value for amplitude_value[28], expected 68, is " - << last_msg_->amplitude_value[28]; - EXPECT_EQ( - get_asamplitude_value[29])>( - reinterpret_cast(&last_msg_->amplitude_value[29])), - 135) - << "incorrect value for amplitude_value[29], expected 135, is " - << last_msg_->amplitude_value[29]; - EXPECT_EQ( - get_asamplitude_value[30])>( - reinterpret_cast(&last_msg_->amplitude_value[30])), - 63) - << "incorrect value for amplitude_value[30], expected 63, is " - << last_msg_->amplitude_value[30]; - EXPECT_EQ( - get_asamplitude_value[31])>( - reinterpret_cast(&last_msg_->amplitude_value[31])), - 168) - << "incorrect value for amplitude_value[31], expected 168, is " - << last_msg_->amplitude_value[31]; - EXPECT_EQ( - get_asamplitude_value[32])>( - reinterpret_cast(&last_msg_->amplitude_value[32])), - 162) - << "incorrect value for amplitude_value[32], expected 162, is " - << last_msg_->amplitude_value[32]; - EXPECT_EQ( - get_asamplitude_value[33])>( - reinterpret_cast(&last_msg_->amplitude_value[33])), - 89) - << "incorrect value for amplitude_value[33], expected 89, is " - << last_msg_->amplitude_value[33]; - EXPECT_EQ( - get_asamplitude_value[34])>( - reinterpret_cast(&last_msg_->amplitude_value[34])), - 36) - << "incorrect value for amplitude_value[34], expected 36, is " - << last_msg_->amplitude_value[34]; - EXPECT_EQ( - get_asamplitude_value[35])>( - reinterpret_cast(&last_msg_->amplitude_value[35])), - 186) - << "incorrect value for amplitude_value[35], expected 186, is " - << last_msg_->amplitude_value[35]; - EXPECT_EQ( - get_asamplitude_value[36])>( - reinterpret_cast(&last_msg_->amplitude_value[36])), - 99) - << "incorrect value for amplitude_value[36], expected 99, is " - << last_msg_->amplitude_value[36]; - EXPECT_EQ( - get_asamplitude_value[37])>( - reinterpret_cast(&last_msg_->amplitude_value[37])), - 63) - << "incorrect value for amplitude_value[37], expected 63, is " - << last_msg_->amplitude_value[37]; - EXPECT_EQ( - get_asamplitude_value[38])>( - reinterpret_cast(&last_msg_->amplitude_value[38])), - 105) - << "incorrect value for amplitude_value[38], expected 105, is " - << last_msg_->amplitude_value[38]; - EXPECT_EQ( - get_asamplitude_value[39])>( - reinterpret_cast(&last_msg_->amplitude_value[39])), - 116) - << "incorrect value for amplitude_value[39], expected 116, is " - << last_msg_->amplitude_value[39]; - EXPECT_EQ( - get_asamplitude_value[40])>( - reinterpret_cast(&last_msg_->amplitude_value[40])), - 216) - << "incorrect value for amplitude_value[40], expected 216, is " - << last_msg_->amplitude_value[40]; - EXPECT_EQ( - get_asamplitude_value[41])>( - reinterpret_cast(&last_msg_->amplitude_value[41])), - 44) - << "incorrect value for amplitude_value[41], expected 44, is " - << last_msg_->amplitude_value[41]; - EXPECT_EQ( - get_asamplitude_value[42])>( - reinterpret_cast(&last_msg_->amplitude_value[42])), - 67) - << "incorrect value for amplitude_value[42], expected 67, is " - << last_msg_->amplitude_value[42]; - EXPECT_EQ( - get_asamplitude_value[43])>( - reinterpret_cast(&last_msg_->amplitude_value[43])), - 212) - << "incorrect value for amplitude_value[43], expected 212, is " - << last_msg_->amplitude_value[43]; - EXPECT_EQ( - get_asamplitude_value[44])>( - reinterpret_cast(&last_msg_->amplitude_value[44])), - 156) - << "incorrect value for amplitude_value[44], expected 156, is " - << last_msg_->amplitude_value[44]; - EXPECT_EQ( - get_asamplitude_value[45])>( - reinterpret_cast(&last_msg_->amplitude_value[45])), - 75) - << "incorrect value for amplitude_value[45], expected 75, is " - << last_msg_->amplitude_value[45]; - EXPECT_EQ( - get_asamplitude_value[46])>( - reinterpret_cast(&last_msg_->amplitude_value[46])), - 81) - << "incorrect value for amplitude_value[46], expected 81, is " - << last_msg_->amplitude_value[46]; - EXPECT_EQ( - get_asamplitude_value[47])>( - reinterpret_cast(&last_msg_->amplitude_value[47])), - 53) - << "incorrect value for amplitude_value[47], expected 53, is " - << last_msg_->amplitude_value[47]; - EXPECT_EQ( - get_asamplitude_value[48])>( - reinterpret_cast(&last_msg_->amplitude_value[48])), - 250) - << "incorrect value for amplitude_value[48], expected 250, is " - << last_msg_->amplitude_value[48]; - EXPECT_EQ( - get_asamplitude_value[49])>( - reinterpret_cast(&last_msg_->amplitude_value[49])), - 225) - << "incorrect value for amplitude_value[49], expected 225, is " - << last_msg_->amplitude_value[49]; - EXPECT_EQ( - get_asamplitude_value[50])>( - reinterpret_cast(&last_msg_->amplitude_value[50])), - 23) - << "incorrect value for amplitude_value[50], expected 23, is " - << last_msg_->amplitude_value[50]; - EXPECT_EQ( - get_asamplitude_value[51])>( - reinterpret_cast(&last_msg_->amplitude_value[51])), - 205) - << "incorrect value for amplitude_value[51], expected 205, is " - << last_msg_->amplitude_value[51]; - EXPECT_EQ( - get_asamplitude_value[52])>( - reinterpret_cast(&last_msg_->amplitude_value[52])), - 26) - << "incorrect value for amplitude_value[52], expected 26, is " - << last_msg_->amplitude_value[52]; - EXPECT_EQ( - get_asamplitude_value[53])>( - reinterpret_cast(&last_msg_->amplitude_value[53])), - 34) - << "incorrect value for amplitude_value[53], expected 34, is " - << last_msg_->amplitude_value[53]; - EXPECT_EQ( - get_asamplitude_value[54])>( - reinterpret_cast(&last_msg_->amplitude_value[54])), - 119) - << "incorrect value for amplitude_value[54], expected 119, is " - << last_msg_->amplitude_value[54]; - EXPECT_EQ( - get_asamplitude_value[55])>( - reinterpret_cast(&last_msg_->amplitude_value[55])), - 50) - << "incorrect value for amplitude_value[55], expected 50, is " - << last_msg_->amplitude_value[55]; - EXPECT_EQ( - get_asamplitude_value[56])>( - reinterpret_cast(&last_msg_->amplitude_value[56])), - 101) - << "incorrect value for amplitude_value[56], expected 101, is " - << last_msg_->amplitude_value[56]; - EXPECT_EQ( - get_asamplitude_value[57])>( - reinterpret_cast(&last_msg_->amplitude_value[57])), - 64) - << "incorrect value for amplitude_value[57], expected 64, is " - << last_msg_->amplitude_value[57]; - EXPECT_EQ( - get_asamplitude_value[58])>( - reinterpret_cast(&last_msg_->amplitude_value[58])), - 7) - << "incorrect value for amplitude_value[58], expected 7, is " - << last_msg_->amplitude_value[58]; - EXPECT_EQ( - get_asamplitude_value[59])>( - reinterpret_cast(&last_msg_->amplitude_value[59])), - 231) - << "incorrect value for amplitude_value[59], expected 231, is " - << last_msg_->amplitude_value[59]; - EXPECT_EQ( - get_asamplitude_value[60])>( - reinterpret_cast(&last_msg_->amplitude_value[60])), - 124) - << "incorrect value for amplitude_value[60], expected 124, is " - << last_msg_->amplitude_value[60]; - EXPECT_EQ( - get_asamplitude_value[61])>( - reinterpret_cast(&last_msg_->amplitude_value[61])), - 183) - << "incorrect value for amplitude_value[61], expected 183, is " - << last_msg_->amplitude_value[61]; - EXPECT_EQ( - get_asamplitude_value[62])>( - reinterpret_cast(&last_msg_->amplitude_value[62])), - 203) - << "incorrect value for amplitude_value[62], expected 203, is " - << last_msg_->amplitude_value[62]; - EXPECT_EQ( - get_asamplitude_value[63])>( - reinterpret_cast(&last_msg_->amplitude_value[63])), - 102) - << "incorrect value for amplitude_value[63], expected 102, is " - << last_msg_->amplitude_value[63]; - EXPECT_EQ( - get_asamplitude_value[64])>( - reinterpret_cast(&last_msg_->amplitude_value[64])), - 234) - << "incorrect value for amplitude_value[64], expected 234, is " - << last_msg_->amplitude_value[64]; - EXPECT_EQ( - get_asamplitude_value[65])>( - reinterpret_cast(&last_msg_->amplitude_value[65])), - 84) - << "incorrect value for amplitude_value[65], expected 84, is " - << last_msg_->amplitude_value[65]; - EXPECT_EQ( - get_asamplitude_value[66])>( - reinterpret_cast(&last_msg_->amplitude_value[66])), - 83) - << "incorrect value for amplitude_value[66], expected 83, is " - << last_msg_->amplitude_value[66]; - EXPECT_EQ( - get_asamplitude_value[67])>( - reinterpret_cast(&last_msg_->amplitude_value[67])), - 208) - << "incorrect value for amplitude_value[67], expected 208, is " - << last_msg_->amplitude_value[67]; - EXPECT_EQ( - get_asamplitude_value[68])>( - reinterpret_cast(&last_msg_->amplitude_value[68])), - 23) - << "incorrect value for amplitude_value[68], expected 23, is " - << last_msg_->amplitude_value[68]; - EXPECT_EQ( - get_asamplitude_value[69])>( - reinterpret_cast(&last_msg_->amplitude_value[69])), - 68) - << "incorrect value for amplitude_value[69], expected 68, is " - << last_msg_->amplitude_value[69]; - EXPECT_EQ( - get_asamplitude_value[70])>( - reinterpret_cast(&last_msg_->amplitude_value[70])), - 54) - << "incorrect value for amplitude_value[70], expected 54, is " - << last_msg_->amplitude_value[70]; - EXPECT_EQ( - get_asamplitude_value[71])>( - reinterpret_cast(&last_msg_->amplitude_value[71])), - 179) - << "incorrect value for amplitude_value[71], expected 179, is " - << last_msg_->amplitude_value[71]; - EXPECT_EQ( - get_asamplitude_value[72])>( - reinterpret_cast(&last_msg_->amplitude_value[72])), - 98) - << "incorrect value for amplitude_value[72], expected 98, is " - << last_msg_->amplitude_value[72]; - EXPECT_EQ( - get_asamplitude_value[73])>( - reinterpret_cast(&last_msg_->amplitude_value[73])), - 96) - << "incorrect value for amplitude_value[73], expected 96, is " - << last_msg_->amplitude_value[73]; - EXPECT_EQ( - get_asamplitude_value[74])>( - reinterpret_cast(&last_msg_->amplitude_value[74])), - 116) - << "incorrect value for amplitude_value[74], expected 116, is " - << last_msg_->amplitude_value[74]; - EXPECT_EQ( - get_asamplitude_value[75])>( - reinterpret_cast(&last_msg_->amplitude_value[75])), - 244) - << "incorrect value for amplitude_value[75], expected 244, is " - << last_msg_->amplitude_value[75]; - EXPECT_EQ( - get_asamplitude_value[76])>( - reinterpret_cast(&last_msg_->amplitude_value[76])), - 246) - << "incorrect value for amplitude_value[76], expected 246, is " - << last_msg_->amplitude_value[76]; - EXPECT_EQ( - get_asamplitude_value[77])>( - reinterpret_cast(&last_msg_->amplitude_value[77])), - 94) - << "incorrect value for amplitude_value[77], expected 94, is " - << last_msg_->amplitude_value[77]; - EXPECT_EQ( - get_asamplitude_value[78])>( - reinterpret_cast(&last_msg_->amplitude_value[78])), - 104) - << "incorrect value for amplitude_value[78], expected 104, is " - << last_msg_->amplitude_value[78]; - EXPECT_EQ( - get_asamplitude_value[79])>( - reinterpret_cast(&last_msg_->amplitude_value[79])), - 94) - << "incorrect value for amplitude_value[79], expected 94, is " - << last_msg_->amplitude_value[79]; - EXPECT_EQ( - get_asamplitude_value[80])>( - reinterpret_cast(&last_msg_->amplitude_value[80])), - 13) - << "incorrect value for amplitude_value[80], expected 13, is " - << last_msg_->amplitude_value[80]; - EXPECT_EQ( - get_asamplitude_value[81])>( - reinterpret_cast(&last_msg_->amplitude_value[81])), - 56) - << "incorrect value for amplitude_value[81], expected 56, is " - << last_msg_->amplitude_value[81]; - EXPECT_EQ( - get_asamplitude_value[82])>( - reinterpret_cast(&last_msg_->amplitude_value[82])), - 210) - << "incorrect value for amplitude_value[82], expected 210, is " - << last_msg_->amplitude_value[82]; - EXPECT_EQ( - get_asamplitude_value[83])>( - reinterpret_cast(&last_msg_->amplitude_value[83])), - 18) - << "incorrect value for amplitude_value[83], expected 18, is " - << last_msg_->amplitude_value[83]; - EXPECT_EQ( - get_asamplitude_value[84])>( - reinterpret_cast(&last_msg_->amplitude_value[84])), - 191) - << "incorrect value for amplitude_value[84], expected 191, is " - << last_msg_->amplitude_value[84]; - EXPECT_EQ( - get_asamplitude_value[85])>( - reinterpret_cast(&last_msg_->amplitude_value[85])), - 22) - << "incorrect value for amplitude_value[85], expected 22, is " - << last_msg_->amplitude_value[85]; - EXPECT_EQ( - get_asamplitude_value[86])>( - reinterpret_cast(&last_msg_->amplitude_value[86])), - 133) - << "incorrect value for amplitude_value[86], expected 133, is " - << last_msg_->amplitude_value[86]; - EXPECT_EQ( - get_asamplitude_value[87])>( - reinterpret_cast(&last_msg_->amplitude_value[87])), - 81) - << "incorrect value for amplitude_value[87], expected 81, is " - << last_msg_->amplitude_value[87]; - EXPECT_EQ( - get_asamplitude_value[88])>( - reinterpret_cast(&last_msg_->amplitude_value[88])), - 153) - << "incorrect value for amplitude_value[88], expected 153, is " - << last_msg_->amplitude_value[88]; - EXPECT_EQ( - get_asamplitude_value[89])>( - reinterpret_cast(&last_msg_->amplitude_value[89])), - 159) - << "incorrect value for amplitude_value[89], expected 159, is " - << last_msg_->amplitude_value[89]; - EXPECT_EQ( - get_asamplitude_value[90])>( - reinterpret_cast(&last_msg_->amplitude_value[90])), - 161) - << "incorrect value for amplitude_value[90], expected 161, is " - << last_msg_->amplitude_value[90]; - EXPECT_EQ( - get_asamplitude_value[91])>( - reinterpret_cast(&last_msg_->amplitude_value[91])), - 219) - << "incorrect value for amplitude_value[91], expected 219, is " - << last_msg_->amplitude_value[91]; - EXPECT_EQ( - get_asamplitude_value[92])>( - reinterpret_cast(&last_msg_->amplitude_value[92])), - 59) - << "incorrect value for amplitude_value[92], expected 59, is " - << last_msg_->amplitude_value[92]; - EXPECT_EQ( - get_asamplitude_value[93])>( - reinterpret_cast(&last_msg_->amplitude_value[93])), - 21) - << "incorrect value for amplitude_value[93], expected 21, is " - << last_msg_->amplitude_value[93]; - EXPECT_EQ( - get_asamplitude_value[94])>( - reinterpret_cast(&last_msg_->amplitude_value[94])), - 164) - << "incorrect value for amplitude_value[94], expected 164, is " - << last_msg_->amplitude_value[94]; - EXPECT_EQ( - get_asamplitude_value[95])>( - reinterpret_cast(&last_msg_->amplitude_value[95])), - 121) - << "incorrect value for amplitude_value[95], expected 121, is " - << last_msg_->amplitude_value[95]; - EXPECT_EQ( - get_asamplitude_value[96])>( - reinterpret_cast(&last_msg_->amplitude_value[96])), - 145) - << "incorrect value for amplitude_value[96], expected 145, is " - << last_msg_->amplitude_value[96]; - EXPECT_EQ( - get_asamplitude_value[97])>( - reinterpret_cast(&last_msg_->amplitude_value[97])), - 203) - << "incorrect value for amplitude_value[97], expected 203, is " - << last_msg_->amplitude_value[97]; - EXPECT_EQ( - get_asamplitude_value[98])>( - reinterpret_cast(&last_msg_->amplitude_value[98])), - 171) - << "incorrect value for amplitude_value[98], expected 171, is " - << last_msg_->amplitude_value[98]; - EXPECT_EQ( - get_asamplitude_value[99])>( - reinterpret_cast(&last_msg_->amplitude_value[99])), - 132) - << "incorrect value for amplitude_value[99], expected 132, is " - << last_msg_->amplitude_value[99]; - EXPECT_EQ( - get_asamplitude_value[100])>( - reinterpret_cast(&last_msg_->amplitude_value[100])), - 57) - << "incorrect value for amplitude_value[100], expected 57, is " - << last_msg_->amplitude_value[100]; - EXPECT_EQ( - get_asamplitude_value[101])>( - reinterpret_cast(&last_msg_->amplitude_value[101])), - 180) - << "incorrect value for amplitude_value[101], expected 180, is " - << last_msg_->amplitude_value[101]; - EXPECT_EQ( - get_asamplitude_value[102])>( - reinterpret_cast(&last_msg_->amplitude_value[102])), - 102) - << "incorrect value for amplitude_value[102], expected 102, is " - << last_msg_->amplitude_value[102]; - EXPECT_EQ( - get_asamplitude_value[103])>( - reinterpret_cast(&last_msg_->amplitude_value[103])), - 101) - << "incorrect value for amplitude_value[103], expected 101, is " - << last_msg_->amplitude_value[103]; - EXPECT_EQ( - get_asamplitude_value[104])>( - reinterpret_cast(&last_msg_->amplitude_value[104])), - 11) - << "incorrect value for amplitude_value[104], expected 11, is " - << last_msg_->amplitude_value[104]; - EXPECT_EQ( - get_asamplitude_value[105])>( - reinterpret_cast(&last_msg_->amplitude_value[105])), - 229) - << "incorrect value for amplitude_value[105], expected 229, is " - << last_msg_->amplitude_value[105]; - EXPECT_EQ( - get_asamplitude_value[106])>( - reinterpret_cast(&last_msg_->amplitude_value[106])), - 175) - << "incorrect value for amplitude_value[106], expected 175, is " - << last_msg_->amplitude_value[106]; - EXPECT_EQ( - get_asamplitude_value[107])>( - reinterpret_cast(&last_msg_->amplitude_value[107])), - 145) - << "incorrect value for amplitude_value[107], expected 145, is " - << last_msg_->amplitude_value[107]; - EXPECT_EQ( - get_asamplitude_value[108])>( - reinterpret_cast(&last_msg_->amplitude_value[108])), - 73) - << "incorrect value for amplitude_value[108], expected 73, is " - << last_msg_->amplitude_value[108]; - EXPECT_EQ( - get_asamplitude_value[109])>( - reinterpret_cast(&last_msg_->amplitude_value[109])), - 72) - << "incorrect value for amplitude_value[109], expected 72, is " - << last_msg_->amplitude_value[109]; - EXPECT_EQ( - get_asamplitude_value[110])>( - reinterpret_cast(&last_msg_->amplitude_value[110])), - 124) - << "incorrect value for amplitude_value[110], expected 124, is " - << last_msg_->amplitude_value[110]; - EXPECT_EQ( - get_asamplitude_value[111])>( - reinterpret_cast(&last_msg_->amplitude_value[111])), - 4) - << "incorrect value for amplitude_value[111], expected 4, is " - << last_msg_->amplitude_value[111]; - EXPECT_EQ( - get_asamplitude_value[112])>( - reinterpret_cast(&last_msg_->amplitude_value[112])), - 184) - << "incorrect value for amplitude_value[112], expected 184, is " - << last_msg_->amplitude_value[112]; - EXPECT_EQ( - get_asamplitude_value[113])>( - reinterpret_cast(&last_msg_->amplitude_value[113])), - 228) - << "incorrect value for amplitude_value[113], expected 228, is " - << last_msg_->amplitude_value[113]; - EXPECT_EQ( - get_asamplitude_value[114])>( - reinterpret_cast(&last_msg_->amplitude_value[114])), - 61) - << "incorrect value for amplitude_value[114], expected 61, is " - << last_msg_->amplitude_value[114]; - EXPECT_EQ( - get_asamplitude_value[115])>( - reinterpret_cast(&last_msg_->amplitude_value[115])), - 234) - << "incorrect value for amplitude_value[115], expected 234, is " - << last_msg_->amplitude_value[115]; - EXPECT_EQ( - get_asamplitude_value[116])>( - reinterpret_cast(&last_msg_->amplitude_value[116])), - 218) - << "incorrect value for amplitude_value[116], expected 218, is " - << last_msg_->amplitude_value[116]; - EXPECT_EQ( - get_asamplitude_value[117])>( - reinterpret_cast(&last_msg_->amplitude_value[117])), - 62) - << "incorrect value for amplitude_value[117], expected 62, is " - << last_msg_->amplitude_value[117]; - EXPECT_EQ( - get_asamplitude_value[118])>( - reinterpret_cast(&last_msg_->amplitude_value[118])), - 226) - << "incorrect value for amplitude_value[118], expected 226, is " - << last_msg_->amplitude_value[118]; - EXPECT_EQ( - get_asamplitude_value[119])>( - reinterpret_cast(&last_msg_->amplitude_value[119])), - 217) - << "incorrect value for amplitude_value[119], expected 217, is " - << last_msg_->amplitude_value[119]; - EXPECT_EQ( - get_asamplitude_value[120])>( - reinterpret_cast(&last_msg_->amplitude_value[120])), - 193) - << "incorrect value for amplitude_value[120], expected 193, is " - << last_msg_->amplitude_value[120]; - EXPECT_EQ( - get_asamplitude_value[121])>( - reinterpret_cast(&last_msg_->amplitude_value[121])), - 7) - << "incorrect value for amplitude_value[121], expected 7, is " - << last_msg_->amplitude_value[121]; - EXPECT_EQ( - get_asamplitude_value[122])>( - reinterpret_cast(&last_msg_->amplitude_value[122])), - 109) - << "incorrect value for amplitude_value[122], expected 109, is " - << last_msg_->amplitude_value[122]; - EXPECT_EQ( - get_asamplitude_value[123])>( - reinterpret_cast(&last_msg_->amplitude_value[123])), - 44) - << "incorrect value for amplitude_value[123], expected 44, is " - << last_msg_->amplitude_value[123]; - EXPECT_EQ( - get_asamplitude_value[124])>( - reinterpret_cast(&last_msg_->amplitude_value[124])), - 83) - << "incorrect value for amplitude_value[124], expected 83, is " - << last_msg_->amplitude_value[124]; - EXPECT_EQ( - get_asamplitude_value[125])>( - reinterpret_cast(&last_msg_->amplitude_value[125])), - 201) - << "incorrect value for amplitude_value[125], expected 201, is " - << last_msg_->amplitude_value[125]; - EXPECT_EQ( - get_asamplitude_value[126])>( - reinterpret_cast(&last_msg_->amplitude_value[126])), - 20) - << "incorrect value for amplitude_value[126], expected 20, is " - << last_msg_->amplitude_value[126]; - EXPECT_EQ( - get_asamplitude_value[127])>( - reinterpret_cast(&last_msg_->amplitude_value[127])), - 101) - << "incorrect value for amplitude_value[127], expected 101, is " - << last_msg_->amplitude_value[127]; - EXPECT_EQ( - get_asamplitude_value[128])>( - reinterpret_cast(&last_msg_->amplitude_value[128])), - 9) - << "incorrect value for amplitude_value[128], expected 9, is " - << last_msg_->amplitude_value[128]; - EXPECT_EQ( - get_asamplitude_value[129])>( - reinterpret_cast(&last_msg_->amplitude_value[129])), - 140) - << "incorrect value for amplitude_value[129], expected 140, is " - << last_msg_->amplitude_value[129]; - EXPECT_EQ( - get_asamplitude_value[130])>( - reinterpret_cast(&last_msg_->amplitude_value[130])), - 186) - << "incorrect value for amplitude_value[130], expected 186, is " - << last_msg_->amplitude_value[130]; - EXPECT_EQ( - get_asamplitude_value[131])>( - reinterpret_cast(&last_msg_->amplitude_value[131])), - 162) - << "incorrect value for amplitude_value[131], expected 162, is " - << last_msg_->amplitude_value[131]; - EXPECT_EQ( - get_asamplitude_value[132])>( - reinterpret_cast(&last_msg_->amplitude_value[132])), - 81) - << "incorrect value for amplitude_value[132], expected 81, is " - << last_msg_->amplitude_value[132]; - EXPECT_EQ( - get_asamplitude_value[133])>( - reinterpret_cast(&last_msg_->amplitude_value[133])), - 91) - << "incorrect value for amplitude_value[133], expected 91, is " - << last_msg_->amplitude_value[133]; - EXPECT_EQ( - get_asamplitude_value[134])>( - reinterpret_cast(&last_msg_->amplitude_value[134])), - 30) - << "incorrect value for amplitude_value[134], expected 30, is " - << last_msg_->amplitude_value[134]; - EXPECT_EQ( - get_asamplitude_value[135])>( - reinterpret_cast(&last_msg_->amplitude_value[135])), - 231) - << "incorrect value for amplitude_value[135], expected 231, is " - << last_msg_->amplitude_value[135]; - EXPECT_EQ( - get_asamplitude_value[136])>( - reinterpret_cast(&last_msg_->amplitude_value[136])), - 161) - << "incorrect value for amplitude_value[136], expected 161, is " - << last_msg_->amplitude_value[136]; - EXPECT_EQ( - get_asamplitude_value[137])>( - reinterpret_cast(&last_msg_->amplitude_value[137])), - 81) - << "incorrect value for amplitude_value[137], expected 81, is " - << last_msg_->amplitude_value[137]; - EXPECT_EQ( - get_asamplitude_value[138])>( - reinterpret_cast(&last_msg_->amplitude_value[138])), - 216) - << "incorrect value for amplitude_value[138], expected 216, is " - << last_msg_->amplitude_value[138]; - EXPECT_EQ( - get_asamplitude_value[139])>( - reinterpret_cast(&last_msg_->amplitude_value[139])), - 114) - << "incorrect value for amplitude_value[139], expected 114, is " - << last_msg_->amplitude_value[139]; - EXPECT_EQ( - get_asamplitude_value[140])>( - reinterpret_cast(&last_msg_->amplitude_value[140])), - 60) - << "incorrect value for amplitude_value[140], expected 60, is " - << last_msg_->amplitude_value[140]; - EXPECT_EQ( - get_asamplitude_value[141])>( - reinterpret_cast(&last_msg_->amplitude_value[141])), - 231) - << "incorrect value for amplitude_value[141], expected 231, is " - << last_msg_->amplitude_value[141]; - EXPECT_EQ( - get_asamplitude_value[142])>( - reinterpret_cast(&last_msg_->amplitude_value[142])), - 163) - << "incorrect value for amplitude_value[142], expected 163, is " - << last_msg_->amplitude_value[142]; - EXPECT_EQ( - get_asamplitude_value[143])>( - reinterpret_cast(&last_msg_->amplitude_value[143])), - 163) - << "incorrect value for amplitude_value[143], expected 163, is " - << last_msg_->amplitude_value[143]; - EXPECT_EQ( - get_asamplitude_value[144])>( - reinterpret_cast(&last_msg_->amplitude_value[144])), - 49) - << "incorrect value for amplitude_value[144], expected 49, is " - << last_msg_->amplitude_value[144]; - EXPECT_EQ( - get_asamplitude_value[145])>( - reinterpret_cast(&last_msg_->amplitude_value[145])), - 237) - << "incorrect value for amplitude_value[145], expected 237, is " - << last_msg_->amplitude_value[145]; - EXPECT_EQ( - get_asamplitude_value[146])>( - reinterpret_cast(&last_msg_->amplitude_value[146])), - 244) - << "incorrect value for amplitude_value[146], expected 244, is " - << last_msg_->amplitude_value[146]; - EXPECT_EQ( - get_asamplitude_value[147])>( - reinterpret_cast(&last_msg_->amplitude_value[147])), - 185) - << "incorrect value for amplitude_value[147], expected 185, is " - << last_msg_->amplitude_value[147]; - EXPECT_EQ( - get_asamplitude_value[148])>( - reinterpret_cast(&last_msg_->amplitude_value[148])), - 240) - << "incorrect value for amplitude_value[148], expected 240, is " - << last_msg_->amplitude_value[148]; - EXPECT_EQ( - get_asamplitude_value[149])>( - reinterpret_cast(&last_msg_->amplitude_value[149])), - 89) - << "incorrect value for amplitude_value[149], expected 89, is " - << last_msg_->amplitude_value[149]; - EXPECT_EQ( - get_asamplitude_value[150])>( - reinterpret_cast(&last_msg_->amplitude_value[150])), - 143) - << "incorrect value for amplitude_value[150], expected 143, is " - << last_msg_->amplitude_value[150]; - EXPECT_EQ( - get_asamplitude_value[151])>( - reinterpret_cast(&last_msg_->amplitude_value[151])), - 174) - << "incorrect value for amplitude_value[151], expected 174, is " - << last_msg_->amplitude_value[151]; - EXPECT_EQ( - get_asamplitude_value[152])>( - reinterpret_cast(&last_msg_->amplitude_value[152])), - 165) - << "incorrect value for amplitude_value[152], expected 165, is " - << last_msg_->amplitude_value[152]; - EXPECT_EQ( - get_asamplitude_value[153])>( - reinterpret_cast(&last_msg_->amplitude_value[153])), - 211) - << "incorrect value for amplitude_value[153], expected 211, is " - << last_msg_->amplitude_value[153]; - EXPECT_EQ( - get_asamplitude_value[154])>( - reinterpret_cast(&last_msg_->amplitude_value[154])), - 241) - << "incorrect value for amplitude_value[154], expected 241, is " - << last_msg_->amplitude_value[154]; - EXPECT_EQ( - get_asamplitude_value[155])>( - reinterpret_cast(&last_msg_->amplitude_value[155])), - 13) - << "incorrect value for amplitude_value[155], expected 13, is " - << last_msg_->amplitude_value[155]; - EXPECT_EQ( - get_asamplitude_value[156])>( - reinterpret_cast(&last_msg_->amplitude_value[156])), - 16) - << "incorrect value for amplitude_value[156], expected 16, is " - << last_msg_->amplitude_value[156]; - EXPECT_EQ( - get_asamplitude_value[157])>( - reinterpret_cast(&last_msg_->amplitude_value[157])), - 61) - << "incorrect value for amplitude_value[157], expected 61, is " - << last_msg_->amplitude_value[157]; - EXPECT_EQ( - get_asamplitude_value[158])>( - reinterpret_cast(&last_msg_->amplitude_value[158])), - 141) - << "incorrect value for amplitude_value[158], expected 141, is " - << last_msg_->amplitude_value[158]; - EXPECT_EQ( - get_asamplitude_value[159])>( - reinterpret_cast(&last_msg_->amplitude_value[159])), - 101) - << "incorrect value for amplitude_value[159], expected 101, is " - << last_msg_->amplitude_value[159]; - EXPECT_EQ( - get_asamplitude_value[160])>( - reinterpret_cast(&last_msg_->amplitude_value[160])), - 89) - << "incorrect value for amplitude_value[160], expected 89, is " - << last_msg_->amplitude_value[160]; - EXPECT_EQ( - get_asamplitude_value[161])>( - reinterpret_cast(&last_msg_->amplitude_value[161])), - 37) - << "incorrect value for amplitude_value[161], expected 37, is " - << last_msg_->amplitude_value[161]; - EXPECT_EQ( - get_asamplitude_value[162])>( - reinterpret_cast(&last_msg_->amplitude_value[162])), - 117) - << "incorrect value for amplitude_value[162], expected 117, is " - << last_msg_->amplitude_value[162]; - EXPECT_EQ( - get_asamplitude_value[163])>( - reinterpret_cast(&last_msg_->amplitude_value[163])), - 189) - << "incorrect value for amplitude_value[163], expected 189, is " - << last_msg_->amplitude_value[163]; - EXPECT_EQ( - get_asamplitude_value[164])>( - reinterpret_cast(&last_msg_->amplitude_value[164])), - 86) - << "incorrect value for amplitude_value[164], expected 86, is " - << last_msg_->amplitude_value[164]; - EXPECT_EQ( - get_asamplitude_value[165])>( - reinterpret_cast(&last_msg_->amplitude_value[165])), - 118) - << "incorrect value for amplitude_value[165], expected 118, is " - << last_msg_->amplitude_value[165]; - EXPECT_EQ( - get_asamplitude_value[166])>( - reinterpret_cast(&last_msg_->amplitude_value[166])), - 176) - << "incorrect value for amplitude_value[166], expected 176, is " - << last_msg_->amplitude_value[166]; - EXPECT_EQ( - get_asamplitude_value[167])>( - reinterpret_cast(&last_msg_->amplitude_value[167])), - 228) - << "incorrect value for amplitude_value[167], expected 228, is " - << last_msg_->amplitude_value[167]; - EXPECT_EQ( - get_asamplitude_value[168])>( - reinterpret_cast(&last_msg_->amplitude_value[168])), - 12) - << "incorrect value for amplitude_value[168], expected 12, is " - << last_msg_->amplitude_value[168]; - EXPECT_EQ( - get_asamplitude_value[169])>( - reinterpret_cast(&last_msg_->amplitude_value[169])), - 14) - << "incorrect value for amplitude_value[169], expected 14, is " - << last_msg_->amplitude_value[169]; - EXPECT_EQ( - get_asamplitude_value[170])>( - reinterpret_cast(&last_msg_->amplitude_value[170])), - 119) - << "incorrect value for amplitude_value[170], expected 119, is " - << last_msg_->amplitude_value[170]; - EXPECT_EQ( - get_asamplitude_value[171])>( - reinterpret_cast(&last_msg_->amplitude_value[171])), - 135) - << "incorrect value for amplitude_value[171], expected 135, is " - << last_msg_->amplitude_value[171]; - EXPECT_EQ( - get_asamplitude_value[172])>( - reinterpret_cast(&last_msg_->amplitude_value[172])), - 129) - << "incorrect value for amplitude_value[172], expected 129, is " - << last_msg_->amplitude_value[172]; - EXPECT_EQ( - get_asamplitude_value[173])>( - reinterpret_cast(&last_msg_->amplitude_value[173])), - 243) - << "incorrect value for amplitude_value[173], expected 243, is " - << last_msg_->amplitude_value[173]; - EXPECT_EQ( - get_asamplitude_value[174])>( - reinterpret_cast(&last_msg_->amplitude_value[174])), - 50) - << "incorrect value for amplitude_value[174], expected 50, is " - << last_msg_->amplitude_value[174]; - EXPECT_EQ( - get_asamplitude_value[175])>( - reinterpret_cast(&last_msg_->amplitude_value[175])), - 29) - << "incorrect value for amplitude_value[175], expected 29, is " - << last_msg_->amplitude_value[175]; - EXPECT_EQ( - get_asamplitude_value[176])>( - reinterpret_cast(&last_msg_->amplitude_value[176])), - 207) - << "incorrect value for amplitude_value[176], expected 207, is " - << last_msg_->amplitude_value[176]; - EXPECT_EQ( - get_asamplitude_value[177])>( - reinterpret_cast(&last_msg_->amplitude_value[177])), - 198) - << "incorrect value for amplitude_value[177], expected 198, is " - << last_msg_->amplitude_value[177]; - EXPECT_EQ( - get_asamplitude_value[178])>( - reinterpret_cast(&last_msg_->amplitude_value[178])), - 117) - << "incorrect value for amplitude_value[178], expected 117, is " - << last_msg_->amplitude_value[178]; - EXPECT_EQ( - get_asamplitude_value[179])>( - reinterpret_cast(&last_msg_->amplitude_value[179])), - 100) - << "incorrect value for amplitude_value[179], expected 100, is " - << last_msg_->amplitude_value[179]; - EXPECT_EQ( - get_asamplitude_value[180])>( - reinterpret_cast(&last_msg_->amplitude_value[180])), - 225) - << "incorrect value for amplitude_value[180], expected 225, is " - << last_msg_->amplitude_value[180]; - EXPECT_EQ( - get_asamplitude_value[181])>( - reinterpret_cast(&last_msg_->amplitude_value[181])), - 6) - << "incorrect value for amplitude_value[181], expected 6, is " - << last_msg_->amplitude_value[181]; - EXPECT_EQ( - get_asamplitude_value[182])>( - reinterpret_cast(&last_msg_->amplitude_value[182])), - 139) - << "incorrect value for amplitude_value[182], expected 139, is " - << last_msg_->amplitude_value[182]; - EXPECT_EQ( - get_asamplitude_value[183])>( - reinterpret_cast(&last_msg_->amplitude_value[183])), - 110) - << "incorrect value for amplitude_value[183], expected 110, is " - << last_msg_->amplitude_value[183]; - EXPECT_EQ( - get_asamplitude_value[184])>( - reinterpret_cast(&last_msg_->amplitude_value[184])), - 39) - << "incorrect value for amplitude_value[184], expected 39, is " - << last_msg_->amplitude_value[184]; - EXPECT_EQ( - get_asamplitude_value[185])>( - reinterpret_cast(&last_msg_->amplitude_value[185])), - 210) - << "incorrect value for amplitude_value[185], expected 210, is " - << last_msg_->amplitude_value[185]; - EXPECT_EQ( - get_asamplitude_value[186])>( - reinterpret_cast(&last_msg_->amplitude_value[186])), - 68) - << "incorrect value for amplitude_value[186], expected 68, is " - << last_msg_->amplitude_value[186]; - EXPECT_EQ( - get_asamplitude_value[187])>( - reinterpret_cast(&last_msg_->amplitude_value[187])), - 199) - << "incorrect value for amplitude_value[187], expected 199, is " - << last_msg_->amplitude_value[187]; - EXPECT_EQ( - get_asamplitude_value[188])>( - reinterpret_cast(&last_msg_->amplitude_value[188])), - 43) - << "incorrect value for amplitude_value[188], expected 43, is " - << last_msg_->amplitude_value[188]; - EXPECT_EQ( - get_asamplitude_value[189])>( - reinterpret_cast(&last_msg_->amplitude_value[189])), - 132) - << "incorrect value for amplitude_value[189], expected 132, is " - << last_msg_->amplitude_value[189]; - EXPECT_EQ( - get_asamplitude_value[190])>( - reinterpret_cast(&last_msg_->amplitude_value[190])), - 64) - << "incorrect value for amplitude_value[190], expected 64, is " - << last_msg_->amplitude_value[190]; - EXPECT_EQ( - get_asamplitude_value[191])>( - reinterpret_cast(&last_msg_->amplitude_value[191])), - 17) - << "incorrect value for amplitude_value[191], expected 17, is " - << last_msg_->amplitude_value[191]; - EXPECT_EQ( - get_asamplitude_value[192])>( - reinterpret_cast(&last_msg_->amplitude_value[192])), - 51) - << "incorrect value for amplitude_value[192], expected 51, is " - << last_msg_->amplitude_value[192]; - EXPECT_EQ( - get_asamplitude_value[193])>( - reinterpret_cast(&last_msg_->amplitude_value[193])), - 173) - << "incorrect value for amplitude_value[193], expected 173, is " - << last_msg_->amplitude_value[193]; - EXPECT_EQ( - get_asamplitude_value[194])>( - reinterpret_cast(&last_msg_->amplitude_value[194])), - 181) - << "incorrect value for amplitude_value[194], expected 181, is " - << last_msg_->amplitude_value[194]; - EXPECT_EQ( - get_asamplitude_value[195])>( - reinterpret_cast(&last_msg_->amplitude_value[195])), - 12) - << "incorrect value for amplitude_value[195], expected 12, is " - << last_msg_->amplitude_value[195]; - EXPECT_EQ( - get_asamplitude_value[196])>( - reinterpret_cast(&last_msg_->amplitude_value[196])), - 140) - << "incorrect value for amplitude_value[196], expected 140, is " - << last_msg_->amplitude_value[196]; - EXPECT_EQ( - get_asamplitude_value[197])>( - reinterpret_cast(&last_msg_->amplitude_value[197])), - 16) - << "incorrect value for amplitude_value[197], expected 16, is " - << last_msg_->amplitude_value[197]; - EXPECT_EQ( - get_asamplitude_value[198])>( - reinterpret_cast(&last_msg_->amplitude_value[198])), - 247) - << "incorrect value for amplitude_value[198], expected 247, is " - << last_msg_->amplitude_value[198]; - EXPECT_EQ( - get_asamplitude_value[199])>( - reinterpret_cast(&last_msg_->amplitude_value[199])), - 84) - << "incorrect value for amplitude_value[199], expected 84, is " - << last_msg_->amplitude_value[199]; - EXPECT_EQ( - get_asamplitude_value[200])>( - reinterpret_cast(&last_msg_->amplitude_value[200])), - 183) - << "incorrect value for amplitude_value[200], expected 183, is " - << last_msg_->amplitude_value[200]; - EXPECT_EQ( - get_asamplitude_value[201])>( - reinterpret_cast(&last_msg_->amplitude_value[201])), - 105) - << "incorrect value for amplitude_value[201], expected 105, is " - << last_msg_->amplitude_value[201]; - EXPECT_EQ( - get_asamplitude_value[202])>( - reinterpret_cast(&last_msg_->amplitude_value[202])), - 39) - << "incorrect value for amplitude_value[202], expected 39, is " - << last_msg_->amplitude_value[202]; - EXPECT_EQ( - get_asamplitude_value[203])>( - reinterpret_cast(&last_msg_->amplitude_value[203])), - 157) - << "incorrect value for amplitude_value[203], expected 157, is " - << last_msg_->amplitude_value[203]; - EXPECT_EQ( - get_asamplitude_value[204])>( - reinterpret_cast(&last_msg_->amplitude_value[204])), - 77) - << "incorrect value for amplitude_value[204], expected 77, is " - << last_msg_->amplitude_value[204]; - EXPECT_EQ( - get_asamplitude_value[205])>( - reinterpret_cast(&last_msg_->amplitude_value[205])), - 30) - << "incorrect value for amplitude_value[205], expected 30, is " - << last_msg_->amplitude_value[205]; - EXPECT_EQ( - get_asamplitude_value[206])>( - reinterpret_cast(&last_msg_->amplitude_value[206])), - 205) - << "incorrect value for amplitude_value[206], expected 205, is " - << last_msg_->amplitude_value[206]; - EXPECT_EQ( - get_asamplitude_value[207])>( - reinterpret_cast(&last_msg_->amplitude_value[207])), - 194) - << "incorrect value for amplitude_value[207], expected 194, is " - << last_msg_->amplitude_value[207]; - EXPECT_EQ( - get_asamplitude_value[208])>( - reinterpret_cast(&last_msg_->amplitude_value[208])), - 59) - << "incorrect value for amplitude_value[208], expected 59, is " - << last_msg_->amplitude_value[208]; - EXPECT_EQ( - get_asamplitude_value[209])>( - reinterpret_cast(&last_msg_->amplitude_value[209])), - 64) - << "incorrect value for amplitude_value[209], expected 64, is " - << last_msg_->amplitude_value[209]; - EXPECT_EQ( - get_asamplitude_value[210])>( - reinterpret_cast(&last_msg_->amplitude_value[210])), - 241) - << "incorrect value for amplitude_value[210], expected 241, is " - << last_msg_->amplitude_value[210]; - EXPECT_EQ( - get_asamplitude_value[211])>( - reinterpret_cast(&last_msg_->amplitude_value[211])), - 183) - << "incorrect value for amplitude_value[211], expected 183, is " - << last_msg_->amplitude_value[211]; - EXPECT_EQ( - get_asamplitude_value[212])>( - reinterpret_cast(&last_msg_->amplitude_value[212])), - 238) - << "incorrect value for amplitude_value[212], expected 238, is " - << last_msg_->amplitude_value[212]; - EXPECT_EQ( - get_asamplitude_value[213])>( - reinterpret_cast(&last_msg_->amplitude_value[213])), - 105) - << "incorrect value for amplitude_value[213], expected 105, is " - << last_msg_->amplitude_value[213]; - EXPECT_EQ( - get_asamplitude_value[214])>( - reinterpret_cast(&last_msg_->amplitude_value[214])), - 181) - << "incorrect value for amplitude_value[214], expected 181, is " - << last_msg_->amplitude_value[214]; - EXPECT_EQ( - get_asamplitude_value[215])>( - reinterpret_cast(&last_msg_->amplitude_value[215])), - 170) - << "incorrect value for amplitude_value[215], expected 170, is " - << last_msg_->amplitude_value[215]; - EXPECT_EQ( - get_asamplitude_value[216])>( - reinterpret_cast(&last_msg_->amplitude_value[216])), - 45) - << "incorrect value for amplitude_value[216], expected 45, is " - << last_msg_->amplitude_value[216]; - EXPECT_EQ( - get_asamplitude_value[217])>( - reinterpret_cast(&last_msg_->amplitude_value[217])), - 8) - << "incorrect value for amplitude_value[217], expected 8, is " - << last_msg_->amplitude_value[217]; - EXPECT_EQ( - get_asamplitude_value[218])>( - reinterpret_cast(&last_msg_->amplitude_value[218])), - 166) - << "incorrect value for amplitude_value[218], expected 166, is " - << last_msg_->amplitude_value[218]; - EXPECT_EQ( - get_asamplitude_value[219])>( - reinterpret_cast(&last_msg_->amplitude_value[219])), - 164) - << "incorrect value for amplitude_value[219], expected 164, is " - << last_msg_->amplitude_value[219]; - EXPECT_EQ( - get_asamplitude_value[220])>( - reinterpret_cast(&last_msg_->amplitude_value[220])), - 238) - << "incorrect value for amplitude_value[220], expected 238, is " - << last_msg_->amplitude_value[220]; - EXPECT_EQ( - get_asamplitude_value[221])>( - reinterpret_cast(&last_msg_->amplitude_value[221])), - 83) - << "incorrect value for amplitude_value[221], expected 83, is " - << last_msg_->amplitude_value[221]; - EXPECT_EQ( - get_asamplitude_value[222])>( - reinterpret_cast(&last_msg_->amplitude_value[222])), - 148) - << "incorrect value for amplitude_value[222], expected 148, is " - << last_msg_->amplitude_value[222]; - EXPECT_EQ( - get_asamplitude_value[223])>( - reinterpret_cast(&last_msg_->amplitude_value[223])), - 173) - << "incorrect value for amplitude_value[223], expected 173, is " - << last_msg_->amplitude_value[223]; - EXPECT_EQ( - get_asamplitude_value[224])>( - reinterpret_cast(&last_msg_->amplitude_value[224])), - 108) - << "incorrect value for amplitude_value[224], expected 108, is " - << last_msg_->amplitude_value[224]; - EXPECT_EQ( - get_asamplitude_value[225])>( - reinterpret_cast(&last_msg_->amplitude_value[225])), - 228) - << "incorrect value for amplitude_value[225], expected 228, is " - << last_msg_->amplitude_value[225]; - EXPECT_EQ( - get_asamplitude_value[226])>( - reinterpret_cast(&last_msg_->amplitude_value[226])), - 67) - << "incorrect value for amplitude_value[226], expected 67, is " - << last_msg_->amplitude_value[226]; - EXPECT_EQ( - get_asamplitude_value[227])>( - reinterpret_cast(&last_msg_->amplitude_value[227])), - 89) - << "incorrect value for amplitude_value[227], expected 89, is " - << last_msg_->amplitude_value[227]; - EXPECT_EQ( - get_asamplitude_value[228])>( - reinterpret_cast(&last_msg_->amplitude_value[228])), - 189) - << "incorrect value for amplitude_value[228], expected 189, is " - << last_msg_->amplitude_value[228]; - EXPECT_EQ( - get_asamplitude_value[229])>( - reinterpret_cast(&last_msg_->amplitude_value[229])), - 67) - << "incorrect value for amplitude_value[229], expected 67, is " - << last_msg_->amplitude_value[229]; - EXPECT_EQ( - get_asamplitude_value[230])>( - reinterpret_cast(&last_msg_->amplitude_value[230])), - 26) - << "incorrect value for amplitude_value[230], expected 26, is " - << last_msg_->amplitude_value[230]; - EXPECT_EQ(get_aschannel_tag)>( - reinterpret_cast(&last_msg_->channel_tag)), - 5878) - << "incorrect value for channel_tag, expected 5878, is " - << last_msg_->channel_tag; - EXPECT_LT((last_msg_->freq_ref * 100 - 6348.20019531 * 100), 0.05) - << "incorrect value for freq_ref, expected 6348.20019531, is " - << last_msg_->freq_ref; - EXPECT_LT((last_msg_->freq_step * 100 - 4608.20019531 * 100), 0.05) - << "incorrect value for freq_step, expected 4608.20019531, is " - << last_msg_->freq_step; - EXPECT_EQ(get_ast.tow)>( - reinterpret_cast(&last_msg_->t.tow)), - 992295133) - << "incorrect value for t.tow, expected 992295133, is " - << last_msg_->t.tow; - EXPECT_EQ(get_ast.wn)>( - reinterpret_cast(&last_msg_->t.wn)), - 6957) - << "incorrect value for t.wn, expected 6957, is " << last_msg_->t.wn; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgThreadState.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgThreadState.cc deleted file mode 100644 index bdd2e9654d..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgThreadState.cc +++ /dev/null @@ -1,1276 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgThreadState.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgThreadState0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgThreadState0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_thread_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_thread_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgThreadState0, Test) { - uint8_t encoded_frame[] = { - 85, 23, 0, 246, 215, 26, 109, 97, 105, 110, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 9, 0, 0, 73, 138, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_thread_state_t *test_msg = (msg_thread_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cpu = 0; - { - const char assign_string[] = { - (char)109, (char)97, (char)105, (char)110, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->stack_free = 2460; - - EXPECT_EQ(send_message(0x17, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascpu)>( - reinterpret_cast(&last_msg_->cpu)), - 0) - << "incorrect value for cpu, expected 0, is " << last_msg_->cpu; - { - const char check_string[] = { - (char)109, (char)97, (char)105, (char)110, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->name, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->name, expected string '" - << check_string << "', is '" << last_msg_->name << "'"; - } - EXPECT_EQ(get_asstack_free)>( - reinterpret_cast(&last_msg_->stack_free)), - 2460) - << "incorrect value for stack_free, expected 2460, is " - << last_msg_->stack_free; -} -class Test_legacy_auto_check_sbp_piksi_MsgThreadState1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgThreadState1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_thread_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_thread_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgThreadState1, Test) { - uint8_t encoded_frame[] = { - 85, 23, 0, 246, 215, 26, 105, 100, 108, 101, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 2, 36, 0, 0, 0, 151, 20, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_thread_state_t *test_msg = (msg_thread_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cpu = 595; - { - const char assign_string[] = { - (char)105, (char)100, (char)108, (char)101, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->stack_free = 36; - - EXPECT_EQ(send_message(0x17, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascpu)>( - reinterpret_cast(&last_msg_->cpu)), - 595) - << "incorrect value for cpu, expected 595, is " << last_msg_->cpu; - { - const char check_string[] = { - (char)105, (char)100, (char)108, (char)101, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->name, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->name, expected string '" - << check_string << "', is '" << last_msg_->name << "'"; - } - EXPECT_EQ(get_asstack_free)>( - reinterpret_cast(&last_msg_->stack_free)), - 36) - << "incorrect value for stack_free, expected 36, is " - << last_msg_->stack_free; -} -class Test_legacy_auto_check_sbp_piksi_MsgThreadState2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgThreadState2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_thread_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_thread_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgThreadState2, Test) { - uint8_t encoded_frame[] = { - 85, 23, 0, 246, 215, 26, 78, 65, 80, 32, 73, 83, 82, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 116, 4, 0, 0, 226, 60, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_thread_state_t *test_msg = (msg_thread_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cpu = 14; - { - const char assign_string[] = { - (char)78, (char)65, (char)80, (char)32, (char)73, (char)83, (char)82, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->stack_free = 1140; - - EXPECT_EQ(send_message(0x17, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascpu)>( - reinterpret_cast(&last_msg_->cpu)), - 14) - << "incorrect value for cpu, expected 14, is " << last_msg_->cpu; - { - const char check_string[] = { - (char)78, (char)65, (char)80, (char)32, (char)73, (char)83, (char)82, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->name, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->name, expected string '" - << check_string << "', is '" << last_msg_->name << "'"; - } - EXPECT_EQ(get_asstack_free)>( - reinterpret_cast(&last_msg_->stack_free)), - 1140) - << "incorrect value for stack_free, expected 1140, is " - << last_msg_->stack_free; -} -class Test_legacy_auto_check_sbp_piksi_MsgThreadState3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgThreadState3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_thread_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_thread_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgThreadState3, Test) { - uint8_t encoded_frame[] = { - 85, 23, 0, 246, 215, 26, 83, 66, 80, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 196, 19, 0, 0, 90, 169, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_thread_state_t *test_msg = (msg_thread_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cpu = 1; - { - const char assign_string[] = { - (char)83, (char)66, (char)80, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->stack_free = 5060; - - EXPECT_EQ(send_message(0x17, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascpu)>( - reinterpret_cast(&last_msg_->cpu)), - 1) - << "incorrect value for cpu, expected 1, is " << last_msg_->cpu; - { - const char check_string[] = { - (char)83, (char)66, (char)80, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->name, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->name, expected string '" - << check_string << "', is '" << last_msg_->name << "'"; - } - EXPECT_EQ(get_asstack_free)>( - reinterpret_cast(&last_msg_->stack_free)), - 5060) - << "incorrect value for stack_free, expected 5060, is " - << last_msg_->stack_free; -} -class Test_legacy_auto_check_sbp_piksi_MsgThreadState4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgThreadState4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_thread_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_thread_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgThreadState4, Test) { - uint8_t encoded_frame[] = { - 85, 23, 0, 246, 215, 26, 109, 97, 110, 97, 103, 101, 32, 97, 99, 113, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 20, 9, 0, 0, 47, 75, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_thread_state_t *test_msg = (msg_thread_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cpu = 7; - { - const char assign_string[] = {(char)109, (char)97, (char)110, (char)97, - (char)103, (char)101, (char)32, (char)97, - (char)99, (char)113, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->stack_free = 2324; - - EXPECT_EQ(send_message(0x17, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascpu)>( - reinterpret_cast(&last_msg_->cpu)), - 7) - << "incorrect value for cpu, expected 7, is " << last_msg_->cpu; - { - const char check_string[] = {(char)109, (char)97, (char)110, (char)97, - (char)103, (char)101, (char)32, (char)97, - (char)99, (char)113, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->name, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->name, expected string '" - << check_string << "', is '" << last_msg_->name << "'"; - } - EXPECT_EQ(get_asstack_free)>( - reinterpret_cast(&last_msg_->stack_free)), - 2324) - << "incorrect value for stack_free, expected 2324, is " - << last_msg_->stack_free; -} -class Test_legacy_auto_check_sbp_piksi_MsgThreadState5 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgThreadState5() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_thread_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_thread_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgThreadState5, Test) { - uint8_t encoded_frame[] = { - 85, 23, 0, 195, 4, 26, 109, 97, 105, 110, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 148, 9, 0, 0, 195, 212, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_thread_state_t *test_msg = (msg_thread_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cpu = 0; - { - const char assign_string[] = { - (char)109, (char)97, (char)105, (char)110, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->stack_free = 2452; - - EXPECT_EQ(send_message(0x17, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascpu)>( - reinterpret_cast(&last_msg_->cpu)), - 0) - << "incorrect value for cpu, expected 0, is " << last_msg_->cpu; - { - const char check_string[] = { - (char)109, (char)97, (char)105, (char)110, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->name, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->name, expected string '" - << check_string << "', is '" << last_msg_->name << "'"; - } - EXPECT_EQ(get_asstack_free)>( - reinterpret_cast(&last_msg_->stack_free)), - 2452) - << "incorrect value for stack_free, expected 2452, is " - << last_msg_->stack_free; -} -class Test_legacy_auto_check_sbp_piksi_MsgThreadState6 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgThreadState6() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_thread_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_thread_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgThreadState6, Test) { - uint8_t encoded_frame[] = { - 85, 23, 0, 195, 4, 26, 105, 100, 108, 101, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 228, 1, 36, 0, 0, 0, 225, 18, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_thread_state_t *test_msg = (msg_thread_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cpu = 484; - { - const char assign_string[] = { - (char)105, (char)100, (char)108, (char)101, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->stack_free = 36; - - EXPECT_EQ(send_message(0x17, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascpu)>( - reinterpret_cast(&last_msg_->cpu)), - 484) - << "incorrect value for cpu, expected 484, is " << last_msg_->cpu; - { - const char check_string[] = { - (char)105, (char)100, (char)108, (char)101, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->name, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->name, expected string '" - << check_string << "', is '" << last_msg_->name << "'"; - } - EXPECT_EQ(get_asstack_free)>( - reinterpret_cast(&last_msg_->stack_free)), - 36) - << "incorrect value for stack_free, expected 36, is " - << last_msg_->stack_free; -} -class Test_legacy_auto_check_sbp_piksi_MsgThreadState7 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgThreadState7() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_thread_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_thread_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgThreadState7, Test) { - uint8_t encoded_frame[] = { - 85, 23, 0, 195, 4, 26, 78, 65, 80, 32, 73, 83, 82, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 1, 92, 7, 0, 0, 166, 116, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_thread_state_t *test_msg = (msg_thread_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cpu = 394; - { - const char assign_string[] = { - (char)78, (char)65, (char)80, (char)32, (char)73, (char)83, (char)82, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->stack_free = 1884; - - EXPECT_EQ(send_message(0x17, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascpu)>( - reinterpret_cast(&last_msg_->cpu)), - 394) - << "incorrect value for cpu, expected 394, is " << last_msg_->cpu; - { - const char check_string[] = { - (char)78, (char)65, (char)80, (char)32, (char)73, (char)83, (char)82, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->name, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->name, expected string '" - << check_string << "', is '" << last_msg_->name << "'"; - } - EXPECT_EQ(get_asstack_free)>( - reinterpret_cast(&last_msg_->stack_free)), - 1884) - << "incorrect value for stack_free, expected 1884, is " - << last_msg_->stack_free; -} -class Test_legacy_auto_check_sbp_piksi_MsgThreadState8 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgThreadState8() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_thread_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_thread_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgThreadState8, Test) { - uint8_t encoded_frame[] = { - 85, 23, 0, 195, 4, 26, 83, 66, 80, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 12, 0, 0, 229, 174, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_thread_state_t *test_msg = (msg_thread_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cpu = 1; - { - const char assign_string[] = { - (char)83, (char)66, (char)80, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->stack_free = 3076; - - EXPECT_EQ(send_message(0x17, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascpu)>( - reinterpret_cast(&last_msg_->cpu)), - 1) - << "incorrect value for cpu, expected 1, is " << last_msg_->cpu; - { - const char check_string[] = { - (char)83, (char)66, (char)80, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->name, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->name, expected string '" - << check_string << "', is '" << last_msg_->name << "'"; - } - EXPECT_EQ(get_asstack_free)>( - reinterpret_cast(&last_msg_->stack_free)), - 3076) - << "incorrect value for stack_free, expected 3076, is " - << last_msg_->stack_free; -} -class Test_legacy_auto_check_sbp_piksi_MsgThreadState9 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgThreadState9() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_thread_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_thread_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgThreadState9, Test) { - uint8_t encoded_frame[] = { - 85, 23, 0, 195, 4, 26, 109, 97, 110, 97, 103, 101, 32, 97, 99, 113, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 124, 9, 0, 0, 52, 2, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_thread_state_t *test_msg = (msg_thread_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cpu = 10; - { - const char assign_string[] = {(char)109, (char)97, (char)110, (char)97, - (char)103, (char)101, (char)32, (char)97, - (char)99, (char)113, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->stack_free = 2428; - - EXPECT_EQ(send_message(0x17, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascpu)>( - reinterpret_cast(&last_msg_->cpu)), - 10) - << "incorrect value for cpu, expected 10, is " << last_msg_->cpu; - { - const char check_string[] = {(char)109, (char)97, (char)110, (char)97, - (char)103, (char)101, (char)32, (char)97, - (char)99, (char)113, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->name, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->name, expected string '" - << check_string << "', is '" << last_msg_->name << "'"; - } - EXPECT_EQ(get_asstack_free)>( - reinterpret_cast(&last_msg_->stack_free)), - 2428) - << "incorrect value for stack_free, expected 2428, is " - << last_msg_->stack_free; -} -class Test_legacy_auto_check_sbp_piksi_MsgThreadState10 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgThreadState10() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_thread_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_thread_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgThreadState10, Test) { - uint8_t encoded_frame[] = { - 85, 23, 0, 195, 4, 26, 109, 97, 110, 97, 103, 101, 32, 116, 114, 97, 99, - 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 9, 0, 0, 122, 54, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_thread_state_t *test_msg = (msg_thread_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cpu = 0; - { - const char assign_string[] = {(char)109, (char)97, (char)110, (char)97, - (char)103, (char)101, (char)32, (char)116, - (char)114, (char)97, (char)99, (char)107, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - memcpy(test_msg->name, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->name) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->stack_free = 2332; - - EXPECT_EQ(send_message(0x17, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascpu)>( - reinterpret_cast(&last_msg_->cpu)), - 0) - << "incorrect value for cpu, expected 0, is " << last_msg_->cpu; - { - const char check_string[] = {(char)109, (char)97, (char)110, (char)97, - (char)103, (char)101, (char)32, (char)116, - (char)114, (char)97, (char)99, (char)107, - (char)0, (char)0, (char)0, (char)0, - (char)0, (char)0, (char)0, (char)0}; - EXPECT_EQ(memcmp(last_msg_->name, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->name, expected string '" - << check_string << "', is '" << last_msg_->name << "'"; - } - EXPECT_EQ(get_asstack_free)>( - reinterpret_cast(&last_msg_->stack_free)), - 2332) - << "incorrect value for stack_free, expected 2332, is " - << last_msg_->stack_free; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgUartState.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgUartState.cc deleted file mode 100644 index 46f18c83f8..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgUartState.cc +++ /dev/null @@ -1,731 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgUartState.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgUartState0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgUartState0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_uart_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_uart_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgUartState0, Test) { - uint8_t encoded_frame[] = { - 85, 29, 0, 200, 224, 74, 154, 169, 242, 69, 102, 166, 231, 68, - 89, 98, 79, 184, 138, 244, 154, 73, 201, 69, 154, 65, 211, 69, - 201, 16, 103, 249, 143, 161, 154, 17, 186, 69, 51, 211, 7, 69, - 215, 149, 253, 25, 218, 24, 29, 195, 16, 19, 159, 142, 71, 17, - 10, 113, 137, 219, 135, 18, 182, 21, 38, 190, 59, 196, 169, 155, - 107, 111, 253, 168, 244, 158, 112, 19, 251, 131, 100, 225, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_uart_state_t *test_msg = (msg_uart_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->latency.avg = 319865629; - test_msg->latency.current = 364253831; - test_msg->latency.lmax = -611749622; - test_msg->latency.lmin = 289902239; - test_msg->obs_period.avg = -1002717658; - test_msg->obs_period.current = -2080697488; - test_msg->obs_period.pmax = -1628133123; - test_msg->obs_period.pmin = 1869323177; - test_msg->uart_a.crc_error_count = 25177; - test_msg->uart_a.io_error_count = 47183; - test_msg->uart_a.rx_buffer_level = 244; - test_msg->uart_a.rx_throughput = 1853.199951171875; - test_msg->uart_a.tx_buffer_level = 138; - test_msg->uart_a.tx_throughput = 7765.2001953125; - test_msg->uart_b.crc_error_count = 4297; - test_msg->uart_b.io_error_count = 63847; - test_msg->uart_b.rx_buffer_level = 161; - test_msg->uart_b.rx_throughput = 6760.2001953125; - test_msg->uart_b.tx_buffer_level = 143; - test_msg->uart_b.tx_throughput = 6441.2001953125; - test_msg->uart_ftdi.crc_error_count = 38359; - test_msg->uart_ftdi.io_error_count = 6653; - test_msg->uart_ftdi.rx_buffer_level = 24; - test_msg->uart_ftdi.rx_throughput = 2173.199951171875; - test_msg->uart_ftdi.tx_buffer_level = 218; - test_msg->uart_ftdi.tx_throughput = 5954.2001953125; - - EXPECT_EQ(send_message(0x1d, 57544, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 57544); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_aslatency.avg)>( - reinterpret_cast(&last_msg_->latency.avg)), - 319865629) - << "incorrect value for latency.avg, expected 319865629, is " - << last_msg_->latency.avg; - EXPECT_EQ(get_aslatency.current)>( - reinterpret_cast(&last_msg_->latency.current)), - 364253831) - << "incorrect value for latency.current, expected 364253831, is " - << last_msg_->latency.current; - EXPECT_EQ(get_aslatency.lmax)>( - reinterpret_cast(&last_msg_->latency.lmax)), - -611749622) - << "incorrect value for latency.lmax, expected -611749622, is " - << last_msg_->latency.lmax; - EXPECT_EQ(get_aslatency.lmin)>( - reinterpret_cast(&last_msg_->latency.lmin)), - 289902239) - << "incorrect value for latency.lmin, expected 289902239, is " - << last_msg_->latency.lmin; - EXPECT_EQ(get_asobs_period.avg)>( - reinterpret_cast(&last_msg_->obs_period.avg)), - -1002717658) - << "incorrect value for obs_period.avg, expected -1002717658, is " - << last_msg_->obs_period.avg; - EXPECT_EQ( - get_asobs_period.current)>( - reinterpret_cast(&last_msg_->obs_period.current)), - -2080697488) - << "incorrect value for obs_period.current, expected -2080697488, is " - << last_msg_->obs_period.current; - EXPECT_EQ(get_asobs_period.pmax)>( - reinterpret_cast(&last_msg_->obs_period.pmax)), - -1628133123) - << "incorrect value for obs_period.pmax, expected -1628133123, is " - << last_msg_->obs_period.pmax; - EXPECT_EQ(get_asobs_period.pmin)>( - reinterpret_cast(&last_msg_->obs_period.pmin)), - 1869323177) - << "incorrect value for obs_period.pmin, expected 1869323177, is " - << last_msg_->obs_period.pmin; - EXPECT_EQ(get_asuart_a.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_a.crc_error_count)), - 25177) - << "incorrect value for uart_a.crc_error_count, expected 25177, is " - << last_msg_->uart_a.crc_error_count; - EXPECT_EQ( - get_asuart_a.io_error_count)>( - reinterpret_cast(&last_msg_->uart_a.io_error_count)), - 47183) - << "incorrect value for uart_a.io_error_count, expected 47183, is " - << last_msg_->uart_a.io_error_count; - EXPECT_EQ(get_asuart_a.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.rx_buffer_level)), - 244) - << "incorrect value for uart_a.rx_buffer_level, expected 244, is " - << last_msg_->uart_a.rx_buffer_level; - EXPECT_LT((last_msg_->uart_a.rx_throughput * 100 - 1853.19995117 * 100), 0.05) - << "incorrect value for uart_a.rx_throughput, expected 1853.19995117, is " - << last_msg_->uart_a.rx_throughput; - EXPECT_EQ(get_asuart_a.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.tx_buffer_level)), - 138) - << "incorrect value for uart_a.tx_buffer_level, expected 138, is " - << last_msg_->uart_a.tx_buffer_level; - EXPECT_LT((last_msg_->uart_a.tx_throughput * 100 - 7765.20019531 * 100), 0.05) - << "incorrect value for uart_a.tx_throughput, expected 7765.20019531, is " - << last_msg_->uart_a.tx_throughput; - EXPECT_EQ(get_asuart_b.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_b.crc_error_count)), - 4297) - << "incorrect value for uart_b.crc_error_count, expected 4297, is " - << last_msg_->uart_b.crc_error_count; - EXPECT_EQ( - get_asuart_b.io_error_count)>( - reinterpret_cast(&last_msg_->uart_b.io_error_count)), - 63847) - << "incorrect value for uart_b.io_error_count, expected 63847, is " - << last_msg_->uart_b.io_error_count; - EXPECT_EQ(get_asuart_b.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.rx_buffer_level)), - 161) - << "incorrect value for uart_b.rx_buffer_level, expected 161, is " - << last_msg_->uart_b.rx_buffer_level; - EXPECT_LT((last_msg_->uart_b.rx_throughput * 100 - 6760.20019531 * 100), 0.05) - << "incorrect value for uart_b.rx_throughput, expected 6760.20019531, is " - << last_msg_->uart_b.rx_throughput; - EXPECT_EQ(get_asuart_b.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.tx_buffer_level)), - 143) - << "incorrect value for uart_b.tx_buffer_level, expected 143, is " - << last_msg_->uart_b.tx_buffer_level; - EXPECT_LT((last_msg_->uart_b.tx_throughput * 100 - 6441.20019531 * 100), 0.05) - << "incorrect value for uart_b.tx_throughput, expected 6441.20019531, is " - << last_msg_->uart_b.tx_throughput; - EXPECT_EQ(get_asuart_ftdi.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.crc_error_count)), - 38359) - << "incorrect value for uart_ftdi.crc_error_count, expected 38359, is " - << last_msg_->uart_ftdi.crc_error_count; - EXPECT_EQ(get_asuart_ftdi.io_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.io_error_count)), - 6653) - << "incorrect value for uart_ftdi.io_error_count, expected 6653, is " - << last_msg_->uart_ftdi.io_error_count; - EXPECT_EQ(get_asuart_ftdi.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.rx_buffer_level)), - 24) - << "incorrect value for uart_ftdi.rx_buffer_level, expected 24, is " - << last_msg_->uart_ftdi.rx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.rx_throughput * 100 - 2173.19995117 * 100), - 0.05) - << "incorrect value for uart_ftdi.rx_throughput, expected 2173.19995117, " - "is " - << last_msg_->uart_ftdi.rx_throughput; - EXPECT_EQ(get_asuart_ftdi.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.tx_buffer_level)), - 218) - << "incorrect value for uart_ftdi.tx_buffer_level, expected 218, is " - << last_msg_->uart_ftdi.tx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.tx_throughput * 100 - 5954.20019531 * 100), - 0.05) - << "incorrect value for uart_ftdi.tx_throughput, expected 5954.20019531, " - "is " - << last_msg_->uart_ftdi.tx_throughput; -} -class Test_legacy_auto_check_sbp_piksi_MsgUartState1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgUartState1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_uart_state_depa_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_uart_state_depa_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgUartState1, Test) { - uint8_t encoded_frame[] = { - 85, 24, 0, 246, 215, 58, 26, 191, 93, 63, 0, 0, 0, 0, - 0, 0, 0, 0, 24, 0, 123, 50, 62, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 54, 7, 162, 64, 177, 57, 16, 61, - 0, 0, 0, 0, 81, 1, 255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, 71, 124, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_uart_state_depa_t *test_msg = (msg_uart_state_depa_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->latency.avg = -1; - test_msg->latency.current = -1; - test_msg->latency.lmax = 0; - test_msg->latency.lmin = 0; - test_msg->uart_a.crc_error_count = 0; - test_msg->uart_a.io_error_count = 0; - test_msg->uart_a.rx_buffer_level = 0; - test_msg->uart_a.rx_throughput = 0.0; - test_msg->uart_a.tx_buffer_level = 24; - test_msg->uart_a.tx_throughput = 0.8661972284317017; - test_msg->uart_b.crc_error_count = 0; - test_msg->uart_b.io_error_count = 0; - test_msg->uart_b.rx_buffer_level = 0; - test_msg->uart_b.rx_throughput = 0.0; - test_msg->uart_b.tx_buffer_level = 40; - test_msg->uart_b.tx_throughput = 2.9718310832977295; - test_msg->uart_ftdi.crc_error_count = 0; - test_msg->uart_ftdi.io_error_count = 0; - test_msg->uart_ftdi.rx_buffer_level = 1; - test_msg->uart_ftdi.rx_throughput = 0.035211268812417984; - test_msg->uart_ftdi.tx_buffer_level = 81; - test_msg->uart_ftdi.tx_throughput = 5.063380241394043; - - EXPECT_EQ(send_message(0x18, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_aslatency.avg)>( - reinterpret_cast(&last_msg_->latency.avg)), - -1) - << "incorrect value for latency.avg, expected -1, is " - << last_msg_->latency.avg; - EXPECT_EQ(get_aslatency.current)>( - reinterpret_cast(&last_msg_->latency.current)), - -1) - << "incorrect value for latency.current, expected -1, is " - << last_msg_->latency.current; - EXPECT_EQ(get_aslatency.lmax)>( - reinterpret_cast(&last_msg_->latency.lmax)), - 0) - << "incorrect value for latency.lmax, expected 0, is " - << last_msg_->latency.lmax; - EXPECT_EQ(get_aslatency.lmin)>( - reinterpret_cast(&last_msg_->latency.lmin)), - 0) - << "incorrect value for latency.lmin, expected 0, is " - << last_msg_->latency.lmin; - EXPECT_EQ(get_asuart_a.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_a.crc_error_count)), - 0) - << "incorrect value for uart_a.crc_error_count, expected 0, is " - << last_msg_->uart_a.crc_error_count; - EXPECT_EQ( - get_asuart_a.io_error_count)>( - reinterpret_cast(&last_msg_->uart_a.io_error_count)), - 0) - << "incorrect value for uart_a.io_error_count, expected 0, is " - << last_msg_->uart_a.io_error_count; - EXPECT_EQ(get_asuart_a.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.rx_buffer_level)), - 0) - << "incorrect value for uart_a.rx_buffer_level, expected 0, is " - << last_msg_->uart_a.rx_buffer_level; - EXPECT_LT((last_msg_->uart_a.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_a.rx_throughput, expected 0.0, is " - << last_msg_->uart_a.rx_throughput; - EXPECT_EQ(get_asuart_a.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.tx_buffer_level)), - 24) - << "incorrect value for uart_a.tx_buffer_level, expected 24, is " - << last_msg_->uart_a.tx_buffer_level; - EXPECT_LT((last_msg_->uart_a.tx_throughput * 100 - 0.866197228432 * 100), - 0.05) - << "incorrect value for uart_a.tx_throughput, expected 0.866197228432, " - "is " - << last_msg_->uart_a.tx_throughput; - EXPECT_EQ(get_asuart_b.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_b.crc_error_count)), - 0) - << "incorrect value for uart_b.crc_error_count, expected 0, is " - << last_msg_->uart_b.crc_error_count; - EXPECT_EQ( - get_asuart_b.io_error_count)>( - reinterpret_cast(&last_msg_->uart_b.io_error_count)), - 0) - << "incorrect value for uart_b.io_error_count, expected 0, is " - << last_msg_->uart_b.io_error_count; - EXPECT_EQ(get_asuart_b.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.rx_buffer_level)), - 0) - << "incorrect value for uart_b.rx_buffer_level, expected 0, is " - << last_msg_->uart_b.rx_buffer_level; - EXPECT_LT((last_msg_->uart_b.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_b.rx_throughput, expected 0.0, is " - << last_msg_->uart_b.rx_throughput; - EXPECT_EQ(get_asuart_b.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.tx_buffer_level)), - 40) - << "incorrect value for uart_b.tx_buffer_level, expected 40, is " - << last_msg_->uart_b.tx_buffer_level; - EXPECT_LT((last_msg_->uart_b.tx_throughput * 100 - 2.9718310833 * 100), 0.05) - << "incorrect value for uart_b.tx_throughput, expected 2.9718310833, is " - << last_msg_->uart_b.tx_throughput; - EXPECT_EQ(get_asuart_ftdi.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.crc_error_count)), - 0) - << "incorrect value for uart_ftdi.crc_error_count, expected 0, is " - << last_msg_->uart_ftdi.crc_error_count; - EXPECT_EQ(get_asuart_ftdi.io_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.io_error_count)), - 0) - << "incorrect value for uart_ftdi.io_error_count, expected 0, is " - << last_msg_->uart_ftdi.io_error_count; - EXPECT_EQ(get_asuart_ftdi.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.rx_buffer_level)), - 1) - << "incorrect value for uart_ftdi.rx_buffer_level, expected 1, is " - << last_msg_->uart_ftdi.rx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.rx_throughput * 100 - 0.0352112688124 * 100), - 0.05) - << "incorrect value for uart_ftdi.rx_throughput, expected " - "0.0352112688124, is " - << last_msg_->uart_ftdi.rx_throughput; - EXPECT_EQ(get_asuart_ftdi.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.tx_buffer_level)), - 81) - << "incorrect value for uart_ftdi.tx_buffer_level, expected 81, is " - << last_msg_->uart_ftdi.tx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.tx_throughput * 100 - 5.06338024139 * 100), - 0.05) - << "incorrect value for uart_ftdi.tx_throughput, expected 5.06338024139, " - "is " - << last_msg_->uart_ftdi.tx_throughput; -} -class Test_legacy_auto_check_sbp_piksi_MsgUartState2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgUartState2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_uart_state_depa_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_uart_state_depa_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgUartState2, Test) { - uint8_t encoded_frame[] = { - 85, 24, 0, 246, 215, 58, 237, 232, 95, 63, 0, 0, 0, 0, - 0, 0, 0, 0, 24, 0, 198, 186, 63, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 214, 72, 217, 64, 29, 72, 180, 62, - 0, 0, 0, 0, 85, 1, 255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, 153, 248, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_uart_state_depa_t *test_msg = (msg_uart_state_depa_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->latency.avg = -1; - test_msg->latency.current = -1; - test_msg->latency.lmax = 0; - test_msg->latency.lmin = 0; - test_msg->uart_a.crc_error_count = 0; - test_msg->uart_a.io_error_count = 0; - test_msg->uart_a.rx_buffer_level = 0; - test_msg->uart_a.rx_throughput = 0.0; - test_msg->uart_a.tx_buffer_level = 24; - test_msg->uart_a.tx_throughput = 0.8746479153633118; - test_msg->uart_b.crc_error_count = 0; - test_msg->uart_b.io_error_count = 0; - test_msg->uart_b.rx_buffer_level = 0; - test_msg->uart_b.rx_throughput = 0.0; - test_msg->uart_b.tx_buffer_level = 40; - test_msg->uart_b.tx_throughput = 2.995774745941162; - test_msg->uart_ftdi.crc_error_count = 0; - test_msg->uart_ftdi.io_error_count = 0; - test_msg->uart_ftdi.rx_buffer_level = 1; - test_msg->uart_ftdi.rx_throughput = 0.35211268067359924; - test_msg->uart_ftdi.tx_buffer_level = 85; - test_msg->uart_ftdi.tx_throughput = 6.7901411056518555; - - EXPECT_EQ(send_message(0x18, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_aslatency.avg)>( - reinterpret_cast(&last_msg_->latency.avg)), - -1) - << "incorrect value for latency.avg, expected -1, is " - << last_msg_->latency.avg; - EXPECT_EQ(get_aslatency.current)>( - reinterpret_cast(&last_msg_->latency.current)), - -1) - << "incorrect value for latency.current, expected -1, is " - << last_msg_->latency.current; - EXPECT_EQ(get_aslatency.lmax)>( - reinterpret_cast(&last_msg_->latency.lmax)), - 0) - << "incorrect value for latency.lmax, expected 0, is " - << last_msg_->latency.lmax; - EXPECT_EQ(get_aslatency.lmin)>( - reinterpret_cast(&last_msg_->latency.lmin)), - 0) - << "incorrect value for latency.lmin, expected 0, is " - << last_msg_->latency.lmin; - EXPECT_EQ(get_asuart_a.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_a.crc_error_count)), - 0) - << "incorrect value for uart_a.crc_error_count, expected 0, is " - << last_msg_->uart_a.crc_error_count; - EXPECT_EQ( - get_asuart_a.io_error_count)>( - reinterpret_cast(&last_msg_->uart_a.io_error_count)), - 0) - << "incorrect value for uart_a.io_error_count, expected 0, is " - << last_msg_->uart_a.io_error_count; - EXPECT_EQ(get_asuart_a.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.rx_buffer_level)), - 0) - << "incorrect value for uart_a.rx_buffer_level, expected 0, is " - << last_msg_->uart_a.rx_buffer_level; - EXPECT_LT((last_msg_->uart_a.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_a.rx_throughput, expected 0.0, is " - << last_msg_->uart_a.rx_throughput; - EXPECT_EQ(get_asuart_a.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.tx_buffer_level)), - 24) - << "incorrect value for uart_a.tx_buffer_level, expected 24, is " - << last_msg_->uart_a.tx_buffer_level; - EXPECT_LT((last_msg_->uart_a.tx_throughput * 100 - 0.874647915363 * 100), - 0.05) - << "incorrect value for uart_a.tx_throughput, expected 0.874647915363, " - "is " - << last_msg_->uart_a.tx_throughput; - EXPECT_EQ(get_asuart_b.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_b.crc_error_count)), - 0) - << "incorrect value for uart_b.crc_error_count, expected 0, is " - << last_msg_->uart_b.crc_error_count; - EXPECT_EQ( - get_asuart_b.io_error_count)>( - reinterpret_cast(&last_msg_->uart_b.io_error_count)), - 0) - << "incorrect value for uart_b.io_error_count, expected 0, is " - << last_msg_->uart_b.io_error_count; - EXPECT_EQ(get_asuart_b.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.rx_buffer_level)), - 0) - << "incorrect value for uart_b.rx_buffer_level, expected 0, is " - << last_msg_->uart_b.rx_buffer_level; - EXPECT_LT((last_msg_->uart_b.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_b.rx_throughput, expected 0.0, is " - << last_msg_->uart_b.rx_throughput; - EXPECT_EQ(get_asuart_b.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.tx_buffer_level)), - 40) - << "incorrect value for uart_b.tx_buffer_level, expected 40, is " - << last_msg_->uart_b.tx_buffer_level; - EXPECT_LT((last_msg_->uart_b.tx_throughput * 100 - 2.99577474594 * 100), 0.05) - << "incorrect value for uart_b.tx_throughput, expected 2.99577474594, is " - << last_msg_->uart_b.tx_throughput; - EXPECT_EQ(get_asuart_ftdi.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.crc_error_count)), - 0) - << "incorrect value for uart_ftdi.crc_error_count, expected 0, is " - << last_msg_->uart_ftdi.crc_error_count; - EXPECT_EQ(get_asuart_ftdi.io_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.io_error_count)), - 0) - << "incorrect value for uart_ftdi.io_error_count, expected 0, is " - << last_msg_->uart_ftdi.io_error_count; - EXPECT_EQ(get_asuart_ftdi.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.rx_buffer_level)), - 1) - << "incorrect value for uart_ftdi.rx_buffer_level, expected 1, is " - << last_msg_->uart_ftdi.rx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.rx_throughput * 100 - 0.352112680674 * 100), - 0.05) - << "incorrect value for uart_ftdi.rx_throughput, expected " - "0.352112680674, is " - << last_msg_->uart_ftdi.rx_throughput; - EXPECT_EQ(get_asuart_ftdi.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.tx_buffer_level)), - 85) - << "incorrect value for uart_ftdi.tx_buffer_level, expected 85, is " - << last_msg_->uart_ftdi.tx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.tx_throughput * 100 - 6.79014110565 * 100), - 0.05) - << "incorrect value for uart_ftdi.tx_throughput, expected 6.79014110565, " - "is " - << last_msg_->uart_ftdi.tx_throughput; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgUartStateDepA.cc b/c/test/legacy/cpp/auto_check_sbp_piksi_MsgUartStateDepA.cc deleted file mode 100644 index bcd1c99eb4..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_piksi_MsgUartStateDepA.cc +++ /dev/null @@ -1,1356 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/piksi/test_MsgUartStateDepA.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_uart_state_depa_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_uart_state_depa_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 24, 0, 195, 4, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 154, 153, 57, 65, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 255, 255, 255, - 255, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 247, 5, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_uart_state_depa_t *test_msg = (msg_uart_state_depa_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->latency.avg = -1; - test_msg->latency.current = -1; - test_msg->latency.lmax = 0; - test_msg->latency.lmin = 0; - test_msg->uart_a.crc_error_count = 0; - test_msg->uart_a.io_error_count = 0; - test_msg->uart_a.rx_buffer_level = 0; - test_msg->uart_a.rx_throughput = 0.0; - test_msg->uart_a.tx_buffer_level = 0; - test_msg->uart_a.tx_throughput = 0.0; - test_msg->uart_b.crc_error_count = 0; - test_msg->uart_b.io_error_count = 0; - test_msg->uart_b.rx_buffer_level = 0; - test_msg->uart_b.rx_throughput = 0.0; - test_msg->uart_b.tx_buffer_level = 0; - test_msg->uart_b.tx_throughput = 0.0; - test_msg->uart_ftdi.crc_error_count = 0; - test_msg->uart_ftdi.io_error_count = 0; - test_msg->uart_ftdi.rx_buffer_level = 0; - test_msg->uart_ftdi.rx_throughput = 0.0; - test_msg->uart_ftdi.tx_buffer_level = 15; - test_msg->uart_ftdi.tx_throughput = 11.600000381469727; - - EXPECT_EQ(send_message(0x18, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_aslatency.avg)>( - reinterpret_cast(&last_msg_->latency.avg)), - -1) - << "incorrect value for latency.avg, expected -1, is " - << last_msg_->latency.avg; - EXPECT_EQ(get_aslatency.current)>( - reinterpret_cast(&last_msg_->latency.current)), - -1) - << "incorrect value for latency.current, expected -1, is " - << last_msg_->latency.current; - EXPECT_EQ(get_aslatency.lmax)>( - reinterpret_cast(&last_msg_->latency.lmax)), - 0) - << "incorrect value for latency.lmax, expected 0, is " - << last_msg_->latency.lmax; - EXPECT_EQ(get_aslatency.lmin)>( - reinterpret_cast(&last_msg_->latency.lmin)), - 0) - << "incorrect value for latency.lmin, expected 0, is " - << last_msg_->latency.lmin; - EXPECT_EQ(get_asuart_a.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_a.crc_error_count)), - 0) - << "incorrect value for uart_a.crc_error_count, expected 0, is " - << last_msg_->uart_a.crc_error_count; - EXPECT_EQ( - get_asuart_a.io_error_count)>( - reinterpret_cast(&last_msg_->uart_a.io_error_count)), - 0) - << "incorrect value for uart_a.io_error_count, expected 0, is " - << last_msg_->uart_a.io_error_count; - EXPECT_EQ(get_asuart_a.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.rx_buffer_level)), - 0) - << "incorrect value for uart_a.rx_buffer_level, expected 0, is " - << last_msg_->uart_a.rx_buffer_level; - EXPECT_LT((last_msg_->uart_a.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_a.rx_throughput, expected 0.0, is " - << last_msg_->uart_a.rx_throughput; - EXPECT_EQ(get_asuart_a.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.tx_buffer_level)), - 0) - << "incorrect value for uart_a.tx_buffer_level, expected 0, is " - << last_msg_->uart_a.tx_buffer_level; - EXPECT_LT((last_msg_->uart_a.tx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_a.tx_throughput, expected 0.0, is " - << last_msg_->uart_a.tx_throughput; - EXPECT_EQ(get_asuart_b.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_b.crc_error_count)), - 0) - << "incorrect value for uart_b.crc_error_count, expected 0, is " - << last_msg_->uart_b.crc_error_count; - EXPECT_EQ( - get_asuart_b.io_error_count)>( - reinterpret_cast(&last_msg_->uart_b.io_error_count)), - 0) - << "incorrect value for uart_b.io_error_count, expected 0, is " - << last_msg_->uart_b.io_error_count; - EXPECT_EQ(get_asuart_b.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.rx_buffer_level)), - 0) - << "incorrect value for uart_b.rx_buffer_level, expected 0, is " - << last_msg_->uart_b.rx_buffer_level; - EXPECT_LT((last_msg_->uart_b.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_b.rx_throughput, expected 0.0, is " - << last_msg_->uart_b.rx_throughput; - EXPECT_EQ(get_asuart_b.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.tx_buffer_level)), - 0) - << "incorrect value for uart_b.tx_buffer_level, expected 0, is " - << last_msg_->uart_b.tx_buffer_level; - EXPECT_LT((last_msg_->uart_b.tx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_b.tx_throughput, expected 0.0, is " - << last_msg_->uart_b.tx_throughput; - EXPECT_EQ(get_asuart_ftdi.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.crc_error_count)), - 0) - << "incorrect value for uart_ftdi.crc_error_count, expected 0, is " - << last_msg_->uart_ftdi.crc_error_count; - EXPECT_EQ(get_asuart_ftdi.io_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.io_error_count)), - 0) - << "incorrect value for uart_ftdi.io_error_count, expected 0, is " - << last_msg_->uart_ftdi.io_error_count; - EXPECT_EQ(get_asuart_ftdi.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.rx_buffer_level)), - 0) - << "incorrect value for uart_ftdi.rx_buffer_level, expected 0, is " - << last_msg_->uart_ftdi.rx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_ftdi.rx_throughput, expected 0.0, is " - << last_msg_->uart_ftdi.rx_throughput; - EXPECT_EQ(get_asuart_ftdi.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.tx_buffer_level)), - 15) - << "incorrect value for uart_ftdi.tx_buffer_level, expected 15, is " - << last_msg_->uart_ftdi.tx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.tx_throughput * 100 - 11.6000003815 * 100), - 0.05) - << "incorrect value for uart_ftdi.tx_throughput, expected 11.6000003815, " - "is " - << last_msg_->uart_ftdi.tx_throughput; -} -class Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_uart_state_depa_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_uart_state_depa_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA1, Test) { - uint8_t encoded_frame[] = { - 85, 24, 0, 195, 4, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 43, 135, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, - 255, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 65, 110, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_uart_state_depa_t *test_msg = (msg_uart_state_depa_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->latency.avg = -1; - test_msg->latency.current = -1; - test_msg->latency.lmax = 0; - test_msg->latency.lmin = 0; - test_msg->uart_a.crc_error_count = 0; - test_msg->uart_a.io_error_count = 0; - test_msg->uart_a.rx_buffer_level = 0; - test_msg->uart_a.rx_throughput = 0.0; - test_msg->uart_a.tx_buffer_level = 0; - test_msg->uart_a.tx_throughput = 0.0; - test_msg->uart_b.crc_error_count = 0; - test_msg->uart_b.io_error_count = 0; - test_msg->uart_b.rx_buffer_level = 0; - test_msg->uart_b.rx_throughput = 0.0; - test_msg->uart_b.tx_buffer_level = 0; - test_msg->uart_b.tx_throughput = 0.0; - test_msg->uart_ftdi.crc_error_count = 0; - test_msg->uart_ftdi.io_error_count = 0; - test_msg->uart_ftdi.rx_buffer_level = 0; - test_msg->uart_ftdi.rx_throughput = 0.0; - test_msg->uart_ftdi.tx_buffer_level = 0; - test_msg->uart_ftdi.tx_throughput = 0.06599999964237213; - - EXPECT_EQ(send_message(0x18, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_aslatency.avg)>( - reinterpret_cast(&last_msg_->latency.avg)), - -1) - << "incorrect value for latency.avg, expected -1, is " - << last_msg_->latency.avg; - EXPECT_EQ(get_aslatency.current)>( - reinterpret_cast(&last_msg_->latency.current)), - -1) - << "incorrect value for latency.current, expected -1, is " - << last_msg_->latency.current; - EXPECT_EQ(get_aslatency.lmax)>( - reinterpret_cast(&last_msg_->latency.lmax)), - 0) - << "incorrect value for latency.lmax, expected 0, is " - << last_msg_->latency.lmax; - EXPECT_EQ(get_aslatency.lmin)>( - reinterpret_cast(&last_msg_->latency.lmin)), - 0) - << "incorrect value for latency.lmin, expected 0, is " - << last_msg_->latency.lmin; - EXPECT_EQ(get_asuart_a.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_a.crc_error_count)), - 0) - << "incorrect value for uart_a.crc_error_count, expected 0, is " - << last_msg_->uart_a.crc_error_count; - EXPECT_EQ( - get_asuart_a.io_error_count)>( - reinterpret_cast(&last_msg_->uart_a.io_error_count)), - 0) - << "incorrect value for uart_a.io_error_count, expected 0, is " - << last_msg_->uart_a.io_error_count; - EXPECT_EQ(get_asuart_a.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.rx_buffer_level)), - 0) - << "incorrect value for uart_a.rx_buffer_level, expected 0, is " - << last_msg_->uart_a.rx_buffer_level; - EXPECT_LT((last_msg_->uart_a.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_a.rx_throughput, expected 0.0, is " - << last_msg_->uart_a.rx_throughput; - EXPECT_EQ(get_asuart_a.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.tx_buffer_level)), - 0) - << "incorrect value for uart_a.tx_buffer_level, expected 0, is " - << last_msg_->uart_a.tx_buffer_level; - EXPECT_LT((last_msg_->uart_a.tx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_a.tx_throughput, expected 0.0, is " - << last_msg_->uart_a.tx_throughput; - EXPECT_EQ(get_asuart_b.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_b.crc_error_count)), - 0) - << "incorrect value for uart_b.crc_error_count, expected 0, is " - << last_msg_->uart_b.crc_error_count; - EXPECT_EQ( - get_asuart_b.io_error_count)>( - reinterpret_cast(&last_msg_->uart_b.io_error_count)), - 0) - << "incorrect value for uart_b.io_error_count, expected 0, is " - << last_msg_->uart_b.io_error_count; - EXPECT_EQ(get_asuart_b.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.rx_buffer_level)), - 0) - << "incorrect value for uart_b.rx_buffer_level, expected 0, is " - << last_msg_->uart_b.rx_buffer_level; - EXPECT_LT((last_msg_->uart_b.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_b.rx_throughput, expected 0.0, is " - << last_msg_->uart_b.rx_throughput; - EXPECT_EQ(get_asuart_b.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.tx_buffer_level)), - 0) - << "incorrect value for uart_b.tx_buffer_level, expected 0, is " - << last_msg_->uart_b.tx_buffer_level; - EXPECT_LT((last_msg_->uart_b.tx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_b.tx_throughput, expected 0.0, is " - << last_msg_->uart_b.tx_throughput; - EXPECT_EQ(get_asuart_ftdi.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.crc_error_count)), - 0) - << "incorrect value for uart_ftdi.crc_error_count, expected 0, is " - << last_msg_->uart_ftdi.crc_error_count; - EXPECT_EQ(get_asuart_ftdi.io_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.io_error_count)), - 0) - << "incorrect value for uart_ftdi.io_error_count, expected 0, is " - << last_msg_->uart_ftdi.io_error_count; - EXPECT_EQ(get_asuart_ftdi.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.rx_buffer_level)), - 0) - << "incorrect value for uart_ftdi.rx_buffer_level, expected 0, is " - << last_msg_->uart_ftdi.rx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_ftdi.rx_throughput, expected 0.0, is " - << last_msg_->uart_ftdi.rx_throughput; - EXPECT_EQ(get_asuart_ftdi.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.tx_buffer_level)), - 0) - << "incorrect value for uart_ftdi.tx_buffer_level, expected 0, is " - << last_msg_->uart_ftdi.tx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.tx_throughput * 100 - 0.0659999996424 * 100), - 0.05) - << "incorrect value for uart_ftdi.tx_throughput, expected " - "0.0659999996424, is " - << last_msg_->uart_ftdi.tx_throughput; -} -class Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_uart_state_depa_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_uart_state_depa_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA2, Test) { - uint8_t encoded_frame[] = { - 85, 24, 0, 195, 4, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, 86, 14, 62, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 255, 255, 255, - 255, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 198, 36, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_uart_state_depa_t *test_msg = (msg_uart_state_depa_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->latency.avg = -1; - test_msg->latency.current = -1; - test_msg->latency.lmax = 0; - test_msg->latency.lmin = 0; - test_msg->uart_a.crc_error_count = 0; - test_msg->uart_a.io_error_count = 0; - test_msg->uart_a.rx_buffer_level = 0; - test_msg->uart_a.rx_throughput = 0.0; - test_msg->uart_a.tx_buffer_level = 0; - test_msg->uart_a.tx_throughput = 0.0; - test_msg->uart_b.crc_error_count = 0; - test_msg->uart_b.io_error_count = 0; - test_msg->uart_b.rx_buffer_level = 0; - test_msg->uart_b.rx_throughput = 0.0; - test_msg->uart_b.tx_buffer_level = 0; - test_msg->uart_b.tx_throughput = 0.0; - test_msg->uart_ftdi.crc_error_count = 0; - test_msg->uart_ftdi.io_error_count = 0; - test_msg->uart_ftdi.rx_buffer_level = 0; - test_msg->uart_ftdi.rx_throughput = 0.0; - test_msg->uart_ftdi.tx_buffer_level = 10; - test_msg->uart_ftdi.tx_throughput = 0.13899999856948853; - - EXPECT_EQ(send_message(0x18, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_aslatency.avg)>( - reinterpret_cast(&last_msg_->latency.avg)), - -1) - << "incorrect value for latency.avg, expected -1, is " - << last_msg_->latency.avg; - EXPECT_EQ(get_aslatency.current)>( - reinterpret_cast(&last_msg_->latency.current)), - -1) - << "incorrect value for latency.current, expected -1, is " - << last_msg_->latency.current; - EXPECT_EQ(get_aslatency.lmax)>( - reinterpret_cast(&last_msg_->latency.lmax)), - 0) - << "incorrect value for latency.lmax, expected 0, is " - << last_msg_->latency.lmax; - EXPECT_EQ(get_aslatency.lmin)>( - reinterpret_cast(&last_msg_->latency.lmin)), - 0) - << "incorrect value for latency.lmin, expected 0, is " - << last_msg_->latency.lmin; - EXPECT_EQ(get_asuart_a.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_a.crc_error_count)), - 0) - << "incorrect value for uart_a.crc_error_count, expected 0, is " - << last_msg_->uart_a.crc_error_count; - EXPECT_EQ( - get_asuart_a.io_error_count)>( - reinterpret_cast(&last_msg_->uart_a.io_error_count)), - 0) - << "incorrect value for uart_a.io_error_count, expected 0, is " - << last_msg_->uart_a.io_error_count; - EXPECT_EQ(get_asuart_a.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.rx_buffer_level)), - 0) - << "incorrect value for uart_a.rx_buffer_level, expected 0, is " - << last_msg_->uart_a.rx_buffer_level; - EXPECT_LT((last_msg_->uart_a.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_a.rx_throughput, expected 0.0, is " - << last_msg_->uart_a.rx_throughput; - EXPECT_EQ(get_asuart_a.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.tx_buffer_level)), - 0) - << "incorrect value for uart_a.tx_buffer_level, expected 0, is " - << last_msg_->uart_a.tx_buffer_level; - EXPECT_LT((last_msg_->uart_a.tx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_a.tx_throughput, expected 0.0, is " - << last_msg_->uart_a.tx_throughput; - EXPECT_EQ(get_asuart_b.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_b.crc_error_count)), - 0) - << "incorrect value for uart_b.crc_error_count, expected 0, is " - << last_msg_->uart_b.crc_error_count; - EXPECT_EQ( - get_asuart_b.io_error_count)>( - reinterpret_cast(&last_msg_->uart_b.io_error_count)), - 0) - << "incorrect value for uart_b.io_error_count, expected 0, is " - << last_msg_->uart_b.io_error_count; - EXPECT_EQ(get_asuart_b.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.rx_buffer_level)), - 0) - << "incorrect value for uart_b.rx_buffer_level, expected 0, is " - << last_msg_->uart_b.rx_buffer_level; - EXPECT_LT((last_msg_->uart_b.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_b.rx_throughput, expected 0.0, is " - << last_msg_->uart_b.rx_throughput; - EXPECT_EQ(get_asuart_b.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.tx_buffer_level)), - 0) - << "incorrect value for uart_b.tx_buffer_level, expected 0, is " - << last_msg_->uart_b.tx_buffer_level; - EXPECT_LT((last_msg_->uart_b.tx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_b.tx_throughput, expected 0.0, is " - << last_msg_->uart_b.tx_throughput; - EXPECT_EQ(get_asuart_ftdi.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.crc_error_count)), - 0) - << "incorrect value for uart_ftdi.crc_error_count, expected 0, is " - << last_msg_->uart_ftdi.crc_error_count; - EXPECT_EQ(get_asuart_ftdi.io_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.io_error_count)), - 0) - << "incorrect value for uart_ftdi.io_error_count, expected 0, is " - << last_msg_->uart_ftdi.io_error_count; - EXPECT_EQ(get_asuart_ftdi.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.rx_buffer_level)), - 0) - << "incorrect value for uart_ftdi.rx_buffer_level, expected 0, is " - << last_msg_->uart_ftdi.rx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_ftdi.rx_throughput, expected 0.0, is " - << last_msg_->uart_ftdi.rx_throughput; - EXPECT_EQ(get_asuart_ftdi.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.tx_buffer_level)), - 10) - << "incorrect value for uart_ftdi.tx_buffer_level, expected 10, is " - << last_msg_->uart_ftdi.tx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.tx_throughput * 100 - 0.138999998569 * 100), - 0.05) - << "incorrect value for uart_ftdi.tx_throughput, expected " - "0.138999998569, is " - << last_msg_->uart_ftdi.tx_throughput; -} -class Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_uart_state_depa_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_uart_state_depa_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA3, Test) { - uint8_t encoded_frame[] = { - 85, 24, 0, 195, 4, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 43, 135, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, - 255, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 65, 110, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_uart_state_depa_t *test_msg = (msg_uart_state_depa_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->latency.avg = -1; - test_msg->latency.current = -1; - test_msg->latency.lmax = 0; - test_msg->latency.lmin = 0; - test_msg->uart_a.crc_error_count = 0; - test_msg->uart_a.io_error_count = 0; - test_msg->uart_a.rx_buffer_level = 0; - test_msg->uart_a.rx_throughput = 0.0; - test_msg->uart_a.tx_buffer_level = 0; - test_msg->uart_a.tx_throughput = 0.0; - test_msg->uart_b.crc_error_count = 0; - test_msg->uart_b.io_error_count = 0; - test_msg->uart_b.rx_buffer_level = 0; - test_msg->uart_b.rx_throughput = 0.0; - test_msg->uart_b.tx_buffer_level = 0; - test_msg->uart_b.tx_throughput = 0.0; - test_msg->uart_ftdi.crc_error_count = 0; - test_msg->uart_ftdi.io_error_count = 0; - test_msg->uart_ftdi.rx_buffer_level = 0; - test_msg->uart_ftdi.rx_throughput = 0.0; - test_msg->uart_ftdi.tx_buffer_level = 0; - test_msg->uart_ftdi.tx_throughput = 0.06599999964237213; - - EXPECT_EQ(send_message(0x18, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_aslatency.avg)>( - reinterpret_cast(&last_msg_->latency.avg)), - -1) - << "incorrect value for latency.avg, expected -1, is " - << last_msg_->latency.avg; - EXPECT_EQ(get_aslatency.current)>( - reinterpret_cast(&last_msg_->latency.current)), - -1) - << "incorrect value for latency.current, expected -1, is " - << last_msg_->latency.current; - EXPECT_EQ(get_aslatency.lmax)>( - reinterpret_cast(&last_msg_->latency.lmax)), - 0) - << "incorrect value for latency.lmax, expected 0, is " - << last_msg_->latency.lmax; - EXPECT_EQ(get_aslatency.lmin)>( - reinterpret_cast(&last_msg_->latency.lmin)), - 0) - << "incorrect value for latency.lmin, expected 0, is " - << last_msg_->latency.lmin; - EXPECT_EQ(get_asuart_a.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_a.crc_error_count)), - 0) - << "incorrect value for uart_a.crc_error_count, expected 0, is " - << last_msg_->uart_a.crc_error_count; - EXPECT_EQ( - get_asuart_a.io_error_count)>( - reinterpret_cast(&last_msg_->uart_a.io_error_count)), - 0) - << "incorrect value for uart_a.io_error_count, expected 0, is " - << last_msg_->uart_a.io_error_count; - EXPECT_EQ(get_asuart_a.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.rx_buffer_level)), - 0) - << "incorrect value for uart_a.rx_buffer_level, expected 0, is " - << last_msg_->uart_a.rx_buffer_level; - EXPECT_LT((last_msg_->uart_a.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_a.rx_throughput, expected 0.0, is " - << last_msg_->uart_a.rx_throughput; - EXPECT_EQ(get_asuart_a.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.tx_buffer_level)), - 0) - << "incorrect value for uart_a.tx_buffer_level, expected 0, is " - << last_msg_->uart_a.tx_buffer_level; - EXPECT_LT((last_msg_->uart_a.tx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_a.tx_throughput, expected 0.0, is " - << last_msg_->uart_a.tx_throughput; - EXPECT_EQ(get_asuart_b.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_b.crc_error_count)), - 0) - << "incorrect value for uart_b.crc_error_count, expected 0, is " - << last_msg_->uart_b.crc_error_count; - EXPECT_EQ( - get_asuart_b.io_error_count)>( - reinterpret_cast(&last_msg_->uart_b.io_error_count)), - 0) - << "incorrect value for uart_b.io_error_count, expected 0, is " - << last_msg_->uart_b.io_error_count; - EXPECT_EQ(get_asuart_b.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.rx_buffer_level)), - 0) - << "incorrect value for uart_b.rx_buffer_level, expected 0, is " - << last_msg_->uart_b.rx_buffer_level; - EXPECT_LT((last_msg_->uart_b.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_b.rx_throughput, expected 0.0, is " - << last_msg_->uart_b.rx_throughput; - EXPECT_EQ(get_asuart_b.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.tx_buffer_level)), - 0) - << "incorrect value for uart_b.tx_buffer_level, expected 0, is " - << last_msg_->uart_b.tx_buffer_level; - EXPECT_LT((last_msg_->uart_b.tx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_b.tx_throughput, expected 0.0, is " - << last_msg_->uart_b.tx_throughput; - EXPECT_EQ(get_asuart_ftdi.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.crc_error_count)), - 0) - << "incorrect value for uart_ftdi.crc_error_count, expected 0, is " - << last_msg_->uart_ftdi.crc_error_count; - EXPECT_EQ(get_asuart_ftdi.io_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.io_error_count)), - 0) - << "incorrect value for uart_ftdi.io_error_count, expected 0, is " - << last_msg_->uart_ftdi.io_error_count; - EXPECT_EQ(get_asuart_ftdi.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.rx_buffer_level)), - 0) - << "incorrect value for uart_ftdi.rx_buffer_level, expected 0, is " - << last_msg_->uart_ftdi.rx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_ftdi.rx_throughput, expected 0.0, is " - << last_msg_->uart_ftdi.rx_throughput; - EXPECT_EQ(get_asuart_ftdi.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.tx_buffer_level)), - 0) - << "incorrect value for uart_ftdi.tx_buffer_level, expected 0, is " - << last_msg_->uart_ftdi.tx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.tx_throughput * 100 - 0.0659999996424 * 100), - 0.05) - << "incorrect value for uart_ftdi.tx_throughput, expected " - "0.0659999996424, is " - << last_msg_->uart_ftdi.tx_throughput; -} -class Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_uart_state_depa_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_uart_state_depa_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA4, Test) { - uint8_t encoded_frame[] = { - 85, 24, 0, 195, 4, 58, 0, 0, 0, 0, 138, 75, 6, 60, - 0, 0, 0, 0, 0, 0, 80, 113, 201, 61, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, 145, 237, 252, 62, 0, 0, 0, 0, - 0, 0, 0, 0, 38, 0, 255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, 112, 111, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_uart_state_depa_t *test_msg = (msg_uart_state_depa_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->latency.avg = -1; - test_msg->latency.current = -1; - test_msg->latency.lmax = 0; - test_msg->latency.lmin = 0; - test_msg->uart_a.crc_error_count = 0; - test_msg->uart_a.io_error_count = 0; - test_msg->uart_a.rx_buffer_level = 0; - test_msg->uart_a.rx_throughput = 0.008196720853447914; - test_msg->uart_a.tx_buffer_level = 0; - test_msg->uart_a.tx_throughput = 0.0; - test_msg->uart_b.crc_error_count = 0; - test_msg->uart_b.io_error_count = 0; - test_msg->uart_b.rx_buffer_level = 0; - test_msg->uart_b.rx_throughput = 0.0; - test_msg->uart_b.tx_buffer_level = 2; - test_msg->uart_b.tx_throughput = 0.09836065769195557; - test_msg->uart_ftdi.crc_error_count = 0; - test_msg->uart_ftdi.io_error_count = 0; - test_msg->uart_ftdi.rx_buffer_level = 0; - test_msg->uart_ftdi.rx_throughput = 0.0; - test_msg->uart_ftdi.tx_buffer_level = 38; - test_msg->uart_ftdi.tx_throughput = 0.49399998784065247; - - EXPECT_EQ(send_message(0x18, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_aslatency.avg)>( - reinterpret_cast(&last_msg_->latency.avg)), - -1) - << "incorrect value for latency.avg, expected -1, is " - << last_msg_->latency.avg; - EXPECT_EQ(get_aslatency.current)>( - reinterpret_cast(&last_msg_->latency.current)), - -1) - << "incorrect value for latency.current, expected -1, is " - << last_msg_->latency.current; - EXPECT_EQ(get_aslatency.lmax)>( - reinterpret_cast(&last_msg_->latency.lmax)), - 0) - << "incorrect value for latency.lmax, expected 0, is " - << last_msg_->latency.lmax; - EXPECT_EQ(get_aslatency.lmin)>( - reinterpret_cast(&last_msg_->latency.lmin)), - 0) - << "incorrect value for latency.lmin, expected 0, is " - << last_msg_->latency.lmin; - EXPECT_EQ(get_asuart_a.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_a.crc_error_count)), - 0) - << "incorrect value for uart_a.crc_error_count, expected 0, is " - << last_msg_->uart_a.crc_error_count; - EXPECT_EQ( - get_asuart_a.io_error_count)>( - reinterpret_cast(&last_msg_->uart_a.io_error_count)), - 0) - << "incorrect value for uart_a.io_error_count, expected 0, is " - << last_msg_->uart_a.io_error_count; - EXPECT_EQ(get_asuart_a.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.rx_buffer_level)), - 0) - << "incorrect value for uart_a.rx_buffer_level, expected 0, is " - << last_msg_->uart_a.rx_buffer_level; - EXPECT_LT((last_msg_->uart_a.rx_throughput * 100 - 0.00819672085345 * 100), - 0.05) - << "incorrect value for uart_a.rx_throughput, expected 0.00819672085345, " - "is " - << last_msg_->uart_a.rx_throughput; - EXPECT_EQ(get_asuart_a.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.tx_buffer_level)), - 0) - << "incorrect value for uart_a.tx_buffer_level, expected 0, is " - << last_msg_->uart_a.tx_buffer_level; - EXPECT_LT((last_msg_->uart_a.tx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_a.tx_throughput, expected 0.0, is " - << last_msg_->uart_a.tx_throughput; - EXPECT_EQ(get_asuart_b.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_b.crc_error_count)), - 0) - << "incorrect value for uart_b.crc_error_count, expected 0, is " - << last_msg_->uart_b.crc_error_count; - EXPECT_EQ( - get_asuart_b.io_error_count)>( - reinterpret_cast(&last_msg_->uart_b.io_error_count)), - 0) - << "incorrect value for uart_b.io_error_count, expected 0, is " - << last_msg_->uart_b.io_error_count; - EXPECT_EQ(get_asuart_b.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.rx_buffer_level)), - 0) - << "incorrect value for uart_b.rx_buffer_level, expected 0, is " - << last_msg_->uart_b.rx_buffer_level; - EXPECT_LT((last_msg_->uart_b.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_b.rx_throughput, expected 0.0, is " - << last_msg_->uart_b.rx_throughput; - EXPECT_EQ(get_asuart_b.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.tx_buffer_level)), - 2) - << "incorrect value for uart_b.tx_buffer_level, expected 2, is " - << last_msg_->uart_b.tx_buffer_level; - EXPECT_LT((last_msg_->uart_b.tx_throughput * 100 - 0.098360657692 * 100), - 0.05) - << "incorrect value for uart_b.tx_throughput, expected 0.098360657692, " - "is " - << last_msg_->uart_b.tx_throughput; - EXPECT_EQ(get_asuart_ftdi.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.crc_error_count)), - 0) - << "incorrect value for uart_ftdi.crc_error_count, expected 0, is " - << last_msg_->uart_ftdi.crc_error_count; - EXPECT_EQ(get_asuart_ftdi.io_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.io_error_count)), - 0) - << "incorrect value for uart_ftdi.io_error_count, expected 0, is " - << last_msg_->uart_ftdi.io_error_count; - EXPECT_EQ(get_asuart_ftdi.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.rx_buffer_level)), - 0) - << "incorrect value for uart_ftdi.rx_buffer_level, expected 0, is " - << last_msg_->uart_ftdi.rx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_ftdi.rx_throughput, expected 0.0, is " - << last_msg_->uart_ftdi.rx_throughput; - EXPECT_EQ(get_asuart_ftdi.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.tx_buffer_level)), - 38) - << "incorrect value for uart_ftdi.tx_buffer_level, expected 38, is " - << last_msg_->uart_ftdi.tx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.tx_throughput * 100 - 0.493999987841 * 100), - 0.05) - << "incorrect value for uart_ftdi.tx_throughput, expected " - "0.493999987841, is " - << last_msg_->uart_ftdi.tx_throughput; -} -class Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA5 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA5() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_uart_state_depa_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_uart_state_depa_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_piksi_MsgUartStateDepA5, Test) { - uint8_t encoded_frame[] = { - 85, 24, 0, 195, 4, 58, 166, 155, 68, 60, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, 166, 155, 68, 60, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, 236, 81, 168, 63, 0, 0, 0, 0, - 0, 0, 0, 0, 50, 0, 255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, 22, 72, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_uart_state_depa_t *test_msg = (msg_uart_state_depa_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->latency.avg = -1; - test_msg->latency.current = -1; - test_msg->latency.lmax = 0; - test_msg->latency.lmin = 0; - test_msg->uart_a.crc_error_count = 0; - test_msg->uart_a.io_error_count = 0; - test_msg->uart_a.rx_buffer_level = 0; - test_msg->uart_a.rx_throughput = 0.0; - test_msg->uart_a.tx_buffer_level = 2; - test_msg->uart_a.tx_throughput = 0.012000000104308128; - test_msg->uart_b.crc_error_count = 0; - test_msg->uart_b.io_error_count = 0; - test_msg->uart_b.rx_buffer_level = 0; - test_msg->uart_b.rx_throughput = 0.0; - test_msg->uart_b.tx_buffer_level = 2; - test_msg->uart_b.tx_throughput = 0.012000000104308128; - test_msg->uart_ftdi.crc_error_count = 0; - test_msg->uart_ftdi.io_error_count = 0; - test_msg->uart_ftdi.rx_buffer_level = 0; - test_msg->uart_ftdi.rx_throughput = 0.0; - test_msg->uart_ftdi.tx_buffer_level = 50; - test_msg->uart_ftdi.tx_throughput = 1.315000057220459; - - EXPECT_EQ(send_message(0x18, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_aslatency.avg)>( - reinterpret_cast(&last_msg_->latency.avg)), - -1) - << "incorrect value for latency.avg, expected -1, is " - << last_msg_->latency.avg; - EXPECT_EQ(get_aslatency.current)>( - reinterpret_cast(&last_msg_->latency.current)), - -1) - << "incorrect value for latency.current, expected -1, is " - << last_msg_->latency.current; - EXPECT_EQ(get_aslatency.lmax)>( - reinterpret_cast(&last_msg_->latency.lmax)), - 0) - << "incorrect value for latency.lmax, expected 0, is " - << last_msg_->latency.lmax; - EXPECT_EQ(get_aslatency.lmin)>( - reinterpret_cast(&last_msg_->latency.lmin)), - 0) - << "incorrect value for latency.lmin, expected 0, is " - << last_msg_->latency.lmin; - EXPECT_EQ(get_asuart_a.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_a.crc_error_count)), - 0) - << "incorrect value for uart_a.crc_error_count, expected 0, is " - << last_msg_->uart_a.crc_error_count; - EXPECT_EQ( - get_asuart_a.io_error_count)>( - reinterpret_cast(&last_msg_->uart_a.io_error_count)), - 0) - << "incorrect value for uart_a.io_error_count, expected 0, is " - << last_msg_->uart_a.io_error_count; - EXPECT_EQ(get_asuart_a.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.rx_buffer_level)), - 0) - << "incorrect value for uart_a.rx_buffer_level, expected 0, is " - << last_msg_->uart_a.rx_buffer_level; - EXPECT_LT((last_msg_->uart_a.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_a.rx_throughput, expected 0.0, is " - << last_msg_->uart_a.rx_throughput; - EXPECT_EQ(get_asuart_a.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_a.tx_buffer_level)), - 2) - << "incorrect value for uart_a.tx_buffer_level, expected 2, is " - << last_msg_->uart_a.tx_buffer_level; - EXPECT_LT((last_msg_->uart_a.tx_throughput * 100 - 0.0120000001043 * 100), - 0.05) - << "incorrect value for uart_a.tx_throughput, expected 0.0120000001043, " - "is " - << last_msg_->uart_a.tx_throughput; - EXPECT_EQ(get_asuart_b.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_b.crc_error_count)), - 0) - << "incorrect value for uart_b.crc_error_count, expected 0, is " - << last_msg_->uart_b.crc_error_count; - EXPECT_EQ( - get_asuart_b.io_error_count)>( - reinterpret_cast(&last_msg_->uart_b.io_error_count)), - 0) - << "incorrect value for uart_b.io_error_count, expected 0, is " - << last_msg_->uart_b.io_error_count; - EXPECT_EQ(get_asuart_b.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.rx_buffer_level)), - 0) - << "incorrect value for uart_b.rx_buffer_level, expected 0, is " - << last_msg_->uart_b.rx_buffer_level; - EXPECT_LT((last_msg_->uart_b.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_b.rx_throughput, expected 0.0, is " - << last_msg_->uart_b.rx_throughput; - EXPECT_EQ(get_asuart_b.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_b.tx_buffer_level)), - 2) - << "incorrect value for uart_b.tx_buffer_level, expected 2, is " - << last_msg_->uart_b.tx_buffer_level; - EXPECT_LT((last_msg_->uart_b.tx_throughput * 100 - 0.0120000001043 * 100), - 0.05) - << "incorrect value for uart_b.tx_throughput, expected 0.0120000001043, " - "is " - << last_msg_->uart_b.tx_throughput; - EXPECT_EQ(get_asuart_ftdi.crc_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.crc_error_count)), - 0) - << "incorrect value for uart_ftdi.crc_error_count, expected 0, is " - << last_msg_->uart_ftdi.crc_error_count; - EXPECT_EQ(get_asuart_ftdi.io_error_count)>( - reinterpret_cast( - &last_msg_->uart_ftdi.io_error_count)), - 0) - << "incorrect value for uart_ftdi.io_error_count, expected 0, is " - << last_msg_->uart_ftdi.io_error_count; - EXPECT_EQ(get_asuart_ftdi.rx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.rx_buffer_level)), - 0) - << "incorrect value for uart_ftdi.rx_buffer_level, expected 0, is " - << last_msg_->uart_ftdi.rx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.rx_throughput * 100 - 0.0 * 100), 0.05) - << "incorrect value for uart_ftdi.rx_throughput, expected 0.0, is " - << last_msg_->uart_ftdi.rx_throughput; - EXPECT_EQ(get_asuart_ftdi.tx_buffer_level)>( - reinterpret_cast( - &last_msg_->uart_ftdi.tx_buffer_level)), - 50) - << "incorrect value for uart_ftdi.tx_buffer_level, expected 50, is " - << last_msg_->uart_ftdi.tx_buffer_level; - EXPECT_LT((last_msg_->uart_ftdi.tx_throughput * 100 - 1.31500005722 * 100), - 0.05) - << "incorrect value for uart_ftdi.tx_throughput, expected 1.31500005722, " - "is " - << last_msg_->uart_ftdi.tx_throughput; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_profiling_MsgMeasurementPoint.cc b/c/test/legacy/cpp/auto_check_sbp_profiling_MsgMeasurementPoint.cc deleted file mode 100644 index cc67c84be9..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_profiling_MsgMeasurementPoint.cc +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/profiling/test_MsgMeasurementPoint.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_profiling_MsgMeasurementPoint0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_profiling_MsgMeasurementPoint0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_measurement_point_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_measurement_point_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_profiling_MsgMeasurementPoint0, Test) { - uint8_t encoded_frame[] = { - 85, 0, 207, 0, 16, 48, 250, 7, 0, 0, 180, 0, 2, 0, - 0, 0, 40, 0, 0, 0, 130, 201, 148, 141, 97, 85, 0, 0, - 18, 130, 201, 148, 0, 0, 0, 0, 66, 64, 157, 15, 0, 0, - 0, 0, 18, 0, 114, 111, 117, 116, 101, 40, 41, 0, 212, 165, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_measurement_point_t *test_msg = - (msg_measurement_point_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = {(char)114, (char)111, (char)117, (char)116, - (char)101, (char)40, (char)41, (char)0}; - memcpy(test_msg->func, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->func) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->id = 2496234002; - test_msg->line = 18; - test_msg->max = 40; - test_msg->min = 2; - test_msg->num_executions = 180; - test_msg->return_addr = 93877475527042; - test_msg->slice_time = 261963842; - test_msg->total_time = 2042; - - EXPECT_EQ(send_message(0xCF00, 4096, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 4096); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = {(char)114, (char)111, (char)117, (char)116, - (char)101, (char)40, (char)41, (char)0}; - EXPECT_EQ(memcmp(last_msg_->func, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->func, expected string '" - << check_string << "', is '" << last_msg_->func << "'"; - } - EXPECT_EQ(get_asid)>( - reinterpret_cast(&last_msg_->id)), - 2496234002) - << "incorrect value for id, expected 2496234002, is " << last_msg_->id; - EXPECT_EQ(get_asline)>( - reinterpret_cast(&last_msg_->line)), - 18) - << "incorrect value for line, expected 18, is " << last_msg_->line; - EXPECT_EQ(get_asmax)>( - reinterpret_cast(&last_msg_->max)), - 40) - << "incorrect value for max, expected 40, is " << last_msg_->max; - EXPECT_EQ(get_asmin)>( - reinterpret_cast(&last_msg_->min)), - 2) - << "incorrect value for min, expected 2, is " << last_msg_->min; - EXPECT_EQ(get_asnum_executions)>( - reinterpret_cast(&last_msg_->num_executions)), - 180) - << "incorrect value for num_executions, expected 180, is " - << last_msg_->num_executions; - EXPECT_EQ(get_asreturn_addr)>( - reinterpret_cast(&last_msg_->return_addr)), - 93877475527042) - << "incorrect value for return_addr, expected 93877475527042, is " - << last_msg_->return_addr; - EXPECT_EQ(get_asslice_time)>( - reinterpret_cast(&last_msg_->slice_time)), - 261963842) - << "incorrect value for slice_time, expected 261963842, is " - << last_msg_->slice_time; - EXPECT_EQ(get_astotal_time)>( - reinterpret_cast(&last_msg_->total_time)), - 2042) - << "incorrect value for total_time, expected 2042, is " - << last_msg_->total_time; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_sbas_MsgSbasRaw.cc b/c/test/legacy/cpp/auto_check_sbp_sbas_MsgSbasRaw.cc deleted file mode 100644 index 713cf37a9a..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_sbas_MsgSbasRaw.cc +++ /dev/null @@ -1,401 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/sbas/test_MsgSbasRaw.yaml by generate.py. Do not -// modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_sbas_MsgSbasRaw0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_sbas_MsgSbasRaw0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_sbas_raw_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_sbas_raw_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_sbas_MsgSbasRaw0, Test) { - uint8_t encoded_frame[] = { - 85, 119, 119, 28, 200, 34, 131, 2, 201, 228, 233, 29, 4, 23, - 255, 0, 23, 255, 0, 23, 255, 127, 240, 2, 255, 192, 3, 127, - 247, 255, 127, 247, 255, 229, 229, 238, 170, 175, 255, 240, 167, 14, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_sbas_raw_t *test_msg = (msg_sbas_raw_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[0] = 23; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[1] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[2] = 0; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[3] = 23; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[4] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[5] = 0; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[6] = 23; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[7] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[8] = 127; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[9] = 240; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[10] = 2; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[11] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[12] = 192; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[13] = 3; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[14] = 127; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[15] = 247; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[16] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[17] = 127; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[18] = 247; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[19] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[20] = 229; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[21] = 229; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[22] = 238; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[23] = 170; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[24] = 175; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[25] = 255; - if (sizeof(test_msg->data) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->data[0])); - } - test_msg->data[26] = 240; - test_msg->message_type = 4; - test_msg->sid.code = 2; - test_msg->sid.sat = 131; - test_msg->tow = 501867721; - - EXPECT_EQ(send_message(0x7777, 51228, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 51228); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asdata[0])>( - reinterpret_cast(&last_msg_->data[0])), - 23) - << "incorrect value for data[0], expected 23, is " << last_msg_->data[0]; - EXPECT_EQ(get_asdata[1])>( - reinterpret_cast(&last_msg_->data[1])), - 255) - << "incorrect value for data[1], expected 255, is " << last_msg_->data[1]; - EXPECT_EQ(get_asdata[2])>( - reinterpret_cast(&last_msg_->data[2])), - 0) - << "incorrect value for data[2], expected 0, is " << last_msg_->data[2]; - EXPECT_EQ(get_asdata[3])>( - reinterpret_cast(&last_msg_->data[3])), - 23) - << "incorrect value for data[3], expected 23, is " << last_msg_->data[3]; - EXPECT_EQ(get_asdata[4])>( - reinterpret_cast(&last_msg_->data[4])), - 255) - << "incorrect value for data[4], expected 255, is " << last_msg_->data[4]; - EXPECT_EQ(get_asdata[5])>( - reinterpret_cast(&last_msg_->data[5])), - 0) - << "incorrect value for data[5], expected 0, is " << last_msg_->data[5]; - EXPECT_EQ(get_asdata[6])>( - reinterpret_cast(&last_msg_->data[6])), - 23) - << "incorrect value for data[6], expected 23, is " << last_msg_->data[6]; - EXPECT_EQ(get_asdata[7])>( - reinterpret_cast(&last_msg_->data[7])), - 255) - << "incorrect value for data[7], expected 255, is " << last_msg_->data[7]; - EXPECT_EQ(get_asdata[8])>( - reinterpret_cast(&last_msg_->data[8])), - 127) - << "incorrect value for data[8], expected 127, is " << last_msg_->data[8]; - EXPECT_EQ(get_asdata[9])>( - reinterpret_cast(&last_msg_->data[9])), - 240) - << "incorrect value for data[9], expected 240, is " << last_msg_->data[9]; - EXPECT_EQ(get_asdata[10])>( - reinterpret_cast(&last_msg_->data[10])), - 2) - << "incorrect value for data[10], expected 2, is " << last_msg_->data[10]; - EXPECT_EQ(get_asdata[11])>( - reinterpret_cast(&last_msg_->data[11])), - 255) - << "incorrect value for data[11], expected 255, is " - << last_msg_->data[11]; - EXPECT_EQ(get_asdata[12])>( - reinterpret_cast(&last_msg_->data[12])), - 192) - << "incorrect value for data[12], expected 192, is " - << last_msg_->data[12]; - EXPECT_EQ(get_asdata[13])>( - reinterpret_cast(&last_msg_->data[13])), - 3) - << "incorrect value for data[13], expected 3, is " << last_msg_->data[13]; - EXPECT_EQ(get_asdata[14])>( - reinterpret_cast(&last_msg_->data[14])), - 127) - << "incorrect value for data[14], expected 127, is " - << last_msg_->data[14]; - EXPECT_EQ(get_asdata[15])>( - reinterpret_cast(&last_msg_->data[15])), - 247) - << "incorrect value for data[15], expected 247, is " - << last_msg_->data[15]; - EXPECT_EQ(get_asdata[16])>( - reinterpret_cast(&last_msg_->data[16])), - 255) - << "incorrect value for data[16], expected 255, is " - << last_msg_->data[16]; - EXPECT_EQ(get_asdata[17])>( - reinterpret_cast(&last_msg_->data[17])), - 127) - << "incorrect value for data[17], expected 127, is " - << last_msg_->data[17]; - EXPECT_EQ(get_asdata[18])>( - reinterpret_cast(&last_msg_->data[18])), - 247) - << "incorrect value for data[18], expected 247, is " - << last_msg_->data[18]; - EXPECT_EQ(get_asdata[19])>( - reinterpret_cast(&last_msg_->data[19])), - 255) - << "incorrect value for data[19], expected 255, is " - << last_msg_->data[19]; - EXPECT_EQ(get_asdata[20])>( - reinterpret_cast(&last_msg_->data[20])), - 229) - << "incorrect value for data[20], expected 229, is " - << last_msg_->data[20]; - EXPECT_EQ(get_asdata[21])>( - reinterpret_cast(&last_msg_->data[21])), - 229) - << "incorrect value for data[21], expected 229, is " - << last_msg_->data[21]; - EXPECT_EQ(get_asdata[22])>( - reinterpret_cast(&last_msg_->data[22])), - 238) - << "incorrect value for data[22], expected 238, is " - << last_msg_->data[22]; - EXPECT_EQ(get_asdata[23])>( - reinterpret_cast(&last_msg_->data[23])), - 170) - << "incorrect value for data[23], expected 170, is " - << last_msg_->data[23]; - EXPECT_EQ(get_asdata[24])>( - reinterpret_cast(&last_msg_->data[24])), - 175) - << "incorrect value for data[24], expected 175, is " - << last_msg_->data[24]; - EXPECT_EQ(get_asdata[25])>( - reinterpret_cast(&last_msg_->data[25])), - 255) - << "incorrect value for data[25], expected 255, is " - << last_msg_->data[25]; - EXPECT_EQ(get_asdata[26])>( - reinterpret_cast(&last_msg_->data[26])), - 240) - << "incorrect value for data[26], expected 240, is " - << last_msg_->data[26]; - EXPECT_EQ(get_asmessage_type)>( - reinterpret_cast(&last_msg_->message_type)), - 4) - << "incorrect value for message_type, expected 4, is " - << last_msg_->message_type; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 2) - << "incorrect value for sid.code, expected 2, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 131) - << "incorrect value for sid.sat, expected 131, is " << last_msg_->sid.sat; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 501867721) - << "incorrect value for tow, expected 501867721, is " << last_msg_->tow; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsReadByIndexDone.cc b/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsReadByIndexDone.cc deleted file mode 100644 index d656edb003..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsReadByIndexDone.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsReadByIndexDone.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsReadByIndexReq.cc b/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsReadByIndexReq.cc deleted file mode 100644 index 6683484f16..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsReadByIndexReq.cc +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsReadByIndexReq.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexReq0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexReq0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_settings_read_by_index_req_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_settings_read_by_index_req_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexReq0, Test) { - uint8_t encoded_frame[] = { - 85, 162, 0, 122, 123, 2, 244, 34, 235, 23, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_settings_read_by_index_req_t *test_msg = - (msg_settings_read_by_index_req_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->index = 8948; - - EXPECT_EQ(send_message(0xa2, 31610, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 31610); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asindex)>( - reinterpret_cast(&last_msg_->index)), - 8948) - << "incorrect value for index, expected 8948, is " << last_msg_->index; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsReadByIndexResp.cc b/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsReadByIndexResp.cc deleted file mode 100644 index 29d02cab6c..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsReadByIndexResp.cc +++ /dev/null @@ -1,628 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsReadByIndexResp.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_settings_read_by_index_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_settings_read_by_index_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp0, Test) { - uint8_t encoded_frame[] = { - 85, 167, 0, 246, 215, 78, 0, 0, 116, 101, 108, 101, 109, 101, 116, - 114, 121, 95, 114, 97, 100, 105, 111, 0, 99, 111, 110, 102, 105, 103, - 117, 114, 97, 116, 105, 111, 110, 95, 115, 116, 114, 105, 110, 103, 0, - 65, 84, 38, 70, 44, 65, 84, 83, 49, 61, 49, 49, 53, 44, 65, - 84, 83, 50, 61, 49, 50, 56, 44, 65, 84, 83, 53, 61, 48, 44, - 65, 84, 38, 87, 44, 65, 84, 90, 0, 248, 233, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_settings_read_by_index_resp_t *test_msg = - (msg_settings_read_by_index_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->index = 0; - { - const char assign_string[] = { - (char)116, (char)101, (char)108, (char)101, (char)109, (char)101, - (char)116, (char)114, (char)121, (char)95, (char)114, (char)97, - (char)100, (char)105, (char)111, (char)0, (char)99, (char)111, - (char)110, (char)102, (char)105, (char)103, (char)117, (char)114, - (char)97, (char)116, (char)105, (char)111, (char)110, (char)95, - (char)115, (char)116, (char)114, (char)105, (char)110, (char)103, - (char)0, (char)65, (char)84, (char)38, (char)70, (char)44, - (char)65, (char)84, (char)83, (char)49, (char)61, (char)49, - (char)49, (char)53, (char)44, (char)65, (char)84, (char)83, - (char)50, (char)61, (char)49, (char)50, (char)56, (char)44, - (char)65, (char)84, (char)83, (char)53, (char)61, (char)48, - (char)44, (char)65, (char)84, (char)38, (char)87, (char)44, - (char)65, (char)84, (char)90, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0xa7, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asindex)>( - reinterpret_cast(&last_msg_->index)), - 0) - << "incorrect value for index, expected 0, is " << last_msg_->index; - { - const char check_string[] = { - (char)116, (char)101, (char)108, (char)101, (char)109, (char)101, - (char)116, (char)114, (char)121, (char)95, (char)114, (char)97, - (char)100, (char)105, (char)111, (char)0, (char)99, (char)111, - (char)110, (char)102, (char)105, (char)103, (char)117, (char)114, - (char)97, (char)116, (char)105, (char)111, (char)110, (char)95, - (char)115, (char)116, (char)114, (char)105, (char)110, (char)103, - (char)0, (char)65, (char)84, (char)38, (char)70, (char)44, - (char)65, (char)84, (char)83, (char)49, (char)61, (char)49, - (char)49, (char)53, (char)44, (char)65, (char)84, (char)83, - (char)50, (char)61, (char)49, (char)50, (char)56, (char)44, - (char)65, (char)84, (char)83, (char)53, (char)61, (char)48, - (char)44, (char)65, (char)84, (char)38, (char)87, (char)44, - (char)65, (char)84, (char)90, (char)0}; - EXPECT_EQ(memcmp(last_msg_->setting, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->setting, expected string '" - << check_string << "', is '" << last_msg_->setting << "'"; - } -} -class Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_settings_read_by_index_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_settings_read_by_index_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp1, Test) { - uint8_t encoded_frame[] = { - 85, 167, 0, 246, 215, 35, 1, 0, 117, 97, 114, 116, 95, 102, 116, - 100, 105, 0, 109, 111, 100, 101, 0, 83, 66, 80, 0, 101, 110, 117, - 109, 58, 83, 66, 80, 44, 78, 77, 69, 65, 0, 167, 243, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_settings_read_by_index_resp_t *test_msg = - (msg_settings_read_by_index_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->index = 1; - { - const char assign_string[] = { - (char)117, (char)97, (char)114, (char)116, (char)95, (char)102, - (char)116, (char)100, (char)105, (char)0, (char)109, (char)111, - (char)100, (char)101, (char)0, (char)83, (char)66, (char)80, - (char)0, (char)101, (char)110, (char)117, (char)109, (char)58, - (char)83, (char)66, (char)80, (char)44, (char)78, (char)77, - (char)69, (char)65, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0xa7, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asindex)>( - reinterpret_cast(&last_msg_->index)), - 1) - << "incorrect value for index, expected 1, is " << last_msg_->index; - { - const char check_string[] = { - (char)117, (char)97, (char)114, (char)116, (char)95, (char)102, - (char)116, (char)100, (char)105, (char)0, (char)109, (char)111, - (char)100, (char)101, (char)0, (char)83, (char)66, (char)80, - (char)0, (char)101, (char)110, (char)117, (char)109, (char)58, - (char)83, (char)66, (char)80, (char)44, (char)78, (char)77, - (char)69, (char)65, (char)0}; - EXPECT_EQ(memcmp(last_msg_->setting, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->setting, expected string '" - << check_string << "', is '" << last_msg_->setting << "'"; - } -} -class Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_settings_read_by_index_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_settings_read_by_index_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp2, Test) { - uint8_t encoded_frame[] = { - 85, 167, 0, 246, 215, 35, 2, 0, 117, 97, 114, 116, 95, 102, 116, - 100, 105, 0, 115, 98, 112, 95, 109, 101, 115, 115, 97, 103, 101, 95, - 109, 97, 115, 107, 0, 54, 53, 53, 51, 53, 0, 4, 56, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_settings_read_by_index_resp_t *test_msg = - (msg_settings_read_by_index_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->index = 2; - { - const char assign_string[] = { - (char)117, (char)97, (char)114, (char)116, (char)95, (char)102, - (char)116, (char)100, (char)105, (char)0, (char)115, (char)98, - (char)112, (char)95, (char)109, (char)101, (char)115, (char)115, - (char)97, (char)103, (char)101, (char)95, (char)109, (char)97, - (char)115, (char)107, (char)0, (char)54, (char)53, (char)53, - (char)51, (char)53, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0xa7, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asindex)>( - reinterpret_cast(&last_msg_->index)), - 2) - << "incorrect value for index, expected 2, is " << last_msg_->index; - { - const char check_string[] = { - (char)117, (char)97, (char)114, (char)116, (char)95, (char)102, - (char)116, (char)100, (char)105, (char)0, (char)115, (char)98, - (char)112, (char)95, (char)109, (char)101, (char)115, (char)115, - (char)97, (char)103, (char)101, (char)95, (char)109, (char)97, - (char)115, (char)107, (char)0, (char)54, (char)53, (char)53, - (char)51, (char)53, (char)0}; - EXPECT_EQ(memcmp(last_msg_->setting, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->setting, expected string '" - << check_string << "', is '" << last_msg_->setting << "'"; - } -} -class Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_settings_read_by_index_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_settings_read_by_index_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp3, Test) { - uint8_t encoded_frame[] = { - 85, 167, 0, 246, 215, 29, 3, 0, 117, 97, 114, 116, 95, - 102, 116, 100, 105, 0, 98, 97, 117, 100, 114, 97, 116, 101, - 0, 49, 48, 48, 48, 48, 48, 48, 0, 242, 146, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_settings_read_by_index_resp_t *test_msg = - (msg_settings_read_by_index_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->index = 3; - { - const char assign_string[] = { - (char)117, (char)97, (char)114, (char)116, (char)95, (char)102, - (char)116, (char)100, (char)105, (char)0, (char)98, (char)97, - (char)117, (char)100, (char)114, (char)97, (char)116, (char)101, - (char)0, (char)49, (char)48, (char)48, (char)48, (char)48, - (char)48, (char)48, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0xa7, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asindex)>( - reinterpret_cast(&last_msg_->index)), - 3) - << "incorrect value for index, expected 3, is " << last_msg_->index; - { - const char check_string[] = { - (char)117, (char)97, (char)114, (char)116, (char)95, (char)102, - (char)116, (char)100, (char)105, (char)0, (char)98, (char)97, - (char)117, (char)100, (char)114, (char)97, (char)116, (char)101, - (char)0, (char)49, (char)48, (char)48, (char)48, (char)48, - (char)48, (char)48, (char)0}; - EXPECT_EQ(memcmp(last_msg_->setting, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->setting, expected string '" - << check_string << "', is '" << last_msg_->setting << "'"; - } -} -class Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_settings_read_by_index_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_settings_read_by_index_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_settings_MsgSettingsReadByIndexResp4, Test) { - uint8_t encoded_frame[] = { - 85, 167, 0, 246, 215, 36, 4, 0, 117, 97, 114, 116, 95, 117, 97, - 114, 116, 97, 0, 109, 111, 100, 101, 0, 83, 66, 80, 0, 101, 110, - 117, 109, 58, 83, 66, 80, 44, 78, 77, 69, 65, 0, 22, 4, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_settings_read_by_index_resp_t *test_msg = - (msg_settings_read_by_index_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->index = 4; - { - const char assign_string[] = { - (char)117, (char)97, (char)114, (char)116, (char)95, (char)117, - (char)97, (char)114, (char)116, (char)97, (char)0, (char)109, - (char)111, (char)100, (char)101, (char)0, (char)83, (char)66, - (char)80, (char)0, (char)101, (char)110, (char)117, (char)109, - (char)58, (char)83, (char)66, (char)80, (char)44, (char)78, - (char)77, (char)69, (char)65, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0xa7, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asindex)>( - reinterpret_cast(&last_msg_->index)), - 4) - << "incorrect value for index, expected 4, is " << last_msg_->index; - { - const char check_string[] = { - (char)117, (char)97, (char)114, (char)116, (char)95, (char)117, - (char)97, (char)114, (char)116, (char)97, (char)0, (char)109, - (char)111, (char)100, (char)101, (char)0, (char)83, (char)66, - (char)80, (char)0, (char)101, (char)110, (char)117, (char)109, - (char)58, (char)83, (char)66, (char)80, (char)44, (char)78, - (char)77, (char)69, (char)65, (char)0}; - EXPECT_EQ(memcmp(last_msg_->setting, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->setting, expected string '" - << check_string << "', is '" << last_msg_->setting << "'"; - } -} diff --git a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsReadReq.cc b/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsReadReq.cc deleted file mode 100644 index e7a470ac4f..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsReadReq.cc +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsReadReq.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_settings_MsgSettingsReadReq0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_settings_MsgSettingsReadReq0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_settings_read_req_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_settings_read_req_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_settings_MsgSettingsReadReq0, Test) { - uint8_t encoded_frame[] = { - 85, 164, 0, 152, 214, 26, 115, 101, 99, 116, 105, 111, - 110, 45, 110, 97, 109, 101, 0, 115, 101, 116, 116, 105, - 110, 103, 45, 110, 97, 109, 101, 0, 181, 228, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_settings_read_req_t *test_msg = - (msg_settings_read_req_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0xa4, 54936, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 54936); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0}; - EXPECT_EQ(memcmp(last_msg_->setting, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->setting, expected string '" - << check_string << "', is '" << last_msg_->setting << "'"; - } -} diff --git a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsReadResp.cc b/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsReadResp.cc deleted file mode 100644 index b87b189873..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsReadResp.cc +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsReadResp.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_settings_MsgSettingsReadResp0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_settings_MsgSettingsReadResp0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_settings_read_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_settings_read_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_settings_MsgSettingsReadResp0, Test) { - uint8_t encoded_frame[] = { - 85, 165, 0, 136, 240, 66, 115, 101, 99, 116, 105, 111, 110, 45, 110, - 97, 109, 101, 0, 115, 101, 116, 116, 105, 110, 103, 45, 110, 97, 109, - 101, 0, 115, 101, 116, 116, 105, 110, 103, 45, 118, 97, 108, 117, 101, - 0, 101, 110, 117, 109, 59, 118, 97, 108, 117, 101, 49, 44, 118, 97, - 108, 117, 101, 50, 44, 118, 97, 108, 117, 101, 51, 0, 203, 199, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_settings_read_resp_t *test_msg = - (msg_settings_read_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0, (char)101, (char)110, - (char)117, (char)109, (char)59, (char)118, (char)97, (char)108, - (char)117, (char)101, (char)49, (char)44, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)50, (char)44, (char)118, - (char)97, (char)108, (char)117, (char)101, (char)51, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0xa5, 61576, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 61576); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0, (char)101, (char)110, - (char)117, (char)109, (char)59, (char)118, (char)97, (char)108, - (char)117, (char)101, (char)49, (char)44, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)50, (char)44, (char)118, - (char)97, (char)108, (char)117, (char)101, (char)51, (char)0}; - EXPECT_EQ(memcmp(last_msg_->setting, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->setting, expected string '" - << check_string << "', is '" << last_msg_->setting << "'"; - } -} diff --git a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsRegister.cc b/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsRegister.cc deleted file mode 100644 index b0e2c1d338..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsRegister.cc +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsRegister.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_settings_MsgSettingsRegister0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_settings_MsgSettingsRegister0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_settings_register_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_settings_register_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_settings_MsgSettingsRegister0, Test) { - uint8_t encoded_frame[] = { - 85, 174, 0, 84, 6, 66, 115, 101, 99, 116, 105, 111, 110, 45, 110, - 97, 109, 101, 0, 115, 101, 116, 116, 105, 110, 103, 45, 110, 97, 109, - 101, 0, 115, 101, 116, 116, 105, 110, 103, 45, 118, 97, 108, 117, 101, - 0, 101, 110, 117, 109, 59, 118, 97, 108, 117, 101, 49, 44, 118, 97, - 108, 117, 101, 50, 44, 118, 97, 108, 117, 101, 51, 0, 142, 235, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_settings_register_t *test_msg = - (msg_settings_register_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0, (char)101, (char)110, - (char)117, (char)109, (char)59, (char)118, (char)97, (char)108, - (char)117, (char)101, (char)49, (char)44, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)50, (char)44, (char)118, - (char)97, (char)108, (char)117, (char)101, (char)51, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0xae, 1620, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1620); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0, (char)101, (char)110, - (char)117, (char)109, (char)59, (char)118, (char)97, (char)108, - (char)117, (char)101, (char)49, (char)44, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)50, (char)44, (char)118, - (char)97, (char)108, (char)117, (char)101, (char)51, (char)0}; - EXPECT_EQ(memcmp(last_msg_->setting, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->setting, expected string '" - << check_string << "', is '" << last_msg_->setting << "'"; - } -} diff --git a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsRegisterResp.cc b/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsRegisterResp.cc deleted file mode 100644 index 66edd779fe..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsRegisterResp.cc +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsRegisterResp.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_settings_MsgSettingsRegisterResp0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_settings_MsgSettingsRegisterResp0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_settings_register_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_settings_register_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_settings_MsgSettingsRegisterResp0, Test) { - uint8_t encoded_frame[] = { - 85, 175, 1, 41, 213, 67, 18, 115, 101, 99, 116, 105, 111, 110, 45, - 110, 97, 109, 101, 0, 115, 101, 116, 116, 105, 110, 103, 45, 110, 97, - 109, 101, 0, 115, 101, 116, 116, 105, 110, 103, 45, 118, 97, 108, 117, - 101, 0, 101, 110, 117, 109, 59, 118, 97, 108, 117, 101, 49, 44, 118, - 97, 108, 117, 101, 50, 44, 118, 97, 108, 117, 101, 51, 0, 82, 16, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_settings_register_resp_t *test_msg = - (msg_settings_register_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0, (char)101, (char)110, - (char)117, (char)109, (char)59, (char)118, (char)97, (char)108, - (char)117, (char)101, (char)49, (char)44, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)50, (char)44, (char)118, - (char)97, (char)108, (char)117, (char)101, (char)51, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->status = 18; - - EXPECT_EQ(send_message(0x1af, 54569, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 54569); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0, (char)101, (char)110, - (char)117, (char)109, (char)59, (char)118, (char)97, (char)108, - (char)117, (char)101, (char)49, (char)44, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)50, (char)44, (char)118, - (char)97, (char)108, (char)117, (char)101, (char)51, (char)0}; - EXPECT_EQ(memcmp(last_msg_->setting, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->setting, expected string '" - << check_string << "', is '" << last_msg_->setting << "'"; - } - EXPECT_EQ(get_asstatus)>( - reinterpret_cast(&last_msg_->status)), - 18) - << "incorrect value for status, expected 18, is " << last_msg_->status; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsSave.cc b/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsSave.cc deleted file mode 100644 index 84f1ff58d3..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsSave.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsSave.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsWrite.cc b/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsWrite.cc deleted file mode 100644 index de1753e0f1..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsWrite.cc +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsWrite.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_settings_MsgSettingsWrite0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_settings_MsgSettingsWrite0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_settings_write_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_settings_write_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_settings_MsgSettingsWrite0, Test) { - uint8_t encoded_frame[] = { - 85, 160, 0, 123, 0, 40, 115, 101, 99, 116, 105, 111, - 110, 45, 110, 97, 109, 101, 0, 115, 101, 116, 116, 105, - 110, 103, 45, 110, 97, 109, 101, 0, 115, 101, 116, 116, - 105, 110, 103, 45, 118, 97, 108, 117, 101, 0, 244, 10, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_settings_write_t *test_msg = (msg_settings_write_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0xa0, 123, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 123); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0}; - EXPECT_EQ(memcmp(last_msg_->setting, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->setting, expected string '" - << check_string << "', is '" << last_msg_->setting << "'"; - } -} diff --git a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsWriteResp.cc b/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsWriteResp.cc deleted file mode 100644 index aa8318b141..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_settings_MsgSettingsWriteResp.cc +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/settings/test_MsgSettingsWriteResp.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_settings_MsgSettingsWriteResp0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_settings_MsgSettingsWriteResp0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_settings_write_resp_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_settings_write_resp_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_settings_MsgSettingsWriteResp0, Test) { - uint8_t encoded_frame[] = { - 85, 175, 0, 91, 55, 67, 152, 115, 101, 99, 116, 105, 111, 110, 45, - 110, 97, 109, 101, 0, 115, 101, 116, 116, 105, 110, 103, 45, 110, 97, - 109, 101, 0, 115, 101, 116, 116, 105, 110, 103, 45, 118, 97, 108, 117, - 101, 0, 101, 110, 117, 109, 59, 118, 97, 108, 117, 101, 49, 44, 118, - 97, 108, 117, 101, 50, 44, 118, 97, 108, 117, 101, 51, 0, 54, 0, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_settings_write_resp_t *test_msg = - (msg_settings_write_resp_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - { - const char assign_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0, (char)101, (char)110, - (char)117, (char)109, (char)59, (char)118, (char)97, (char)108, - (char)117, (char)101, (char)49, (char)44, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)50, (char)44, (char)118, - (char)97, (char)108, (char)117, (char)101, (char)51, (char)0}; - memcpy(test_msg->setting, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->setting) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - test_msg->status = 152; - - EXPECT_EQ(send_message(0xaf, 14171, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 14171); - EXPECT_EQ(last_msg_len_, test_msg_len); - { - const char check_string[] = { - (char)115, (char)101, (char)99, (char)116, (char)105, (char)111, - (char)110, (char)45, (char)110, (char)97, (char)109, (char)101, - (char)0, (char)115, (char)101, (char)116, (char)116, (char)105, - (char)110, (char)103, (char)45, (char)110, (char)97, (char)109, - (char)101, (char)0, (char)115, (char)101, (char)116, (char)116, - (char)105, (char)110, (char)103, (char)45, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)0, (char)101, (char)110, - (char)117, (char)109, (char)59, (char)118, (char)97, (char)108, - (char)117, (char)101, (char)49, (char)44, (char)118, (char)97, - (char)108, (char)117, (char)101, (char)50, (char)44, (char)118, - (char)97, (char)108, (char)117, (char)101, (char)51, (char)0}; - EXPECT_EQ(memcmp(last_msg_->setting, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->setting, expected string '" - << check_string << "', is '" << last_msg_->setting << "'"; - } - EXPECT_EQ(get_asstatus)>( - reinterpret_cast(&last_msg_->status)), - 152) - << "incorrect value for status, expected 152, is " << last_msg_->status; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_signing_MsgCertificateChain.cc b/c/test/legacy/cpp/auto_check_sbp_signing_MsgCertificateChain.cc deleted file mode 100644 index 677a4f3269..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_signing_MsgCertificateChain.cc +++ /dev/null @@ -1,1765 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgCertificateChain.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_signing_MsgCertificateChain0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_signing_MsgCertificateChain0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_certificate_chain_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_certificate_chain_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_signing_MsgCertificateChain0, Test) { - uint8_t encoded_frame[] = { - 85, 9, 12, 66, 0, 144, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 232, 7, - 3, 30, 12, 34, 59, 21, 205, 91, 7, 72, 0, 1, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 227, 224, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_certificate_chain_t *test_msg = - (msg_certificate_chain_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[0] = 20; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[1] = 21; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[2] = 22; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[3] = 23; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[4] = 24; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[5] = 25; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[6] = 26; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[7] = 27; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[8] = 28; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[9] = 29; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[10] = 10; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[11] = 11; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[12] = 12; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[13] = 13; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[14] = 14; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[15] = 15; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[16] = 16; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[17] = 17; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[18] = 18; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[19] = 19; - test_msg->expiration.day = 30; - test_msg->expiration.hours = 12; - test_msg->expiration.minutes = 34; - test_msg->expiration.month = 3; - test_msg->expiration.ns = 123456789; - test_msg->expiration.seconds = 59; - test_msg->expiration.year = 2024; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[0] = 10; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[1] = 11; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[2] = 12; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[3] = 13; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[4] = 14; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[5] = 15; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[6] = 16; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[7] = 17; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[8] = 18; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[9] = 19; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[10] = 0; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[11] = 1; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[12] = 2; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[13] = 3; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[14] = 4; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[15] = 5; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[16] = 6; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[17] = 7; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[18] = 8; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[19] = 9; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[0] = 0; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[1] = 1; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[2] = 2; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[3] = 3; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[4] = 4; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[5] = 5; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[6] = 6; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[7] = 7; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[8] = 8; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[9] = 9; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[10] = 10; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[11] = 11; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[12] = 12; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[13] = 13; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[14] = 14; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[15] = 15; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[16] = 16; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[17] = 17; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[18] = 18; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[19] = 19; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[0] = 0; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[1] = 1; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[2] = 2; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[3] = 3; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[4] = 4; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[5] = 5; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[6] = 6; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[7] = 7; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[8] = 8; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[9] = 9; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[10] = 10; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[11] = 11; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[12] = 12; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[13] = 13; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[14] = 14; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[15] = 15; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[16] = 16; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[17] = 17; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[18] = 18; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[19] = 19; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[20] = 20; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[21] = 21; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[22] = 22; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[23] = 23; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[24] = 24; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[25] = 25; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[26] = 26; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[27] = 27; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[28] = 28; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[29] = 29; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[30] = 30; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[31] = 31; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[32] = 32; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[33] = 33; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[34] = 34; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[35] = 35; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[36] = 36; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[37] = 37; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[38] = 38; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[39] = 39; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[40] = 40; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[41] = 41; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[42] = 42; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[43] = 43; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[44] = 44; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[45] = 45; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[46] = 46; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[47] = 47; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[48] = 48; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[49] = 49; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[50] = 50; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[51] = 51; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[52] = 52; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[53] = 53; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[54] = 54; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[55] = 55; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[56] = 56; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[57] = 57; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[58] = 58; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[59] = 59; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[60] = 60; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[61] = 61; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[62] = 62; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[63] = 63; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[64] = 64; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[65] = 65; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[66] = 66; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[67] = 67; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[68] = 68; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[69] = 69; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[70] = 70; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[71] = 71; - test_msg->signature.len = 72; - - EXPECT_EQ(send_message(0xC09, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascorrections_certificate[0])>( - reinterpret_cast( - &last_msg_->corrections_certificate[0])), - 20) - << "incorrect value for corrections_certificate[0], expected 20, is " - << last_msg_->corrections_certificate[0]; - EXPECT_EQ(get_ascorrections_certificate[1])>( - reinterpret_cast( - &last_msg_->corrections_certificate[1])), - 21) - << "incorrect value for corrections_certificate[1], expected 21, is " - << last_msg_->corrections_certificate[1]; - EXPECT_EQ(get_ascorrections_certificate[2])>( - reinterpret_cast( - &last_msg_->corrections_certificate[2])), - 22) - << "incorrect value for corrections_certificate[2], expected 22, is " - << last_msg_->corrections_certificate[2]; - EXPECT_EQ(get_ascorrections_certificate[3])>( - reinterpret_cast( - &last_msg_->corrections_certificate[3])), - 23) - << "incorrect value for corrections_certificate[3], expected 23, is " - << last_msg_->corrections_certificate[3]; - EXPECT_EQ(get_ascorrections_certificate[4])>( - reinterpret_cast( - &last_msg_->corrections_certificate[4])), - 24) - << "incorrect value for corrections_certificate[4], expected 24, is " - << last_msg_->corrections_certificate[4]; - EXPECT_EQ(get_ascorrections_certificate[5])>( - reinterpret_cast( - &last_msg_->corrections_certificate[5])), - 25) - << "incorrect value for corrections_certificate[5], expected 25, is " - << last_msg_->corrections_certificate[5]; - EXPECT_EQ(get_ascorrections_certificate[6])>( - reinterpret_cast( - &last_msg_->corrections_certificate[6])), - 26) - << "incorrect value for corrections_certificate[6], expected 26, is " - << last_msg_->corrections_certificate[6]; - EXPECT_EQ(get_ascorrections_certificate[7])>( - reinterpret_cast( - &last_msg_->corrections_certificate[7])), - 27) - << "incorrect value for corrections_certificate[7], expected 27, is " - << last_msg_->corrections_certificate[7]; - EXPECT_EQ(get_ascorrections_certificate[8])>( - reinterpret_cast( - &last_msg_->corrections_certificate[8])), - 28) - << "incorrect value for corrections_certificate[8], expected 28, is " - << last_msg_->corrections_certificate[8]; - EXPECT_EQ(get_ascorrections_certificate[9])>( - reinterpret_cast( - &last_msg_->corrections_certificate[9])), - 29) - << "incorrect value for corrections_certificate[9], expected 29, is " - << last_msg_->corrections_certificate[9]; - EXPECT_EQ(get_ascorrections_certificate[10])>( - reinterpret_cast( - &last_msg_->corrections_certificate[10])), - 10) - << "incorrect value for corrections_certificate[10], expected 10, is " - << last_msg_->corrections_certificate[10]; - EXPECT_EQ(get_ascorrections_certificate[11])>( - reinterpret_cast( - &last_msg_->corrections_certificate[11])), - 11) - << "incorrect value for corrections_certificate[11], expected 11, is " - << last_msg_->corrections_certificate[11]; - EXPECT_EQ(get_ascorrections_certificate[12])>( - reinterpret_cast( - &last_msg_->corrections_certificate[12])), - 12) - << "incorrect value for corrections_certificate[12], expected 12, is " - << last_msg_->corrections_certificate[12]; - EXPECT_EQ(get_ascorrections_certificate[13])>( - reinterpret_cast( - &last_msg_->corrections_certificate[13])), - 13) - << "incorrect value for corrections_certificate[13], expected 13, is " - << last_msg_->corrections_certificate[13]; - EXPECT_EQ(get_ascorrections_certificate[14])>( - reinterpret_cast( - &last_msg_->corrections_certificate[14])), - 14) - << "incorrect value for corrections_certificate[14], expected 14, is " - << last_msg_->corrections_certificate[14]; - EXPECT_EQ(get_ascorrections_certificate[15])>( - reinterpret_cast( - &last_msg_->corrections_certificate[15])), - 15) - << "incorrect value for corrections_certificate[15], expected 15, is " - << last_msg_->corrections_certificate[15]; - EXPECT_EQ(get_ascorrections_certificate[16])>( - reinterpret_cast( - &last_msg_->corrections_certificate[16])), - 16) - << "incorrect value for corrections_certificate[16], expected 16, is " - << last_msg_->corrections_certificate[16]; - EXPECT_EQ(get_ascorrections_certificate[17])>( - reinterpret_cast( - &last_msg_->corrections_certificate[17])), - 17) - << "incorrect value for corrections_certificate[17], expected 17, is " - << last_msg_->corrections_certificate[17]; - EXPECT_EQ(get_ascorrections_certificate[18])>( - reinterpret_cast( - &last_msg_->corrections_certificate[18])), - 18) - << "incorrect value for corrections_certificate[18], expected 18, is " - << last_msg_->corrections_certificate[18]; - EXPECT_EQ(get_ascorrections_certificate[19])>( - reinterpret_cast( - &last_msg_->corrections_certificate[19])), - 19) - << "incorrect value for corrections_certificate[19], expected 19, is " - << last_msg_->corrections_certificate[19]; - EXPECT_EQ(get_asexpiration.day)>( - reinterpret_cast(&last_msg_->expiration.day)), - 30) - << "incorrect value for expiration.day, expected 30, is " - << last_msg_->expiration.day; - EXPECT_EQ( - get_asexpiration.hours)>( - reinterpret_cast(&last_msg_->expiration.hours)), - 12) - << "incorrect value for expiration.hours, expected 12, is " - << last_msg_->expiration.hours; - EXPECT_EQ( - get_asexpiration.minutes)>( - reinterpret_cast(&last_msg_->expiration.minutes)), - 34) - << "incorrect value for expiration.minutes, expected 34, is " - << last_msg_->expiration.minutes; - EXPECT_EQ( - get_asexpiration.month)>( - reinterpret_cast(&last_msg_->expiration.month)), - 3) - << "incorrect value for expiration.month, expected 3, is " - << last_msg_->expiration.month; - EXPECT_EQ(get_asexpiration.ns)>( - reinterpret_cast(&last_msg_->expiration.ns)), - 123456789) - << "incorrect value for expiration.ns, expected 123456789, is " - << last_msg_->expiration.ns; - EXPECT_EQ( - get_asexpiration.seconds)>( - reinterpret_cast(&last_msg_->expiration.seconds)), - 59) - << "incorrect value for expiration.seconds, expected 59, is " - << last_msg_->expiration.seconds; - EXPECT_EQ(get_asexpiration.year)>( - reinterpret_cast(&last_msg_->expiration.year)), - 2024) - << "incorrect value for expiration.year, expected 2024, is " - << last_msg_->expiration.year; - EXPECT_EQ(get_asintermediate_certificate[0])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[0])), - 10) - << "incorrect value for intermediate_certificate[0], expected 10, is " - << last_msg_->intermediate_certificate[0]; - EXPECT_EQ(get_asintermediate_certificate[1])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[1])), - 11) - << "incorrect value for intermediate_certificate[1], expected 11, is " - << last_msg_->intermediate_certificate[1]; - EXPECT_EQ(get_asintermediate_certificate[2])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[2])), - 12) - << "incorrect value for intermediate_certificate[2], expected 12, is " - << last_msg_->intermediate_certificate[2]; - EXPECT_EQ(get_asintermediate_certificate[3])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[3])), - 13) - << "incorrect value for intermediate_certificate[3], expected 13, is " - << last_msg_->intermediate_certificate[3]; - EXPECT_EQ(get_asintermediate_certificate[4])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[4])), - 14) - << "incorrect value for intermediate_certificate[4], expected 14, is " - << last_msg_->intermediate_certificate[4]; - EXPECT_EQ(get_asintermediate_certificate[5])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[5])), - 15) - << "incorrect value for intermediate_certificate[5], expected 15, is " - << last_msg_->intermediate_certificate[5]; - EXPECT_EQ(get_asintermediate_certificate[6])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[6])), - 16) - << "incorrect value for intermediate_certificate[6], expected 16, is " - << last_msg_->intermediate_certificate[6]; - EXPECT_EQ(get_asintermediate_certificate[7])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[7])), - 17) - << "incorrect value for intermediate_certificate[7], expected 17, is " - << last_msg_->intermediate_certificate[7]; - EXPECT_EQ(get_asintermediate_certificate[8])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[8])), - 18) - << "incorrect value for intermediate_certificate[8], expected 18, is " - << last_msg_->intermediate_certificate[8]; - EXPECT_EQ(get_asintermediate_certificate[9])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[9])), - 19) - << "incorrect value for intermediate_certificate[9], expected 19, is " - << last_msg_->intermediate_certificate[9]; - EXPECT_EQ(get_asintermediate_certificate[10])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[10])), - 0) - << "incorrect value for intermediate_certificate[10], expected 0, is " - << last_msg_->intermediate_certificate[10]; - EXPECT_EQ(get_asintermediate_certificate[11])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[11])), - 1) - << "incorrect value for intermediate_certificate[11], expected 1, is " - << last_msg_->intermediate_certificate[11]; - EXPECT_EQ(get_asintermediate_certificate[12])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[12])), - 2) - << "incorrect value for intermediate_certificate[12], expected 2, is " - << last_msg_->intermediate_certificate[12]; - EXPECT_EQ(get_asintermediate_certificate[13])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[13])), - 3) - << "incorrect value for intermediate_certificate[13], expected 3, is " - << last_msg_->intermediate_certificate[13]; - EXPECT_EQ(get_asintermediate_certificate[14])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[14])), - 4) - << "incorrect value for intermediate_certificate[14], expected 4, is " - << last_msg_->intermediate_certificate[14]; - EXPECT_EQ(get_asintermediate_certificate[15])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[15])), - 5) - << "incorrect value for intermediate_certificate[15], expected 5, is " - << last_msg_->intermediate_certificate[15]; - EXPECT_EQ(get_asintermediate_certificate[16])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[16])), - 6) - << "incorrect value for intermediate_certificate[16], expected 6, is " - << last_msg_->intermediate_certificate[16]; - EXPECT_EQ(get_asintermediate_certificate[17])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[17])), - 7) - << "incorrect value for intermediate_certificate[17], expected 7, is " - << last_msg_->intermediate_certificate[17]; - EXPECT_EQ(get_asintermediate_certificate[18])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[18])), - 8) - << "incorrect value for intermediate_certificate[18], expected 8, is " - << last_msg_->intermediate_certificate[18]; - EXPECT_EQ(get_asintermediate_certificate[19])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[19])), - 9) - << "incorrect value for intermediate_certificate[19], expected 9, is " - << last_msg_->intermediate_certificate[19]; - EXPECT_EQ( - get_asroot_certificate[0])>( - reinterpret_cast(&last_msg_->root_certificate[0])), - 0) - << "incorrect value for root_certificate[0], expected 0, is " - << last_msg_->root_certificate[0]; - EXPECT_EQ( - get_asroot_certificate[1])>( - reinterpret_cast(&last_msg_->root_certificate[1])), - 1) - << "incorrect value for root_certificate[1], expected 1, is " - << last_msg_->root_certificate[1]; - EXPECT_EQ( - get_asroot_certificate[2])>( - reinterpret_cast(&last_msg_->root_certificate[2])), - 2) - << "incorrect value for root_certificate[2], expected 2, is " - << last_msg_->root_certificate[2]; - EXPECT_EQ( - get_asroot_certificate[3])>( - reinterpret_cast(&last_msg_->root_certificate[3])), - 3) - << "incorrect value for root_certificate[3], expected 3, is " - << last_msg_->root_certificate[3]; - EXPECT_EQ( - get_asroot_certificate[4])>( - reinterpret_cast(&last_msg_->root_certificate[4])), - 4) - << "incorrect value for root_certificate[4], expected 4, is " - << last_msg_->root_certificate[4]; - EXPECT_EQ( - get_asroot_certificate[5])>( - reinterpret_cast(&last_msg_->root_certificate[5])), - 5) - << "incorrect value for root_certificate[5], expected 5, is " - << last_msg_->root_certificate[5]; - EXPECT_EQ( - get_asroot_certificate[6])>( - reinterpret_cast(&last_msg_->root_certificate[6])), - 6) - << "incorrect value for root_certificate[6], expected 6, is " - << last_msg_->root_certificate[6]; - EXPECT_EQ( - get_asroot_certificate[7])>( - reinterpret_cast(&last_msg_->root_certificate[7])), - 7) - << "incorrect value for root_certificate[7], expected 7, is " - << last_msg_->root_certificate[7]; - EXPECT_EQ( - get_asroot_certificate[8])>( - reinterpret_cast(&last_msg_->root_certificate[8])), - 8) - << "incorrect value for root_certificate[8], expected 8, is " - << last_msg_->root_certificate[8]; - EXPECT_EQ( - get_asroot_certificate[9])>( - reinterpret_cast(&last_msg_->root_certificate[9])), - 9) - << "incorrect value for root_certificate[9], expected 9, is " - << last_msg_->root_certificate[9]; - EXPECT_EQ( - get_asroot_certificate[10])>( - reinterpret_cast(&last_msg_->root_certificate[10])), - 10) - << "incorrect value for root_certificate[10], expected 10, is " - << last_msg_->root_certificate[10]; - EXPECT_EQ( - get_asroot_certificate[11])>( - reinterpret_cast(&last_msg_->root_certificate[11])), - 11) - << "incorrect value for root_certificate[11], expected 11, is " - << last_msg_->root_certificate[11]; - EXPECT_EQ( - get_asroot_certificate[12])>( - reinterpret_cast(&last_msg_->root_certificate[12])), - 12) - << "incorrect value for root_certificate[12], expected 12, is " - << last_msg_->root_certificate[12]; - EXPECT_EQ( - get_asroot_certificate[13])>( - reinterpret_cast(&last_msg_->root_certificate[13])), - 13) - << "incorrect value for root_certificate[13], expected 13, is " - << last_msg_->root_certificate[13]; - EXPECT_EQ( - get_asroot_certificate[14])>( - reinterpret_cast(&last_msg_->root_certificate[14])), - 14) - << "incorrect value for root_certificate[14], expected 14, is " - << last_msg_->root_certificate[14]; - EXPECT_EQ( - get_asroot_certificate[15])>( - reinterpret_cast(&last_msg_->root_certificate[15])), - 15) - << "incorrect value for root_certificate[15], expected 15, is " - << last_msg_->root_certificate[15]; - EXPECT_EQ( - get_asroot_certificate[16])>( - reinterpret_cast(&last_msg_->root_certificate[16])), - 16) - << "incorrect value for root_certificate[16], expected 16, is " - << last_msg_->root_certificate[16]; - EXPECT_EQ( - get_asroot_certificate[17])>( - reinterpret_cast(&last_msg_->root_certificate[17])), - 17) - << "incorrect value for root_certificate[17], expected 17, is " - << last_msg_->root_certificate[17]; - EXPECT_EQ( - get_asroot_certificate[18])>( - reinterpret_cast(&last_msg_->root_certificate[18])), - 18) - << "incorrect value for root_certificate[18], expected 18, is " - << last_msg_->root_certificate[18]; - EXPECT_EQ( - get_asroot_certificate[19])>( - reinterpret_cast(&last_msg_->root_certificate[19])), - 19) - << "incorrect value for root_certificate[19], expected 19, is " - << last_msg_->root_certificate[19]; - EXPECT_EQ( - get_assignature.data[0])>( - reinterpret_cast(&last_msg_->signature.data[0])), - 0) - << "incorrect value for signature.data[0], expected 0, is " - << last_msg_->signature.data[0]; - EXPECT_EQ( - get_assignature.data[1])>( - reinterpret_cast(&last_msg_->signature.data[1])), - 1) - << "incorrect value for signature.data[1], expected 1, is " - << last_msg_->signature.data[1]; - EXPECT_EQ( - get_assignature.data[2])>( - reinterpret_cast(&last_msg_->signature.data[2])), - 2) - << "incorrect value for signature.data[2], expected 2, is " - << last_msg_->signature.data[2]; - EXPECT_EQ( - get_assignature.data[3])>( - reinterpret_cast(&last_msg_->signature.data[3])), - 3) - << "incorrect value for signature.data[3], expected 3, is " - << last_msg_->signature.data[3]; - EXPECT_EQ( - get_assignature.data[4])>( - reinterpret_cast(&last_msg_->signature.data[4])), - 4) - << "incorrect value for signature.data[4], expected 4, is " - << last_msg_->signature.data[4]; - EXPECT_EQ( - get_assignature.data[5])>( - reinterpret_cast(&last_msg_->signature.data[5])), - 5) - << "incorrect value for signature.data[5], expected 5, is " - << last_msg_->signature.data[5]; - EXPECT_EQ( - get_assignature.data[6])>( - reinterpret_cast(&last_msg_->signature.data[6])), - 6) - << "incorrect value for signature.data[6], expected 6, is " - << last_msg_->signature.data[6]; - EXPECT_EQ( - get_assignature.data[7])>( - reinterpret_cast(&last_msg_->signature.data[7])), - 7) - << "incorrect value for signature.data[7], expected 7, is " - << last_msg_->signature.data[7]; - EXPECT_EQ( - get_assignature.data[8])>( - reinterpret_cast(&last_msg_->signature.data[8])), - 8) - << "incorrect value for signature.data[8], expected 8, is " - << last_msg_->signature.data[8]; - EXPECT_EQ( - get_assignature.data[9])>( - reinterpret_cast(&last_msg_->signature.data[9])), - 9) - << "incorrect value for signature.data[9], expected 9, is " - << last_msg_->signature.data[9]; - EXPECT_EQ( - get_assignature.data[10])>( - reinterpret_cast(&last_msg_->signature.data[10])), - 10) - << "incorrect value for signature.data[10], expected 10, is " - << last_msg_->signature.data[10]; - EXPECT_EQ( - get_assignature.data[11])>( - reinterpret_cast(&last_msg_->signature.data[11])), - 11) - << "incorrect value for signature.data[11], expected 11, is " - << last_msg_->signature.data[11]; - EXPECT_EQ( - get_assignature.data[12])>( - reinterpret_cast(&last_msg_->signature.data[12])), - 12) - << "incorrect value for signature.data[12], expected 12, is " - << last_msg_->signature.data[12]; - EXPECT_EQ( - get_assignature.data[13])>( - reinterpret_cast(&last_msg_->signature.data[13])), - 13) - << "incorrect value for signature.data[13], expected 13, is " - << last_msg_->signature.data[13]; - EXPECT_EQ( - get_assignature.data[14])>( - reinterpret_cast(&last_msg_->signature.data[14])), - 14) - << "incorrect value for signature.data[14], expected 14, is " - << last_msg_->signature.data[14]; - EXPECT_EQ( - get_assignature.data[15])>( - reinterpret_cast(&last_msg_->signature.data[15])), - 15) - << "incorrect value for signature.data[15], expected 15, is " - << last_msg_->signature.data[15]; - EXPECT_EQ( - get_assignature.data[16])>( - reinterpret_cast(&last_msg_->signature.data[16])), - 16) - << "incorrect value for signature.data[16], expected 16, is " - << last_msg_->signature.data[16]; - EXPECT_EQ( - get_assignature.data[17])>( - reinterpret_cast(&last_msg_->signature.data[17])), - 17) - << "incorrect value for signature.data[17], expected 17, is " - << last_msg_->signature.data[17]; - EXPECT_EQ( - get_assignature.data[18])>( - reinterpret_cast(&last_msg_->signature.data[18])), - 18) - << "incorrect value for signature.data[18], expected 18, is " - << last_msg_->signature.data[18]; - EXPECT_EQ( - get_assignature.data[19])>( - reinterpret_cast(&last_msg_->signature.data[19])), - 19) - << "incorrect value for signature.data[19], expected 19, is " - << last_msg_->signature.data[19]; - EXPECT_EQ( - get_assignature.data[20])>( - reinterpret_cast(&last_msg_->signature.data[20])), - 20) - << "incorrect value for signature.data[20], expected 20, is " - << last_msg_->signature.data[20]; - EXPECT_EQ( - get_assignature.data[21])>( - reinterpret_cast(&last_msg_->signature.data[21])), - 21) - << "incorrect value for signature.data[21], expected 21, is " - << last_msg_->signature.data[21]; - EXPECT_EQ( - get_assignature.data[22])>( - reinterpret_cast(&last_msg_->signature.data[22])), - 22) - << "incorrect value for signature.data[22], expected 22, is " - << last_msg_->signature.data[22]; - EXPECT_EQ( - get_assignature.data[23])>( - reinterpret_cast(&last_msg_->signature.data[23])), - 23) - << "incorrect value for signature.data[23], expected 23, is " - << last_msg_->signature.data[23]; - EXPECT_EQ( - get_assignature.data[24])>( - reinterpret_cast(&last_msg_->signature.data[24])), - 24) - << "incorrect value for signature.data[24], expected 24, is " - << last_msg_->signature.data[24]; - EXPECT_EQ( - get_assignature.data[25])>( - reinterpret_cast(&last_msg_->signature.data[25])), - 25) - << "incorrect value for signature.data[25], expected 25, is " - << last_msg_->signature.data[25]; - EXPECT_EQ( - get_assignature.data[26])>( - reinterpret_cast(&last_msg_->signature.data[26])), - 26) - << "incorrect value for signature.data[26], expected 26, is " - << last_msg_->signature.data[26]; - EXPECT_EQ( - get_assignature.data[27])>( - reinterpret_cast(&last_msg_->signature.data[27])), - 27) - << "incorrect value for signature.data[27], expected 27, is " - << last_msg_->signature.data[27]; - EXPECT_EQ( - get_assignature.data[28])>( - reinterpret_cast(&last_msg_->signature.data[28])), - 28) - << "incorrect value for signature.data[28], expected 28, is " - << last_msg_->signature.data[28]; - EXPECT_EQ( - get_assignature.data[29])>( - reinterpret_cast(&last_msg_->signature.data[29])), - 29) - << "incorrect value for signature.data[29], expected 29, is " - << last_msg_->signature.data[29]; - EXPECT_EQ( - get_assignature.data[30])>( - reinterpret_cast(&last_msg_->signature.data[30])), - 30) - << "incorrect value for signature.data[30], expected 30, is " - << last_msg_->signature.data[30]; - EXPECT_EQ( - get_assignature.data[31])>( - reinterpret_cast(&last_msg_->signature.data[31])), - 31) - << "incorrect value for signature.data[31], expected 31, is " - << last_msg_->signature.data[31]; - EXPECT_EQ( - get_assignature.data[32])>( - reinterpret_cast(&last_msg_->signature.data[32])), - 32) - << "incorrect value for signature.data[32], expected 32, is " - << last_msg_->signature.data[32]; - EXPECT_EQ( - get_assignature.data[33])>( - reinterpret_cast(&last_msg_->signature.data[33])), - 33) - << "incorrect value for signature.data[33], expected 33, is " - << last_msg_->signature.data[33]; - EXPECT_EQ( - get_assignature.data[34])>( - reinterpret_cast(&last_msg_->signature.data[34])), - 34) - << "incorrect value for signature.data[34], expected 34, is " - << last_msg_->signature.data[34]; - EXPECT_EQ( - get_assignature.data[35])>( - reinterpret_cast(&last_msg_->signature.data[35])), - 35) - << "incorrect value for signature.data[35], expected 35, is " - << last_msg_->signature.data[35]; - EXPECT_EQ( - get_assignature.data[36])>( - reinterpret_cast(&last_msg_->signature.data[36])), - 36) - << "incorrect value for signature.data[36], expected 36, is " - << last_msg_->signature.data[36]; - EXPECT_EQ( - get_assignature.data[37])>( - reinterpret_cast(&last_msg_->signature.data[37])), - 37) - << "incorrect value for signature.data[37], expected 37, is " - << last_msg_->signature.data[37]; - EXPECT_EQ( - get_assignature.data[38])>( - reinterpret_cast(&last_msg_->signature.data[38])), - 38) - << "incorrect value for signature.data[38], expected 38, is " - << last_msg_->signature.data[38]; - EXPECT_EQ( - get_assignature.data[39])>( - reinterpret_cast(&last_msg_->signature.data[39])), - 39) - << "incorrect value for signature.data[39], expected 39, is " - << last_msg_->signature.data[39]; - EXPECT_EQ( - get_assignature.data[40])>( - reinterpret_cast(&last_msg_->signature.data[40])), - 40) - << "incorrect value for signature.data[40], expected 40, is " - << last_msg_->signature.data[40]; - EXPECT_EQ( - get_assignature.data[41])>( - reinterpret_cast(&last_msg_->signature.data[41])), - 41) - << "incorrect value for signature.data[41], expected 41, is " - << last_msg_->signature.data[41]; - EXPECT_EQ( - get_assignature.data[42])>( - reinterpret_cast(&last_msg_->signature.data[42])), - 42) - << "incorrect value for signature.data[42], expected 42, is " - << last_msg_->signature.data[42]; - EXPECT_EQ( - get_assignature.data[43])>( - reinterpret_cast(&last_msg_->signature.data[43])), - 43) - << "incorrect value for signature.data[43], expected 43, is " - << last_msg_->signature.data[43]; - EXPECT_EQ( - get_assignature.data[44])>( - reinterpret_cast(&last_msg_->signature.data[44])), - 44) - << "incorrect value for signature.data[44], expected 44, is " - << last_msg_->signature.data[44]; - EXPECT_EQ( - get_assignature.data[45])>( - reinterpret_cast(&last_msg_->signature.data[45])), - 45) - << "incorrect value for signature.data[45], expected 45, is " - << last_msg_->signature.data[45]; - EXPECT_EQ( - get_assignature.data[46])>( - reinterpret_cast(&last_msg_->signature.data[46])), - 46) - << "incorrect value for signature.data[46], expected 46, is " - << last_msg_->signature.data[46]; - EXPECT_EQ( - get_assignature.data[47])>( - reinterpret_cast(&last_msg_->signature.data[47])), - 47) - << "incorrect value for signature.data[47], expected 47, is " - << last_msg_->signature.data[47]; - EXPECT_EQ( - get_assignature.data[48])>( - reinterpret_cast(&last_msg_->signature.data[48])), - 48) - << "incorrect value for signature.data[48], expected 48, is " - << last_msg_->signature.data[48]; - EXPECT_EQ( - get_assignature.data[49])>( - reinterpret_cast(&last_msg_->signature.data[49])), - 49) - << "incorrect value for signature.data[49], expected 49, is " - << last_msg_->signature.data[49]; - EXPECT_EQ( - get_assignature.data[50])>( - reinterpret_cast(&last_msg_->signature.data[50])), - 50) - << "incorrect value for signature.data[50], expected 50, is " - << last_msg_->signature.data[50]; - EXPECT_EQ( - get_assignature.data[51])>( - reinterpret_cast(&last_msg_->signature.data[51])), - 51) - << "incorrect value for signature.data[51], expected 51, is " - << last_msg_->signature.data[51]; - EXPECT_EQ( - get_assignature.data[52])>( - reinterpret_cast(&last_msg_->signature.data[52])), - 52) - << "incorrect value for signature.data[52], expected 52, is " - << last_msg_->signature.data[52]; - EXPECT_EQ( - get_assignature.data[53])>( - reinterpret_cast(&last_msg_->signature.data[53])), - 53) - << "incorrect value for signature.data[53], expected 53, is " - << last_msg_->signature.data[53]; - EXPECT_EQ( - get_assignature.data[54])>( - reinterpret_cast(&last_msg_->signature.data[54])), - 54) - << "incorrect value for signature.data[54], expected 54, is " - << last_msg_->signature.data[54]; - EXPECT_EQ( - get_assignature.data[55])>( - reinterpret_cast(&last_msg_->signature.data[55])), - 55) - << "incorrect value for signature.data[55], expected 55, is " - << last_msg_->signature.data[55]; - EXPECT_EQ( - get_assignature.data[56])>( - reinterpret_cast(&last_msg_->signature.data[56])), - 56) - << "incorrect value for signature.data[56], expected 56, is " - << last_msg_->signature.data[56]; - EXPECT_EQ( - get_assignature.data[57])>( - reinterpret_cast(&last_msg_->signature.data[57])), - 57) - << "incorrect value for signature.data[57], expected 57, is " - << last_msg_->signature.data[57]; - EXPECT_EQ( - get_assignature.data[58])>( - reinterpret_cast(&last_msg_->signature.data[58])), - 58) - << "incorrect value for signature.data[58], expected 58, is " - << last_msg_->signature.data[58]; - EXPECT_EQ( - get_assignature.data[59])>( - reinterpret_cast(&last_msg_->signature.data[59])), - 59) - << "incorrect value for signature.data[59], expected 59, is " - << last_msg_->signature.data[59]; - EXPECT_EQ( - get_assignature.data[60])>( - reinterpret_cast(&last_msg_->signature.data[60])), - 60) - << "incorrect value for signature.data[60], expected 60, is " - << last_msg_->signature.data[60]; - EXPECT_EQ( - get_assignature.data[61])>( - reinterpret_cast(&last_msg_->signature.data[61])), - 61) - << "incorrect value for signature.data[61], expected 61, is " - << last_msg_->signature.data[61]; - EXPECT_EQ( - get_assignature.data[62])>( - reinterpret_cast(&last_msg_->signature.data[62])), - 62) - << "incorrect value for signature.data[62], expected 62, is " - << last_msg_->signature.data[62]; - EXPECT_EQ( - get_assignature.data[63])>( - reinterpret_cast(&last_msg_->signature.data[63])), - 63) - << "incorrect value for signature.data[63], expected 63, is " - << last_msg_->signature.data[63]; - EXPECT_EQ( - get_assignature.data[64])>( - reinterpret_cast(&last_msg_->signature.data[64])), - 64) - << "incorrect value for signature.data[64], expected 64, is " - << last_msg_->signature.data[64]; - EXPECT_EQ( - get_assignature.data[65])>( - reinterpret_cast(&last_msg_->signature.data[65])), - 65) - << "incorrect value for signature.data[65], expected 65, is " - << last_msg_->signature.data[65]; - EXPECT_EQ( - get_assignature.data[66])>( - reinterpret_cast(&last_msg_->signature.data[66])), - 66) - << "incorrect value for signature.data[66], expected 66, is " - << last_msg_->signature.data[66]; - EXPECT_EQ( - get_assignature.data[67])>( - reinterpret_cast(&last_msg_->signature.data[67])), - 67) - << "incorrect value for signature.data[67], expected 67, is " - << last_msg_->signature.data[67]; - EXPECT_EQ( - get_assignature.data[68])>( - reinterpret_cast(&last_msg_->signature.data[68])), - 68) - << "incorrect value for signature.data[68], expected 68, is " - << last_msg_->signature.data[68]; - EXPECT_EQ( - get_assignature.data[69])>( - reinterpret_cast(&last_msg_->signature.data[69])), - 69) - << "incorrect value for signature.data[69], expected 69, is " - << last_msg_->signature.data[69]; - EXPECT_EQ( - get_assignature.data[70])>( - reinterpret_cast(&last_msg_->signature.data[70])), - 70) - << "incorrect value for signature.data[70], expected 70, is " - << last_msg_->signature.data[70]; - EXPECT_EQ( - get_assignature.data[71])>( - reinterpret_cast(&last_msg_->signature.data[71])), - 71) - << "incorrect value for signature.data[71], expected 71, is " - << last_msg_->signature.data[71]; - EXPECT_EQ(get_assignature.len)>( - reinterpret_cast(&last_msg_->signature.len)), - 72) - << "incorrect value for signature.len, expected 72, is " - << last_msg_->signature.len; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_signing_MsgCertificateChainDep.cc b/c/test/legacy/cpp/auto_check_sbp_signing_MsgCertificateChainDep.cc deleted file mode 100644 index 69f81b32d5..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_signing_MsgCertificateChainDep.cc +++ /dev/null @@ -1,1535 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgCertificateChainDep.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_signing_MsgCertificateChainDep0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_signing_MsgCertificateChainDep0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_certificate_chain_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_certificate_chain_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_signing_MsgCertificateChainDep0, Test) { - uint8_t encoded_frame[] = { - 85, 5, 12, 66, 0, 135, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 232, 7, 3, 30, 12, 34, 59, 21, 205, 91, 7, 0, 1, 2, - 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, - 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, - 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, - 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 112, 100, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_certificate_chain_dep_t *test_msg = - (msg_certificate_chain_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[0] = 20; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[1] = 21; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[2] = 22; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[3] = 23; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[4] = 24; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[5] = 25; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[6] = 26; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[7] = 27; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[8] = 28; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[9] = 29; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[10] = 10; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[11] = 11; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[12] = 12; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[13] = 13; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[14] = 14; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[15] = 15; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[16] = 16; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[17] = 17; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[18] = 18; - if (sizeof(test_msg->corrections_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->corrections_certificate[0])); - } - test_msg->corrections_certificate[19] = 19; - test_msg->expiration.day = 30; - test_msg->expiration.hours = 12; - test_msg->expiration.minutes = 34; - test_msg->expiration.month = 3; - test_msg->expiration.ns = 123456789; - test_msg->expiration.seconds = 59; - test_msg->expiration.year = 2024; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[0] = 10; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[1] = 11; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[2] = 12; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[3] = 13; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[4] = 14; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[5] = 15; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[6] = 16; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[7] = 17; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[8] = 18; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[9] = 19; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[10] = 0; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[11] = 1; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[12] = 2; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[13] = 3; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[14] = 4; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[15] = 5; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[16] = 6; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[17] = 7; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[18] = 8; - if (sizeof(test_msg->intermediate_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->intermediate_certificate[0])); - } - test_msg->intermediate_certificate[19] = 9; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[0] = 0; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[1] = 1; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[2] = 2; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[3] = 3; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[4] = 4; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[5] = 5; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[6] = 6; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[7] = 7; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[8] = 8; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[9] = 9; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[10] = 10; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[11] = 11; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[12] = 12; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[13] = 13; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[14] = 14; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[15] = 15; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[16] = 16; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[17] = 17; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[18] = 18; - if (sizeof(test_msg->root_certificate) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->root_certificate[0])); - } - test_msg->root_certificate[19] = 19; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[0] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[1] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[2] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[3] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[4] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[5] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[6] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[7] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[8] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[9] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[10] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[11] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[12] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[13] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[14] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[15] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[16] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[17] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[18] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[19] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[20] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[21] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[22] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[23] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[24] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[25] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[26] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[27] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[28] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[29] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[30] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[31] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[32] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[33] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[34] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[35] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[36] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[37] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[38] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[39] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[40] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[41] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[42] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[43] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[44] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[45] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[46] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[47] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[48] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[49] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[50] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[51] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[52] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[53] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[54] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[55] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[56] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[57] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[58] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[59] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[60] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[61] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[62] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[63] = 7; - - EXPECT_EQ(send_message(0xC05, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascorrections_certificate[0])>( - reinterpret_cast( - &last_msg_->corrections_certificate[0])), - 20) - << "incorrect value for corrections_certificate[0], expected 20, is " - << last_msg_->corrections_certificate[0]; - EXPECT_EQ(get_ascorrections_certificate[1])>( - reinterpret_cast( - &last_msg_->corrections_certificate[1])), - 21) - << "incorrect value for corrections_certificate[1], expected 21, is " - << last_msg_->corrections_certificate[1]; - EXPECT_EQ(get_ascorrections_certificate[2])>( - reinterpret_cast( - &last_msg_->corrections_certificate[2])), - 22) - << "incorrect value for corrections_certificate[2], expected 22, is " - << last_msg_->corrections_certificate[2]; - EXPECT_EQ(get_ascorrections_certificate[3])>( - reinterpret_cast( - &last_msg_->corrections_certificate[3])), - 23) - << "incorrect value for corrections_certificate[3], expected 23, is " - << last_msg_->corrections_certificate[3]; - EXPECT_EQ(get_ascorrections_certificate[4])>( - reinterpret_cast( - &last_msg_->corrections_certificate[4])), - 24) - << "incorrect value for corrections_certificate[4], expected 24, is " - << last_msg_->corrections_certificate[4]; - EXPECT_EQ(get_ascorrections_certificate[5])>( - reinterpret_cast( - &last_msg_->corrections_certificate[5])), - 25) - << "incorrect value for corrections_certificate[5], expected 25, is " - << last_msg_->corrections_certificate[5]; - EXPECT_EQ(get_ascorrections_certificate[6])>( - reinterpret_cast( - &last_msg_->corrections_certificate[6])), - 26) - << "incorrect value for corrections_certificate[6], expected 26, is " - << last_msg_->corrections_certificate[6]; - EXPECT_EQ(get_ascorrections_certificate[7])>( - reinterpret_cast( - &last_msg_->corrections_certificate[7])), - 27) - << "incorrect value for corrections_certificate[7], expected 27, is " - << last_msg_->corrections_certificate[7]; - EXPECT_EQ(get_ascorrections_certificate[8])>( - reinterpret_cast( - &last_msg_->corrections_certificate[8])), - 28) - << "incorrect value for corrections_certificate[8], expected 28, is " - << last_msg_->corrections_certificate[8]; - EXPECT_EQ(get_ascorrections_certificate[9])>( - reinterpret_cast( - &last_msg_->corrections_certificate[9])), - 29) - << "incorrect value for corrections_certificate[9], expected 29, is " - << last_msg_->corrections_certificate[9]; - EXPECT_EQ(get_ascorrections_certificate[10])>( - reinterpret_cast( - &last_msg_->corrections_certificate[10])), - 10) - << "incorrect value for corrections_certificate[10], expected 10, is " - << last_msg_->corrections_certificate[10]; - EXPECT_EQ(get_ascorrections_certificate[11])>( - reinterpret_cast( - &last_msg_->corrections_certificate[11])), - 11) - << "incorrect value for corrections_certificate[11], expected 11, is " - << last_msg_->corrections_certificate[11]; - EXPECT_EQ(get_ascorrections_certificate[12])>( - reinterpret_cast( - &last_msg_->corrections_certificate[12])), - 12) - << "incorrect value for corrections_certificate[12], expected 12, is " - << last_msg_->corrections_certificate[12]; - EXPECT_EQ(get_ascorrections_certificate[13])>( - reinterpret_cast( - &last_msg_->corrections_certificate[13])), - 13) - << "incorrect value for corrections_certificate[13], expected 13, is " - << last_msg_->corrections_certificate[13]; - EXPECT_EQ(get_ascorrections_certificate[14])>( - reinterpret_cast( - &last_msg_->corrections_certificate[14])), - 14) - << "incorrect value for corrections_certificate[14], expected 14, is " - << last_msg_->corrections_certificate[14]; - EXPECT_EQ(get_ascorrections_certificate[15])>( - reinterpret_cast( - &last_msg_->corrections_certificate[15])), - 15) - << "incorrect value for corrections_certificate[15], expected 15, is " - << last_msg_->corrections_certificate[15]; - EXPECT_EQ(get_ascorrections_certificate[16])>( - reinterpret_cast( - &last_msg_->corrections_certificate[16])), - 16) - << "incorrect value for corrections_certificate[16], expected 16, is " - << last_msg_->corrections_certificate[16]; - EXPECT_EQ(get_ascorrections_certificate[17])>( - reinterpret_cast( - &last_msg_->corrections_certificate[17])), - 17) - << "incorrect value for corrections_certificate[17], expected 17, is " - << last_msg_->corrections_certificate[17]; - EXPECT_EQ(get_ascorrections_certificate[18])>( - reinterpret_cast( - &last_msg_->corrections_certificate[18])), - 18) - << "incorrect value for corrections_certificate[18], expected 18, is " - << last_msg_->corrections_certificate[18]; - EXPECT_EQ(get_ascorrections_certificate[19])>( - reinterpret_cast( - &last_msg_->corrections_certificate[19])), - 19) - << "incorrect value for corrections_certificate[19], expected 19, is " - << last_msg_->corrections_certificate[19]; - EXPECT_EQ(get_asexpiration.day)>( - reinterpret_cast(&last_msg_->expiration.day)), - 30) - << "incorrect value for expiration.day, expected 30, is " - << last_msg_->expiration.day; - EXPECT_EQ( - get_asexpiration.hours)>( - reinterpret_cast(&last_msg_->expiration.hours)), - 12) - << "incorrect value for expiration.hours, expected 12, is " - << last_msg_->expiration.hours; - EXPECT_EQ( - get_asexpiration.minutes)>( - reinterpret_cast(&last_msg_->expiration.minutes)), - 34) - << "incorrect value for expiration.minutes, expected 34, is " - << last_msg_->expiration.minutes; - EXPECT_EQ( - get_asexpiration.month)>( - reinterpret_cast(&last_msg_->expiration.month)), - 3) - << "incorrect value for expiration.month, expected 3, is " - << last_msg_->expiration.month; - EXPECT_EQ(get_asexpiration.ns)>( - reinterpret_cast(&last_msg_->expiration.ns)), - 123456789) - << "incorrect value for expiration.ns, expected 123456789, is " - << last_msg_->expiration.ns; - EXPECT_EQ( - get_asexpiration.seconds)>( - reinterpret_cast(&last_msg_->expiration.seconds)), - 59) - << "incorrect value for expiration.seconds, expected 59, is " - << last_msg_->expiration.seconds; - EXPECT_EQ(get_asexpiration.year)>( - reinterpret_cast(&last_msg_->expiration.year)), - 2024) - << "incorrect value for expiration.year, expected 2024, is " - << last_msg_->expiration.year; - EXPECT_EQ(get_asintermediate_certificate[0])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[0])), - 10) - << "incorrect value for intermediate_certificate[0], expected 10, is " - << last_msg_->intermediate_certificate[0]; - EXPECT_EQ(get_asintermediate_certificate[1])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[1])), - 11) - << "incorrect value for intermediate_certificate[1], expected 11, is " - << last_msg_->intermediate_certificate[1]; - EXPECT_EQ(get_asintermediate_certificate[2])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[2])), - 12) - << "incorrect value for intermediate_certificate[2], expected 12, is " - << last_msg_->intermediate_certificate[2]; - EXPECT_EQ(get_asintermediate_certificate[3])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[3])), - 13) - << "incorrect value for intermediate_certificate[3], expected 13, is " - << last_msg_->intermediate_certificate[3]; - EXPECT_EQ(get_asintermediate_certificate[4])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[4])), - 14) - << "incorrect value for intermediate_certificate[4], expected 14, is " - << last_msg_->intermediate_certificate[4]; - EXPECT_EQ(get_asintermediate_certificate[5])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[5])), - 15) - << "incorrect value for intermediate_certificate[5], expected 15, is " - << last_msg_->intermediate_certificate[5]; - EXPECT_EQ(get_asintermediate_certificate[6])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[6])), - 16) - << "incorrect value for intermediate_certificate[6], expected 16, is " - << last_msg_->intermediate_certificate[6]; - EXPECT_EQ(get_asintermediate_certificate[7])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[7])), - 17) - << "incorrect value for intermediate_certificate[7], expected 17, is " - << last_msg_->intermediate_certificate[7]; - EXPECT_EQ(get_asintermediate_certificate[8])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[8])), - 18) - << "incorrect value for intermediate_certificate[8], expected 18, is " - << last_msg_->intermediate_certificate[8]; - EXPECT_EQ(get_asintermediate_certificate[9])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[9])), - 19) - << "incorrect value for intermediate_certificate[9], expected 19, is " - << last_msg_->intermediate_certificate[9]; - EXPECT_EQ(get_asintermediate_certificate[10])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[10])), - 0) - << "incorrect value for intermediate_certificate[10], expected 0, is " - << last_msg_->intermediate_certificate[10]; - EXPECT_EQ(get_asintermediate_certificate[11])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[11])), - 1) - << "incorrect value for intermediate_certificate[11], expected 1, is " - << last_msg_->intermediate_certificate[11]; - EXPECT_EQ(get_asintermediate_certificate[12])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[12])), - 2) - << "incorrect value for intermediate_certificate[12], expected 2, is " - << last_msg_->intermediate_certificate[12]; - EXPECT_EQ(get_asintermediate_certificate[13])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[13])), - 3) - << "incorrect value for intermediate_certificate[13], expected 3, is " - << last_msg_->intermediate_certificate[13]; - EXPECT_EQ(get_asintermediate_certificate[14])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[14])), - 4) - << "incorrect value for intermediate_certificate[14], expected 4, is " - << last_msg_->intermediate_certificate[14]; - EXPECT_EQ(get_asintermediate_certificate[15])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[15])), - 5) - << "incorrect value for intermediate_certificate[15], expected 5, is " - << last_msg_->intermediate_certificate[15]; - EXPECT_EQ(get_asintermediate_certificate[16])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[16])), - 6) - << "incorrect value for intermediate_certificate[16], expected 6, is " - << last_msg_->intermediate_certificate[16]; - EXPECT_EQ(get_asintermediate_certificate[17])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[17])), - 7) - << "incorrect value for intermediate_certificate[17], expected 7, is " - << last_msg_->intermediate_certificate[17]; - EXPECT_EQ(get_asintermediate_certificate[18])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[18])), - 8) - << "incorrect value for intermediate_certificate[18], expected 8, is " - << last_msg_->intermediate_certificate[18]; - EXPECT_EQ(get_asintermediate_certificate[19])>( - reinterpret_cast( - &last_msg_->intermediate_certificate[19])), - 9) - << "incorrect value for intermediate_certificate[19], expected 9, is " - << last_msg_->intermediate_certificate[19]; - EXPECT_EQ( - get_asroot_certificate[0])>( - reinterpret_cast(&last_msg_->root_certificate[0])), - 0) - << "incorrect value for root_certificate[0], expected 0, is " - << last_msg_->root_certificate[0]; - EXPECT_EQ( - get_asroot_certificate[1])>( - reinterpret_cast(&last_msg_->root_certificate[1])), - 1) - << "incorrect value for root_certificate[1], expected 1, is " - << last_msg_->root_certificate[1]; - EXPECT_EQ( - get_asroot_certificate[2])>( - reinterpret_cast(&last_msg_->root_certificate[2])), - 2) - << "incorrect value for root_certificate[2], expected 2, is " - << last_msg_->root_certificate[2]; - EXPECT_EQ( - get_asroot_certificate[3])>( - reinterpret_cast(&last_msg_->root_certificate[3])), - 3) - << "incorrect value for root_certificate[3], expected 3, is " - << last_msg_->root_certificate[3]; - EXPECT_EQ( - get_asroot_certificate[4])>( - reinterpret_cast(&last_msg_->root_certificate[4])), - 4) - << "incorrect value for root_certificate[4], expected 4, is " - << last_msg_->root_certificate[4]; - EXPECT_EQ( - get_asroot_certificate[5])>( - reinterpret_cast(&last_msg_->root_certificate[5])), - 5) - << "incorrect value for root_certificate[5], expected 5, is " - << last_msg_->root_certificate[5]; - EXPECT_EQ( - get_asroot_certificate[6])>( - reinterpret_cast(&last_msg_->root_certificate[6])), - 6) - << "incorrect value for root_certificate[6], expected 6, is " - << last_msg_->root_certificate[6]; - EXPECT_EQ( - get_asroot_certificate[7])>( - reinterpret_cast(&last_msg_->root_certificate[7])), - 7) - << "incorrect value for root_certificate[7], expected 7, is " - << last_msg_->root_certificate[7]; - EXPECT_EQ( - get_asroot_certificate[8])>( - reinterpret_cast(&last_msg_->root_certificate[8])), - 8) - << "incorrect value for root_certificate[8], expected 8, is " - << last_msg_->root_certificate[8]; - EXPECT_EQ( - get_asroot_certificate[9])>( - reinterpret_cast(&last_msg_->root_certificate[9])), - 9) - << "incorrect value for root_certificate[9], expected 9, is " - << last_msg_->root_certificate[9]; - EXPECT_EQ( - get_asroot_certificate[10])>( - reinterpret_cast(&last_msg_->root_certificate[10])), - 10) - << "incorrect value for root_certificate[10], expected 10, is " - << last_msg_->root_certificate[10]; - EXPECT_EQ( - get_asroot_certificate[11])>( - reinterpret_cast(&last_msg_->root_certificate[11])), - 11) - << "incorrect value for root_certificate[11], expected 11, is " - << last_msg_->root_certificate[11]; - EXPECT_EQ( - get_asroot_certificate[12])>( - reinterpret_cast(&last_msg_->root_certificate[12])), - 12) - << "incorrect value for root_certificate[12], expected 12, is " - << last_msg_->root_certificate[12]; - EXPECT_EQ( - get_asroot_certificate[13])>( - reinterpret_cast(&last_msg_->root_certificate[13])), - 13) - << "incorrect value for root_certificate[13], expected 13, is " - << last_msg_->root_certificate[13]; - EXPECT_EQ( - get_asroot_certificate[14])>( - reinterpret_cast(&last_msg_->root_certificate[14])), - 14) - << "incorrect value for root_certificate[14], expected 14, is " - << last_msg_->root_certificate[14]; - EXPECT_EQ( - get_asroot_certificate[15])>( - reinterpret_cast(&last_msg_->root_certificate[15])), - 15) - << "incorrect value for root_certificate[15], expected 15, is " - << last_msg_->root_certificate[15]; - EXPECT_EQ( - get_asroot_certificate[16])>( - reinterpret_cast(&last_msg_->root_certificate[16])), - 16) - << "incorrect value for root_certificate[16], expected 16, is " - << last_msg_->root_certificate[16]; - EXPECT_EQ( - get_asroot_certificate[17])>( - reinterpret_cast(&last_msg_->root_certificate[17])), - 17) - << "incorrect value for root_certificate[17], expected 17, is " - << last_msg_->root_certificate[17]; - EXPECT_EQ( - get_asroot_certificate[18])>( - reinterpret_cast(&last_msg_->root_certificate[18])), - 18) - << "incorrect value for root_certificate[18], expected 18, is " - << last_msg_->root_certificate[18]; - EXPECT_EQ( - get_asroot_certificate[19])>( - reinterpret_cast(&last_msg_->root_certificate[19])), - 19) - << "incorrect value for root_certificate[19], expected 19, is " - << last_msg_->root_certificate[19]; - EXPECT_EQ(get_assignature[0])>( - reinterpret_cast(&last_msg_->signature[0])), - 0) - << "incorrect value for signature[0], expected 0, is " - << last_msg_->signature[0]; - EXPECT_EQ(get_assignature[1])>( - reinterpret_cast(&last_msg_->signature[1])), - 1) - << "incorrect value for signature[1], expected 1, is " - << last_msg_->signature[1]; - EXPECT_EQ(get_assignature[2])>( - reinterpret_cast(&last_msg_->signature[2])), - 2) - << "incorrect value for signature[2], expected 2, is " - << last_msg_->signature[2]; - EXPECT_EQ(get_assignature[3])>( - reinterpret_cast(&last_msg_->signature[3])), - 3) - << "incorrect value for signature[3], expected 3, is " - << last_msg_->signature[3]; - EXPECT_EQ(get_assignature[4])>( - reinterpret_cast(&last_msg_->signature[4])), - 4) - << "incorrect value for signature[4], expected 4, is " - << last_msg_->signature[4]; - EXPECT_EQ(get_assignature[5])>( - reinterpret_cast(&last_msg_->signature[5])), - 5) - << "incorrect value for signature[5], expected 5, is " - << last_msg_->signature[5]; - EXPECT_EQ(get_assignature[6])>( - reinterpret_cast(&last_msg_->signature[6])), - 6) - << "incorrect value for signature[6], expected 6, is " - << last_msg_->signature[6]; - EXPECT_EQ(get_assignature[7])>( - reinterpret_cast(&last_msg_->signature[7])), - 7) - << "incorrect value for signature[7], expected 7, is " - << last_msg_->signature[7]; - EXPECT_EQ(get_assignature[8])>( - reinterpret_cast(&last_msg_->signature[8])), - 0) - << "incorrect value for signature[8], expected 0, is " - << last_msg_->signature[8]; - EXPECT_EQ(get_assignature[9])>( - reinterpret_cast(&last_msg_->signature[9])), - 1) - << "incorrect value for signature[9], expected 1, is " - << last_msg_->signature[9]; - EXPECT_EQ(get_assignature[10])>( - reinterpret_cast(&last_msg_->signature[10])), - 2) - << "incorrect value for signature[10], expected 2, is " - << last_msg_->signature[10]; - EXPECT_EQ(get_assignature[11])>( - reinterpret_cast(&last_msg_->signature[11])), - 3) - << "incorrect value for signature[11], expected 3, is " - << last_msg_->signature[11]; - EXPECT_EQ(get_assignature[12])>( - reinterpret_cast(&last_msg_->signature[12])), - 4) - << "incorrect value for signature[12], expected 4, is " - << last_msg_->signature[12]; - EXPECT_EQ(get_assignature[13])>( - reinterpret_cast(&last_msg_->signature[13])), - 5) - << "incorrect value for signature[13], expected 5, is " - << last_msg_->signature[13]; - EXPECT_EQ(get_assignature[14])>( - reinterpret_cast(&last_msg_->signature[14])), - 6) - << "incorrect value for signature[14], expected 6, is " - << last_msg_->signature[14]; - EXPECT_EQ(get_assignature[15])>( - reinterpret_cast(&last_msg_->signature[15])), - 7) - << "incorrect value for signature[15], expected 7, is " - << last_msg_->signature[15]; - EXPECT_EQ(get_assignature[16])>( - reinterpret_cast(&last_msg_->signature[16])), - 0) - << "incorrect value for signature[16], expected 0, is " - << last_msg_->signature[16]; - EXPECT_EQ(get_assignature[17])>( - reinterpret_cast(&last_msg_->signature[17])), - 1) - << "incorrect value for signature[17], expected 1, is " - << last_msg_->signature[17]; - EXPECT_EQ(get_assignature[18])>( - reinterpret_cast(&last_msg_->signature[18])), - 2) - << "incorrect value for signature[18], expected 2, is " - << last_msg_->signature[18]; - EXPECT_EQ(get_assignature[19])>( - reinterpret_cast(&last_msg_->signature[19])), - 3) - << "incorrect value for signature[19], expected 3, is " - << last_msg_->signature[19]; - EXPECT_EQ(get_assignature[20])>( - reinterpret_cast(&last_msg_->signature[20])), - 4) - << "incorrect value for signature[20], expected 4, is " - << last_msg_->signature[20]; - EXPECT_EQ(get_assignature[21])>( - reinterpret_cast(&last_msg_->signature[21])), - 5) - << "incorrect value for signature[21], expected 5, is " - << last_msg_->signature[21]; - EXPECT_EQ(get_assignature[22])>( - reinterpret_cast(&last_msg_->signature[22])), - 6) - << "incorrect value for signature[22], expected 6, is " - << last_msg_->signature[22]; - EXPECT_EQ(get_assignature[23])>( - reinterpret_cast(&last_msg_->signature[23])), - 7) - << "incorrect value for signature[23], expected 7, is " - << last_msg_->signature[23]; - EXPECT_EQ(get_assignature[24])>( - reinterpret_cast(&last_msg_->signature[24])), - 0) - << "incorrect value for signature[24], expected 0, is " - << last_msg_->signature[24]; - EXPECT_EQ(get_assignature[25])>( - reinterpret_cast(&last_msg_->signature[25])), - 1) - << "incorrect value for signature[25], expected 1, is " - << last_msg_->signature[25]; - EXPECT_EQ(get_assignature[26])>( - reinterpret_cast(&last_msg_->signature[26])), - 2) - << "incorrect value for signature[26], expected 2, is " - << last_msg_->signature[26]; - EXPECT_EQ(get_assignature[27])>( - reinterpret_cast(&last_msg_->signature[27])), - 3) - << "incorrect value for signature[27], expected 3, is " - << last_msg_->signature[27]; - EXPECT_EQ(get_assignature[28])>( - reinterpret_cast(&last_msg_->signature[28])), - 4) - << "incorrect value for signature[28], expected 4, is " - << last_msg_->signature[28]; - EXPECT_EQ(get_assignature[29])>( - reinterpret_cast(&last_msg_->signature[29])), - 5) - << "incorrect value for signature[29], expected 5, is " - << last_msg_->signature[29]; - EXPECT_EQ(get_assignature[30])>( - reinterpret_cast(&last_msg_->signature[30])), - 6) - << "incorrect value for signature[30], expected 6, is " - << last_msg_->signature[30]; - EXPECT_EQ(get_assignature[31])>( - reinterpret_cast(&last_msg_->signature[31])), - 7) - << "incorrect value for signature[31], expected 7, is " - << last_msg_->signature[31]; - EXPECT_EQ(get_assignature[32])>( - reinterpret_cast(&last_msg_->signature[32])), - 0) - << "incorrect value for signature[32], expected 0, is " - << last_msg_->signature[32]; - EXPECT_EQ(get_assignature[33])>( - reinterpret_cast(&last_msg_->signature[33])), - 1) - << "incorrect value for signature[33], expected 1, is " - << last_msg_->signature[33]; - EXPECT_EQ(get_assignature[34])>( - reinterpret_cast(&last_msg_->signature[34])), - 2) - << "incorrect value for signature[34], expected 2, is " - << last_msg_->signature[34]; - EXPECT_EQ(get_assignature[35])>( - reinterpret_cast(&last_msg_->signature[35])), - 3) - << "incorrect value for signature[35], expected 3, is " - << last_msg_->signature[35]; - EXPECT_EQ(get_assignature[36])>( - reinterpret_cast(&last_msg_->signature[36])), - 4) - << "incorrect value for signature[36], expected 4, is " - << last_msg_->signature[36]; - EXPECT_EQ(get_assignature[37])>( - reinterpret_cast(&last_msg_->signature[37])), - 5) - << "incorrect value for signature[37], expected 5, is " - << last_msg_->signature[37]; - EXPECT_EQ(get_assignature[38])>( - reinterpret_cast(&last_msg_->signature[38])), - 6) - << "incorrect value for signature[38], expected 6, is " - << last_msg_->signature[38]; - EXPECT_EQ(get_assignature[39])>( - reinterpret_cast(&last_msg_->signature[39])), - 7) - << "incorrect value for signature[39], expected 7, is " - << last_msg_->signature[39]; - EXPECT_EQ(get_assignature[40])>( - reinterpret_cast(&last_msg_->signature[40])), - 0) - << "incorrect value for signature[40], expected 0, is " - << last_msg_->signature[40]; - EXPECT_EQ(get_assignature[41])>( - reinterpret_cast(&last_msg_->signature[41])), - 1) - << "incorrect value for signature[41], expected 1, is " - << last_msg_->signature[41]; - EXPECT_EQ(get_assignature[42])>( - reinterpret_cast(&last_msg_->signature[42])), - 2) - << "incorrect value for signature[42], expected 2, is " - << last_msg_->signature[42]; - EXPECT_EQ(get_assignature[43])>( - reinterpret_cast(&last_msg_->signature[43])), - 3) - << "incorrect value for signature[43], expected 3, is " - << last_msg_->signature[43]; - EXPECT_EQ(get_assignature[44])>( - reinterpret_cast(&last_msg_->signature[44])), - 4) - << "incorrect value for signature[44], expected 4, is " - << last_msg_->signature[44]; - EXPECT_EQ(get_assignature[45])>( - reinterpret_cast(&last_msg_->signature[45])), - 5) - << "incorrect value for signature[45], expected 5, is " - << last_msg_->signature[45]; - EXPECT_EQ(get_assignature[46])>( - reinterpret_cast(&last_msg_->signature[46])), - 6) - << "incorrect value for signature[46], expected 6, is " - << last_msg_->signature[46]; - EXPECT_EQ(get_assignature[47])>( - reinterpret_cast(&last_msg_->signature[47])), - 7) - << "incorrect value for signature[47], expected 7, is " - << last_msg_->signature[47]; - EXPECT_EQ(get_assignature[48])>( - reinterpret_cast(&last_msg_->signature[48])), - 0) - << "incorrect value for signature[48], expected 0, is " - << last_msg_->signature[48]; - EXPECT_EQ(get_assignature[49])>( - reinterpret_cast(&last_msg_->signature[49])), - 1) - << "incorrect value for signature[49], expected 1, is " - << last_msg_->signature[49]; - EXPECT_EQ(get_assignature[50])>( - reinterpret_cast(&last_msg_->signature[50])), - 2) - << "incorrect value for signature[50], expected 2, is " - << last_msg_->signature[50]; - EXPECT_EQ(get_assignature[51])>( - reinterpret_cast(&last_msg_->signature[51])), - 3) - << "incorrect value for signature[51], expected 3, is " - << last_msg_->signature[51]; - EXPECT_EQ(get_assignature[52])>( - reinterpret_cast(&last_msg_->signature[52])), - 4) - << "incorrect value for signature[52], expected 4, is " - << last_msg_->signature[52]; - EXPECT_EQ(get_assignature[53])>( - reinterpret_cast(&last_msg_->signature[53])), - 5) - << "incorrect value for signature[53], expected 5, is " - << last_msg_->signature[53]; - EXPECT_EQ(get_assignature[54])>( - reinterpret_cast(&last_msg_->signature[54])), - 6) - << "incorrect value for signature[54], expected 6, is " - << last_msg_->signature[54]; - EXPECT_EQ(get_assignature[55])>( - reinterpret_cast(&last_msg_->signature[55])), - 7) - << "incorrect value for signature[55], expected 7, is " - << last_msg_->signature[55]; - EXPECT_EQ(get_assignature[56])>( - reinterpret_cast(&last_msg_->signature[56])), - 0) - << "incorrect value for signature[56], expected 0, is " - << last_msg_->signature[56]; - EXPECT_EQ(get_assignature[57])>( - reinterpret_cast(&last_msg_->signature[57])), - 1) - << "incorrect value for signature[57], expected 1, is " - << last_msg_->signature[57]; - EXPECT_EQ(get_assignature[58])>( - reinterpret_cast(&last_msg_->signature[58])), - 2) - << "incorrect value for signature[58], expected 2, is " - << last_msg_->signature[58]; - EXPECT_EQ(get_assignature[59])>( - reinterpret_cast(&last_msg_->signature[59])), - 3) - << "incorrect value for signature[59], expected 3, is " - << last_msg_->signature[59]; - EXPECT_EQ(get_assignature[60])>( - reinterpret_cast(&last_msg_->signature[60])), - 4) - << "incorrect value for signature[60], expected 4, is " - << last_msg_->signature[60]; - EXPECT_EQ(get_assignature[61])>( - reinterpret_cast(&last_msg_->signature[61])), - 5) - << "incorrect value for signature[61], expected 5, is " - << last_msg_->signature[61]; - EXPECT_EQ(get_assignature[62])>( - reinterpret_cast(&last_msg_->signature[62])), - 6) - << "incorrect value for signature[62], expected 6, is " - << last_msg_->signature[62]; - EXPECT_EQ(get_assignature[63])>( - reinterpret_cast(&last_msg_->signature[63])), - 7) - << "incorrect value for signature[63], expected 7, is " - << last_msg_->signature[63]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_signing_MsgEcdsaCertificate.cc b/c/test/legacy/cpp/auto_check_sbp_signing_MsgEcdsaCertificate.cc deleted file mode 100644 index b223cbbe56..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_signing_MsgEcdsaCertificate.cc +++ /dev/null @@ -1,3160 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgEcdsaCertificate.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_signing_MsgEcdsaCertificate0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_signing_MsgEcdsaCertificate0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ecdsa_certificate_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ecdsa_certificate_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_signing_MsgEcdsaCertificate0, Test) { - uint8_t encoded_frame[] = { - 85, 4, 12, 66, 0, 253, 48, 10, 11, 12, 13, 2, 180, 160, 116, - 77, 243, 28, 173, 36, 86, 33, 8, 31, 120, 73, 64, 169, 148, 224, - 57, 95, 17, 40, 213, 92, 195, 146, 235, 228, 177, 101, 82, 182, 25, - 172, 170, 250, 236, 7, 119, 4, 201, 10, 14, 208, 47, 126, 49, 210, - 174, 75, 221, 203, 24, 66, 52, 35, 26, 30, 140, 111, 246, 39, 226, - 205, 198, 178, 196, 5, 81, 9, 44, 164, 163, 214, 138, 123, 76, 74, - 237, 121, 13, 137, 186, 97, 193, 189, 200, 124, 69, 115, 230, 159, 185, - 158, 51, 12, 225, 65, 192, 105, 56, 41, 85, 133, 19, 217, 166, 48, - 139, 131, 96, 216, 98, 147, 132, 234, 167, 248, 247, 32, 239, 194, 188, - 254, 114, 117, 83, 25, 251, 191, 104, 240, 118, 68, 42, 93, 18, 16, - 37, 232, 99, 179, 23, 90, 94, 136, 6, 125, 91, 255, 15, 71, 43, - 46, 25, 252, 229, 80, 143, 58, 241, 11, 62, 181, 155, 53, 153, 149, - 152, 227, 150, 87, 112, 165, 2, 128, 231, 25, 157, 244, 204, 108, 253, - 127, 122, 145, 113, 162, 197, 171, 199, 54, 184, 222, 206, 67, 144, 78, - 187, 207, 60, 211, 141, 135, 106, 220, 79, 183, 245, 21, 161, 168, 34, - 129, 50, 176, 1, 218, 20, 130, 59, 249, 109, 219, 0, 100, 103, 55, - 29, 242, 110, 154, 190, 233, 142, 45, 61, 215, 202, 238, 88, 209, 70, - 63, 151, 27, 102, 219, 30, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ecdsa_certificate_t *test_msg = - (msg_ecdsa_certificate_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[0] = 180; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[1] = 160; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[2] = 116; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[3] = 77; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[4] = 243; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[5] = 28; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[6] = 173; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[7] = 36; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[8] = 86; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[9] = 33; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[10] = 8; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[11] = 31; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[12] = 120; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[13] = 73; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[14] = 64; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[15] = 169; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[16] = 148; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[17] = 224; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[18] = 57; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[19] = 95; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[20] = 17; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[21] = 40; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[22] = 213; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[23] = 92; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[24] = 195; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[25] = 146; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[26] = 235; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[27] = 228; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[28] = 177; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[29] = 101; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[30] = 82; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[31] = 182; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[32] = 25; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[33] = 172; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[34] = 170; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[35] = 250; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[36] = 236; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[37] = 7; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[38] = 119; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[39] = 4; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[40] = 201; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[41] = 10; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[42] = 14; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[43] = 208; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[44] = 47; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[45] = 126; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[46] = 49; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[47] = 210; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[48] = 174; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[49] = 75; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[50] = 221; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[51] = 203; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[52] = 24; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[53] = 66; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[54] = 52; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[55] = 35; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[56] = 26; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[57] = 30; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[58] = 140; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[59] = 111; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[60] = 246; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[61] = 39; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[62] = 226; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[63] = 205; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[64] = 198; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[65] = 178; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[66] = 196; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[67] = 5; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[68] = 81; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[69] = 9; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[70] = 44; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[71] = 164; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[72] = 163; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[73] = 214; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[74] = 138; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[75] = 123; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[76] = 76; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[77] = 74; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[78] = 237; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[79] = 121; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[80] = 13; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[81] = 137; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[82] = 186; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[83] = 97; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[84] = 193; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[85] = 189; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[86] = 200; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[87] = 124; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[88] = 69; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[89] = 115; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[90] = 230; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[91] = 159; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[92] = 185; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[93] = 158; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[94] = 51; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[95] = 12; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[96] = 225; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[97] = 65; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[98] = 192; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[99] = 105; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[100] = 56; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[101] = 41; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[102] = 85; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[103] = 133; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[104] = 19; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[105] = 217; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[106] = 166; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[107] = 48; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[108] = 139; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[109] = 131; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[110] = 96; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[111] = 216; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[112] = 98; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[113] = 147; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[114] = 132; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[115] = 234; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[116] = 167; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[117] = 248; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[118] = 247; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[119] = 32; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[120] = 239; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[121] = 194; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[122] = 188; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[123] = 254; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[124] = 114; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[125] = 117; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[126] = 83; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[127] = 25; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[128] = 251; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[129] = 191; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[130] = 104; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[131] = 240; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[132] = 118; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[133] = 68; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[134] = 42; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[135] = 93; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[136] = 18; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[137] = 16; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[138] = 37; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[139] = 232; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[140] = 99; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[141] = 179; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[142] = 23; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[143] = 90; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[144] = 94; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[145] = 136; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[146] = 6; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[147] = 125; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[148] = 91; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[149] = 255; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[150] = 15; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[151] = 71; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[152] = 43; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[153] = 46; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[154] = 25; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[155] = 252; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[156] = 229; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[157] = 80; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[158] = 143; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[159] = 58; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[160] = 241; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[161] = 11; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[162] = 62; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[163] = 181; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[164] = 155; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[165] = 53; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[166] = 153; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[167] = 149; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[168] = 152; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[169] = 227; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[170] = 150; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[171] = 87; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[172] = 112; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[173] = 165; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[174] = 2; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[175] = 128; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[176] = 231; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[177] = 25; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[178] = 157; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[179] = 244; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[180] = 204; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[181] = 108; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[182] = 253; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[183] = 127; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[184] = 122; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[185] = 145; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[186] = 113; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[187] = 162; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[188] = 197; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[189] = 171; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[190] = 199; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[191] = 54; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[192] = 184; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[193] = 222; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[194] = 206; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[195] = 67; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[196] = 144; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[197] = 78; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[198] = 187; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[199] = 207; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[200] = 60; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[201] = 211; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[202] = 141; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[203] = 135; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[204] = 106; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[205] = 220; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[206] = 79; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[207] = 183; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[208] = 245; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[209] = 21; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[210] = 161; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[211] = 168; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[212] = 34; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[213] = 129; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[214] = 50; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[215] = 176; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[216] = 1; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[217] = 218; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[218] = 20; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[219] = 130; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[220] = 59; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[221] = 249; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[222] = 109; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[223] = 219; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[224] = 0; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[225] = 100; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[226] = 103; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[227] = 55; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[228] = 29; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[229] = 242; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[230] = 110; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[231] = 154; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[232] = 190; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[233] = 233; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[234] = 142; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[235] = 45; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[236] = 61; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[237] = 215; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[238] = 202; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[239] = 238; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[240] = 88; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[241] = 209; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[242] = 70; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[243] = 63; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[244] = 151; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[245] = 27; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[246] = 102; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_id[0])); - } - test_msg->certificate_id[0] = 10; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_id[0])); - } - test_msg->certificate_id[1] = 11; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_id[0])); - } - test_msg->certificate_id[2] = 12; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_id[0])); - } - test_msg->certificate_id[3] = 13; - test_msg->flags = 2; - test_msg->n_msg = 48; - - EXPECT_EQ(send_message(0xC04, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ( - get_ascertificate_bytes[0])>( - reinterpret_cast(&last_msg_->certificate_bytes[0])), - 180) - << "incorrect value for certificate_bytes[0], expected 180, is " - << last_msg_->certificate_bytes[0]; - EXPECT_EQ( - get_ascertificate_bytes[1])>( - reinterpret_cast(&last_msg_->certificate_bytes[1])), - 160) - << "incorrect value for certificate_bytes[1], expected 160, is " - << last_msg_->certificate_bytes[1]; - EXPECT_EQ( - get_ascertificate_bytes[2])>( - reinterpret_cast(&last_msg_->certificate_bytes[2])), - 116) - << "incorrect value for certificate_bytes[2], expected 116, is " - << last_msg_->certificate_bytes[2]; - EXPECT_EQ( - get_ascertificate_bytes[3])>( - reinterpret_cast(&last_msg_->certificate_bytes[3])), - 77) - << "incorrect value for certificate_bytes[3], expected 77, is " - << last_msg_->certificate_bytes[3]; - EXPECT_EQ( - get_ascertificate_bytes[4])>( - reinterpret_cast(&last_msg_->certificate_bytes[4])), - 243) - << "incorrect value for certificate_bytes[4], expected 243, is " - << last_msg_->certificate_bytes[4]; - EXPECT_EQ( - get_ascertificate_bytes[5])>( - reinterpret_cast(&last_msg_->certificate_bytes[5])), - 28) - << "incorrect value for certificate_bytes[5], expected 28, is " - << last_msg_->certificate_bytes[5]; - EXPECT_EQ( - get_ascertificate_bytes[6])>( - reinterpret_cast(&last_msg_->certificate_bytes[6])), - 173) - << "incorrect value for certificate_bytes[6], expected 173, is " - << last_msg_->certificate_bytes[6]; - EXPECT_EQ( - get_ascertificate_bytes[7])>( - reinterpret_cast(&last_msg_->certificate_bytes[7])), - 36) - << "incorrect value for certificate_bytes[7], expected 36, is " - << last_msg_->certificate_bytes[7]; - EXPECT_EQ( - get_ascertificate_bytes[8])>( - reinterpret_cast(&last_msg_->certificate_bytes[8])), - 86) - << "incorrect value for certificate_bytes[8], expected 86, is " - << last_msg_->certificate_bytes[8]; - EXPECT_EQ( - get_ascertificate_bytes[9])>( - reinterpret_cast(&last_msg_->certificate_bytes[9])), - 33) - << "incorrect value for certificate_bytes[9], expected 33, is " - << last_msg_->certificate_bytes[9]; - EXPECT_EQ( - get_ascertificate_bytes[10])>( - reinterpret_cast(&last_msg_->certificate_bytes[10])), - 8) - << "incorrect value for certificate_bytes[10], expected 8, is " - << last_msg_->certificate_bytes[10]; - EXPECT_EQ( - get_ascertificate_bytes[11])>( - reinterpret_cast(&last_msg_->certificate_bytes[11])), - 31) - << "incorrect value for certificate_bytes[11], expected 31, is " - << last_msg_->certificate_bytes[11]; - EXPECT_EQ( - get_ascertificate_bytes[12])>( - reinterpret_cast(&last_msg_->certificate_bytes[12])), - 120) - << "incorrect value for certificate_bytes[12], expected 120, is " - << last_msg_->certificate_bytes[12]; - EXPECT_EQ( - get_ascertificate_bytes[13])>( - reinterpret_cast(&last_msg_->certificate_bytes[13])), - 73) - << "incorrect value for certificate_bytes[13], expected 73, is " - << last_msg_->certificate_bytes[13]; - EXPECT_EQ( - get_ascertificate_bytes[14])>( - reinterpret_cast(&last_msg_->certificate_bytes[14])), - 64) - << "incorrect value for certificate_bytes[14], expected 64, is " - << last_msg_->certificate_bytes[14]; - EXPECT_EQ( - get_ascertificate_bytes[15])>( - reinterpret_cast(&last_msg_->certificate_bytes[15])), - 169) - << "incorrect value for certificate_bytes[15], expected 169, is " - << last_msg_->certificate_bytes[15]; - EXPECT_EQ( - get_ascertificate_bytes[16])>( - reinterpret_cast(&last_msg_->certificate_bytes[16])), - 148) - << "incorrect value for certificate_bytes[16], expected 148, is " - << last_msg_->certificate_bytes[16]; - EXPECT_EQ( - get_ascertificate_bytes[17])>( - reinterpret_cast(&last_msg_->certificate_bytes[17])), - 224) - << "incorrect value for certificate_bytes[17], expected 224, is " - << last_msg_->certificate_bytes[17]; - EXPECT_EQ( - get_ascertificate_bytes[18])>( - reinterpret_cast(&last_msg_->certificate_bytes[18])), - 57) - << "incorrect value for certificate_bytes[18], expected 57, is " - << last_msg_->certificate_bytes[18]; - EXPECT_EQ( - get_ascertificate_bytes[19])>( - reinterpret_cast(&last_msg_->certificate_bytes[19])), - 95) - << "incorrect value for certificate_bytes[19], expected 95, is " - << last_msg_->certificate_bytes[19]; - EXPECT_EQ( - get_ascertificate_bytes[20])>( - reinterpret_cast(&last_msg_->certificate_bytes[20])), - 17) - << "incorrect value for certificate_bytes[20], expected 17, is " - << last_msg_->certificate_bytes[20]; - EXPECT_EQ( - get_ascertificate_bytes[21])>( - reinterpret_cast(&last_msg_->certificate_bytes[21])), - 40) - << "incorrect value for certificate_bytes[21], expected 40, is " - << last_msg_->certificate_bytes[21]; - EXPECT_EQ( - get_ascertificate_bytes[22])>( - reinterpret_cast(&last_msg_->certificate_bytes[22])), - 213) - << "incorrect value for certificate_bytes[22], expected 213, is " - << last_msg_->certificate_bytes[22]; - EXPECT_EQ( - get_ascertificate_bytes[23])>( - reinterpret_cast(&last_msg_->certificate_bytes[23])), - 92) - << "incorrect value for certificate_bytes[23], expected 92, is " - << last_msg_->certificate_bytes[23]; - EXPECT_EQ( - get_ascertificate_bytes[24])>( - reinterpret_cast(&last_msg_->certificate_bytes[24])), - 195) - << "incorrect value for certificate_bytes[24], expected 195, is " - << last_msg_->certificate_bytes[24]; - EXPECT_EQ( - get_ascertificate_bytes[25])>( - reinterpret_cast(&last_msg_->certificate_bytes[25])), - 146) - << "incorrect value for certificate_bytes[25], expected 146, is " - << last_msg_->certificate_bytes[25]; - EXPECT_EQ( - get_ascertificate_bytes[26])>( - reinterpret_cast(&last_msg_->certificate_bytes[26])), - 235) - << "incorrect value for certificate_bytes[26], expected 235, is " - << last_msg_->certificate_bytes[26]; - EXPECT_EQ( - get_ascertificate_bytes[27])>( - reinterpret_cast(&last_msg_->certificate_bytes[27])), - 228) - << "incorrect value for certificate_bytes[27], expected 228, is " - << last_msg_->certificate_bytes[27]; - EXPECT_EQ( - get_ascertificate_bytes[28])>( - reinterpret_cast(&last_msg_->certificate_bytes[28])), - 177) - << "incorrect value for certificate_bytes[28], expected 177, is " - << last_msg_->certificate_bytes[28]; - EXPECT_EQ( - get_ascertificate_bytes[29])>( - reinterpret_cast(&last_msg_->certificate_bytes[29])), - 101) - << "incorrect value for certificate_bytes[29], expected 101, is " - << last_msg_->certificate_bytes[29]; - EXPECT_EQ( - get_ascertificate_bytes[30])>( - reinterpret_cast(&last_msg_->certificate_bytes[30])), - 82) - << "incorrect value for certificate_bytes[30], expected 82, is " - << last_msg_->certificate_bytes[30]; - EXPECT_EQ( - get_ascertificate_bytes[31])>( - reinterpret_cast(&last_msg_->certificate_bytes[31])), - 182) - << "incorrect value for certificate_bytes[31], expected 182, is " - << last_msg_->certificate_bytes[31]; - EXPECT_EQ( - get_ascertificate_bytes[32])>( - reinterpret_cast(&last_msg_->certificate_bytes[32])), - 25) - << "incorrect value for certificate_bytes[32], expected 25, is " - << last_msg_->certificate_bytes[32]; - EXPECT_EQ( - get_ascertificate_bytes[33])>( - reinterpret_cast(&last_msg_->certificate_bytes[33])), - 172) - << "incorrect value for certificate_bytes[33], expected 172, is " - << last_msg_->certificate_bytes[33]; - EXPECT_EQ( - get_ascertificate_bytes[34])>( - reinterpret_cast(&last_msg_->certificate_bytes[34])), - 170) - << "incorrect value for certificate_bytes[34], expected 170, is " - << last_msg_->certificate_bytes[34]; - EXPECT_EQ( - get_ascertificate_bytes[35])>( - reinterpret_cast(&last_msg_->certificate_bytes[35])), - 250) - << "incorrect value for certificate_bytes[35], expected 250, is " - << last_msg_->certificate_bytes[35]; - EXPECT_EQ( - get_ascertificate_bytes[36])>( - reinterpret_cast(&last_msg_->certificate_bytes[36])), - 236) - << "incorrect value for certificate_bytes[36], expected 236, is " - << last_msg_->certificate_bytes[36]; - EXPECT_EQ( - get_ascertificate_bytes[37])>( - reinterpret_cast(&last_msg_->certificate_bytes[37])), - 7) - << "incorrect value for certificate_bytes[37], expected 7, is " - << last_msg_->certificate_bytes[37]; - EXPECT_EQ( - get_ascertificate_bytes[38])>( - reinterpret_cast(&last_msg_->certificate_bytes[38])), - 119) - << "incorrect value for certificate_bytes[38], expected 119, is " - << last_msg_->certificate_bytes[38]; - EXPECT_EQ( - get_ascertificate_bytes[39])>( - reinterpret_cast(&last_msg_->certificate_bytes[39])), - 4) - << "incorrect value for certificate_bytes[39], expected 4, is " - << last_msg_->certificate_bytes[39]; - EXPECT_EQ( - get_ascertificate_bytes[40])>( - reinterpret_cast(&last_msg_->certificate_bytes[40])), - 201) - << "incorrect value for certificate_bytes[40], expected 201, is " - << last_msg_->certificate_bytes[40]; - EXPECT_EQ( - get_ascertificate_bytes[41])>( - reinterpret_cast(&last_msg_->certificate_bytes[41])), - 10) - << "incorrect value for certificate_bytes[41], expected 10, is " - << last_msg_->certificate_bytes[41]; - EXPECT_EQ( - get_ascertificate_bytes[42])>( - reinterpret_cast(&last_msg_->certificate_bytes[42])), - 14) - << "incorrect value for certificate_bytes[42], expected 14, is " - << last_msg_->certificate_bytes[42]; - EXPECT_EQ( - get_ascertificate_bytes[43])>( - reinterpret_cast(&last_msg_->certificate_bytes[43])), - 208) - << "incorrect value for certificate_bytes[43], expected 208, is " - << last_msg_->certificate_bytes[43]; - EXPECT_EQ( - get_ascertificate_bytes[44])>( - reinterpret_cast(&last_msg_->certificate_bytes[44])), - 47) - << "incorrect value for certificate_bytes[44], expected 47, is " - << last_msg_->certificate_bytes[44]; - EXPECT_EQ( - get_ascertificate_bytes[45])>( - reinterpret_cast(&last_msg_->certificate_bytes[45])), - 126) - << "incorrect value for certificate_bytes[45], expected 126, is " - << last_msg_->certificate_bytes[45]; - EXPECT_EQ( - get_ascertificate_bytes[46])>( - reinterpret_cast(&last_msg_->certificate_bytes[46])), - 49) - << "incorrect value for certificate_bytes[46], expected 49, is " - << last_msg_->certificate_bytes[46]; - EXPECT_EQ( - get_ascertificate_bytes[47])>( - reinterpret_cast(&last_msg_->certificate_bytes[47])), - 210) - << "incorrect value for certificate_bytes[47], expected 210, is " - << last_msg_->certificate_bytes[47]; - EXPECT_EQ( - get_ascertificate_bytes[48])>( - reinterpret_cast(&last_msg_->certificate_bytes[48])), - 174) - << "incorrect value for certificate_bytes[48], expected 174, is " - << last_msg_->certificate_bytes[48]; - EXPECT_EQ( - get_ascertificate_bytes[49])>( - reinterpret_cast(&last_msg_->certificate_bytes[49])), - 75) - << "incorrect value for certificate_bytes[49], expected 75, is " - << last_msg_->certificate_bytes[49]; - EXPECT_EQ( - get_ascertificate_bytes[50])>( - reinterpret_cast(&last_msg_->certificate_bytes[50])), - 221) - << "incorrect value for certificate_bytes[50], expected 221, is " - << last_msg_->certificate_bytes[50]; - EXPECT_EQ( - get_ascertificate_bytes[51])>( - reinterpret_cast(&last_msg_->certificate_bytes[51])), - 203) - << "incorrect value for certificate_bytes[51], expected 203, is " - << last_msg_->certificate_bytes[51]; - EXPECT_EQ( - get_ascertificate_bytes[52])>( - reinterpret_cast(&last_msg_->certificate_bytes[52])), - 24) - << "incorrect value for certificate_bytes[52], expected 24, is " - << last_msg_->certificate_bytes[52]; - EXPECT_EQ( - get_ascertificate_bytes[53])>( - reinterpret_cast(&last_msg_->certificate_bytes[53])), - 66) - << "incorrect value for certificate_bytes[53], expected 66, is " - << last_msg_->certificate_bytes[53]; - EXPECT_EQ( - get_ascertificate_bytes[54])>( - reinterpret_cast(&last_msg_->certificate_bytes[54])), - 52) - << "incorrect value for certificate_bytes[54], expected 52, is " - << last_msg_->certificate_bytes[54]; - EXPECT_EQ( - get_ascertificate_bytes[55])>( - reinterpret_cast(&last_msg_->certificate_bytes[55])), - 35) - << "incorrect value for certificate_bytes[55], expected 35, is " - << last_msg_->certificate_bytes[55]; - EXPECT_EQ( - get_ascertificate_bytes[56])>( - reinterpret_cast(&last_msg_->certificate_bytes[56])), - 26) - << "incorrect value for certificate_bytes[56], expected 26, is " - << last_msg_->certificate_bytes[56]; - EXPECT_EQ( - get_ascertificate_bytes[57])>( - reinterpret_cast(&last_msg_->certificate_bytes[57])), - 30) - << "incorrect value for certificate_bytes[57], expected 30, is " - << last_msg_->certificate_bytes[57]; - EXPECT_EQ( - get_ascertificate_bytes[58])>( - reinterpret_cast(&last_msg_->certificate_bytes[58])), - 140) - << "incorrect value for certificate_bytes[58], expected 140, is " - << last_msg_->certificate_bytes[58]; - EXPECT_EQ( - get_ascertificate_bytes[59])>( - reinterpret_cast(&last_msg_->certificate_bytes[59])), - 111) - << "incorrect value for certificate_bytes[59], expected 111, is " - << last_msg_->certificate_bytes[59]; - EXPECT_EQ( - get_ascertificate_bytes[60])>( - reinterpret_cast(&last_msg_->certificate_bytes[60])), - 246) - << "incorrect value for certificate_bytes[60], expected 246, is " - << last_msg_->certificate_bytes[60]; - EXPECT_EQ( - get_ascertificate_bytes[61])>( - reinterpret_cast(&last_msg_->certificate_bytes[61])), - 39) - << "incorrect value for certificate_bytes[61], expected 39, is " - << last_msg_->certificate_bytes[61]; - EXPECT_EQ( - get_ascertificate_bytes[62])>( - reinterpret_cast(&last_msg_->certificate_bytes[62])), - 226) - << "incorrect value for certificate_bytes[62], expected 226, is " - << last_msg_->certificate_bytes[62]; - EXPECT_EQ( - get_ascertificate_bytes[63])>( - reinterpret_cast(&last_msg_->certificate_bytes[63])), - 205) - << "incorrect value for certificate_bytes[63], expected 205, is " - << last_msg_->certificate_bytes[63]; - EXPECT_EQ( - get_ascertificate_bytes[64])>( - reinterpret_cast(&last_msg_->certificate_bytes[64])), - 198) - << "incorrect value for certificate_bytes[64], expected 198, is " - << last_msg_->certificate_bytes[64]; - EXPECT_EQ( - get_ascertificate_bytes[65])>( - reinterpret_cast(&last_msg_->certificate_bytes[65])), - 178) - << "incorrect value for certificate_bytes[65], expected 178, is " - << last_msg_->certificate_bytes[65]; - EXPECT_EQ( - get_ascertificate_bytes[66])>( - reinterpret_cast(&last_msg_->certificate_bytes[66])), - 196) - << "incorrect value for certificate_bytes[66], expected 196, is " - << last_msg_->certificate_bytes[66]; - EXPECT_EQ( - get_ascertificate_bytes[67])>( - reinterpret_cast(&last_msg_->certificate_bytes[67])), - 5) - << "incorrect value for certificate_bytes[67], expected 5, is " - << last_msg_->certificate_bytes[67]; - EXPECT_EQ( - get_ascertificate_bytes[68])>( - reinterpret_cast(&last_msg_->certificate_bytes[68])), - 81) - << "incorrect value for certificate_bytes[68], expected 81, is " - << last_msg_->certificate_bytes[68]; - EXPECT_EQ( - get_ascertificate_bytes[69])>( - reinterpret_cast(&last_msg_->certificate_bytes[69])), - 9) - << "incorrect value for certificate_bytes[69], expected 9, is " - << last_msg_->certificate_bytes[69]; - EXPECT_EQ( - get_ascertificate_bytes[70])>( - reinterpret_cast(&last_msg_->certificate_bytes[70])), - 44) - << "incorrect value for certificate_bytes[70], expected 44, is " - << last_msg_->certificate_bytes[70]; - EXPECT_EQ( - get_ascertificate_bytes[71])>( - reinterpret_cast(&last_msg_->certificate_bytes[71])), - 164) - << "incorrect value for certificate_bytes[71], expected 164, is " - << last_msg_->certificate_bytes[71]; - EXPECT_EQ( - get_ascertificate_bytes[72])>( - reinterpret_cast(&last_msg_->certificate_bytes[72])), - 163) - << "incorrect value for certificate_bytes[72], expected 163, is " - << last_msg_->certificate_bytes[72]; - EXPECT_EQ( - get_ascertificate_bytes[73])>( - reinterpret_cast(&last_msg_->certificate_bytes[73])), - 214) - << "incorrect value for certificate_bytes[73], expected 214, is " - << last_msg_->certificate_bytes[73]; - EXPECT_EQ( - get_ascertificate_bytes[74])>( - reinterpret_cast(&last_msg_->certificate_bytes[74])), - 138) - << "incorrect value for certificate_bytes[74], expected 138, is " - << last_msg_->certificate_bytes[74]; - EXPECT_EQ( - get_ascertificate_bytes[75])>( - reinterpret_cast(&last_msg_->certificate_bytes[75])), - 123) - << "incorrect value for certificate_bytes[75], expected 123, is " - << last_msg_->certificate_bytes[75]; - EXPECT_EQ( - get_ascertificate_bytes[76])>( - reinterpret_cast(&last_msg_->certificate_bytes[76])), - 76) - << "incorrect value for certificate_bytes[76], expected 76, is " - << last_msg_->certificate_bytes[76]; - EXPECT_EQ( - get_ascertificate_bytes[77])>( - reinterpret_cast(&last_msg_->certificate_bytes[77])), - 74) - << "incorrect value for certificate_bytes[77], expected 74, is " - << last_msg_->certificate_bytes[77]; - EXPECT_EQ( - get_ascertificate_bytes[78])>( - reinterpret_cast(&last_msg_->certificate_bytes[78])), - 237) - << "incorrect value for certificate_bytes[78], expected 237, is " - << last_msg_->certificate_bytes[78]; - EXPECT_EQ( - get_ascertificate_bytes[79])>( - reinterpret_cast(&last_msg_->certificate_bytes[79])), - 121) - << "incorrect value for certificate_bytes[79], expected 121, is " - << last_msg_->certificate_bytes[79]; - EXPECT_EQ( - get_ascertificate_bytes[80])>( - reinterpret_cast(&last_msg_->certificate_bytes[80])), - 13) - << "incorrect value for certificate_bytes[80], expected 13, is " - << last_msg_->certificate_bytes[80]; - EXPECT_EQ( - get_ascertificate_bytes[81])>( - reinterpret_cast(&last_msg_->certificate_bytes[81])), - 137) - << "incorrect value for certificate_bytes[81], expected 137, is " - << last_msg_->certificate_bytes[81]; - EXPECT_EQ( - get_ascertificate_bytes[82])>( - reinterpret_cast(&last_msg_->certificate_bytes[82])), - 186) - << "incorrect value for certificate_bytes[82], expected 186, is " - << last_msg_->certificate_bytes[82]; - EXPECT_EQ( - get_ascertificate_bytes[83])>( - reinterpret_cast(&last_msg_->certificate_bytes[83])), - 97) - << "incorrect value for certificate_bytes[83], expected 97, is " - << last_msg_->certificate_bytes[83]; - EXPECT_EQ( - get_ascertificate_bytes[84])>( - reinterpret_cast(&last_msg_->certificate_bytes[84])), - 193) - << "incorrect value for certificate_bytes[84], expected 193, is " - << last_msg_->certificate_bytes[84]; - EXPECT_EQ( - get_ascertificate_bytes[85])>( - reinterpret_cast(&last_msg_->certificate_bytes[85])), - 189) - << "incorrect value for certificate_bytes[85], expected 189, is " - << last_msg_->certificate_bytes[85]; - EXPECT_EQ( - get_ascertificate_bytes[86])>( - reinterpret_cast(&last_msg_->certificate_bytes[86])), - 200) - << "incorrect value for certificate_bytes[86], expected 200, is " - << last_msg_->certificate_bytes[86]; - EXPECT_EQ( - get_ascertificate_bytes[87])>( - reinterpret_cast(&last_msg_->certificate_bytes[87])), - 124) - << "incorrect value for certificate_bytes[87], expected 124, is " - << last_msg_->certificate_bytes[87]; - EXPECT_EQ( - get_ascertificate_bytes[88])>( - reinterpret_cast(&last_msg_->certificate_bytes[88])), - 69) - << "incorrect value for certificate_bytes[88], expected 69, is " - << last_msg_->certificate_bytes[88]; - EXPECT_EQ( - get_ascertificate_bytes[89])>( - reinterpret_cast(&last_msg_->certificate_bytes[89])), - 115) - << "incorrect value for certificate_bytes[89], expected 115, is " - << last_msg_->certificate_bytes[89]; - EXPECT_EQ( - get_ascertificate_bytes[90])>( - reinterpret_cast(&last_msg_->certificate_bytes[90])), - 230) - << "incorrect value for certificate_bytes[90], expected 230, is " - << last_msg_->certificate_bytes[90]; - EXPECT_EQ( - get_ascertificate_bytes[91])>( - reinterpret_cast(&last_msg_->certificate_bytes[91])), - 159) - << "incorrect value for certificate_bytes[91], expected 159, is " - << last_msg_->certificate_bytes[91]; - EXPECT_EQ( - get_ascertificate_bytes[92])>( - reinterpret_cast(&last_msg_->certificate_bytes[92])), - 185) - << "incorrect value for certificate_bytes[92], expected 185, is " - << last_msg_->certificate_bytes[92]; - EXPECT_EQ( - get_ascertificate_bytes[93])>( - reinterpret_cast(&last_msg_->certificate_bytes[93])), - 158) - << "incorrect value for certificate_bytes[93], expected 158, is " - << last_msg_->certificate_bytes[93]; - EXPECT_EQ( - get_ascertificate_bytes[94])>( - reinterpret_cast(&last_msg_->certificate_bytes[94])), - 51) - << "incorrect value for certificate_bytes[94], expected 51, is " - << last_msg_->certificate_bytes[94]; - EXPECT_EQ( - get_ascertificate_bytes[95])>( - reinterpret_cast(&last_msg_->certificate_bytes[95])), - 12) - << "incorrect value for certificate_bytes[95], expected 12, is " - << last_msg_->certificate_bytes[95]; - EXPECT_EQ( - get_ascertificate_bytes[96])>( - reinterpret_cast(&last_msg_->certificate_bytes[96])), - 225) - << "incorrect value for certificate_bytes[96], expected 225, is " - << last_msg_->certificate_bytes[96]; - EXPECT_EQ( - get_ascertificate_bytes[97])>( - reinterpret_cast(&last_msg_->certificate_bytes[97])), - 65) - << "incorrect value for certificate_bytes[97], expected 65, is " - << last_msg_->certificate_bytes[97]; - EXPECT_EQ( - get_ascertificate_bytes[98])>( - reinterpret_cast(&last_msg_->certificate_bytes[98])), - 192) - << "incorrect value for certificate_bytes[98], expected 192, is " - << last_msg_->certificate_bytes[98]; - EXPECT_EQ( - get_ascertificate_bytes[99])>( - reinterpret_cast(&last_msg_->certificate_bytes[99])), - 105) - << "incorrect value for certificate_bytes[99], expected 105, is " - << last_msg_->certificate_bytes[99]; - EXPECT_EQ(get_ascertificate_bytes[100])>( - reinterpret_cast( - &last_msg_->certificate_bytes[100])), - 56) - << "incorrect value for certificate_bytes[100], expected 56, is " - << last_msg_->certificate_bytes[100]; - EXPECT_EQ(get_ascertificate_bytes[101])>( - reinterpret_cast( - &last_msg_->certificate_bytes[101])), - 41) - << "incorrect value for certificate_bytes[101], expected 41, is " - << last_msg_->certificate_bytes[101]; - EXPECT_EQ(get_ascertificate_bytes[102])>( - reinterpret_cast( - &last_msg_->certificate_bytes[102])), - 85) - << "incorrect value for certificate_bytes[102], expected 85, is " - << last_msg_->certificate_bytes[102]; - EXPECT_EQ(get_ascertificate_bytes[103])>( - reinterpret_cast( - &last_msg_->certificate_bytes[103])), - 133) - << "incorrect value for certificate_bytes[103], expected 133, is " - << last_msg_->certificate_bytes[103]; - EXPECT_EQ(get_ascertificate_bytes[104])>( - reinterpret_cast( - &last_msg_->certificate_bytes[104])), - 19) - << "incorrect value for certificate_bytes[104], expected 19, is " - << last_msg_->certificate_bytes[104]; - EXPECT_EQ(get_ascertificate_bytes[105])>( - reinterpret_cast( - &last_msg_->certificate_bytes[105])), - 217) - << "incorrect value for certificate_bytes[105], expected 217, is " - << last_msg_->certificate_bytes[105]; - EXPECT_EQ(get_ascertificate_bytes[106])>( - reinterpret_cast( - &last_msg_->certificate_bytes[106])), - 166) - << "incorrect value for certificate_bytes[106], expected 166, is " - << last_msg_->certificate_bytes[106]; - EXPECT_EQ(get_ascertificate_bytes[107])>( - reinterpret_cast( - &last_msg_->certificate_bytes[107])), - 48) - << "incorrect value for certificate_bytes[107], expected 48, is " - << last_msg_->certificate_bytes[107]; - EXPECT_EQ(get_ascertificate_bytes[108])>( - reinterpret_cast( - &last_msg_->certificate_bytes[108])), - 139) - << "incorrect value for certificate_bytes[108], expected 139, is " - << last_msg_->certificate_bytes[108]; - EXPECT_EQ(get_ascertificate_bytes[109])>( - reinterpret_cast( - &last_msg_->certificate_bytes[109])), - 131) - << "incorrect value for certificate_bytes[109], expected 131, is " - << last_msg_->certificate_bytes[109]; - EXPECT_EQ(get_ascertificate_bytes[110])>( - reinterpret_cast( - &last_msg_->certificate_bytes[110])), - 96) - << "incorrect value for certificate_bytes[110], expected 96, is " - << last_msg_->certificate_bytes[110]; - EXPECT_EQ(get_ascertificate_bytes[111])>( - reinterpret_cast( - &last_msg_->certificate_bytes[111])), - 216) - << "incorrect value for certificate_bytes[111], expected 216, is " - << last_msg_->certificate_bytes[111]; - EXPECT_EQ(get_ascertificate_bytes[112])>( - reinterpret_cast( - &last_msg_->certificate_bytes[112])), - 98) - << "incorrect value for certificate_bytes[112], expected 98, is " - << last_msg_->certificate_bytes[112]; - EXPECT_EQ(get_ascertificate_bytes[113])>( - reinterpret_cast( - &last_msg_->certificate_bytes[113])), - 147) - << "incorrect value for certificate_bytes[113], expected 147, is " - << last_msg_->certificate_bytes[113]; - EXPECT_EQ(get_ascertificate_bytes[114])>( - reinterpret_cast( - &last_msg_->certificate_bytes[114])), - 132) - << "incorrect value for certificate_bytes[114], expected 132, is " - << last_msg_->certificate_bytes[114]; - EXPECT_EQ(get_ascertificate_bytes[115])>( - reinterpret_cast( - &last_msg_->certificate_bytes[115])), - 234) - << "incorrect value for certificate_bytes[115], expected 234, is " - << last_msg_->certificate_bytes[115]; - EXPECT_EQ(get_ascertificate_bytes[116])>( - reinterpret_cast( - &last_msg_->certificate_bytes[116])), - 167) - << "incorrect value for certificate_bytes[116], expected 167, is " - << last_msg_->certificate_bytes[116]; - EXPECT_EQ(get_ascertificate_bytes[117])>( - reinterpret_cast( - &last_msg_->certificate_bytes[117])), - 248) - << "incorrect value for certificate_bytes[117], expected 248, is " - << last_msg_->certificate_bytes[117]; - EXPECT_EQ(get_ascertificate_bytes[118])>( - reinterpret_cast( - &last_msg_->certificate_bytes[118])), - 247) - << "incorrect value for certificate_bytes[118], expected 247, is " - << last_msg_->certificate_bytes[118]; - EXPECT_EQ(get_ascertificate_bytes[119])>( - reinterpret_cast( - &last_msg_->certificate_bytes[119])), - 32) - << "incorrect value for certificate_bytes[119], expected 32, is " - << last_msg_->certificate_bytes[119]; - EXPECT_EQ(get_ascertificate_bytes[120])>( - reinterpret_cast( - &last_msg_->certificate_bytes[120])), - 239) - << "incorrect value for certificate_bytes[120], expected 239, is " - << last_msg_->certificate_bytes[120]; - EXPECT_EQ(get_ascertificate_bytes[121])>( - reinterpret_cast( - &last_msg_->certificate_bytes[121])), - 194) - << "incorrect value for certificate_bytes[121], expected 194, is " - << last_msg_->certificate_bytes[121]; - EXPECT_EQ(get_ascertificate_bytes[122])>( - reinterpret_cast( - &last_msg_->certificate_bytes[122])), - 188) - << "incorrect value for certificate_bytes[122], expected 188, is " - << last_msg_->certificate_bytes[122]; - EXPECT_EQ(get_ascertificate_bytes[123])>( - reinterpret_cast( - &last_msg_->certificate_bytes[123])), - 254) - << "incorrect value for certificate_bytes[123], expected 254, is " - << last_msg_->certificate_bytes[123]; - EXPECT_EQ(get_ascertificate_bytes[124])>( - reinterpret_cast( - &last_msg_->certificate_bytes[124])), - 114) - << "incorrect value for certificate_bytes[124], expected 114, is " - << last_msg_->certificate_bytes[124]; - EXPECT_EQ(get_ascertificate_bytes[125])>( - reinterpret_cast( - &last_msg_->certificate_bytes[125])), - 117) - << "incorrect value for certificate_bytes[125], expected 117, is " - << last_msg_->certificate_bytes[125]; - EXPECT_EQ(get_ascertificate_bytes[126])>( - reinterpret_cast( - &last_msg_->certificate_bytes[126])), - 83) - << "incorrect value for certificate_bytes[126], expected 83, is " - << last_msg_->certificate_bytes[126]; - EXPECT_EQ(get_ascertificate_bytes[127])>( - reinterpret_cast( - &last_msg_->certificate_bytes[127])), - 25) - << "incorrect value for certificate_bytes[127], expected 25, is " - << last_msg_->certificate_bytes[127]; - EXPECT_EQ(get_ascertificate_bytes[128])>( - reinterpret_cast( - &last_msg_->certificate_bytes[128])), - 251) - << "incorrect value for certificate_bytes[128], expected 251, is " - << last_msg_->certificate_bytes[128]; - EXPECT_EQ(get_ascertificate_bytes[129])>( - reinterpret_cast( - &last_msg_->certificate_bytes[129])), - 191) - << "incorrect value for certificate_bytes[129], expected 191, is " - << last_msg_->certificate_bytes[129]; - EXPECT_EQ(get_ascertificate_bytes[130])>( - reinterpret_cast( - &last_msg_->certificate_bytes[130])), - 104) - << "incorrect value for certificate_bytes[130], expected 104, is " - << last_msg_->certificate_bytes[130]; - EXPECT_EQ(get_ascertificate_bytes[131])>( - reinterpret_cast( - &last_msg_->certificate_bytes[131])), - 240) - << "incorrect value for certificate_bytes[131], expected 240, is " - << last_msg_->certificate_bytes[131]; - EXPECT_EQ(get_ascertificate_bytes[132])>( - reinterpret_cast( - &last_msg_->certificate_bytes[132])), - 118) - << "incorrect value for certificate_bytes[132], expected 118, is " - << last_msg_->certificate_bytes[132]; - EXPECT_EQ(get_ascertificate_bytes[133])>( - reinterpret_cast( - &last_msg_->certificate_bytes[133])), - 68) - << "incorrect value for certificate_bytes[133], expected 68, is " - << last_msg_->certificate_bytes[133]; - EXPECT_EQ(get_ascertificate_bytes[134])>( - reinterpret_cast( - &last_msg_->certificate_bytes[134])), - 42) - << "incorrect value for certificate_bytes[134], expected 42, is " - << last_msg_->certificate_bytes[134]; - EXPECT_EQ(get_ascertificate_bytes[135])>( - reinterpret_cast( - &last_msg_->certificate_bytes[135])), - 93) - << "incorrect value for certificate_bytes[135], expected 93, is " - << last_msg_->certificate_bytes[135]; - EXPECT_EQ(get_ascertificate_bytes[136])>( - reinterpret_cast( - &last_msg_->certificate_bytes[136])), - 18) - << "incorrect value for certificate_bytes[136], expected 18, is " - << last_msg_->certificate_bytes[136]; - EXPECT_EQ(get_ascertificate_bytes[137])>( - reinterpret_cast( - &last_msg_->certificate_bytes[137])), - 16) - << "incorrect value for certificate_bytes[137], expected 16, is " - << last_msg_->certificate_bytes[137]; - EXPECT_EQ(get_ascertificate_bytes[138])>( - reinterpret_cast( - &last_msg_->certificate_bytes[138])), - 37) - << "incorrect value for certificate_bytes[138], expected 37, is " - << last_msg_->certificate_bytes[138]; - EXPECT_EQ(get_ascertificate_bytes[139])>( - reinterpret_cast( - &last_msg_->certificate_bytes[139])), - 232) - << "incorrect value for certificate_bytes[139], expected 232, is " - << last_msg_->certificate_bytes[139]; - EXPECT_EQ(get_ascertificate_bytes[140])>( - reinterpret_cast( - &last_msg_->certificate_bytes[140])), - 99) - << "incorrect value for certificate_bytes[140], expected 99, is " - << last_msg_->certificate_bytes[140]; - EXPECT_EQ(get_ascertificate_bytes[141])>( - reinterpret_cast( - &last_msg_->certificate_bytes[141])), - 179) - << "incorrect value for certificate_bytes[141], expected 179, is " - << last_msg_->certificate_bytes[141]; - EXPECT_EQ(get_ascertificate_bytes[142])>( - reinterpret_cast( - &last_msg_->certificate_bytes[142])), - 23) - << "incorrect value for certificate_bytes[142], expected 23, is " - << last_msg_->certificate_bytes[142]; - EXPECT_EQ(get_ascertificate_bytes[143])>( - reinterpret_cast( - &last_msg_->certificate_bytes[143])), - 90) - << "incorrect value for certificate_bytes[143], expected 90, is " - << last_msg_->certificate_bytes[143]; - EXPECT_EQ(get_ascertificate_bytes[144])>( - reinterpret_cast( - &last_msg_->certificate_bytes[144])), - 94) - << "incorrect value for certificate_bytes[144], expected 94, is " - << last_msg_->certificate_bytes[144]; - EXPECT_EQ(get_ascertificate_bytes[145])>( - reinterpret_cast( - &last_msg_->certificate_bytes[145])), - 136) - << "incorrect value for certificate_bytes[145], expected 136, is " - << last_msg_->certificate_bytes[145]; - EXPECT_EQ(get_ascertificate_bytes[146])>( - reinterpret_cast( - &last_msg_->certificate_bytes[146])), - 6) - << "incorrect value for certificate_bytes[146], expected 6, is " - << last_msg_->certificate_bytes[146]; - EXPECT_EQ(get_ascertificate_bytes[147])>( - reinterpret_cast( - &last_msg_->certificate_bytes[147])), - 125) - << "incorrect value for certificate_bytes[147], expected 125, is " - << last_msg_->certificate_bytes[147]; - EXPECT_EQ(get_ascertificate_bytes[148])>( - reinterpret_cast( - &last_msg_->certificate_bytes[148])), - 91) - << "incorrect value for certificate_bytes[148], expected 91, is " - << last_msg_->certificate_bytes[148]; - EXPECT_EQ(get_ascertificate_bytes[149])>( - reinterpret_cast( - &last_msg_->certificate_bytes[149])), - 255) - << "incorrect value for certificate_bytes[149], expected 255, is " - << last_msg_->certificate_bytes[149]; - EXPECT_EQ(get_ascertificate_bytes[150])>( - reinterpret_cast( - &last_msg_->certificate_bytes[150])), - 15) - << "incorrect value for certificate_bytes[150], expected 15, is " - << last_msg_->certificate_bytes[150]; - EXPECT_EQ(get_ascertificate_bytes[151])>( - reinterpret_cast( - &last_msg_->certificate_bytes[151])), - 71) - << "incorrect value for certificate_bytes[151], expected 71, is " - << last_msg_->certificate_bytes[151]; - EXPECT_EQ(get_ascertificate_bytes[152])>( - reinterpret_cast( - &last_msg_->certificate_bytes[152])), - 43) - << "incorrect value for certificate_bytes[152], expected 43, is " - << last_msg_->certificate_bytes[152]; - EXPECT_EQ(get_ascertificate_bytes[153])>( - reinterpret_cast( - &last_msg_->certificate_bytes[153])), - 46) - << "incorrect value for certificate_bytes[153], expected 46, is " - << last_msg_->certificate_bytes[153]; - EXPECT_EQ(get_ascertificate_bytes[154])>( - reinterpret_cast( - &last_msg_->certificate_bytes[154])), - 25) - << "incorrect value for certificate_bytes[154], expected 25, is " - << last_msg_->certificate_bytes[154]; - EXPECT_EQ(get_ascertificate_bytes[155])>( - reinterpret_cast( - &last_msg_->certificate_bytes[155])), - 252) - << "incorrect value for certificate_bytes[155], expected 252, is " - << last_msg_->certificate_bytes[155]; - EXPECT_EQ(get_ascertificate_bytes[156])>( - reinterpret_cast( - &last_msg_->certificate_bytes[156])), - 229) - << "incorrect value for certificate_bytes[156], expected 229, is " - << last_msg_->certificate_bytes[156]; - EXPECT_EQ(get_ascertificate_bytes[157])>( - reinterpret_cast( - &last_msg_->certificate_bytes[157])), - 80) - << "incorrect value for certificate_bytes[157], expected 80, is " - << last_msg_->certificate_bytes[157]; - EXPECT_EQ(get_ascertificate_bytes[158])>( - reinterpret_cast( - &last_msg_->certificate_bytes[158])), - 143) - << "incorrect value for certificate_bytes[158], expected 143, is " - << last_msg_->certificate_bytes[158]; - EXPECT_EQ(get_ascertificate_bytes[159])>( - reinterpret_cast( - &last_msg_->certificate_bytes[159])), - 58) - << "incorrect value for certificate_bytes[159], expected 58, is " - << last_msg_->certificate_bytes[159]; - EXPECT_EQ(get_ascertificate_bytes[160])>( - reinterpret_cast( - &last_msg_->certificate_bytes[160])), - 241) - << "incorrect value for certificate_bytes[160], expected 241, is " - << last_msg_->certificate_bytes[160]; - EXPECT_EQ(get_ascertificate_bytes[161])>( - reinterpret_cast( - &last_msg_->certificate_bytes[161])), - 11) - << "incorrect value for certificate_bytes[161], expected 11, is " - << last_msg_->certificate_bytes[161]; - EXPECT_EQ(get_ascertificate_bytes[162])>( - reinterpret_cast( - &last_msg_->certificate_bytes[162])), - 62) - << "incorrect value for certificate_bytes[162], expected 62, is " - << last_msg_->certificate_bytes[162]; - EXPECT_EQ(get_ascertificate_bytes[163])>( - reinterpret_cast( - &last_msg_->certificate_bytes[163])), - 181) - << "incorrect value for certificate_bytes[163], expected 181, is " - << last_msg_->certificate_bytes[163]; - EXPECT_EQ(get_ascertificate_bytes[164])>( - reinterpret_cast( - &last_msg_->certificate_bytes[164])), - 155) - << "incorrect value for certificate_bytes[164], expected 155, is " - << last_msg_->certificate_bytes[164]; - EXPECT_EQ(get_ascertificate_bytes[165])>( - reinterpret_cast( - &last_msg_->certificate_bytes[165])), - 53) - << "incorrect value for certificate_bytes[165], expected 53, is " - << last_msg_->certificate_bytes[165]; - EXPECT_EQ(get_ascertificate_bytes[166])>( - reinterpret_cast( - &last_msg_->certificate_bytes[166])), - 153) - << "incorrect value for certificate_bytes[166], expected 153, is " - << last_msg_->certificate_bytes[166]; - EXPECT_EQ(get_ascertificate_bytes[167])>( - reinterpret_cast( - &last_msg_->certificate_bytes[167])), - 149) - << "incorrect value for certificate_bytes[167], expected 149, is " - << last_msg_->certificate_bytes[167]; - EXPECT_EQ(get_ascertificate_bytes[168])>( - reinterpret_cast( - &last_msg_->certificate_bytes[168])), - 152) - << "incorrect value for certificate_bytes[168], expected 152, is " - << last_msg_->certificate_bytes[168]; - EXPECT_EQ(get_ascertificate_bytes[169])>( - reinterpret_cast( - &last_msg_->certificate_bytes[169])), - 227) - << "incorrect value for certificate_bytes[169], expected 227, is " - << last_msg_->certificate_bytes[169]; - EXPECT_EQ(get_ascertificate_bytes[170])>( - reinterpret_cast( - &last_msg_->certificate_bytes[170])), - 150) - << "incorrect value for certificate_bytes[170], expected 150, is " - << last_msg_->certificate_bytes[170]; - EXPECT_EQ(get_ascertificate_bytes[171])>( - reinterpret_cast( - &last_msg_->certificate_bytes[171])), - 87) - << "incorrect value for certificate_bytes[171], expected 87, is " - << last_msg_->certificate_bytes[171]; - EXPECT_EQ(get_ascertificate_bytes[172])>( - reinterpret_cast( - &last_msg_->certificate_bytes[172])), - 112) - << "incorrect value for certificate_bytes[172], expected 112, is " - << last_msg_->certificate_bytes[172]; - EXPECT_EQ(get_ascertificate_bytes[173])>( - reinterpret_cast( - &last_msg_->certificate_bytes[173])), - 165) - << "incorrect value for certificate_bytes[173], expected 165, is " - << last_msg_->certificate_bytes[173]; - EXPECT_EQ(get_ascertificate_bytes[174])>( - reinterpret_cast( - &last_msg_->certificate_bytes[174])), - 2) - << "incorrect value for certificate_bytes[174], expected 2, is " - << last_msg_->certificate_bytes[174]; - EXPECT_EQ(get_ascertificate_bytes[175])>( - reinterpret_cast( - &last_msg_->certificate_bytes[175])), - 128) - << "incorrect value for certificate_bytes[175], expected 128, is " - << last_msg_->certificate_bytes[175]; - EXPECT_EQ(get_ascertificate_bytes[176])>( - reinterpret_cast( - &last_msg_->certificate_bytes[176])), - 231) - << "incorrect value for certificate_bytes[176], expected 231, is " - << last_msg_->certificate_bytes[176]; - EXPECT_EQ(get_ascertificate_bytes[177])>( - reinterpret_cast( - &last_msg_->certificate_bytes[177])), - 25) - << "incorrect value for certificate_bytes[177], expected 25, is " - << last_msg_->certificate_bytes[177]; - EXPECT_EQ(get_ascertificate_bytes[178])>( - reinterpret_cast( - &last_msg_->certificate_bytes[178])), - 157) - << "incorrect value for certificate_bytes[178], expected 157, is " - << last_msg_->certificate_bytes[178]; - EXPECT_EQ(get_ascertificate_bytes[179])>( - reinterpret_cast( - &last_msg_->certificate_bytes[179])), - 244) - << "incorrect value for certificate_bytes[179], expected 244, is " - << last_msg_->certificate_bytes[179]; - EXPECT_EQ(get_ascertificate_bytes[180])>( - reinterpret_cast( - &last_msg_->certificate_bytes[180])), - 204) - << "incorrect value for certificate_bytes[180], expected 204, is " - << last_msg_->certificate_bytes[180]; - EXPECT_EQ(get_ascertificate_bytes[181])>( - reinterpret_cast( - &last_msg_->certificate_bytes[181])), - 108) - << "incorrect value for certificate_bytes[181], expected 108, is " - << last_msg_->certificate_bytes[181]; - EXPECT_EQ(get_ascertificate_bytes[182])>( - reinterpret_cast( - &last_msg_->certificate_bytes[182])), - 253) - << "incorrect value for certificate_bytes[182], expected 253, is " - << last_msg_->certificate_bytes[182]; - EXPECT_EQ(get_ascertificate_bytes[183])>( - reinterpret_cast( - &last_msg_->certificate_bytes[183])), - 127) - << "incorrect value for certificate_bytes[183], expected 127, is " - << last_msg_->certificate_bytes[183]; - EXPECT_EQ(get_ascertificate_bytes[184])>( - reinterpret_cast( - &last_msg_->certificate_bytes[184])), - 122) - << "incorrect value for certificate_bytes[184], expected 122, is " - << last_msg_->certificate_bytes[184]; - EXPECT_EQ(get_ascertificate_bytes[185])>( - reinterpret_cast( - &last_msg_->certificate_bytes[185])), - 145) - << "incorrect value for certificate_bytes[185], expected 145, is " - << last_msg_->certificate_bytes[185]; - EXPECT_EQ(get_ascertificate_bytes[186])>( - reinterpret_cast( - &last_msg_->certificate_bytes[186])), - 113) - << "incorrect value for certificate_bytes[186], expected 113, is " - << last_msg_->certificate_bytes[186]; - EXPECT_EQ(get_ascertificate_bytes[187])>( - reinterpret_cast( - &last_msg_->certificate_bytes[187])), - 162) - << "incorrect value for certificate_bytes[187], expected 162, is " - << last_msg_->certificate_bytes[187]; - EXPECT_EQ(get_ascertificate_bytes[188])>( - reinterpret_cast( - &last_msg_->certificate_bytes[188])), - 197) - << "incorrect value for certificate_bytes[188], expected 197, is " - << last_msg_->certificate_bytes[188]; - EXPECT_EQ(get_ascertificate_bytes[189])>( - reinterpret_cast( - &last_msg_->certificate_bytes[189])), - 171) - << "incorrect value for certificate_bytes[189], expected 171, is " - << last_msg_->certificate_bytes[189]; - EXPECT_EQ(get_ascertificate_bytes[190])>( - reinterpret_cast( - &last_msg_->certificate_bytes[190])), - 199) - << "incorrect value for certificate_bytes[190], expected 199, is " - << last_msg_->certificate_bytes[190]; - EXPECT_EQ(get_ascertificate_bytes[191])>( - reinterpret_cast( - &last_msg_->certificate_bytes[191])), - 54) - << "incorrect value for certificate_bytes[191], expected 54, is " - << last_msg_->certificate_bytes[191]; - EXPECT_EQ(get_ascertificate_bytes[192])>( - reinterpret_cast( - &last_msg_->certificate_bytes[192])), - 184) - << "incorrect value for certificate_bytes[192], expected 184, is " - << last_msg_->certificate_bytes[192]; - EXPECT_EQ(get_ascertificate_bytes[193])>( - reinterpret_cast( - &last_msg_->certificate_bytes[193])), - 222) - << "incorrect value for certificate_bytes[193], expected 222, is " - << last_msg_->certificate_bytes[193]; - EXPECT_EQ(get_ascertificate_bytes[194])>( - reinterpret_cast( - &last_msg_->certificate_bytes[194])), - 206) - << "incorrect value for certificate_bytes[194], expected 206, is " - << last_msg_->certificate_bytes[194]; - EXPECT_EQ(get_ascertificate_bytes[195])>( - reinterpret_cast( - &last_msg_->certificate_bytes[195])), - 67) - << "incorrect value for certificate_bytes[195], expected 67, is " - << last_msg_->certificate_bytes[195]; - EXPECT_EQ(get_ascertificate_bytes[196])>( - reinterpret_cast( - &last_msg_->certificate_bytes[196])), - 144) - << "incorrect value for certificate_bytes[196], expected 144, is " - << last_msg_->certificate_bytes[196]; - EXPECT_EQ(get_ascertificate_bytes[197])>( - reinterpret_cast( - &last_msg_->certificate_bytes[197])), - 78) - << "incorrect value for certificate_bytes[197], expected 78, is " - << last_msg_->certificate_bytes[197]; - EXPECT_EQ(get_ascertificate_bytes[198])>( - reinterpret_cast( - &last_msg_->certificate_bytes[198])), - 187) - << "incorrect value for certificate_bytes[198], expected 187, is " - << last_msg_->certificate_bytes[198]; - EXPECT_EQ(get_ascertificate_bytes[199])>( - reinterpret_cast( - &last_msg_->certificate_bytes[199])), - 207) - << "incorrect value for certificate_bytes[199], expected 207, is " - << last_msg_->certificate_bytes[199]; - EXPECT_EQ(get_ascertificate_bytes[200])>( - reinterpret_cast( - &last_msg_->certificate_bytes[200])), - 60) - << "incorrect value for certificate_bytes[200], expected 60, is " - << last_msg_->certificate_bytes[200]; - EXPECT_EQ(get_ascertificate_bytes[201])>( - reinterpret_cast( - &last_msg_->certificate_bytes[201])), - 211) - << "incorrect value for certificate_bytes[201], expected 211, is " - << last_msg_->certificate_bytes[201]; - EXPECT_EQ(get_ascertificate_bytes[202])>( - reinterpret_cast( - &last_msg_->certificate_bytes[202])), - 141) - << "incorrect value for certificate_bytes[202], expected 141, is " - << last_msg_->certificate_bytes[202]; - EXPECT_EQ(get_ascertificate_bytes[203])>( - reinterpret_cast( - &last_msg_->certificate_bytes[203])), - 135) - << "incorrect value for certificate_bytes[203], expected 135, is " - << last_msg_->certificate_bytes[203]; - EXPECT_EQ(get_ascertificate_bytes[204])>( - reinterpret_cast( - &last_msg_->certificate_bytes[204])), - 106) - << "incorrect value for certificate_bytes[204], expected 106, is " - << last_msg_->certificate_bytes[204]; - EXPECT_EQ(get_ascertificate_bytes[205])>( - reinterpret_cast( - &last_msg_->certificate_bytes[205])), - 220) - << "incorrect value for certificate_bytes[205], expected 220, is " - << last_msg_->certificate_bytes[205]; - EXPECT_EQ(get_ascertificate_bytes[206])>( - reinterpret_cast( - &last_msg_->certificate_bytes[206])), - 79) - << "incorrect value for certificate_bytes[206], expected 79, is " - << last_msg_->certificate_bytes[206]; - EXPECT_EQ(get_ascertificate_bytes[207])>( - reinterpret_cast( - &last_msg_->certificate_bytes[207])), - 183) - << "incorrect value for certificate_bytes[207], expected 183, is " - << last_msg_->certificate_bytes[207]; - EXPECT_EQ(get_ascertificate_bytes[208])>( - reinterpret_cast( - &last_msg_->certificate_bytes[208])), - 245) - << "incorrect value for certificate_bytes[208], expected 245, is " - << last_msg_->certificate_bytes[208]; - EXPECT_EQ(get_ascertificate_bytes[209])>( - reinterpret_cast( - &last_msg_->certificate_bytes[209])), - 21) - << "incorrect value for certificate_bytes[209], expected 21, is " - << last_msg_->certificate_bytes[209]; - EXPECT_EQ(get_ascertificate_bytes[210])>( - reinterpret_cast( - &last_msg_->certificate_bytes[210])), - 161) - << "incorrect value for certificate_bytes[210], expected 161, is " - << last_msg_->certificate_bytes[210]; - EXPECT_EQ(get_ascertificate_bytes[211])>( - reinterpret_cast( - &last_msg_->certificate_bytes[211])), - 168) - << "incorrect value for certificate_bytes[211], expected 168, is " - << last_msg_->certificate_bytes[211]; - EXPECT_EQ(get_ascertificate_bytes[212])>( - reinterpret_cast( - &last_msg_->certificate_bytes[212])), - 34) - << "incorrect value for certificate_bytes[212], expected 34, is " - << last_msg_->certificate_bytes[212]; - EXPECT_EQ(get_ascertificate_bytes[213])>( - reinterpret_cast( - &last_msg_->certificate_bytes[213])), - 129) - << "incorrect value for certificate_bytes[213], expected 129, is " - << last_msg_->certificate_bytes[213]; - EXPECT_EQ(get_ascertificate_bytes[214])>( - reinterpret_cast( - &last_msg_->certificate_bytes[214])), - 50) - << "incorrect value for certificate_bytes[214], expected 50, is " - << last_msg_->certificate_bytes[214]; - EXPECT_EQ(get_ascertificate_bytes[215])>( - reinterpret_cast( - &last_msg_->certificate_bytes[215])), - 176) - << "incorrect value for certificate_bytes[215], expected 176, is " - << last_msg_->certificate_bytes[215]; - EXPECT_EQ(get_ascertificate_bytes[216])>( - reinterpret_cast( - &last_msg_->certificate_bytes[216])), - 1) - << "incorrect value for certificate_bytes[216], expected 1, is " - << last_msg_->certificate_bytes[216]; - EXPECT_EQ(get_ascertificate_bytes[217])>( - reinterpret_cast( - &last_msg_->certificate_bytes[217])), - 218) - << "incorrect value for certificate_bytes[217], expected 218, is " - << last_msg_->certificate_bytes[217]; - EXPECT_EQ(get_ascertificate_bytes[218])>( - reinterpret_cast( - &last_msg_->certificate_bytes[218])), - 20) - << "incorrect value for certificate_bytes[218], expected 20, is " - << last_msg_->certificate_bytes[218]; - EXPECT_EQ(get_ascertificate_bytes[219])>( - reinterpret_cast( - &last_msg_->certificate_bytes[219])), - 130) - << "incorrect value for certificate_bytes[219], expected 130, is " - << last_msg_->certificate_bytes[219]; - EXPECT_EQ(get_ascertificate_bytes[220])>( - reinterpret_cast( - &last_msg_->certificate_bytes[220])), - 59) - << "incorrect value for certificate_bytes[220], expected 59, is " - << last_msg_->certificate_bytes[220]; - EXPECT_EQ(get_ascertificate_bytes[221])>( - reinterpret_cast( - &last_msg_->certificate_bytes[221])), - 249) - << "incorrect value for certificate_bytes[221], expected 249, is " - << last_msg_->certificate_bytes[221]; - EXPECT_EQ(get_ascertificate_bytes[222])>( - reinterpret_cast( - &last_msg_->certificate_bytes[222])), - 109) - << "incorrect value for certificate_bytes[222], expected 109, is " - << last_msg_->certificate_bytes[222]; - EXPECT_EQ(get_ascertificate_bytes[223])>( - reinterpret_cast( - &last_msg_->certificate_bytes[223])), - 219) - << "incorrect value for certificate_bytes[223], expected 219, is " - << last_msg_->certificate_bytes[223]; - EXPECT_EQ(get_ascertificate_bytes[224])>( - reinterpret_cast( - &last_msg_->certificate_bytes[224])), - 0) - << "incorrect value for certificate_bytes[224], expected 0, is " - << last_msg_->certificate_bytes[224]; - EXPECT_EQ(get_ascertificate_bytes[225])>( - reinterpret_cast( - &last_msg_->certificate_bytes[225])), - 100) - << "incorrect value for certificate_bytes[225], expected 100, is " - << last_msg_->certificate_bytes[225]; - EXPECT_EQ(get_ascertificate_bytes[226])>( - reinterpret_cast( - &last_msg_->certificate_bytes[226])), - 103) - << "incorrect value for certificate_bytes[226], expected 103, is " - << last_msg_->certificate_bytes[226]; - EXPECT_EQ(get_ascertificate_bytes[227])>( - reinterpret_cast( - &last_msg_->certificate_bytes[227])), - 55) - << "incorrect value for certificate_bytes[227], expected 55, is " - << last_msg_->certificate_bytes[227]; - EXPECT_EQ(get_ascertificate_bytes[228])>( - reinterpret_cast( - &last_msg_->certificate_bytes[228])), - 29) - << "incorrect value for certificate_bytes[228], expected 29, is " - << last_msg_->certificate_bytes[228]; - EXPECT_EQ(get_ascertificate_bytes[229])>( - reinterpret_cast( - &last_msg_->certificate_bytes[229])), - 242) - << "incorrect value for certificate_bytes[229], expected 242, is " - << last_msg_->certificate_bytes[229]; - EXPECT_EQ(get_ascertificate_bytes[230])>( - reinterpret_cast( - &last_msg_->certificate_bytes[230])), - 110) - << "incorrect value for certificate_bytes[230], expected 110, is " - << last_msg_->certificate_bytes[230]; - EXPECT_EQ(get_ascertificate_bytes[231])>( - reinterpret_cast( - &last_msg_->certificate_bytes[231])), - 154) - << "incorrect value for certificate_bytes[231], expected 154, is " - << last_msg_->certificate_bytes[231]; - EXPECT_EQ(get_ascertificate_bytes[232])>( - reinterpret_cast( - &last_msg_->certificate_bytes[232])), - 190) - << "incorrect value for certificate_bytes[232], expected 190, is " - << last_msg_->certificate_bytes[232]; - EXPECT_EQ(get_ascertificate_bytes[233])>( - reinterpret_cast( - &last_msg_->certificate_bytes[233])), - 233) - << "incorrect value for certificate_bytes[233], expected 233, is " - << last_msg_->certificate_bytes[233]; - EXPECT_EQ(get_ascertificate_bytes[234])>( - reinterpret_cast( - &last_msg_->certificate_bytes[234])), - 142) - << "incorrect value for certificate_bytes[234], expected 142, is " - << last_msg_->certificate_bytes[234]; - EXPECT_EQ(get_ascertificate_bytes[235])>( - reinterpret_cast( - &last_msg_->certificate_bytes[235])), - 45) - << "incorrect value for certificate_bytes[235], expected 45, is " - << last_msg_->certificate_bytes[235]; - EXPECT_EQ(get_ascertificate_bytes[236])>( - reinterpret_cast( - &last_msg_->certificate_bytes[236])), - 61) - << "incorrect value for certificate_bytes[236], expected 61, is " - << last_msg_->certificate_bytes[236]; - EXPECT_EQ(get_ascertificate_bytes[237])>( - reinterpret_cast( - &last_msg_->certificate_bytes[237])), - 215) - << "incorrect value for certificate_bytes[237], expected 215, is " - << last_msg_->certificate_bytes[237]; - EXPECT_EQ(get_ascertificate_bytes[238])>( - reinterpret_cast( - &last_msg_->certificate_bytes[238])), - 202) - << "incorrect value for certificate_bytes[238], expected 202, is " - << last_msg_->certificate_bytes[238]; - EXPECT_EQ(get_ascertificate_bytes[239])>( - reinterpret_cast( - &last_msg_->certificate_bytes[239])), - 238) - << "incorrect value for certificate_bytes[239], expected 238, is " - << last_msg_->certificate_bytes[239]; - EXPECT_EQ(get_ascertificate_bytes[240])>( - reinterpret_cast( - &last_msg_->certificate_bytes[240])), - 88) - << "incorrect value for certificate_bytes[240], expected 88, is " - << last_msg_->certificate_bytes[240]; - EXPECT_EQ(get_ascertificate_bytes[241])>( - reinterpret_cast( - &last_msg_->certificate_bytes[241])), - 209) - << "incorrect value for certificate_bytes[241], expected 209, is " - << last_msg_->certificate_bytes[241]; - EXPECT_EQ(get_ascertificate_bytes[242])>( - reinterpret_cast( - &last_msg_->certificate_bytes[242])), - 70) - << "incorrect value for certificate_bytes[242], expected 70, is " - << last_msg_->certificate_bytes[242]; - EXPECT_EQ(get_ascertificate_bytes[243])>( - reinterpret_cast( - &last_msg_->certificate_bytes[243])), - 63) - << "incorrect value for certificate_bytes[243], expected 63, is " - << last_msg_->certificate_bytes[243]; - EXPECT_EQ(get_ascertificate_bytes[244])>( - reinterpret_cast( - &last_msg_->certificate_bytes[244])), - 151) - << "incorrect value for certificate_bytes[244], expected 151, is " - << last_msg_->certificate_bytes[244]; - EXPECT_EQ(get_ascertificate_bytes[245])>( - reinterpret_cast( - &last_msg_->certificate_bytes[245])), - 27) - << "incorrect value for certificate_bytes[245], expected 27, is " - << last_msg_->certificate_bytes[245]; - EXPECT_EQ(get_ascertificate_bytes[246])>( - reinterpret_cast( - &last_msg_->certificate_bytes[246])), - 102) - << "incorrect value for certificate_bytes[246], expected 102, is " - << last_msg_->certificate_bytes[246]; - EXPECT_EQ( - get_ascertificate_id[0])>( - reinterpret_cast(&last_msg_->certificate_id[0])), - 10) - << "incorrect value for certificate_id[0], expected 10, is " - << last_msg_->certificate_id[0]; - EXPECT_EQ( - get_ascertificate_id[1])>( - reinterpret_cast(&last_msg_->certificate_id[1])), - 11) - << "incorrect value for certificate_id[1], expected 11, is " - << last_msg_->certificate_id[1]; - EXPECT_EQ( - get_ascertificate_id[2])>( - reinterpret_cast(&last_msg_->certificate_id[2])), - 12) - << "incorrect value for certificate_id[2], expected 12, is " - << last_msg_->certificate_id[2]; - EXPECT_EQ( - get_ascertificate_id[3])>( - reinterpret_cast(&last_msg_->certificate_id[3])), - 13) - << "incorrect value for certificate_id[3], expected 13, is " - << last_msg_->certificate_id[3]; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 2) - << "incorrect value for flags, expected 2, is " << last_msg_->flags; - EXPECT_EQ(get_asn_msg)>( - reinterpret_cast(&last_msg_->n_msg)), - 48) - << "incorrect value for n_msg, expected 48, is " << last_msg_->n_msg; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_signing_MsgEcdsaSignature.cc b/c/test/legacy/cpp/auto_check_sbp_signing_MsgEcdsaSignature.cc deleted file mode 100644 index a9f4fc8ab4..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_signing_MsgEcdsaSignature.cc +++ /dev/null @@ -1,1096 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgEcdsaSignature.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_signing_MsgEcdsaSignature0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_signing_MsgEcdsaSignature0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ecdsa_signature_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ecdsa_signature_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_signing_MsgEcdsaSignature0, Test) { - uint8_t encoded_frame[] = { - 85, 8, 12, 66, 0, 83, 0, 1, 2, 1, 2, 3, 4, 72, 0, 1, - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 10, 21, 23, 232, 131, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ecdsa_signature_t *test_msg = (msg_ecdsa_signature_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_id[0])); - } - test_msg->certificate_id[0] = 1; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_id[0])); - } - test_msg->certificate_id[1] = 2; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_id[0])); - } - test_msg->certificate_id[2] = 3; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_id[0])); - } - test_msg->certificate_id[3] = 4; - test_msg->flags = 0; - test_msg->on_demand_counter = 2; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[0] = 0; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[1] = 1; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[2] = 2; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[3] = 3; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[4] = 4; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[5] = 5; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[6] = 6; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[7] = 7; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[8] = 8; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[9] = 9; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[10] = 10; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[11] = 11; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[12] = 12; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[13] = 13; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[14] = 14; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[15] = 15; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[16] = 16; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[17] = 17; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[18] = 18; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[19] = 19; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[20] = 20; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[21] = 21; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[22] = 22; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[23] = 23; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[24] = 24; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[25] = 25; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[26] = 26; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[27] = 27; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[28] = 28; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[29] = 29; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[30] = 30; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[31] = 31; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[32] = 32; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[33] = 33; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[34] = 34; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[35] = 35; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[36] = 36; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[37] = 37; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[38] = 38; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[39] = 39; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[40] = 40; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[41] = 41; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[42] = 42; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[43] = 43; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[44] = 44; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[45] = 45; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[46] = 46; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[47] = 47; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[48] = 48; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[49] = 49; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[50] = 50; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[51] = 51; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[52] = 52; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[53] = 53; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[54] = 54; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[55] = 55; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[56] = 56; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[57] = 57; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[58] = 58; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[59] = 59; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[60] = 60; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[61] = 61; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[62] = 62; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[63] = 63; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[64] = 64; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[65] = 65; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[66] = 66; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[67] = 67; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[68] = 68; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[69] = 69; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[70] = 70; - if (sizeof(test_msg->signature.data) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signature.data[0])); - } - test_msg->signature.data[71] = 71; - test_msg->signature.len = 72; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[0] = 10; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[1] = 21; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[2] = 23; - test_msg->stream_counter = 1; - - EXPECT_EQ(send_message(0xC08, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ( - get_ascertificate_id[0])>( - reinterpret_cast(&last_msg_->certificate_id[0])), - 1) - << "incorrect value for certificate_id[0], expected 1, is " - << last_msg_->certificate_id[0]; - EXPECT_EQ( - get_ascertificate_id[1])>( - reinterpret_cast(&last_msg_->certificate_id[1])), - 2) - << "incorrect value for certificate_id[1], expected 2, is " - << last_msg_->certificate_id[1]; - EXPECT_EQ( - get_ascertificate_id[2])>( - reinterpret_cast(&last_msg_->certificate_id[2])), - 3) - << "incorrect value for certificate_id[2], expected 3, is " - << last_msg_->certificate_id[2]; - EXPECT_EQ( - get_ascertificate_id[3])>( - reinterpret_cast(&last_msg_->certificate_id[3])), - 4) - << "incorrect value for certificate_id[3], expected 4, is " - << last_msg_->certificate_id[3]; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ( - get_ason_demand_counter)>( - reinterpret_cast(&last_msg_->on_demand_counter)), - 2) - << "incorrect value for on_demand_counter, expected 2, is " - << last_msg_->on_demand_counter; - EXPECT_EQ( - get_assignature.data[0])>( - reinterpret_cast(&last_msg_->signature.data[0])), - 0) - << "incorrect value for signature.data[0], expected 0, is " - << last_msg_->signature.data[0]; - EXPECT_EQ( - get_assignature.data[1])>( - reinterpret_cast(&last_msg_->signature.data[1])), - 1) - << "incorrect value for signature.data[1], expected 1, is " - << last_msg_->signature.data[1]; - EXPECT_EQ( - get_assignature.data[2])>( - reinterpret_cast(&last_msg_->signature.data[2])), - 2) - << "incorrect value for signature.data[2], expected 2, is " - << last_msg_->signature.data[2]; - EXPECT_EQ( - get_assignature.data[3])>( - reinterpret_cast(&last_msg_->signature.data[3])), - 3) - << "incorrect value for signature.data[3], expected 3, is " - << last_msg_->signature.data[3]; - EXPECT_EQ( - get_assignature.data[4])>( - reinterpret_cast(&last_msg_->signature.data[4])), - 4) - << "incorrect value for signature.data[4], expected 4, is " - << last_msg_->signature.data[4]; - EXPECT_EQ( - get_assignature.data[5])>( - reinterpret_cast(&last_msg_->signature.data[5])), - 5) - << "incorrect value for signature.data[5], expected 5, is " - << last_msg_->signature.data[5]; - EXPECT_EQ( - get_assignature.data[6])>( - reinterpret_cast(&last_msg_->signature.data[6])), - 6) - << "incorrect value for signature.data[6], expected 6, is " - << last_msg_->signature.data[6]; - EXPECT_EQ( - get_assignature.data[7])>( - reinterpret_cast(&last_msg_->signature.data[7])), - 7) - << "incorrect value for signature.data[7], expected 7, is " - << last_msg_->signature.data[7]; - EXPECT_EQ( - get_assignature.data[8])>( - reinterpret_cast(&last_msg_->signature.data[8])), - 8) - << "incorrect value for signature.data[8], expected 8, is " - << last_msg_->signature.data[8]; - EXPECT_EQ( - get_assignature.data[9])>( - reinterpret_cast(&last_msg_->signature.data[9])), - 9) - << "incorrect value for signature.data[9], expected 9, is " - << last_msg_->signature.data[9]; - EXPECT_EQ( - get_assignature.data[10])>( - reinterpret_cast(&last_msg_->signature.data[10])), - 10) - << "incorrect value for signature.data[10], expected 10, is " - << last_msg_->signature.data[10]; - EXPECT_EQ( - get_assignature.data[11])>( - reinterpret_cast(&last_msg_->signature.data[11])), - 11) - << "incorrect value for signature.data[11], expected 11, is " - << last_msg_->signature.data[11]; - EXPECT_EQ( - get_assignature.data[12])>( - reinterpret_cast(&last_msg_->signature.data[12])), - 12) - << "incorrect value for signature.data[12], expected 12, is " - << last_msg_->signature.data[12]; - EXPECT_EQ( - get_assignature.data[13])>( - reinterpret_cast(&last_msg_->signature.data[13])), - 13) - << "incorrect value for signature.data[13], expected 13, is " - << last_msg_->signature.data[13]; - EXPECT_EQ( - get_assignature.data[14])>( - reinterpret_cast(&last_msg_->signature.data[14])), - 14) - << "incorrect value for signature.data[14], expected 14, is " - << last_msg_->signature.data[14]; - EXPECT_EQ( - get_assignature.data[15])>( - reinterpret_cast(&last_msg_->signature.data[15])), - 15) - << "incorrect value for signature.data[15], expected 15, is " - << last_msg_->signature.data[15]; - EXPECT_EQ( - get_assignature.data[16])>( - reinterpret_cast(&last_msg_->signature.data[16])), - 16) - << "incorrect value for signature.data[16], expected 16, is " - << last_msg_->signature.data[16]; - EXPECT_EQ( - get_assignature.data[17])>( - reinterpret_cast(&last_msg_->signature.data[17])), - 17) - << "incorrect value for signature.data[17], expected 17, is " - << last_msg_->signature.data[17]; - EXPECT_EQ( - get_assignature.data[18])>( - reinterpret_cast(&last_msg_->signature.data[18])), - 18) - << "incorrect value for signature.data[18], expected 18, is " - << last_msg_->signature.data[18]; - EXPECT_EQ( - get_assignature.data[19])>( - reinterpret_cast(&last_msg_->signature.data[19])), - 19) - << "incorrect value for signature.data[19], expected 19, is " - << last_msg_->signature.data[19]; - EXPECT_EQ( - get_assignature.data[20])>( - reinterpret_cast(&last_msg_->signature.data[20])), - 20) - << "incorrect value for signature.data[20], expected 20, is " - << last_msg_->signature.data[20]; - EXPECT_EQ( - get_assignature.data[21])>( - reinterpret_cast(&last_msg_->signature.data[21])), - 21) - << "incorrect value for signature.data[21], expected 21, is " - << last_msg_->signature.data[21]; - EXPECT_EQ( - get_assignature.data[22])>( - reinterpret_cast(&last_msg_->signature.data[22])), - 22) - << "incorrect value for signature.data[22], expected 22, is " - << last_msg_->signature.data[22]; - EXPECT_EQ( - get_assignature.data[23])>( - reinterpret_cast(&last_msg_->signature.data[23])), - 23) - << "incorrect value for signature.data[23], expected 23, is " - << last_msg_->signature.data[23]; - EXPECT_EQ( - get_assignature.data[24])>( - reinterpret_cast(&last_msg_->signature.data[24])), - 24) - << "incorrect value for signature.data[24], expected 24, is " - << last_msg_->signature.data[24]; - EXPECT_EQ( - get_assignature.data[25])>( - reinterpret_cast(&last_msg_->signature.data[25])), - 25) - << "incorrect value for signature.data[25], expected 25, is " - << last_msg_->signature.data[25]; - EXPECT_EQ( - get_assignature.data[26])>( - reinterpret_cast(&last_msg_->signature.data[26])), - 26) - << "incorrect value for signature.data[26], expected 26, is " - << last_msg_->signature.data[26]; - EXPECT_EQ( - get_assignature.data[27])>( - reinterpret_cast(&last_msg_->signature.data[27])), - 27) - << "incorrect value for signature.data[27], expected 27, is " - << last_msg_->signature.data[27]; - EXPECT_EQ( - get_assignature.data[28])>( - reinterpret_cast(&last_msg_->signature.data[28])), - 28) - << "incorrect value for signature.data[28], expected 28, is " - << last_msg_->signature.data[28]; - EXPECT_EQ( - get_assignature.data[29])>( - reinterpret_cast(&last_msg_->signature.data[29])), - 29) - << "incorrect value for signature.data[29], expected 29, is " - << last_msg_->signature.data[29]; - EXPECT_EQ( - get_assignature.data[30])>( - reinterpret_cast(&last_msg_->signature.data[30])), - 30) - << "incorrect value for signature.data[30], expected 30, is " - << last_msg_->signature.data[30]; - EXPECT_EQ( - get_assignature.data[31])>( - reinterpret_cast(&last_msg_->signature.data[31])), - 31) - << "incorrect value for signature.data[31], expected 31, is " - << last_msg_->signature.data[31]; - EXPECT_EQ( - get_assignature.data[32])>( - reinterpret_cast(&last_msg_->signature.data[32])), - 32) - << "incorrect value for signature.data[32], expected 32, is " - << last_msg_->signature.data[32]; - EXPECT_EQ( - get_assignature.data[33])>( - reinterpret_cast(&last_msg_->signature.data[33])), - 33) - << "incorrect value for signature.data[33], expected 33, is " - << last_msg_->signature.data[33]; - EXPECT_EQ( - get_assignature.data[34])>( - reinterpret_cast(&last_msg_->signature.data[34])), - 34) - << "incorrect value for signature.data[34], expected 34, is " - << last_msg_->signature.data[34]; - EXPECT_EQ( - get_assignature.data[35])>( - reinterpret_cast(&last_msg_->signature.data[35])), - 35) - << "incorrect value for signature.data[35], expected 35, is " - << last_msg_->signature.data[35]; - EXPECT_EQ( - get_assignature.data[36])>( - reinterpret_cast(&last_msg_->signature.data[36])), - 36) - << "incorrect value for signature.data[36], expected 36, is " - << last_msg_->signature.data[36]; - EXPECT_EQ( - get_assignature.data[37])>( - reinterpret_cast(&last_msg_->signature.data[37])), - 37) - << "incorrect value for signature.data[37], expected 37, is " - << last_msg_->signature.data[37]; - EXPECT_EQ( - get_assignature.data[38])>( - reinterpret_cast(&last_msg_->signature.data[38])), - 38) - << "incorrect value for signature.data[38], expected 38, is " - << last_msg_->signature.data[38]; - EXPECT_EQ( - get_assignature.data[39])>( - reinterpret_cast(&last_msg_->signature.data[39])), - 39) - << "incorrect value for signature.data[39], expected 39, is " - << last_msg_->signature.data[39]; - EXPECT_EQ( - get_assignature.data[40])>( - reinterpret_cast(&last_msg_->signature.data[40])), - 40) - << "incorrect value for signature.data[40], expected 40, is " - << last_msg_->signature.data[40]; - EXPECT_EQ( - get_assignature.data[41])>( - reinterpret_cast(&last_msg_->signature.data[41])), - 41) - << "incorrect value for signature.data[41], expected 41, is " - << last_msg_->signature.data[41]; - EXPECT_EQ( - get_assignature.data[42])>( - reinterpret_cast(&last_msg_->signature.data[42])), - 42) - << "incorrect value for signature.data[42], expected 42, is " - << last_msg_->signature.data[42]; - EXPECT_EQ( - get_assignature.data[43])>( - reinterpret_cast(&last_msg_->signature.data[43])), - 43) - << "incorrect value for signature.data[43], expected 43, is " - << last_msg_->signature.data[43]; - EXPECT_EQ( - get_assignature.data[44])>( - reinterpret_cast(&last_msg_->signature.data[44])), - 44) - << "incorrect value for signature.data[44], expected 44, is " - << last_msg_->signature.data[44]; - EXPECT_EQ( - get_assignature.data[45])>( - reinterpret_cast(&last_msg_->signature.data[45])), - 45) - << "incorrect value for signature.data[45], expected 45, is " - << last_msg_->signature.data[45]; - EXPECT_EQ( - get_assignature.data[46])>( - reinterpret_cast(&last_msg_->signature.data[46])), - 46) - << "incorrect value for signature.data[46], expected 46, is " - << last_msg_->signature.data[46]; - EXPECT_EQ( - get_assignature.data[47])>( - reinterpret_cast(&last_msg_->signature.data[47])), - 47) - << "incorrect value for signature.data[47], expected 47, is " - << last_msg_->signature.data[47]; - EXPECT_EQ( - get_assignature.data[48])>( - reinterpret_cast(&last_msg_->signature.data[48])), - 48) - << "incorrect value for signature.data[48], expected 48, is " - << last_msg_->signature.data[48]; - EXPECT_EQ( - get_assignature.data[49])>( - reinterpret_cast(&last_msg_->signature.data[49])), - 49) - << "incorrect value for signature.data[49], expected 49, is " - << last_msg_->signature.data[49]; - EXPECT_EQ( - get_assignature.data[50])>( - reinterpret_cast(&last_msg_->signature.data[50])), - 50) - << "incorrect value for signature.data[50], expected 50, is " - << last_msg_->signature.data[50]; - EXPECT_EQ( - get_assignature.data[51])>( - reinterpret_cast(&last_msg_->signature.data[51])), - 51) - << "incorrect value for signature.data[51], expected 51, is " - << last_msg_->signature.data[51]; - EXPECT_EQ( - get_assignature.data[52])>( - reinterpret_cast(&last_msg_->signature.data[52])), - 52) - << "incorrect value for signature.data[52], expected 52, is " - << last_msg_->signature.data[52]; - EXPECT_EQ( - get_assignature.data[53])>( - reinterpret_cast(&last_msg_->signature.data[53])), - 53) - << "incorrect value for signature.data[53], expected 53, is " - << last_msg_->signature.data[53]; - EXPECT_EQ( - get_assignature.data[54])>( - reinterpret_cast(&last_msg_->signature.data[54])), - 54) - << "incorrect value for signature.data[54], expected 54, is " - << last_msg_->signature.data[54]; - EXPECT_EQ( - get_assignature.data[55])>( - reinterpret_cast(&last_msg_->signature.data[55])), - 55) - << "incorrect value for signature.data[55], expected 55, is " - << last_msg_->signature.data[55]; - EXPECT_EQ( - get_assignature.data[56])>( - reinterpret_cast(&last_msg_->signature.data[56])), - 56) - << "incorrect value for signature.data[56], expected 56, is " - << last_msg_->signature.data[56]; - EXPECT_EQ( - get_assignature.data[57])>( - reinterpret_cast(&last_msg_->signature.data[57])), - 57) - << "incorrect value for signature.data[57], expected 57, is " - << last_msg_->signature.data[57]; - EXPECT_EQ( - get_assignature.data[58])>( - reinterpret_cast(&last_msg_->signature.data[58])), - 58) - << "incorrect value for signature.data[58], expected 58, is " - << last_msg_->signature.data[58]; - EXPECT_EQ( - get_assignature.data[59])>( - reinterpret_cast(&last_msg_->signature.data[59])), - 59) - << "incorrect value for signature.data[59], expected 59, is " - << last_msg_->signature.data[59]; - EXPECT_EQ( - get_assignature.data[60])>( - reinterpret_cast(&last_msg_->signature.data[60])), - 60) - << "incorrect value for signature.data[60], expected 60, is " - << last_msg_->signature.data[60]; - EXPECT_EQ( - get_assignature.data[61])>( - reinterpret_cast(&last_msg_->signature.data[61])), - 61) - << "incorrect value for signature.data[61], expected 61, is " - << last_msg_->signature.data[61]; - EXPECT_EQ( - get_assignature.data[62])>( - reinterpret_cast(&last_msg_->signature.data[62])), - 62) - << "incorrect value for signature.data[62], expected 62, is " - << last_msg_->signature.data[62]; - EXPECT_EQ( - get_assignature.data[63])>( - reinterpret_cast(&last_msg_->signature.data[63])), - 63) - << "incorrect value for signature.data[63], expected 63, is " - << last_msg_->signature.data[63]; - EXPECT_EQ( - get_assignature.data[64])>( - reinterpret_cast(&last_msg_->signature.data[64])), - 64) - << "incorrect value for signature.data[64], expected 64, is " - << last_msg_->signature.data[64]; - EXPECT_EQ( - get_assignature.data[65])>( - reinterpret_cast(&last_msg_->signature.data[65])), - 65) - << "incorrect value for signature.data[65], expected 65, is " - << last_msg_->signature.data[65]; - EXPECT_EQ( - get_assignature.data[66])>( - reinterpret_cast(&last_msg_->signature.data[66])), - 66) - << "incorrect value for signature.data[66], expected 66, is " - << last_msg_->signature.data[66]; - EXPECT_EQ( - get_assignature.data[67])>( - reinterpret_cast(&last_msg_->signature.data[67])), - 67) - << "incorrect value for signature.data[67], expected 67, is " - << last_msg_->signature.data[67]; - EXPECT_EQ( - get_assignature.data[68])>( - reinterpret_cast(&last_msg_->signature.data[68])), - 68) - << "incorrect value for signature.data[68], expected 68, is " - << last_msg_->signature.data[68]; - EXPECT_EQ( - get_assignature.data[69])>( - reinterpret_cast(&last_msg_->signature.data[69])), - 69) - << "incorrect value for signature.data[69], expected 69, is " - << last_msg_->signature.data[69]; - EXPECT_EQ( - get_assignature.data[70])>( - reinterpret_cast(&last_msg_->signature.data[70])), - 70) - << "incorrect value for signature.data[70], expected 70, is " - << last_msg_->signature.data[70]; - EXPECT_EQ( - get_assignature.data[71])>( - reinterpret_cast(&last_msg_->signature.data[71])), - 71) - << "incorrect value for signature.data[71], expected 71, is " - << last_msg_->signature.data[71]; - EXPECT_EQ(get_assignature.len)>( - reinterpret_cast(&last_msg_->signature.len)), - 72) - << "incorrect value for signature.len, expected 72, is " - << last_msg_->signature.len; - EXPECT_EQ( - get_assigned_messages[0])>( - reinterpret_cast(&last_msg_->signed_messages[0])), - 10) - << "incorrect value for signed_messages[0], expected 10, is " - << last_msg_->signed_messages[0]; - EXPECT_EQ( - get_assigned_messages[1])>( - reinterpret_cast(&last_msg_->signed_messages[1])), - 21) - << "incorrect value for signed_messages[1], expected 21, is " - << last_msg_->signed_messages[1]; - EXPECT_EQ( - get_assigned_messages[2])>( - reinterpret_cast(&last_msg_->signed_messages[2])), - 23) - << "incorrect value for signed_messages[2], expected 23, is " - << last_msg_->signed_messages[2]; - EXPECT_EQ(get_asstream_counter)>( - reinterpret_cast(&last_msg_->stream_counter)), - 1) - << "incorrect value for stream_counter, expected 1, is " - << last_msg_->stream_counter; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_signing_MsgEcdsaSignatureDepA.cc b/c/test/legacy/cpp/auto_check_sbp_signing_MsgEcdsaSignatureDepA.cc deleted file mode 100644 index 06ae49759e..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_signing_MsgEcdsaSignatureDepA.cc +++ /dev/null @@ -1,3052 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgEcdsaSignatureDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ecdsa_signature_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ecdsa_signature_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 6, 12, 66, 0, 255, 0, 1, 2, 1, 2, 3, 4, 0, 1, - 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, - 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, - 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, - 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, - 6, 7, 10, 21, 23, 63, 140, 37, 130, 106, 28, 40, 165, 179, 73, - 178, 60, 126, 114, 78, 113, 27, 95, 3, 62, 104, 145, 96, 19, 92, - 123, 14, 90, 153, 183, 9, 72, 81, 118, 112, 124, 16, 182, 76, 146, - 115, 58, 144, 17, 105, 66, 31, 135, 54, 100, 84, 181, 103, 11, 88, - 133, 155, 167, 173, 143, 86, 158, 20, 168, 132, 141, 102, 50, 48, 71, - 147, 53, 87, 1, 108, 138, 36, 134, 139, 163, 82, 43, 52, 150, 12, - 30, 110, 156, 107, 120, 91, 122, 69, 164, 170, 116, 25, 94, 5, 22, - 24, 162, 175, 38, 157, 98, 44, 160, 47, 97, 142, 8, 74, 13, 177, - 15, 128, 26, 131, 154, 65, 169, 55, 136, 125, 171, 161, 29, 129, 151, - 68, 166, 51, 70, 45, 56, 79, 149, 99, 42, 101, 152, 39, 89, 180, - 64, 49, 6, 80, 172, 32, 109, 2, 119, 93, 176, 0, 33, 57, 34, - 18, 85, 121, 137, 83, 111, 59, 7, 77, 4, 117, 159, 148, 35, 61, - 41, 67, 46, 127, 75, 174, 97, 172, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ecdsa_signature_dep_a_t *test_msg = - (msg_ecdsa_signature_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_id[0])); - } - test_msg->certificate_id[0] = 1; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_id[0])); - } - test_msg->certificate_id[1] = 2; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_id[0])); - } - test_msg->certificate_id[2] = 3; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_id[0])); - } - test_msg->certificate_id[3] = 4; - test_msg->flags = 0; - test_msg->on_demand_counter = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[0] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[1] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[2] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[3] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[4] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[5] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[6] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[7] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[8] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[9] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[10] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[11] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[12] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[13] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[14] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[15] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[16] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[17] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[18] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[19] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[20] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[21] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[22] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[23] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[24] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[25] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[26] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[27] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[28] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[29] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[30] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[31] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[32] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[33] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[34] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[35] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[36] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[37] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[38] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[39] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[40] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[41] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[42] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[43] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[44] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[45] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[46] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[47] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[48] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[49] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[50] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[51] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[52] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[53] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[54] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[55] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[56] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[57] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[58] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[59] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[60] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[61] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[62] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[63] = 7; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[0] = 10; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[1] = 21; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[2] = 23; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[3] = 63; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[4] = 140; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[5] = 37; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[6] = 130; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[7] = 106; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[8] = 28; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[9] = 40; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[10] = 165; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[11] = 179; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[12] = 73; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[13] = 178; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[14] = 60; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[15] = 126; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[16] = 114; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[17] = 78; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[18] = 113; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[19] = 27; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[20] = 95; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[21] = 3; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[22] = 62; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[23] = 104; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[24] = 145; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[25] = 96; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[26] = 19; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[27] = 92; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[28] = 123; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[29] = 14; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[30] = 90; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[31] = 153; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[32] = 183; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[33] = 9; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[34] = 72; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[35] = 81; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[36] = 118; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[37] = 112; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[38] = 124; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[39] = 16; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[40] = 182; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[41] = 76; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[42] = 146; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[43] = 115; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[44] = 58; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[45] = 144; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[46] = 17; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[47] = 105; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[48] = 66; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[49] = 31; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[50] = 135; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[51] = 54; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[52] = 100; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[53] = 84; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[54] = 181; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[55] = 103; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[56] = 11; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[57] = 88; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[58] = 133; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[59] = 155; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[60] = 167; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[61] = 173; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[62] = 143; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[63] = 86; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[64] = 158; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[65] = 20; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[66] = 168; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[67] = 132; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[68] = 141; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[69] = 102; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[70] = 50; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[71] = 48; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[72] = 71; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[73] = 147; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[74] = 53; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[75] = 87; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[76] = 1; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[77] = 108; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[78] = 138; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[79] = 36; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[80] = 134; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[81] = 139; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[82] = 163; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[83] = 82; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[84] = 43; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[85] = 52; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[86] = 150; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[87] = 12; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[88] = 30; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[89] = 110; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[90] = 156; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[91] = 107; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[92] = 120; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[93] = 91; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[94] = 122; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[95] = 69; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[96] = 164; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[97] = 170; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[98] = 116; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[99] = 25; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[100] = 94; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[101] = 5; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[102] = 22; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[103] = 24; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[104] = 162; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[105] = 175; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[106] = 38; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[107] = 157; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[108] = 98; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[109] = 44; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[110] = 160; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[111] = 47; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[112] = 97; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[113] = 142; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[114] = 8; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[115] = 74; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[116] = 13; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[117] = 177; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[118] = 15; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[119] = 128; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[120] = 26; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[121] = 131; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[122] = 154; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[123] = 65; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[124] = 169; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[125] = 55; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[126] = 136; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[127] = 125; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[128] = 171; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[129] = 161; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[130] = 29; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[131] = 129; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[132] = 151; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[133] = 68; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[134] = 166; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[135] = 51; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[136] = 70; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[137] = 45; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[138] = 56; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[139] = 79; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[140] = 149; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[141] = 99; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[142] = 42; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[143] = 101; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[144] = 152; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[145] = 39; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[146] = 89; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[147] = 180; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[148] = 64; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[149] = 49; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[150] = 6; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[151] = 80; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[152] = 172; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[153] = 32; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[154] = 109; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[155] = 2; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[156] = 119; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[157] = 93; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[158] = 176; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[159] = 0; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[160] = 33; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[161] = 57; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[162] = 34; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[163] = 18; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[164] = 85; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[165] = 121; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[166] = 137; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[167] = 83; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[168] = 111; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[169] = 59; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[170] = 7; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[171] = 77; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[172] = 4; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[173] = 117; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[174] = 159; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[175] = 148; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[176] = 35; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[177] = 61; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[178] = 41; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[179] = 67; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[180] = 46; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[181] = 127; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[182] = 75; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[183] = 174; - test_msg->stream_counter = 1; - - EXPECT_EQ(send_message(0xC06, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ( - get_ascertificate_id[0])>( - reinterpret_cast(&last_msg_->certificate_id[0])), - 1) - << "incorrect value for certificate_id[0], expected 1, is " - << last_msg_->certificate_id[0]; - EXPECT_EQ( - get_ascertificate_id[1])>( - reinterpret_cast(&last_msg_->certificate_id[1])), - 2) - << "incorrect value for certificate_id[1], expected 2, is " - << last_msg_->certificate_id[1]; - EXPECT_EQ( - get_ascertificate_id[2])>( - reinterpret_cast(&last_msg_->certificate_id[2])), - 3) - << "incorrect value for certificate_id[2], expected 3, is " - << last_msg_->certificate_id[2]; - EXPECT_EQ( - get_ascertificate_id[3])>( - reinterpret_cast(&last_msg_->certificate_id[3])), - 4) - << "incorrect value for certificate_id[3], expected 4, is " - << last_msg_->certificate_id[3]; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ( - get_ason_demand_counter)>( - reinterpret_cast(&last_msg_->on_demand_counter)), - 2) - << "incorrect value for on_demand_counter, expected 2, is " - << last_msg_->on_demand_counter; - EXPECT_EQ(get_assignature[0])>( - reinterpret_cast(&last_msg_->signature[0])), - 0) - << "incorrect value for signature[0], expected 0, is " - << last_msg_->signature[0]; - EXPECT_EQ(get_assignature[1])>( - reinterpret_cast(&last_msg_->signature[1])), - 1) - << "incorrect value for signature[1], expected 1, is " - << last_msg_->signature[1]; - EXPECT_EQ(get_assignature[2])>( - reinterpret_cast(&last_msg_->signature[2])), - 2) - << "incorrect value for signature[2], expected 2, is " - << last_msg_->signature[2]; - EXPECT_EQ(get_assignature[3])>( - reinterpret_cast(&last_msg_->signature[3])), - 3) - << "incorrect value for signature[3], expected 3, is " - << last_msg_->signature[3]; - EXPECT_EQ(get_assignature[4])>( - reinterpret_cast(&last_msg_->signature[4])), - 4) - << "incorrect value for signature[4], expected 4, is " - << last_msg_->signature[4]; - EXPECT_EQ(get_assignature[5])>( - reinterpret_cast(&last_msg_->signature[5])), - 5) - << "incorrect value for signature[5], expected 5, is " - << last_msg_->signature[5]; - EXPECT_EQ(get_assignature[6])>( - reinterpret_cast(&last_msg_->signature[6])), - 6) - << "incorrect value for signature[6], expected 6, is " - << last_msg_->signature[6]; - EXPECT_EQ(get_assignature[7])>( - reinterpret_cast(&last_msg_->signature[7])), - 7) - << "incorrect value for signature[7], expected 7, is " - << last_msg_->signature[7]; - EXPECT_EQ(get_assignature[8])>( - reinterpret_cast(&last_msg_->signature[8])), - 0) - << "incorrect value for signature[8], expected 0, is " - << last_msg_->signature[8]; - EXPECT_EQ(get_assignature[9])>( - reinterpret_cast(&last_msg_->signature[9])), - 1) - << "incorrect value for signature[9], expected 1, is " - << last_msg_->signature[9]; - EXPECT_EQ(get_assignature[10])>( - reinterpret_cast(&last_msg_->signature[10])), - 2) - << "incorrect value for signature[10], expected 2, is " - << last_msg_->signature[10]; - EXPECT_EQ(get_assignature[11])>( - reinterpret_cast(&last_msg_->signature[11])), - 3) - << "incorrect value for signature[11], expected 3, is " - << last_msg_->signature[11]; - EXPECT_EQ(get_assignature[12])>( - reinterpret_cast(&last_msg_->signature[12])), - 4) - << "incorrect value for signature[12], expected 4, is " - << last_msg_->signature[12]; - EXPECT_EQ(get_assignature[13])>( - reinterpret_cast(&last_msg_->signature[13])), - 5) - << "incorrect value for signature[13], expected 5, is " - << last_msg_->signature[13]; - EXPECT_EQ(get_assignature[14])>( - reinterpret_cast(&last_msg_->signature[14])), - 6) - << "incorrect value for signature[14], expected 6, is " - << last_msg_->signature[14]; - EXPECT_EQ(get_assignature[15])>( - reinterpret_cast(&last_msg_->signature[15])), - 7) - << "incorrect value for signature[15], expected 7, is " - << last_msg_->signature[15]; - EXPECT_EQ(get_assignature[16])>( - reinterpret_cast(&last_msg_->signature[16])), - 0) - << "incorrect value for signature[16], expected 0, is " - << last_msg_->signature[16]; - EXPECT_EQ(get_assignature[17])>( - reinterpret_cast(&last_msg_->signature[17])), - 1) - << "incorrect value for signature[17], expected 1, is " - << last_msg_->signature[17]; - EXPECT_EQ(get_assignature[18])>( - reinterpret_cast(&last_msg_->signature[18])), - 2) - << "incorrect value for signature[18], expected 2, is " - << last_msg_->signature[18]; - EXPECT_EQ(get_assignature[19])>( - reinterpret_cast(&last_msg_->signature[19])), - 3) - << "incorrect value for signature[19], expected 3, is " - << last_msg_->signature[19]; - EXPECT_EQ(get_assignature[20])>( - reinterpret_cast(&last_msg_->signature[20])), - 4) - << "incorrect value for signature[20], expected 4, is " - << last_msg_->signature[20]; - EXPECT_EQ(get_assignature[21])>( - reinterpret_cast(&last_msg_->signature[21])), - 5) - << "incorrect value for signature[21], expected 5, is " - << last_msg_->signature[21]; - EXPECT_EQ(get_assignature[22])>( - reinterpret_cast(&last_msg_->signature[22])), - 6) - << "incorrect value for signature[22], expected 6, is " - << last_msg_->signature[22]; - EXPECT_EQ(get_assignature[23])>( - reinterpret_cast(&last_msg_->signature[23])), - 7) - << "incorrect value for signature[23], expected 7, is " - << last_msg_->signature[23]; - EXPECT_EQ(get_assignature[24])>( - reinterpret_cast(&last_msg_->signature[24])), - 0) - << "incorrect value for signature[24], expected 0, is " - << last_msg_->signature[24]; - EXPECT_EQ(get_assignature[25])>( - reinterpret_cast(&last_msg_->signature[25])), - 1) - << "incorrect value for signature[25], expected 1, is " - << last_msg_->signature[25]; - EXPECT_EQ(get_assignature[26])>( - reinterpret_cast(&last_msg_->signature[26])), - 2) - << "incorrect value for signature[26], expected 2, is " - << last_msg_->signature[26]; - EXPECT_EQ(get_assignature[27])>( - reinterpret_cast(&last_msg_->signature[27])), - 3) - << "incorrect value for signature[27], expected 3, is " - << last_msg_->signature[27]; - EXPECT_EQ(get_assignature[28])>( - reinterpret_cast(&last_msg_->signature[28])), - 4) - << "incorrect value for signature[28], expected 4, is " - << last_msg_->signature[28]; - EXPECT_EQ(get_assignature[29])>( - reinterpret_cast(&last_msg_->signature[29])), - 5) - << "incorrect value for signature[29], expected 5, is " - << last_msg_->signature[29]; - EXPECT_EQ(get_assignature[30])>( - reinterpret_cast(&last_msg_->signature[30])), - 6) - << "incorrect value for signature[30], expected 6, is " - << last_msg_->signature[30]; - EXPECT_EQ(get_assignature[31])>( - reinterpret_cast(&last_msg_->signature[31])), - 7) - << "incorrect value for signature[31], expected 7, is " - << last_msg_->signature[31]; - EXPECT_EQ(get_assignature[32])>( - reinterpret_cast(&last_msg_->signature[32])), - 0) - << "incorrect value for signature[32], expected 0, is " - << last_msg_->signature[32]; - EXPECT_EQ(get_assignature[33])>( - reinterpret_cast(&last_msg_->signature[33])), - 1) - << "incorrect value for signature[33], expected 1, is " - << last_msg_->signature[33]; - EXPECT_EQ(get_assignature[34])>( - reinterpret_cast(&last_msg_->signature[34])), - 2) - << "incorrect value for signature[34], expected 2, is " - << last_msg_->signature[34]; - EXPECT_EQ(get_assignature[35])>( - reinterpret_cast(&last_msg_->signature[35])), - 3) - << "incorrect value for signature[35], expected 3, is " - << last_msg_->signature[35]; - EXPECT_EQ(get_assignature[36])>( - reinterpret_cast(&last_msg_->signature[36])), - 4) - << "incorrect value for signature[36], expected 4, is " - << last_msg_->signature[36]; - EXPECT_EQ(get_assignature[37])>( - reinterpret_cast(&last_msg_->signature[37])), - 5) - << "incorrect value for signature[37], expected 5, is " - << last_msg_->signature[37]; - EXPECT_EQ(get_assignature[38])>( - reinterpret_cast(&last_msg_->signature[38])), - 6) - << "incorrect value for signature[38], expected 6, is " - << last_msg_->signature[38]; - EXPECT_EQ(get_assignature[39])>( - reinterpret_cast(&last_msg_->signature[39])), - 7) - << "incorrect value for signature[39], expected 7, is " - << last_msg_->signature[39]; - EXPECT_EQ(get_assignature[40])>( - reinterpret_cast(&last_msg_->signature[40])), - 0) - << "incorrect value for signature[40], expected 0, is " - << last_msg_->signature[40]; - EXPECT_EQ(get_assignature[41])>( - reinterpret_cast(&last_msg_->signature[41])), - 1) - << "incorrect value for signature[41], expected 1, is " - << last_msg_->signature[41]; - EXPECT_EQ(get_assignature[42])>( - reinterpret_cast(&last_msg_->signature[42])), - 2) - << "incorrect value for signature[42], expected 2, is " - << last_msg_->signature[42]; - EXPECT_EQ(get_assignature[43])>( - reinterpret_cast(&last_msg_->signature[43])), - 3) - << "incorrect value for signature[43], expected 3, is " - << last_msg_->signature[43]; - EXPECT_EQ(get_assignature[44])>( - reinterpret_cast(&last_msg_->signature[44])), - 4) - << "incorrect value for signature[44], expected 4, is " - << last_msg_->signature[44]; - EXPECT_EQ(get_assignature[45])>( - reinterpret_cast(&last_msg_->signature[45])), - 5) - << "incorrect value for signature[45], expected 5, is " - << last_msg_->signature[45]; - EXPECT_EQ(get_assignature[46])>( - reinterpret_cast(&last_msg_->signature[46])), - 6) - << "incorrect value for signature[46], expected 6, is " - << last_msg_->signature[46]; - EXPECT_EQ(get_assignature[47])>( - reinterpret_cast(&last_msg_->signature[47])), - 7) - << "incorrect value for signature[47], expected 7, is " - << last_msg_->signature[47]; - EXPECT_EQ(get_assignature[48])>( - reinterpret_cast(&last_msg_->signature[48])), - 0) - << "incorrect value for signature[48], expected 0, is " - << last_msg_->signature[48]; - EXPECT_EQ(get_assignature[49])>( - reinterpret_cast(&last_msg_->signature[49])), - 1) - << "incorrect value for signature[49], expected 1, is " - << last_msg_->signature[49]; - EXPECT_EQ(get_assignature[50])>( - reinterpret_cast(&last_msg_->signature[50])), - 2) - << "incorrect value for signature[50], expected 2, is " - << last_msg_->signature[50]; - EXPECT_EQ(get_assignature[51])>( - reinterpret_cast(&last_msg_->signature[51])), - 3) - << "incorrect value for signature[51], expected 3, is " - << last_msg_->signature[51]; - EXPECT_EQ(get_assignature[52])>( - reinterpret_cast(&last_msg_->signature[52])), - 4) - << "incorrect value for signature[52], expected 4, is " - << last_msg_->signature[52]; - EXPECT_EQ(get_assignature[53])>( - reinterpret_cast(&last_msg_->signature[53])), - 5) - << "incorrect value for signature[53], expected 5, is " - << last_msg_->signature[53]; - EXPECT_EQ(get_assignature[54])>( - reinterpret_cast(&last_msg_->signature[54])), - 6) - << "incorrect value for signature[54], expected 6, is " - << last_msg_->signature[54]; - EXPECT_EQ(get_assignature[55])>( - reinterpret_cast(&last_msg_->signature[55])), - 7) - << "incorrect value for signature[55], expected 7, is " - << last_msg_->signature[55]; - EXPECT_EQ(get_assignature[56])>( - reinterpret_cast(&last_msg_->signature[56])), - 0) - << "incorrect value for signature[56], expected 0, is " - << last_msg_->signature[56]; - EXPECT_EQ(get_assignature[57])>( - reinterpret_cast(&last_msg_->signature[57])), - 1) - << "incorrect value for signature[57], expected 1, is " - << last_msg_->signature[57]; - EXPECT_EQ(get_assignature[58])>( - reinterpret_cast(&last_msg_->signature[58])), - 2) - << "incorrect value for signature[58], expected 2, is " - << last_msg_->signature[58]; - EXPECT_EQ(get_assignature[59])>( - reinterpret_cast(&last_msg_->signature[59])), - 3) - << "incorrect value for signature[59], expected 3, is " - << last_msg_->signature[59]; - EXPECT_EQ(get_assignature[60])>( - reinterpret_cast(&last_msg_->signature[60])), - 4) - << "incorrect value for signature[60], expected 4, is " - << last_msg_->signature[60]; - EXPECT_EQ(get_assignature[61])>( - reinterpret_cast(&last_msg_->signature[61])), - 5) - << "incorrect value for signature[61], expected 5, is " - << last_msg_->signature[61]; - EXPECT_EQ(get_assignature[62])>( - reinterpret_cast(&last_msg_->signature[62])), - 6) - << "incorrect value for signature[62], expected 6, is " - << last_msg_->signature[62]; - EXPECT_EQ(get_assignature[63])>( - reinterpret_cast(&last_msg_->signature[63])), - 7) - << "incorrect value for signature[63], expected 7, is " - << last_msg_->signature[63]; - EXPECT_EQ( - get_assigned_messages[0])>( - reinterpret_cast(&last_msg_->signed_messages[0])), - 10) - << "incorrect value for signed_messages[0], expected 10, is " - << last_msg_->signed_messages[0]; - EXPECT_EQ( - get_assigned_messages[1])>( - reinterpret_cast(&last_msg_->signed_messages[1])), - 21) - << "incorrect value for signed_messages[1], expected 21, is " - << last_msg_->signed_messages[1]; - EXPECT_EQ( - get_assigned_messages[2])>( - reinterpret_cast(&last_msg_->signed_messages[2])), - 23) - << "incorrect value for signed_messages[2], expected 23, is " - << last_msg_->signed_messages[2]; - EXPECT_EQ( - get_assigned_messages[3])>( - reinterpret_cast(&last_msg_->signed_messages[3])), - 63) - << "incorrect value for signed_messages[3], expected 63, is " - << last_msg_->signed_messages[3]; - EXPECT_EQ( - get_assigned_messages[4])>( - reinterpret_cast(&last_msg_->signed_messages[4])), - 140) - << "incorrect value for signed_messages[4], expected 140, is " - << last_msg_->signed_messages[4]; - EXPECT_EQ( - get_assigned_messages[5])>( - reinterpret_cast(&last_msg_->signed_messages[5])), - 37) - << "incorrect value for signed_messages[5], expected 37, is " - << last_msg_->signed_messages[5]; - EXPECT_EQ( - get_assigned_messages[6])>( - reinterpret_cast(&last_msg_->signed_messages[6])), - 130) - << "incorrect value for signed_messages[6], expected 130, is " - << last_msg_->signed_messages[6]; - EXPECT_EQ( - get_assigned_messages[7])>( - reinterpret_cast(&last_msg_->signed_messages[7])), - 106) - << "incorrect value for signed_messages[7], expected 106, is " - << last_msg_->signed_messages[7]; - EXPECT_EQ( - get_assigned_messages[8])>( - reinterpret_cast(&last_msg_->signed_messages[8])), - 28) - << "incorrect value for signed_messages[8], expected 28, is " - << last_msg_->signed_messages[8]; - EXPECT_EQ( - get_assigned_messages[9])>( - reinterpret_cast(&last_msg_->signed_messages[9])), - 40) - << "incorrect value for signed_messages[9], expected 40, is " - << last_msg_->signed_messages[9]; - EXPECT_EQ( - get_assigned_messages[10])>( - reinterpret_cast(&last_msg_->signed_messages[10])), - 165) - << "incorrect value for signed_messages[10], expected 165, is " - << last_msg_->signed_messages[10]; - EXPECT_EQ( - get_assigned_messages[11])>( - reinterpret_cast(&last_msg_->signed_messages[11])), - 179) - << "incorrect value for signed_messages[11], expected 179, is " - << last_msg_->signed_messages[11]; - EXPECT_EQ( - get_assigned_messages[12])>( - reinterpret_cast(&last_msg_->signed_messages[12])), - 73) - << "incorrect value for signed_messages[12], expected 73, is " - << last_msg_->signed_messages[12]; - EXPECT_EQ( - get_assigned_messages[13])>( - reinterpret_cast(&last_msg_->signed_messages[13])), - 178) - << "incorrect value for signed_messages[13], expected 178, is " - << last_msg_->signed_messages[13]; - EXPECT_EQ( - get_assigned_messages[14])>( - reinterpret_cast(&last_msg_->signed_messages[14])), - 60) - << "incorrect value for signed_messages[14], expected 60, is " - << last_msg_->signed_messages[14]; - EXPECT_EQ( - get_assigned_messages[15])>( - reinterpret_cast(&last_msg_->signed_messages[15])), - 126) - << "incorrect value for signed_messages[15], expected 126, is " - << last_msg_->signed_messages[15]; - EXPECT_EQ( - get_assigned_messages[16])>( - reinterpret_cast(&last_msg_->signed_messages[16])), - 114) - << "incorrect value for signed_messages[16], expected 114, is " - << last_msg_->signed_messages[16]; - EXPECT_EQ( - get_assigned_messages[17])>( - reinterpret_cast(&last_msg_->signed_messages[17])), - 78) - << "incorrect value for signed_messages[17], expected 78, is " - << last_msg_->signed_messages[17]; - EXPECT_EQ( - get_assigned_messages[18])>( - reinterpret_cast(&last_msg_->signed_messages[18])), - 113) - << "incorrect value for signed_messages[18], expected 113, is " - << last_msg_->signed_messages[18]; - EXPECT_EQ( - get_assigned_messages[19])>( - reinterpret_cast(&last_msg_->signed_messages[19])), - 27) - << "incorrect value for signed_messages[19], expected 27, is " - << last_msg_->signed_messages[19]; - EXPECT_EQ( - get_assigned_messages[20])>( - reinterpret_cast(&last_msg_->signed_messages[20])), - 95) - << "incorrect value for signed_messages[20], expected 95, is " - << last_msg_->signed_messages[20]; - EXPECT_EQ( - get_assigned_messages[21])>( - reinterpret_cast(&last_msg_->signed_messages[21])), - 3) - << "incorrect value for signed_messages[21], expected 3, is " - << last_msg_->signed_messages[21]; - EXPECT_EQ( - get_assigned_messages[22])>( - reinterpret_cast(&last_msg_->signed_messages[22])), - 62) - << "incorrect value for signed_messages[22], expected 62, is " - << last_msg_->signed_messages[22]; - EXPECT_EQ( - get_assigned_messages[23])>( - reinterpret_cast(&last_msg_->signed_messages[23])), - 104) - << "incorrect value for signed_messages[23], expected 104, is " - << last_msg_->signed_messages[23]; - EXPECT_EQ( - get_assigned_messages[24])>( - reinterpret_cast(&last_msg_->signed_messages[24])), - 145) - << "incorrect value for signed_messages[24], expected 145, is " - << last_msg_->signed_messages[24]; - EXPECT_EQ( - get_assigned_messages[25])>( - reinterpret_cast(&last_msg_->signed_messages[25])), - 96) - << "incorrect value for signed_messages[25], expected 96, is " - << last_msg_->signed_messages[25]; - EXPECT_EQ( - get_assigned_messages[26])>( - reinterpret_cast(&last_msg_->signed_messages[26])), - 19) - << "incorrect value for signed_messages[26], expected 19, is " - << last_msg_->signed_messages[26]; - EXPECT_EQ( - get_assigned_messages[27])>( - reinterpret_cast(&last_msg_->signed_messages[27])), - 92) - << "incorrect value for signed_messages[27], expected 92, is " - << last_msg_->signed_messages[27]; - EXPECT_EQ( - get_assigned_messages[28])>( - reinterpret_cast(&last_msg_->signed_messages[28])), - 123) - << "incorrect value for signed_messages[28], expected 123, is " - << last_msg_->signed_messages[28]; - EXPECT_EQ( - get_assigned_messages[29])>( - reinterpret_cast(&last_msg_->signed_messages[29])), - 14) - << "incorrect value for signed_messages[29], expected 14, is " - << last_msg_->signed_messages[29]; - EXPECT_EQ( - get_assigned_messages[30])>( - reinterpret_cast(&last_msg_->signed_messages[30])), - 90) - << "incorrect value for signed_messages[30], expected 90, is " - << last_msg_->signed_messages[30]; - EXPECT_EQ( - get_assigned_messages[31])>( - reinterpret_cast(&last_msg_->signed_messages[31])), - 153) - << "incorrect value for signed_messages[31], expected 153, is " - << last_msg_->signed_messages[31]; - EXPECT_EQ( - get_assigned_messages[32])>( - reinterpret_cast(&last_msg_->signed_messages[32])), - 183) - << "incorrect value for signed_messages[32], expected 183, is " - << last_msg_->signed_messages[32]; - EXPECT_EQ( - get_assigned_messages[33])>( - reinterpret_cast(&last_msg_->signed_messages[33])), - 9) - << "incorrect value for signed_messages[33], expected 9, is " - << last_msg_->signed_messages[33]; - EXPECT_EQ( - get_assigned_messages[34])>( - reinterpret_cast(&last_msg_->signed_messages[34])), - 72) - << "incorrect value for signed_messages[34], expected 72, is " - << last_msg_->signed_messages[34]; - EXPECT_EQ( - get_assigned_messages[35])>( - reinterpret_cast(&last_msg_->signed_messages[35])), - 81) - << "incorrect value for signed_messages[35], expected 81, is " - << last_msg_->signed_messages[35]; - EXPECT_EQ( - get_assigned_messages[36])>( - reinterpret_cast(&last_msg_->signed_messages[36])), - 118) - << "incorrect value for signed_messages[36], expected 118, is " - << last_msg_->signed_messages[36]; - EXPECT_EQ( - get_assigned_messages[37])>( - reinterpret_cast(&last_msg_->signed_messages[37])), - 112) - << "incorrect value for signed_messages[37], expected 112, is " - << last_msg_->signed_messages[37]; - EXPECT_EQ( - get_assigned_messages[38])>( - reinterpret_cast(&last_msg_->signed_messages[38])), - 124) - << "incorrect value for signed_messages[38], expected 124, is " - << last_msg_->signed_messages[38]; - EXPECT_EQ( - get_assigned_messages[39])>( - reinterpret_cast(&last_msg_->signed_messages[39])), - 16) - << "incorrect value for signed_messages[39], expected 16, is " - << last_msg_->signed_messages[39]; - EXPECT_EQ( - get_assigned_messages[40])>( - reinterpret_cast(&last_msg_->signed_messages[40])), - 182) - << "incorrect value for signed_messages[40], expected 182, is " - << last_msg_->signed_messages[40]; - EXPECT_EQ( - get_assigned_messages[41])>( - reinterpret_cast(&last_msg_->signed_messages[41])), - 76) - << "incorrect value for signed_messages[41], expected 76, is " - << last_msg_->signed_messages[41]; - EXPECT_EQ( - get_assigned_messages[42])>( - reinterpret_cast(&last_msg_->signed_messages[42])), - 146) - << "incorrect value for signed_messages[42], expected 146, is " - << last_msg_->signed_messages[42]; - EXPECT_EQ( - get_assigned_messages[43])>( - reinterpret_cast(&last_msg_->signed_messages[43])), - 115) - << "incorrect value for signed_messages[43], expected 115, is " - << last_msg_->signed_messages[43]; - EXPECT_EQ( - get_assigned_messages[44])>( - reinterpret_cast(&last_msg_->signed_messages[44])), - 58) - << "incorrect value for signed_messages[44], expected 58, is " - << last_msg_->signed_messages[44]; - EXPECT_EQ( - get_assigned_messages[45])>( - reinterpret_cast(&last_msg_->signed_messages[45])), - 144) - << "incorrect value for signed_messages[45], expected 144, is " - << last_msg_->signed_messages[45]; - EXPECT_EQ( - get_assigned_messages[46])>( - reinterpret_cast(&last_msg_->signed_messages[46])), - 17) - << "incorrect value for signed_messages[46], expected 17, is " - << last_msg_->signed_messages[46]; - EXPECT_EQ( - get_assigned_messages[47])>( - reinterpret_cast(&last_msg_->signed_messages[47])), - 105) - << "incorrect value for signed_messages[47], expected 105, is " - << last_msg_->signed_messages[47]; - EXPECT_EQ( - get_assigned_messages[48])>( - reinterpret_cast(&last_msg_->signed_messages[48])), - 66) - << "incorrect value for signed_messages[48], expected 66, is " - << last_msg_->signed_messages[48]; - EXPECT_EQ( - get_assigned_messages[49])>( - reinterpret_cast(&last_msg_->signed_messages[49])), - 31) - << "incorrect value for signed_messages[49], expected 31, is " - << last_msg_->signed_messages[49]; - EXPECT_EQ( - get_assigned_messages[50])>( - reinterpret_cast(&last_msg_->signed_messages[50])), - 135) - << "incorrect value for signed_messages[50], expected 135, is " - << last_msg_->signed_messages[50]; - EXPECT_EQ( - get_assigned_messages[51])>( - reinterpret_cast(&last_msg_->signed_messages[51])), - 54) - << "incorrect value for signed_messages[51], expected 54, is " - << last_msg_->signed_messages[51]; - EXPECT_EQ( - get_assigned_messages[52])>( - reinterpret_cast(&last_msg_->signed_messages[52])), - 100) - << "incorrect value for signed_messages[52], expected 100, is " - << last_msg_->signed_messages[52]; - EXPECT_EQ( - get_assigned_messages[53])>( - reinterpret_cast(&last_msg_->signed_messages[53])), - 84) - << "incorrect value for signed_messages[53], expected 84, is " - << last_msg_->signed_messages[53]; - EXPECT_EQ( - get_assigned_messages[54])>( - reinterpret_cast(&last_msg_->signed_messages[54])), - 181) - << "incorrect value for signed_messages[54], expected 181, is " - << last_msg_->signed_messages[54]; - EXPECT_EQ( - get_assigned_messages[55])>( - reinterpret_cast(&last_msg_->signed_messages[55])), - 103) - << "incorrect value for signed_messages[55], expected 103, is " - << last_msg_->signed_messages[55]; - EXPECT_EQ( - get_assigned_messages[56])>( - reinterpret_cast(&last_msg_->signed_messages[56])), - 11) - << "incorrect value for signed_messages[56], expected 11, is " - << last_msg_->signed_messages[56]; - EXPECT_EQ( - get_assigned_messages[57])>( - reinterpret_cast(&last_msg_->signed_messages[57])), - 88) - << "incorrect value for signed_messages[57], expected 88, is " - << last_msg_->signed_messages[57]; - EXPECT_EQ( - get_assigned_messages[58])>( - reinterpret_cast(&last_msg_->signed_messages[58])), - 133) - << "incorrect value for signed_messages[58], expected 133, is " - << last_msg_->signed_messages[58]; - EXPECT_EQ( - get_assigned_messages[59])>( - reinterpret_cast(&last_msg_->signed_messages[59])), - 155) - << "incorrect value for signed_messages[59], expected 155, is " - << last_msg_->signed_messages[59]; - EXPECT_EQ( - get_assigned_messages[60])>( - reinterpret_cast(&last_msg_->signed_messages[60])), - 167) - << "incorrect value for signed_messages[60], expected 167, is " - << last_msg_->signed_messages[60]; - EXPECT_EQ( - get_assigned_messages[61])>( - reinterpret_cast(&last_msg_->signed_messages[61])), - 173) - << "incorrect value for signed_messages[61], expected 173, is " - << last_msg_->signed_messages[61]; - EXPECT_EQ( - get_assigned_messages[62])>( - reinterpret_cast(&last_msg_->signed_messages[62])), - 143) - << "incorrect value for signed_messages[62], expected 143, is " - << last_msg_->signed_messages[62]; - EXPECT_EQ( - get_assigned_messages[63])>( - reinterpret_cast(&last_msg_->signed_messages[63])), - 86) - << "incorrect value for signed_messages[63], expected 86, is " - << last_msg_->signed_messages[63]; - EXPECT_EQ( - get_assigned_messages[64])>( - reinterpret_cast(&last_msg_->signed_messages[64])), - 158) - << "incorrect value for signed_messages[64], expected 158, is " - << last_msg_->signed_messages[64]; - EXPECT_EQ( - get_assigned_messages[65])>( - reinterpret_cast(&last_msg_->signed_messages[65])), - 20) - << "incorrect value for signed_messages[65], expected 20, is " - << last_msg_->signed_messages[65]; - EXPECT_EQ( - get_assigned_messages[66])>( - reinterpret_cast(&last_msg_->signed_messages[66])), - 168) - << "incorrect value for signed_messages[66], expected 168, is " - << last_msg_->signed_messages[66]; - EXPECT_EQ( - get_assigned_messages[67])>( - reinterpret_cast(&last_msg_->signed_messages[67])), - 132) - << "incorrect value for signed_messages[67], expected 132, is " - << last_msg_->signed_messages[67]; - EXPECT_EQ( - get_assigned_messages[68])>( - reinterpret_cast(&last_msg_->signed_messages[68])), - 141) - << "incorrect value for signed_messages[68], expected 141, is " - << last_msg_->signed_messages[68]; - EXPECT_EQ( - get_assigned_messages[69])>( - reinterpret_cast(&last_msg_->signed_messages[69])), - 102) - << "incorrect value for signed_messages[69], expected 102, is " - << last_msg_->signed_messages[69]; - EXPECT_EQ( - get_assigned_messages[70])>( - reinterpret_cast(&last_msg_->signed_messages[70])), - 50) - << "incorrect value for signed_messages[70], expected 50, is " - << last_msg_->signed_messages[70]; - EXPECT_EQ( - get_assigned_messages[71])>( - reinterpret_cast(&last_msg_->signed_messages[71])), - 48) - << "incorrect value for signed_messages[71], expected 48, is " - << last_msg_->signed_messages[71]; - EXPECT_EQ( - get_assigned_messages[72])>( - reinterpret_cast(&last_msg_->signed_messages[72])), - 71) - << "incorrect value for signed_messages[72], expected 71, is " - << last_msg_->signed_messages[72]; - EXPECT_EQ( - get_assigned_messages[73])>( - reinterpret_cast(&last_msg_->signed_messages[73])), - 147) - << "incorrect value for signed_messages[73], expected 147, is " - << last_msg_->signed_messages[73]; - EXPECT_EQ( - get_assigned_messages[74])>( - reinterpret_cast(&last_msg_->signed_messages[74])), - 53) - << "incorrect value for signed_messages[74], expected 53, is " - << last_msg_->signed_messages[74]; - EXPECT_EQ( - get_assigned_messages[75])>( - reinterpret_cast(&last_msg_->signed_messages[75])), - 87) - << "incorrect value for signed_messages[75], expected 87, is " - << last_msg_->signed_messages[75]; - EXPECT_EQ( - get_assigned_messages[76])>( - reinterpret_cast(&last_msg_->signed_messages[76])), - 1) - << "incorrect value for signed_messages[76], expected 1, is " - << last_msg_->signed_messages[76]; - EXPECT_EQ( - get_assigned_messages[77])>( - reinterpret_cast(&last_msg_->signed_messages[77])), - 108) - << "incorrect value for signed_messages[77], expected 108, is " - << last_msg_->signed_messages[77]; - EXPECT_EQ( - get_assigned_messages[78])>( - reinterpret_cast(&last_msg_->signed_messages[78])), - 138) - << "incorrect value for signed_messages[78], expected 138, is " - << last_msg_->signed_messages[78]; - EXPECT_EQ( - get_assigned_messages[79])>( - reinterpret_cast(&last_msg_->signed_messages[79])), - 36) - << "incorrect value for signed_messages[79], expected 36, is " - << last_msg_->signed_messages[79]; - EXPECT_EQ( - get_assigned_messages[80])>( - reinterpret_cast(&last_msg_->signed_messages[80])), - 134) - << "incorrect value for signed_messages[80], expected 134, is " - << last_msg_->signed_messages[80]; - EXPECT_EQ( - get_assigned_messages[81])>( - reinterpret_cast(&last_msg_->signed_messages[81])), - 139) - << "incorrect value for signed_messages[81], expected 139, is " - << last_msg_->signed_messages[81]; - EXPECT_EQ( - get_assigned_messages[82])>( - reinterpret_cast(&last_msg_->signed_messages[82])), - 163) - << "incorrect value for signed_messages[82], expected 163, is " - << last_msg_->signed_messages[82]; - EXPECT_EQ( - get_assigned_messages[83])>( - reinterpret_cast(&last_msg_->signed_messages[83])), - 82) - << "incorrect value for signed_messages[83], expected 82, is " - << last_msg_->signed_messages[83]; - EXPECT_EQ( - get_assigned_messages[84])>( - reinterpret_cast(&last_msg_->signed_messages[84])), - 43) - << "incorrect value for signed_messages[84], expected 43, is " - << last_msg_->signed_messages[84]; - EXPECT_EQ( - get_assigned_messages[85])>( - reinterpret_cast(&last_msg_->signed_messages[85])), - 52) - << "incorrect value for signed_messages[85], expected 52, is " - << last_msg_->signed_messages[85]; - EXPECT_EQ( - get_assigned_messages[86])>( - reinterpret_cast(&last_msg_->signed_messages[86])), - 150) - << "incorrect value for signed_messages[86], expected 150, is " - << last_msg_->signed_messages[86]; - EXPECT_EQ( - get_assigned_messages[87])>( - reinterpret_cast(&last_msg_->signed_messages[87])), - 12) - << "incorrect value for signed_messages[87], expected 12, is " - << last_msg_->signed_messages[87]; - EXPECT_EQ( - get_assigned_messages[88])>( - reinterpret_cast(&last_msg_->signed_messages[88])), - 30) - << "incorrect value for signed_messages[88], expected 30, is " - << last_msg_->signed_messages[88]; - EXPECT_EQ( - get_assigned_messages[89])>( - reinterpret_cast(&last_msg_->signed_messages[89])), - 110) - << "incorrect value for signed_messages[89], expected 110, is " - << last_msg_->signed_messages[89]; - EXPECT_EQ( - get_assigned_messages[90])>( - reinterpret_cast(&last_msg_->signed_messages[90])), - 156) - << "incorrect value for signed_messages[90], expected 156, is " - << last_msg_->signed_messages[90]; - EXPECT_EQ( - get_assigned_messages[91])>( - reinterpret_cast(&last_msg_->signed_messages[91])), - 107) - << "incorrect value for signed_messages[91], expected 107, is " - << last_msg_->signed_messages[91]; - EXPECT_EQ( - get_assigned_messages[92])>( - reinterpret_cast(&last_msg_->signed_messages[92])), - 120) - << "incorrect value for signed_messages[92], expected 120, is " - << last_msg_->signed_messages[92]; - EXPECT_EQ( - get_assigned_messages[93])>( - reinterpret_cast(&last_msg_->signed_messages[93])), - 91) - << "incorrect value for signed_messages[93], expected 91, is " - << last_msg_->signed_messages[93]; - EXPECT_EQ( - get_assigned_messages[94])>( - reinterpret_cast(&last_msg_->signed_messages[94])), - 122) - << "incorrect value for signed_messages[94], expected 122, is " - << last_msg_->signed_messages[94]; - EXPECT_EQ( - get_assigned_messages[95])>( - reinterpret_cast(&last_msg_->signed_messages[95])), - 69) - << "incorrect value for signed_messages[95], expected 69, is " - << last_msg_->signed_messages[95]; - EXPECT_EQ( - get_assigned_messages[96])>( - reinterpret_cast(&last_msg_->signed_messages[96])), - 164) - << "incorrect value for signed_messages[96], expected 164, is " - << last_msg_->signed_messages[96]; - EXPECT_EQ( - get_assigned_messages[97])>( - reinterpret_cast(&last_msg_->signed_messages[97])), - 170) - << "incorrect value for signed_messages[97], expected 170, is " - << last_msg_->signed_messages[97]; - EXPECT_EQ( - get_assigned_messages[98])>( - reinterpret_cast(&last_msg_->signed_messages[98])), - 116) - << "incorrect value for signed_messages[98], expected 116, is " - << last_msg_->signed_messages[98]; - EXPECT_EQ( - get_assigned_messages[99])>( - reinterpret_cast(&last_msg_->signed_messages[99])), - 25) - << "incorrect value for signed_messages[99], expected 25, is " - << last_msg_->signed_messages[99]; - EXPECT_EQ( - get_assigned_messages[100])>( - reinterpret_cast(&last_msg_->signed_messages[100])), - 94) - << "incorrect value for signed_messages[100], expected 94, is " - << last_msg_->signed_messages[100]; - EXPECT_EQ( - get_assigned_messages[101])>( - reinterpret_cast(&last_msg_->signed_messages[101])), - 5) - << "incorrect value for signed_messages[101], expected 5, is " - << last_msg_->signed_messages[101]; - EXPECT_EQ( - get_assigned_messages[102])>( - reinterpret_cast(&last_msg_->signed_messages[102])), - 22) - << "incorrect value for signed_messages[102], expected 22, is " - << last_msg_->signed_messages[102]; - EXPECT_EQ( - get_assigned_messages[103])>( - reinterpret_cast(&last_msg_->signed_messages[103])), - 24) - << "incorrect value for signed_messages[103], expected 24, is " - << last_msg_->signed_messages[103]; - EXPECT_EQ( - get_assigned_messages[104])>( - reinterpret_cast(&last_msg_->signed_messages[104])), - 162) - << "incorrect value for signed_messages[104], expected 162, is " - << last_msg_->signed_messages[104]; - EXPECT_EQ( - get_assigned_messages[105])>( - reinterpret_cast(&last_msg_->signed_messages[105])), - 175) - << "incorrect value for signed_messages[105], expected 175, is " - << last_msg_->signed_messages[105]; - EXPECT_EQ( - get_assigned_messages[106])>( - reinterpret_cast(&last_msg_->signed_messages[106])), - 38) - << "incorrect value for signed_messages[106], expected 38, is " - << last_msg_->signed_messages[106]; - EXPECT_EQ( - get_assigned_messages[107])>( - reinterpret_cast(&last_msg_->signed_messages[107])), - 157) - << "incorrect value for signed_messages[107], expected 157, is " - << last_msg_->signed_messages[107]; - EXPECT_EQ( - get_assigned_messages[108])>( - reinterpret_cast(&last_msg_->signed_messages[108])), - 98) - << "incorrect value for signed_messages[108], expected 98, is " - << last_msg_->signed_messages[108]; - EXPECT_EQ( - get_assigned_messages[109])>( - reinterpret_cast(&last_msg_->signed_messages[109])), - 44) - << "incorrect value for signed_messages[109], expected 44, is " - << last_msg_->signed_messages[109]; - EXPECT_EQ( - get_assigned_messages[110])>( - reinterpret_cast(&last_msg_->signed_messages[110])), - 160) - << "incorrect value for signed_messages[110], expected 160, is " - << last_msg_->signed_messages[110]; - EXPECT_EQ( - get_assigned_messages[111])>( - reinterpret_cast(&last_msg_->signed_messages[111])), - 47) - << "incorrect value for signed_messages[111], expected 47, is " - << last_msg_->signed_messages[111]; - EXPECT_EQ( - get_assigned_messages[112])>( - reinterpret_cast(&last_msg_->signed_messages[112])), - 97) - << "incorrect value for signed_messages[112], expected 97, is " - << last_msg_->signed_messages[112]; - EXPECT_EQ( - get_assigned_messages[113])>( - reinterpret_cast(&last_msg_->signed_messages[113])), - 142) - << "incorrect value for signed_messages[113], expected 142, is " - << last_msg_->signed_messages[113]; - EXPECT_EQ( - get_assigned_messages[114])>( - reinterpret_cast(&last_msg_->signed_messages[114])), - 8) - << "incorrect value for signed_messages[114], expected 8, is " - << last_msg_->signed_messages[114]; - EXPECT_EQ( - get_assigned_messages[115])>( - reinterpret_cast(&last_msg_->signed_messages[115])), - 74) - << "incorrect value for signed_messages[115], expected 74, is " - << last_msg_->signed_messages[115]; - EXPECT_EQ( - get_assigned_messages[116])>( - reinterpret_cast(&last_msg_->signed_messages[116])), - 13) - << "incorrect value for signed_messages[116], expected 13, is " - << last_msg_->signed_messages[116]; - EXPECT_EQ( - get_assigned_messages[117])>( - reinterpret_cast(&last_msg_->signed_messages[117])), - 177) - << "incorrect value for signed_messages[117], expected 177, is " - << last_msg_->signed_messages[117]; - EXPECT_EQ( - get_assigned_messages[118])>( - reinterpret_cast(&last_msg_->signed_messages[118])), - 15) - << "incorrect value for signed_messages[118], expected 15, is " - << last_msg_->signed_messages[118]; - EXPECT_EQ( - get_assigned_messages[119])>( - reinterpret_cast(&last_msg_->signed_messages[119])), - 128) - << "incorrect value for signed_messages[119], expected 128, is " - << last_msg_->signed_messages[119]; - EXPECT_EQ( - get_assigned_messages[120])>( - reinterpret_cast(&last_msg_->signed_messages[120])), - 26) - << "incorrect value for signed_messages[120], expected 26, is " - << last_msg_->signed_messages[120]; - EXPECT_EQ( - get_assigned_messages[121])>( - reinterpret_cast(&last_msg_->signed_messages[121])), - 131) - << "incorrect value for signed_messages[121], expected 131, is " - << last_msg_->signed_messages[121]; - EXPECT_EQ( - get_assigned_messages[122])>( - reinterpret_cast(&last_msg_->signed_messages[122])), - 154) - << "incorrect value for signed_messages[122], expected 154, is " - << last_msg_->signed_messages[122]; - EXPECT_EQ( - get_assigned_messages[123])>( - reinterpret_cast(&last_msg_->signed_messages[123])), - 65) - << "incorrect value for signed_messages[123], expected 65, is " - << last_msg_->signed_messages[123]; - EXPECT_EQ( - get_assigned_messages[124])>( - reinterpret_cast(&last_msg_->signed_messages[124])), - 169) - << "incorrect value for signed_messages[124], expected 169, is " - << last_msg_->signed_messages[124]; - EXPECT_EQ( - get_assigned_messages[125])>( - reinterpret_cast(&last_msg_->signed_messages[125])), - 55) - << "incorrect value for signed_messages[125], expected 55, is " - << last_msg_->signed_messages[125]; - EXPECT_EQ( - get_assigned_messages[126])>( - reinterpret_cast(&last_msg_->signed_messages[126])), - 136) - << "incorrect value for signed_messages[126], expected 136, is " - << last_msg_->signed_messages[126]; - EXPECT_EQ( - get_assigned_messages[127])>( - reinterpret_cast(&last_msg_->signed_messages[127])), - 125) - << "incorrect value for signed_messages[127], expected 125, is " - << last_msg_->signed_messages[127]; - EXPECT_EQ( - get_assigned_messages[128])>( - reinterpret_cast(&last_msg_->signed_messages[128])), - 171) - << "incorrect value for signed_messages[128], expected 171, is " - << last_msg_->signed_messages[128]; - EXPECT_EQ( - get_assigned_messages[129])>( - reinterpret_cast(&last_msg_->signed_messages[129])), - 161) - << "incorrect value for signed_messages[129], expected 161, is " - << last_msg_->signed_messages[129]; - EXPECT_EQ( - get_assigned_messages[130])>( - reinterpret_cast(&last_msg_->signed_messages[130])), - 29) - << "incorrect value for signed_messages[130], expected 29, is " - << last_msg_->signed_messages[130]; - EXPECT_EQ( - get_assigned_messages[131])>( - reinterpret_cast(&last_msg_->signed_messages[131])), - 129) - << "incorrect value for signed_messages[131], expected 129, is " - << last_msg_->signed_messages[131]; - EXPECT_EQ( - get_assigned_messages[132])>( - reinterpret_cast(&last_msg_->signed_messages[132])), - 151) - << "incorrect value for signed_messages[132], expected 151, is " - << last_msg_->signed_messages[132]; - EXPECT_EQ( - get_assigned_messages[133])>( - reinterpret_cast(&last_msg_->signed_messages[133])), - 68) - << "incorrect value for signed_messages[133], expected 68, is " - << last_msg_->signed_messages[133]; - EXPECT_EQ( - get_assigned_messages[134])>( - reinterpret_cast(&last_msg_->signed_messages[134])), - 166) - << "incorrect value for signed_messages[134], expected 166, is " - << last_msg_->signed_messages[134]; - EXPECT_EQ( - get_assigned_messages[135])>( - reinterpret_cast(&last_msg_->signed_messages[135])), - 51) - << "incorrect value for signed_messages[135], expected 51, is " - << last_msg_->signed_messages[135]; - EXPECT_EQ( - get_assigned_messages[136])>( - reinterpret_cast(&last_msg_->signed_messages[136])), - 70) - << "incorrect value for signed_messages[136], expected 70, is " - << last_msg_->signed_messages[136]; - EXPECT_EQ( - get_assigned_messages[137])>( - reinterpret_cast(&last_msg_->signed_messages[137])), - 45) - << "incorrect value for signed_messages[137], expected 45, is " - << last_msg_->signed_messages[137]; - EXPECT_EQ( - get_assigned_messages[138])>( - reinterpret_cast(&last_msg_->signed_messages[138])), - 56) - << "incorrect value for signed_messages[138], expected 56, is " - << last_msg_->signed_messages[138]; - EXPECT_EQ( - get_assigned_messages[139])>( - reinterpret_cast(&last_msg_->signed_messages[139])), - 79) - << "incorrect value for signed_messages[139], expected 79, is " - << last_msg_->signed_messages[139]; - EXPECT_EQ( - get_assigned_messages[140])>( - reinterpret_cast(&last_msg_->signed_messages[140])), - 149) - << "incorrect value for signed_messages[140], expected 149, is " - << last_msg_->signed_messages[140]; - EXPECT_EQ( - get_assigned_messages[141])>( - reinterpret_cast(&last_msg_->signed_messages[141])), - 99) - << "incorrect value for signed_messages[141], expected 99, is " - << last_msg_->signed_messages[141]; - EXPECT_EQ( - get_assigned_messages[142])>( - reinterpret_cast(&last_msg_->signed_messages[142])), - 42) - << "incorrect value for signed_messages[142], expected 42, is " - << last_msg_->signed_messages[142]; - EXPECT_EQ( - get_assigned_messages[143])>( - reinterpret_cast(&last_msg_->signed_messages[143])), - 101) - << "incorrect value for signed_messages[143], expected 101, is " - << last_msg_->signed_messages[143]; - EXPECT_EQ( - get_assigned_messages[144])>( - reinterpret_cast(&last_msg_->signed_messages[144])), - 152) - << "incorrect value for signed_messages[144], expected 152, is " - << last_msg_->signed_messages[144]; - EXPECT_EQ( - get_assigned_messages[145])>( - reinterpret_cast(&last_msg_->signed_messages[145])), - 39) - << "incorrect value for signed_messages[145], expected 39, is " - << last_msg_->signed_messages[145]; - EXPECT_EQ( - get_assigned_messages[146])>( - reinterpret_cast(&last_msg_->signed_messages[146])), - 89) - << "incorrect value for signed_messages[146], expected 89, is " - << last_msg_->signed_messages[146]; - EXPECT_EQ( - get_assigned_messages[147])>( - reinterpret_cast(&last_msg_->signed_messages[147])), - 180) - << "incorrect value for signed_messages[147], expected 180, is " - << last_msg_->signed_messages[147]; - EXPECT_EQ( - get_assigned_messages[148])>( - reinterpret_cast(&last_msg_->signed_messages[148])), - 64) - << "incorrect value for signed_messages[148], expected 64, is " - << last_msg_->signed_messages[148]; - EXPECT_EQ( - get_assigned_messages[149])>( - reinterpret_cast(&last_msg_->signed_messages[149])), - 49) - << "incorrect value for signed_messages[149], expected 49, is " - << last_msg_->signed_messages[149]; - EXPECT_EQ( - get_assigned_messages[150])>( - reinterpret_cast(&last_msg_->signed_messages[150])), - 6) - << "incorrect value for signed_messages[150], expected 6, is " - << last_msg_->signed_messages[150]; - EXPECT_EQ( - get_assigned_messages[151])>( - reinterpret_cast(&last_msg_->signed_messages[151])), - 80) - << "incorrect value for signed_messages[151], expected 80, is " - << last_msg_->signed_messages[151]; - EXPECT_EQ( - get_assigned_messages[152])>( - reinterpret_cast(&last_msg_->signed_messages[152])), - 172) - << "incorrect value for signed_messages[152], expected 172, is " - << last_msg_->signed_messages[152]; - EXPECT_EQ( - get_assigned_messages[153])>( - reinterpret_cast(&last_msg_->signed_messages[153])), - 32) - << "incorrect value for signed_messages[153], expected 32, is " - << last_msg_->signed_messages[153]; - EXPECT_EQ( - get_assigned_messages[154])>( - reinterpret_cast(&last_msg_->signed_messages[154])), - 109) - << "incorrect value for signed_messages[154], expected 109, is " - << last_msg_->signed_messages[154]; - EXPECT_EQ( - get_assigned_messages[155])>( - reinterpret_cast(&last_msg_->signed_messages[155])), - 2) - << "incorrect value for signed_messages[155], expected 2, is " - << last_msg_->signed_messages[155]; - EXPECT_EQ( - get_assigned_messages[156])>( - reinterpret_cast(&last_msg_->signed_messages[156])), - 119) - << "incorrect value for signed_messages[156], expected 119, is " - << last_msg_->signed_messages[156]; - EXPECT_EQ( - get_assigned_messages[157])>( - reinterpret_cast(&last_msg_->signed_messages[157])), - 93) - << "incorrect value for signed_messages[157], expected 93, is " - << last_msg_->signed_messages[157]; - EXPECT_EQ( - get_assigned_messages[158])>( - reinterpret_cast(&last_msg_->signed_messages[158])), - 176) - << "incorrect value for signed_messages[158], expected 176, is " - << last_msg_->signed_messages[158]; - EXPECT_EQ( - get_assigned_messages[159])>( - reinterpret_cast(&last_msg_->signed_messages[159])), - 0) - << "incorrect value for signed_messages[159], expected 0, is " - << last_msg_->signed_messages[159]; - EXPECT_EQ( - get_assigned_messages[160])>( - reinterpret_cast(&last_msg_->signed_messages[160])), - 33) - << "incorrect value for signed_messages[160], expected 33, is " - << last_msg_->signed_messages[160]; - EXPECT_EQ( - get_assigned_messages[161])>( - reinterpret_cast(&last_msg_->signed_messages[161])), - 57) - << "incorrect value for signed_messages[161], expected 57, is " - << last_msg_->signed_messages[161]; - EXPECT_EQ( - get_assigned_messages[162])>( - reinterpret_cast(&last_msg_->signed_messages[162])), - 34) - << "incorrect value for signed_messages[162], expected 34, is " - << last_msg_->signed_messages[162]; - EXPECT_EQ( - get_assigned_messages[163])>( - reinterpret_cast(&last_msg_->signed_messages[163])), - 18) - << "incorrect value for signed_messages[163], expected 18, is " - << last_msg_->signed_messages[163]; - EXPECT_EQ( - get_assigned_messages[164])>( - reinterpret_cast(&last_msg_->signed_messages[164])), - 85) - << "incorrect value for signed_messages[164], expected 85, is " - << last_msg_->signed_messages[164]; - EXPECT_EQ( - get_assigned_messages[165])>( - reinterpret_cast(&last_msg_->signed_messages[165])), - 121) - << "incorrect value for signed_messages[165], expected 121, is " - << last_msg_->signed_messages[165]; - EXPECT_EQ( - get_assigned_messages[166])>( - reinterpret_cast(&last_msg_->signed_messages[166])), - 137) - << "incorrect value for signed_messages[166], expected 137, is " - << last_msg_->signed_messages[166]; - EXPECT_EQ( - get_assigned_messages[167])>( - reinterpret_cast(&last_msg_->signed_messages[167])), - 83) - << "incorrect value for signed_messages[167], expected 83, is " - << last_msg_->signed_messages[167]; - EXPECT_EQ( - get_assigned_messages[168])>( - reinterpret_cast(&last_msg_->signed_messages[168])), - 111) - << "incorrect value for signed_messages[168], expected 111, is " - << last_msg_->signed_messages[168]; - EXPECT_EQ( - get_assigned_messages[169])>( - reinterpret_cast(&last_msg_->signed_messages[169])), - 59) - << "incorrect value for signed_messages[169], expected 59, is " - << last_msg_->signed_messages[169]; - EXPECT_EQ( - get_assigned_messages[170])>( - reinterpret_cast(&last_msg_->signed_messages[170])), - 7) - << "incorrect value for signed_messages[170], expected 7, is " - << last_msg_->signed_messages[170]; - EXPECT_EQ( - get_assigned_messages[171])>( - reinterpret_cast(&last_msg_->signed_messages[171])), - 77) - << "incorrect value for signed_messages[171], expected 77, is " - << last_msg_->signed_messages[171]; - EXPECT_EQ( - get_assigned_messages[172])>( - reinterpret_cast(&last_msg_->signed_messages[172])), - 4) - << "incorrect value for signed_messages[172], expected 4, is " - << last_msg_->signed_messages[172]; - EXPECT_EQ( - get_assigned_messages[173])>( - reinterpret_cast(&last_msg_->signed_messages[173])), - 117) - << "incorrect value for signed_messages[173], expected 117, is " - << last_msg_->signed_messages[173]; - EXPECT_EQ( - get_assigned_messages[174])>( - reinterpret_cast(&last_msg_->signed_messages[174])), - 159) - << "incorrect value for signed_messages[174], expected 159, is " - << last_msg_->signed_messages[174]; - EXPECT_EQ( - get_assigned_messages[175])>( - reinterpret_cast(&last_msg_->signed_messages[175])), - 148) - << "incorrect value for signed_messages[175], expected 148, is " - << last_msg_->signed_messages[175]; - EXPECT_EQ( - get_assigned_messages[176])>( - reinterpret_cast(&last_msg_->signed_messages[176])), - 35) - << "incorrect value for signed_messages[176], expected 35, is " - << last_msg_->signed_messages[176]; - EXPECT_EQ( - get_assigned_messages[177])>( - reinterpret_cast(&last_msg_->signed_messages[177])), - 61) - << "incorrect value for signed_messages[177], expected 61, is " - << last_msg_->signed_messages[177]; - EXPECT_EQ( - get_assigned_messages[178])>( - reinterpret_cast(&last_msg_->signed_messages[178])), - 41) - << "incorrect value for signed_messages[178], expected 41, is " - << last_msg_->signed_messages[178]; - EXPECT_EQ( - get_assigned_messages[179])>( - reinterpret_cast(&last_msg_->signed_messages[179])), - 67) - << "incorrect value for signed_messages[179], expected 67, is " - << last_msg_->signed_messages[179]; - EXPECT_EQ( - get_assigned_messages[180])>( - reinterpret_cast(&last_msg_->signed_messages[180])), - 46) - << "incorrect value for signed_messages[180], expected 46, is " - << last_msg_->signed_messages[180]; - EXPECT_EQ( - get_assigned_messages[181])>( - reinterpret_cast(&last_msg_->signed_messages[181])), - 127) - << "incorrect value for signed_messages[181], expected 127, is " - << last_msg_->signed_messages[181]; - EXPECT_EQ( - get_assigned_messages[182])>( - reinterpret_cast(&last_msg_->signed_messages[182])), - 75) - << "incorrect value for signed_messages[182], expected 75, is " - << last_msg_->signed_messages[182]; - EXPECT_EQ( - get_assigned_messages[183])>( - reinterpret_cast(&last_msg_->signed_messages[183])), - 174) - << "incorrect value for signed_messages[183], expected 174, is " - << last_msg_->signed_messages[183]; - EXPECT_EQ(get_asstream_counter)>( - reinterpret_cast(&last_msg_->stream_counter)), - 1) - << "incorrect value for stream_counter, expected 1, is " - << last_msg_->stream_counter; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_signing_MsgEcdsaSignatureDepB.cc b/c/test/legacy/cpp/auto_check_sbp_signing_MsgEcdsaSignatureDepB.cc deleted file mode 100644 index 6eb70af1a9..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_signing_MsgEcdsaSignatureDepB.cc +++ /dev/null @@ -1,955 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgEcdsaSignatureDepB.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepB0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepB0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ecdsa_signature_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ecdsa_signature_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_signing_MsgEcdsaSignatureDepB0, Test) { - uint8_t encoded_frame[] = { - 85, 7, 12, 66, 0, 83, 0, 1, 2, 1, 2, 3, 4, 72, 0, 1, - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 10, 21, 23, 254, 159, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ecdsa_signature_dep_b_t *test_msg = - (msg_ecdsa_signature_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_id[0])); - } - test_msg->certificate_id[0] = 1; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_id[0])); - } - test_msg->certificate_id[1] = 2; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_id[0])); - } - test_msg->certificate_id[2] = 3; - if (sizeof(test_msg->certificate_id) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_id[0])); - } - test_msg->certificate_id[3] = 4; - test_msg->flags = 0; - test_msg->n_signature_bytes = 72; - test_msg->on_demand_counter = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[0] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[1] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[2] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[3] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[4] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[5] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[6] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[7] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[8] = 8; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[9] = 9; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[10] = 10; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[11] = 11; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[12] = 12; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[13] = 13; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[14] = 14; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[15] = 15; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[16] = 16; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[17] = 17; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[18] = 18; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[19] = 19; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[20] = 20; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[21] = 21; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[22] = 22; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[23] = 23; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[24] = 24; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[25] = 25; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[26] = 26; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[27] = 27; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[28] = 28; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[29] = 29; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[30] = 30; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[31] = 31; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[32] = 32; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[33] = 33; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[34] = 34; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[35] = 35; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[36] = 36; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[37] = 37; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[38] = 38; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[39] = 39; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[40] = 40; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[41] = 41; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[42] = 42; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[43] = 43; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[44] = 44; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[45] = 45; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[46] = 46; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[47] = 47; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[48] = 48; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[49] = 49; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[50] = 50; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[51] = 51; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[52] = 52; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[53] = 53; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[54] = 54; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[55] = 55; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[56] = 56; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[57] = 57; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[58] = 58; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[59] = 59; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[60] = 60; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[61] = 61; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[62] = 62; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[63] = 63; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[64] = 64; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[65] = 65; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[66] = 66; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[67] = 67; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[68] = 68; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[69] = 69; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[70] = 70; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[71] = 71; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[0] = 10; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[1] = 21; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[2] = 23; - test_msg->stream_counter = 1; - - EXPECT_EQ(send_message(0xC07, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ( - get_ascertificate_id[0])>( - reinterpret_cast(&last_msg_->certificate_id[0])), - 1) - << "incorrect value for certificate_id[0], expected 1, is " - << last_msg_->certificate_id[0]; - EXPECT_EQ( - get_ascertificate_id[1])>( - reinterpret_cast(&last_msg_->certificate_id[1])), - 2) - << "incorrect value for certificate_id[1], expected 2, is " - << last_msg_->certificate_id[1]; - EXPECT_EQ( - get_ascertificate_id[2])>( - reinterpret_cast(&last_msg_->certificate_id[2])), - 3) - << "incorrect value for certificate_id[2], expected 3, is " - << last_msg_->certificate_id[2]; - EXPECT_EQ( - get_ascertificate_id[3])>( - reinterpret_cast(&last_msg_->certificate_id[3])), - 4) - << "incorrect value for certificate_id[3], expected 4, is " - << last_msg_->certificate_id[3]; - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ( - get_asn_signature_bytes)>( - reinterpret_cast(&last_msg_->n_signature_bytes)), - 72) - << "incorrect value for n_signature_bytes, expected 72, is " - << last_msg_->n_signature_bytes; - EXPECT_EQ( - get_ason_demand_counter)>( - reinterpret_cast(&last_msg_->on_demand_counter)), - 2) - << "incorrect value for on_demand_counter, expected 2, is " - << last_msg_->on_demand_counter; - EXPECT_EQ(get_assignature[0])>( - reinterpret_cast(&last_msg_->signature[0])), - 0) - << "incorrect value for signature[0], expected 0, is " - << last_msg_->signature[0]; - EXPECT_EQ(get_assignature[1])>( - reinterpret_cast(&last_msg_->signature[1])), - 1) - << "incorrect value for signature[1], expected 1, is " - << last_msg_->signature[1]; - EXPECT_EQ(get_assignature[2])>( - reinterpret_cast(&last_msg_->signature[2])), - 2) - << "incorrect value for signature[2], expected 2, is " - << last_msg_->signature[2]; - EXPECT_EQ(get_assignature[3])>( - reinterpret_cast(&last_msg_->signature[3])), - 3) - << "incorrect value for signature[3], expected 3, is " - << last_msg_->signature[3]; - EXPECT_EQ(get_assignature[4])>( - reinterpret_cast(&last_msg_->signature[4])), - 4) - << "incorrect value for signature[4], expected 4, is " - << last_msg_->signature[4]; - EXPECT_EQ(get_assignature[5])>( - reinterpret_cast(&last_msg_->signature[5])), - 5) - << "incorrect value for signature[5], expected 5, is " - << last_msg_->signature[5]; - EXPECT_EQ(get_assignature[6])>( - reinterpret_cast(&last_msg_->signature[6])), - 6) - << "incorrect value for signature[6], expected 6, is " - << last_msg_->signature[6]; - EXPECT_EQ(get_assignature[7])>( - reinterpret_cast(&last_msg_->signature[7])), - 7) - << "incorrect value for signature[7], expected 7, is " - << last_msg_->signature[7]; - EXPECT_EQ(get_assignature[8])>( - reinterpret_cast(&last_msg_->signature[8])), - 8) - << "incorrect value for signature[8], expected 8, is " - << last_msg_->signature[8]; - EXPECT_EQ(get_assignature[9])>( - reinterpret_cast(&last_msg_->signature[9])), - 9) - << "incorrect value for signature[9], expected 9, is " - << last_msg_->signature[9]; - EXPECT_EQ(get_assignature[10])>( - reinterpret_cast(&last_msg_->signature[10])), - 10) - << "incorrect value for signature[10], expected 10, is " - << last_msg_->signature[10]; - EXPECT_EQ(get_assignature[11])>( - reinterpret_cast(&last_msg_->signature[11])), - 11) - << "incorrect value for signature[11], expected 11, is " - << last_msg_->signature[11]; - EXPECT_EQ(get_assignature[12])>( - reinterpret_cast(&last_msg_->signature[12])), - 12) - << "incorrect value for signature[12], expected 12, is " - << last_msg_->signature[12]; - EXPECT_EQ(get_assignature[13])>( - reinterpret_cast(&last_msg_->signature[13])), - 13) - << "incorrect value for signature[13], expected 13, is " - << last_msg_->signature[13]; - EXPECT_EQ(get_assignature[14])>( - reinterpret_cast(&last_msg_->signature[14])), - 14) - << "incorrect value for signature[14], expected 14, is " - << last_msg_->signature[14]; - EXPECT_EQ(get_assignature[15])>( - reinterpret_cast(&last_msg_->signature[15])), - 15) - << "incorrect value for signature[15], expected 15, is " - << last_msg_->signature[15]; - EXPECT_EQ(get_assignature[16])>( - reinterpret_cast(&last_msg_->signature[16])), - 16) - << "incorrect value for signature[16], expected 16, is " - << last_msg_->signature[16]; - EXPECT_EQ(get_assignature[17])>( - reinterpret_cast(&last_msg_->signature[17])), - 17) - << "incorrect value for signature[17], expected 17, is " - << last_msg_->signature[17]; - EXPECT_EQ(get_assignature[18])>( - reinterpret_cast(&last_msg_->signature[18])), - 18) - << "incorrect value for signature[18], expected 18, is " - << last_msg_->signature[18]; - EXPECT_EQ(get_assignature[19])>( - reinterpret_cast(&last_msg_->signature[19])), - 19) - << "incorrect value for signature[19], expected 19, is " - << last_msg_->signature[19]; - EXPECT_EQ(get_assignature[20])>( - reinterpret_cast(&last_msg_->signature[20])), - 20) - << "incorrect value for signature[20], expected 20, is " - << last_msg_->signature[20]; - EXPECT_EQ(get_assignature[21])>( - reinterpret_cast(&last_msg_->signature[21])), - 21) - << "incorrect value for signature[21], expected 21, is " - << last_msg_->signature[21]; - EXPECT_EQ(get_assignature[22])>( - reinterpret_cast(&last_msg_->signature[22])), - 22) - << "incorrect value for signature[22], expected 22, is " - << last_msg_->signature[22]; - EXPECT_EQ(get_assignature[23])>( - reinterpret_cast(&last_msg_->signature[23])), - 23) - << "incorrect value for signature[23], expected 23, is " - << last_msg_->signature[23]; - EXPECT_EQ(get_assignature[24])>( - reinterpret_cast(&last_msg_->signature[24])), - 24) - << "incorrect value for signature[24], expected 24, is " - << last_msg_->signature[24]; - EXPECT_EQ(get_assignature[25])>( - reinterpret_cast(&last_msg_->signature[25])), - 25) - << "incorrect value for signature[25], expected 25, is " - << last_msg_->signature[25]; - EXPECT_EQ(get_assignature[26])>( - reinterpret_cast(&last_msg_->signature[26])), - 26) - << "incorrect value for signature[26], expected 26, is " - << last_msg_->signature[26]; - EXPECT_EQ(get_assignature[27])>( - reinterpret_cast(&last_msg_->signature[27])), - 27) - << "incorrect value for signature[27], expected 27, is " - << last_msg_->signature[27]; - EXPECT_EQ(get_assignature[28])>( - reinterpret_cast(&last_msg_->signature[28])), - 28) - << "incorrect value for signature[28], expected 28, is " - << last_msg_->signature[28]; - EXPECT_EQ(get_assignature[29])>( - reinterpret_cast(&last_msg_->signature[29])), - 29) - << "incorrect value for signature[29], expected 29, is " - << last_msg_->signature[29]; - EXPECT_EQ(get_assignature[30])>( - reinterpret_cast(&last_msg_->signature[30])), - 30) - << "incorrect value for signature[30], expected 30, is " - << last_msg_->signature[30]; - EXPECT_EQ(get_assignature[31])>( - reinterpret_cast(&last_msg_->signature[31])), - 31) - << "incorrect value for signature[31], expected 31, is " - << last_msg_->signature[31]; - EXPECT_EQ(get_assignature[32])>( - reinterpret_cast(&last_msg_->signature[32])), - 32) - << "incorrect value for signature[32], expected 32, is " - << last_msg_->signature[32]; - EXPECT_EQ(get_assignature[33])>( - reinterpret_cast(&last_msg_->signature[33])), - 33) - << "incorrect value for signature[33], expected 33, is " - << last_msg_->signature[33]; - EXPECT_EQ(get_assignature[34])>( - reinterpret_cast(&last_msg_->signature[34])), - 34) - << "incorrect value for signature[34], expected 34, is " - << last_msg_->signature[34]; - EXPECT_EQ(get_assignature[35])>( - reinterpret_cast(&last_msg_->signature[35])), - 35) - << "incorrect value for signature[35], expected 35, is " - << last_msg_->signature[35]; - EXPECT_EQ(get_assignature[36])>( - reinterpret_cast(&last_msg_->signature[36])), - 36) - << "incorrect value for signature[36], expected 36, is " - << last_msg_->signature[36]; - EXPECT_EQ(get_assignature[37])>( - reinterpret_cast(&last_msg_->signature[37])), - 37) - << "incorrect value for signature[37], expected 37, is " - << last_msg_->signature[37]; - EXPECT_EQ(get_assignature[38])>( - reinterpret_cast(&last_msg_->signature[38])), - 38) - << "incorrect value for signature[38], expected 38, is " - << last_msg_->signature[38]; - EXPECT_EQ(get_assignature[39])>( - reinterpret_cast(&last_msg_->signature[39])), - 39) - << "incorrect value for signature[39], expected 39, is " - << last_msg_->signature[39]; - EXPECT_EQ(get_assignature[40])>( - reinterpret_cast(&last_msg_->signature[40])), - 40) - << "incorrect value for signature[40], expected 40, is " - << last_msg_->signature[40]; - EXPECT_EQ(get_assignature[41])>( - reinterpret_cast(&last_msg_->signature[41])), - 41) - << "incorrect value for signature[41], expected 41, is " - << last_msg_->signature[41]; - EXPECT_EQ(get_assignature[42])>( - reinterpret_cast(&last_msg_->signature[42])), - 42) - << "incorrect value for signature[42], expected 42, is " - << last_msg_->signature[42]; - EXPECT_EQ(get_assignature[43])>( - reinterpret_cast(&last_msg_->signature[43])), - 43) - << "incorrect value for signature[43], expected 43, is " - << last_msg_->signature[43]; - EXPECT_EQ(get_assignature[44])>( - reinterpret_cast(&last_msg_->signature[44])), - 44) - << "incorrect value for signature[44], expected 44, is " - << last_msg_->signature[44]; - EXPECT_EQ(get_assignature[45])>( - reinterpret_cast(&last_msg_->signature[45])), - 45) - << "incorrect value for signature[45], expected 45, is " - << last_msg_->signature[45]; - EXPECT_EQ(get_assignature[46])>( - reinterpret_cast(&last_msg_->signature[46])), - 46) - << "incorrect value for signature[46], expected 46, is " - << last_msg_->signature[46]; - EXPECT_EQ(get_assignature[47])>( - reinterpret_cast(&last_msg_->signature[47])), - 47) - << "incorrect value for signature[47], expected 47, is " - << last_msg_->signature[47]; - EXPECT_EQ(get_assignature[48])>( - reinterpret_cast(&last_msg_->signature[48])), - 48) - << "incorrect value for signature[48], expected 48, is " - << last_msg_->signature[48]; - EXPECT_EQ(get_assignature[49])>( - reinterpret_cast(&last_msg_->signature[49])), - 49) - << "incorrect value for signature[49], expected 49, is " - << last_msg_->signature[49]; - EXPECT_EQ(get_assignature[50])>( - reinterpret_cast(&last_msg_->signature[50])), - 50) - << "incorrect value for signature[50], expected 50, is " - << last_msg_->signature[50]; - EXPECT_EQ(get_assignature[51])>( - reinterpret_cast(&last_msg_->signature[51])), - 51) - << "incorrect value for signature[51], expected 51, is " - << last_msg_->signature[51]; - EXPECT_EQ(get_assignature[52])>( - reinterpret_cast(&last_msg_->signature[52])), - 52) - << "incorrect value for signature[52], expected 52, is " - << last_msg_->signature[52]; - EXPECT_EQ(get_assignature[53])>( - reinterpret_cast(&last_msg_->signature[53])), - 53) - << "incorrect value for signature[53], expected 53, is " - << last_msg_->signature[53]; - EXPECT_EQ(get_assignature[54])>( - reinterpret_cast(&last_msg_->signature[54])), - 54) - << "incorrect value for signature[54], expected 54, is " - << last_msg_->signature[54]; - EXPECT_EQ(get_assignature[55])>( - reinterpret_cast(&last_msg_->signature[55])), - 55) - << "incorrect value for signature[55], expected 55, is " - << last_msg_->signature[55]; - EXPECT_EQ(get_assignature[56])>( - reinterpret_cast(&last_msg_->signature[56])), - 56) - << "incorrect value for signature[56], expected 56, is " - << last_msg_->signature[56]; - EXPECT_EQ(get_assignature[57])>( - reinterpret_cast(&last_msg_->signature[57])), - 57) - << "incorrect value for signature[57], expected 57, is " - << last_msg_->signature[57]; - EXPECT_EQ(get_assignature[58])>( - reinterpret_cast(&last_msg_->signature[58])), - 58) - << "incorrect value for signature[58], expected 58, is " - << last_msg_->signature[58]; - EXPECT_EQ(get_assignature[59])>( - reinterpret_cast(&last_msg_->signature[59])), - 59) - << "incorrect value for signature[59], expected 59, is " - << last_msg_->signature[59]; - EXPECT_EQ(get_assignature[60])>( - reinterpret_cast(&last_msg_->signature[60])), - 60) - << "incorrect value for signature[60], expected 60, is " - << last_msg_->signature[60]; - EXPECT_EQ(get_assignature[61])>( - reinterpret_cast(&last_msg_->signature[61])), - 61) - << "incorrect value for signature[61], expected 61, is " - << last_msg_->signature[61]; - EXPECT_EQ(get_assignature[62])>( - reinterpret_cast(&last_msg_->signature[62])), - 62) - << "incorrect value for signature[62], expected 62, is " - << last_msg_->signature[62]; - EXPECT_EQ(get_assignature[63])>( - reinterpret_cast(&last_msg_->signature[63])), - 63) - << "incorrect value for signature[63], expected 63, is " - << last_msg_->signature[63]; - EXPECT_EQ(get_assignature[64])>( - reinterpret_cast(&last_msg_->signature[64])), - 64) - << "incorrect value for signature[64], expected 64, is " - << last_msg_->signature[64]; - EXPECT_EQ(get_assignature[65])>( - reinterpret_cast(&last_msg_->signature[65])), - 65) - << "incorrect value for signature[65], expected 65, is " - << last_msg_->signature[65]; - EXPECT_EQ(get_assignature[66])>( - reinterpret_cast(&last_msg_->signature[66])), - 66) - << "incorrect value for signature[66], expected 66, is " - << last_msg_->signature[66]; - EXPECT_EQ(get_assignature[67])>( - reinterpret_cast(&last_msg_->signature[67])), - 67) - << "incorrect value for signature[67], expected 67, is " - << last_msg_->signature[67]; - EXPECT_EQ(get_assignature[68])>( - reinterpret_cast(&last_msg_->signature[68])), - 68) - << "incorrect value for signature[68], expected 68, is " - << last_msg_->signature[68]; - EXPECT_EQ(get_assignature[69])>( - reinterpret_cast(&last_msg_->signature[69])), - 69) - << "incorrect value for signature[69], expected 69, is " - << last_msg_->signature[69]; - EXPECT_EQ(get_assignature[70])>( - reinterpret_cast(&last_msg_->signature[70])), - 70) - << "incorrect value for signature[70], expected 70, is " - << last_msg_->signature[70]; - EXPECT_EQ(get_assignature[71])>( - reinterpret_cast(&last_msg_->signature[71])), - 71) - << "incorrect value for signature[71], expected 71, is " - << last_msg_->signature[71]; - EXPECT_EQ( - get_assigned_messages[0])>( - reinterpret_cast(&last_msg_->signed_messages[0])), - 10) - << "incorrect value for signed_messages[0], expected 10, is " - << last_msg_->signed_messages[0]; - EXPECT_EQ( - get_assigned_messages[1])>( - reinterpret_cast(&last_msg_->signed_messages[1])), - 21) - << "incorrect value for signed_messages[1], expected 21, is " - << last_msg_->signed_messages[1]; - EXPECT_EQ( - get_assigned_messages[2])>( - reinterpret_cast(&last_msg_->signed_messages[2])), - 23) - << "incorrect value for signed_messages[2], expected 23, is " - << last_msg_->signed_messages[2]; - EXPECT_EQ(get_asstream_counter)>( - reinterpret_cast(&last_msg_->stream_counter)), - 1) - << "incorrect value for stream_counter, expected 1, is " - << last_msg_->stream_counter; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_signing_MsgEd25519CertificateDep.cc b/c/test/legacy/cpp/auto_check_sbp_signing_MsgEd25519CertificateDep.cc deleted file mode 100644 index e3a901c4cc..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_signing_MsgEd25519CertificateDep.cc +++ /dev/null @@ -1,1353 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgEd25519CertificateDep.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_signing_MsgEd25519CertificateDep0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_signing_MsgEd25519CertificateDep0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ed25519_certificate_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ed25519_certificate_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_signing_MsgEd25519CertificateDep0, Test) { - uint8_t encoded_frame[] = { - 85, 2, 12, 66, 0, 106, 16, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 0, 3, 6, - 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, - 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, - 99, 102, 105, 108, 111, 114, 117, 120, 123, 126, 129, 132, 135, 138, 141, - 144, 147, 150, 153, 156, 159, 162, 165, 168, 171, 174, 177, 180, 183, 186, - 189, 192, 195, 198, 201, 204, 207, 210, 213, 216, 219, 222, 225, 228, 231, - 234, 237, 240, 243, 246, 249, 252, 218, 148, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ed25519_certificate_dep_t *test_msg = - (msg_ed25519_certificate_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[0] = 0; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[1] = 3; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[2] = 6; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[3] = 9; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[4] = 12; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[5] = 15; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[6] = 18; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[7] = 21; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[8] = 24; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[9] = 27; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[10] = 30; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[11] = 33; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[12] = 36; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[13] = 39; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[14] = 42; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[15] = 45; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[16] = 48; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[17] = 51; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[18] = 54; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[19] = 57; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[20] = 60; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[21] = 63; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[22] = 66; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[23] = 69; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[24] = 72; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[25] = 75; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[26] = 78; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[27] = 81; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[28] = 84; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[29] = 87; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[30] = 90; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[31] = 93; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[32] = 96; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[33] = 99; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[34] = 102; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[35] = 105; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[36] = 108; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[37] = 111; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[38] = 114; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[39] = 117; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[40] = 120; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[41] = 123; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[42] = 126; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[43] = 129; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[44] = 132; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[45] = 135; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[46] = 138; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[47] = 141; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[48] = 144; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[49] = 147; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[50] = 150; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[51] = 153; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[52] = 156; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[53] = 159; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[54] = 162; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[55] = 165; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[56] = 168; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[57] = 171; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[58] = 174; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[59] = 177; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[60] = 180; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[61] = 183; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[62] = 186; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[63] = 189; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[64] = 192; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[65] = 195; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[66] = 198; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[67] = 201; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[68] = 204; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[69] = 207; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[70] = 210; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[71] = 213; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[72] = 216; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[73] = 219; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[74] = 222; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[75] = 225; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[76] = 228; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[77] = 231; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[78] = 234; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[79] = 237; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[80] = 240; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[81] = 243; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[82] = 246; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[83] = 249; - if (sizeof(test_msg->certificate_bytes) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->certificate_bytes[0])); - } - test_msg->certificate_bytes[84] = 252; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[0] = 100; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[1] = 101; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[2] = 102; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[3] = 103; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[4] = 104; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[5] = 105; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[6] = 106; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[7] = 107; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[8] = 108; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[9] = 109; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[10] = 110; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[11] = 111; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[12] = 112; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[13] = 113; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[14] = 114; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[15] = 115; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[16] = 116; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[17] = 117; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[18] = 118; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[19] = 119; - test_msg->n_msg = 16; - - EXPECT_EQ(send_message(0xC02, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ( - get_ascertificate_bytes[0])>( - reinterpret_cast(&last_msg_->certificate_bytes[0])), - 0) - << "incorrect value for certificate_bytes[0], expected 0, is " - << last_msg_->certificate_bytes[0]; - EXPECT_EQ( - get_ascertificate_bytes[1])>( - reinterpret_cast(&last_msg_->certificate_bytes[1])), - 3) - << "incorrect value for certificate_bytes[1], expected 3, is " - << last_msg_->certificate_bytes[1]; - EXPECT_EQ( - get_ascertificate_bytes[2])>( - reinterpret_cast(&last_msg_->certificate_bytes[2])), - 6) - << "incorrect value for certificate_bytes[2], expected 6, is " - << last_msg_->certificate_bytes[2]; - EXPECT_EQ( - get_ascertificate_bytes[3])>( - reinterpret_cast(&last_msg_->certificate_bytes[3])), - 9) - << "incorrect value for certificate_bytes[3], expected 9, is " - << last_msg_->certificate_bytes[3]; - EXPECT_EQ( - get_ascertificate_bytes[4])>( - reinterpret_cast(&last_msg_->certificate_bytes[4])), - 12) - << "incorrect value for certificate_bytes[4], expected 12, is " - << last_msg_->certificate_bytes[4]; - EXPECT_EQ( - get_ascertificate_bytes[5])>( - reinterpret_cast(&last_msg_->certificate_bytes[5])), - 15) - << "incorrect value for certificate_bytes[5], expected 15, is " - << last_msg_->certificate_bytes[5]; - EXPECT_EQ( - get_ascertificate_bytes[6])>( - reinterpret_cast(&last_msg_->certificate_bytes[6])), - 18) - << "incorrect value for certificate_bytes[6], expected 18, is " - << last_msg_->certificate_bytes[6]; - EXPECT_EQ( - get_ascertificate_bytes[7])>( - reinterpret_cast(&last_msg_->certificate_bytes[7])), - 21) - << "incorrect value for certificate_bytes[7], expected 21, is " - << last_msg_->certificate_bytes[7]; - EXPECT_EQ( - get_ascertificate_bytes[8])>( - reinterpret_cast(&last_msg_->certificate_bytes[8])), - 24) - << "incorrect value for certificate_bytes[8], expected 24, is " - << last_msg_->certificate_bytes[8]; - EXPECT_EQ( - get_ascertificate_bytes[9])>( - reinterpret_cast(&last_msg_->certificate_bytes[9])), - 27) - << "incorrect value for certificate_bytes[9], expected 27, is " - << last_msg_->certificate_bytes[9]; - EXPECT_EQ( - get_ascertificate_bytes[10])>( - reinterpret_cast(&last_msg_->certificate_bytes[10])), - 30) - << "incorrect value for certificate_bytes[10], expected 30, is " - << last_msg_->certificate_bytes[10]; - EXPECT_EQ( - get_ascertificate_bytes[11])>( - reinterpret_cast(&last_msg_->certificate_bytes[11])), - 33) - << "incorrect value for certificate_bytes[11], expected 33, is " - << last_msg_->certificate_bytes[11]; - EXPECT_EQ( - get_ascertificate_bytes[12])>( - reinterpret_cast(&last_msg_->certificate_bytes[12])), - 36) - << "incorrect value for certificate_bytes[12], expected 36, is " - << last_msg_->certificate_bytes[12]; - EXPECT_EQ( - get_ascertificate_bytes[13])>( - reinterpret_cast(&last_msg_->certificate_bytes[13])), - 39) - << "incorrect value for certificate_bytes[13], expected 39, is " - << last_msg_->certificate_bytes[13]; - EXPECT_EQ( - get_ascertificate_bytes[14])>( - reinterpret_cast(&last_msg_->certificate_bytes[14])), - 42) - << "incorrect value for certificate_bytes[14], expected 42, is " - << last_msg_->certificate_bytes[14]; - EXPECT_EQ( - get_ascertificate_bytes[15])>( - reinterpret_cast(&last_msg_->certificate_bytes[15])), - 45) - << "incorrect value for certificate_bytes[15], expected 45, is " - << last_msg_->certificate_bytes[15]; - EXPECT_EQ( - get_ascertificate_bytes[16])>( - reinterpret_cast(&last_msg_->certificate_bytes[16])), - 48) - << "incorrect value for certificate_bytes[16], expected 48, is " - << last_msg_->certificate_bytes[16]; - EXPECT_EQ( - get_ascertificate_bytes[17])>( - reinterpret_cast(&last_msg_->certificate_bytes[17])), - 51) - << "incorrect value for certificate_bytes[17], expected 51, is " - << last_msg_->certificate_bytes[17]; - EXPECT_EQ( - get_ascertificate_bytes[18])>( - reinterpret_cast(&last_msg_->certificate_bytes[18])), - 54) - << "incorrect value for certificate_bytes[18], expected 54, is " - << last_msg_->certificate_bytes[18]; - EXPECT_EQ( - get_ascertificate_bytes[19])>( - reinterpret_cast(&last_msg_->certificate_bytes[19])), - 57) - << "incorrect value for certificate_bytes[19], expected 57, is " - << last_msg_->certificate_bytes[19]; - EXPECT_EQ( - get_ascertificate_bytes[20])>( - reinterpret_cast(&last_msg_->certificate_bytes[20])), - 60) - << "incorrect value for certificate_bytes[20], expected 60, is " - << last_msg_->certificate_bytes[20]; - EXPECT_EQ( - get_ascertificate_bytes[21])>( - reinterpret_cast(&last_msg_->certificate_bytes[21])), - 63) - << "incorrect value for certificate_bytes[21], expected 63, is " - << last_msg_->certificate_bytes[21]; - EXPECT_EQ( - get_ascertificate_bytes[22])>( - reinterpret_cast(&last_msg_->certificate_bytes[22])), - 66) - << "incorrect value for certificate_bytes[22], expected 66, is " - << last_msg_->certificate_bytes[22]; - EXPECT_EQ( - get_ascertificate_bytes[23])>( - reinterpret_cast(&last_msg_->certificate_bytes[23])), - 69) - << "incorrect value for certificate_bytes[23], expected 69, is " - << last_msg_->certificate_bytes[23]; - EXPECT_EQ( - get_ascertificate_bytes[24])>( - reinterpret_cast(&last_msg_->certificate_bytes[24])), - 72) - << "incorrect value for certificate_bytes[24], expected 72, is " - << last_msg_->certificate_bytes[24]; - EXPECT_EQ( - get_ascertificate_bytes[25])>( - reinterpret_cast(&last_msg_->certificate_bytes[25])), - 75) - << "incorrect value for certificate_bytes[25], expected 75, is " - << last_msg_->certificate_bytes[25]; - EXPECT_EQ( - get_ascertificate_bytes[26])>( - reinterpret_cast(&last_msg_->certificate_bytes[26])), - 78) - << "incorrect value for certificate_bytes[26], expected 78, is " - << last_msg_->certificate_bytes[26]; - EXPECT_EQ( - get_ascertificate_bytes[27])>( - reinterpret_cast(&last_msg_->certificate_bytes[27])), - 81) - << "incorrect value for certificate_bytes[27], expected 81, is " - << last_msg_->certificate_bytes[27]; - EXPECT_EQ( - get_ascertificate_bytes[28])>( - reinterpret_cast(&last_msg_->certificate_bytes[28])), - 84) - << "incorrect value for certificate_bytes[28], expected 84, is " - << last_msg_->certificate_bytes[28]; - EXPECT_EQ( - get_ascertificate_bytes[29])>( - reinterpret_cast(&last_msg_->certificate_bytes[29])), - 87) - << "incorrect value for certificate_bytes[29], expected 87, is " - << last_msg_->certificate_bytes[29]; - EXPECT_EQ( - get_ascertificate_bytes[30])>( - reinterpret_cast(&last_msg_->certificate_bytes[30])), - 90) - << "incorrect value for certificate_bytes[30], expected 90, is " - << last_msg_->certificate_bytes[30]; - EXPECT_EQ( - get_ascertificate_bytes[31])>( - reinterpret_cast(&last_msg_->certificate_bytes[31])), - 93) - << "incorrect value for certificate_bytes[31], expected 93, is " - << last_msg_->certificate_bytes[31]; - EXPECT_EQ( - get_ascertificate_bytes[32])>( - reinterpret_cast(&last_msg_->certificate_bytes[32])), - 96) - << "incorrect value for certificate_bytes[32], expected 96, is " - << last_msg_->certificate_bytes[32]; - EXPECT_EQ( - get_ascertificate_bytes[33])>( - reinterpret_cast(&last_msg_->certificate_bytes[33])), - 99) - << "incorrect value for certificate_bytes[33], expected 99, is " - << last_msg_->certificate_bytes[33]; - EXPECT_EQ( - get_ascertificate_bytes[34])>( - reinterpret_cast(&last_msg_->certificate_bytes[34])), - 102) - << "incorrect value for certificate_bytes[34], expected 102, is " - << last_msg_->certificate_bytes[34]; - EXPECT_EQ( - get_ascertificate_bytes[35])>( - reinterpret_cast(&last_msg_->certificate_bytes[35])), - 105) - << "incorrect value for certificate_bytes[35], expected 105, is " - << last_msg_->certificate_bytes[35]; - EXPECT_EQ( - get_ascertificate_bytes[36])>( - reinterpret_cast(&last_msg_->certificate_bytes[36])), - 108) - << "incorrect value for certificate_bytes[36], expected 108, is " - << last_msg_->certificate_bytes[36]; - EXPECT_EQ( - get_ascertificate_bytes[37])>( - reinterpret_cast(&last_msg_->certificate_bytes[37])), - 111) - << "incorrect value for certificate_bytes[37], expected 111, is " - << last_msg_->certificate_bytes[37]; - EXPECT_EQ( - get_ascertificate_bytes[38])>( - reinterpret_cast(&last_msg_->certificate_bytes[38])), - 114) - << "incorrect value for certificate_bytes[38], expected 114, is " - << last_msg_->certificate_bytes[38]; - EXPECT_EQ( - get_ascertificate_bytes[39])>( - reinterpret_cast(&last_msg_->certificate_bytes[39])), - 117) - << "incorrect value for certificate_bytes[39], expected 117, is " - << last_msg_->certificate_bytes[39]; - EXPECT_EQ( - get_ascertificate_bytes[40])>( - reinterpret_cast(&last_msg_->certificate_bytes[40])), - 120) - << "incorrect value for certificate_bytes[40], expected 120, is " - << last_msg_->certificate_bytes[40]; - EXPECT_EQ( - get_ascertificate_bytes[41])>( - reinterpret_cast(&last_msg_->certificate_bytes[41])), - 123) - << "incorrect value for certificate_bytes[41], expected 123, is " - << last_msg_->certificate_bytes[41]; - EXPECT_EQ( - get_ascertificate_bytes[42])>( - reinterpret_cast(&last_msg_->certificate_bytes[42])), - 126) - << "incorrect value for certificate_bytes[42], expected 126, is " - << last_msg_->certificate_bytes[42]; - EXPECT_EQ( - get_ascertificate_bytes[43])>( - reinterpret_cast(&last_msg_->certificate_bytes[43])), - 129) - << "incorrect value for certificate_bytes[43], expected 129, is " - << last_msg_->certificate_bytes[43]; - EXPECT_EQ( - get_ascertificate_bytes[44])>( - reinterpret_cast(&last_msg_->certificate_bytes[44])), - 132) - << "incorrect value for certificate_bytes[44], expected 132, is " - << last_msg_->certificate_bytes[44]; - EXPECT_EQ( - get_ascertificate_bytes[45])>( - reinterpret_cast(&last_msg_->certificate_bytes[45])), - 135) - << "incorrect value for certificate_bytes[45], expected 135, is " - << last_msg_->certificate_bytes[45]; - EXPECT_EQ( - get_ascertificate_bytes[46])>( - reinterpret_cast(&last_msg_->certificate_bytes[46])), - 138) - << "incorrect value for certificate_bytes[46], expected 138, is " - << last_msg_->certificate_bytes[46]; - EXPECT_EQ( - get_ascertificate_bytes[47])>( - reinterpret_cast(&last_msg_->certificate_bytes[47])), - 141) - << "incorrect value for certificate_bytes[47], expected 141, is " - << last_msg_->certificate_bytes[47]; - EXPECT_EQ( - get_ascertificate_bytes[48])>( - reinterpret_cast(&last_msg_->certificate_bytes[48])), - 144) - << "incorrect value for certificate_bytes[48], expected 144, is " - << last_msg_->certificate_bytes[48]; - EXPECT_EQ( - get_ascertificate_bytes[49])>( - reinterpret_cast(&last_msg_->certificate_bytes[49])), - 147) - << "incorrect value for certificate_bytes[49], expected 147, is " - << last_msg_->certificate_bytes[49]; - EXPECT_EQ( - get_ascertificate_bytes[50])>( - reinterpret_cast(&last_msg_->certificate_bytes[50])), - 150) - << "incorrect value for certificate_bytes[50], expected 150, is " - << last_msg_->certificate_bytes[50]; - EXPECT_EQ( - get_ascertificate_bytes[51])>( - reinterpret_cast(&last_msg_->certificate_bytes[51])), - 153) - << "incorrect value for certificate_bytes[51], expected 153, is " - << last_msg_->certificate_bytes[51]; - EXPECT_EQ( - get_ascertificate_bytes[52])>( - reinterpret_cast(&last_msg_->certificate_bytes[52])), - 156) - << "incorrect value for certificate_bytes[52], expected 156, is " - << last_msg_->certificate_bytes[52]; - EXPECT_EQ( - get_ascertificate_bytes[53])>( - reinterpret_cast(&last_msg_->certificate_bytes[53])), - 159) - << "incorrect value for certificate_bytes[53], expected 159, is " - << last_msg_->certificate_bytes[53]; - EXPECT_EQ( - get_ascertificate_bytes[54])>( - reinterpret_cast(&last_msg_->certificate_bytes[54])), - 162) - << "incorrect value for certificate_bytes[54], expected 162, is " - << last_msg_->certificate_bytes[54]; - EXPECT_EQ( - get_ascertificate_bytes[55])>( - reinterpret_cast(&last_msg_->certificate_bytes[55])), - 165) - << "incorrect value for certificate_bytes[55], expected 165, is " - << last_msg_->certificate_bytes[55]; - EXPECT_EQ( - get_ascertificate_bytes[56])>( - reinterpret_cast(&last_msg_->certificate_bytes[56])), - 168) - << "incorrect value for certificate_bytes[56], expected 168, is " - << last_msg_->certificate_bytes[56]; - EXPECT_EQ( - get_ascertificate_bytes[57])>( - reinterpret_cast(&last_msg_->certificate_bytes[57])), - 171) - << "incorrect value for certificate_bytes[57], expected 171, is " - << last_msg_->certificate_bytes[57]; - EXPECT_EQ( - get_ascertificate_bytes[58])>( - reinterpret_cast(&last_msg_->certificate_bytes[58])), - 174) - << "incorrect value for certificate_bytes[58], expected 174, is " - << last_msg_->certificate_bytes[58]; - EXPECT_EQ( - get_ascertificate_bytes[59])>( - reinterpret_cast(&last_msg_->certificate_bytes[59])), - 177) - << "incorrect value for certificate_bytes[59], expected 177, is " - << last_msg_->certificate_bytes[59]; - EXPECT_EQ( - get_ascertificate_bytes[60])>( - reinterpret_cast(&last_msg_->certificate_bytes[60])), - 180) - << "incorrect value for certificate_bytes[60], expected 180, is " - << last_msg_->certificate_bytes[60]; - EXPECT_EQ( - get_ascertificate_bytes[61])>( - reinterpret_cast(&last_msg_->certificate_bytes[61])), - 183) - << "incorrect value for certificate_bytes[61], expected 183, is " - << last_msg_->certificate_bytes[61]; - EXPECT_EQ( - get_ascertificate_bytes[62])>( - reinterpret_cast(&last_msg_->certificate_bytes[62])), - 186) - << "incorrect value for certificate_bytes[62], expected 186, is " - << last_msg_->certificate_bytes[62]; - EXPECT_EQ( - get_ascertificate_bytes[63])>( - reinterpret_cast(&last_msg_->certificate_bytes[63])), - 189) - << "incorrect value for certificate_bytes[63], expected 189, is " - << last_msg_->certificate_bytes[63]; - EXPECT_EQ( - get_ascertificate_bytes[64])>( - reinterpret_cast(&last_msg_->certificate_bytes[64])), - 192) - << "incorrect value for certificate_bytes[64], expected 192, is " - << last_msg_->certificate_bytes[64]; - EXPECT_EQ( - get_ascertificate_bytes[65])>( - reinterpret_cast(&last_msg_->certificate_bytes[65])), - 195) - << "incorrect value for certificate_bytes[65], expected 195, is " - << last_msg_->certificate_bytes[65]; - EXPECT_EQ( - get_ascertificate_bytes[66])>( - reinterpret_cast(&last_msg_->certificate_bytes[66])), - 198) - << "incorrect value for certificate_bytes[66], expected 198, is " - << last_msg_->certificate_bytes[66]; - EXPECT_EQ( - get_ascertificate_bytes[67])>( - reinterpret_cast(&last_msg_->certificate_bytes[67])), - 201) - << "incorrect value for certificate_bytes[67], expected 201, is " - << last_msg_->certificate_bytes[67]; - EXPECT_EQ( - get_ascertificate_bytes[68])>( - reinterpret_cast(&last_msg_->certificate_bytes[68])), - 204) - << "incorrect value for certificate_bytes[68], expected 204, is " - << last_msg_->certificate_bytes[68]; - EXPECT_EQ( - get_ascertificate_bytes[69])>( - reinterpret_cast(&last_msg_->certificate_bytes[69])), - 207) - << "incorrect value for certificate_bytes[69], expected 207, is " - << last_msg_->certificate_bytes[69]; - EXPECT_EQ( - get_ascertificate_bytes[70])>( - reinterpret_cast(&last_msg_->certificate_bytes[70])), - 210) - << "incorrect value for certificate_bytes[70], expected 210, is " - << last_msg_->certificate_bytes[70]; - EXPECT_EQ( - get_ascertificate_bytes[71])>( - reinterpret_cast(&last_msg_->certificate_bytes[71])), - 213) - << "incorrect value for certificate_bytes[71], expected 213, is " - << last_msg_->certificate_bytes[71]; - EXPECT_EQ( - get_ascertificate_bytes[72])>( - reinterpret_cast(&last_msg_->certificate_bytes[72])), - 216) - << "incorrect value for certificate_bytes[72], expected 216, is " - << last_msg_->certificate_bytes[72]; - EXPECT_EQ( - get_ascertificate_bytes[73])>( - reinterpret_cast(&last_msg_->certificate_bytes[73])), - 219) - << "incorrect value for certificate_bytes[73], expected 219, is " - << last_msg_->certificate_bytes[73]; - EXPECT_EQ( - get_ascertificate_bytes[74])>( - reinterpret_cast(&last_msg_->certificate_bytes[74])), - 222) - << "incorrect value for certificate_bytes[74], expected 222, is " - << last_msg_->certificate_bytes[74]; - EXPECT_EQ( - get_ascertificate_bytes[75])>( - reinterpret_cast(&last_msg_->certificate_bytes[75])), - 225) - << "incorrect value for certificate_bytes[75], expected 225, is " - << last_msg_->certificate_bytes[75]; - EXPECT_EQ( - get_ascertificate_bytes[76])>( - reinterpret_cast(&last_msg_->certificate_bytes[76])), - 228) - << "incorrect value for certificate_bytes[76], expected 228, is " - << last_msg_->certificate_bytes[76]; - EXPECT_EQ( - get_ascertificate_bytes[77])>( - reinterpret_cast(&last_msg_->certificate_bytes[77])), - 231) - << "incorrect value for certificate_bytes[77], expected 231, is " - << last_msg_->certificate_bytes[77]; - EXPECT_EQ( - get_ascertificate_bytes[78])>( - reinterpret_cast(&last_msg_->certificate_bytes[78])), - 234) - << "incorrect value for certificate_bytes[78], expected 234, is " - << last_msg_->certificate_bytes[78]; - EXPECT_EQ( - get_ascertificate_bytes[79])>( - reinterpret_cast(&last_msg_->certificate_bytes[79])), - 237) - << "incorrect value for certificate_bytes[79], expected 237, is " - << last_msg_->certificate_bytes[79]; - EXPECT_EQ( - get_ascertificate_bytes[80])>( - reinterpret_cast(&last_msg_->certificate_bytes[80])), - 240) - << "incorrect value for certificate_bytes[80], expected 240, is " - << last_msg_->certificate_bytes[80]; - EXPECT_EQ( - get_ascertificate_bytes[81])>( - reinterpret_cast(&last_msg_->certificate_bytes[81])), - 243) - << "incorrect value for certificate_bytes[81], expected 243, is " - << last_msg_->certificate_bytes[81]; - EXPECT_EQ( - get_ascertificate_bytes[82])>( - reinterpret_cast(&last_msg_->certificate_bytes[82])), - 246) - << "incorrect value for certificate_bytes[82], expected 246, is " - << last_msg_->certificate_bytes[82]; - EXPECT_EQ( - get_ascertificate_bytes[83])>( - reinterpret_cast(&last_msg_->certificate_bytes[83])), - 249) - << "incorrect value for certificate_bytes[83], expected 249, is " - << last_msg_->certificate_bytes[83]; - EXPECT_EQ( - get_ascertificate_bytes[84])>( - reinterpret_cast(&last_msg_->certificate_bytes[84])), - 252) - << "incorrect value for certificate_bytes[84], expected 252, is " - << last_msg_->certificate_bytes[84]; - EXPECT_EQ(get_asfingerprint[0])>( - reinterpret_cast(&last_msg_->fingerprint[0])), - 100) - << "incorrect value for fingerprint[0], expected 100, is " - << last_msg_->fingerprint[0]; - EXPECT_EQ(get_asfingerprint[1])>( - reinterpret_cast(&last_msg_->fingerprint[1])), - 101) - << "incorrect value for fingerprint[1], expected 101, is " - << last_msg_->fingerprint[1]; - EXPECT_EQ(get_asfingerprint[2])>( - reinterpret_cast(&last_msg_->fingerprint[2])), - 102) - << "incorrect value for fingerprint[2], expected 102, is " - << last_msg_->fingerprint[2]; - EXPECT_EQ(get_asfingerprint[3])>( - reinterpret_cast(&last_msg_->fingerprint[3])), - 103) - << "incorrect value for fingerprint[3], expected 103, is " - << last_msg_->fingerprint[3]; - EXPECT_EQ(get_asfingerprint[4])>( - reinterpret_cast(&last_msg_->fingerprint[4])), - 104) - << "incorrect value for fingerprint[4], expected 104, is " - << last_msg_->fingerprint[4]; - EXPECT_EQ(get_asfingerprint[5])>( - reinterpret_cast(&last_msg_->fingerprint[5])), - 105) - << "incorrect value for fingerprint[5], expected 105, is " - << last_msg_->fingerprint[5]; - EXPECT_EQ(get_asfingerprint[6])>( - reinterpret_cast(&last_msg_->fingerprint[6])), - 106) - << "incorrect value for fingerprint[6], expected 106, is " - << last_msg_->fingerprint[6]; - EXPECT_EQ(get_asfingerprint[7])>( - reinterpret_cast(&last_msg_->fingerprint[7])), - 107) - << "incorrect value for fingerprint[7], expected 107, is " - << last_msg_->fingerprint[7]; - EXPECT_EQ(get_asfingerprint[8])>( - reinterpret_cast(&last_msg_->fingerprint[8])), - 108) - << "incorrect value for fingerprint[8], expected 108, is " - << last_msg_->fingerprint[8]; - EXPECT_EQ(get_asfingerprint[9])>( - reinterpret_cast(&last_msg_->fingerprint[9])), - 109) - << "incorrect value for fingerprint[9], expected 109, is " - << last_msg_->fingerprint[9]; - EXPECT_EQ(get_asfingerprint[10])>( - reinterpret_cast(&last_msg_->fingerprint[10])), - 110) - << "incorrect value for fingerprint[10], expected 110, is " - << last_msg_->fingerprint[10]; - EXPECT_EQ(get_asfingerprint[11])>( - reinterpret_cast(&last_msg_->fingerprint[11])), - 111) - << "incorrect value for fingerprint[11], expected 111, is " - << last_msg_->fingerprint[11]; - EXPECT_EQ(get_asfingerprint[12])>( - reinterpret_cast(&last_msg_->fingerprint[12])), - 112) - << "incorrect value for fingerprint[12], expected 112, is " - << last_msg_->fingerprint[12]; - EXPECT_EQ(get_asfingerprint[13])>( - reinterpret_cast(&last_msg_->fingerprint[13])), - 113) - << "incorrect value for fingerprint[13], expected 113, is " - << last_msg_->fingerprint[13]; - EXPECT_EQ(get_asfingerprint[14])>( - reinterpret_cast(&last_msg_->fingerprint[14])), - 114) - << "incorrect value for fingerprint[14], expected 114, is " - << last_msg_->fingerprint[14]; - EXPECT_EQ(get_asfingerprint[15])>( - reinterpret_cast(&last_msg_->fingerprint[15])), - 115) - << "incorrect value for fingerprint[15], expected 115, is " - << last_msg_->fingerprint[15]; - EXPECT_EQ(get_asfingerprint[16])>( - reinterpret_cast(&last_msg_->fingerprint[16])), - 116) - << "incorrect value for fingerprint[16], expected 116, is " - << last_msg_->fingerprint[16]; - EXPECT_EQ(get_asfingerprint[17])>( - reinterpret_cast(&last_msg_->fingerprint[17])), - 117) - << "incorrect value for fingerprint[17], expected 117, is " - << last_msg_->fingerprint[17]; - EXPECT_EQ(get_asfingerprint[18])>( - reinterpret_cast(&last_msg_->fingerprint[18])), - 118) - << "incorrect value for fingerprint[18], expected 118, is " - << last_msg_->fingerprint[18]; - EXPECT_EQ(get_asfingerprint[19])>( - reinterpret_cast(&last_msg_->fingerprint[19])), - 119) - << "incorrect value for fingerprint[19], expected 119, is " - << last_msg_->fingerprint[19]; - EXPECT_EQ(get_asn_msg)>( - reinterpret_cast(&last_msg_->n_msg)), - 16) - << "incorrect value for n_msg, expected 16, is " << last_msg_->n_msg; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_signing_MsgEd25519SignatureDepA.cc b/c/test/legacy/cpp/auto_check_sbp_signing_MsgEd25519SignatureDepA.cc deleted file mode 100644 index a5ca24550a..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_signing_MsgEd25519SignatureDepA.cc +++ /dev/null @@ -1,1273 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgEd25519SignatureDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_signing_MsgEd25519SignatureDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_signing_MsgEd25519SignatureDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ed25519_signature_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ed25519_signature_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_signing_MsgEd25519SignatureDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 1, 12, 66, 0, 184, 0, 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 136, 19, 0, 0, 114, 20, 0, 0, 92, 21, 0, 0, 70, 22, 0, - 0, 48, 23, 0, 0, 26, 24, 0, 0, 4, 25, 0, 0, 238, 25, - 0, 0, 216, 26, 0, 0, 194, 27, 0, 0, 172, 28, 0, 0, 150, - 29, 0, 0, 128, 30, 0, 0, 106, 31, 0, 0, 84, 32, 0, 0, - 62, 33, 0, 0, 40, 34, 0, 0, 18, 35, 0, 0, 252, 35, 0, - 0, 230, 36, 0, 0, 208, 37, 0, 0, 186, 38, 0, 0, 164, 39, - 0, 0, 142, 40, 0, 0, 120, 41, 0, 0, 169, 111, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ed25519_signature_dep_a_t *test_msg = - (msg_ed25519_signature_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[0] = 100; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[1] = 101; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[2] = 102; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[3] = 103; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[4] = 104; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[5] = 105; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[6] = 106; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[7] = 107; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[8] = 108; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[9] = 109; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[10] = 110; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[11] = 111; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[12] = 112; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[13] = 113; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[14] = 114; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[15] = 115; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[16] = 116; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[17] = 117; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[18] = 118; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[19] = 119; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[0] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[1] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[2] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[3] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[4] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[5] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[6] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[7] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[8] = 8; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[9] = 9; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[10] = 10; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[11] = 11; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[12] = 12; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[13] = 13; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[14] = 14; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[15] = 15; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[16] = 16; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[17] = 17; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[18] = 18; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[19] = 19; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[20] = 20; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[21] = 21; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[22] = 22; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[23] = 23; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[24] = 24; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[25] = 25; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[26] = 26; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[27] = 27; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[28] = 28; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[29] = 29; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[30] = 30; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[31] = 31; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[32] = 32; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[33] = 33; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[34] = 34; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[35] = 35; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[36] = 36; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[37] = 37; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[38] = 38; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[39] = 39; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[40] = 40; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[41] = 41; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[42] = 42; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[43] = 43; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[44] = 44; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[45] = 45; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[46] = 46; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[47] = 47; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[48] = 48; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[49] = 49; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[50] = 50; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[51] = 51; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[52] = 52; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[53] = 53; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[54] = 54; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[55] = 55; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[56] = 56; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[57] = 57; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[58] = 58; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[59] = 59; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[60] = 60; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[61] = 61; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[62] = 62; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[63] = 63; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[0] = 5000; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[1] = 5234; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[2] = 5468; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[3] = 5702; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[4] = 5936; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[5] = 6170; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[6] = 6404; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[7] = 6638; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[8] = 6872; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[9] = 7106; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[10] = 7340; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[11] = 7574; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[12] = 7808; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[13] = 8042; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[14] = 8276; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[15] = 8510; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[16] = 8744; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[17] = 8978; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[18] = 9212; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[19] = 9446; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[20] = 9680; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[21] = 9914; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[22] = 10148; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[23] = 10382; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[24] = 10616; - - EXPECT_EQ(send_message(0xC01, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asfingerprint[0])>( - reinterpret_cast(&last_msg_->fingerprint[0])), - 100) - << "incorrect value for fingerprint[0], expected 100, is " - << last_msg_->fingerprint[0]; - EXPECT_EQ(get_asfingerprint[1])>( - reinterpret_cast(&last_msg_->fingerprint[1])), - 101) - << "incorrect value for fingerprint[1], expected 101, is " - << last_msg_->fingerprint[1]; - EXPECT_EQ(get_asfingerprint[2])>( - reinterpret_cast(&last_msg_->fingerprint[2])), - 102) - << "incorrect value for fingerprint[2], expected 102, is " - << last_msg_->fingerprint[2]; - EXPECT_EQ(get_asfingerprint[3])>( - reinterpret_cast(&last_msg_->fingerprint[3])), - 103) - << "incorrect value for fingerprint[3], expected 103, is " - << last_msg_->fingerprint[3]; - EXPECT_EQ(get_asfingerprint[4])>( - reinterpret_cast(&last_msg_->fingerprint[4])), - 104) - << "incorrect value for fingerprint[4], expected 104, is " - << last_msg_->fingerprint[4]; - EXPECT_EQ(get_asfingerprint[5])>( - reinterpret_cast(&last_msg_->fingerprint[5])), - 105) - << "incorrect value for fingerprint[5], expected 105, is " - << last_msg_->fingerprint[5]; - EXPECT_EQ(get_asfingerprint[6])>( - reinterpret_cast(&last_msg_->fingerprint[6])), - 106) - << "incorrect value for fingerprint[6], expected 106, is " - << last_msg_->fingerprint[6]; - EXPECT_EQ(get_asfingerprint[7])>( - reinterpret_cast(&last_msg_->fingerprint[7])), - 107) - << "incorrect value for fingerprint[7], expected 107, is " - << last_msg_->fingerprint[7]; - EXPECT_EQ(get_asfingerprint[8])>( - reinterpret_cast(&last_msg_->fingerprint[8])), - 108) - << "incorrect value for fingerprint[8], expected 108, is " - << last_msg_->fingerprint[8]; - EXPECT_EQ(get_asfingerprint[9])>( - reinterpret_cast(&last_msg_->fingerprint[9])), - 109) - << "incorrect value for fingerprint[9], expected 109, is " - << last_msg_->fingerprint[9]; - EXPECT_EQ(get_asfingerprint[10])>( - reinterpret_cast(&last_msg_->fingerprint[10])), - 110) - << "incorrect value for fingerprint[10], expected 110, is " - << last_msg_->fingerprint[10]; - EXPECT_EQ(get_asfingerprint[11])>( - reinterpret_cast(&last_msg_->fingerprint[11])), - 111) - << "incorrect value for fingerprint[11], expected 111, is " - << last_msg_->fingerprint[11]; - EXPECT_EQ(get_asfingerprint[12])>( - reinterpret_cast(&last_msg_->fingerprint[12])), - 112) - << "incorrect value for fingerprint[12], expected 112, is " - << last_msg_->fingerprint[12]; - EXPECT_EQ(get_asfingerprint[13])>( - reinterpret_cast(&last_msg_->fingerprint[13])), - 113) - << "incorrect value for fingerprint[13], expected 113, is " - << last_msg_->fingerprint[13]; - EXPECT_EQ(get_asfingerprint[14])>( - reinterpret_cast(&last_msg_->fingerprint[14])), - 114) - << "incorrect value for fingerprint[14], expected 114, is " - << last_msg_->fingerprint[14]; - EXPECT_EQ(get_asfingerprint[15])>( - reinterpret_cast(&last_msg_->fingerprint[15])), - 115) - << "incorrect value for fingerprint[15], expected 115, is " - << last_msg_->fingerprint[15]; - EXPECT_EQ(get_asfingerprint[16])>( - reinterpret_cast(&last_msg_->fingerprint[16])), - 116) - << "incorrect value for fingerprint[16], expected 116, is " - << last_msg_->fingerprint[16]; - EXPECT_EQ(get_asfingerprint[17])>( - reinterpret_cast(&last_msg_->fingerprint[17])), - 117) - << "incorrect value for fingerprint[17], expected 117, is " - << last_msg_->fingerprint[17]; - EXPECT_EQ(get_asfingerprint[18])>( - reinterpret_cast(&last_msg_->fingerprint[18])), - 118) - << "incorrect value for fingerprint[18], expected 118, is " - << last_msg_->fingerprint[18]; - EXPECT_EQ(get_asfingerprint[19])>( - reinterpret_cast(&last_msg_->fingerprint[19])), - 119) - << "incorrect value for fingerprint[19], expected 119, is " - << last_msg_->fingerprint[19]; - EXPECT_EQ(get_assignature[0])>( - reinterpret_cast(&last_msg_->signature[0])), - 0) - << "incorrect value for signature[0], expected 0, is " - << last_msg_->signature[0]; - EXPECT_EQ(get_assignature[1])>( - reinterpret_cast(&last_msg_->signature[1])), - 1) - << "incorrect value for signature[1], expected 1, is " - << last_msg_->signature[1]; - EXPECT_EQ(get_assignature[2])>( - reinterpret_cast(&last_msg_->signature[2])), - 2) - << "incorrect value for signature[2], expected 2, is " - << last_msg_->signature[2]; - EXPECT_EQ(get_assignature[3])>( - reinterpret_cast(&last_msg_->signature[3])), - 3) - << "incorrect value for signature[3], expected 3, is " - << last_msg_->signature[3]; - EXPECT_EQ(get_assignature[4])>( - reinterpret_cast(&last_msg_->signature[4])), - 4) - << "incorrect value for signature[4], expected 4, is " - << last_msg_->signature[4]; - EXPECT_EQ(get_assignature[5])>( - reinterpret_cast(&last_msg_->signature[5])), - 5) - << "incorrect value for signature[5], expected 5, is " - << last_msg_->signature[5]; - EXPECT_EQ(get_assignature[6])>( - reinterpret_cast(&last_msg_->signature[6])), - 6) - << "incorrect value for signature[6], expected 6, is " - << last_msg_->signature[6]; - EXPECT_EQ(get_assignature[7])>( - reinterpret_cast(&last_msg_->signature[7])), - 7) - << "incorrect value for signature[7], expected 7, is " - << last_msg_->signature[7]; - EXPECT_EQ(get_assignature[8])>( - reinterpret_cast(&last_msg_->signature[8])), - 8) - << "incorrect value for signature[8], expected 8, is " - << last_msg_->signature[8]; - EXPECT_EQ(get_assignature[9])>( - reinterpret_cast(&last_msg_->signature[9])), - 9) - << "incorrect value for signature[9], expected 9, is " - << last_msg_->signature[9]; - EXPECT_EQ(get_assignature[10])>( - reinterpret_cast(&last_msg_->signature[10])), - 10) - << "incorrect value for signature[10], expected 10, is " - << last_msg_->signature[10]; - EXPECT_EQ(get_assignature[11])>( - reinterpret_cast(&last_msg_->signature[11])), - 11) - << "incorrect value for signature[11], expected 11, is " - << last_msg_->signature[11]; - EXPECT_EQ(get_assignature[12])>( - reinterpret_cast(&last_msg_->signature[12])), - 12) - << "incorrect value for signature[12], expected 12, is " - << last_msg_->signature[12]; - EXPECT_EQ(get_assignature[13])>( - reinterpret_cast(&last_msg_->signature[13])), - 13) - << "incorrect value for signature[13], expected 13, is " - << last_msg_->signature[13]; - EXPECT_EQ(get_assignature[14])>( - reinterpret_cast(&last_msg_->signature[14])), - 14) - << "incorrect value for signature[14], expected 14, is " - << last_msg_->signature[14]; - EXPECT_EQ(get_assignature[15])>( - reinterpret_cast(&last_msg_->signature[15])), - 15) - << "incorrect value for signature[15], expected 15, is " - << last_msg_->signature[15]; - EXPECT_EQ(get_assignature[16])>( - reinterpret_cast(&last_msg_->signature[16])), - 16) - << "incorrect value for signature[16], expected 16, is " - << last_msg_->signature[16]; - EXPECT_EQ(get_assignature[17])>( - reinterpret_cast(&last_msg_->signature[17])), - 17) - << "incorrect value for signature[17], expected 17, is " - << last_msg_->signature[17]; - EXPECT_EQ(get_assignature[18])>( - reinterpret_cast(&last_msg_->signature[18])), - 18) - << "incorrect value for signature[18], expected 18, is " - << last_msg_->signature[18]; - EXPECT_EQ(get_assignature[19])>( - reinterpret_cast(&last_msg_->signature[19])), - 19) - << "incorrect value for signature[19], expected 19, is " - << last_msg_->signature[19]; - EXPECT_EQ(get_assignature[20])>( - reinterpret_cast(&last_msg_->signature[20])), - 20) - << "incorrect value for signature[20], expected 20, is " - << last_msg_->signature[20]; - EXPECT_EQ(get_assignature[21])>( - reinterpret_cast(&last_msg_->signature[21])), - 21) - << "incorrect value for signature[21], expected 21, is " - << last_msg_->signature[21]; - EXPECT_EQ(get_assignature[22])>( - reinterpret_cast(&last_msg_->signature[22])), - 22) - << "incorrect value for signature[22], expected 22, is " - << last_msg_->signature[22]; - EXPECT_EQ(get_assignature[23])>( - reinterpret_cast(&last_msg_->signature[23])), - 23) - << "incorrect value for signature[23], expected 23, is " - << last_msg_->signature[23]; - EXPECT_EQ(get_assignature[24])>( - reinterpret_cast(&last_msg_->signature[24])), - 24) - << "incorrect value for signature[24], expected 24, is " - << last_msg_->signature[24]; - EXPECT_EQ(get_assignature[25])>( - reinterpret_cast(&last_msg_->signature[25])), - 25) - << "incorrect value for signature[25], expected 25, is " - << last_msg_->signature[25]; - EXPECT_EQ(get_assignature[26])>( - reinterpret_cast(&last_msg_->signature[26])), - 26) - << "incorrect value for signature[26], expected 26, is " - << last_msg_->signature[26]; - EXPECT_EQ(get_assignature[27])>( - reinterpret_cast(&last_msg_->signature[27])), - 27) - << "incorrect value for signature[27], expected 27, is " - << last_msg_->signature[27]; - EXPECT_EQ(get_assignature[28])>( - reinterpret_cast(&last_msg_->signature[28])), - 28) - << "incorrect value for signature[28], expected 28, is " - << last_msg_->signature[28]; - EXPECT_EQ(get_assignature[29])>( - reinterpret_cast(&last_msg_->signature[29])), - 29) - << "incorrect value for signature[29], expected 29, is " - << last_msg_->signature[29]; - EXPECT_EQ(get_assignature[30])>( - reinterpret_cast(&last_msg_->signature[30])), - 30) - << "incorrect value for signature[30], expected 30, is " - << last_msg_->signature[30]; - EXPECT_EQ(get_assignature[31])>( - reinterpret_cast(&last_msg_->signature[31])), - 31) - << "incorrect value for signature[31], expected 31, is " - << last_msg_->signature[31]; - EXPECT_EQ(get_assignature[32])>( - reinterpret_cast(&last_msg_->signature[32])), - 32) - << "incorrect value for signature[32], expected 32, is " - << last_msg_->signature[32]; - EXPECT_EQ(get_assignature[33])>( - reinterpret_cast(&last_msg_->signature[33])), - 33) - << "incorrect value for signature[33], expected 33, is " - << last_msg_->signature[33]; - EXPECT_EQ(get_assignature[34])>( - reinterpret_cast(&last_msg_->signature[34])), - 34) - << "incorrect value for signature[34], expected 34, is " - << last_msg_->signature[34]; - EXPECT_EQ(get_assignature[35])>( - reinterpret_cast(&last_msg_->signature[35])), - 35) - << "incorrect value for signature[35], expected 35, is " - << last_msg_->signature[35]; - EXPECT_EQ(get_assignature[36])>( - reinterpret_cast(&last_msg_->signature[36])), - 36) - << "incorrect value for signature[36], expected 36, is " - << last_msg_->signature[36]; - EXPECT_EQ(get_assignature[37])>( - reinterpret_cast(&last_msg_->signature[37])), - 37) - << "incorrect value for signature[37], expected 37, is " - << last_msg_->signature[37]; - EXPECT_EQ(get_assignature[38])>( - reinterpret_cast(&last_msg_->signature[38])), - 38) - << "incorrect value for signature[38], expected 38, is " - << last_msg_->signature[38]; - EXPECT_EQ(get_assignature[39])>( - reinterpret_cast(&last_msg_->signature[39])), - 39) - << "incorrect value for signature[39], expected 39, is " - << last_msg_->signature[39]; - EXPECT_EQ(get_assignature[40])>( - reinterpret_cast(&last_msg_->signature[40])), - 40) - << "incorrect value for signature[40], expected 40, is " - << last_msg_->signature[40]; - EXPECT_EQ(get_assignature[41])>( - reinterpret_cast(&last_msg_->signature[41])), - 41) - << "incorrect value for signature[41], expected 41, is " - << last_msg_->signature[41]; - EXPECT_EQ(get_assignature[42])>( - reinterpret_cast(&last_msg_->signature[42])), - 42) - << "incorrect value for signature[42], expected 42, is " - << last_msg_->signature[42]; - EXPECT_EQ(get_assignature[43])>( - reinterpret_cast(&last_msg_->signature[43])), - 43) - << "incorrect value for signature[43], expected 43, is " - << last_msg_->signature[43]; - EXPECT_EQ(get_assignature[44])>( - reinterpret_cast(&last_msg_->signature[44])), - 44) - << "incorrect value for signature[44], expected 44, is " - << last_msg_->signature[44]; - EXPECT_EQ(get_assignature[45])>( - reinterpret_cast(&last_msg_->signature[45])), - 45) - << "incorrect value for signature[45], expected 45, is " - << last_msg_->signature[45]; - EXPECT_EQ(get_assignature[46])>( - reinterpret_cast(&last_msg_->signature[46])), - 46) - << "incorrect value for signature[46], expected 46, is " - << last_msg_->signature[46]; - EXPECT_EQ(get_assignature[47])>( - reinterpret_cast(&last_msg_->signature[47])), - 47) - << "incorrect value for signature[47], expected 47, is " - << last_msg_->signature[47]; - EXPECT_EQ(get_assignature[48])>( - reinterpret_cast(&last_msg_->signature[48])), - 48) - << "incorrect value for signature[48], expected 48, is " - << last_msg_->signature[48]; - EXPECT_EQ(get_assignature[49])>( - reinterpret_cast(&last_msg_->signature[49])), - 49) - << "incorrect value for signature[49], expected 49, is " - << last_msg_->signature[49]; - EXPECT_EQ(get_assignature[50])>( - reinterpret_cast(&last_msg_->signature[50])), - 50) - << "incorrect value for signature[50], expected 50, is " - << last_msg_->signature[50]; - EXPECT_EQ(get_assignature[51])>( - reinterpret_cast(&last_msg_->signature[51])), - 51) - << "incorrect value for signature[51], expected 51, is " - << last_msg_->signature[51]; - EXPECT_EQ(get_assignature[52])>( - reinterpret_cast(&last_msg_->signature[52])), - 52) - << "incorrect value for signature[52], expected 52, is " - << last_msg_->signature[52]; - EXPECT_EQ(get_assignature[53])>( - reinterpret_cast(&last_msg_->signature[53])), - 53) - << "incorrect value for signature[53], expected 53, is " - << last_msg_->signature[53]; - EXPECT_EQ(get_assignature[54])>( - reinterpret_cast(&last_msg_->signature[54])), - 54) - << "incorrect value for signature[54], expected 54, is " - << last_msg_->signature[54]; - EXPECT_EQ(get_assignature[55])>( - reinterpret_cast(&last_msg_->signature[55])), - 55) - << "incorrect value for signature[55], expected 55, is " - << last_msg_->signature[55]; - EXPECT_EQ(get_assignature[56])>( - reinterpret_cast(&last_msg_->signature[56])), - 56) - << "incorrect value for signature[56], expected 56, is " - << last_msg_->signature[56]; - EXPECT_EQ(get_assignature[57])>( - reinterpret_cast(&last_msg_->signature[57])), - 57) - << "incorrect value for signature[57], expected 57, is " - << last_msg_->signature[57]; - EXPECT_EQ(get_assignature[58])>( - reinterpret_cast(&last_msg_->signature[58])), - 58) - << "incorrect value for signature[58], expected 58, is " - << last_msg_->signature[58]; - EXPECT_EQ(get_assignature[59])>( - reinterpret_cast(&last_msg_->signature[59])), - 59) - << "incorrect value for signature[59], expected 59, is " - << last_msg_->signature[59]; - EXPECT_EQ(get_assignature[60])>( - reinterpret_cast(&last_msg_->signature[60])), - 60) - << "incorrect value for signature[60], expected 60, is " - << last_msg_->signature[60]; - EXPECT_EQ(get_assignature[61])>( - reinterpret_cast(&last_msg_->signature[61])), - 61) - << "incorrect value for signature[61], expected 61, is " - << last_msg_->signature[61]; - EXPECT_EQ(get_assignature[62])>( - reinterpret_cast(&last_msg_->signature[62])), - 62) - << "incorrect value for signature[62], expected 62, is " - << last_msg_->signature[62]; - EXPECT_EQ(get_assignature[63])>( - reinterpret_cast(&last_msg_->signature[63])), - 63) - << "incorrect value for signature[63], expected 63, is " - << last_msg_->signature[63]; - EXPECT_EQ( - get_assigned_messages[0])>( - reinterpret_cast(&last_msg_->signed_messages[0])), - 5000) - << "incorrect value for signed_messages[0], expected 5000, is " - << last_msg_->signed_messages[0]; - EXPECT_EQ( - get_assigned_messages[1])>( - reinterpret_cast(&last_msg_->signed_messages[1])), - 5234) - << "incorrect value for signed_messages[1], expected 5234, is " - << last_msg_->signed_messages[1]; - EXPECT_EQ( - get_assigned_messages[2])>( - reinterpret_cast(&last_msg_->signed_messages[2])), - 5468) - << "incorrect value for signed_messages[2], expected 5468, is " - << last_msg_->signed_messages[2]; - EXPECT_EQ( - get_assigned_messages[3])>( - reinterpret_cast(&last_msg_->signed_messages[3])), - 5702) - << "incorrect value for signed_messages[3], expected 5702, is " - << last_msg_->signed_messages[3]; - EXPECT_EQ( - get_assigned_messages[4])>( - reinterpret_cast(&last_msg_->signed_messages[4])), - 5936) - << "incorrect value for signed_messages[4], expected 5936, is " - << last_msg_->signed_messages[4]; - EXPECT_EQ( - get_assigned_messages[5])>( - reinterpret_cast(&last_msg_->signed_messages[5])), - 6170) - << "incorrect value for signed_messages[5], expected 6170, is " - << last_msg_->signed_messages[5]; - EXPECT_EQ( - get_assigned_messages[6])>( - reinterpret_cast(&last_msg_->signed_messages[6])), - 6404) - << "incorrect value for signed_messages[6], expected 6404, is " - << last_msg_->signed_messages[6]; - EXPECT_EQ( - get_assigned_messages[7])>( - reinterpret_cast(&last_msg_->signed_messages[7])), - 6638) - << "incorrect value for signed_messages[7], expected 6638, is " - << last_msg_->signed_messages[7]; - EXPECT_EQ( - get_assigned_messages[8])>( - reinterpret_cast(&last_msg_->signed_messages[8])), - 6872) - << "incorrect value for signed_messages[8], expected 6872, is " - << last_msg_->signed_messages[8]; - EXPECT_EQ( - get_assigned_messages[9])>( - reinterpret_cast(&last_msg_->signed_messages[9])), - 7106) - << "incorrect value for signed_messages[9], expected 7106, is " - << last_msg_->signed_messages[9]; - EXPECT_EQ( - get_assigned_messages[10])>( - reinterpret_cast(&last_msg_->signed_messages[10])), - 7340) - << "incorrect value for signed_messages[10], expected 7340, is " - << last_msg_->signed_messages[10]; - EXPECT_EQ( - get_assigned_messages[11])>( - reinterpret_cast(&last_msg_->signed_messages[11])), - 7574) - << "incorrect value for signed_messages[11], expected 7574, is " - << last_msg_->signed_messages[11]; - EXPECT_EQ( - get_assigned_messages[12])>( - reinterpret_cast(&last_msg_->signed_messages[12])), - 7808) - << "incorrect value for signed_messages[12], expected 7808, is " - << last_msg_->signed_messages[12]; - EXPECT_EQ( - get_assigned_messages[13])>( - reinterpret_cast(&last_msg_->signed_messages[13])), - 8042) - << "incorrect value for signed_messages[13], expected 8042, is " - << last_msg_->signed_messages[13]; - EXPECT_EQ( - get_assigned_messages[14])>( - reinterpret_cast(&last_msg_->signed_messages[14])), - 8276) - << "incorrect value for signed_messages[14], expected 8276, is " - << last_msg_->signed_messages[14]; - EXPECT_EQ( - get_assigned_messages[15])>( - reinterpret_cast(&last_msg_->signed_messages[15])), - 8510) - << "incorrect value for signed_messages[15], expected 8510, is " - << last_msg_->signed_messages[15]; - EXPECT_EQ( - get_assigned_messages[16])>( - reinterpret_cast(&last_msg_->signed_messages[16])), - 8744) - << "incorrect value for signed_messages[16], expected 8744, is " - << last_msg_->signed_messages[16]; - EXPECT_EQ( - get_assigned_messages[17])>( - reinterpret_cast(&last_msg_->signed_messages[17])), - 8978) - << "incorrect value for signed_messages[17], expected 8978, is " - << last_msg_->signed_messages[17]; - EXPECT_EQ( - get_assigned_messages[18])>( - reinterpret_cast(&last_msg_->signed_messages[18])), - 9212) - << "incorrect value for signed_messages[18], expected 9212, is " - << last_msg_->signed_messages[18]; - EXPECT_EQ( - get_assigned_messages[19])>( - reinterpret_cast(&last_msg_->signed_messages[19])), - 9446) - << "incorrect value for signed_messages[19], expected 9446, is " - << last_msg_->signed_messages[19]; - EXPECT_EQ( - get_assigned_messages[20])>( - reinterpret_cast(&last_msg_->signed_messages[20])), - 9680) - << "incorrect value for signed_messages[20], expected 9680, is " - << last_msg_->signed_messages[20]; - EXPECT_EQ( - get_assigned_messages[21])>( - reinterpret_cast(&last_msg_->signed_messages[21])), - 9914) - << "incorrect value for signed_messages[21], expected 9914, is " - << last_msg_->signed_messages[21]; - EXPECT_EQ( - get_assigned_messages[22])>( - reinterpret_cast(&last_msg_->signed_messages[22])), - 10148) - << "incorrect value for signed_messages[22], expected 10148, is " - << last_msg_->signed_messages[22]; - EXPECT_EQ( - get_assigned_messages[23])>( - reinterpret_cast(&last_msg_->signed_messages[23])), - 10382) - << "incorrect value for signed_messages[23], expected 10382, is " - << last_msg_->signed_messages[23]; - EXPECT_EQ( - get_assigned_messages[24])>( - reinterpret_cast(&last_msg_->signed_messages[24])), - 10616) - << "incorrect value for signed_messages[24], expected 10616, is " - << last_msg_->signed_messages[24]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_signing_MsgEd25519SignatureDepB.cc b/c/test/legacy/cpp/auto_check_sbp_signing_MsgEd25519SignatureDepB.cc deleted file mode 100644 index 670e34d699..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_signing_MsgEd25519SignatureDepB.cc +++ /dev/null @@ -1,1286 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/signing/test_MsgEd25519SignatureDepB.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_signing_MsgEd25519SignatureDepB0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_signing_MsgEd25519SignatureDepB0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ed25519_signature_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ed25519_signature_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_signing_MsgEd25519SignatureDepB0, Test) { - uint8_t encoded_frame[] = { - 85, 3, 12, 66, 0, 186, 1, 0, 0, 1, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 136, 19, 0, 0, 114, 20, 0, 0, 92, 21, 0, 0, 70, - 22, 0, 0, 48, 23, 0, 0, 26, 24, 0, 0, 4, 25, 0, 0, - 238, 25, 0, 0, 216, 26, 0, 0, 194, 27, 0, 0, 172, 28, 0, - 0, 150, 29, 0, 0, 128, 30, 0, 0, 106, 31, 0, 0, 84, 32, - 0, 0, 62, 33, 0, 0, 40, 34, 0, 0, 18, 35, 0, 0, 252, - 35, 0, 0, 230, 36, 0, 0, 208, 37, 0, 0, 186, 38, 0, 0, - 164, 39, 0, 0, 142, 40, 0, 0, 120, 41, 0, 0, 238, 145, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ed25519_signature_dep_b_t *test_msg = - (msg_ed25519_signature_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[0] = 100; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[1] = 101; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[2] = 102; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[3] = 103; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[4] = 104; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[5] = 105; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[6] = 106; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[7] = 107; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[8] = 108; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[9] = 109; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[10] = 110; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[11] = 111; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[12] = 112; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[13] = 113; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[14] = 114; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[15] = 115; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[16] = 116; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[17] = 117; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[18] = 118; - if (sizeof(test_msg->fingerprint) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->fingerprint[0])); - } - test_msg->fingerprint[19] = 119; - test_msg->on_demand_counter = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[0] = 0; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[1] = 1; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[2] = 2; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[3] = 3; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[4] = 4; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[5] = 5; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[6] = 6; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[7] = 7; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[8] = 8; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[9] = 9; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[10] = 10; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[11] = 11; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[12] = 12; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[13] = 13; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[14] = 14; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[15] = 15; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[16] = 16; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[17] = 17; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[18] = 18; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[19] = 19; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[20] = 20; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[21] = 21; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[22] = 22; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[23] = 23; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[24] = 24; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[25] = 25; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[26] = 26; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[27] = 27; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[28] = 28; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[29] = 29; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[30] = 30; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[31] = 31; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[32] = 32; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[33] = 33; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[34] = 34; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[35] = 35; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[36] = 36; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[37] = 37; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[38] = 38; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[39] = 39; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[40] = 40; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[41] = 41; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[42] = 42; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[43] = 43; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[44] = 44; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[45] = 45; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[46] = 46; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[47] = 47; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[48] = 48; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[49] = 49; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[50] = 50; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[51] = 51; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[52] = 52; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[53] = 53; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[54] = 54; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[55] = 55; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[56] = 56; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[57] = 57; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[58] = 58; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[59] = 59; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[60] = 60; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[61] = 61; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[62] = 62; - if (sizeof(test_msg->signature) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->signature[0])); - } - test_msg->signature[63] = 63; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[0] = 5000; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[1] = 5234; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[2] = 5468; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[3] = 5702; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[4] = 5936; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[5] = 6170; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[6] = 6404; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[7] = 6638; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[8] = 6872; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[9] = 7106; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[10] = 7340; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[11] = 7574; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[12] = 7808; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[13] = 8042; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[14] = 8276; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[15] = 8510; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[16] = 8744; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[17] = 8978; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[18] = 9212; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[19] = 9446; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[20] = 9680; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[21] = 9914; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[22] = 10148; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[23] = 10382; - if (sizeof(test_msg->signed_messages) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->signed_messages[0])); - } - test_msg->signed_messages[24] = 10616; - test_msg->stream_counter = 1; - - EXPECT_EQ(send_message(0xC03, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asfingerprint[0])>( - reinterpret_cast(&last_msg_->fingerprint[0])), - 100) - << "incorrect value for fingerprint[0], expected 100, is " - << last_msg_->fingerprint[0]; - EXPECT_EQ(get_asfingerprint[1])>( - reinterpret_cast(&last_msg_->fingerprint[1])), - 101) - << "incorrect value for fingerprint[1], expected 101, is " - << last_msg_->fingerprint[1]; - EXPECT_EQ(get_asfingerprint[2])>( - reinterpret_cast(&last_msg_->fingerprint[2])), - 102) - << "incorrect value for fingerprint[2], expected 102, is " - << last_msg_->fingerprint[2]; - EXPECT_EQ(get_asfingerprint[3])>( - reinterpret_cast(&last_msg_->fingerprint[3])), - 103) - << "incorrect value for fingerprint[3], expected 103, is " - << last_msg_->fingerprint[3]; - EXPECT_EQ(get_asfingerprint[4])>( - reinterpret_cast(&last_msg_->fingerprint[4])), - 104) - << "incorrect value for fingerprint[4], expected 104, is " - << last_msg_->fingerprint[4]; - EXPECT_EQ(get_asfingerprint[5])>( - reinterpret_cast(&last_msg_->fingerprint[5])), - 105) - << "incorrect value for fingerprint[5], expected 105, is " - << last_msg_->fingerprint[5]; - EXPECT_EQ(get_asfingerprint[6])>( - reinterpret_cast(&last_msg_->fingerprint[6])), - 106) - << "incorrect value for fingerprint[6], expected 106, is " - << last_msg_->fingerprint[6]; - EXPECT_EQ(get_asfingerprint[7])>( - reinterpret_cast(&last_msg_->fingerprint[7])), - 107) - << "incorrect value for fingerprint[7], expected 107, is " - << last_msg_->fingerprint[7]; - EXPECT_EQ(get_asfingerprint[8])>( - reinterpret_cast(&last_msg_->fingerprint[8])), - 108) - << "incorrect value for fingerprint[8], expected 108, is " - << last_msg_->fingerprint[8]; - EXPECT_EQ(get_asfingerprint[9])>( - reinterpret_cast(&last_msg_->fingerprint[9])), - 109) - << "incorrect value for fingerprint[9], expected 109, is " - << last_msg_->fingerprint[9]; - EXPECT_EQ(get_asfingerprint[10])>( - reinterpret_cast(&last_msg_->fingerprint[10])), - 110) - << "incorrect value for fingerprint[10], expected 110, is " - << last_msg_->fingerprint[10]; - EXPECT_EQ(get_asfingerprint[11])>( - reinterpret_cast(&last_msg_->fingerprint[11])), - 111) - << "incorrect value for fingerprint[11], expected 111, is " - << last_msg_->fingerprint[11]; - EXPECT_EQ(get_asfingerprint[12])>( - reinterpret_cast(&last_msg_->fingerprint[12])), - 112) - << "incorrect value for fingerprint[12], expected 112, is " - << last_msg_->fingerprint[12]; - EXPECT_EQ(get_asfingerprint[13])>( - reinterpret_cast(&last_msg_->fingerprint[13])), - 113) - << "incorrect value for fingerprint[13], expected 113, is " - << last_msg_->fingerprint[13]; - EXPECT_EQ(get_asfingerprint[14])>( - reinterpret_cast(&last_msg_->fingerprint[14])), - 114) - << "incorrect value for fingerprint[14], expected 114, is " - << last_msg_->fingerprint[14]; - EXPECT_EQ(get_asfingerprint[15])>( - reinterpret_cast(&last_msg_->fingerprint[15])), - 115) - << "incorrect value for fingerprint[15], expected 115, is " - << last_msg_->fingerprint[15]; - EXPECT_EQ(get_asfingerprint[16])>( - reinterpret_cast(&last_msg_->fingerprint[16])), - 116) - << "incorrect value for fingerprint[16], expected 116, is " - << last_msg_->fingerprint[16]; - EXPECT_EQ(get_asfingerprint[17])>( - reinterpret_cast(&last_msg_->fingerprint[17])), - 117) - << "incorrect value for fingerprint[17], expected 117, is " - << last_msg_->fingerprint[17]; - EXPECT_EQ(get_asfingerprint[18])>( - reinterpret_cast(&last_msg_->fingerprint[18])), - 118) - << "incorrect value for fingerprint[18], expected 118, is " - << last_msg_->fingerprint[18]; - EXPECT_EQ(get_asfingerprint[19])>( - reinterpret_cast(&last_msg_->fingerprint[19])), - 119) - << "incorrect value for fingerprint[19], expected 119, is " - << last_msg_->fingerprint[19]; - EXPECT_EQ( - get_ason_demand_counter)>( - reinterpret_cast(&last_msg_->on_demand_counter)), - 0) - << "incorrect value for on_demand_counter, expected 0, is " - << last_msg_->on_demand_counter; - EXPECT_EQ(get_assignature[0])>( - reinterpret_cast(&last_msg_->signature[0])), - 0) - << "incorrect value for signature[0], expected 0, is " - << last_msg_->signature[0]; - EXPECT_EQ(get_assignature[1])>( - reinterpret_cast(&last_msg_->signature[1])), - 1) - << "incorrect value for signature[1], expected 1, is " - << last_msg_->signature[1]; - EXPECT_EQ(get_assignature[2])>( - reinterpret_cast(&last_msg_->signature[2])), - 2) - << "incorrect value for signature[2], expected 2, is " - << last_msg_->signature[2]; - EXPECT_EQ(get_assignature[3])>( - reinterpret_cast(&last_msg_->signature[3])), - 3) - << "incorrect value for signature[3], expected 3, is " - << last_msg_->signature[3]; - EXPECT_EQ(get_assignature[4])>( - reinterpret_cast(&last_msg_->signature[4])), - 4) - << "incorrect value for signature[4], expected 4, is " - << last_msg_->signature[4]; - EXPECT_EQ(get_assignature[5])>( - reinterpret_cast(&last_msg_->signature[5])), - 5) - << "incorrect value for signature[5], expected 5, is " - << last_msg_->signature[5]; - EXPECT_EQ(get_assignature[6])>( - reinterpret_cast(&last_msg_->signature[6])), - 6) - << "incorrect value for signature[6], expected 6, is " - << last_msg_->signature[6]; - EXPECT_EQ(get_assignature[7])>( - reinterpret_cast(&last_msg_->signature[7])), - 7) - << "incorrect value for signature[7], expected 7, is " - << last_msg_->signature[7]; - EXPECT_EQ(get_assignature[8])>( - reinterpret_cast(&last_msg_->signature[8])), - 8) - << "incorrect value for signature[8], expected 8, is " - << last_msg_->signature[8]; - EXPECT_EQ(get_assignature[9])>( - reinterpret_cast(&last_msg_->signature[9])), - 9) - << "incorrect value for signature[9], expected 9, is " - << last_msg_->signature[9]; - EXPECT_EQ(get_assignature[10])>( - reinterpret_cast(&last_msg_->signature[10])), - 10) - << "incorrect value for signature[10], expected 10, is " - << last_msg_->signature[10]; - EXPECT_EQ(get_assignature[11])>( - reinterpret_cast(&last_msg_->signature[11])), - 11) - << "incorrect value for signature[11], expected 11, is " - << last_msg_->signature[11]; - EXPECT_EQ(get_assignature[12])>( - reinterpret_cast(&last_msg_->signature[12])), - 12) - << "incorrect value for signature[12], expected 12, is " - << last_msg_->signature[12]; - EXPECT_EQ(get_assignature[13])>( - reinterpret_cast(&last_msg_->signature[13])), - 13) - << "incorrect value for signature[13], expected 13, is " - << last_msg_->signature[13]; - EXPECT_EQ(get_assignature[14])>( - reinterpret_cast(&last_msg_->signature[14])), - 14) - << "incorrect value for signature[14], expected 14, is " - << last_msg_->signature[14]; - EXPECT_EQ(get_assignature[15])>( - reinterpret_cast(&last_msg_->signature[15])), - 15) - << "incorrect value for signature[15], expected 15, is " - << last_msg_->signature[15]; - EXPECT_EQ(get_assignature[16])>( - reinterpret_cast(&last_msg_->signature[16])), - 16) - << "incorrect value for signature[16], expected 16, is " - << last_msg_->signature[16]; - EXPECT_EQ(get_assignature[17])>( - reinterpret_cast(&last_msg_->signature[17])), - 17) - << "incorrect value for signature[17], expected 17, is " - << last_msg_->signature[17]; - EXPECT_EQ(get_assignature[18])>( - reinterpret_cast(&last_msg_->signature[18])), - 18) - << "incorrect value for signature[18], expected 18, is " - << last_msg_->signature[18]; - EXPECT_EQ(get_assignature[19])>( - reinterpret_cast(&last_msg_->signature[19])), - 19) - << "incorrect value for signature[19], expected 19, is " - << last_msg_->signature[19]; - EXPECT_EQ(get_assignature[20])>( - reinterpret_cast(&last_msg_->signature[20])), - 20) - << "incorrect value for signature[20], expected 20, is " - << last_msg_->signature[20]; - EXPECT_EQ(get_assignature[21])>( - reinterpret_cast(&last_msg_->signature[21])), - 21) - << "incorrect value for signature[21], expected 21, is " - << last_msg_->signature[21]; - EXPECT_EQ(get_assignature[22])>( - reinterpret_cast(&last_msg_->signature[22])), - 22) - << "incorrect value for signature[22], expected 22, is " - << last_msg_->signature[22]; - EXPECT_EQ(get_assignature[23])>( - reinterpret_cast(&last_msg_->signature[23])), - 23) - << "incorrect value for signature[23], expected 23, is " - << last_msg_->signature[23]; - EXPECT_EQ(get_assignature[24])>( - reinterpret_cast(&last_msg_->signature[24])), - 24) - << "incorrect value for signature[24], expected 24, is " - << last_msg_->signature[24]; - EXPECT_EQ(get_assignature[25])>( - reinterpret_cast(&last_msg_->signature[25])), - 25) - << "incorrect value for signature[25], expected 25, is " - << last_msg_->signature[25]; - EXPECT_EQ(get_assignature[26])>( - reinterpret_cast(&last_msg_->signature[26])), - 26) - << "incorrect value for signature[26], expected 26, is " - << last_msg_->signature[26]; - EXPECT_EQ(get_assignature[27])>( - reinterpret_cast(&last_msg_->signature[27])), - 27) - << "incorrect value for signature[27], expected 27, is " - << last_msg_->signature[27]; - EXPECT_EQ(get_assignature[28])>( - reinterpret_cast(&last_msg_->signature[28])), - 28) - << "incorrect value for signature[28], expected 28, is " - << last_msg_->signature[28]; - EXPECT_EQ(get_assignature[29])>( - reinterpret_cast(&last_msg_->signature[29])), - 29) - << "incorrect value for signature[29], expected 29, is " - << last_msg_->signature[29]; - EXPECT_EQ(get_assignature[30])>( - reinterpret_cast(&last_msg_->signature[30])), - 30) - << "incorrect value for signature[30], expected 30, is " - << last_msg_->signature[30]; - EXPECT_EQ(get_assignature[31])>( - reinterpret_cast(&last_msg_->signature[31])), - 31) - << "incorrect value for signature[31], expected 31, is " - << last_msg_->signature[31]; - EXPECT_EQ(get_assignature[32])>( - reinterpret_cast(&last_msg_->signature[32])), - 32) - << "incorrect value for signature[32], expected 32, is " - << last_msg_->signature[32]; - EXPECT_EQ(get_assignature[33])>( - reinterpret_cast(&last_msg_->signature[33])), - 33) - << "incorrect value for signature[33], expected 33, is " - << last_msg_->signature[33]; - EXPECT_EQ(get_assignature[34])>( - reinterpret_cast(&last_msg_->signature[34])), - 34) - << "incorrect value for signature[34], expected 34, is " - << last_msg_->signature[34]; - EXPECT_EQ(get_assignature[35])>( - reinterpret_cast(&last_msg_->signature[35])), - 35) - << "incorrect value for signature[35], expected 35, is " - << last_msg_->signature[35]; - EXPECT_EQ(get_assignature[36])>( - reinterpret_cast(&last_msg_->signature[36])), - 36) - << "incorrect value for signature[36], expected 36, is " - << last_msg_->signature[36]; - EXPECT_EQ(get_assignature[37])>( - reinterpret_cast(&last_msg_->signature[37])), - 37) - << "incorrect value for signature[37], expected 37, is " - << last_msg_->signature[37]; - EXPECT_EQ(get_assignature[38])>( - reinterpret_cast(&last_msg_->signature[38])), - 38) - << "incorrect value for signature[38], expected 38, is " - << last_msg_->signature[38]; - EXPECT_EQ(get_assignature[39])>( - reinterpret_cast(&last_msg_->signature[39])), - 39) - << "incorrect value for signature[39], expected 39, is " - << last_msg_->signature[39]; - EXPECT_EQ(get_assignature[40])>( - reinterpret_cast(&last_msg_->signature[40])), - 40) - << "incorrect value for signature[40], expected 40, is " - << last_msg_->signature[40]; - EXPECT_EQ(get_assignature[41])>( - reinterpret_cast(&last_msg_->signature[41])), - 41) - << "incorrect value for signature[41], expected 41, is " - << last_msg_->signature[41]; - EXPECT_EQ(get_assignature[42])>( - reinterpret_cast(&last_msg_->signature[42])), - 42) - << "incorrect value for signature[42], expected 42, is " - << last_msg_->signature[42]; - EXPECT_EQ(get_assignature[43])>( - reinterpret_cast(&last_msg_->signature[43])), - 43) - << "incorrect value for signature[43], expected 43, is " - << last_msg_->signature[43]; - EXPECT_EQ(get_assignature[44])>( - reinterpret_cast(&last_msg_->signature[44])), - 44) - << "incorrect value for signature[44], expected 44, is " - << last_msg_->signature[44]; - EXPECT_EQ(get_assignature[45])>( - reinterpret_cast(&last_msg_->signature[45])), - 45) - << "incorrect value for signature[45], expected 45, is " - << last_msg_->signature[45]; - EXPECT_EQ(get_assignature[46])>( - reinterpret_cast(&last_msg_->signature[46])), - 46) - << "incorrect value for signature[46], expected 46, is " - << last_msg_->signature[46]; - EXPECT_EQ(get_assignature[47])>( - reinterpret_cast(&last_msg_->signature[47])), - 47) - << "incorrect value for signature[47], expected 47, is " - << last_msg_->signature[47]; - EXPECT_EQ(get_assignature[48])>( - reinterpret_cast(&last_msg_->signature[48])), - 48) - << "incorrect value for signature[48], expected 48, is " - << last_msg_->signature[48]; - EXPECT_EQ(get_assignature[49])>( - reinterpret_cast(&last_msg_->signature[49])), - 49) - << "incorrect value for signature[49], expected 49, is " - << last_msg_->signature[49]; - EXPECT_EQ(get_assignature[50])>( - reinterpret_cast(&last_msg_->signature[50])), - 50) - << "incorrect value for signature[50], expected 50, is " - << last_msg_->signature[50]; - EXPECT_EQ(get_assignature[51])>( - reinterpret_cast(&last_msg_->signature[51])), - 51) - << "incorrect value for signature[51], expected 51, is " - << last_msg_->signature[51]; - EXPECT_EQ(get_assignature[52])>( - reinterpret_cast(&last_msg_->signature[52])), - 52) - << "incorrect value for signature[52], expected 52, is " - << last_msg_->signature[52]; - EXPECT_EQ(get_assignature[53])>( - reinterpret_cast(&last_msg_->signature[53])), - 53) - << "incorrect value for signature[53], expected 53, is " - << last_msg_->signature[53]; - EXPECT_EQ(get_assignature[54])>( - reinterpret_cast(&last_msg_->signature[54])), - 54) - << "incorrect value for signature[54], expected 54, is " - << last_msg_->signature[54]; - EXPECT_EQ(get_assignature[55])>( - reinterpret_cast(&last_msg_->signature[55])), - 55) - << "incorrect value for signature[55], expected 55, is " - << last_msg_->signature[55]; - EXPECT_EQ(get_assignature[56])>( - reinterpret_cast(&last_msg_->signature[56])), - 56) - << "incorrect value for signature[56], expected 56, is " - << last_msg_->signature[56]; - EXPECT_EQ(get_assignature[57])>( - reinterpret_cast(&last_msg_->signature[57])), - 57) - << "incorrect value for signature[57], expected 57, is " - << last_msg_->signature[57]; - EXPECT_EQ(get_assignature[58])>( - reinterpret_cast(&last_msg_->signature[58])), - 58) - << "incorrect value for signature[58], expected 58, is " - << last_msg_->signature[58]; - EXPECT_EQ(get_assignature[59])>( - reinterpret_cast(&last_msg_->signature[59])), - 59) - << "incorrect value for signature[59], expected 59, is " - << last_msg_->signature[59]; - EXPECT_EQ(get_assignature[60])>( - reinterpret_cast(&last_msg_->signature[60])), - 60) - << "incorrect value for signature[60], expected 60, is " - << last_msg_->signature[60]; - EXPECT_EQ(get_assignature[61])>( - reinterpret_cast(&last_msg_->signature[61])), - 61) - << "incorrect value for signature[61], expected 61, is " - << last_msg_->signature[61]; - EXPECT_EQ(get_assignature[62])>( - reinterpret_cast(&last_msg_->signature[62])), - 62) - << "incorrect value for signature[62], expected 62, is " - << last_msg_->signature[62]; - EXPECT_EQ(get_assignature[63])>( - reinterpret_cast(&last_msg_->signature[63])), - 63) - << "incorrect value for signature[63], expected 63, is " - << last_msg_->signature[63]; - EXPECT_EQ( - get_assigned_messages[0])>( - reinterpret_cast(&last_msg_->signed_messages[0])), - 5000) - << "incorrect value for signed_messages[0], expected 5000, is " - << last_msg_->signed_messages[0]; - EXPECT_EQ( - get_assigned_messages[1])>( - reinterpret_cast(&last_msg_->signed_messages[1])), - 5234) - << "incorrect value for signed_messages[1], expected 5234, is " - << last_msg_->signed_messages[1]; - EXPECT_EQ( - get_assigned_messages[2])>( - reinterpret_cast(&last_msg_->signed_messages[2])), - 5468) - << "incorrect value for signed_messages[2], expected 5468, is " - << last_msg_->signed_messages[2]; - EXPECT_EQ( - get_assigned_messages[3])>( - reinterpret_cast(&last_msg_->signed_messages[3])), - 5702) - << "incorrect value for signed_messages[3], expected 5702, is " - << last_msg_->signed_messages[3]; - EXPECT_EQ( - get_assigned_messages[4])>( - reinterpret_cast(&last_msg_->signed_messages[4])), - 5936) - << "incorrect value for signed_messages[4], expected 5936, is " - << last_msg_->signed_messages[4]; - EXPECT_EQ( - get_assigned_messages[5])>( - reinterpret_cast(&last_msg_->signed_messages[5])), - 6170) - << "incorrect value for signed_messages[5], expected 6170, is " - << last_msg_->signed_messages[5]; - EXPECT_EQ( - get_assigned_messages[6])>( - reinterpret_cast(&last_msg_->signed_messages[6])), - 6404) - << "incorrect value for signed_messages[6], expected 6404, is " - << last_msg_->signed_messages[6]; - EXPECT_EQ( - get_assigned_messages[7])>( - reinterpret_cast(&last_msg_->signed_messages[7])), - 6638) - << "incorrect value for signed_messages[7], expected 6638, is " - << last_msg_->signed_messages[7]; - EXPECT_EQ( - get_assigned_messages[8])>( - reinterpret_cast(&last_msg_->signed_messages[8])), - 6872) - << "incorrect value for signed_messages[8], expected 6872, is " - << last_msg_->signed_messages[8]; - EXPECT_EQ( - get_assigned_messages[9])>( - reinterpret_cast(&last_msg_->signed_messages[9])), - 7106) - << "incorrect value for signed_messages[9], expected 7106, is " - << last_msg_->signed_messages[9]; - EXPECT_EQ( - get_assigned_messages[10])>( - reinterpret_cast(&last_msg_->signed_messages[10])), - 7340) - << "incorrect value for signed_messages[10], expected 7340, is " - << last_msg_->signed_messages[10]; - EXPECT_EQ( - get_assigned_messages[11])>( - reinterpret_cast(&last_msg_->signed_messages[11])), - 7574) - << "incorrect value for signed_messages[11], expected 7574, is " - << last_msg_->signed_messages[11]; - EXPECT_EQ( - get_assigned_messages[12])>( - reinterpret_cast(&last_msg_->signed_messages[12])), - 7808) - << "incorrect value for signed_messages[12], expected 7808, is " - << last_msg_->signed_messages[12]; - EXPECT_EQ( - get_assigned_messages[13])>( - reinterpret_cast(&last_msg_->signed_messages[13])), - 8042) - << "incorrect value for signed_messages[13], expected 8042, is " - << last_msg_->signed_messages[13]; - EXPECT_EQ( - get_assigned_messages[14])>( - reinterpret_cast(&last_msg_->signed_messages[14])), - 8276) - << "incorrect value for signed_messages[14], expected 8276, is " - << last_msg_->signed_messages[14]; - EXPECT_EQ( - get_assigned_messages[15])>( - reinterpret_cast(&last_msg_->signed_messages[15])), - 8510) - << "incorrect value for signed_messages[15], expected 8510, is " - << last_msg_->signed_messages[15]; - EXPECT_EQ( - get_assigned_messages[16])>( - reinterpret_cast(&last_msg_->signed_messages[16])), - 8744) - << "incorrect value for signed_messages[16], expected 8744, is " - << last_msg_->signed_messages[16]; - EXPECT_EQ( - get_assigned_messages[17])>( - reinterpret_cast(&last_msg_->signed_messages[17])), - 8978) - << "incorrect value for signed_messages[17], expected 8978, is " - << last_msg_->signed_messages[17]; - EXPECT_EQ( - get_assigned_messages[18])>( - reinterpret_cast(&last_msg_->signed_messages[18])), - 9212) - << "incorrect value for signed_messages[18], expected 9212, is " - << last_msg_->signed_messages[18]; - EXPECT_EQ( - get_assigned_messages[19])>( - reinterpret_cast(&last_msg_->signed_messages[19])), - 9446) - << "incorrect value for signed_messages[19], expected 9446, is " - << last_msg_->signed_messages[19]; - EXPECT_EQ( - get_assigned_messages[20])>( - reinterpret_cast(&last_msg_->signed_messages[20])), - 9680) - << "incorrect value for signed_messages[20], expected 9680, is " - << last_msg_->signed_messages[20]; - EXPECT_EQ( - get_assigned_messages[21])>( - reinterpret_cast(&last_msg_->signed_messages[21])), - 9914) - << "incorrect value for signed_messages[21], expected 9914, is " - << last_msg_->signed_messages[21]; - EXPECT_EQ( - get_assigned_messages[22])>( - reinterpret_cast(&last_msg_->signed_messages[22])), - 10148) - << "incorrect value for signed_messages[22], expected 10148, is " - << last_msg_->signed_messages[22]; - EXPECT_EQ( - get_assigned_messages[23])>( - reinterpret_cast(&last_msg_->signed_messages[23])), - 10382) - << "incorrect value for signed_messages[23], expected 10382, is " - << last_msg_->signed_messages[23]; - EXPECT_EQ( - get_assigned_messages[24])>( - reinterpret_cast(&last_msg_->signed_messages[24])), - 10616) - << "incorrect value for signed_messages[24], expected 10616, is " - << last_msg_->signed_messages[24]; - EXPECT_EQ(get_asstream_counter)>( - reinterpret_cast(&last_msg_->stream_counter)), - 1) - << "incorrect value for stream_counter, expected 1, is " - << last_msg_->stream_counter; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_solution_meta_MsgSolnMeta.cc b/c/test/legacy/cpp/auto_check_sbp_solution_meta_MsgSolnMeta.cc deleted file mode 100644 index 52b54870cf..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_solution_meta_MsgSolnMeta.cc +++ /dev/null @@ -1,2301 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/soln_meta/test_MsgSolnMeta.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_solution_meta_MsgSolnMeta0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_solution_meta_MsgSolnMeta0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_soln_meta_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_soln_meta_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_solution_meta_MsgSolnMeta0, Test) { - uint8_t encoded_frame[] = { - 85, 14, 255, 0, 60, 254, 48, 208, 65, 216, 122, 45, 196, 160, 144, - 228, 8, 83, 89, 87, 3, 213, 95, 109, 86, 131, 71, 70, 84, 73, - 131, 26, 82, 247, 140, 97, 115, 110, 118, 253, 2, 122, 186, 148, 122, - 148, 180, 231, 68, 46, 190, 102, 243, 48, 192, 15, 208, 89, 56, 10, - 245, 2, 254, 201, 120, 32, 126, 2, 83, 161, 238, 123, 102, 230, 76, - 190, 225, 182, 207, 228, 7, 218, 117, 89, 29, 191, 56, 248, 185, 255, - 46, 18, 72, 142, 82, 113, 26, 4, 172, 254, 178, 136, 113, 115, 58, - 193, 89, 227, 182, 246, 76, 77, 108, 245, 41, 31, 70, 124, 249, 145, - 15, 78, 228, 38, 241, 129, 8, 176, 251, 72, 248, 80, 115, 244, 231, - 145, 191, 190, 178, 168, 89, 233, 69, 176, 174, 140, 182, 141, 81, 82, - 92, 79, 101, 223, 100, 64, 184, 215, 124, 37, 21, 227, 135, 102, 72, - 36, 219, 56, 146, 90, 219, 104, 227, 102, 83, 12, 41, 122, 173, 94, - 1, 174, 134, 130, 104, 237, 116, 249, 107, 230, 130, 123, 25, 162, 57, - 223, 193, 174, 146, 193, 239, 44, 246, 197, 214, 80, 83, 100, 66, 72, - 133, 137, 140, 82, 2, 2, 96, 9, 96, 158, 134, 97, 43, 129, 141, - 25, 183, 200, 214, 57, 248, 103, 222, 65, 195, 15, 244, 21, 180, 46, - 140, 130, 36, 17, 194, 209, 65, 254, 115, 103, 152, 129, 234, 235, 194, - 234, 170, 201, 210, 154, 150, 247, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_soln_meta_t *test_msg = (msg_soln_meta_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->age_corrections = 21256; - test_msg->age_gnss = 3573765977; - test_msg->hdop = 41156; - test_msg->pdop = 11642; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[0].flags = 109; - test_msg->sol_in[0].sensor_type = 95; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[1].flags = 131; - test_msg->sol_in[1].sensor_type = 86; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[2].flags = 70; - test_msg->sol_in[2].sensor_type = 71; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[3].flags = 73; - test_msg->sol_in[3].sensor_type = 84; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[4].flags = 26; - test_msg->sol_in[4].sensor_type = 131; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[5].flags = 247; - test_msg->sol_in[5].sensor_type = 82; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[6].flags = 97; - test_msg->sol_in[6].sensor_type = 140; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[7].flags = 110; - test_msg->sol_in[7].sensor_type = 115; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[8].flags = 253; - test_msg->sol_in[8].sensor_type = 118; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[9].flags = 122; - test_msg->sol_in[9].sensor_type = 2; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[10].flags = 148; - test_msg->sol_in[10].sensor_type = 186; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[11].flags = 148; - test_msg->sol_in[11].sensor_type = 122; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[12].flags = 231; - test_msg->sol_in[12].sensor_type = 180; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[13].flags = 46; - test_msg->sol_in[13].sensor_type = 68; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[14].flags = 102; - test_msg->sol_in[14].sensor_type = 190; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[15].flags = 48; - test_msg->sol_in[15].sensor_type = 243; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[16].flags = 15; - test_msg->sol_in[16].sensor_type = 192; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[17].flags = 89; - test_msg->sol_in[17].sensor_type = 208; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[18].flags = 10; - test_msg->sol_in[18].sensor_type = 56; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[19].flags = 2; - test_msg->sol_in[19].sensor_type = 245; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[20].flags = 201; - test_msg->sol_in[20].sensor_type = 254; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[21].flags = 32; - test_msg->sol_in[21].sensor_type = 120; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[22].flags = 2; - test_msg->sol_in[22].sensor_type = 126; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[23].flags = 161; - test_msg->sol_in[23].sensor_type = 83; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[24].flags = 123; - test_msg->sol_in[24].sensor_type = 238; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[25].flags = 230; - test_msg->sol_in[25].sensor_type = 102; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[26].flags = 190; - test_msg->sol_in[26].sensor_type = 76; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[27].flags = 182; - test_msg->sol_in[27].sensor_type = 225; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[28].flags = 228; - test_msg->sol_in[28].sensor_type = 207; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[29].flags = 218; - test_msg->sol_in[29].sensor_type = 7; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[30].flags = 89; - test_msg->sol_in[30].sensor_type = 117; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[31].flags = 191; - test_msg->sol_in[31].sensor_type = 29; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[32].flags = 248; - test_msg->sol_in[32].sensor_type = 56; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[33].flags = 255; - test_msg->sol_in[33].sensor_type = 185; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[34].flags = 18; - test_msg->sol_in[34].sensor_type = 46; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[35].flags = 142; - test_msg->sol_in[35].sensor_type = 72; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[36].flags = 113; - test_msg->sol_in[36].sensor_type = 82; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[37].flags = 4; - test_msg->sol_in[37].sensor_type = 26; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[38].flags = 254; - test_msg->sol_in[38].sensor_type = 172; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[39].flags = 136; - test_msg->sol_in[39].sensor_type = 178; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[40].flags = 115; - test_msg->sol_in[40].sensor_type = 113; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[41].flags = 193; - test_msg->sol_in[41].sensor_type = 58; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[42].flags = 227; - test_msg->sol_in[42].sensor_type = 89; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[43].flags = 246; - test_msg->sol_in[43].sensor_type = 182; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[44].flags = 77; - test_msg->sol_in[44].sensor_type = 76; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[45].flags = 245; - test_msg->sol_in[45].sensor_type = 108; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[46].flags = 31; - test_msg->sol_in[46].sensor_type = 41; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[47].flags = 124; - test_msg->sol_in[47].sensor_type = 70; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[48].flags = 145; - test_msg->sol_in[48].sensor_type = 249; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[49].flags = 78; - test_msg->sol_in[49].sensor_type = 15; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[50].flags = 38; - test_msg->sol_in[50].sensor_type = 228; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[51].flags = 129; - test_msg->sol_in[51].sensor_type = 241; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[52].flags = 176; - test_msg->sol_in[52].sensor_type = 8; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[53].flags = 72; - test_msg->sol_in[53].sensor_type = 251; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[54].flags = 80; - test_msg->sol_in[54].sensor_type = 248; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[55].flags = 244; - test_msg->sol_in[55].sensor_type = 115; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[56].flags = 145; - test_msg->sol_in[56].sensor_type = 231; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[57].flags = 190; - test_msg->sol_in[57].sensor_type = 191; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[58].flags = 168; - test_msg->sol_in[58].sensor_type = 178; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[59].flags = 233; - test_msg->sol_in[59].sensor_type = 89; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[60].flags = 176; - test_msg->sol_in[60].sensor_type = 69; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[61].flags = 140; - test_msg->sol_in[61].sensor_type = 174; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[62].flags = 141; - test_msg->sol_in[62].sensor_type = 182; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[63].flags = 82; - test_msg->sol_in[63].sensor_type = 81; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[64].flags = 79; - test_msg->sol_in[64].sensor_type = 92; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[65].flags = 223; - test_msg->sol_in[65].sensor_type = 101; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[66].flags = 64; - test_msg->sol_in[66].sensor_type = 100; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[67].flags = 215; - test_msg->sol_in[67].sensor_type = 184; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[68].flags = 37; - test_msg->sol_in[68].sensor_type = 124; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[69].flags = 227; - test_msg->sol_in[69].sensor_type = 21; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[70].flags = 102; - test_msg->sol_in[70].sensor_type = 135; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[71].flags = 36; - test_msg->sol_in[71].sensor_type = 72; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[72].flags = 56; - test_msg->sol_in[72].sensor_type = 219; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[73].flags = 90; - test_msg->sol_in[73].sensor_type = 146; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[74].flags = 104; - test_msg->sol_in[74].sensor_type = 219; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[75].flags = 102; - test_msg->sol_in[75].sensor_type = 227; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[76].flags = 12; - test_msg->sol_in[76].sensor_type = 83; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[77].flags = 122; - test_msg->sol_in[77].sensor_type = 41; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[78].flags = 94; - test_msg->sol_in[78].sensor_type = 173; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[79].flags = 174; - test_msg->sol_in[79].sensor_type = 1; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[80].flags = 130; - test_msg->sol_in[80].sensor_type = 134; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[81].flags = 237; - test_msg->sol_in[81].sensor_type = 104; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[82].flags = 249; - test_msg->sol_in[82].sensor_type = 116; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[83].flags = 230; - test_msg->sol_in[83].sensor_type = 107; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[84].flags = 123; - test_msg->sol_in[84].sensor_type = 130; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[85].flags = 162; - test_msg->sol_in[85].sensor_type = 25; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[86].flags = 223; - test_msg->sol_in[86].sensor_type = 57; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[87].flags = 174; - test_msg->sol_in[87].sensor_type = 193; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[88].flags = 193; - test_msg->sol_in[88].sensor_type = 146; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[89].flags = 44; - test_msg->sol_in[89].sensor_type = 239; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[90].flags = 197; - test_msg->sol_in[90].sensor_type = 246; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[91].flags = 80; - test_msg->sol_in[91].sensor_type = 214; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[92].flags = 100; - test_msg->sol_in[92].sensor_type = 83; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[93].flags = 72; - test_msg->sol_in[93].sensor_type = 66; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[94].flags = 137; - test_msg->sol_in[94].sensor_type = 133; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[95].flags = 82; - test_msg->sol_in[95].sensor_type = 140; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[96].flags = 2; - test_msg->sol_in[96].sensor_type = 2; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[97].flags = 9; - test_msg->sol_in[97].sensor_type = 96; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[98].flags = 158; - test_msg->sol_in[98].sensor_type = 96; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[99].flags = 97; - test_msg->sol_in[99].sensor_type = 134; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[100].flags = 129; - test_msg->sol_in[100].sensor_type = 43; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[101].flags = 25; - test_msg->sol_in[101].sensor_type = 141; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[102].flags = 200; - test_msg->sol_in[102].sensor_type = 183; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[103].flags = 57; - test_msg->sol_in[103].sensor_type = 214; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[104].flags = 103; - test_msg->sol_in[104].sensor_type = 248; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[105].flags = 65; - test_msg->sol_in[105].sensor_type = 222; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[106].flags = 15; - test_msg->sol_in[106].sensor_type = 195; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[107].flags = 21; - test_msg->sol_in[107].sensor_type = 244; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[108].flags = 46; - test_msg->sol_in[108].sensor_type = 180; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[109].flags = 130; - test_msg->sol_in[109].sensor_type = 140; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[110].flags = 17; - test_msg->sol_in[110].sensor_type = 36; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[111].flags = 209; - test_msg->sol_in[111].sensor_type = 194; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[112].flags = 254; - test_msg->sol_in[112].sensor_type = 65; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[113].flags = 103; - test_msg->sol_in[113].sensor_type = 115; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[114].flags = 129; - test_msg->sol_in[114].sensor_type = 152; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[115].flags = 235; - test_msg->sol_in[115].sensor_type = 234; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[116].flags = 234; - test_msg->sol_in[116].sensor_type = 194; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[117].flags = 201; - test_msg->sol_in[117].sensor_type = 170; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[118].flags = 154; - test_msg->sol_in[118].sensor_type = 210; - test_msg->tow = 3628191792; - test_msg->vdop = 58512; - - EXPECT_EQ(send_message(0xff0e, 15360, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 15360); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asage_corrections)>( - reinterpret_cast(&last_msg_->age_corrections)), - 21256) - << "incorrect value for age_corrections, expected 21256, is " - << last_msg_->age_corrections; - EXPECT_EQ(get_asage_gnss)>( - reinterpret_cast(&last_msg_->age_gnss)), - 3573765977) - << "incorrect value for age_gnss, expected 3573765977, is " - << last_msg_->age_gnss; - EXPECT_EQ(get_ashdop)>( - reinterpret_cast(&last_msg_->hdop)), - 41156) - << "incorrect value for hdop, expected 41156, is " << last_msg_->hdop; - EXPECT_EQ(get_aspdop)>( - reinterpret_cast(&last_msg_->pdop)), - 11642) - << "incorrect value for pdop, expected 11642, is " << last_msg_->pdop; - EXPECT_EQ(get_assol_in[0].flags)>( - reinterpret_cast(&last_msg_->sol_in[0].flags)), - 109) - << "incorrect value for sol_in[0].flags, expected 109, is " - << last_msg_->sol_in[0].flags; - EXPECT_EQ( - get_assol_in[0].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[0].sensor_type)), - 95) - << "incorrect value for sol_in[0].sensor_type, expected 95, is " - << last_msg_->sol_in[0].sensor_type; - EXPECT_EQ(get_assol_in[1].flags)>( - reinterpret_cast(&last_msg_->sol_in[1].flags)), - 131) - << "incorrect value for sol_in[1].flags, expected 131, is " - << last_msg_->sol_in[1].flags; - EXPECT_EQ( - get_assol_in[1].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[1].sensor_type)), - 86) - << "incorrect value for sol_in[1].sensor_type, expected 86, is " - << last_msg_->sol_in[1].sensor_type; - EXPECT_EQ(get_assol_in[2].flags)>( - reinterpret_cast(&last_msg_->sol_in[2].flags)), - 70) - << "incorrect value for sol_in[2].flags, expected 70, is " - << last_msg_->sol_in[2].flags; - EXPECT_EQ( - get_assol_in[2].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[2].sensor_type)), - 71) - << "incorrect value for sol_in[2].sensor_type, expected 71, is " - << last_msg_->sol_in[2].sensor_type; - EXPECT_EQ(get_assol_in[3].flags)>( - reinterpret_cast(&last_msg_->sol_in[3].flags)), - 73) - << "incorrect value for sol_in[3].flags, expected 73, is " - << last_msg_->sol_in[3].flags; - EXPECT_EQ( - get_assol_in[3].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[3].sensor_type)), - 84) - << "incorrect value for sol_in[3].sensor_type, expected 84, is " - << last_msg_->sol_in[3].sensor_type; - EXPECT_EQ(get_assol_in[4].flags)>( - reinterpret_cast(&last_msg_->sol_in[4].flags)), - 26) - << "incorrect value for sol_in[4].flags, expected 26, is " - << last_msg_->sol_in[4].flags; - EXPECT_EQ( - get_assol_in[4].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[4].sensor_type)), - 131) - << "incorrect value for sol_in[4].sensor_type, expected 131, is " - << last_msg_->sol_in[4].sensor_type; - EXPECT_EQ(get_assol_in[5].flags)>( - reinterpret_cast(&last_msg_->sol_in[5].flags)), - 247) - << "incorrect value for sol_in[5].flags, expected 247, is " - << last_msg_->sol_in[5].flags; - EXPECT_EQ( - get_assol_in[5].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[5].sensor_type)), - 82) - << "incorrect value for sol_in[5].sensor_type, expected 82, is " - << last_msg_->sol_in[5].sensor_type; - EXPECT_EQ(get_assol_in[6].flags)>( - reinterpret_cast(&last_msg_->sol_in[6].flags)), - 97) - << "incorrect value for sol_in[6].flags, expected 97, is " - << last_msg_->sol_in[6].flags; - EXPECT_EQ( - get_assol_in[6].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[6].sensor_type)), - 140) - << "incorrect value for sol_in[6].sensor_type, expected 140, is " - << last_msg_->sol_in[6].sensor_type; - EXPECT_EQ(get_assol_in[7].flags)>( - reinterpret_cast(&last_msg_->sol_in[7].flags)), - 110) - << "incorrect value for sol_in[7].flags, expected 110, is " - << last_msg_->sol_in[7].flags; - EXPECT_EQ( - get_assol_in[7].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[7].sensor_type)), - 115) - << "incorrect value for sol_in[7].sensor_type, expected 115, is " - << last_msg_->sol_in[7].sensor_type; - EXPECT_EQ(get_assol_in[8].flags)>( - reinterpret_cast(&last_msg_->sol_in[8].flags)), - 253) - << "incorrect value for sol_in[8].flags, expected 253, is " - << last_msg_->sol_in[8].flags; - EXPECT_EQ( - get_assol_in[8].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[8].sensor_type)), - 118) - << "incorrect value for sol_in[8].sensor_type, expected 118, is " - << last_msg_->sol_in[8].sensor_type; - EXPECT_EQ(get_assol_in[9].flags)>( - reinterpret_cast(&last_msg_->sol_in[9].flags)), - 122) - << "incorrect value for sol_in[9].flags, expected 122, is " - << last_msg_->sol_in[9].flags; - EXPECT_EQ( - get_assol_in[9].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[9].sensor_type)), - 2) - << "incorrect value for sol_in[9].sensor_type, expected 2, is " - << last_msg_->sol_in[9].sensor_type; - EXPECT_EQ( - get_assol_in[10].flags)>( - reinterpret_cast(&last_msg_->sol_in[10].flags)), - 148) - << "incorrect value for sol_in[10].flags, expected 148, is " - << last_msg_->sol_in[10].flags; - EXPECT_EQ(get_assol_in[10].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[10].sensor_type)), - 186) - << "incorrect value for sol_in[10].sensor_type, expected 186, is " - << last_msg_->sol_in[10].sensor_type; - EXPECT_EQ( - get_assol_in[11].flags)>( - reinterpret_cast(&last_msg_->sol_in[11].flags)), - 148) - << "incorrect value for sol_in[11].flags, expected 148, is " - << last_msg_->sol_in[11].flags; - EXPECT_EQ(get_assol_in[11].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[11].sensor_type)), - 122) - << "incorrect value for sol_in[11].sensor_type, expected 122, is " - << last_msg_->sol_in[11].sensor_type; - EXPECT_EQ( - get_assol_in[12].flags)>( - reinterpret_cast(&last_msg_->sol_in[12].flags)), - 231) - << "incorrect value for sol_in[12].flags, expected 231, is " - << last_msg_->sol_in[12].flags; - EXPECT_EQ(get_assol_in[12].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[12].sensor_type)), - 180) - << "incorrect value for sol_in[12].sensor_type, expected 180, is " - << last_msg_->sol_in[12].sensor_type; - EXPECT_EQ( - get_assol_in[13].flags)>( - reinterpret_cast(&last_msg_->sol_in[13].flags)), - 46) - << "incorrect value for sol_in[13].flags, expected 46, is " - << last_msg_->sol_in[13].flags; - EXPECT_EQ(get_assol_in[13].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[13].sensor_type)), - 68) - << "incorrect value for sol_in[13].sensor_type, expected 68, is " - << last_msg_->sol_in[13].sensor_type; - EXPECT_EQ( - get_assol_in[14].flags)>( - reinterpret_cast(&last_msg_->sol_in[14].flags)), - 102) - << "incorrect value for sol_in[14].flags, expected 102, is " - << last_msg_->sol_in[14].flags; - EXPECT_EQ(get_assol_in[14].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[14].sensor_type)), - 190) - << "incorrect value for sol_in[14].sensor_type, expected 190, is " - << last_msg_->sol_in[14].sensor_type; - EXPECT_EQ( - get_assol_in[15].flags)>( - reinterpret_cast(&last_msg_->sol_in[15].flags)), - 48) - << "incorrect value for sol_in[15].flags, expected 48, is " - << last_msg_->sol_in[15].flags; - EXPECT_EQ(get_assol_in[15].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[15].sensor_type)), - 243) - << "incorrect value for sol_in[15].sensor_type, expected 243, is " - << last_msg_->sol_in[15].sensor_type; - EXPECT_EQ( - get_assol_in[16].flags)>( - reinterpret_cast(&last_msg_->sol_in[16].flags)), - 15) - << "incorrect value for sol_in[16].flags, expected 15, is " - << last_msg_->sol_in[16].flags; - EXPECT_EQ(get_assol_in[16].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[16].sensor_type)), - 192) - << "incorrect value for sol_in[16].sensor_type, expected 192, is " - << last_msg_->sol_in[16].sensor_type; - EXPECT_EQ( - get_assol_in[17].flags)>( - reinterpret_cast(&last_msg_->sol_in[17].flags)), - 89) - << "incorrect value for sol_in[17].flags, expected 89, is " - << last_msg_->sol_in[17].flags; - EXPECT_EQ(get_assol_in[17].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[17].sensor_type)), - 208) - << "incorrect value for sol_in[17].sensor_type, expected 208, is " - << last_msg_->sol_in[17].sensor_type; - EXPECT_EQ( - get_assol_in[18].flags)>( - reinterpret_cast(&last_msg_->sol_in[18].flags)), - 10) - << "incorrect value for sol_in[18].flags, expected 10, is " - << last_msg_->sol_in[18].flags; - EXPECT_EQ(get_assol_in[18].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[18].sensor_type)), - 56) - << "incorrect value for sol_in[18].sensor_type, expected 56, is " - << last_msg_->sol_in[18].sensor_type; - EXPECT_EQ( - get_assol_in[19].flags)>( - reinterpret_cast(&last_msg_->sol_in[19].flags)), - 2) - << "incorrect value for sol_in[19].flags, expected 2, is " - << last_msg_->sol_in[19].flags; - EXPECT_EQ(get_assol_in[19].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[19].sensor_type)), - 245) - << "incorrect value for sol_in[19].sensor_type, expected 245, is " - << last_msg_->sol_in[19].sensor_type; - EXPECT_EQ( - get_assol_in[20].flags)>( - reinterpret_cast(&last_msg_->sol_in[20].flags)), - 201) - << "incorrect value for sol_in[20].flags, expected 201, is " - << last_msg_->sol_in[20].flags; - EXPECT_EQ(get_assol_in[20].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[20].sensor_type)), - 254) - << "incorrect value for sol_in[20].sensor_type, expected 254, is " - << last_msg_->sol_in[20].sensor_type; - EXPECT_EQ( - get_assol_in[21].flags)>( - reinterpret_cast(&last_msg_->sol_in[21].flags)), - 32) - << "incorrect value for sol_in[21].flags, expected 32, is " - << last_msg_->sol_in[21].flags; - EXPECT_EQ(get_assol_in[21].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[21].sensor_type)), - 120) - << "incorrect value for sol_in[21].sensor_type, expected 120, is " - << last_msg_->sol_in[21].sensor_type; - EXPECT_EQ( - get_assol_in[22].flags)>( - reinterpret_cast(&last_msg_->sol_in[22].flags)), - 2) - << "incorrect value for sol_in[22].flags, expected 2, is " - << last_msg_->sol_in[22].flags; - EXPECT_EQ(get_assol_in[22].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[22].sensor_type)), - 126) - << "incorrect value for sol_in[22].sensor_type, expected 126, is " - << last_msg_->sol_in[22].sensor_type; - EXPECT_EQ( - get_assol_in[23].flags)>( - reinterpret_cast(&last_msg_->sol_in[23].flags)), - 161) - << "incorrect value for sol_in[23].flags, expected 161, is " - << last_msg_->sol_in[23].flags; - EXPECT_EQ(get_assol_in[23].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[23].sensor_type)), - 83) - << "incorrect value for sol_in[23].sensor_type, expected 83, is " - << last_msg_->sol_in[23].sensor_type; - EXPECT_EQ( - get_assol_in[24].flags)>( - reinterpret_cast(&last_msg_->sol_in[24].flags)), - 123) - << "incorrect value for sol_in[24].flags, expected 123, is " - << last_msg_->sol_in[24].flags; - EXPECT_EQ(get_assol_in[24].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[24].sensor_type)), - 238) - << "incorrect value for sol_in[24].sensor_type, expected 238, is " - << last_msg_->sol_in[24].sensor_type; - EXPECT_EQ( - get_assol_in[25].flags)>( - reinterpret_cast(&last_msg_->sol_in[25].flags)), - 230) - << "incorrect value for sol_in[25].flags, expected 230, is " - << last_msg_->sol_in[25].flags; - EXPECT_EQ(get_assol_in[25].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[25].sensor_type)), - 102) - << "incorrect value for sol_in[25].sensor_type, expected 102, is " - << last_msg_->sol_in[25].sensor_type; - EXPECT_EQ( - get_assol_in[26].flags)>( - reinterpret_cast(&last_msg_->sol_in[26].flags)), - 190) - << "incorrect value for sol_in[26].flags, expected 190, is " - << last_msg_->sol_in[26].flags; - EXPECT_EQ(get_assol_in[26].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[26].sensor_type)), - 76) - << "incorrect value for sol_in[26].sensor_type, expected 76, is " - << last_msg_->sol_in[26].sensor_type; - EXPECT_EQ( - get_assol_in[27].flags)>( - reinterpret_cast(&last_msg_->sol_in[27].flags)), - 182) - << "incorrect value for sol_in[27].flags, expected 182, is " - << last_msg_->sol_in[27].flags; - EXPECT_EQ(get_assol_in[27].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[27].sensor_type)), - 225) - << "incorrect value for sol_in[27].sensor_type, expected 225, is " - << last_msg_->sol_in[27].sensor_type; - EXPECT_EQ( - get_assol_in[28].flags)>( - reinterpret_cast(&last_msg_->sol_in[28].flags)), - 228) - << "incorrect value for sol_in[28].flags, expected 228, is " - << last_msg_->sol_in[28].flags; - EXPECT_EQ(get_assol_in[28].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[28].sensor_type)), - 207) - << "incorrect value for sol_in[28].sensor_type, expected 207, is " - << last_msg_->sol_in[28].sensor_type; - EXPECT_EQ( - get_assol_in[29].flags)>( - reinterpret_cast(&last_msg_->sol_in[29].flags)), - 218) - << "incorrect value for sol_in[29].flags, expected 218, is " - << last_msg_->sol_in[29].flags; - EXPECT_EQ(get_assol_in[29].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[29].sensor_type)), - 7) - << "incorrect value for sol_in[29].sensor_type, expected 7, is " - << last_msg_->sol_in[29].sensor_type; - EXPECT_EQ( - get_assol_in[30].flags)>( - reinterpret_cast(&last_msg_->sol_in[30].flags)), - 89) - << "incorrect value for sol_in[30].flags, expected 89, is " - << last_msg_->sol_in[30].flags; - EXPECT_EQ(get_assol_in[30].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[30].sensor_type)), - 117) - << "incorrect value for sol_in[30].sensor_type, expected 117, is " - << last_msg_->sol_in[30].sensor_type; - EXPECT_EQ( - get_assol_in[31].flags)>( - reinterpret_cast(&last_msg_->sol_in[31].flags)), - 191) - << "incorrect value for sol_in[31].flags, expected 191, is " - << last_msg_->sol_in[31].flags; - EXPECT_EQ(get_assol_in[31].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[31].sensor_type)), - 29) - << "incorrect value for sol_in[31].sensor_type, expected 29, is " - << last_msg_->sol_in[31].sensor_type; - EXPECT_EQ( - get_assol_in[32].flags)>( - reinterpret_cast(&last_msg_->sol_in[32].flags)), - 248) - << "incorrect value for sol_in[32].flags, expected 248, is " - << last_msg_->sol_in[32].flags; - EXPECT_EQ(get_assol_in[32].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[32].sensor_type)), - 56) - << "incorrect value for sol_in[32].sensor_type, expected 56, is " - << last_msg_->sol_in[32].sensor_type; - EXPECT_EQ( - get_assol_in[33].flags)>( - reinterpret_cast(&last_msg_->sol_in[33].flags)), - 255) - << "incorrect value for sol_in[33].flags, expected 255, is " - << last_msg_->sol_in[33].flags; - EXPECT_EQ(get_assol_in[33].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[33].sensor_type)), - 185) - << "incorrect value for sol_in[33].sensor_type, expected 185, is " - << last_msg_->sol_in[33].sensor_type; - EXPECT_EQ( - get_assol_in[34].flags)>( - reinterpret_cast(&last_msg_->sol_in[34].flags)), - 18) - << "incorrect value for sol_in[34].flags, expected 18, is " - << last_msg_->sol_in[34].flags; - EXPECT_EQ(get_assol_in[34].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[34].sensor_type)), - 46) - << "incorrect value for sol_in[34].sensor_type, expected 46, is " - << last_msg_->sol_in[34].sensor_type; - EXPECT_EQ( - get_assol_in[35].flags)>( - reinterpret_cast(&last_msg_->sol_in[35].flags)), - 142) - << "incorrect value for sol_in[35].flags, expected 142, is " - << last_msg_->sol_in[35].flags; - EXPECT_EQ(get_assol_in[35].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[35].sensor_type)), - 72) - << "incorrect value for sol_in[35].sensor_type, expected 72, is " - << last_msg_->sol_in[35].sensor_type; - EXPECT_EQ( - get_assol_in[36].flags)>( - reinterpret_cast(&last_msg_->sol_in[36].flags)), - 113) - << "incorrect value for sol_in[36].flags, expected 113, is " - << last_msg_->sol_in[36].flags; - EXPECT_EQ(get_assol_in[36].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[36].sensor_type)), - 82) - << "incorrect value for sol_in[36].sensor_type, expected 82, is " - << last_msg_->sol_in[36].sensor_type; - EXPECT_EQ( - get_assol_in[37].flags)>( - reinterpret_cast(&last_msg_->sol_in[37].flags)), - 4) - << "incorrect value for sol_in[37].flags, expected 4, is " - << last_msg_->sol_in[37].flags; - EXPECT_EQ(get_assol_in[37].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[37].sensor_type)), - 26) - << "incorrect value for sol_in[37].sensor_type, expected 26, is " - << last_msg_->sol_in[37].sensor_type; - EXPECT_EQ( - get_assol_in[38].flags)>( - reinterpret_cast(&last_msg_->sol_in[38].flags)), - 254) - << "incorrect value for sol_in[38].flags, expected 254, is " - << last_msg_->sol_in[38].flags; - EXPECT_EQ(get_assol_in[38].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[38].sensor_type)), - 172) - << "incorrect value for sol_in[38].sensor_type, expected 172, is " - << last_msg_->sol_in[38].sensor_type; - EXPECT_EQ( - get_assol_in[39].flags)>( - reinterpret_cast(&last_msg_->sol_in[39].flags)), - 136) - << "incorrect value for sol_in[39].flags, expected 136, is " - << last_msg_->sol_in[39].flags; - EXPECT_EQ(get_assol_in[39].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[39].sensor_type)), - 178) - << "incorrect value for sol_in[39].sensor_type, expected 178, is " - << last_msg_->sol_in[39].sensor_type; - EXPECT_EQ( - get_assol_in[40].flags)>( - reinterpret_cast(&last_msg_->sol_in[40].flags)), - 115) - << "incorrect value for sol_in[40].flags, expected 115, is " - << last_msg_->sol_in[40].flags; - EXPECT_EQ(get_assol_in[40].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[40].sensor_type)), - 113) - << "incorrect value for sol_in[40].sensor_type, expected 113, is " - << last_msg_->sol_in[40].sensor_type; - EXPECT_EQ( - get_assol_in[41].flags)>( - reinterpret_cast(&last_msg_->sol_in[41].flags)), - 193) - << "incorrect value for sol_in[41].flags, expected 193, is " - << last_msg_->sol_in[41].flags; - EXPECT_EQ(get_assol_in[41].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[41].sensor_type)), - 58) - << "incorrect value for sol_in[41].sensor_type, expected 58, is " - << last_msg_->sol_in[41].sensor_type; - EXPECT_EQ( - get_assol_in[42].flags)>( - reinterpret_cast(&last_msg_->sol_in[42].flags)), - 227) - << "incorrect value for sol_in[42].flags, expected 227, is " - << last_msg_->sol_in[42].flags; - EXPECT_EQ(get_assol_in[42].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[42].sensor_type)), - 89) - << "incorrect value for sol_in[42].sensor_type, expected 89, is " - << last_msg_->sol_in[42].sensor_type; - EXPECT_EQ( - get_assol_in[43].flags)>( - reinterpret_cast(&last_msg_->sol_in[43].flags)), - 246) - << "incorrect value for sol_in[43].flags, expected 246, is " - << last_msg_->sol_in[43].flags; - EXPECT_EQ(get_assol_in[43].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[43].sensor_type)), - 182) - << "incorrect value for sol_in[43].sensor_type, expected 182, is " - << last_msg_->sol_in[43].sensor_type; - EXPECT_EQ( - get_assol_in[44].flags)>( - reinterpret_cast(&last_msg_->sol_in[44].flags)), - 77) - << "incorrect value for sol_in[44].flags, expected 77, is " - << last_msg_->sol_in[44].flags; - EXPECT_EQ(get_assol_in[44].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[44].sensor_type)), - 76) - << "incorrect value for sol_in[44].sensor_type, expected 76, is " - << last_msg_->sol_in[44].sensor_type; - EXPECT_EQ( - get_assol_in[45].flags)>( - reinterpret_cast(&last_msg_->sol_in[45].flags)), - 245) - << "incorrect value for sol_in[45].flags, expected 245, is " - << last_msg_->sol_in[45].flags; - EXPECT_EQ(get_assol_in[45].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[45].sensor_type)), - 108) - << "incorrect value for sol_in[45].sensor_type, expected 108, is " - << last_msg_->sol_in[45].sensor_type; - EXPECT_EQ( - get_assol_in[46].flags)>( - reinterpret_cast(&last_msg_->sol_in[46].flags)), - 31) - << "incorrect value for sol_in[46].flags, expected 31, is " - << last_msg_->sol_in[46].flags; - EXPECT_EQ(get_assol_in[46].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[46].sensor_type)), - 41) - << "incorrect value for sol_in[46].sensor_type, expected 41, is " - << last_msg_->sol_in[46].sensor_type; - EXPECT_EQ( - get_assol_in[47].flags)>( - reinterpret_cast(&last_msg_->sol_in[47].flags)), - 124) - << "incorrect value for sol_in[47].flags, expected 124, is " - << last_msg_->sol_in[47].flags; - EXPECT_EQ(get_assol_in[47].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[47].sensor_type)), - 70) - << "incorrect value for sol_in[47].sensor_type, expected 70, is " - << last_msg_->sol_in[47].sensor_type; - EXPECT_EQ( - get_assol_in[48].flags)>( - reinterpret_cast(&last_msg_->sol_in[48].flags)), - 145) - << "incorrect value for sol_in[48].flags, expected 145, is " - << last_msg_->sol_in[48].flags; - EXPECT_EQ(get_assol_in[48].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[48].sensor_type)), - 249) - << "incorrect value for sol_in[48].sensor_type, expected 249, is " - << last_msg_->sol_in[48].sensor_type; - EXPECT_EQ( - get_assol_in[49].flags)>( - reinterpret_cast(&last_msg_->sol_in[49].flags)), - 78) - << "incorrect value for sol_in[49].flags, expected 78, is " - << last_msg_->sol_in[49].flags; - EXPECT_EQ(get_assol_in[49].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[49].sensor_type)), - 15) - << "incorrect value for sol_in[49].sensor_type, expected 15, is " - << last_msg_->sol_in[49].sensor_type; - EXPECT_EQ( - get_assol_in[50].flags)>( - reinterpret_cast(&last_msg_->sol_in[50].flags)), - 38) - << "incorrect value for sol_in[50].flags, expected 38, is " - << last_msg_->sol_in[50].flags; - EXPECT_EQ(get_assol_in[50].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[50].sensor_type)), - 228) - << "incorrect value for sol_in[50].sensor_type, expected 228, is " - << last_msg_->sol_in[50].sensor_type; - EXPECT_EQ( - get_assol_in[51].flags)>( - reinterpret_cast(&last_msg_->sol_in[51].flags)), - 129) - << "incorrect value for sol_in[51].flags, expected 129, is " - << last_msg_->sol_in[51].flags; - EXPECT_EQ(get_assol_in[51].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[51].sensor_type)), - 241) - << "incorrect value for sol_in[51].sensor_type, expected 241, is " - << last_msg_->sol_in[51].sensor_type; - EXPECT_EQ( - get_assol_in[52].flags)>( - reinterpret_cast(&last_msg_->sol_in[52].flags)), - 176) - << "incorrect value for sol_in[52].flags, expected 176, is " - << last_msg_->sol_in[52].flags; - EXPECT_EQ(get_assol_in[52].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[52].sensor_type)), - 8) - << "incorrect value for sol_in[52].sensor_type, expected 8, is " - << last_msg_->sol_in[52].sensor_type; - EXPECT_EQ( - get_assol_in[53].flags)>( - reinterpret_cast(&last_msg_->sol_in[53].flags)), - 72) - << "incorrect value for sol_in[53].flags, expected 72, is " - << last_msg_->sol_in[53].flags; - EXPECT_EQ(get_assol_in[53].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[53].sensor_type)), - 251) - << "incorrect value for sol_in[53].sensor_type, expected 251, is " - << last_msg_->sol_in[53].sensor_type; - EXPECT_EQ( - get_assol_in[54].flags)>( - reinterpret_cast(&last_msg_->sol_in[54].flags)), - 80) - << "incorrect value for sol_in[54].flags, expected 80, is " - << last_msg_->sol_in[54].flags; - EXPECT_EQ(get_assol_in[54].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[54].sensor_type)), - 248) - << "incorrect value for sol_in[54].sensor_type, expected 248, is " - << last_msg_->sol_in[54].sensor_type; - EXPECT_EQ( - get_assol_in[55].flags)>( - reinterpret_cast(&last_msg_->sol_in[55].flags)), - 244) - << "incorrect value for sol_in[55].flags, expected 244, is " - << last_msg_->sol_in[55].flags; - EXPECT_EQ(get_assol_in[55].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[55].sensor_type)), - 115) - << "incorrect value for sol_in[55].sensor_type, expected 115, is " - << last_msg_->sol_in[55].sensor_type; - EXPECT_EQ( - get_assol_in[56].flags)>( - reinterpret_cast(&last_msg_->sol_in[56].flags)), - 145) - << "incorrect value for sol_in[56].flags, expected 145, is " - << last_msg_->sol_in[56].flags; - EXPECT_EQ(get_assol_in[56].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[56].sensor_type)), - 231) - << "incorrect value for sol_in[56].sensor_type, expected 231, is " - << last_msg_->sol_in[56].sensor_type; - EXPECT_EQ( - get_assol_in[57].flags)>( - reinterpret_cast(&last_msg_->sol_in[57].flags)), - 190) - << "incorrect value for sol_in[57].flags, expected 190, is " - << last_msg_->sol_in[57].flags; - EXPECT_EQ(get_assol_in[57].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[57].sensor_type)), - 191) - << "incorrect value for sol_in[57].sensor_type, expected 191, is " - << last_msg_->sol_in[57].sensor_type; - EXPECT_EQ( - get_assol_in[58].flags)>( - reinterpret_cast(&last_msg_->sol_in[58].flags)), - 168) - << "incorrect value for sol_in[58].flags, expected 168, is " - << last_msg_->sol_in[58].flags; - EXPECT_EQ(get_assol_in[58].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[58].sensor_type)), - 178) - << "incorrect value for sol_in[58].sensor_type, expected 178, is " - << last_msg_->sol_in[58].sensor_type; - EXPECT_EQ( - get_assol_in[59].flags)>( - reinterpret_cast(&last_msg_->sol_in[59].flags)), - 233) - << "incorrect value for sol_in[59].flags, expected 233, is " - << last_msg_->sol_in[59].flags; - EXPECT_EQ(get_assol_in[59].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[59].sensor_type)), - 89) - << "incorrect value for sol_in[59].sensor_type, expected 89, is " - << last_msg_->sol_in[59].sensor_type; - EXPECT_EQ( - get_assol_in[60].flags)>( - reinterpret_cast(&last_msg_->sol_in[60].flags)), - 176) - << "incorrect value for sol_in[60].flags, expected 176, is " - << last_msg_->sol_in[60].flags; - EXPECT_EQ(get_assol_in[60].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[60].sensor_type)), - 69) - << "incorrect value for sol_in[60].sensor_type, expected 69, is " - << last_msg_->sol_in[60].sensor_type; - EXPECT_EQ( - get_assol_in[61].flags)>( - reinterpret_cast(&last_msg_->sol_in[61].flags)), - 140) - << "incorrect value for sol_in[61].flags, expected 140, is " - << last_msg_->sol_in[61].flags; - EXPECT_EQ(get_assol_in[61].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[61].sensor_type)), - 174) - << "incorrect value for sol_in[61].sensor_type, expected 174, is " - << last_msg_->sol_in[61].sensor_type; - EXPECT_EQ( - get_assol_in[62].flags)>( - reinterpret_cast(&last_msg_->sol_in[62].flags)), - 141) - << "incorrect value for sol_in[62].flags, expected 141, is " - << last_msg_->sol_in[62].flags; - EXPECT_EQ(get_assol_in[62].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[62].sensor_type)), - 182) - << "incorrect value for sol_in[62].sensor_type, expected 182, is " - << last_msg_->sol_in[62].sensor_type; - EXPECT_EQ( - get_assol_in[63].flags)>( - reinterpret_cast(&last_msg_->sol_in[63].flags)), - 82) - << "incorrect value for sol_in[63].flags, expected 82, is " - << last_msg_->sol_in[63].flags; - EXPECT_EQ(get_assol_in[63].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[63].sensor_type)), - 81) - << "incorrect value for sol_in[63].sensor_type, expected 81, is " - << last_msg_->sol_in[63].sensor_type; - EXPECT_EQ( - get_assol_in[64].flags)>( - reinterpret_cast(&last_msg_->sol_in[64].flags)), - 79) - << "incorrect value for sol_in[64].flags, expected 79, is " - << last_msg_->sol_in[64].flags; - EXPECT_EQ(get_assol_in[64].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[64].sensor_type)), - 92) - << "incorrect value for sol_in[64].sensor_type, expected 92, is " - << last_msg_->sol_in[64].sensor_type; - EXPECT_EQ( - get_assol_in[65].flags)>( - reinterpret_cast(&last_msg_->sol_in[65].flags)), - 223) - << "incorrect value for sol_in[65].flags, expected 223, is " - << last_msg_->sol_in[65].flags; - EXPECT_EQ(get_assol_in[65].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[65].sensor_type)), - 101) - << "incorrect value for sol_in[65].sensor_type, expected 101, is " - << last_msg_->sol_in[65].sensor_type; - EXPECT_EQ( - get_assol_in[66].flags)>( - reinterpret_cast(&last_msg_->sol_in[66].flags)), - 64) - << "incorrect value for sol_in[66].flags, expected 64, is " - << last_msg_->sol_in[66].flags; - EXPECT_EQ(get_assol_in[66].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[66].sensor_type)), - 100) - << "incorrect value for sol_in[66].sensor_type, expected 100, is " - << last_msg_->sol_in[66].sensor_type; - EXPECT_EQ( - get_assol_in[67].flags)>( - reinterpret_cast(&last_msg_->sol_in[67].flags)), - 215) - << "incorrect value for sol_in[67].flags, expected 215, is " - << last_msg_->sol_in[67].flags; - EXPECT_EQ(get_assol_in[67].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[67].sensor_type)), - 184) - << "incorrect value for sol_in[67].sensor_type, expected 184, is " - << last_msg_->sol_in[67].sensor_type; - EXPECT_EQ( - get_assol_in[68].flags)>( - reinterpret_cast(&last_msg_->sol_in[68].flags)), - 37) - << "incorrect value for sol_in[68].flags, expected 37, is " - << last_msg_->sol_in[68].flags; - EXPECT_EQ(get_assol_in[68].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[68].sensor_type)), - 124) - << "incorrect value for sol_in[68].sensor_type, expected 124, is " - << last_msg_->sol_in[68].sensor_type; - EXPECT_EQ( - get_assol_in[69].flags)>( - reinterpret_cast(&last_msg_->sol_in[69].flags)), - 227) - << "incorrect value for sol_in[69].flags, expected 227, is " - << last_msg_->sol_in[69].flags; - EXPECT_EQ(get_assol_in[69].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[69].sensor_type)), - 21) - << "incorrect value for sol_in[69].sensor_type, expected 21, is " - << last_msg_->sol_in[69].sensor_type; - EXPECT_EQ( - get_assol_in[70].flags)>( - reinterpret_cast(&last_msg_->sol_in[70].flags)), - 102) - << "incorrect value for sol_in[70].flags, expected 102, is " - << last_msg_->sol_in[70].flags; - EXPECT_EQ(get_assol_in[70].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[70].sensor_type)), - 135) - << "incorrect value for sol_in[70].sensor_type, expected 135, is " - << last_msg_->sol_in[70].sensor_type; - EXPECT_EQ( - get_assol_in[71].flags)>( - reinterpret_cast(&last_msg_->sol_in[71].flags)), - 36) - << "incorrect value for sol_in[71].flags, expected 36, is " - << last_msg_->sol_in[71].flags; - EXPECT_EQ(get_assol_in[71].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[71].sensor_type)), - 72) - << "incorrect value for sol_in[71].sensor_type, expected 72, is " - << last_msg_->sol_in[71].sensor_type; - EXPECT_EQ( - get_assol_in[72].flags)>( - reinterpret_cast(&last_msg_->sol_in[72].flags)), - 56) - << "incorrect value for sol_in[72].flags, expected 56, is " - << last_msg_->sol_in[72].flags; - EXPECT_EQ(get_assol_in[72].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[72].sensor_type)), - 219) - << "incorrect value for sol_in[72].sensor_type, expected 219, is " - << last_msg_->sol_in[72].sensor_type; - EXPECT_EQ( - get_assol_in[73].flags)>( - reinterpret_cast(&last_msg_->sol_in[73].flags)), - 90) - << "incorrect value for sol_in[73].flags, expected 90, is " - << last_msg_->sol_in[73].flags; - EXPECT_EQ(get_assol_in[73].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[73].sensor_type)), - 146) - << "incorrect value for sol_in[73].sensor_type, expected 146, is " - << last_msg_->sol_in[73].sensor_type; - EXPECT_EQ( - get_assol_in[74].flags)>( - reinterpret_cast(&last_msg_->sol_in[74].flags)), - 104) - << "incorrect value for sol_in[74].flags, expected 104, is " - << last_msg_->sol_in[74].flags; - EXPECT_EQ(get_assol_in[74].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[74].sensor_type)), - 219) - << "incorrect value for sol_in[74].sensor_type, expected 219, is " - << last_msg_->sol_in[74].sensor_type; - EXPECT_EQ( - get_assol_in[75].flags)>( - reinterpret_cast(&last_msg_->sol_in[75].flags)), - 102) - << "incorrect value for sol_in[75].flags, expected 102, is " - << last_msg_->sol_in[75].flags; - EXPECT_EQ(get_assol_in[75].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[75].sensor_type)), - 227) - << "incorrect value for sol_in[75].sensor_type, expected 227, is " - << last_msg_->sol_in[75].sensor_type; - EXPECT_EQ( - get_assol_in[76].flags)>( - reinterpret_cast(&last_msg_->sol_in[76].flags)), - 12) - << "incorrect value for sol_in[76].flags, expected 12, is " - << last_msg_->sol_in[76].flags; - EXPECT_EQ(get_assol_in[76].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[76].sensor_type)), - 83) - << "incorrect value for sol_in[76].sensor_type, expected 83, is " - << last_msg_->sol_in[76].sensor_type; - EXPECT_EQ( - get_assol_in[77].flags)>( - reinterpret_cast(&last_msg_->sol_in[77].flags)), - 122) - << "incorrect value for sol_in[77].flags, expected 122, is " - << last_msg_->sol_in[77].flags; - EXPECT_EQ(get_assol_in[77].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[77].sensor_type)), - 41) - << "incorrect value for sol_in[77].sensor_type, expected 41, is " - << last_msg_->sol_in[77].sensor_type; - EXPECT_EQ( - get_assol_in[78].flags)>( - reinterpret_cast(&last_msg_->sol_in[78].flags)), - 94) - << "incorrect value for sol_in[78].flags, expected 94, is " - << last_msg_->sol_in[78].flags; - EXPECT_EQ(get_assol_in[78].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[78].sensor_type)), - 173) - << "incorrect value for sol_in[78].sensor_type, expected 173, is " - << last_msg_->sol_in[78].sensor_type; - EXPECT_EQ( - get_assol_in[79].flags)>( - reinterpret_cast(&last_msg_->sol_in[79].flags)), - 174) - << "incorrect value for sol_in[79].flags, expected 174, is " - << last_msg_->sol_in[79].flags; - EXPECT_EQ(get_assol_in[79].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[79].sensor_type)), - 1) - << "incorrect value for sol_in[79].sensor_type, expected 1, is " - << last_msg_->sol_in[79].sensor_type; - EXPECT_EQ( - get_assol_in[80].flags)>( - reinterpret_cast(&last_msg_->sol_in[80].flags)), - 130) - << "incorrect value for sol_in[80].flags, expected 130, is " - << last_msg_->sol_in[80].flags; - EXPECT_EQ(get_assol_in[80].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[80].sensor_type)), - 134) - << "incorrect value for sol_in[80].sensor_type, expected 134, is " - << last_msg_->sol_in[80].sensor_type; - EXPECT_EQ( - get_assol_in[81].flags)>( - reinterpret_cast(&last_msg_->sol_in[81].flags)), - 237) - << "incorrect value for sol_in[81].flags, expected 237, is " - << last_msg_->sol_in[81].flags; - EXPECT_EQ(get_assol_in[81].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[81].sensor_type)), - 104) - << "incorrect value for sol_in[81].sensor_type, expected 104, is " - << last_msg_->sol_in[81].sensor_type; - EXPECT_EQ( - get_assol_in[82].flags)>( - reinterpret_cast(&last_msg_->sol_in[82].flags)), - 249) - << "incorrect value for sol_in[82].flags, expected 249, is " - << last_msg_->sol_in[82].flags; - EXPECT_EQ(get_assol_in[82].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[82].sensor_type)), - 116) - << "incorrect value for sol_in[82].sensor_type, expected 116, is " - << last_msg_->sol_in[82].sensor_type; - EXPECT_EQ( - get_assol_in[83].flags)>( - reinterpret_cast(&last_msg_->sol_in[83].flags)), - 230) - << "incorrect value for sol_in[83].flags, expected 230, is " - << last_msg_->sol_in[83].flags; - EXPECT_EQ(get_assol_in[83].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[83].sensor_type)), - 107) - << "incorrect value for sol_in[83].sensor_type, expected 107, is " - << last_msg_->sol_in[83].sensor_type; - EXPECT_EQ( - get_assol_in[84].flags)>( - reinterpret_cast(&last_msg_->sol_in[84].flags)), - 123) - << "incorrect value for sol_in[84].flags, expected 123, is " - << last_msg_->sol_in[84].flags; - EXPECT_EQ(get_assol_in[84].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[84].sensor_type)), - 130) - << "incorrect value for sol_in[84].sensor_type, expected 130, is " - << last_msg_->sol_in[84].sensor_type; - EXPECT_EQ( - get_assol_in[85].flags)>( - reinterpret_cast(&last_msg_->sol_in[85].flags)), - 162) - << "incorrect value for sol_in[85].flags, expected 162, is " - << last_msg_->sol_in[85].flags; - EXPECT_EQ(get_assol_in[85].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[85].sensor_type)), - 25) - << "incorrect value for sol_in[85].sensor_type, expected 25, is " - << last_msg_->sol_in[85].sensor_type; - EXPECT_EQ( - get_assol_in[86].flags)>( - reinterpret_cast(&last_msg_->sol_in[86].flags)), - 223) - << "incorrect value for sol_in[86].flags, expected 223, is " - << last_msg_->sol_in[86].flags; - EXPECT_EQ(get_assol_in[86].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[86].sensor_type)), - 57) - << "incorrect value for sol_in[86].sensor_type, expected 57, is " - << last_msg_->sol_in[86].sensor_type; - EXPECT_EQ( - get_assol_in[87].flags)>( - reinterpret_cast(&last_msg_->sol_in[87].flags)), - 174) - << "incorrect value for sol_in[87].flags, expected 174, is " - << last_msg_->sol_in[87].flags; - EXPECT_EQ(get_assol_in[87].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[87].sensor_type)), - 193) - << "incorrect value for sol_in[87].sensor_type, expected 193, is " - << last_msg_->sol_in[87].sensor_type; - EXPECT_EQ( - get_assol_in[88].flags)>( - reinterpret_cast(&last_msg_->sol_in[88].flags)), - 193) - << "incorrect value for sol_in[88].flags, expected 193, is " - << last_msg_->sol_in[88].flags; - EXPECT_EQ(get_assol_in[88].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[88].sensor_type)), - 146) - << "incorrect value for sol_in[88].sensor_type, expected 146, is " - << last_msg_->sol_in[88].sensor_type; - EXPECT_EQ( - get_assol_in[89].flags)>( - reinterpret_cast(&last_msg_->sol_in[89].flags)), - 44) - << "incorrect value for sol_in[89].flags, expected 44, is " - << last_msg_->sol_in[89].flags; - EXPECT_EQ(get_assol_in[89].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[89].sensor_type)), - 239) - << "incorrect value for sol_in[89].sensor_type, expected 239, is " - << last_msg_->sol_in[89].sensor_type; - EXPECT_EQ( - get_assol_in[90].flags)>( - reinterpret_cast(&last_msg_->sol_in[90].flags)), - 197) - << "incorrect value for sol_in[90].flags, expected 197, is " - << last_msg_->sol_in[90].flags; - EXPECT_EQ(get_assol_in[90].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[90].sensor_type)), - 246) - << "incorrect value for sol_in[90].sensor_type, expected 246, is " - << last_msg_->sol_in[90].sensor_type; - EXPECT_EQ( - get_assol_in[91].flags)>( - reinterpret_cast(&last_msg_->sol_in[91].flags)), - 80) - << "incorrect value for sol_in[91].flags, expected 80, is " - << last_msg_->sol_in[91].flags; - EXPECT_EQ(get_assol_in[91].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[91].sensor_type)), - 214) - << "incorrect value for sol_in[91].sensor_type, expected 214, is " - << last_msg_->sol_in[91].sensor_type; - EXPECT_EQ( - get_assol_in[92].flags)>( - reinterpret_cast(&last_msg_->sol_in[92].flags)), - 100) - << "incorrect value for sol_in[92].flags, expected 100, is " - << last_msg_->sol_in[92].flags; - EXPECT_EQ(get_assol_in[92].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[92].sensor_type)), - 83) - << "incorrect value for sol_in[92].sensor_type, expected 83, is " - << last_msg_->sol_in[92].sensor_type; - EXPECT_EQ( - get_assol_in[93].flags)>( - reinterpret_cast(&last_msg_->sol_in[93].flags)), - 72) - << "incorrect value for sol_in[93].flags, expected 72, is " - << last_msg_->sol_in[93].flags; - EXPECT_EQ(get_assol_in[93].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[93].sensor_type)), - 66) - << "incorrect value for sol_in[93].sensor_type, expected 66, is " - << last_msg_->sol_in[93].sensor_type; - EXPECT_EQ( - get_assol_in[94].flags)>( - reinterpret_cast(&last_msg_->sol_in[94].flags)), - 137) - << "incorrect value for sol_in[94].flags, expected 137, is " - << last_msg_->sol_in[94].flags; - EXPECT_EQ(get_assol_in[94].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[94].sensor_type)), - 133) - << "incorrect value for sol_in[94].sensor_type, expected 133, is " - << last_msg_->sol_in[94].sensor_type; - EXPECT_EQ( - get_assol_in[95].flags)>( - reinterpret_cast(&last_msg_->sol_in[95].flags)), - 82) - << "incorrect value for sol_in[95].flags, expected 82, is " - << last_msg_->sol_in[95].flags; - EXPECT_EQ(get_assol_in[95].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[95].sensor_type)), - 140) - << "incorrect value for sol_in[95].sensor_type, expected 140, is " - << last_msg_->sol_in[95].sensor_type; - EXPECT_EQ( - get_assol_in[96].flags)>( - reinterpret_cast(&last_msg_->sol_in[96].flags)), - 2) - << "incorrect value for sol_in[96].flags, expected 2, is " - << last_msg_->sol_in[96].flags; - EXPECT_EQ(get_assol_in[96].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[96].sensor_type)), - 2) - << "incorrect value for sol_in[96].sensor_type, expected 2, is " - << last_msg_->sol_in[96].sensor_type; - EXPECT_EQ( - get_assol_in[97].flags)>( - reinterpret_cast(&last_msg_->sol_in[97].flags)), - 9) - << "incorrect value for sol_in[97].flags, expected 9, is " - << last_msg_->sol_in[97].flags; - EXPECT_EQ(get_assol_in[97].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[97].sensor_type)), - 96) - << "incorrect value for sol_in[97].sensor_type, expected 96, is " - << last_msg_->sol_in[97].sensor_type; - EXPECT_EQ( - get_assol_in[98].flags)>( - reinterpret_cast(&last_msg_->sol_in[98].flags)), - 158) - << "incorrect value for sol_in[98].flags, expected 158, is " - << last_msg_->sol_in[98].flags; - EXPECT_EQ(get_assol_in[98].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[98].sensor_type)), - 96) - << "incorrect value for sol_in[98].sensor_type, expected 96, is " - << last_msg_->sol_in[98].sensor_type; - EXPECT_EQ( - get_assol_in[99].flags)>( - reinterpret_cast(&last_msg_->sol_in[99].flags)), - 97) - << "incorrect value for sol_in[99].flags, expected 97, is " - << last_msg_->sol_in[99].flags; - EXPECT_EQ(get_assol_in[99].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[99].sensor_type)), - 134) - << "incorrect value for sol_in[99].sensor_type, expected 134, is " - << last_msg_->sol_in[99].sensor_type; - EXPECT_EQ( - get_assol_in[100].flags)>( - reinterpret_cast(&last_msg_->sol_in[100].flags)), - 129) - << "incorrect value for sol_in[100].flags, expected 129, is " - << last_msg_->sol_in[100].flags; - EXPECT_EQ(get_assol_in[100].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[100].sensor_type)), - 43) - << "incorrect value for sol_in[100].sensor_type, expected 43, is " - << last_msg_->sol_in[100].sensor_type; - EXPECT_EQ( - get_assol_in[101].flags)>( - reinterpret_cast(&last_msg_->sol_in[101].flags)), - 25) - << "incorrect value for sol_in[101].flags, expected 25, is " - << last_msg_->sol_in[101].flags; - EXPECT_EQ(get_assol_in[101].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[101].sensor_type)), - 141) - << "incorrect value for sol_in[101].sensor_type, expected 141, is " - << last_msg_->sol_in[101].sensor_type; - EXPECT_EQ( - get_assol_in[102].flags)>( - reinterpret_cast(&last_msg_->sol_in[102].flags)), - 200) - << "incorrect value for sol_in[102].flags, expected 200, is " - << last_msg_->sol_in[102].flags; - EXPECT_EQ(get_assol_in[102].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[102].sensor_type)), - 183) - << "incorrect value for sol_in[102].sensor_type, expected 183, is " - << last_msg_->sol_in[102].sensor_type; - EXPECT_EQ( - get_assol_in[103].flags)>( - reinterpret_cast(&last_msg_->sol_in[103].flags)), - 57) - << "incorrect value for sol_in[103].flags, expected 57, is " - << last_msg_->sol_in[103].flags; - EXPECT_EQ(get_assol_in[103].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[103].sensor_type)), - 214) - << "incorrect value for sol_in[103].sensor_type, expected 214, is " - << last_msg_->sol_in[103].sensor_type; - EXPECT_EQ( - get_assol_in[104].flags)>( - reinterpret_cast(&last_msg_->sol_in[104].flags)), - 103) - << "incorrect value for sol_in[104].flags, expected 103, is " - << last_msg_->sol_in[104].flags; - EXPECT_EQ(get_assol_in[104].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[104].sensor_type)), - 248) - << "incorrect value for sol_in[104].sensor_type, expected 248, is " - << last_msg_->sol_in[104].sensor_type; - EXPECT_EQ( - get_assol_in[105].flags)>( - reinterpret_cast(&last_msg_->sol_in[105].flags)), - 65) - << "incorrect value for sol_in[105].flags, expected 65, is " - << last_msg_->sol_in[105].flags; - EXPECT_EQ(get_assol_in[105].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[105].sensor_type)), - 222) - << "incorrect value for sol_in[105].sensor_type, expected 222, is " - << last_msg_->sol_in[105].sensor_type; - EXPECT_EQ( - get_assol_in[106].flags)>( - reinterpret_cast(&last_msg_->sol_in[106].flags)), - 15) - << "incorrect value for sol_in[106].flags, expected 15, is " - << last_msg_->sol_in[106].flags; - EXPECT_EQ(get_assol_in[106].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[106].sensor_type)), - 195) - << "incorrect value for sol_in[106].sensor_type, expected 195, is " - << last_msg_->sol_in[106].sensor_type; - EXPECT_EQ( - get_assol_in[107].flags)>( - reinterpret_cast(&last_msg_->sol_in[107].flags)), - 21) - << "incorrect value for sol_in[107].flags, expected 21, is " - << last_msg_->sol_in[107].flags; - EXPECT_EQ(get_assol_in[107].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[107].sensor_type)), - 244) - << "incorrect value for sol_in[107].sensor_type, expected 244, is " - << last_msg_->sol_in[107].sensor_type; - EXPECT_EQ( - get_assol_in[108].flags)>( - reinterpret_cast(&last_msg_->sol_in[108].flags)), - 46) - << "incorrect value for sol_in[108].flags, expected 46, is " - << last_msg_->sol_in[108].flags; - EXPECT_EQ(get_assol_in[108].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[108].sensor_type)), - 180) - << "incorrect value for sol_in[108].sensor_type, expected 180, is " - << last_msg_->sol_in[108].sensor_type; - EXPECT_EQ( - get_assol_in[109].flags)>( - reinterpret_cast(&last_msg_->sol_in[109].flags)), - 130) - << "incorrect value for sol_in[109].flags, expected 130, is " - << last_msg_->sol_in[109].flags; - EXPECT_EQ(get_assol_in[109].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[109].sensor_type)), - 140) - << "incorrect value for sol_in[109].sensor_type, expected 140, is " - << last_msg_->sol_in[109].sensor_type; - EXPECT_EQ( - get_assol_in[110].flags)>( - reinterpret_cast(&last_msg_->sol_in[110].flags)), - 17) - << "incorrect value for sol_in[110].flags, expected 17, is " - << last_msg_->sol_in[110].flags; - EXPECT_EQ(get_assol_in[110].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[110].sensor_type)), - 36) - << "incorrect value for sol_in[110].sensor_type, expected 36, is " - << last_msg_->sol_in[110].sensor_type; - EXPECT_EQ( - get_assol_in[111].flags)>( - reinterpret_cast(&last_msg_->sol_in[111].flags)), - 209) - << "incorrect value for sol_in[111].flags, expected 209, is " - << last_msg_->sol_in[111].flags; - EXPECT_EQ(get_assol_in[111].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[111].sensor_type)), - 194) - << "incorrect value for sol_in[111].sensor_type, expected 194, is " - << last_msg_->sol_in[111].sensor_type; - EXPECT_EQ( - get_assol_in[112].flags)>( - reinterpret_cast(&last_msg_->sol_in[112].flags)), - 254) - << "incorrect value for sol_in[112].flags, expected 254, is " - << last_msg_->sol_in[112].flags; - EXPECT_EQ(get_assol_in[112].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[112].sensor_type)), - 65) - << "incorrect value for sol_in[112].sensor_type, expected 65, is " - << last_msg_->sol_in[112].sensor_type; - EXPECT_EQ( - get_assol_in[113].flags)>( - reinterpret_cast(&last_msg_->sol_in[113].flags)), - 103) - << "incorrect value for sol_in[113].flags, expected 103, is " - << last_msg_->sol_in[113].flags; - EXPECT_EQ(get_assol_in[113].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[113].sensor_type)), - 115) - << "incorrect value for sol_in[113].sensor_type, expected 115, is " - << last_msg_->sol_in[113].sensor_type; - EXPECT_EQ( - get_assol_in[114].flags)>( - reinterpret_cast(&last_msg_->sol_in[114].flags)), - 129) - << "incorrect value for sol_in[114].flags, expected 129, is " - << last_msg_->sol_in[114].flags; - EXPECT_EQ(get_assol_in[114].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[114].sensor_type)), - 152) - << "incorrect value for sol_in[114].sensor_type, expected 152, is " - << last_msg_->sol_in[114].sensor_type; - EXPECT_EQ( - get_assol_in[115].flags)>( - reinterpret_cast(&last_msg_->sol_in[115].flags)), - 235) - << "incorrect value for sol_in[115].flags, expected 235, is " - << last_msg_->sol_in[115].flags; - EXPECT_EQ(get_assol_in[115].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[115].sensor_type)), - 234) - << "incorrect value for sol_in[115].sensor_type, expected 234, is " - << last_msg_->sol_in[115].sensor_type; - EXPECT_EQ( - get_assol_in[116].flags)>( - reinterpret_cast(&last_msg_->sol_in[116].flags)), - 234) - << "incorrect value for sol_in[116].flags, expected 234, is " - << last_msg_->sol_in[116].flags; - EXPECT_EQ(get_assol_in[116].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[116].sensor_type)), - 194) - << "incorrect value for sol_in[116].sensor_type, expected 194, is " - << last_msg_->sol_in[116].sensor_type; - EXPECT_EQ( - get_assol_in[117].flags)>( - reinterpret_cast(&last_msg_->sol_in[117].flags)), - 201) - << "incorrect value for sol_in[117].flags, expected 201, is " - << last_msg_->sol_in[117].flags; - EXPECT_EQ(get_assol_in[117].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[117].sensor_type)), - 170) - << "incorrect value for sol_in[117].sensor_type, expected 170, is " - << last_msg_->sol_in[117].sensor_type; - EXPECT_EQ( - get_assol_in[118].flags)>( - reinterpret_cast(&last_msg_->sol_in[118].flags)), - 154) - << "incorrect value for sol_in[118].flags, expected 154, is " - << last_msg_->sol_in[118].flags; - EXPECT_EQ(get_assol_in[118].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[118].sensor_type)), - 210) - << "incorrect value for sol_in[118].sensor_type, expected 210, is " - << last_msg_->sol_in[118].sensor_type; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 3628191792) - << "incorrect value for tow, expected 3628191792, is " << last_msg_->tow; - EXPECT_EQ(get_asvdop)>( - reinterpret_cast(&last_msg_->vdop)), - 58512) - << "incorrect value for vdop, expected 58512, is " << last_msg_->vdop; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_solution_meta_MsgSolnMetaDepA.cc b/c/test/legacy/cpp/auto_check_sbp_solution_meta_MsgSolnMetaDepA.cc deleted file mode 100644 index 941497829f..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_solution_meta_MsgSolnMetaDepA.cc +++ /dev/null @@ -1,2298 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/soln_meta/test_MsgSolnMetaDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_solution_meta_MsgSolnMetaDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_solution_meta_MsgSolnMetaDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_soln_meta_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_soln_meta_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_solution_meta_MsgSolnMetaDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 15, 255, 84, 241, 254, 183, 222, 157, 121, 5, 164, 238, 31, 190, - 115, 93, 59, 103, 36, 83, 161, 156, 46, 253, 67, 87, 200, 39, 250, - 245, 242, 228, 72, 18, 222, 11, 88, 207, 218, 231, 13, 226, 224, 22, - 196, 21, 242, 12, 89, 71, 219, 182, 85, 145, 204, 146, 40, 204, 51, - 21, 153, 227, 44, 15, 28, 255, 39, 205, 216, 240, 190, 93, 219, 103, - 42, 41, 182, 76, 222, 17, 23, 125, 31, 18, 229, 28, 47, 214, 25, - 100, 84, 106, 72, 48, 10, 222, 232, 235, 73, 109, 163, 51, 152, 133, - 235, 87, 70, 2, 108, 91, 101, 200, 55, 24, 156, 233, 73, 39, 66, - 97, 140, 252, 227, 230, 237, 135, 241, 245, 205, 70, 0, 219, 188, 107, - 136, 178, 58, 1, 29, 44, 213, 225, 147, 190, 96, 192, 108, 228, 15, - 203, 18, 3, 222, 180, 68, 101, 229, 223, 203, 243, 164, 92, 165, 220, - 159, 174, 121, 112, 167, 240, 40, 59, 3, 230, 52, 149, 148, 218, 142, - 212, 109, 176, 71, 179, 172, 77, 1, 193, 70, 147, 149, 23, 144, 148, - 239, 195, 186, 86, 30, 34, 143, 156, 207, 63, 55, 117, 255, 222, 222, - 219, 145, 224, 191, 210, 109, 86, 153, 21, 32, 226, 10, 60, 63, 106, - 236, 93, 96, 30, 163, 106, 238, 147, 133, 132, 107, 152, 214, 221, 185, - 202, 21, 252, 51, 130, 59, 166, 202, 127, 170, 58, 193, 215, 125, 22, - 58, 135, 47, 88, 142, 77, 211, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_soln_meta_dep_a_t *test_msg = (msg_soln_meta_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->age_corrections = 48671; - test_msg->alignment_status = 115; - test_msg->hdop = 31133; - test_msg->last_used_gnss_pos_tow = 610745181; - test_msg->last_used_gnss_vel_tow = 782016851; - test_msg->n_sats = 238; - test_msg->pdop = 57015; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[0].flags = 67; - test_msg->sol_in[0].sensor_type = 253; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[1].flags = 200; - test_msg->sol_in[1].sensor_type = 87; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[2].flags = 250; - test_msg->sol_in[2].sensor_type = 39; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[3].flags = 242; - test_msg->sol_in[3].sensor_type = 245; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[4].flags = 72; - test_msg->sol_in[4].sensor_type = 228; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[5].flags = 222; - test_msg->sol_in[5].sensor_type = 18; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[6].flags = 88; - test_msg->sol_in[6].sensor_type = 11; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[7].flags = 218; - test_msg->sol_in[7].sensor_type = 207; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[8].flags = 13; - test_msg->sol_in[8].sensor_type = 231; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[9].flags = 224; - test_msg->sol_in[9].sensor_type = 226; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[10].flags = 196; - test_msg->sol_in[10].sensor_type = 22; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[11].flags = 242; - test_msg->sol_in[11].sensor_type = 21; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[12].flags = 89; - test_msg->sol_in[12].sensor_type = 12; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[13].flags = 219; - test_msg->sol_in[13].sensor_type = 71; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[14].flags = 85; - test_msg->sol_in[14].sensor_type = 182; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[15].flags = 204; - test_msg->sol_in[15].sensor_type = 145; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[16].flags = 40; - test_msg->sol_in[16].sensor_type = 146; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[17].flags = 51; - test_msg->sol_in[17].sensor_type = 204; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[18].flags = 153; - test_msg->sol_in[18].sensor_type = 21; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[19].flags = 44; - test_msg->sol_in[19].sensor_type = 227; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[20].flags = 28; - test_msg->sol_in[20].sensor_type = 15; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[21].flags = 39; - test_msg->sol_in[21].sensor_type = 255; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[22].flags = 216; - test_msg->sol_in[22].sensor_type = 205; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[23].flags = 190; - test_msg->sol_in[23].sensor_type = 240; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[24].flags = 219; - test_msg->sol_in[24].sensor_type = 93; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[25].flags = 42; - test_msg->sol_in[25].sensor_type = 103; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[26].flags = 182; - test_msg->sol_in[26].sensor_type = 41; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[27].flags = 222; - test_msg->sol_in[27].sensor_type = 76; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[28].flags = 23; - test_msg->sol_in[28].sensor_type = 17; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[29].flags = 31; - test_msg->sol_in[29].sensor_type = 125; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[30].flags = 229; - test_msg->sol_in[30].sensor_type = 18; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[31].flags = 47; - test_msg->sol_in[31].sensor_type = 28; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[32].flags = 25; - test_msg->sol_in[32].sensor_type = 214; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[33].flags = 84; - test_msg->sol_in[33].sensor_type = 100; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[34].flags = 72; - test_msg->sol_in[34].sensor_type = 106; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[35].flags = 10; - test_msg->sol_in[35].sensor_type = 48; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[36].flags = 232; - test_msg->sol_in[36].sensor_type = 222; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[37].flags = 73; - test_msg->sol_in[37].sensor_type = 235; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[38].flags = 163; - test_msg->sol_in[38].sensor_type = 109; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[39].flags = 152; - test_msg->sol_in[39].sensor_type = 51; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[40].flags = 235; - test_msg->sol_in[40].sensor_type = 133; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[41].flags = 70; - test_msg->sol_in[41].sensor_type = 87; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[42].flags = 108; - test_msg->sol_in[42].sensor_type = 2; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[43].flags = 101; - test_msg->sol_in[43].sensor_type = 91; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[44].flags = 55; - test_msg->sol_in[44].sensor_type = 200; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[45].flags = 156; - test_msg->sol_in[45].sensor_type = 24; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[46].flags = 73; - test_msg->sol_in[46].sensor_type = 233; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[47].flags = 66; - test_msg->sol_in[47].sensor_type = 39; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[48].flags = 140; - test_msg->sol_in[48].sensor_type = 97; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[49].flags = 227; - test_msg->sol_in[49].sensor_type = 252; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[50].flags = 237; - test_msg->sol_in[50].sensor_type = 230; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[51].flags = 241; - test_msg->sol_in[51].sensor_type = 135; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[52].flags = 205; - test_msg->sol_in[52].sensor_type = 245; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[53].flags = 0; - test_msg->sol_in[53].sensor_type = 70; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[54].flags = 188; - test_msg->sol_in[54].sensor_type = 219; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[55].flags = 136; - test_msg->sol_in[55].sensor_type = 107; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[56].flags = 58; - test_msg->sol_in[56].sensor_type = 178; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[57].flags = 29; - test_msg->sol_in[57].sensor_type = 1; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[58].flags = 213; - test_msg->sol_in[58].sensor_type = 44; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[59].flags = 147; - test_msg->sol_in[59].sensor_type = 225; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[60].flags = 96; - test_msg->sol_in[60].sensor_type = 190; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[61].flags = 108; - test_msg->sol_in[61].sensor_type = 192; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[62].flags = 15; - test_msg->sol_in[62].sensor_type = 228; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[63].flags = 18; - test_msg->sol_in[63].sensor_type = 203; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[64].flags = 222; - test_msg->sol_in[64].sensor_type = 3; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[65].flags = 68; - test_msg->sol_in[65].sensor_type = 180; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[66].flags = 229; - test_msg->sol_in[66].sensor_type = 101; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[67].flags = 203; - test_msg->sol_in[67].sensor_type = 223; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[68].flags = 164; - test_msg->sol_in[68].sensor_type = 243; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[69].flags = 165; - test_msg->sol_in[69].sensor_type = 92; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[70].flags = 159; - test_msg->sol_in[70].sensor_type = 220; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[71].flags = 121; - test_msg->sol_in[71].sensor_type = 174; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[72].flags = 167; - test_msg->sol_in[72].sensor_type = 112; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[73].flags = 40; - test_msg->sol_in[73].sensor_type = 240; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[74].flags = 3; - test_msg->sol_in[74].sensor_type = 59; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[75].flags = 52; - test_msg->sol_in[75].sensor_type = 230; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[76].flags = 148; - test_msg->sol_in[76].sensor_type = 149; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[77].flags = 142; - test_msg->sol_in[77].sensor_type = 218; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[78].flags = 109; - test_msg->sol_in[78].sensor_type = 212; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[79].flags = 71; - test_msg->sol_in[79].sensor_type = 176; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[80].flags = 172; - test_msg->sol_in[80].sensor_type = 179; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[81].flags = 1; - test_msg->sol_in[81].sensor_type = 77; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[82].flags = 70; - test_msg->sol_in[82].sensor_type = 193; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[83].flags = 149; - test_msg->sol_in[83].sensor_type = 147; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[84].flags = 144; - test_msg->sol_in[84].sensor_type = 23; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[85].flags = 239; - test_msg->sol_in[85].sensor_type = 148; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[86].flags = 186; - test_msg->sol_in[86].sensor_type = 195; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[87].flags = 30; - test_msg->sol_in[87].sensor_type = 86; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[88].flags = 143; - test_msg->sol_in[88].sensor_type = 34; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[89].flags = 207; - test_msg->sol_in[89].sensor_type = 156; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[90].flags = 55; - test_msg->sol_in[90].sensor_type = 63; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[91].flags = 255; - test_msg->sol_in[91].sensor_type = 117; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[92].flags = 222; - test_msg->sol_in[92].sensor_type = 222; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[93].flags = 145; - test_msg->sol_in[93].sensor_type = 219; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[94].flags = 191; - test_msg->sol_in[94].sensor_type = 224; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[95].flags = 109; - test_msg->sol_in[95].sensor_type = 210; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[96].flags = 153; - test_msg->sol_in[96].sensor_type = 86; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[97].flags = 32; - test_msg->sol_in[97].sensor_type = 21; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[98].flags = 10; - test_msg->sol_in[98].sensor_type = 226; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[99].flags = 63; - test_msg->sol_in[99].sensor_type = 60; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[100].flags = 236; - test_msg->sol_in[100].sensor_type = 106; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[101].flags = 96; - test_msg->sol_in[101].sensor_type = 93; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[102].flags = 163; - test_msg->sol_in[102].sensor_type = 30; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[103].flags = 238; - test_msg->sol_in[103].sensor_type = 106; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[104].flags = 133; - test_msg->sol_in[104].sensor_type = 147; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[105].flags = 107; - test_msg->sol_in[105].sensor_type = 132; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[106].flags = 214; - test_msg->sol_in[106].sensor_type = 152; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[107].flags = 185; - test_msg->sol_in[107].sensor_type = 221; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[108].flags = 21; - test_msg->sol_in[108].sensor_type = 202; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[109].flags = 51; - test_msg->sol_in[109].sensor_type = 252; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[110].flags = 59; - test_msg->sol_in[110].sensor_type = 130; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[111].flags = 202; - test_msg->sol_in[111].sensor_type = 166; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[112].flags = 170; - test_msg->sol_in[112].sensor_type = 127; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[113].flags = 193; - test_msg->sol_in[113].sensor_type = 58; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[114].flags = 125; - test_msg->sol_in[114].sensor_type = 215; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[115].flags = 58; - test_msg->sol_in[115].sensor_type = 22; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[116].flags = 47; - test_msg->sol_in[116].sensor_type = 135; - if (sizeof(test_msg->sol_in) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sol_in[0])); - } - test_msg->sol_in[117].flags = 142; - test_msg->sol_in[117].sensor_type = 88; - test_msg->vdop = 41989; - - EXPECT_EQ(send_message(0xff0f, 61780, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 61780); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asage_corrections)>( - reinterpret_cast(&last_msg_->age_corrections)), - 48671) - << "incorrect value for age_corrections, expected 48671, is " - << last_msg_->age_corrections; - EXPECT_EQ( - get_asalignment_status)>( - reinterpret_cast(&last_msg_->alignment_status)), - 115) - << "incorrect value for alignment_status, expected 115, is " - << last_msg_->alignment_status; - EXPECT_EQ(get_ashdop)>( - reinterpret_cast(&last_msg_->hdop)), - 31133) - << "incorrect value for hdop, expected 31133, is " << last_msg_->hdop; - EXPECT_EQ(get_aslast_used_gnss_pos_tow)>( - reinterpret_cast( - &last_msg_->last_used_gnss_pos_tow)), - 610745181) - << "incorrect value for last_used_gnss_pos_tow, expected 610745181, is " - << last_msg_->last_used_gnss_pos_tow; - EXPECT_EQ(get_aslast_used_gnss_vel_tow)>( - reinterpret_cast( - &last_msg_->last_used_gnss_vel_tow)), - 782016851) - << "incorrect value for last_used_gnss_vel_tow, expected 782016851, is " - << last_msg_->last_used_gnss_vel_tow; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 238) - << "incorrect value for n_sats, expected 238, is " << last_msg_->n_sats; - EXPECT_EQ(get_aspdop)>( - reinterpret_cast(&last_msg_->pdop)), - 57015) - << "incorrect value for pdop, expected 57015, is " << last_msg_->pdop; - EXPECT_EQ(get_assol_in[0].flags)>( - reinterpret_cast(&last_msg_->sol_in[0].flags)), - 67) - << "incorrect value for sol_in[0].flags, expected 67, is " - << last_msg_->sol_in[0].flags; - EXPECT_EQ( - get_assol_in[0].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[0].sensor_type)), - 253) - << "incorrect value for sol_in[0].sensor_type, expected 253, is " - << last_msg_->sol_in[0].sensor_type; - EXPECT_EQ(get_assol_in[1].flags)>( - reinterpret_cast(&last_msg_->sol_in[1].flags)), - 200) - << "incorrect value for sol_in[1].flags, expected 200, is " - << last_msg_->sol_in[1].flags; - EXPECT_EQ( - get_assol_in[1].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[1].sensor_type)), - 87) - << "incorrect value for sol_in[1].sensor_type, expected 87, is " - << last_msg_->sol_in[1].sensor_type; - EXPECT_EQ(get_assol_in[2].flags)>( - reinterpret_cast(&last_msg_->sol_in[2].flags)), - 250) - << "incorrect value for sol_in[2].flags, expected 250, is " - << last_msg_->sol_in[2].flags; - EXPECT_EQ( - get_assol_in[2].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[2].sensor_type)), - 39) - << "incorrect value for sol_in[2].sensor_type, expected 39, is " - << last_msg_->sol_in[2].sensor_type; - EXPECT_EQ(get_assol_in[3].flags)>( - reinterpret_cast(&last_msg_->sol_in[3].flags)), - 242) - << "incorrect value for sol_in[3].flags, expected 242, is " - << last_msg_->sol_in[3].flags; - EXPECT_EQ( - get_assol_in[3].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[3].sensor_type)), - 245) - << "incorrect value for sol_in[3].sensor_type, expected 245, is " - << last_msg_->sol_in[3].sensor_type; - EXPECT_EQ(get_assol_in[4].flags)>( - reinterpret_cast(&last_msg_->sol_in[4].flags)), - 72) - << "incorrect value for sol_in[4].flags, expected 72, is " - << last_msg_->sol_in[4].flags; - EXPECT_EQ( - get_assol_in[4].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[4].sensor_type)), - 228) - << "incorrect value for sol_in[4].sensor_type, expected 228, is " - << last_msg_->sol_in[4].sensor_type; - EXPECT_EQ(get_assol_in[5].flags)>( - reinterpret_cast(&last_msg_->sol_in[5].flags)), - 222) - << "incorrect value for sol_in[5].flags, expected 222, is " - << last_msg_->sol_in[5].flags; - EXPECT_EQ( - get_assol_in[5].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[5].sensor_type)), - 18) - << "incorrect value for sol_in[5].sensor_type, expected 18, is " - << last_msg_->sol_in[5].sensor_type; - EXPECT_EQ(get_assol_in[6].flags)>( - reinterpret_cast(&last_msg_->sol_in[6].flags)), - 88) - << "incorrect value for sol_in[6].flags, expected 88, is " - << last_msg_->sol_in[6].flags; - EXPECT_EQ( - get_assol_in[6].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[6].sensor_type)), - 11) - << "incorrect value for sol_in[6].sensor_type, expected 11, is " - << last_msg_->sol_in[6].sensor_type; - EXPECT_EQ(get_assol_in[7].flags)>( - reinterpret_cast(&last_msg_->sol_in[7].flags)), - 218) - << "incorrect value for sol_in[7].flags, expected 218, is " - << last_msg_->sol_in[7].flags; - EXPECT_EQ( - get_assol_in[7].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[7].sensor_type)), - 207) - << "incorrect value for sol_in[7].sensor_type, expected 207, is " - << last_msg_->sol_in[7].sensor_type; - EXPECT_EQ(get_assol_in[8].flags)>( - reinterpret_cast(&last_msg_->sol_in[8].flags)), - 13) - << "incorrect value for sol_in[8].flags, expected 13, is " - << last_msg_->sol_in[8].flags; - EXPECT_EQ( - get_assol_in[8].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[8].sensor_type)), - 231) - << "incorrect value for sol_in[8].sensor_type, expected 231, is " - << last_msg_->sol_in[8].sensor_type; - EXPECT_EQ(get_assol_in[9].flags)>( - reinterpret_cast(&last_msg_->sol_in[9].flags)), - 224) - << "incorrect value for sol_in[9].flags, expected 224, is " - << last_msg_->sol_in[9].flags; - EXPECT_EQ( - get_assol_in[9].sensor_type)>( - reinterpret_cast(&last_msg_->sol_in[9].sensor_type)), - 226) - << "incorrect value for sol_in[9].sensor_type, expected 226, is " - << last_msg_->sol_in[9].sensor_type; - EXPECT_EQ( - get_assol_in[10].flags)>( - reinterpret_cast(&last_msg_->sol_in[10].flags)), - 196) - << "incorrect value for sol_in[10].flags, expected 196, is " - << last_msg_->sol_in[10].flags; - EXPECT_EQ(get_assol_in[10].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[10].sensor_type)), - 22) - << "incorrect value for sol_in[10].sensor_type, expected 22, is " - << last_msg_->sol_in[10].sensor_type; - EXPECT_EQ( - get_assol_in[11].flags)>( - reinterpret_cast(&last_msg_->sol_in[11].flags)), - 242) - << "incorrect value for sol_in[11].flags, expected 242, is " - << last_msg_->sol_in[11].flags; - EXPECT_EQ(get_assol_in[11].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[11].sensor_type)), - 21) - << "incorrect value for sol_in[11].sensor_type, expected 21, is " - << last_msg_->sol_in[11].sensor_type; - EXPECT_EQ( - get_assol_in[12].flags)>( - reinterpret_cast(&last_msg_->sol_in[12].flags)), - 89) - << "incorrect value for sol_in[12].flags, expected 89, is " - << last_msg_->sol_in[12].flags; - EXPECT_EQ(get_assol_in[12].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[12].sensor_type)), - 12) - << "incorrect value for sol_in[12].sensor_type, expected 12, is " - << last_msg_->sol_in[12].sensor_type; - EXPECT_EQ( - get_assol_in[13].flags)>( - reinterpret_cast(&last_msg_->sol_in[13].flags)), - 219) - << "incorrect value for sol_in[13].flags, expected 219, is " - << last_msg_->sol_in[13].flags; - EXPECT_EQ(get_assol_in[13].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[13].sensor_type)), - 71) - << "incorrect value for sol_in[13].sensor_type, expected 71, is " - << last_msg_->sol_in[13].sensor_type; - EXPECT_EQ( - get_assol_in[14].flags)>( - reinterpret_cast(&last_msg_->sol_in[14].flags)), - 85) - << "incorrect value for sol_in[14].flags, expected 85, is " - << last_msg_->sol_in[14].flags; - EXPECT_EQ(get_assol_in[14].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[14].sensor_type)), - 182) - << "incorrect value for sol_in[14].sensor_type, expected 182, is " - << last_msg_->sol_in[14].sensor_type; - EXPECT_EQ( - get_assol_in[15].flags)>( - reinterpret_cast(&last_msg_->sol_in[15].flags)), - 204) - << "incorrect value for sol_in[15].flags, expected 204, is " - << last_msg_->sol_in[15].flags; - EXPECT_EQ(get_assol_in[15].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[15].sensor_type)), - 145) - << "incorrect value for sol_in[15].sensor_type, expected 145, is " - << last_msg_->sol_in[15].sensor_type; - EXPECT_EQ( - get_assol_in[16].flags)>( - reinterpret_cast(&last_msg_->sol_in[16].flags)), - 40) - << "incorrect value for sol_in[16].flags, expected 40, is " - << last_msg_->sol_in[16].flags; - EXPECT_EQ(get_assol_in[16].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[16].sensor_type)), - 146) - << "incorrect value for sol_in[16].sensor_type, expected 146, is " - << last_msg_->sol_in[16].sensor_type; - EXPECT_EQ( - get_assol_in[17].flags)>( - reinterpret_cast(&last_msg_->sol_in[17].flags)), - 51) - << "incorrect value for sol_in[17].flags, expected 51, is " - << last_msg_->sol_in[17].flags; - EXPECT_EQ(get_assol_in[17].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[17].sensor_type)), - 204) - << "incorrect value for sol_in[17].sensor_type, expected 204, is " - << last_msg_->sol_in[17].sensor_type; - EXPECT_EQ( - get_assol_in[18].flags)>( - reinterpret_cast(&last_msg_->sol_in[18].flags)), - 153) - << "incorrect value for sol_in[18].flags, expected 153, is " - << last_msg_->sol_in[18].flags; - EXPECT_EQ(get_assol_in[18].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[18].sensor_type)), - 21) - << "incorrect value for sol_in[18].sensor_type, expected 21, is " - << last_msg_->sol_in[18].sensor_type; - EXPECT_EQ( - get_assol_in[19].flags)>( - reinterpret_cast(&last_msg_->sol_in[19].flags)), - 44) - << "incorrect value for sol_in[19].flags, expected 44, is " - << last_msg_->sol_in[19].flags; - EXPECT_EQ(get_assol_in[19].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[19].sensor_type)), - 227) - << "incorrect value for sol_in[19].sensor_type, expected 227, is " - << last_msg_->sol_in[19].sensor_type; - EXPECT_EQ( - get_assol_in[20].flags)>( - reinterpret_cast(&last_msg_->sol_in[20].flags)), - 28) - << "incorrect value for sol_in[20].flags, expected 28, is " - << last_msg_->sol_in[20].flags; - EXPECT_EQ(get_assol_in[20].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[20].sensor_type)), - 15) - << "incorrect value for sol_in[20].sensor_type, expected 15, is " - << last_msg_->sol_in[20].sensor_type; - EXPECT_EQ( - get_assol_in[21].flags)>( - reinterpret_cast(&last_msg_->sol_in[21].flags)), - 39) - << "incorrect value for sol_in[21].flags, expected 39, is " - << last_msg_->sol_in[21].flags; - EXPECT_EQ(get_assol_in[21].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[21].sensor_type)), - 255) - << "incorrect value for sol_in[21].sensor_type, expected 255, is " - << last_msg_->sol_in[21].sensor_type; - EXPECT_EQ( - get_assol_in[22].flags)>( - reinterpret_cast(&last_msg_->sol_in[22].flags)), - 216) - << "incorrect value for sol_in[22].flags, expected 216, is " - << last_msg_->sol_in[22].flags; - EXPECT_EQ(get_assol_in[22].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[22].sensor_type)), - 205) - << "incorrect value for sol_in[22].sensor_type, expected 205, is " - << last_msg_->sol_in[22].sensor_type; - EXPECT_EQ( - get_assol_in[23].flags)>( - reinterpret_cast(&last_msg_->sol_in[23].flags)), - 190) - << "incorrect value for sol_in[23].flags, expected 190, is " - << last_msg_->sol_in[23].flags; - EXPECT_EQ(get_assol_in[23].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[23].sensor_type)), - 240) - << "incorrect value for sol_in[23].sensor_type, expected 240, is " - << last_msg_->sol_in[23].sensor_type; - EXPECT_EQ( - get_assol_in[24].flags)>( - reinterpret_cast(&last_msg_->sol_in[24].flags)), - 219) - << "incorrect value for sol_in[24].flags, expected 219, is " - << last_msg_->sol_in[24].flags; - EXPECT_EQ(get_assol_in[24].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[24].sensor_type)), - 93) - << "incorrect value for sol_in[24].sensor_type, expected 93, is " - << last_msg_->sol_in[24].sensor_type; - EXPECT_EQ( - get_assol_in[25].flags)>( - reinterpret_cast(&last_msg_->sol_in[25].flags)), - 42) - << "incorrect value for sol_in[25].flags, expected 42, is " - << last_msg_->sol_in[25].flags; - EXPECT_EQ(get_assol_in[25].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[25].sensor_type)), - 103) - << "incorrect value for sol_in[25].sensor_type, expected 103, is " - << last_msg_->sol_in[25].sensor_type; - EXPECT_EQ( - get_assol_in[26].flags)>( - reinterpret_cast(&last_msg_->sol_in[26].flags)), - 182) - << "incorrect value for sol_in[26].flags, expected 182, is " - << last_msg_->sol_in[26].flags; - EXPECT_EQ(get_assol_in[26].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[26].sensor_type)), - 41) - << "incorrect value for sol_in[26].sensor_type, expected 41, is " - << last_msg_->sol_in[26].sensor_type; - EXPECT_EQ( - get_assol_in[27].flags)>( - reinterpret_cast(&last_msg_->sol_in[27].flags)), - 222) - << "incorrect value for sol_in[27].flags, expected 222, is " - << last_msg_->sol_in[27].flags; - EXPECT_EQ(get_assol_in[27].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[27].sensor_type)), - 76) - << "incorrect value for sol_in[27].sensor_type, expected 76, is " - << last_msg_->sol_in[27].sensor_type; - EXPECT_EQ( - get_assol_in[28].flags)>( - reinterpret_cast(&last_msg_->sol_in[28].flags)), - 23) - << "incorrect value for sol_in[28].flags, expected 23, is " - << last_msg_->sol_in[28].flags; - EXPECT_EQ(get_assol_in[28].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[28].sensor_type)), - 17) - << "incorrect value for sol_in[28].sensor_type, expected 17, is " - << last_msg_->sol_in[28].sensor_type; - EXPECT_EQ( - get_assol_in[29].flags)>( - reinterpret_cast(&last_msg_->sol_in[29].flags)), - 31) - << "incorrect value for sol_in[29].flags, expected 31, is " - << last_msg_->sol_in[29].flags; - EXPECT_EQ(get_assol_in[29].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[29].sensor_type)), - 125) - << "incorrect value for sol_in[29].sensor_type, expected 125, is " - << last_msg_->sol_in[29].sensor_type; - EXPECT_EQ( - get_assol_in[30].flags)>( - reinterpret_cast(&last_msg_->sol_in[30].flags)), - 229) - << "incorrect value for sol_in[30].flags, expected 229, is " - << last_msg_->sol_in[30].flags; - EXPECT_EQ(get_assol_in[30].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[30].sensor_type)), - 18) - << "incorrect value for sol_in[30].sensor_type, expected 18, is " - << last_msg_->sol_in[30].sensor_type; - EXPECT_EQ( - get_assol_in[31].flags)>( - reinterpret_cast(&last_msg_->sol_in[31].flags)), - 47) - << "incorrect value for sol_in[31].flags, expected 47, is " - << last_msg_->sol_in[31].flags; - EXPECT_EQ(get_assol_in[31].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[31].sensor_type)), - 28) - << "incorrect value for sol_in[31].sensor_type, expected 28, is " - << last_msg_->sol_in[31].sensor_type; - EXPECT_EQ( - get_assol_in[32].flags)>( - reinterpret_cast(&last_msg_->sol_in[32].flags)), - 25) - << "incorrect value for sol_in[32].flags, expected 25, is " - << last_msg_->sol_in[32].flags; - EXPECT_EQ(get_assol_in[32].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[32].sensor_type)), - 214) - << "incorrect value for sol_in[32].sensor_type, expected 214, is " - << last_msg_->sol_in[32].sensor_type; - EXPECT_EQ( - get_assol_in[33].flags)>( - reinterpret_cast(&last_msg_->sol_in[33].flags)), - 84) - << "incorrect value for sol_in[33].flags, expected 84, is " - << last_msg_->sol_in[33].flags; - EXPECT_EQ(get_assol_in[33].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[33].sensor_type)), - 100) - << "incorrect value for sol_in[33].sensor_type, expected 100, is " - << last_msg_->sol_in[33].sensor_type; - EXPECT_EQ( - get_assol_in[34].flags)>( - reinterpret_cast(&last_msg_->sol_in[34].flags)), - 72) - << "incorrect value for sol_in[34].flags, expected 72, is " - << last_msg_->sol_in[34].flags; - EXPECT_EQ(get_assol_in[34].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[34].sensor_type)), - 106) - << "incorrect value for sol_in[34].sensor_type, expected 106, is " - << last_msg_->sol_in[34].sensor_type; - EXPECT_EQ( - get_assol_in[35].flags)>( - reinterpret_cast(&last_msg_->sol_in[35].flags)), - 10) - << "incorrect value for sol_in[35].flags, expected 10, is " - << last_msg_->sol_in[35].flags; - EXPECT_EQ(get_assol_in[35].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[35].sensor_type)), - 48) - << "incorrect value for sol_in[35].sensor_type, expected 48, is " - << last_msg_->sol_in[35].sensor_type; - EXPECT_EQ( - get_assol_in[36].flags)>( - reinterpret_cast(&last_msg_->sol_in[36].flags)), - 232) - << "incorrect value for sol_in[36].flags, expected 232, is " - << last_msg_->sol_in[36].flags; - EXPECT_EQ(get_assol_in[36].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[36].sensor_type)), - 222) - << "incorrect value for sol_in[36].sensor_type, expected 222, is " - << last_msg_->sol_in[36].sensor_type; - EXPECT_EQ( - get_assol_in[37].flags)>( - reinterpret_cast(&last_msg_->sol_in[37].flags)), - 73) - << "incorrect value for sol_in[37].flags, expected 73, is " - << last_msg_->sol_in[37].flags; - EXPECT_EQ(get_assol_in[37].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[37].sensor_type)), - 235) - << "incorrect value for sol_in[37].sensor_type, expected 235, is " - << last_msg_->sol_in[37].sensor_type; - EXPECT_EQ( - get_assol_in[38].flags)>( - reinterpret_cast(&last_msg_->sol_in[38].flags)), - 163) - << "incorrect value for sol_in[38].flags, expected 163, is " - << last_msg_->sol_in[38].flags; - EXPECT_EQ(get_assol_in[38].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[38].sensor_type)), - 109) - << "incorrect value for sol_in[38].sensor_type, expected 109, is " - << last_msg_->sol_in[38].sensor_type; - EXPECT_EQ( - get_assol_in[39].flags)>( - reinterpret_cast(&last_msg_->sol_in[39].flags)), - 152) - << "incorrect value for sol_in[39].flags, expected 152, is " - << last_msg_->sol_in[39].flags; - EXPECT_EQ(get_assol_in[39].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[39].sensor_type)), - 51) - << "incorrect value for sol_in[39].sensor_type, expected 51, is " - << last_msg_->sol_in[39].sensor_type; - EXPECT_EQ( - get_assol_in[40].flags)>( - reinterpret_cast(&last_msg_->sol_in[40].flags)), - 235) - << "incorrect value for sol_in[40].flags, expected 235, is " - << last_msg_->sol_in[40].flags; - EXPECT_EQ(get_assol_in[40].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[40].sensor_type)), - 133) - << "incorrect value for sol_in[40].sensor_type, expected 133, is " - << last_msg_->sol_in[40].sensor_type; - EXPECT_EQ( - get_assol_in[41].flags)>( - reinterpret_cast(&last_msg_->sol_in[41].flags)), - 70) - << "incorrect value for sol_in[41].flags, expected 70, is " - << last_msg_->sol_in[41].flags; - EXPECT_EQ(get_assol_in[41].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[41].sensor_type)), - 87) - << "incorrect value for sol_in[41].sensor_type, expected 87, is " - << last_msg_->sol_in[41].sensor_type; - EXPECT_EQ( - get_assol_in[42].flags)>( - reinterpret_cast(&last_msg_->sol_in[42].flags)), - 108) - << "incorrect value for sol_in[42].flags, expected 108, is " - << last_msg_->sol_in[42].flags; - EXPECT_EQ(get_assol_in[42].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[42].sensor_type)), - 2) - << "incorrect value for sol_in[42].sensor_type, expected 2, is " - << last_msg_->sol_in[42].sensor_type; - EXPECT_EQ( - get_assol_in[43].flags)>( - reinterpret_cast(&last_msg_->sol_in[43].flags)), - 101) - << "incorrect value for sol_in[43].flags, expected 101, is " - << last_msg_->sol_in[43].flags; - EXPECT_EQ(get_assol_in[43].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[43].sensor_type)), - 91) - << "incorrect value for sol_in[43].sensor_type, expected 91, is " - << last_msg_->sol_in[43].sensor_type; - EXPECT_EQ( - get_assol_in[44].flags)>( - reinterpret_cast(&last_msg_->sol_in[44].flags)), - 55) - << "incorrect value for sol_in[44].flags, expected 55, is " - << last_msg_->sol_in[44].flags; - EXPECT_EQ(get_assol_in[44].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[44].sensor_type)), - 200) - << "incorrect value for sol_in[44].sensor_type, expected 200, is " - << last_msg_->sol_in[44].sensor_type; - EXPECT_EQ( - get_assol_in[45].flags)>( - reinterpret_cast(&last_msg_->sol_in[45].flags)), - 156) - << "incorrect value for sol_in[45].flags, expected 156, is " - << last_msg_->sol_in[45].flags; - EXPECT_EQ(get_assol_in[45].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[45].sensor_type)), - 24) - << "incorrect value for sol_in[45].sensor_type, expected 24, is " - << last_msg_->sol_in[45].sensor_type; - EXPECT_EQ( - get_assol_in[46].flags)>( - reinterpret_cast(&last_msg_->sol_in[46].flags)), - 73) - << "incorrect value for sol_in[46].flags, expected 73, is " - << last_msg_->sol_in[46].flags; - EXPECT_EQ(get_assol_in[46].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[46].sensor_type)), - 233) - << "incorrect value for sol_in[46].sensor_type, expected 233, is " - << last_msg_->sol_in[46].sensor_type; - EXPECT_EQ( - get_assol_in[47].flags)>( - reinterpret_cast(&last_msg_->sol_in[47].flags)), - 66) - << "incorrect value for sol_in[47].flags, expected 66, is " - << last_msg_->sol_in[47].flags; - EXPECT_EQ(get_assol_in[47].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[47].sensor_type)), - 39) - << "incorrect value for sol_in[47].sensor_type, expected 39, is " - << last_msg_->sol_in[47].sensor_type; - EXPECT_EQ( - get_assol_in[48].flags)>( - reinterpret_cast(&last_msg_->sol_in[48].flags)), - 140) - << "incorrect value for sol_in[48].flags, expected 140, is " - << last_msg_->sol_in[48].flags; - EXPECT_EQ(get_assol_in[48].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[48].sensor_type)), - 97) - << "incorrect value for sol_in[48].sensor_type, expected 97, is " - << last_msg_->sol_in[48].sensor_type; - EXPECT_EQ( - get_assol_in[49].flags)>( - reinterpret_cast(&last_msg_->sol_in[49].flags)), - 227) - << "incorrect value for sol_in[49].flags, expected 227, is " - << last_msg_->sol_in[49].flags; - EXPECT_EQ(get_assol_in[49].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[49].sensor_type)), - 252) - << "incorrect value for sol_in[49].sensor_type, expected 252, is " - << last_msg_->sol_in[49].sensor_type; - EXPECT_EQ( - get_assol_in[50].flags)>( - reinterpret_cast(&last_msg_->sol_in[50].flags)), - 237) - << "incorrect value for sol_in[50].flags, expected 237, is " - << last_msg_->sol_in[50].flags; - EXPECT_EQ(get_assol_in[50].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[50].sensor_type)), - 230) - << "incorrect value for sol_in[50].sensor_type, expected 230, is " - << last_msg_->sol_in[50].sensor_type; - EXPECT_EQ( - get_assol_in[51].flags)>( - reinterpret_cast(&last_msg_->sol_in[51].flags)), - 241) - << "incorrect value for sol_in[51].flags, expected 241, is " - << last_msg_->sol_in[51].flags; - EXPECT_EQ(get_assol_in[51].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[51].sensor_type)), - 135) - << "incorrect value for sol_in[51].sensor_type, expected 135, is " - << last_msg_->sol_in[51].sensor_type; - EXPECT_EQ( - get_assol_in[52].flags)>( - reinterpret_cast(&last_msg_->sol_in[52].flags)), - 205) - << "incorrect value for sol_in[52].flags, expected 205, is " - << last_msg_->sol_in[52].flags; - EXPECT_EQ(get_assol_in[52].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[52].sensor_type)), - 245) - << "incorrect value for sol_in[52].sensor_type, expected 245, is " - << last_msg_->sol_in[52].sensor_type; - EXPECT_EQ( - get_assol_in[53].flags)>( - reinterpret_cast(&last_msg_->sol_in[53].flags)), - 0) - << "incorrect value for sol_in[53].flags, expected 0, is " - << last_msg_->sol_in[53].flags; - EXPECT_EQ(get_assol_in[53].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[53].sensor_type)), - 70) - << "incorrect value for sol_in[53].sensor_type, expected 70, is " - << last_msg_->sol_in[53].sensor_type; - EXPECT_EQ( - get_assol_in[54].flags)>( - reinterpret_cast(&last_msg_->sol_in[54].flags)), - 188) - << "incorrect value for sol_in[54].flags, expected 188, is " - << last_msg_->sol_in[54].flags; - EXPECT_EQ(get_assol_in[54].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[54].sensor_type)), - 219) - << "incorrect value for sol_in[54].sensor_type, expected 219, is " - << last_msg_->sol_in[54].sensor_type; - EXPECT_EQ( - get_assol_in[55].flags)>( - reinterpret_cast(&last_msg_->sol_in[55].flags)), - 136) - << "incorrect value for sol_in[55].flags, expected 136, is " - << last_msg_->sol_in[55].flags; - EXPECT_EQ(get_assol_in[55].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[55].sensor_type)), - 107) - << "incorrect value for sol_in[55].sensor_type, expected 107, is " - << last_msg_->sol_in[55].sensor_type; - EXPECT_EQ( - get_assol_in[56].flags)>( - reinterpret_cast(&last_msg_->sol_in[56].flags)), - 58) - << "incorrect value for sol_in[56].flags, expected 58, is " - << last_msg_->sol_in[56].flags; - EXPECT_EQ(get_assol_in[56].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[56].sensor_type)), - 178) - << "incorrect value for sol_in[56].sensor_type, expected 178, is " - << last_msg_->sol_in[56].sensor_type; - EXPECT_EQ( - get_assol_in[57].flags)>( - reinterpret_cast(&last_msg_->sol_in[57].flags)), - 29) - << "incorrect value for sol_in[57].flags, expected 29, is " - << last_msg_->sol_in[57].flags; - EXPECT_EQ(get_assol_in[57].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[57].sensor_type)), - 1) - << "incorrect value for sol_in[57].sensor_type, expected 1, is " - << last_msg_->sol_in[57].sensor_type; - EXPECT_EQ( - get_assol_in[58].flags)>( - reinterpret_cast(&last_msg_->sol_in[58].flags)), - 213) - << "incorrect value for sol_in[58].flags, expected 213, is " - << last_msg_->sol_in[58].flags; - EXPECT_EQ(get_assol_in[58].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[58].sensor_type)), - 44) - << "incorrect value for sol_in[58].sensor_type, expected 44, is " - << last_msg_->sol_in[58].sensor_type; - EXPECT_EQ( - get_assol_in[59].flags)>( - reinterpret_cast(&last_msg_->sol_in[59].flags)), - 147) - << "incorrect value for sol_in[59].flags, expected 147, is " - << last_msg_->sol_in[59].flags; - EXPECT_EQ(get_assol_in[59].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[59].sensor_type)), - 225) - << "incorrect value for sol_in[59].sensor_type, expected 225, is " - << last_msg_->sol_in[59].sensor_type; - EXPECT_EQ( - get_assol_in[60].flags)>( - reinterpret_cast(&last_msg_->sol_in[60].flags)), - 96) - << "incorrect value for sol_in[60].flags, expected 96, is " - << last_msg_->sol_in[60].flags; - EXPECT_EQ(get_assol_in[60].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[60].sensor_type)), - 190) - << "incorrect value for sol_in[60].sensor_type, expected 190, is " - << last_msg_->sol_in[60].sensor_type; - EXPECT_EQ( - get_assol_in[61].flags)>( - reinterpret_cast(&last_msg_->sol_in[61].flags)), - 108) - << "incorrect value for sol_in[61].flags, expected 108, is " - << last_msg_->sol_in[61].flags; - EXPECT_EQ(get_assol_in[61].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[61].sensor_type)), - 192) - << "incorrect value for sol_in[61].sensor_type, expected 192, is " - << last_msg_->sol_in[61].sensor_type; - EXPECT_EQ( - get_assol_in[62].flags)>( - reinterpret_cast(&last_msg_->sol_in[62].flags)), - 15) - << "incorrect value for sol_in[62].flags, expected 15, is " - << last_msg_->sol_in[62].flags; - EXPECT_EQ(get_assol_in[62].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[62].sensor_type)), - 228) - << "incorrect value for sol_in[62].sensor_type, expected 228, is " - << last_msg_->sol_in[62].sensor_type; - EXPECT_EQ( - get_assol_in[63].flags)>( - reinterpret_cast(&last_msg_->sol_in[63].flags)), - 18) - << "incorrect value for sol_in[63].flags, expected 18, is " - << last_msg_->sol_in[63].flags; - EXPECT_EQ(get_assol_in[63].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[63].sensor_type)), - 203) - << "incorrect value for sol_in[63].sensor_type, expected 203, is " - << last_msg_->sol_in[63].sensor_type; - EXPECT_EQ( - get_assol_in[64].flags)>( - reinterpret_cast(&last_msg_->sol_in[64].flags)), - 222) - << "incorrect value for sol_in[64].flags, expected 222, is " - << last_msg_->sol_in[64].flags; - EXPECT_EQ(get_assol_in[64].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[64].sensor_type)), - 3) - << "incorrect value for sol_in[64].sensor_type, expected 3, is " - << last_msg_->sol_in[64].sensor_type; - EXPECT_EQ( - get_assol_in[65].flags)>( - reinterpret_cast(&last_msg_->sol_in[65].flags)), - 68) - << "incorrect value for sol_in[65].flags, expected 68, is " - << last_msg_->sol_in[65].flags; - EXPECT_EQ(get_assol_in[65].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[65].sensor_type)), - 180) - << "incorrect value for sol_in[65].sensor_type, expected 180, is " - << last_msg_->sol_in[65].sensor_type; - EXPECT_EQ( - get_assol_in[66].flags)>( - reinterpret_cast(&last_msg_->sol_in[66].flags)), - 229) - << "incorrect value for sol_in[66].flags, expected 229, is " - << last_msg_->sol_in[66].flags; - EXPECT_EQ(get_assol_in[66].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[66].sensor_type)), - 101) - << "incorrect value for sol_in[66].sensor_type, expected 101, is " - << last_msg_->sol_in[66].sensor_type; - EXPECT_EQ( - get_assol_in[67].flags)>( - reinterpret_cast(&last_msg_->sol_in[67].flags)), - 203) - << "incorrect value for sol_in[67].flags, expected 203, is " - << last_msg_->sol_in[67].flags; - EXPECT_EQ(get_assol_in[67].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[67].sensor_type)), - 223) - << "incorrect value for sol_in[67].sensor_type, expected 223, is " - << last_msg_->sol_in[67].sensor_type; - EXPECT_EQ( - get_assol_in[68].flags)>( - reinterpret_cast(&last_msg_->sol_in[68].flags)), - 164) - << "incorrect value for sol_in[68].flags, expected 164, is " - << last_msg_->sol_in[68].flags; - EXPECT_EQ(get_assol_in[68].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[68].sensor_type)), - 243) - << "incorrect value for sol_in[68].sensor_type, expected 243, is " - << last_msg_->sol_in[68].sensor_type; - EXPECT_EQ( - get_assol_in[69].flags)>( - reinterpret_cast(&last_msg_->sol_in[69].flags)), - 165) - << "incorrect value for sol_in[69].flags, expected 165, is " - << last_msg_->sol_in[69].flags; - EXPECT_EQ(get_assol_in[69].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[69].sensor_type)), - 92) - << "incorrect value for sol_in[69].sensor_type, expected 92, is " - << last_msg_->sol_in[69].sensor_type; - EXPECT_EQ( - get_assol_in[70].flags)>( - reinterpret_cast(&last_msg_->sol_in[70].flags)), - 159) - << "incorrect value for sol_in[70].flags, expected 159, is " - << last_msg_->sol_in[70].flags; - EXPECT_EQ(get_assol_in[70].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[70].sensor_type)), - 220) - << "incorrect value for sol_in[70].sensor_type, expected 220, is " - << last_msg_->sol_in[70].sensor_type; - EXPECT_EQ( - get_assol_in[71].flags)>( - reinterpret_cast(&last_msg_->sol_in[71].flags)), - 121) - << "incorrect value for sol_in[71].flags, expected 121, is " - << last_msg_->sol_in[71].flags; - EXPECT_EQ(get_assol_in[71].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[71].sensor_type)), - 174) - << "incorrect value for sol_in[71].sensor_type, expected 174, is " - << last_msg_->sol_in[71].sensor_type; - EXPECT_EQ( - get_assol_in[72].flags)>( - reinterpret_cast(&last_msg_->sol_in[72].flags)), - 167) - << "incorrect value for sol_in[72].flags, expected 167, is " - << last_msg_->sol_in[72].flags; - EXPECT_EQ(get_assol_in[72].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[72].sensor_type)), - 112) - << "incorrect value for sol_in[72].sensor_type, expected 112, is " - << last_msg_->sol_in[72].sensor_type; - EXPECT_EQ( - get_assol_in[73].flags)>( - reinterpret_cast(&last_msg_->sol_in[73].flags)), - 40) - << "incorrect value for sol_in[73].flags, expected 40, is " - << last_msg_->sol_in[73].flags; - EXPECT_EQ(get_assol_in[73].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[73].sensor_type)), - 240) - << "incorrect value for sol_in[73].sensor_type, expected 240, is " - << last_msg_->sol_in[73].sensor_type; - EXPECT_EQ( - get_assol_in[74].flags)>( - reinterpret_cast(&last_msg_->sol_in[74].flags)), - 3) - << "incorrect value for sol_in[74].flags, expected 3, is " - << last_msg_->sol_in[74].flags; - EXPECT_EQ(get_assol_in[74].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[74].sensor_type)), - 59) - << "incorrect value for sol_in[74].sensor_type, expected 59, is " - << last_msg_->sol_in[74].sensor_type; - EXPECT_EQ( - get_assol_in[75].flags)>( - reinterpret_cast(&last_msg_->sol_in[75].flags)), - 52) - << "incorrect value for sol_in[75].flags, expected 52, is " - << last_msg_->sol_in[75].flags; - EXPECT_EQ(get_assol_in[75].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[75].sensor_type)), - 230) - << "incorrect value for sol_in[75].sensor_type, expected 230, is " - << last_msg_->sol_in[75].sensor_type; - EXPECT_EQ( - get_assol_in[76].flags)>( - reinterpret_cast(&last_msg_->sol_in[76].flags)), - 148) - << "incorrect value for sol_in[76].flags, expected 148, is " - << last_msg_->sol_in[76].flags; - EXPECT_EQ(get_assol_in[76].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[76].sensor_type)), - 149) - << "incorrect value for sol_in[76].sensor_type, expected 149, is " - << last_msg_->sol_in[76].sensor_type; - EXPECT_EQ( - get_assol_in[77].flags)>( - reinterpret_cast(&last_msg_->sol_in[77].flags)), - 142) - << "incorrect value for sol_in[77].flags, expected 142, is " - << last_msg_->sol_in[77].flags; - EXPECT_EQ(get_assol_in[77].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[77].sensor_type)), - 218) - << "incorrect value for sol_in[77].sensor_type, expected 218, is " - << last_msg_->sol_in[77].sensor_type; - EXPECT_EQ( - get_assol_in[78].flags)>( - reinterpret_cast(&last_msg_->sol_in[78].flags)), - 109) - << "incorrect value for sol_in[78].flags, expected 109, is " - << last_msg_->sol_in[78].flags; - EXPECT_EQ(get_assol_in[78].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[78].sensor_type)), - 212) - << "incorrect value for sol_in[78].sensor_type, expected 212, is " - << last_msg_->sol_in[78].sensor_type; - EXPECT_EQ( - get_assol_in[79].flags)>( - reinterpret_cast(&last_msg_->sol_in[79].flags)), - 71) - << "incorrect value for sol_in[79].flags, expected 71, is " - << last_msg_->sol_in[79].flags; - EXPECT_EQ(get_assol_in[79].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[79].sensor_type)), - 176) - << "incorrect value for sol_in[79].sensor_type, expected 176, is " - << last_msg_->sol_in[79].sensor_type; - EXPECT_EQ( - get_assol_in[80].flags)>( - reinterpret_cast(&last_msg_->sol_in[80].flags)), - 172) - << "incorrect value for sol_in[80].flags, expected 172, is " - << last_msg_->sol_in[80].flags; - EXPECT_EQ(get_assol_in[80].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[80].sensor_type)), - 179) - << "incorrect value for sol_in[80].sensor_type, expected 179, is " - << last_msg_->sol_in[80].sensor_type; - EXPECT_EQ( - get_assol_in[81].flags)>( - reinterpret_cast(&last_msg_->sol_in[81].flags)), - 1) - << "incorrect value for sol_in[81].flags, expected 1, is " - << last_msg_->sol_in[81].flags; - EXPECT_EQ(get_assol_in[81].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[81].sensor_type)), - 77) - << "incorrect value for sol_in[81].sensor_type, expected 77, is " - << last_msg_->sol_in[81].sensor_type; - EXPECT_EQ( - get_assol_in[82].flags)>( - reinterpret_cast(&last_msg_->sol_in[82].flags)), - 70) - << "incorrect value for sol_in[82].flags, expected 70, is " - << last_msg_->sol_in[82].flags; - EXPECT_EQ(get_assol_in[82].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[82].sensor_type)), - 193) - << "incorrect value for sol_in[82].sensor_type, expected 193, is " - << last_msg_->sol_in[82].sensor_type; - EXPECT_EQ( - get_assol_in[83].flags)>( - reinterpret_cast(&last_msg_->sol_in[83].flags)), - 149) - << "incorrect value for sol_in[83].flags, expected 149, is " - << last_msg_->sol_in[83].flags; - EXPECT_EQ(get_assol_in[83].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[83].sensor_type)), - 147) - << "incorrect value for sol_in[83].sensor_type, expected 147, is " - << last_msg_->sol_in[83].sensor_type; - EXPECT_EQ( - get_assol_in[84].flags)>( - reinterpret_cast(&last_msg_->sol_in[84].flags)), - 144) - << "incorrect value for sol_in[84].flags, expected 144, is " - << last_msg_->sol_in[84].flags; - EXPECT_EQ(get_assol_in[84].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[84].sensor_type)), - 23) - << "incorrect value for sol_in[84].sensor_type, expected 23, is " - << last_msg_->sol_in[84].sensor_type; - EXPECT_EQ( - get_assol_in[85].flags)>( - reinterpret_cast(&last_msg_->sol_in[85].flags)), - 239) - << "incorrect value for sol_in[85].flags, expected 239, is " - << last_msg_->sol_in[85].flags; - EXPECT_EQ(get_assol_in[85].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[85].sensor_type)), - 148) - << "incorrect value for sol_in[85].sensor_type, expected 148, is " - << last_msg_->sol_in[85].sensor_type; - EXPECT_EQ( - get_assol_in[86].flags)>( - reinterpret_cast(&last_msg_->sol_in[86].flags)), - 186) - << "incorrect value for sol_in[86].flags, expected 186, is " - << last_msg_->sol_in[86].flags; - EXPECT_EQ(get_assol_in[86].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[86].sensor_type)), - 195) - << "incorrect value for sol_in[86].sensor_type, expected 195, is " - << last_msg_->sol_in[86].sensor_type; - EXPECT_EQ( - get_assol_in[87].flags)>( - reinterpret_cast(&last_msg_->sol_in[87].flags)), - 30) - << "incorrect value for sol_in[87].flags, expected 30, is " - << last_msg_->sol_in[87].flags; - EXPECT_EQ(get_assol_in[87].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[87].sensor_type)), - 86) - << "incorrect value for sol_in[87].sensor_type, expected 86, is " - << last_msg_->sol_in[87].sensor_type; - EXPECT_EQ( - get_assol_in[88].flags)>( - reinterpret_cast(&last_msg_->sol_in[88].flags)), - 143) - << "incorrect value for sol_in[88].flags, expected 143, is " - << last_msg_->sol_in[88].flags; - EXPECT_EQ(get_assol_in[88].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[88].sensor_type)), - 34) - << "incorrect value for sol_in[88].sensor_type, expected 34, is " - << last_msg_->sol_in[88].sensor_type; - EXPECT_EQ( - get_assol_in[89].flags)>( - reinterpret_cast(&last_msg_->sol_in[89].flags)), - 207) - << "incorrect value for sol_in[89].flags, expected 207, is " - << last_msg_->sol_in[89].flags; - EXPECT_EQ(get_assol_in[89].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[89].sensor_type)), - 156) - << "incorrect value for sol_in[89].sensor_type, expected 156, is " - << last_msg_->sol_in[89].sensor_type; - EXPECT_EQ( - get_assol_in[90].flags)>( - reinterpret_cast(&last_msg_->sol_in[90].flags)), - 55) - << "incorrect value for sol_in[90].flags, expected 55, is " - << last_msg_->sol_in[90].flags; - EXPECT_EQ(get_assol_in[90].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[90].sensor_type)), - 63) - << "incorrect value for sol_in[90].sensor_type, expected 63, is " - << last_msg_->sol_in[90].sensor_type; - EXPECT_EQ( - get_assol_in[91].flags)>( - reinterpret_cast(&last_msg_->sol_in[91].flags)), - 255) - << "incorrect value for sol_in[91].flags, expected 255, is " - << last_msg_->sol_in[91].flags; - EXPECT_EQ(get_assol_in[91].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[91].sensor_type)), - 117) - << "incorrect value for sol_in[91].sensor_type, expected 117, is " - << last_msg_->sol_in[91].sensor_type; - EXPECT_EQ( - get_assol_in[92].flags)>( - reinterpret_cast(&last_msg_->sol_in[92].flags)), - 222) - << "incorrect value for sol_in[92].flags, expected 222, is " - << last_msg_->sol_in[92].flags; - EXPECT_EQ(get_assol_in[92].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[92].sensor_type)), - 222) - << "incorrect value for sol_in[92].sensor_type, expected 222, is " - << last_msg_->sol_in[92].sensor_type; - EXPECT_EQ( - get_assol_in[93].flags)>( - reinterpret_cast(&last_msg_->sol_in[93].flags)), - 145) - << "incorrect value for sol_in[93].flags, expected 145, is " - << last_msg_->sol_in[93].flags; - EXPECT_EQ(get_assol_in[93].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[93].sensor_type)), - 219) - << "incorrect value for sol_in[93].sensor_type, expected 219, is " - << last_msg_->sol_in[93].sensor_type; - EXPECT_EQ( - get_assol_in[94].flags)>( - reinterpret_cast(&last_msg_->sol_in[94].flags)), - 191) - << "incorrect value for sol_in[94].flags, expected 191, is " - << last_msg_->sol_in[94].flags; - EXPECT_EQ(get_assol_in[94].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[94].sensor_type)), - 224) - << "incorrect value for sol_in[94].sensor_type, expected 224, is " - << last_msg_->sol_in[94].sensor_type; - EXPECT_EQ( - get_assol_in[95].flags)>( - reinterpret_cast(&last_msg_->sol_in[95].flags)), - 109) - << "incorrect value for sol_in[95].flags, expected 109, is " - << last_msg_->sol_in[95].flags; - EXPECT_EQ(get_assol_in[95].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[95].sensor_type)), - 210) - << "incorrect value for sol_in[95].sensor_type, expected 210, is " - << last_msg_->sol_in[95].sensor_type; - EXPECT_EQ( - get_assol_in[96].flags)>( - reinterpret_cast(&last_msg_->sol_in[96].flags)), - 153) - << "incorrect value for sol_in[96].flags, expected 153, is " - << last_msg_->sol_in[96].flags; - EXPECT_EQ(get_assol_in[96].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[96].sensor_type)), - 86) - << "incorrect value for sol_in[96].sensor_type, expected 86, is " - << last_msg_->sol_in[96].sensor_type; - EXPECT_EQ( - get_assol_in[97].flags)>( - reinterpret_cast(&last_msg_->sol_in[97].flags)), - 32) - << "incorrect value for sol_in[97].flags, expected 32, is " - << last_msg_->sol_in[97].flags; - EXPECT_EQ(get_assol_in[97].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[97].sensor_type)), - 21) - << "incorrect value for sol_in[97].sensor_type, expected 21, is " - << last_msg_->sol_in[97].sensor_type; - EXPECT_EQ( - get_assol_in[98].flags)>( - reinterpret_cast(&last_msg_->sol_in[98].flags)), - 10) - << "incorrect value for sol_in[98].flags, expected 10, is " - << last_msg_->sol_in[98].flags; - EXPECT_EQ(get_assol_in[98].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[98].sensor_type)), - 226) - << "incorrect value for sol_in[98].sensor_type, expected 226, is " - << last_msg_->sol_in[98].sensor_type; - EXPECT_EQ( - get_assol_in[99].flags)>( - reinterpret_cast(&last_msg_->sol_in[99].flags)), - 63) - << "incorrect value for sol_in[99].flags, expected 63, is " - << last_msg_->sol_in[99].flags; - EXPECT_EQ(get_assol_in[99].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[99].sensor_type)), - 60) - << "incorrect value for sol_in[99].sensor_type, expected 60, is " - << last_msg_->sol_in[99].sensor_type; - EXPECT_EQ( - get_assol_in[100].flags)>( - reinterpret_cast(&last_msg_->sol_in[100].flags)), - 236) - << "incorrect value for sol_in[100].flags, expected 236, is " - << last_msg_->sol_in[100].flags; - EXPECT_EQ(get_assol_in[100].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[100].sensor_type)), - 106) - << "incorrect value for sol_in[100].sensor_type, expected 106, is " - << last_msg_->sol_in[100].sensor_type; - EXPECT_EQ( - get_assol_in[101].flags)>( - reinterpret_cast(&last_msg_->sol_in[101].flags)), - 96) - << "incorrect value for sol_in[101].flags, expected 96, is " - << last_msg_->sol_in[101].flags; - EXPECT_EQ(get_assol_in[101].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[101].sensor_type)), - 93) - << "incorrect value for sol_in[101].sensor_type, expected 93, is " - << last_msg_->sol_in[101].sensor_type; - EXPECT_EQ( - get_assol_in[102].flags)>( - reinterpret_cast(&last_msg_->sol_in[102].flags)), - 163) - << "incorrect value for sol_in[102].flags, expected 163, is " - << last_msg_->sol_in[102].flags; - EXPECT_EQ(get_assol_in[102].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[102].sensor_type)), - 30) - << "incorrect value for sol_in[102].sensor_type, expected 30, is " - << last_msg_->sol_in[102].sensor_type; - EXPECT_EQ( - get_assol_in[103].flags)>( - reinterpret_cast(&last_msg_->sol_in[103].flags)), - 238) - << "incorrect value for sol_in[103].flags, expected 238, is " - << last_msg_->sol_in[103].flags; - EXPECT_EQ(get_assol_in[103].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[103].sensor_type)), - 106) - << "incorrect value for sol_in[103].sensor_type, expected 106, is " - << last_msg_->sol_in[103].sensor_type; - EXPECT_EQ( - get_assol_in[104].flags)>( - reinterpret_cast(&last_msg_->sol_in[104].flags)), - 133) - << "incorrect value for sol_in[104].flags, expected 133, is " - << last_msg_->sol_in[104].flags; - EXPECT_EQ(get_assol_in[104].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[104].sensor_type)), - 147) - << "incorrect value for sol_in[104].sensor_type, expected 147, is " - << last_msg_->sol_in[104].sensor_type; - EXPECT_EQ( - get_assol_in[105].flags)>( - reinterpret_cast(&last_msg_->sol_in[105].flags)), - 107) - << "incorrect value for sol_in[105].flags, expected 107, is " - << last_msg_->sol_in[105].flags; - EXPECT_EQ(get_assol_in[105].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[105].sensor_type)), - 132) - << "incorrect value for sol_in[105].sensor_type, expected 132, is " - << last_msg_->sol_in[105].sensor_type; - EXPECT_EQ( - get_assol_in[106].flags)>( - reinterpret_cast(&last_msg_->sol_in[106].flags)), - 214) - << "incorrect value for sol_in[106].flags, expected 214, is " - << last_msg_->sol_in[106].flags; - EXPECT_EQ(get_assol_in[106].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[106].sensor_type)), - 152) - << "incorrect value for sol_in[106].sensor_type, expected 152, is " - << last_msg_->sol_in[106].sensor_type; - EXPECT_EQ( - get_assol_in[107].flags)>( - reinterpret_cast(&last_msg_->sol_in[107].flags)), - 185) - << "incorrect value for sol_in[107].flags, expected 185, is " - << last_msg_->sol_in[107].flags; - EXPECT_EQ(get_assol_in[107].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[107].sensor_type)), - 221) - << "incorrect value for sol_in[107].sensor_type, expected 221, is " - << last_msg_->sol_in[107].sensor_type; - EXPECT_EQ( - get_assol_in[108].flags)>( - reinterpret_cast(&last_msg_->sol_in[108].flags)), - 21) - << "incorrect value for sol_in[108].flags, expected 21, is " - << last_msg_->sol_in[108].flags; - EXPECT_EQ(get_assol_in[108].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[108].sensor_type)), - 202) - << "incorrect value for sol_in[108].sensor_type, expected 202, is " - << last_msg_->sol_in[108].sensor_type; - EXPECT_EQ( - get_assol_in[109].flags)>( - reinterpret_cast(&last_msg_->sol_in[109].flags)), - 51) - << "incorrect value for sol_in[109].flags, expected 51, is " - << last_msg_->sol_in[109].flags; - EXPECT_EQ(get_assol_in[109].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[109].sensor_type)), - 252) - << "incorrect value for sol_in[109].sensor_type, expected 252, is " - << last_msg_->sol_in[109].sensor_type; - EXPECT_EQ( - get_assol_in[110].flags)>( - reinterpret_cast(&last_msg_->sol_in[110].flags)), - 59) - << "incorrect value for sol_in[110].flags, expected 59, is " - << last_msg_->sol_in[110].flags; - EXPECT_EQ(get_assol_in[110].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[110].sensor_type)), - 130) - << "incorrect value for sol_in[110].sensor_type, expected 130, is " - << last_msg_->sol_in[110].sensor_type; - EXPECT_EQ( - get_assol_in[111].flags)>( - reinterpret_cast(&last_msg_->sol_in[111].flags)), - 202) - << "incorrect value for sol_in[111].flags, expected 202, is " - << last_msg_->sol_in[111].flags; - EXPECT_EQ(get_assol_in[111].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[111].sensor_type)), - 166) - << "incorrect value for sol_in[111].sensor_type, expected 166, is " - << last_msg_->sol_in[111].sensor_type; - EXPECT_EQ( - get_assol_in[112].flags)>( - reinterpret_cast(&last_msg_->sol_in[112].flags)), - 170) - << "incorrect value for sol_in[112].flags, expected 170, is " - << last_msg_->sol_in[112].flags; - EXPECT_EQ(get_assol_in[112].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[112].sensor_type)), - 127) - << "incorrect value for sol_in[112].sensor_type, expected 127, is " - << last_msg_->sol_in[112].sensor_type; - EXPECT_EQ( - get_assol_in[113].flags)>( - reinterpret_cast(&last_msg_->sol_in[113].flags)), - 193) - << "incorrect value for sol_in[113].flags, expected 193, is " - << last_msg_->sol_in[113].flags; - EXPECT_EQ(get_assol_in[113].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[113].sensor_type)), - 58) - << "incorrect value for sol_in[113].sensor_type, expected 58, is " - << last_msg_->sol_in[113].sensor_type; - EXPECT_EQ( - get_assol_in[114].flags)>( - reinterpret_cast(&last_msg_->sol_in[114].flags)), - 125) - << "incorrect value for sol_in[114].flags, expected 125, is " - << last_msg_->sol_in[114].flags; - EXPECT_EQ(get_assol_in[114].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[114].sensor_type)), - 215) - << "incorrect value for sol_in[114].sensor_type, expected 215, is " - << last_msg_->sol_in[114].sensor_type; - EXPECT_EQ( - get_assol_in[115].flags)>( - reinterpret_cast(&last_msg_->sol_in[115].flags)), - 58) - << "incorrect value for sol_in[115].flags, expected 58, is " - << last_msg_->sol_in[115].flags; - EXPECT_EQ(get_assol_in[115].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[115].sensor_type)), - 22) - << "incorrect value for sol_in[115].sensor_type, expected 22, is " - << last_msg_->sol_in[115].sensor_type; - EXPECT_EQ( - get_assol_in[116].flags)>( - reinterpret_cast(&last_msg_->sol_in[116].flags)), - 47) - << "incorrect value for sol_in[116].flags, expected 47, is " - << last_msg_->sol_in[116].flags; - EXPECT_EQ(get_assol_in[116].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[116].sensor_type)), - 135) - << "incorrect value for sol_in[116].sensor_type, expected 135, is " - << last_msg_->sol_in[116].sensor_type; - EXPECT_EQ( - get_assol_in[117].flags)>( - reinterpret_cast(&last_msg_->sol_in[117].flags)), - 142) - << "incorrect value for sol_in[117].flags, expected 142, is " - << last_msg_->sol_in[117].flags; - EXPECT_EQ(get_assol_in[117].sensor_type)>( - reinterpret_cast( - &last_msg_->sol_in[117].sensor_type)), - 88) - << "incorrect value for sol_in[117].sensor_type, expected 88, is " - << last_msg_->sol_in[117].sensor_type; - EXPECT_EQ(get_asvdop)>( - reinterpret_cast(&last_msg_->vdop)), - 41989) - << "incorrect value for vdop, expected 41989, is " << last_msg_->vdop; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrCodeBiases.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrCodeBiases.cc deleted file mode 100644 index e29e53283a..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrCodeBiases.cc +++ /dev/null @@ -1,1537 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrCodeBiases.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrCodeBiases0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrCodeBiases0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_code_biases_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_code_biases_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrCodeBiases0, Test) { - uint8_t encoded_frame[] = { - 85, 225, 5, 39, 87, 253, 208, 90, 19, 23, 9, 66, 133, 241, 254, - 132, 51, 4, 131, 240, 120, 83, 148, 209, 213, 62, 228, 232, 71, 66, - 188, 210, 128, 54, 131, 152, 129, 111, 139, 242, 177, 145, 44, 9, 245, - 207, 241, 202, 150, 141, 50, 159, 220, 139, 37, 187, 98, 191, 23, 128, - 136, 167, 200, 6, 211, 90, 23, 244, 138, 215, 209, 139, 13, 101, 32, - 7, 18, 29, 70, 250, 109, 73, 202, 79, 144, 9, 146, 69, 241, 52, - 22, 99, 98, 204, 3, 171, 230, 180, 75, 62, 145, 86, 130, 31, 30, - 155, 37, 18, 55, 210, 39, 127, 242, 66, 13, 237, 152, 170, 212, 15, - 246, 59, 94, 180, 195, 157, 69, 100, 119, 16, 68, 179, 175, 144, 113, - 81, 82, 30, 151, 21, 109, 41, 225, 8, 77, 164, 157, 0, 73, 30, - 6, 78, 81, 143, 116, 240, 151, 55, 185, 169, 254, 51, 39, 74, 175, - 247, 34, 97, 74, 97, 176, 48, 236, 173, 12, 174, 101, 130, 30, 169, - 193, 190, 204, 196, 123, 107, 25, 225, 74, 9, 10, 55, 3, 131, 246, - 99, 133, 34, 227, 203, 68, 18, 97, 223, 89, 192, 246, 50, 69, 91, - 10, 151, 74, 118, 110, 36, 168, 247, 160, 77, 179, 141, 178, 99, 191, - 120, 77, 192, 91, 224, 1, 226, 50, 87, 146, 148, 238, 100, 179, 125, - 227, 215, 104, 184, 31, 57, 90, 79, 21, 156, 245, 81, 60, 93, 170, - 60, 200, 167, 13, 125, 132, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_code_biases_t *test_msg = (msg_ssr_code_biases_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[0].code = 51; - test_msg->biases[0].value = -31996; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[1].code = 240; - test_msg->biases[1].value = 21368; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[2].code = 148; - test_msg->biases[2].value = -10799; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[3].code = 62; - test_msg->biases[3].value = -5916; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[4].code = 71; - test_msg->biases[4].value = -17342; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[5].code = 210; - test_msg->biases[5].value = 13952; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[6].code = 131; - test_msg->biases[6].value = -32360; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[7].code = 111; - test_msg->biases[7].value = -3445; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[8].code = 177; - test_msg->biases[8].value = 11409; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[9].code = 9; - test_msg->biases[9].value = -12299; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[10].code = 241; - test_msg->biases[10].value = -26934; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[11].code = 141; - test_msg->biases[11].value = -24782; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[12].code = 220; - test_msg->biases[12].value = 9611; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[13].code = 187; - test_msg->biases[13].value = -16542; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[14].code = 23; - test_msg->biases[14].value = -30592; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[15].code = 167; - test_msg->biases[15].value = 1736; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[16].code = 211; - test_msg->biases[16].value = 5978; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[17].code = 244; - test_msg->biases[17].value = -10358; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[18].code = 209; - test_msg->biases[18].value = 3467; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[19].code = 101; - test_msg->biases[19].value = 1824; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[20].code = 18; - test_msg->biases[20].value = 17949; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[21].code = 250; - test_msg->biases[21].value = 18797; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[22].code = 202; - test_msg->biases[22].value = -28593; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[23].code = 9; - test_msg->biases[23].value = 17810; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[24].code = 241; - test_msg->biases[24].value = 5684; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[25].code = 99; - test_msg->biases[25].value = -13214; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[26].code = 3; - test_msg->biases[26].value = -6485; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[27].code = 180; - test_msg->biases[27].value = 15947; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[28].code = 145; - test_msg->biases[28].value = -32170; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[29].code = 31; - test_msg->biases[29].value = -25826; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[30].code = 37; - test_msg->biases[30].value = 14098; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[31].code = 210; - test_msg->biases[31].value = 32551; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[32].code = 242; - test_msg->biases[32].value = 3394; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[33].code = 237; - test_msg->biases[33].value = -21864; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[34].code = 212; - test_msg->biases[34].value = -2545; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[35].code = 59; - test_msg->biases[35].value = -19362; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[36].code = 195; - test_msg->biases[36].value = 17821; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[37].code = 100; - test_msg->biases[37].value = 4215; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[38].code = 68; - test_msg->biases[38].value = -20557; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[39].code = 144; - test_msg->biases[39].value = 20849; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[40].code = 82; - test_msg->biases[40].value = -26850; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[41].code = 21; - test_msg->biases[41].value = 10605; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[42].code = 225; - test_msg->biases[42].value = 19720; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[43].code = 164; - test_msg->biases[43].value = 157; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[44].code = 73; - test_msg->biases[44].value = 1566; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[45].code = 78; - test_msg->biases[45].value = -28847; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[46].code = 116; - test_msg->biases[46].value = -26640; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[47].code = 55; - test_msg->biases[47].value = -22087; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[48].code = 254; - test_msg->biases[48].value = 10035; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[49].code = 74; - test_msg->biases[49].value = -2129; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[50].code = 34; - test_msg->biases[50].value = 19041; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[51].code = 97; - test_msg->biases[51].value = 12464; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[52].code = 236; - test_msg->biases[52].value = 3245; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[53].code = 174; - test_msg->biases[53].value = -32155; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[54].code = 30; - test_msg->biases[54].value = -15959; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[55].code = 190; - test_msg->biases[55].value = -15156; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[56].code = 123; - test_msg->biases[56].value = 6507; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[57].code = 225; - test_msg->biases[57].value = 2378; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[58].code = 10; - test_msg->biases[58].value = 823; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[59].code = 131; - test_msg->biases[59].value = 25590; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[60].code = 133; - test_msg->biases[60].value = -7390; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[61].code = 203; - test_msg->biases[61].value = 4676; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[62].code = 97; - test_msg->biases[62].value = 23007; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[63].code = 192; - test_msg->biases[63].value = 13046; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[64].code = 69; - test_msg->biases[64].value = 2651; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[65].code = 151; - test_msg->biases[65].value = 30282; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[66].code = 110; - test_msg->biases[66].value = -22492; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[67].code = 247; - test_msg->biases[67].value = 19872; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[68].code = 179; - test_msg->biases[68].value = -19827; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[69].code = 99; - test_msg->biases[69].value = 30911; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[70].code = 77; - test_msg->biases[70].value = 23488; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[71].code = 224; - test_msg->biases[71].value = -7679; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[72].code = 50; - test_msg->biases[72].value = -28073; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[73].code = 148; - test_msg->biases[73].value = 25838; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[74].code = 179; - test_msg->biases[74].value = -7299; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[75].code = 215; - test_msg->biases[75].value = -18328; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[76].code = 31; - test_msg->biases[76].value = 23097; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[77].code = 79; - test_msg->biases[77].value = -25579; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[78].code = 245; - test_msg->biases[78].value = 15441; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[79].code = 93; - test_msg->biases[79].value = 15530; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[80].code = 200; - test_msg->biases[80].value = 3495; - test_msg->iod_ssr = 132; - test_msg->sid.code = 241; - test_msg->sid.sat = 133; - test_msg->time.tow = 387144400; - test_msg->time.wn = 16905; - test_msg->update_interval = 254; - - EXPECT_EQ(send_message(0x5e1, 22311, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 22311); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asbiases[0].code)>( - reinterpret_cast(&last_msg_->biases[0].code)), - 51) - << "incorrect value for biases[0].code, expected 51, is " - << last_msg_->biases[0].code; - EXPECT_EQ(get_asbiases[0].value)>( - reinterpret_cast(&last_msg_->biases[0].value)), - -31996) - << "incorrect value for biases[0].value, expected -31996, is " - << last_msg_->biases[0].value; - EXPECT_EQ(get_asbiases[1].code)>( - reinterpret_cast(&last_msg_->biases[1].code)), - 240) - << "incorrect value for biases[1].code, expected 240, is " - << last_msg_->biases[1].code; - EXPECT_EQ(get_asbiases[1].value)>( - reinterpret_cast(&last_msg_->biases[1].value)), - 21368) - << "incorrect value for biases[1].value, expected 21368, is " - << last_msg_->biases[1].value; - EXPECT_EQ(get_asbiases[2].code)>( - reinterpret_cast(&last_msg_->biases[2].code)), - 148) - << "incorrect value for biases[2].code, expected 148, is " - << last_msg_->biases[2].code; - EXPECT_EQ(get_asbiases[2].value)>( - reinterpret_cast(&last_msg_->biases[2].value)), - -10799) - << "incorrect value for biases[2].value, expected -10799, is " - << last_msg_->biases[2].value; - EXPECT_EQ(get_asbiases[3].code)>( - reinterpret_cast(&last_msg_->biases[3].code)), - 62) - << "incorrect value for biases[3].code, expected 62, is " - << last_msg_->biases[3].code; - EXPECT_EQ(get_asbiases[3].value)>( - reinterpret_cast(&last_msg_->biases[3].value)), - -5916) - << "incorrect value for biases[3].value, expected -5916, is " - << last_msg_->biases[3].value; - EXPECT_EQ(get_asbiases[4].code)>( - reinterpret_cast(&last_msg_->biases[4].code)), - 71) - << "incorrect value for biases[4].code, expected 71, is " - << last_msg_->biases[4].code; - EXPECT_EQ(get_asbiases[4].value)>( - reinterpret_cast(&last_msg_->biases[4].value)), - -17342) - << "incorrect value for biases[4].value, expected -17342, is " - << last_msg_->biases[4].value; - EXPECT_EQ(get_asbiases[5].code)>( - reinterpret_cast(&last_msg_->biases[5].code)), - 210) - << "incorrect value for biases[5].code, expected 210, is " - << last_msg_->biases[5].code; - EXPECT_EQ(get_asbiases[5].value)>( - reinterpret_cast(&last_msg_->biases[5].value)), - 13952) - << "incorrect value for biases[5].value, expected 13952, is " - << last_msg_->biases[5].value; - EXPECT_EQ(get_asbiases[6].code)>( - reinterpret_cast(&last_msg_->biases[6].code)), - 131) - << "incorrect value for biases[6].code, expected 131, is " - << last_msg_->biases[6].code; - EXPECT_EQ(get_asbiases[6].value)>( - reinterpret_cast(&last_msg_->biases[6].value)), - -32360) - << "incorrect value for biases[6].value, expected -32360, is " - << last_msg_->biases[6].value; - EXPECT_EQ(get_asbiases[7].code)>( - reinterpret_cast(&last_msg_->biases[7].code)), - 111) - << "incorrect value for biases[7].code, expected 111, is " - << last_msg_->biases[7].code; - EXPECT_EQ(get_asbiases[7].value)>( - reinterpret_cast(&last_msg_->biases[7].value)), - -3445) - << "incorrect value for biases[7].value, expected -3445, is " - << last_msg_->biases[7].value; - EXPECT_EQ(get_asbiases[8].code)>( - reinterpret_cast(&last_msg_->biases[8].code)), - 177) - << "incorrect value for biases[8].code, expected 177, is " - << last_msg_->biases[8].code; - EXPECT_EQ(get_asbiases[8].value)>( - reinterpret_cast(&last_msg_->biases[8].value)), - 11409) - << "incorrect value for biases[8].value, expected 11409, is " - << last_msg_->biases[8].value; - EXPECT_EQ(get_asbiases[9].code)>( - reinterpret_cast(&last_msg_->biases[9].code)), - 9) - << "incorrect value for biases[9].code, expected 9, is " - << last_msg_->biases[9].code; - EXPECT_EQ(get_asbiases[9].value)>( - reinterpret_cast(&last_msg_->biases[9].value)), - -12299) - << "incorrect value for biases[9].value, expected -12299, is " - << last_msg_->biases[9].value; - EXPECT_EQ(get_asbiases[10].code)>( - reinterpret_cast(&last_msg_->biases[10].code)), - 241) - << "incorrect value for biases[10].code, expected 241, is " - << last_msg_->biases[10].code; - EXPECT_EQ( - get_asbiases[10].value)>( - reinterpret_cast(&last_msg_->biases[10].value)), - -26934) - << "incorrect value for biases[10].value, expected -26934, is " - << last_msg_->biases[10].value; - EXPECT_EQ(get_asbiases[11].code)>( - reinterpret_cast(&last_msg_->biases[11].code)), - 141) - << "incorrect value for biases[11].code, expected 141, is " - << last_msg_->biases[11].code; - EXPECT_EQ( - get_asbiases[11].value)>( - reinterpret_cast(&last_msg_->biases[11].value)), - -24782) - << "incorrect value for biases[11].value, expected -24782, is " - << last_msg_->biases[11].value; - EXPECT_EQ(get_asbiases[12].code)>( - reinterpret_cast(&last_msg_->biases[12].code)), - 220) - << "incorrect value for biases[12].code, expected 220, is " - << last_msg_->biases[12].code; - EXPECT_EQ( - get_asbiases[12].value)>( - reinterpret_cast(&last_msg_->biases[12].value)), - 9611) - << "incorrect value for biases[12].value, expected 9611, is " - << last_msg_->biases[12].value; - EXPECT_EQ(get_asbiases[13].code)>( - reinterpret_cast(&last_msg_->biases[13].code)), - 187) - << "incorrect value for biases[13].code, expected 187, is " - << last_msg_->biases[13].code; - EXPECT_EQ( - get_asbiases[13].value)>( - reinterpret_cast(&last_msg_->biases[13].value)), - -16542) - << "incorrect value for biases[13].value, expected -16542, is " - << last_msg_->biases[13].value; - EXPECT_EQ(get_asbiases[14].code)>( - reinterpret_cast(&last_msg_->biases[14].code)), - 23) - << "incorrect value for biases[14].code, expected 23, is " - << last_msg_->biases[14].code; - EXPECT_EQ( - get_asbiases[14].value)>( - reinterpret_cast(&last_msg_->biases[14].value)), - -30592) - << "incorrect value for biases[14].value, expected -30592, is " - << last_msg_->biases[14].value; - EXPECT_EQ(get_asbiases[15].code)>( - reinterpret_cast(&last_msg_->biases[15].code)), - 167) - << "incorrect value for biases[15].code, expected 167, is " - << last_msg_->biases[15].code; - EXPECT_EQ( - get_asbiases[15].value)>( - reinterpret_cast(&last_msg_->biases[15].value)), - 1736) - << "incorrect value for biases[15].value, expected 1736, is " - << last_msg_->biases[15].value; - EXPECT_EQ(get_asbiases[16].code)>( - reinterpret_cast(&last_msg_->biases[16].code)), - 211) - << "incorrect value for biases[16].code, expected 211, is " - << last_msg_->biases[16].code; - EXPECT_EQ( - get_asbiases[16].value)>( - reinterpret_cast(&last_msg_->biases[16].value)), - 5978) - << "incorrect value for biases[16].value, expected 5978, is " - << last_msg_->biases[16].value; - EXPECT_EQ(get_asbiases[17].code)>( - reinterpret_cast(&last_msg_->biases[17].code)), - 244) - << "incorrect value for biases[17].code, expected 244, is " - << last_msg_->biases[17].code; - EXPECT_EQ( - get_asbiases[17].value)>( - reinterpret_cast(&last_msg_->biases[17].value)), - -10358) - << "incorrect value for biases[17].value, expected -10358, is " - << last_msg_->biases[17].value; - EXPECT_EQ(get_asbiases[18].code)>( - reinterpret_cast(&last_msg_->biases[18].code)), - 209) - << "incorrect value for biases[18].code, expected 209, is " - << last_msg_->biases[18].code; - EXPECT_EQ( - get_asbiases[18].value)>( - reinterpret_cast(&last_msg_->biases[18].value)), - 3467) - << "incorrect value for biases[18].value, expected 3467, is " - << last_msg_->biases[18].value; - EXPECT_EQ(get_asbiases[19].code)>( - reinterpret_cast(&last_msg_->biases[19].code)), - 101) - << "incorrect value for biases[19].code, expected 101, is " - << last_msg_->biases[19].code; - EXPECT_EQ( - get_asbiases[19].value)>( - reinterpret_cast(&last_msg_->biases[19].value)), - 1824) - << "incorrect value for biases[19].value, expected 1824, is " - << last_msg_->biases[19].value; - EXPECT_EQ(get_asbiases[20].code)>( - reinterpret_cast(&last_msg_->biases[20].code)), - 18) - << "incorrect value for biases[20].code, expected 18, is " - << last_msg_->biases[20].code; - EXPECT_EQ( - get_asbiases[20].value)>( - reinterpret_cast(&last_msg_->biases[20].value)), - 17949) - << "incorrect value for biases[20].value, expected 17949, is " - << last_msg_->biases[20].value; - EXPECT_EQ(get_asbiases[21].code)>( - reinterpret_cast(&last_msg_->biases[21].code)), - 250) - << "incorrect value for biases[21].code, expected 250, is " - << last_msg_->biases[21].code; - EXPECT_EQ( - get_asbiases[21].value)>( - reinterpret_cast(&last_msg_->biases[21].value)), - 18797) - << "incorrect value for biases[21].value, expected 18797, is " - << last_msg_->biases[21].value; - EXPECT_EQ(get_asbiases[22].code)>( - reinterpret_cast(&last_msg_->biases[22].code)), - 202) - << "incorrect value for biases[22].code, expected 202, is " - << last_msg_->biases[22].code; - EXPECT_EQ( - get_asbiases[22].value)>( - reinterpret_cast(&last_msg_->biases[22].value)), - -28593) - << "incorrect value for biases[22].value, expected -28593, is " - << last_msg_->biases[22].value; - EXPECT_EQ(get_asbiases[23].code)>( - reinterpret_cast(&last_msg_->biases[23].code)), - 9) - << "incorrect value for biases[23].code, expected 9, is " - << last_msg_->biases[23].code; - EXPECT_EQ( - get_asbiases[23].value)>( - reinterpret_cast(&last_msg_->biases[23].value)), - 17810) - << "incorrect value for biases[23].value, expected 17810, is " - << last_msg_->biases[23].value; - EXPECT_EQ(get_asbiases[24].code)>( - reinterpret_cast(&last_msg_->biases[24].code)), - 241) - << "incorrect value for biases[24].code, expected 241, is " - << last_msg_->biases[24].code; - EXPECT_EQ( - get_asbiases[24].value)>( - reinterpret_cast(&last_msg_->biases[24].value)), - 5684) - << "incorrect value for biases[24].value, expected 5684, is " - << last_msg_->biases[24].value; - EXPECT_EQ(get_asbiases[25].code)>( - reinterpret_cast(&last_msg_->biases[25].code)), - 99) - << "incorrect value for biases[25].code, expected 99, is " - << last_msg_->biases[25].code; - EXPECT_EQ( - get_asbiases[25].value)>( - reinterpret_cast(&last_msg_->biases[25].value)), - -13214) - << "incorrect value for biases[25].value, expected -13214, is " - << last_msg_->biases[25].value; - EXPECT_EQ(get_asbiases[26].code)>( - reinterpret_cast(&last_msg_->biases[26].code)), - 3) - << "incorrect value for biases[26].code, expected 3, is " - << last_msg_->biases[26].code; - EXPECT_EQ( - get_asbiases[26].value)>( - reinterpret_cast(&last_msg_->biases[26].value)), - -6485) - << "incorrect value for biases[26].value, expected -6485, is " - << last_msg_->biases[26].value; - EXPECT_EQ(get_asbiases[27].code)>( - reinterpret_cast(&last_msg_->biases[27].code)), - 180) - << "incorrect value for biases[27].code, expected 180, is " - << last_msg_->biases[27].code; - EXPECT_EQ( - get_asbiases[27].value)>( - reinterpret_cast(&last_msg_->biases[27].value)), - 15947) - << "incorrect value for biases[27].value, expected 15947, is " - << last_msg_->biases[27].value; - EXPECT_EQ(get_asbiases[28].code)>( - reinterpret_cast(&last_msg_->biases[28].code)), - 145) - << "incorrect value for biases[28].code, expected 145, is " - << last_msg_->biases[28].code; - EXPECT_EQ( - get_asbiases[28].value)>( - reinterpret_cast(&last_msg_->biases[28].value)), - -32170) - << "incorrect value for biases[28].value, expected -32170, is " - << last_msg_->biases[28].value; - EXPECT_EQ(get_asbiases[29].code)>( - reinterpret_cast(&last_msg_->biases[29].code)), - 31) - << "incorrect value for biases[29].code, expected 31, is " - << last_msg_->biases[29].code; - EXPECT_EQ( - get_asbiases[29].value)>( - reinterpret_cast(&last_msg_->biases[29].value)), - -25826) - << "incorrect value for biases[29].value, expected -25826, is " - << last_msg_->biases[29].value; - EXPECT_EQ(get_asbiases[30].code)>( - reinterpret_cast(&last_msg_->biases[30].code)), - 37) - << "incorrect value for biases[30].code, expected 37, is " - << last_msg_->biases[30].code; - EXPECT_EQ( - get_asbiases[30].value)>( - reinterpret_cast(&last_msg_->biases[30].value)), - 14098) - << "incorrect value for biases[30].value, expected 14098, is " - << last_msg_->biases[30].value; - EXPECT_EQ(get_asbiases[31].code)>( - reinterpret_cast(&last_msg_->biases[31].code)), - 210) - << "incorrect value for biases[31].code, expected 210, is " - << last_msg_->biases[31].code; - EXPECT_EQ( - get_asbiases[31].value)>( - reinterpret_cast(&last_msg_->biases[31].value)), - 32551) - << "incorrect value for biases[31].value, expected 32551, is " - << last_msg_->biases[31].value; - EXPECT_EQ(get_asbiases[32].code)>( - reinterpret_cast(&last_msg_->biases[32].code)), - 242) - << "incorrect value for biases[32].code, expected 242, is " - << last_msg_->biases[32].code; - EXPECT_EQ( - get_asbiases[32].value)>( - reinterpret_cast(&last_msg_->biases[32].value)), - 3394) - << "incorrect value for biases[32].value, expected 3394, is " - << last_msg_->biases[32].value; - EXPECT_EQ(get_asbiases[33].code)>( - reinterpret_cast(&last_msg_->biases[33].code)), - 237) - << "incorrect value for biases[33].code, expected 237, is " - << last_msg_->biases[33].code; - EXPECT_EQ( - get_asbiases[33].value)>( - reinterpret_cast(&last_msg_->biases[33].value)), - -21864) - << "incorrect value for biases[33].value, expected -21864, is " - << last_msg_->biases[33].value; - EXPECT_EQ(get_asbiases[34].code)>( - reinterpret_cast(&last_msg_->biases[34].code)), - 212) - << "incorrect value for biases[34].code, expected 212, is " - << last_msg_->biases[34].code; - EXPECT_EQ( - get_asbiases[34].value)>( - reinterpret_cast(&last_msg_->biases[34].value)), - -2545) - << "incorrect value for biases[34].value, expected -2545, is " - << last_msg_->biases[34].value; - EXPECT_EQ(get_asbiases[35].code)>( - reinterpret_cast(&last_msg_->biases[35].code)), - 59) - << "incorrect value for biases[35].code, expected 59, is " - << last_msg_->biases[35].code; - EXPECT_EQ( - get_asbiases[35].value)>( - reinterpret_cast(&last_msg_->biases[35].value)), - -19362) - << "incorrect value for biases[35].value, expected -19362, is " - << last_msg_->biases[35].value; - EXPECT_EQ(get_asbiases[36].code)>( - reinterpret_cast(&last_msg_->biases[36].code)), - 195) - << "incorrect value for biases[36].code, expected 195, is " - << last_msg_->biases[36].code; - EXPECT_EQ( - get_asbiases[36].value)>( - reinterpret_cast(&last_msg_->biases[36].value)), - 17821) - << "incorrect value for biases[36].value, expected 17821, is " - << last_msg_->biases[36].value; - EXPECT_EQ(get_asbiases[37].code)>( - reinterpret_cast(&last_msg_->biases[37].code)), - 100) - << "incorrect value for biases[37].code, expected 100, is " - << last_msg_->biases[37].code; - EXPECT_EQ( - get_asbiases[37].value)>( - reinterpret_cast(&last_msg_->biases[37].value)), - 4215) - << "incorrect value for biases[37].value, expected 4215, is " - << last_msg_->biases[37].value; - EXPECT_EQ(get_asbiases[38].code)>( - reinterpret_cast(&last_msg_->biases[38].code)), - 68) - << "incorrect value for biases[38].code, expected 68, is " - << last_msg_->biases[38].code; - EXPECT_EQ( - get_asbiases[38].value)>( - reinterpret_cast(&last_msg_->biases[38].value)), - -20557) - << "incorrect value for biases[38].value, expected -20557, is " - << last_msg_->biases[38].value; - EXPECT_EQ(get_asbiases[39].code)>( - reinterpret_cast(&last_msg_->biases[39].code)), - 144) - << "incorrect value for biases[39].code, expected 144, is " - << last_msg_->biases[39].code; - EXPECT_EQ( - get_asbiases[39].value)>( - reinterpret_cast(&last_msg_->biases[39].value)), - 20849) - << "incorrect value for biases[39].value, expected 20849, is " - << last_msg_->biases[39].value; - EXPECT_EQ(get_asbiases[40].code)>( - reinterpret_cast(&last_msg_->biases[40].code)), - 82) - << "incorrect value for biases[40].code, expected 82, is " - << last_msg_->biases[40].code; - EXPECT_EQ( - get_asbiases[40].value)>( - reinterpret_cast(&last_msg_->biases[40].value)), - -26850) - << "incorrect value for biases[40].value, expected -26850, is " - << last_msg_->biases[40].value; - EXPECT_EQ(get_asbiases[41].code)>( - reinterpret_cast(&last_msg_->biases[41].code)), - 21) - << "incorrect value for biases[41].code, expected 21, is " - << last_msg_->biases[41].code; - EXPECT_EQ( - get_asbiases[41].value)>( - reinterpret_cast(&last_msg_->biases[41].value)), - 10605) - << "incorrect value for biases[41].value, expected 10605, is " - << last_msg_->biases[41].value; - EXPECT_EQ(get_asbiases[42].code)>( - reinterpret_cast(&last_msg_->biases[42].code)), - 225) - << "incorrect value for biases[42].code, expected 225, is " - << last_msg_->biases[42].code; - EXPECT_EQ( - get_asbiases[42].value)>( - reinterpret_cast(&last_msg_->biases[42].value)), - 19720) - << "incorrect value for biases[42].value, expected 19720, is " - << last_msg_->biases[42].value; - EXPECT_EQ(get_asbiases[43].code)>( - reinterpret_cast(&last_msg_->biases[43].code)), - 164) - << "incorrect value for biases[43].code, expected 164, is " - << last_msg_->biases[43].code; - EXPECT_EQ( - get_asbiases[43].value)>( - reinterpret_cast(&last_msg_->biases[43].value)), - 157) - << "incorrect value for biases[43].value, expected 157, is " - << last_msg_->biases[43].value; - EXPECT_EQ(get_asbiases[44].code)>( - reinterpret_cast(&last_msg_->biases[44].code)), - 73) - << "incorrect value for biases[44].code, expected 73, is " - << last_msg_->biases[44].code; - EXPECT_EQ( - get_asbiases[44].value)>( - reinterpret_cast(&last_msg_->biases[44].value)), - 1566) - << "incorrect value for biases[44].value, expected 1566, is " - << last_msg_->biases[44].value; - EXPECT_EQ(get_asbiases[45].code)>( - reinterpret_cast(&last_msg_->biases[45].code)), - 78) - << "incorrect value for biases[45].code, expected 78, is " - << last_msg_->biases[45].code; - EXPECT_EQ( - get_asbiases[45].value)>( - reinterpret_cast(&last_msg_->biases[45].value)), - -28847) - << "incorrect value for biases[45].value, expected -28847, is " - << last_msg_->biases[45].value; - EXPECT_EQ(get_asbiases[46].code)>( - reinterpret_cast(&last_msg_->biases[46].code)), - 116) - << "incorrect value for biases[46].code, expected 116, is " - << last_msg_->biases[46].code; - EXPECT_EQ( - get_asbiases[46].value)>( - reinterpret_cast(&last_msg_->biases[46].value)), - -26640) - << "incorrect value for biases[46].value, expected -26640, is " - << last_msg_->biases[46].value; - EXPECT_EQ(get_asbiases[47].code)>( - reinterpret_cast(&last_msg_->biases[47].code)), - 55) - << "incorrect value for biases[47].code, expected 55, is " - << last_msg_->biases[47].code; - EXPECT_EQ( - get_asbiases[47].value)>( - reinterpret_cast(&last_msg_->biases[47].value)), - -22087) - << "incorrect value for biases[47].value, expected -22087, is " - << last_msg_->biases[47].value; - EXPECT_EQ(get_asbiases[48].code)>( - reinterpret_cast(&last_msg_->biases[48].code)), - 254) - << "incorrect value for biases[48].code, expected 254, is " - << last_msg_->biases[48].code; - EXPECT_EQ( - get_asbiases[48].value)>( - reinterpret_cast(&last_msg_->biases[48].value)), - 10035) - << "incorrect value for biases[48].value, expected 10035, is " - << last_msg_->biases[48].value; - EXPECT_EQ(get_asbiases[49].code)>( - reinterpret_cast(&last_msg_->biases[49].code)), - 74) - << "incorrect value for biases[49].code, expected 74, is " - << last_msg_->biases[49].code; - EXPECT_EQ( - get_asbiases[49].value)>( - reinterpret_cast(&last_msg_->biases[49].value)), - -2129) - << "incorrect value for biases[49].value, expected -2129, is " - << last_msg_->biases[49].value; - EXPECT_EQ(get_asbiases[50].code)>( - reinterpret_cast(&last_msg_->biases[50].code)), - 34) - << "incorrect value for biases[50].code, expected 34, is " - << last_msg_->biases[50].code; - EXPECT_EQ( - get_asbiases[50].value)>( - reinterpret_cast(&last_msg_->biases[50].value)), - 19041) - << "incorrect value for biases[50].value, expected 19041, is " - << last_msg_->biases[50].value; - EXPECT_EQ(get_asbiases[51].code)>( - reinterpret_cast(&last_msg_->biases[51].code)), - 97) - << "incorrect value for biases[51].code, expected 97, is " - << last_msg_->biases[51].code; - EXPECT_EQ( - get_asbiases[51].value)>( - reinterpret_cast(&last_msg_->biases[51].value)), - 12464) - << "incorrect value for biases[51].value, expected 12464, is " - << last_msg_->biases[51].value; - EXPECT_EQ(get_asbiases[52].code)>( - reinterpret_cast(&last_msg_->biases[52].code)), - 236) - << "incorrect value for biases[52].code, expected 236, is " - << last_msg_->biases[52].code; - EXPECT_EQ( - get_asbiases[52].value)>( - reinterpret_cast(&last_msg_->biases[52].value)), - 3245) - << "incorrect value for biases[52].value, expected 3245, is " - << last_msg_->biases[52].value; - EXPECT_EQ(get_asbiases[53].code)>( - reinterpret_cast(&last_msg_->biases[53].code)), - 174) - << "incorrect value for biases[53].code, expected 174, is " - << last_msg_->biases[53].code; - EXPECT_EQ( - get_asbiases[53].value)>( - reinterpret_cast(&last_msg_->biases[53].value)), - -32155) - << "incorrect value for biases[53].value, expected -32155, is " - << last_msg_->biases[53].value; - EXPECT_EQ(get_asbiases[54].code)>( - reinterpret_cast(&last_msg_->biases[54].code)), - 30) - << "incorrect value for biases[54].code, expected 30, is " - << last_msg_->biases[54].code; - EXPECT_EQ( - get_asbiases[54].value)>( - reinterpret_cast(&last_msg_->biases[54].value)), - -15959) - << "incorrect value for biases[54].value, expected -15959, is " - << last_msg_->biases[54].value; - EXPECT_EQ(get_asbiases[55].code)>( - reinterpret_cast(&last_msg_->biases[55].code)), - 190) - << "incorrect value for biases[55].code, expected 190, is " - << last_msg_->biases[55].code; - EXPECT_EQ( - get_asbiases[55].value)>( - reinterpret_cast(&last_msg_->biases[55].value)), - -15156) - << "incorrect value for biases[55].value, expected -15156, is " - << last_msg_->biases[55].value; - EXPECT_EQ(get_asbiases[56].code)>( - reinterpret_cast(&last_msg_->biases[56].code)), - 123) - << "incorrect value for biases[56].code, expected 123, is " - << last_msg_->biases[56].code; - EXPECT_EQ( - get_asbiases[56].value)>( - reinterpret_cast(&last_msg_->biases[56].value)), - 6507) - << "incorrect value for biases[56].value, expected 6507, is " - << last_msg_->biases[56].value; - EXPECT_EQ(get_asbiases[57].code)>( - reinterpret_cast(&last_msg_->biases[57].code)), - 225) - << "incorrect value for biases[57].code, expected 225, is " - << last_msg_->biases[57].code; - EXPECT_EQ( - get_asbiases[57].value)>( - reinterpret_cast(&last_msg_->biases[57].value)), - 2378) - << "incorrect value for biases[57].value, expected 2378, is " - << last_msg_->biases[57].value; - EXPECT_EQ(get_asbiases[58].code)>( - reinterpret_cast(&last_msg_->biases[58].code)), - 10) - << "incorrect value for biases[58].code, expected 10, is " - << last_msg_->biases[58].code; - EXPECT_EQ( - get_asbiases[58].value)>( - reinterpret_cast(&last_msg_->biases[58].value)), - 823) - << "incorrect value for biases[58].value, expected 823, is " - << last_msg_->biases[58].value; - EXPECT_EQ(get_asbiases[59].code)>( - reinterpret_cast(&last_msg_->biases[59].code)), - 131) - << "incorrect value for biases[59].code, expected 131, is " - << last_msg_->biases[59].code; - EXPECT_EQ( - get_asbiases[59].value)>( - reinterpret_cast(&last_msg_->biases[59].value)), - 25590) - << "incorrect value for biases[59].value, expected 25590, is " - << last_msg_->biases[59].value; - EXPECT_EQ(get_asbiases[60].code)>( - reinterpret_cast(&last_msg_->biases[60].code)), - 133) - << "incorrect value for biases[60].code, expected 133, is " - << last_msg_->biases[60].code; - EXPECT_EQ( - get_asbiases[60].value)>( - reinterpret_cast(&last_msg_->biases[60].value)), - -7390) - << "incorrect value for biases[60].value, expected -7390, is " - << last_msg_->biases[60].value; - EXPECT_EQ(get_asbiases[61].code)>( - reinterpret_cast(&last_msg_->biases[61].code)), - 203) - << "incorrect value for biases[61].code, expected 203, is " - << last_msg_->biases[61].code; - EXPECT_EQ( - get_asbiases[61].value)>( - reinterpret_cast(&last_msg_->biases[61].value)), - 4676) - << "incorrect value for biases[61].value, expected 4676, is " - << last_msg_->biases[61].value; - EXPECT_EQ(get_asbiases[62].code)>( - reinterpret_cast(&last_msg_->biases[62].code)), - 97) - << "incorrect value for biases[62].code, expected 97, is " - << last_msg_->biases[62].code; - EXPECT_EQ( - get_asbiases[62].value)>( - reinterpret_cast(&last_msg_->biases[62].value)), - 23007) - << "incorrect value for biases[62].value, expected 23007, is " - << last_msg_->biases[62].value; - EXPECT_EQ(get_asbiases[63].code)>( - reinterpret_cast(&last_msg_->biases[63].code)), - 192) - << "incorrect value for biases[63].code, expected 192, is " - << last_msg_->biases[63].code; - EXPECT_EQ( - get_asbiases[63].value)>( - reinterpret_cast(&last_msg_->biases[63].value)), - 13046) - << "incorrect value for biases[63].value, expected 13046, is " - << last_msg_->biases[63].value; - EXPECT_EQ(get_asbiases[64].code)>( - reinterpret_cast(&last_msg_->biases[64].code)), - 69) - << "incorrect value for biases[64].code, expected 69, is " - << last_msg_->biases[64].code; - EXPECT_EQ( - get_asbiases[64].value)>( - reinterpret_cast(&last_msg_->biases[64].value)), - 2651) - << "incorrect value for biases[64].value, expected 2651, is " - << last_msg_->biases[64].value; - EXPECT_EQ(get_asbiases[65].code)>( - reinterpret_cast(&last_msg_->biases[65].code)), - 151) - << "incorrect value for biases[65].code, expected 151, is " - << last_msg_->biases[65].code; - EXPECT_EQ( - get_asbiases[65].value)>( - reinterpret_cast(&last_msg_->biases[65].value)), - 30282) - << "incorrect value for biases[65].value, expected 30282, is " - << last_msg_->biases[65].value; - EXPECT_EQ(get_asbiases[66].code)>( - reinterpret_cast(&last_msg_->biases[66].code)), - 110) - << "incorrect value for biases[66].code, expected 110, is " - << last_msg_->biases[66].code; - EXPECT_EQ( - get_asbiases[66].value)>( - reinterpret_cast(&last_msg_->biases[66].value)), - -22492) - << "incorrect value for biases[66].value, expected -22492, is " - << last_msg_->biases[66].value; - EXPECT_EQ(get_asbiases[67].code)>( - reinterpret_cast(&last_msg_->biases[67].code)), - 247) - << "incorrect value for biases[67].code, expected 247, is " - << last_msg_->biases[67].code; - EXPECT_EQ( - get_asbiases[67].value)>( - reinterpret_cast(&last_msg_->biases[67].value)), - 19872) - << "incorrect value for biases[67].value, expected 19872, is " - << last_msg_->biases[67].value; - EXPECT_EQ(get_asbiases[68].code)>( - reinterpret_cast(&last_msg_->biases[68].code)), - 179) - << "incorrect value for biases[68].code, expected 179, is " - << last_msg_->biases[68].code; - EXPECT_EQ( - get_asbiases[68].value)>( - reinterpret_cast(&last_msg_->biases[68].value)), - -19827) - << "incorrect value for biases[68].value, expected -19827, is " - << last_msg_->biases[68].value; - EXPECT_EQ(get_asbiases[69].code)>( - reinterpret_cast(&last_msg_->biases[69].code)), - 99) - << "incorrect value for biases[69].code, expected 99, is " - << last_msg_->biases[69].code; - EXPECT_EQ( - get_asbiases[69].value)>( - reinterpret_cast(&last_msg_->biases[69].value)), - 30911) - << "incorrect value for biases[69].value, expected 30911, is " - << last_msg_->biases[69].value; - EXPECT_EQ(get_asbiases[70].code)>( - reinterpret_cast(&last_msg_->biases[70].code)), - 77) - << "incorrect value for biases[70].code, expected 77, is " - << last_msg_->biases[70].code; - EXPECT_EQ( - get_asbiases[70].value)>( - reinterpret_cast(&last_msg_->biases[70].value)), - 23488) - << "incorrect value for biases[70].value, expected 23488, is " - << last_msg_->biases[70].value; - EXPECT_EQ(get_asbiases[71].code)>( - reinterpret_cast(&last_msg_->biases[71].code)), - 224) - << "incorrect value for biases[71].code, expected 224, is " - << last_msg_->biases[71].code; - EXPECT_EQ( - get_asbiases[71].value)>( - reinterpret_cast(&last_msg_->biases[71].value)), - -7679) - << "incorrect value for biases[71].value, expected -7679, is " - << last_msg_->biases[71].value; - EXPECT_EQ(get_asbiases[72].code)>( - reinterpret_cast(&last_msg_->biases[72].code)), - 50) - << "incorrect value for biases[72].code, expected 50, is " - << last_msg_->biases[72].code; - EXPECT_EQ( - get_asbiases[72].value)>( - reinterpret_cast(&last_msg_->biases[72].value)), - -28073) - << "incorrect value for biases[72].value, expected -28073, is " - << last_msg_->biases[72].value; - EXPECT_EQ(get_asbiases[73].code)>( - reinterpret_cast(&last_msg_->biases[73].code)), - 148) - << "incorrect value for biases[73].code, expected 148, is " - << last_msg_->biases[73].code; - EXPECT_EQ( - get_asbiases[73].value)>( - reinterpret_cast(&last_msg_->biases[73].value)), - 25838) - << "incorrect value for biases[73].value, expected 25838, is " - << last_msg_->biases[73].value; - EXPECT_EQ(get_asbiases[74].code)>( - reinterpret_cast(&last_msg_->biases[74].code)), - 179) - << "incorrect value for biases[74].code, expected 179, is " - << last_msg_->biases[74].code; - EXPECT_EQ( - get_asbiases[74].value)>( - reinterpret_cast(&last_msg_->biases[74].value)), - -7299) - << "incorrect value for biases[74].value, expected -7299, is " - << last_msg_->biases[74].value; - EXPECT_EQ(get_asbiases[75].code)>( - reinterpret_cast(&last_msg_->biases[75].code)), - 215) - << "incorrect value for biases[75].code, expected 215, is " - << last_msg_->biases[75].code; - EXPECT_EQ( - get_asbiases[75].value)>( - reinterpret_cast(&last_msg_->biases[75].value)), - -18328) - << "incorrect value for biases[75].value, expected -18328, is " - << last_msg_->biases[75].value; - EXPECT_EQ(get_asbiases[76].code)>( - reinterpret_cast(&last_msg_->biases[76].code)), - 31) - << "incorrect value for biases[76].code, expected 31, is " - << last_msg_->biases[76].code; - EXPECT_EQ( - get_asbiases[76].value)>( - reinterpret_cast(&last_msg_->biases[76].value)), - 23097) - << "incorrect value for biases[76].value, expected 23097, is " - << last_msg_->biases[76].value; - EXPECT_EQ(get_asbiases[77].code)>( - reinterpret_cast(&last_msg_->biases[77].code)), - 79) - << "incorrect value for biases[77].code, expected 79, is " - << last_msg_->biases[77].code; - EXPECT_EQ( - get_asbiases[77].value)>( - reinterpret_cast(&last_msg_->biases[77].value)), - -25579) - << "incorrect value for biases[77].value, expected -25579, is " - << last_msg_->biases[77].value; - EXPECT_EQ(get_asbiases[78].code)>( - reinterpret_cast(&last_msg_->biases[78].code)), - 245) - << "incorrect value for biases[78].code, expected 245, is " - << last_msg_->biases[78].code; - EXPECT_EQ( - get_asbiases[78].value)>( - reinterpret_cast(&last_msg_->biases[78].value)), - 15441) - << "incorrect value for biases[78].value, expected 15441, is " - << last_msg_->biases[78].value; - EXPECT_EQ(get_asbiases[79].code)>( - reinterpret_cast(&last_msg_->biases[79].code)), - 93) - << "incorrect value for biases[79].code, expected 93, is " - << last_msg_->biases[79].code; - EXPECT_EQ( - get_asbiases[79].value)>( - reinterpret_cast(&last_msg_->biases[79].value)), - 15530) - << "incorrect value for biases[79].value, expected 15530, is " - << last_msg_->biases[79].value; - EXPECT_EQ(get_asbiases[80].code)>( - reinterpret_cast(&last_msg_->biases[80].code)), - 200) - << "incorrect value for biases[80].code, expected 200, is " - << last_msg_->biases[80].code; - EXPECT_EQ( - get_asbiases[80].value)>( - reinterpret_cast(&last_msg_->biases[80].value)), - 3495) - << "incorrect value for biases[80].value, expected 3495, is " - << last_msg_->biases[80].value; - EXPECT_EQ(get_asiod_ssr)>( - reinterpret_cast(&last_msg_->iod_ssr)), - 132) - << "incorrect value for iod_ssr, expected 132, is " << last_msg_->iod_ssr; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 241) - << "incorrect value for sid.code, expected 241, is " - << last_msg_->sid.code; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 133) - << "incorrect value for sid.sat, expected 133, is " << last_msg_->sid.sat; - EXPECT_EQ(get_astime.tow)>( - reinterpret_cast(&last_msg_->time.tow)), - 387144400) - << "incorrect value for time.tow, expected 387144400, is " - << last_msg_->time.tow; - EXPECT_EQ(get_astime.wn)>( - reinterpret_cast(&last_msg_->time.wn)), - 16905) - << "incorrect value for time.wn, expected 16905, is " - << last_msg_->time.wn; - EXPECT_EQ(get_asupdate_interval)>( - reinterpret_cast(&last_msg_->update_interval)), - 254) - << "incorrect value for update_interval, expected 254, is " - << last_msg_->update_interval; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds.cc deleted file mode 100644 index fbec8c2fe0..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds.cc +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrCodePhaseBiasesBounds.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_code_phase_biases_bounds_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_code_phase_biases_bounds_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrCodePhaseBiasesBounds0, Test) { - uint8_t encoded_frame[] = { - 85, 236, 5, 66, 0, 31, 180, 0, 0, 0, 3, 0, 1, 2, 1, 14, 15, 1, 3, 0, - 3, 39, 1, 39, 1, 1, 3, 39, 1, 39, 1, 1, 1, 39, 1, 39, 1, 23, 113, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_code_phase_biases_bounds_t *test_msg = - (msg_ssr_code_phase_biases_bounds_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->const_id = 1; - test_msg->header.num_msgs = 1; - test_msg->header.seq_num = 2; - test_msg->header.sol_id = 14; - test_msg->header.time.tow = 180; - test_msg->header.time.wn = 3; - test_msg->header.update_interval = 1; - test_msg->n_sats_signals = 3; - if (sizeof(test_msg->satellites_signals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->satellites_signals[0])); - } - test_msg->satellites_signals[0].code_bias_bound_mu = 39; - test_msg->satellites_signals[0].code_bias_bound_sig = 1; - test_msg->satellites_signals[0].phase_bias_bound_mu = 39; - test_msg->satellites_signals[0].phase_bias_bound_sig = 1; - test_msg->satellites_signals[0].sat_id = 0; - test_msg->satellites_signals[0].signal_id = 3; - if (sizeof(test_msg->satellites_signals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->satellites_signals[0])); - } - test_msg->satellites_signals[1].code_bias_bound_mu = 39; - test_msg->satellites_signals[1].code_bias_bound_sig = 1; - test_msg->satellites_signals[1].phase_bias_bound_mu = 39; - test_msg->satellites_signals[1].phase_bias_bound_sig = 1; - test_msg->satellites_signals[1].sat_id = 1; - test_msg->satellites_signals[1].signal_id = 3; - if (sizeof(test_msg->satellites_signals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->satellites_signals[0])); - } - test_msg->satellites_signals[2].code_bias_bound_mu = 39; - test_msg->satellites_signals[2].code_bias_bound_sig = 1; - test_msg->satellites_signals[2].phase_bias_bound_mu = 39; - test_msg->satellites_signals[2].phase_bias_bound_sig = 1; - test_msg->satellites_signals[2].sat_id = 1; - test_msg->satellites_signals[2].signal_id = 1; - test_msg->ssr_iod = 15; - - EXPECT_EQ(send_message(1516, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asconst_id)>( - reinterpret_cast(&last_msg_->const_id)), - 1) - << "incorrect value for const_id, expected 1, is " << last_msg_->const_id; - EXPECT_EQ(get_asheader.num_msgs)>( - reinterpret_cast(&last_msg_->header.num_msgs)), - 1) - << "incorrect value for header.num_msgs, expected 1, is " - << last_msg_->header.num_msgs; - EXPECT_EQ(get_asheader.seq_num)>( - reinterpret_cast(&last_msg_->header.seq_num)), - 2) - << "incorrect value for header.seq_num, expected 2, is " - << last_msg_->header.seq_num; - EXPECT_EQ(get_asheader.sol_id)>( - reinterpret_cast(&last_msg_->header.sol_id)), - 14) - << "incorrect value for header.sol_id, expected 14, is " - << last_msg_->header.sol_id; - EXPECT_EQ(get_asheader.time.tow)>( - reinterpret_cast(&last_msg_->header.time.tow)), - 180) - << "incorrect value for header.time.tow, expected 180, is " - << last_msg_->header.time.tow; - EXPECT_EQ(get_asheader.time.wn)>( - reinterpret_cast(&last_msg_->header.time.wn)), - 3) - << "incorrect value for header.time.wn, expected 3, is " - << last_msg_->header.time.wn; - EXPECT_EQ(get_asheader.update_interval)>( - reinterpret_cast( - &last_msg_->header.update_interval)), - 1) - << "incorrect value for header.update_interval, expected 1, is " - << last_msg_->header.update_interval; - EXPECT_EQ(get_asn_sats_signals)>( - reinterpret_cast(&last_msg_->n_sats_signals)), - 3) - << "incorrect value for n_sats_signals, expected 3, is " - << last_msg_->n_sats_signals; - EXPECT_EQ( - get_assatellites_signals[0].code_bias_bound_mu)>( - reinterpret_cast( - &last_msg_->satellites_signals[0].code_bias_bound_mu)), - 39) - << "incorrect value for satellites_signals[0].code_bias_bound_mu, " - "expected 39, is " - << last_msg_->satellites_signals[0].code_bias_bound_mu; - EXPECT_EQ( - get_assatellites_signals[0].code_bias_bound_sig)>( - reinterpret_cast( - &last_msg_->satellites_signals[0].code_bias_bound_sig)), - 1) - << "incorrect value for satellites_signals[0].code_bias_bound_sig, " - "expected 1, is " - << last_msg_->satellites_signals[0].code_bias_bound_sig; - EXPECT_EQ( - get_assatellites_signals[0].phase_bias_bound_mu)>( - reinterpret_cast( - &last_msg_->satellites_signals[0].phase_bias_bound_mu)), - 39) - << "incorrect value for satellites_signals[0].phase_bias_bound_mu, " - "expected 39, is " - << last_msg_->satellites_signals[0].phase_bias_bound_mu; - EXPECT_EQ( - get_assatellites_signals[0].phase_bias_bound_sig)>( - reinterpret_cast( - &last_msg_->satellites_signals[0].phase_bias_bound_sig)), - 1) - << "incorrect value for satellites_signals[0].phase_bias_bound_sig, " - "expected 1, is " - << last_msg_->satellites_signals[0].phase_bias_bound_sig; - EXPECT_EQ(get_assatellites_signals[0].sat_id)>( - reinterpret_cast( - &last_msg_->satellites_signals[0].sat_id)), - 0) - << "incorrect value for satellites_signals[0].sat_id, expected 0, is " - << last_msg_->satellites_signals[0].sat_id; - EXPECT_EQ(get_assatellites_signals[0].signal_id)>( - reinterpret_cast( - &last_msg_->satellites_signals[0].signal_id)), - 3) - << "incorrect value for satellites_signals[0].signal_id, expected 3, is " - << last_msg_->satellites_signals[0].signal_id; - EXPECT_EQ( - get_assatellites_signals[1].code_bias_bound_mu)>( - reinterpret_cast( - &last_msg_->satellites_signals[1].code_bias_bound_mu)), - 39) - << "incorrect value for satellites_signals[1].code_bias_bound_mu, " - "expected 39, is " - << last_msg_->satellites_signals[1].code_bias_bound_mu; - EXPECT_EQ( - get_assatellites_signals[1].code_bias_bound_sig)>( - reinterpret_cast( - &last_msg_->satellites_signals[1].code_bias_bound_sig)), - 1) - << "incorrect value for satellites_signals[1].code_bias_bound_sig, " - "expected 1, is " - << last_msg_->satellites_signals[1].code_bias_bound_sig; - EXPECT_EQ( - get_assatellites_signals[1].phase_bias_bound_mu)>( - reinterpret_cast( - &last_msg_->satellites_signals[1].phase_bias_bound_mu)), - 39) - << "incorrect value for satellites_signals[1].phase_bias_bound_mu, " - "expected 39, is " - << last_msg_->satellites_signals[1].phase_bias_bound_mu; - EXPECT_EQ( - get_assatellites_signals[1].phase_bias_bound_sig)>( - reinterpret_cast( - &last_msg_->satellites_signals[1].phase_bias_bound_sig)), - 1) - << "incorrect value for satellites_signals[1].phase_bias_bound_sig, " - "expected 1, is " - << last_msg_->satellites_signals[1].phase_bias_bound_sig; - EXPECT_EQ(get_assatellites_signals[1].sat_id)>( - reinterpret_cast( - &last_msg_->satellites_signals[1].sat_id)), - 1) - << "incorrect value for satellites_signals[1].sat_id, expected 1, is " - << last_msg_->satellites_signals[1].sat_id; - EXPECT_EQ(get_assatellites_signals[1].signal_id)>( - reinterpret_cast( - &last_msg_->satellites_signals[1].signal_id)), - 3) - << "incorrect value for satellites_signals[1].signal_id, expected 3, is " - << last_msg_->satellites_signals[1].signal_id; - EXPECT_EQ( - get_assatellites_signals[2].code_bias_bound_mu)>( - reinterpret_cast( - &last_msg_->satellites_signals[2].code_bias_bound_mu)), - 39) - << "incorrect value for satellites_signals[2].code_bias_bound_mu, " - "expected 39, is " - << last_msg_->satellites_signals[2].code_bias_bound_mu; - EXPECT_EQ( - get_assatellites_signals[2].code_bias_bound_sig)>( - reinterpret_cast( - &last_msg_->satellites_signals[2].code_bias_bound_sig)), - 1) - << "incorrect value for satellites_signals[2].code_bias_bound_sig, " - "expected 1, is " - << last_msg_->satellites_signals[2].code_bias_bound_sig; - EXPECT_EQ( - get_assatellites_signals[2].phase_bias_bound_mu)>( - reinterpret_cast( - &last_msg_->satellites_signals[2].phase_bias_bound_mu)), - 39) - << "incorrect value for satellites_signals[2].phase_bias_bound_mu, " - "expected 39, is " - << last_msg_->satellites_signals[2].phase_bias_bound_mu; - EXPECT_EQ( - get_assatellites_signals[2].phase_bias_bound_sig)>( - reinterpret_cast( - &last_msg_->satellites_signals[2].phase_bias_bound_sig)), - 1) - << "incorrect value for satellites_signals[2].phase_bias_bound_sig, " - "expected 1, is " - << last_msg_->satellites_signals[2].phase_bias_bound_sig; - EXPECT_EQ(get_assatellites_signals[2].sat_id)>( - reinterpret_cast( - &last_msg_->satellites_signals[2].sat_id)), - 1) - << "incorrect value for satellites_signals[2].sat_id, expected 1, is " - << last_msg_->satellites_signals[2].sat_id; - EXPECT_EQ(get_assatellites_signals[2].signal_id)>( - reinterpret_cast( - &last_msg_->satellites_signals[2].signal_id)), - 1) - << "incorrect value for satellites_signals[2].signal_id, expected 1, is " - << last_msg_->satellites_signals[2].signal_id; - EXPECT_EQ(get_asssr_iod)>( - reinterpret_cast(&last_msg_->ssr_iod)), - 15) - << "incorrect value for ssr_iod, expected 15, is " << last_msg_->ssr_iod; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrGridDefinitionDepA.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrGridDefinitionDepA.cc deleted file mode 100644 index 4b7cb1a906..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrGridDefinitionDepA.cc +++ /dev/null @@ -1,2638 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrGridDefinitionDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrGridDefinitionDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrGridDefinitionDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_grid_definition_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_grid_definition_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrGridDefinitionDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 245, 5, 181, 247, 255, 11, 84, 171, 229, 132, 143, 46, 204, 52, - 92, 104, 25, 204, 182, 22, 98, 203, 123, 211, 38, 13, 253, 129, 173, - 171, 235, 253, 26, 203, 3, 120, 126, 42, 44, 39, 87, 69, 154, 13, - 28, 179, 32, 47, 36, 195, 39, 198, 134, 235, 134, 57, 120, 243, 151, - 35, 17, 201, 211, 125, 117, 164, 142, 101, 239, 144, 158, 239, 90, 56, - 71, 120, 67, 221, 114, 10, 190, 4, 230, 164, 171, 78, 185, 90, 46, - 177, 82, 228, 123, 222, 227, 145, 195, 219, 27, 56, 227, 246, 215, 144, - 158, 31, 214, 241, 254, 200, 86, 142, 89, 12, 121, 29, 124, 9, 19, - 153, 44, 35, 126, 14, 217, 65, 116, 26, 139, 122, 114, 90, 124, 81, - 0, 186, 246, 46, 98, 179, 243, 198, 217, 36, 30, 202, 12, 135, 61, - 42, 150, 221, 102, 83, 179, 43, 252, 81, 62, 126, 204, 195, 238, 18, - 128, 193, 53, 94, 99, 63, 182, 2, 186, 220, 77, 186, 224, 220, 13, - 212, 182, 88, 15, 151, 5, 93, 251, 164, 18, 228, 168, 226, 195, 44, - 170, 145, 36, 58, 96, 107, 144, 11, 228, 12, 163, 238, 247, 159, 189, - 1, 115, 65, 202, 121, 47, 193, 11, 96, 93, 72, 81, 207, 121, 19, - 151, 136, 233, 51, 133, 195, 77, 44, 147, 206, 120, 252, 77, 212, 68, - 60, 206, 106, 207, 243, 158, 94, 6, 3, 205, 92, 84, 2, 220, 50, - 61, 38, 141, 117, 108, 101, 76, 139, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_grid_definition_dep_a_t *test_msg = - (msg_ssr_grid_definition_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.area_width = 43860; - test_msg->header.lat_nw_corner_enc = 34021; - test_msg->header.lon_nw_corner_enc = 11919; - test_msg->header.num_msgs = 204; - test_msg->header.region_size_inverse = 11; - test_msg->header.seq_num = 52; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[0] = 92; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[1] = 104; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[2] = 25; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[3] = 204; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[4] = 182; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[5] = 22; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[6] = 98; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[7] = 203; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[8] = 123; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[9] = 211; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[10] = 38; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[11] = 13; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[12] = 253; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[13] = 129; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[14] = 173; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[15] = 171; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[16] = 235; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[17] = 253; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[18] = 26; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[19] = 203; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[20] = 3; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[21] = 120; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[22] = 126; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[23] = 42; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[24] = 44; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[25] = 39; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[26] = 87; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[27] = 69; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[28] = 154; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[29] = 13; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[30] = 28; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[31] = 179; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[32] = 32; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[33] = 47; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[34] = 36; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[35] = 195; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[36] = 39; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[37] = 198; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[38] = 134; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[39] = 235; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[40] = 134; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[41] = 57; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[42] = 120; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[43] = 243; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[44] = 151; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[45] = 35; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[46] = 17; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[47] = 201; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[48] = 211; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[49] = 125; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[50] = 117; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[51] = 164; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[52] = 142; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[53] = 101; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[54] = 239; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[55] = 144; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[56] = 158; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[57] = 239; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[58] = 90; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[59] = 56; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[60] = 71; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[61] = 120; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[62] = 67; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[63] = 221; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[64] = 114; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[65] = 10; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[66] = 190; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[67] = 4; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[68] = 230; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[69] = 164; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[70] = 171; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[71] = 78; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[72] = 185; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[73] = 90; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[74] = 46; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[75] = 177; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[76] = 82; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[77] = 228; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[78] = 123; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[79] = 222; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[80] = 227; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[81] = 145; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[82] = 195; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[83] = 219; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[84] = 27; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[85] = 56; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[86] = 227; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[87] = 246; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[88] = 215; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[89] = 144; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[90] = 158; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[91] = 31; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[92] = 214; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[93] = 241; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[94] = 254; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[95] = 200; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[96] = 86; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[97] = 142; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[98] = 89; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[99] = 12; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[100] = 121; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[101] = 29; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[102] = 124; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[103] = 9; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[104] = 19; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[105] = 153; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[106] = 44; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[107] = 35; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[108] = 126; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[109] = 14; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[110] = 217; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[111] = 65; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[112] = 116; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[113] = 26; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[114] = 139; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[115] = 122; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[116] = 114; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[117] = 90; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[118] = 124; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[119] = 81; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[120] = 0; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[121] = 186; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[122] = 246; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[123] = 46; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[124] = 98; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[125] = 179; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[126] = 243; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[127] = 198; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[128] = 217; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[129] = 36; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[130] = 30; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[131] = 202; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[132] = 12; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[133] = 135; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[134] = 61; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[135] = 42; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[136] = 150; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[137] = 221; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[138] = 102; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[139] = 83; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[140] = 179; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[141] = 43; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[142] = 252; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[143] = 81; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[144] = 62; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[145] = 126; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[146] = 204; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[147] = 195; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[148] = 238; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[149] = 18; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[150] = 128; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[151] = 193; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[152] = 53; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[153] = 94; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[154] = 99; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[155] = 63; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[156] = 182; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[157] = 2; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[158] = 186; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[159] = 220; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[160] = 77; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[161] = 186; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[162] = 224; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[163] = 220; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[164] = 13; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[165] = 212; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[166] = 182; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[167] = 88; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[168] = 15; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[169] = 151; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[170] = 5; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[171] = 93; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[172] = 251; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[173] = 164; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[174] = 18; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[175] = 228; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[176] = 168; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[177] = 226; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[178] = 195; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[179] = 44; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[180] = 170; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[181] = 145; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[182] = 36; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[183] = 58; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[184] = 96; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[185] = 107; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[186] = 144; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[187] = 11; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[188] = 228; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[189] = 12; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[190] = 163; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[191] = 238; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[192] = 247; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[193] = 159; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[194] = 189; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[195] = 1; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[196] = 115; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[197] = 65; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[198] = 202; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[199] = 121; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[200] = 47; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[201] = 193; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[202] = 11; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[203] = 96; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[204] = 93; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[205] = 72; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[206] = 81; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[207] = 207; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[208] = 121; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[209] = 19; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[210] = 151; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[211] = 136; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[212] = 233; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[213] = 51; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[214] = 133; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[215] = 195; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[216] = 77; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[217] = 44; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[218] = 147; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[219] = 206; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[220] = 120; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[221] = 252; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[222] = 77; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[223] = 212; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[224] = 68; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[225] = 60; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[226] = 206; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[227] = 106; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[228] = 207; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[229] = 243; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[230] = 158; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[231] = 94; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[232] = 6; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[233] = 3; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[234] = 205; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[235] = 92; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[236] = 84; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[237] = 2; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[238] = 220; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[239] = 50; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[240] = 61; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[241] = 38; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[242] = 141; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[243] = 117; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[244] = 108; - if (sizeof(test_msg->rle_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->rle_list[0])); - } - test_msg->rle_list[245] = 101; - - EXPECT_EQ(send_message(0x5f5, 63413, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 63413); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ( - get_asheader.area_width)>( - reinterpret_cast(&last_msg_->header.area_width)), - 43860) - << "incorrect value for header.area_width, expected 43860, is " - << last_msg_->header.area_width; - EXPECT_EQ(get_asheader.lat_nw_corner_enc)>( - reinterpret_cast( - &last_msg_->header.lat_nw_corner_enc)), - 34021) - << "incorrect value for header.lat_nw_corner_enc, expected 34021, is " - << last_msg_->header.lat_nw_corner_enc; - EXPECT_EQ(get_asheader.lon_nw_corner_enc)>( - reinterpret_cast( - &last_msg_->header.lon_nw_corner_enc)), - 11919) - << "incorrect value for header.lon_nw_corner_enc, expected 11919, is " - << last_msg_->header.lon_nw_corner_enc; - EXPECT_EQ(get_asheader.num_msgs)>( - reinterpret_cast(&last_msg_->header.num_msgs)), - 204) - << "incorrect value for header.num_msgs, expected 204, is " - << last_msg_->header.num_msgs; - EXPECT_EQ(get_asheader.region_size_inverse)>( - reinterpret_cast( - &last_msg_->header.region_size_inverse)), - 11) - << "incorrect value for header.region_size_inverse, expected 11, is " - << last_msg_->header.region_size_inverse; - EXPECT_EQ(get_asheader.seq_num)>( - reinterpret_cast(&last_msg_->header.seq_num)), - 52) - << "incorrect value for header.seq_num, expected 52, is " - << last_msg_->header.seq_num; - EXPECT_EQ(get_asrle_list[0])>( - reinterpret_cast(&last_msg_->rle_list[0])), - 92) - << "incorrect value for rle_list[0], expected 92, is " - << last_msg_->rle_list[0]; - EXPECT_EQ(get_asrle_list[1])>( - reinterpret_cast(&last_msg_->rle_list[1])), - 104) - << "incorrect value for rle_list[1], expected 104, is " - << last_msg_->rle_list[1]; - EXPECT_EQ(get_asrle_list[2])>( - reinterpret_cast(&last_msg_->rle_list[2])), - 25) - << "incorrect value for rle_list[2], expected 25, is " - << last_msg_->rle_list[2]; - EXPECT_EQ(get_asrle_list[3])>( - reinterpret_cast(&last_msg_->rle_list[3])), - 204) - << "incorrect value for rle_list[3], expected 204, is " - << last_msg_->rle_list[3]; - EXPECT_EQ(get_asrle_list[4])>( - reinterpret_cast(&last_msg_->rle_list[4])), - 182) - << "incorrect value for rle_list[4], expected 182, is " - << last_msg_->rle_list[4]; - EXPECT_EQ(get_asrle_list[5])>( - reinterpret_cast(&last_msg_->rle_list[5])), - 22) - << "incorrect value for rle_list[5], expected 22, is " - << last_msg_->rle_list[5]; - EXPECT_EQ(get_asrle_list[6])>( - reinterpret_cast(&last_msg_->rle_list[6])), - 98) - << "incorrect value for rle_list[6], expected 98, is " - << last_msg_->rle_list[6]; - EXPECT_EQ(get_asrle_list[7])>( - reinterpret_cast(&last_msg_->rle_list[7])), - 203) - << "incorrect value for rle_list[7], expected 203, is " - << last_msg_->rle_list[7]; - EXPECT_EQ(get_asrle_list[8])>( - reinterpret_cast(&last_msg_->rle_list[8])), - 123) - << "incorrect value for rle_list[8], expected 123, is " - << last_msg_->rle_list[8]; - EXPECT_EQ(get_asrle_list[9])>( - reinterpret_cast(&last_msg_->rle_list[9])), - 211) - << "incorrect value for rle_list[9], expected 211, is " - << last_msg_->rle_list[9]; - EXPECT_EQ(get_asrle_list[10])>( - reinterpret_cast(&last_msg_->rle_list[10])), - 38) - << "incorrect value for rle_list[10], expected 38, is " - << last_msg_->rle_list[10]; - EXPECT_EQ(get_asrle_list[11])>( - reinterpret_cast(&last_msg_->rle_list[11])), - 13) - << "incorrect value for rle_list[11], expected 13, is " - << last_msg_->rle_list[11]; - EXPECT_EQ(get_asrle_list[12])>( - reinterpret_cast(&last_msg_->rle_list[12])), - 253) - << "incorrect value for rle_list[12], expected 253, is " - << last_msg_->rle_list[12]; - EXPECT_EQ(get_asrle_list[13])>( - reinterpret_cast(&last_msg_->rle_list[13])), - 129) - << "incorrect value for rle_list[13], expected 129, is " - << last_msg_->rle_list[13]; - EXPECT_EQ(get_asrle_list[14])>( - reinterpret_cast(&last_msg_->rle_list[14])), - 173) - << "incorrect value for rle_list[14], expected 173, is " - << last_msg_->rle_list[14]; - EXPECT_EQ(get_asrle_list[15])>( - reinterpret_cast(&last_msg_->rle_list[15])), - 171) - << "incorrect value for rle_list[15], expected 171, is " - << last_msg_->rle_list[15]; - EXPECT_EQ(get_asrle_list[16])>( - reinterpret_cast(&last_msg_->rle_list[16])), - 235) - << "incorrect value for rle_list[16], expected 235, is " - << last_msg_->rle_list[16]; - EXPECT_EQ(get_asrle_list[17])>( - reinterpret_cast(&last_msg_->rle_list[17])), - 253) - << "incorrect value for rle_list[17], expected 253, is " - << last_msg_->rle_list[17]; - EXPECT_EQ(get_asrle_list[18])>( - reinterpret_cast(&last_msg_->rle_list[18])), - 26) - << "incorrect value for rle_list[18], expected 26, is " - << last_msg_->rle_list[18]; - EXPECT_EQ(get_asrle_list[19])>( - reinterpret_cast(&last_msg_->rle_list[19])), - 203) - << "incorrect value for rle_list[19], expected 203, is " - << last_msg_->rle_list[19]; - EXPECT_EQ(get_asrle_list[20])>( - reinterpret_cast(&last_msg_->rle_list[20])), - 3) - << "incorrect value for rle_list[20], expected 3, is " - << last_msg_->rle_list[20]; - EXPECT_EQ(get_asrle_list[21])>( - reinterpret_cast(&last_msg_->rle_list[21])), - 120) - << "incorrect value for rle_list[21], expected 120, is " - << last_msg_->rle_list[21]; - EXPECT_EQ(get_asrle_list[22])>( - reinterpret_cast(&last_msg_->rle_list[22])), - 126) - << "incorrect value for rle_list[22], expected 126, is " - << last_msg_->rle_list[22]; - EXPECT_EQ(get_asrle_list[23])>( - reinterpret_cast(&last_msg_->rle_list[23])), - 42) - << "incorrect value for rle_list[23], expected 42, is " - << last_msg_->rle_list[23]; - EXPECT_EQ(get_asrle_list[24])>( - reinterpret_cast(&last_msg_->rle_list[24])), - 44) - << "incorrect value for rle_list[24], expected 44, is " - << last_msg_->rle_list[24]; - EXPECT_EQ(get_asrle_list[25])>( - reinterpret_cast(&last_msg_->rle_list[25])), - 39) - << "incorrect value for rle_list[25], expected 39, is " - << last_msg_->rle_list[25]; - EXPECT_EQ(get_asrle_list[26])>( - reinterpret_cast(&last_msg_->rle_list[26])), - 87) - << "incorrect value for rle_list[26], expected 87, is " - << last_msg_->rle_list[26]; - EXPECT_EQ(get_asrle_list[27])>( - reinterpret_cast(&last_msg_->rle_list[27])), - 69) - << "incorrect value for rle_list[27], expected 69, is " - << last_msg_->rle_list[27]; - EXPECT_EQ(get_asrle_list[28])>( - reinterpret_cast(&last_msg_->rle_list[28])), - 154) - << "incorrect value for rle_list[28], expected 154, is " - << last_msg_->rle_list[28]; - EXPECT_EQ(get_asrle_list[29])>( - reinterpret_cast(&last_msg_->rle_list[29])), - 13) - << "incorrect value for rle_list[29], expected 13, is " - << last_msg_->rle_list[29]; - EXPECT_EQ(get_asrle_list[30])>( - reinterpret_cast(&last_msg_->rle_list[30])), - 28) - << "incorrect value for rle_list[30], expected 28, is " - << last_msg_->rle_list[30]; - EXPECT_EQ(get_asrle_list[31])>( - reinterpret_cast(&last_msg_->rle_list[31])), - 179) - << "incorrect value for rle_list[31], expected 179, is " - << last_msg_->rle_list[31]; - EXPECT_EQ(get_asrle_list[32])>( - reinterpret_cast(&last_msg_->rle_list[32])), - 32) - << "incorrect value for rle_list[32], expected 32, is " - << last_msg_->rle_list[32]; - EXPECT_EQ(get_asrle_list[33])>( - reinterpret_cast(&last_msg_->rle_list[33])), - 47) - << "incorrect value for rle_list[33], expected 47, is " - << last_msg_->rle_list[33]; - EXPECT_EQ(get_asrle_list[34])>( - reinterpret_cast(&last_msg_->rle_list[34])), - 36) - << "incorrect value for rle_list[34], expected 36, is " - << last_msg_->rle_list[34]; - EXPECT_EQ(get_asrle_list[35])>( - reinterpret_cast(&last_msg_->rle_list[35])), - 195) - << "incorrect value for rle_list[35], expected 195, is " - << last_msg_->rle_list[35]; - EXPECT_EQ(get_asrle_list[36])>( - reinterpret_cast(&last_msg_->rle_list[36])), - 39) - << "incorrect value for rle_list[36], expected 39, is " - << last_msg_->rle_list[36]; - EXPECT_EQ(get_asrle_list[37])>( - reinterpret_cast(&last_msg_->rle_list[37])), - 198) - << "incorrect value for rle_list[37], expected 198, is " - << last_msg_->rle_list[37]; - EXPECT_EQ(get_asrle_list[38])>( - reinterpret_cast(&last_msg_->rle_list[38])), - 134) - << "incorrect value for rle_list[38], expected 134, is " - << last_msg_->rle_list[38]; - EXPECT_EQ(get_asrle_list[39])>( - reinterpret_cast(&last_msg_->rle_list[39])), - 235) - << "incorrect value for rle_list[39], expected 235, is " - << last_msg_->rle_list[39]; - EXPECT_EQ(get_asrle_list[40])>( - reinterpret_cast(&last_msg_->rle_list[40])), - 134) - << "incorrect value for rle_list[40], expected 134, is " - << last_msg_->rle_list[40]; - EXPECT_EQ(get_asrle_list[41])>( - reinterpret_cast(&last_msg_->rle_list[41])), - 57) - << "incorrect value for rle_list[41], expected 57, is " - << last_msg_->rle_list[41]; - EXPECT_EQ(get_asrle_list[42])>( - reinterpret_cast(&last_msg_->rle_list[42])), - 120) - << "incorrect value for rle_list[42], expected 120, is " - << last_msg_->rle_list[42]; - EXPECT_EQ(get_asrle_list[43])>( - reinterpret_cast(&last_msg_->rle_list[43])), - 243) - << "incorrect value for rle_list[43], expected 243, is " - << last_msg_->rle_list[43]; - EXPECT_EQ(get_asrle_list[44])>( - reinterpret_cast(&last_msg_->rle_list[44])), - 151) - << "incorrect value for rle_list[44], expected 151, is " - << last_msg_->rle_list[44]; - EXPECT_EQ(get_asrle_list[45])>( - reinterpret_cast(&last_msg_->rle_list[45])), - 35) - << "incorrect value for rle_list[45], expected 35, is " - << last_msg_->rle_list[45]; - EXPECT_EQ(get_asrle_list[46])>( - reinterpret_cast(&last_msg_->rle_list[46])), - 17) - << "incorrect value for rle_list[46], expected 17, is " - << last_msg_->rle_list[46]; - EXPECT_EQ(get_asrle_list[47])>( - reinterpret_cast(&last_msg_->rle_list[47])), - 201) - << "incorrect value for rle_list[47], expected 201, is " - << last_msg_->rle_list[47]; - EXPECT_EQ(get_asrle_list[48])>( - reinterpret_cast(&last_msg_->rle_list[48])), - 211) - << "incorrect value for rle_list[48], expected 211, is " - << last_msg_->rle_list[48]; - EXPECT_EQ(get_asrle_list[49])>( - reinterpret_cast(&last_msg_->rle_list[49])), - 125) - << "incorrect value for rle_list[49], expected 125, is " - << last_msg_->rle_list[49]; - EXPECT_EQ(get_asrle_list[50])>( - reinterpret_cast(&last_msg_->rle_list[50])), - 117) - << "incorrect value for rle_list[50], expected 117, is " - << last_msg_->rle_list[50]; - EXPECT_EQ(get_asrle_list[51])>( - reinterpret_cast(&last_msg_->rle_list[51])), - 164) - << "incorrect value for rle_list[51], expected 164, is " - << last_msg_->rle_list[51]; - EXPECT_EQ(get_asrle_list[52])>( - reinterpret_cast(&last_msg_->rle_list[52])), - 142) - << "incorrect value for rle_list[52], expected 142, is " - << last_msg_->rle_list[52]; - EXPECT_EQ(get_asrle_list[53])>( - reinterpret_cast(&last_msg_->rle_list[53])), - 101) - << "incorrect value for rle_list[53], expected 101, is " - << last_msg_->rle_list[53]; - EXPECT_EQ(get_asrle_list[54])>( - reinterpret_cast(&last_msg_->rle_list[54])), - 239) - << "incorrect value for rle_list[54], expected 239, is " - << last_msg_->rle_list[54]; - EXPECT_EQ(get_asrle_list[55])>( - reinterpret_cast(&last_msg_->rle_list[55])), - 144) - << "incorrect value for rle_list[55], expected 144, is " - << last_msg_->rle_list[55]; - EXPECT_EQ(get_asrle_list[56])>( - reinterpret_cast(&last_msg_->rle_list[56])), - 158) - << "incorrect value for rle_list[56], expected 158, is " - << last_msg_->rle_list[56]; - EXPECT_EQ(get_asrle_list[57])>( - reinterpret_cast(&last_msg_->rle_list[57])), - 239) - << "incorrect value for rle_list[57], expected 239, is " - << last_msg_->rle_list[57]; - EXPECT_EQ(get_asrle_list[58])>( - reinterpret_cast(&last_msg_->rle_list[58])), - 90) - << "incorrect value for rle_list[58], expected 90, is " - << last_msg_->rle_list[58]; - EXPECT_EQ(get_asrle_list[59])>( - reinterpret_cast(&last_msg_->rle_list[59])), - 56) - << "incorrect value for rle_list[59], expected 56, is " - << last_msg_->rle_list[59]; - EXPECT_EQ(get_asrle_list[60])>( - reinterpret_cast(&last_msg_->rle_list[60])), - 71) - << "incorrect value for rle_list[60], expected 71, is " - << last_msg_->rle_list[60]; - EXPECT_EQ(get_asrle_list[61])>( - reinterpret_cast(&last_msg_->rle_list[61])), - 120) - << "incorrect value for rle_list[61], expected 120, is " - << last_msg_->rle_list[61]; - EXPECT_EQ(get_asrle_list[62])>( - reinterpret_cast(&last_msg_->rle_list[62])), - 67) - << "incorrect value for rle_list[62], expected 67, is " - << last_msg_->rle_list[62]; - EXPECT_EQ(get_asrle_list[63])>( - reinterpret_cast(&last_msg_->rle_list[63])), - 221) - << "incorrect value for rle_list[63], expected 221, is " - << last_msg_->rle_list[63]; - EXPECT_EQ(get_asrle_list[64])>( - reinterpret_cast(&last_msg_->rle_list[64])), - 114) - << "incorrect value for rle_list[64], expected 114, is " - << last_msg_->rle_list[64]; - EXPECT_EQ(get_asrle_list[65])>( - reinterpret_cast(&last_msg_->rle_list[65])), - 10) - << "incorrect value for rle_list[65], expected 10, is " - << last_msg_->rle_list[65]; - EXPECT_EQ(get_asrle_list[66])>( - reinterpret_cast(&last_msg_->rle_list[66])), - 190) - << "incorrect value for rle_list[66], expected 190, is " - << last_msg_->rle_list[66]; - EXPECT_EQ(get_asrle_list[67])>( - reinterpret_cast(&last_msg_->rle_list[67])), - 4) - << "incorrect value for rle_list[67], expected 4, is " - << last_msg_->rle_list[67]; - EXPECT_EQ(get_asrle_list[68])>( - reinterpret_cast(&last_msg_->rle_list[68])), - 230) - << "incorrect value for rle_list[68], expected 230, is " - << last_msg_->rle_list[68]; - EXPECT_EQ(get_asrle_list[69])>( - reinterpret_cast(&last_msg_->rle_list[69])), - 164) - << "incorrect value for rle_list[69], expected 164, is " - << last_msg_->rle_list[69]; - EXPECT_EQ(get_asrle_list[70])>( - reinterpret_cast(&last_msg_->rle_list[70])), - 171) - << "incorrect value for rle_list[70], expected 171, is " - << last_msg_->rle_list[70]; - EXPECT_EQ(get_asrle_list[71])>( - reinterpret_cast(&last_msg_->rle_list[71])), - 78) - << "incorrect value for rle_list[71], expected 78, is " - << last_msg_->rle_list[71]; - EXPECT_EQ(get_asrle_list[72])>( - reinterpret_cast(&last_msg_->rle_list[72])), - 185) - << "incorrect value for rle_list[72], expected 185, is " - << last_msg_->rle_list[72]; - EXPECT_EQ(get_asrle_list[73])>( - reinterpret_cast(&last_msg_->rle_list[73])), - 90) - << "incorrect value for rle_list[73], expected 90, is " - << last_msg_->rle_list[73]; - EXPECT_EQ(get_asrle_list[74])>( - reinterpret_cast(&last_msg_->rle_list[74])), - 46) - << "incorrect value for rle_list[74], expected 46, is " - << last_msg_->rle_list[74]; - EXPECT_EQ(get_asrle_list[75])>( - reinterpret_cast(&last_msg_->rle_list[75])), - 177) - << "incorrect value for rle_list[75], expected 177, is " - << last_msg_->rle_list[75]; - EXPECT_EQ(get_asrle_list[76])>( - reinterpret_cast(&last_msg_->rle_list[76])), - 82) - << "incorrect value for rle_list[76], expected 82, is " - << last_msg_->rle_list[76]; - EXPECT_EQ(get_asrle_list[77])>( - reinterpret_cast(&last_msg_->rle_list[77])), - 228) - << "incorrect value for rle_list[77], expected 228, is " - << last_msg_->rle_list[77]; - EXPECT_EQ(get_asrle_list[78])>( - reinterpret_cast(&last_msg_->rle_list[78])), - 123) - << "incorrect value for rle_list[78], expected 123, is " - << last_msg_->rle_list[78]; - EXPECT_EQ(get_asrle_list[79])>( - reinterpret_cast(&last_msg_->rle_list[79])), - 222) - << "incorrect value for rle_list[79], expected 222, is " - << last_msg_->rle_list[79]; - EXPECT_EQ(get_asrle_list[80])>( - reinterpret_cast(&last_msg_->rle_list[80])), - 227) - << "incorrect value for rle_list[80], expected 227, is " - << last_msg_->rle_list[80]; - EXPECT_EQ(get_asrle_list[81])>( - reinterpret_cast(&last_msg_->rle_list[81])), - 145) - << "incorrect value for rle_list[81], expected 145, is " - << last_msg_->rle_list[81]; - EXPECT_EQ(get_asrle_list[82])>( - reinterpret_cast(&last_msg_->rle_list[82])), - 195) - << "incorrect value for rle_list[82], expected 195, is " - << last_msg_->rle_list[82]; - EXPECT_EQ(get_asrle_list[83])>( - reinterpret_cast(&last_msg_->rle_list[83])), - 219) - << "incorrect value for rle_list[83], expected 219, is " - << last_msg_->rle_list[83]; - EXPECT_EQ(get_asrle_list[84])>( - reinterpret_cast(&last_msg_->rle_list[84])), - 27) - << "incorrect value for rle_list[84], expected 27, is " - << last_msg_->rle_list[84]; - EXPECT_EQ(get_asrle_list[85])>( - reinterpret_cast(&last_msg_->rle_list[85])), - 56) - << "incorrect value for rle_list[85], expected 56, is " - << last_msg_->rle_list[85]; - EXPECT_EQ(get_asrle_list[86])>( - reinterpret_cast(&last_msg_->rle_list[86])), - 227) - << "incorrect value for rle_list[86], expected 227, is " - << last_msg_->rle_list[86]; - EXPECT_EQ(get_asrle_list[87])>( - reinterpret_cast(&last_msg_->rle_list[87])), - 246) - << "incorrect value for rle_list[87], expected 246, is " - << last_msg_->rle_list[87]; - EXPECT_EQ(get_asrle_list[88])>( - reinterpret_cast(&last_msg_->rle_list[88])), - 215) - << "incorrect value for rle_list[88], expected 215, is " - << last_msg_->rle_list[88]; - EXPECT_EQ(get_asrle_list[89])>( - reinterpret_cast(&last_msg_->rle_list[89])), - 144) - << "incorrect value for rle_list[89], expected 144, is " - << last_msg_->rle_list[89]; - EXPECT_EQ(get_asrle_list[90])>( - reinterpret_cast(&last_msg_->rle_list[90])), - 158) - << "incorrect value for rle_list[90], expected 158, is " - << last_msg_->rle_list[90]; - EXPECT_EQ(get_asrle_list[91])>( - reinterpret_cast(&last_msg_->rle_list[91])), - 31) - << "incorrect value for rle_list[91], expected 31, is " - << last_msg_->rle_list[91]; - EXPECT_EQ(get_asrle_list[92])>( - reinterpret_cast(&last_msg_->rle_list[92])), - 214) - << "incorrect value for rle_list[92], expected 214, is " - << last_msg_->rle_list[92]; - EXPECT_EQ(get_asrle_list[93])>( - reinterpret_cast(&last_msg_->rle_list[93])), - 241) - << "incorrect value for rle_list[93], expected 241, is " - << last_msg_->rle_list[93]; - EXPECT_EQ(get_asrle_list[94])>( - reinterpret_cast(&last_msg_->rle_list[94])), - 254) - << "incorrect value for rle_list[94], expected 254, is " - << last_msg_->rle_list[94]; - EXPECT_EQ(get_asrle_list[95])>( - reinterpret_cast(&last_msg_->rle_list[95])), - 200) - << "incorrect value for rle_list[95], expected 200, is " - << last_msg_->rle_list[95]; - EXPECT_EQ(get_asrle_list[96])>( - reinterpret_cast(&last_msg_->rle_list[96])), - 86) - << "incorrect value for rle_list[96], expected 86, is " - << last_msg_->rle_list[96]; - EXPECT_EQ(get_asrle_list[97])>( - reinterpret_cast(&last_msg_->rle_list[97])), - 142) - << "incorrect value for rle_list[97], expected 142, is " - << last_msg_->rle_list[97]; - EXPECT_EQ(get_asrle_list[98])>( - reinterpret_cast(&last_msg_->rle_list[98])), - 89) - << "incorrect value for rle_list[98], expected 89, is " - << last_msg_->rle_list[98]; - EXPECT_EQ(get_asrle_list[99])>( - reinterpret_cast(&last_msg_->rle_list[99])), - 12) - << "incorrect value for rle_list[99], expected 12, is " - << last_msg_->rle_list[99]; - EXPECT_EQ(get_asrle_list[100])>( - reinterpret_cast(&last_msg_->rle_list[100])), - 121) - << "incorrect value for rle_list[100], expected 121, is " - << last_msg_->rle_list[100]; - EXPECT_EQ(get_asrle_list[101])>( - reinterpret_cast(&last_msg_->rle_list[101])), - 29) - << "incorrect value for rle_list[101], expected 29, is " - << last_msg_->rle_list[101]; - EXPECT_EQ(get_asrle_list[102])>( - reinterpret_cast(&last_msg_->rle_list[102])), - 124) - << "incorrect value for rle_list[102], expected 124, is " - << last_msg_->rle_list[102]; - EXPECT_EQ(get_asrle_list[103])>( - reinterpret_cast(&last_msg_->rle_list[103])), - 9) - << "incorrect value for rle_list[103], expected 9, is " - << last_msg_->rle_list[103]; - EXPECT_EQ(get_asrle_list[104])>( - reinterpret_cast(&last_msg_->rle_list[104])), - 19) - << "incorrect value for rle_list[104], expected 19, is " - << last_msg_->rle_list[104]; - EXPECT_EQ(get_asrle_list[105])>( - reinterpret_cast(&last_msg_->rle_list[105])), - 153) - << "incorrect value for rle_list[105], expected 153, is " - << last_msg_->rle_list[105]; - EXPECT_EQ(get_asrle_list[106])>( - reinterpret_cast(&last_msg_->rle_list[106])), - 44) - << "incorrect value for rle_list[106], expected 44, is " - << last_msg_->rle_list[106]; - EXPECT_EQ(get_asrle_list[107])>( - reinterpret_cast(&last_msg_->rle_list[107])), - 35) - << "incorrect value for rle_list[107], expected 35, is " - << last_msg_->rle_list[107]; - EXPECT_EQ(get_asrle_list[108])>( - reinterpret_cast(&last_msg_->rle_list[108])), - 126) - << "incorrect value for rle_list[108], expected 126, is " - << last_msg_->rle_list[108]; - EXPECT_EQ(get_asrle_list[109])>( - reinterpret_cast(&last_msg_->rle_list[109])), - 14) - << "incorrect value for rle_list[109], expected 14, is " - << last_msg_->rle_list[109]; - EXPECT_EQ(get_asrle_list[110])>( - reinterpret_cast(&last_msg_->rle_list[110])), - 217) - << "incorrect value for rle_list[110], expected 217, is " - << last_msg_->rle_list[110]; - EXPECT_EQ(get_asrle_list[111])>( - reinterpret_cast(&last_msg_->rle_list[111])), - 65) - << "incorrect value for rle_list[111], expected 65, is " - << last_msg_->rle_list[111]; - EXPECT_EQ(get_asrle_list[112])>( - reinterpret_cast(&last_msg_->rle_list[112])), - 116) - << "incorrect value for rle_list[112], expected 116, is " - << last_msg_->rle_list[112]; - EXPECT_EQ(get_asrle_list[113])>( - reinterpret_cast(&last_msg_->rle_list[113])), - 26) - << "incorrect value for rle_list[113], expected 26, is " - << last_msg_->rle_list[113]; - EXPECT_EQ(get_asrle_list[114])>( - reinterpret_cast(&last_msg_->rle_list[114])), - 139) - << "incorrect value for rle_list[114], expected 139, is " - << last_msg_->rle_list[114]; - EXPECT_EQ(get_asrle_list[115])>( - reinterpret_cast(&last_msg_->rle_list[115])), - 122) - << "incorrect value for rle_list[115], expected 122, is " - << last_msg_->rle_list[115]; - EXPECT_EQ(get_asrle_list[116])>( - reinterpret_cast(&last_msg_->rle_list[116])), - 114) - << "incorrect value for rle_list[116], expected 114, is " - << last_msg_->rle_list[116]; - EXPECT_EQ(get_asrle_list[117])>( - reinterpret_cast(&last_msg_->rle_list[117])), - 90) - << "incorrect value for rle_list[117], expected 90, is " - << last_msg_->rle_list[117]; - EXPECT_EQ(get_asrle_list[118])>( - reinterpret_cast(&last_msg_->rle_list[118])), - 124) - << "incorrect value for rle_list[118], expected 124, is " - << last_msg_->rle_list[118]; - EXPECT_EQ(get_asrle_list[119])>( - reinterpret_cast(&last_msg_->rle_list[119])), - 81) - << "incorrect value for rle_list[119], expected 81, is " - << last_msg_->rle_list[119]; - EXPECT_EQ(get_asrle_list[120])>( - reinterpret_cast(&last_msg_->rle_list[120])), - 0) - << "incorrect value for rle_list[120], expected 0, is " - << last_msg_->rle_list[120]; - EXPECT_EQ(get_asrle_list[121])>( - reinterpret_cast(&last_msg_->rle_list[121])), - 186) - << "incorrect value for rle_list[121], expected 186, is " - << last_msg_->rle_list[121]; - EXPECT_EQ(get_asrle_list[122])>( - reinterpret_cast(&last_msg_->rle_list[122])), - 246) - << "incorrect value for rle_list[122], expected 246, is " - << last_msg_->rle_list[122]; - EXPECT_EQ(get_asrle_list[123])>( - reinterpret_cast(&last_msg_->rle_list[123])), - 46) - << "incorrect value for rle_list[123], expected 46, is " - << last_msg_->rle_list[123]; - EXPECT_EQ(get_asrle_list[124])>( - reinterpret_cast(&last_msg_->rle_list[124])), - 98) - << "incorrect value for rle_list[124], expected 98, is " - << last_msg_->rle_list[124]; - EXPECT_EQ(get_asrle_list[125])>( - reinterpret_cast(&last_msg_->rle_list[125])), - 179) - << "incorrect value for rle_list[125], expected 179, is " - << last_msg_->rle_list[125]; - EXPECT_EQ(get_asrle_list[126])>( - reinterpret_cast(&last_msg_->rle_list[126])), - 243) - << "incorrect value for rle_list[126], expected 243, is " - << last_msg_->rle_list[126]; - EXPECT_EQ(get_asrle_list[127])>( - reinterpret_cast(&last_msg_->rle_list[127])), - 198) - << "incorrect value for rle_list[127], expected 198, is " - << last_msg_->rle_list[127]; - EXPECT_EQ(get_asrle_list[128])>( - reinterpret_cast(&last_msg_->rle_list[128])), - 217) - << "incorrect value for rle_list[128], expected 217, is " - << last_msg_->rle_list[128]; - EXPECT_EQ(get_asrle_list[129])>( - reinterpret_cast(&last_msg_->rle_list[129])), - 36) - << "incorrect value for rle_list[129], expected 36, is " - << last_msg_->rle_list[129]; - EXPECT_EQ(get_asrle_list[130])>( - reinterpret_cast(&last_msg_->rle_list[130])), - 30) - << "incorrect value for rle_list[130], expected 30, is " - << last_msg_->rle_list[130]; - EXPECT_EQ(get_asrle_list[131])>( - reinterpret_cast(&last_msg_->rle_list[131])), - 202) - << "incorrect value for rle_list[131], expected 202, is " - << last_msg_->rle_list[131]; - EXPECT_EQ(get_asrle_list[132])>( - reinterpret_cast(&last_msg_->rle_list[132])), - 12) - << "incorrect value for rle_list[132], expected 12, is " - << last_msg_->rle_list[132]; - EXPECT_EQ(get_asrle_list[133])>( - reinterpret_cast(&last_msg_->rle_list[133])), - 135) - << "incorrect value for rle_list[133], expected 135, is " - << last_msg_->rle_list[133]; - EXPECT_EQ(get_asrle_list[134])>( - reinterpret_cast(&last_msg_->rle_list[134])), - 61) - << "incorrect value for rle_list[134], expected 61, is " - << last_msg_->rle_list[134]; - EXPECT_EQ(get_asrle_list[135])>( - reinterpret_cast(&last_msg_->rle_list[135])), - 42) - << "incorrect value for rle_list[135], expected 42, is " - << last_msg_->rle_list[135]; - EXPECT_EQ(get_asrle_list[136])>( - reinterpret_cast(&last_msg_->rle_list[136])), - 150) - << "incorrect value for rle_list[136], expected 150, is " - << last_msg_->rle_list[136]; - EXPECT_EQ(get_asrle_list[137])>( - reinterpret_cast(&last_msg_->rle_list[137])), - 221) - << "incorrect value for rle_list[137], expected 221, is " - << last_msg_->rle_list[137]; - EXPECT_EQ(get_asrle_list[138])>( - reinterpret_cast(&last_msg_->rle_list[138])), - 102) - << "incorrect value for rle_list[138], expected 102, is " - << last_msg_->rle_list[138]; - EXPECT_EQ(get_asrle_list[139])>( - reinterpret_cast(&last_msg_->rle_list[139])), - 83) - << "incorrect value for rle_list[139], expected 83, is " - << last_msg_->rle_list[139]; - EXPECT_EQ(get_asrle_list[140])>( - reinterpret_cast(&last_msg_->rle_list[140])), - 179) - << "incorrect value for rle_list[140], expected 179, is " - << last_msg_->rle_list[140]; - EXPECT_EQ(get_asrle_list[141])>( - reinterpret_cast(&last_msg_->rle_list[141])), - 43) - << "incorrect value for rle_list[141], expected 43, is " - << last_msg_->rle_list[141]; - EXPECT_EQ(get_asrle_list[142])>( - reinterpret_cast(&last_msg_->rle_list[142])), - 252) - << "incorrect value for rle_list[142], expected 252, is " - << last_msg_->rle_list[142]; - EXPECT_EQ(get_asrle_list[143])>( - reinterpret_cast(&last_msg_->rle_list[143])), - 81) - << "incorrect value for rle_list[143], expected 81, is " - << last_msg_->rle_list[143]; - EXPECT_EQ(get_asrle_list[144])>( - reinterpret_cast(&last_msg_->rle_list[144])), - 62) - << "incorrect value for rle_list[144], expected 62, is " - << last_msg_->rle_list[144]; - EXPECT_EQ(get_asrle_list[145])>( - reinterpret_cast(&last_msg_->rle_list[145])), - 126) - << "incorrect value for rle_list[145], expected 126, is " - << last_msg_->rle_list[145]; - EXPECT_EQ(get_asrle_list[146])>( - reinterpret_cast(&last_msg_->rle_list[146])), - 204) - << "incorrect value for rle_list[146], expected 204, is " - << last_msg_->rle_list[146]; - EXPECT_EQ(get_asrle_list[147])>( - reinterpret_cast(&last_msg_->rle_list[147])), - 195) - << "incorrect value for rle_list[147], expected 195, is " - << last_msg_->rle_list[147]; - EXPECT_EQ(get_asrle_list[148])>( - reinterpret_cast(&last_msg_->rle_list[148])), - 238) - << "incorrect value for rle_list[148], expected 238, is " - << last_msg_->rle_list[148]; - EXPECT_EQ(get_asrle_list[149])>( - reinterpret_cast(&last_msg_->rle_list[149])), - 18) - << "incorrect value for rle_list[149], expected 18, is " - << last_msg_->rle_list[149]; - EXPECT_EQ(get_asrle_list[150])>( - reinterpret_cast(&last_msg_->rle_list[150])), - 128) - << "incorrect value for rle_list[150], expected 128, is " - << last_msg_->rle_list[150]; - EXPECT_EQ(get_asrle_list[151])>( - reinterpret_cast(&last_msg_->rle_list[151])), - 193) - << "incorrect value for rle_list[151], expected 193, is " - << last_msg_->rle_list[151]; - EXPECT_EQ(get_asrle_list[152])>( - reinterpret_cast(&last_msg_->rle_list[152])), - 53) - << "incorrect value for rle_list[152], expected 53, is " - << last_msg_->rle_list[152]; - EXPECT_EQ(get_asrle_list[153])>( - reinterpret_cast(&last_msg_->rle_list[153])), - 94) - << "incorrect value for rle_list[153], expected 94, is " - << last_msg_->rle_list[153]; - EXPECT_EQ(get_asrle_list[154])>( - reinterpret_cast(&last_msg_->rle_list[154])), - 99) - << "incorrect value for rle_list[154], expected 99, is " - << last_msg_->rle_list[154]; - EXPECT_EQ(get_asrle_list[155])>( - reinterpret_cast(&last_msg_->rle_list[155])), - 63) - << "incorrect value for rle_list[155], expected 63, is " - << last_msg_->rle_list[155]; - EXPECT_EQ(get_asrle_list[156])>( - reinterpret_cast(&last_msg_->rle_list[156])), - 182) - << "incorrect value for rle_list[156], expected 182, is " - << last_msg_->rle_list[156]; - EXPECT_EQ(get_asrle_list[157])>( - reinterpret_cast(&last_msg_->rle_list[157])), - 2) - << "incorrect value for rle_list[157], expected 2, is " - << last_msg_->rle_list[157]; - EXPECT_EQ(get_asrle_list[158])>( - reinterpret_cast(&last_msg_->rle_list[158])), - 186) - << "incorrect value for rle_list[158], expected 186, is " - << last_msg_->rle_list[158]; - EXPECT_EQ(get_asrle_list[159])>( - reinterpret_cast(&last_msg_->rle_list[159])), - 220) - << "incorrect value for rle_list[159], expected 220, is " - << last_msg_->rle_list[159]; - EXPECT_EQ(get_asrle_list[160])>( - reinterpret_cast(&last_msg_->rle_list[160])), - 77) - << "incorrect value for rle_list[160], expected 77, is " - << last_msg_->rle_list[160]; - EXPECT_EQ(get_asrle_list[161])>( - reinterpret_cast(&last_msg_->rle_list[161])), - 186) - << "incorrect value for rle_list[161], expected 186, is " - << last_msg_->rle_list[161]; - EXPECT_EQ(get_asrle_list[162])>( - reinterpret_cast(&last_msg_->rle_list[162])), - 224) - << "incorrect value for rle_list[162], expected 224, is " - << last_msg_->rle_list[162]; - EXPECT_EQ(get_asrle_list[163])>( - reinterpret_cast(&last_msg_->rle_list[163])), - 220) - << "incorrect value for rle_list[163], expected 220, is " - << last_msg_->rle_list[163]; - EXPECT_EQ(get_asrle_list[164])>( - reinterpret_cast(&last_msg_->rle_list[164])), - 13) - << "incorrect value for rle_list[164], expected 13, is " - << last_msg_->rle_list[164]; - EXPECT_EQ(get_asrle_list[165])>( - reinterpret_cast(&last_msg_->rle_list[165])), - 212) - << "incorrect value for rle_list[165], expected 212, is " - << last_msg_->rle_list[165]; - EXPECT_EQ(get_asrle_list[166])>( - reinterpret_cast(&last_msg_->rle_list[166])), - 182) - << "incorrect value for rle_list[166], expected 182, is " - << last_msg_->rle_list[166]; - EXPECT_EQ(get_asrle_list[167])>( - reinterpret_cast(&last_msg_->rle_list[167])), - 88) - << "incorrect value for rle_list[167], expected 88, is " - << last_msg_->rle_list[167]; - EXPECT_EQ(get_asrle_list[168])>( - reinterpret_cast(&last_msg_->rle_list[168])), - 15) - << "incorrect value for rle_list[168], expected 15, is " - << last_msg_->rle_list[168]; - EXPECT_EQ(get_asrle_list[169])>( - reinterpret_cast(&last_msg_->rle_list[169])), - 151) - << "incorrect value for rle_list[169], expected 151, is " - << last_msg_->rle_list[169]; - EXPECT_EQ(get_asrle_list[170])>( - reinterpret_cast(&last_msg_->rle_list[170])), - 5) - << "incorrect value for rle_list[170], expected 5, is " - << last_msg_->rle_list[170]; - EXPECT_EQ(get_asrle_list[171])>( - reinterpret_cast(&last_msg_->rle_list[171])), - 93) - << "incorrect value for rle_list[171], expected 93, is " - << last_msg_->rle_list[171]; - EXPECT_EQ(get_asrle_list[172])>( - reinterpret_cast(&last_msg_->rle_list[172])), - 251) - << "incorrect value for rle_list[172], expected 251, is " - << last_msg_->rle_list[172]; - EXPECT_EQ(get_asrle_list[173])>( - reinterpret_cast(&last_msg_->rle_list[173])), - 164) - << "incorrect value for rle_list[173], expected 164, is " - << last_msg_->rle_list[173]; - EXPECT_EQ(get_asrle_list[174])>( - reinterpret_cast(&last_msg_->rle_list[174])), - 18) - << "incorrect value for rle_list[174], expected 18, is " - << last_msg_->rle_list[174]; - EXPECT_EQ(get_asrle_list[175])>( - reinterpret_cast(&last_msg_->rle_list[175])), - 228) - << "incorrect value for rle_list[175], expected 228, is " - << last_msg_->rle_list[175]; - EXPECT_EQ(get_asrle_list[176])>( - reinterpret_cast(&last_msg_->rle_list[176])), - 168) - << "incorrect value for rle_list[176], expected 168, is " - << last_msg_->rle_list[176]; - EXPECT_EQ(get_asrle_list[177])>( - reinterpret_cast(&last_msg_->rle_list[177])), - 226) - << "incorrect value for rle_list[177], expected 226, is " - << last_msg_->rle_list[177]; - EXPECT_EQ(get_asrle_list[178])>( - reinterpret_cast(&last_msg_->rle_list[178])), - 195) - << "incorrect value for rle_list[178], expected 195, is " - << last_msg_->rle_list[178]; - EXPECT_EQ(get_asrle_list[179])>( - reinterpret_cast(&last_msg_->rle_list[179])), - 44) - << "incorrect value for rle_list[179], expected 44, is " - << last_msg_->rle_list[179]; - EXPECT_EQ(get_asrle_list[180])>( - reinterpret_cast(&last_msg_->rle_list[180])), - 170) - << "incorrect value for rle_list[180], expected 170, is " - << last_msg_->rle_list[180]; - EXPECT_EQ(get_asrle_list[181])>( - reinterpret_cast(&last_msg_->rle_list[181])), - 145) - << "incorrect value for rle_list[181], expected 145, is " - << last_msg_->rle_list[181]; - EXPECT_EQ(get_asrle_list[182])>( - reinterpret_cast(&last_msg_->rle_list[182])), - 36) - << "incorrect value for rle_list[182], expected 36, is " - << last_msg_->rle_list[182]; - EXPECT_EQ(get_asrle_list[183])>( - reinterpret_cast(&last_msg_->rle_list[183])), - 58) - << "incorrect value for rle_list[183], expected 58, is " - << last_msg_->rle_list[183]; - EXPECT_EQ(get_asrle_list[184])>( - reinterpret_cast(&last_msg_->rle_list[184])), - 96) - << "incorrect value for rle_list[184], expected 96, is " - << last_msg_->rle_list[184]; - EXPECT_EQ(get_asrle_list[185])>( - reinterpret_cast(&last_msg_->rle_list[185])), - 107) - << "incorrect value for rle_list[185], expected 107, is " - << last_msg_->rle_list[185]; - EXPECT_EQ(get_asrle_list[186])>( - reinterpret_cast(&last_msg_->rle_list[186])), - 144) - << "incorrect value for rle_list[186], expected 144, is " - << last_msg_->rle_list[186]; - EXPECT_EQ(get_asrle_list[187])>( - reinterpret_cast(&last_msg_->rle_list[187])), - 11) - << "incorrect value for rle_list[187], expected 11, is " - << last_msg_->rle_list[187]; - EXPECT_EQ(get_asrle_list[188])>( - reinterpret_cast(&last_msg_->rle_list[188])), - 228) - << "incorrect value for rle_list[188], expected 228, is " - << last_msg_->rle_list[188]; - EXPECT_EQ(get_asrle_list[189])>( - reinterpret_cast(&last_msg_->rle_list[189])), - 12) - << "incorrect value for rle_list[189], expected 12, is " - << last_msg_->rle_list[189]; - EXPECT_EQ(get_asrle_list[190])>( - reinterpret_cast(&last_msg_->rle_list[190])), - 163) - << "incorrect value for rle_list[190], expected 163, is " - << last_msg_->rle_list[190]; - EXPECT_EQ(get_asrle_list[191])>( - reinterpret_cast(&last_msg_->rle_list[191])), - 238) - << "incorrect value for rle_list[191], expected 238, is " - << last_msg_->rle_list[191]; - EXPECT_EQ(get_asrle_list[192])>( - reinterpret_cast(&last_msg_->rle_list[192])), - 247) - << "incorrect value for rle_list[192], expected 247, is " - << last_msg_->rle_list[192]; - EXPECT_EQ(get_asrle_list[193])>( - reinterpret_cast(&last_msg_->rle_list[193])), - 159) - << "incorrect value for rle_list[193], expected 159, is " - << last_msg_->rle_list[193]; - EXPECT_EQ(get_asrle_list[194])>( - reinterpret_cast(&last_msg_->rle_list[194])), - 189) - << "incorrect value for rle_list[194], expected 189, is " - << last_msg_->rle_list[194]; - EXPECT_EQ(get_asrle_list[195])>( - reinterpret_cast(&last_msg_->rle_list[195])), - 1) - << "incorrect value for rle_list[195], expected 1, is " - << last_msg_->rle_list[195]; - EXPECT_EQ(get_asrle_list[196])>( - reinterpret_cast(&last_msg_->rle_list[196])), - 115) - << "incorrect value for rle_list[196], expected 115, is " - << last_msg_->rle_list[196]; - EXPECT_EQ(get_asrle_list[197])>( - reinterpret_cast(&last_msg_->rle_list[197])), - 65) - << "incorrect value for rle_list[197], expected 65, is " - << last_msg_->rle_list[197]; - EXPECT_EQ(get_asrle_list[198])>( - reinterpret_cast(&last_msg_->rle_list[198])), - 202) - << "incorrect value for rle_list[198], expected 202, is " - << last_msg_->rle_list[198]; - EXPECT_EQ(get_asrle_list[199])>( - reinterpret_cast(&last_msg_->rle_list[199])), - 121) - << "incorrect value for rle_list[199], expected 121, is " - << last_msg_->rle_list[199]; - EXPECT_EQ(get_asrle_list[200])>( - reinterpret_cast(&last_msg_->rle_list[200])), - 47) - << "incorrect value for rle_list[200], expected 47, is " - << last_msg_->rle_list[200]; - EXPECT_EQ(get_asrle_list[201])>( - reinterpret_cast(&last_msg_->rle_list[201])), - 193) - << "incorrect value for rle_list[201], expected 193, is " - << last_msg_->rle_list[201]; - EXPECT_EQ(get_asrle_list[202])>( - reinterpret_cast(&last_msg_->rle_list[202])), - 11) - << "incorrect value for rle_list[202], expected 11, is " - << last_msg_->rle_list[202]; - EXPECT_EQ(get_asrle_list[203])>( - reinterpret_cast(&last_msg_->rle_list[203])), - 96) - << "incorrect value for rle_list[203], expected 96, is " - << last_msg_->rle_list[203]; - EXPECT_EQ(get_asrle_list[204])>( - reinterpret_cast(&last_msg_->rle_list[204])), - 93) - << "incorrect value for rle_list[204], expected 93, is " - << last_msg_->rle_list[204]; - EXPECT_EQ(get_asrle_list[205])>( - reinterpret_cast(&last_msg_->rle_list[205])), - 72) - << "incorrect value for rle_list[205], expected 72, is " - << last_msg_->rle_list[205]; - EXPECT_EQ(get_asrle_list[206])>( - reinterpret_cast(&last_msg_->rle_list[206])), - 81) - << "incorrect value for rle_list[206], expected 81, is " - << last_msg_->rle_list[206]; - EXPECT_EQ(get_asrle_list[207])>( - reinterpret_cast(&last_msg_->rle_list[207])), - 207) - << "incorrect value for rle_list[207], expected 207, is " - << last_msg_->rle_list[207]; - EXPECT_EQ(get_asrle_list[208])>( - reinterpret_cast(&last_msg_->rle_list[208])), - 121) - << "incorrect value for rle_list[208], expected 121, is " - << last_msg_->rle_list[208]; - EXPECT_EQ(get_asrle_list[209])>( - reinterpret_cast(&last_msg_->rle_list[209])), - 19) - << "incorrect value for rle_list[209], expected 19, is " - << last_msg_->rle_list[209]; - EXPECT_EQ(get_asrle_list[210])>( - reinterpret_cast(&last_msg_->rle_list[210])), - 151) - << "incorrect value for rle_list[210], expected 151, is " - << last_msg_->rle_list[210]; - EXPECT_EQ(get_asrle_list[211])>( - reinterpret_cast(&last_msg_->rle_list[211])), - 136) - << "incorrect value for rle_list[211], expected 136, is " - << last_msg_->rle_list[211]; - EXPECT_EQ(get_asrle_list[212])>( - reinterpret_cast(&last_msg_->rle_list[212])), - 233) - << "incorrect value for rle_list[212], expected 233, is " - << last_msg_->rle_list[212]; - EXPECT_EQ(get_asrle_list[213])>( - reinterpret_cast(&last_msg_->rle_list[213])), - 51) - << "incorrect value for rle_list[213], expected 51, is " - << last_msg_->rle_list[213]; - EXPECT_EQ(get_asrle_list[214])>( - reinterpret_cast(&last_msg_->rle_list[214])), - 133) - << "incorrect value for rle_list[214], expected 133, is " - << last_msg_->rle_list[214]; - EXPECT_EQ(get_asrle_list[215])>( - reinterpret_cast(&last_msg_->rle_list[215])), - 195) - << "incorrect value for rle_list[215], expected 195, is " - << last_msg_->rle_list[215]; - EXPECT_EQ(get_asrle_list[216])>( - reinterpret_cast(&last_msg_->rle_list[216])), - 77) - << "incorrect value for rle_list[216], expected 77, is " - << last_msg_->rle_list[216]; - EXPECT_EQ(get_asrle_list[217])>( - reinterpret_cast(&last_msg_->rle_list[217])), - 44) - << "incorrect value for rle_list[217], expected 44, is " - << last_msg_->rle_list[217]; - EXPECT_EQ(get_asrle_list[218])>( - reinterpret_cast(&last_msg_->rle_list[218])), - 147) - << "incorrect value for rle_list[218], expected 147, is " - << last_msg_->rle_list[218]; - EXPECT_EQ(get_asrle_list[219])>( - reinterpret_cast(&last_msg_->rle_list[219])), - 206) - << "incorrect value for rle_list[219], expected 206, is " - << last_msg_->rle_list[219]; - EXPECT_EQ(get_asrle_list[220])>( - reinterpret_cast(&last_msg_->rle_list[220])), - 120) - << "incorrect value for rle_list[220], expected 120, is " - << last_msg_->rle_list[220]; - EXPECT_EQ(get_asrle_list[221])>( - reinterpret_cast(&last_msg_->rle_list[221])), - 252) - << "incorrect value for rle_list[221], expected 252, is " - << last_msg_->rle_list[221]; - EXPECT_EQ(get_asrle_list[222])>( - reinterpret_cast(&last_msg_->rle_list[222])), - 77) - << "incorrect value for rle_list[222], expected 77, is " - << last_msg_->rle_list[222]; - EXPECT_EQ(get_asrle_list[223])>( - reinterpret_cast(&last_msg_->rle_list[223])), - 212) - << "incorrect value for rle_list[223], expected 212, is " - << last_msg_->rle_list[223]; - EXPECT_EQ(get_asrle_list[224])>( - reinterpret_cast(&last_msg_->rle_list[224])), - 68) - << "incorrect value for rle_list[224], expected 68, is " - << last_msg_->rle_list[224]; - EXPECT_EQ(get_asrle_list[225])>( - reinterpret_cast(&last_msg_->rle_list[225])), - 60) - << "incorrect value for rle_list[225], expected 60, is " - << last_msg_->rle_list[225]; - EXPECT_EQ(get_asrle_list[226])>( - reinterpret_cast(&last_msg_->rle_list[226])), - 206) - << "incorrect value for rle_list[226], expected 206, is " - << last_msg_->rle_list[226]; - EXPECT_EQ(get_asrle_list[227])>( - reinterpret_cast(&last_msg_->rle_list[227])), - 106) - << "incorrect value for rle_list[227], expected 106, is " - << last_msg_->rle_list[227]; - EXPECT_EQ(get_asrle_list[228])>( - reinterpret_cast(&last_msg_->rle_list[228])), - 207) - << "incorrect value for rle_list[228], expected 207, is " - << last_msg_->rle_list[228]; - EXPECT_EQ(get_asrle_list[229])>( - reinterpret_cast(&last_msg_->rle_list[229])), - 243) - << "incorrect value for rle_list[229], expected 243, is " - << last_msg_->rle_list[229]; - EXPECT_EQ(get_asrle_list[230])>( - reinterpret_cast(&last_msg_->rle_list[230])), - 158) - << "incorrect value for rle_list[230], expected 158, is " - << last_msg_->rle_list[230]; - EXPECT_EQ(get_asrle_list[231])>( - reinterpret_cast(&last_msg_->rle_list[231])), - 94) - << "incorrect value for rle_list[231], expected 94, is " - << last_msg_->rle_list[231]; - EXPECT_EQ(get_asrle_list[232])>( - reinterpret_cast(&last_msg_->rle_list[232])), - 6) - << "incorrect value for rle_list[232], expected 6, is " - << last_msg_->rle_list[232]; - EXPECT_EQ(get_asrle_list[233])>( - reinterpret_cast(&last_msg_->rle_list[233])), - 3) - << "incorrect value for rle_list[233], expected 3, is " - << last_msg_->rle_list[233]; - EXPECT_EQ(get_asrle_list[234])>( - reinterpret_cast(&last_msg_->rle_list[234])), - 205) - << "incorrect value for rle_list[234], expected 205, is " - << last_msg_->rle_list[234]; - EXPECT_EQ(get_asrle_list[235])>( - reinterpret_cast(&last_msg_->rle_list[235])), - 92) - << "incorrect value for rle_list[235], expected 92, is " - << last_msg_->rle_list[235]; - EXPECT_EQ(get_asrle_list[236])>( - reinterpret_cast(&last_msg_->rle_list[236])), - 84) - << "incorrect value for rle_list[236], expected 84, is " - << last_msg_->rle_list[236]; - EXPECT_EQ(get_asrle_list[237])>( - reinterpret_cast(&last_msg_->rle_list[237])), - 2) - << "incorrect value for rle_list[237], expected 2, is " - << last_msg_->rle_list[237]; - EXPECT_EQ(get_asrle_list[238])>( - reinterpret_cast(&last_msg_->rle_list[238])), - 220) - << "incorrect value for rle_list[238], expected 220, is " - << last_msg_->rle_list[238]; - EXPECT_EQ(get_asrle_list[239])>( - reinterpret_cast(&last_msg_->rle_list[239])), - 50) - << "incorrect value for rle_list[239], expected 50, is " - << last_msg_->rle_list[239]; - EXPECT_EQ(get_asrle_list[240])>( - reinterpret_cast(&last_msg_->rle_list[240])), - 61) - << "incorrect value for rle_list[240], expected 61, is " - << last_msg_->rle_list[240]; - EXPECT_EQ(get_asrle_list[241])>( - reinterpret_cast(&last_msg_->rle_list[241])), - 38) - << "incorrect value for rle_list[241], expected 38, is " - << last_msg_->rle_list[241]; - EXPECT_EQ(get_asrle_list[242])>( - reinterpret_cast(&last_msg_->rle_list[242])), - 141) - << "incorrect value for rle_list[242], expected 141, is " - << last_msg_->rle_list[242]; - EXPECT_EQ(get_asrle_list[243])>( - reinterpret_cast(&last_msg_->rle_list[243])), - 117) - << "incorrect value for rle_list[243], expected 117, is " - << last_msg_->rle_list[243]; - EXPECT_EQ(get_asrle_list[244])>( - reinterpret_cast(&last_msg_->rle_list[244])), - 108) - << "incorrect value for rle_list[244], expected 108, is " - << last_msg_->rle_list[244]; - EXPECT_EQ(get_asrle_list[245])>( - reinterpret_cast(&last_msg_->rle_list[245])), - 101) - << "incorrect value for rle_list[245], expected 101, is " - << last_msg_->rle_list[245]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrGriddedCorrection.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrGriddedCorrection.cc deleted file mode 100644 index 50a71bf14c..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrGriddedCorrection.cc +++ /dev/null @@ -1,1785 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrGriddedCorrection.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrection0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrection0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_gridded_correction_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_gridded_correction_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrection0, Test) { - uint8_t encoded_frame[] = { - 85, 252, 5, 196, 249, 253, 21, 14, 151, 50, 120, 133, 29, 151, 174, - 229, 151, 189, 204, 196, 105, 170, 120, 149, 169, 37, 244, 78, 72, 140, - 101, 2, 173, 88, 70, 180, 54, 152, 115, 78, 201, 161, 23, 135, 152, - 98, 61, 75, 178, 120, 229, 146, 55, 58, 169, 234, 230, 69, 172, 191, - 127, 146, 89, 150, 91, 111, 225, 41, 17, 119, 52, 166, 166, 120, 57, - 221, 12, 3, 156, 70, 156, 35, 127, 8, 127, 58, 128, 55, 115, 80, - 157, 122, 153, 124, 27, 128, 98, 103, 204, 75, 238, 128, 226, 148, 248, - 61, 216, 208, 149, 167, 224, 40, 144, 186, 157, 227, 72, 240, 100, 35, - 12, 212, 7, 59, 176, 81, 86, 27, 24, 155, 67, 43, 132, 45, 203, - 44, 6, 112, 183, 231, 176, 79, 194, 253, 247, 103, 91, 226, 116, 148, - 23, 62, 227, 240, 29, 219, 205, 18, 242, 207, 72, 71, 79, 37, 42, - 176, 201, 202, 91, 105, 115, 146, 59, 110, 44, 109, 128, 183, 185, 67, - 31, 165, 92, 79, 189, 180, 94, 7, 162, 121, 156, 210, 47, 7, 7, - 205, 174, 41, 241, 129, 210, 43, 101, 186, 208, 195, 226, 247, 187, 219, - 160, 120, 192, 102, 166, 42, 246, 173, 94, 102, 156, 222, 30, 35, 247, - 64, 189, 137, 204, 220, 32, 71, 222, 222, 201, 246, 3, 25, 45, 251, - 239, 115, 88, 218, 10, 209, 120, 65, 175, 131, 194, 41, 174, 137, 17, - 68, 28, 253, 42, 178, 35, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_gridded_correction_t *test_msg = - (msg_ssr_gridded_correction_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.iod_atmo = 170; - test_msg->header.num_msgs = 48535; - test_msg->header.seq_num = 50380; - test_msg->header.tile_id = 12951; - test_msg->header.tile_set_id = 3605; - test_msg->header.time.tow = 2535294328; - test_msg->header.time.wn = 58798; - test_msg->header.tropo_quality_indicator = 120; - test_msg->header.update_interval = 105; - test_msg->index = 43413; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[0].residual = -21246; - test_msg->stec_residuals[0].stddev = 88; - test_msg->stec_residuals[0].sv_id.constellation = 101; - test_msg->stec_residuals[0].sv_id.satId = 140; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[1].residual = -26570; - test_msg->stec_residuals[1].stddev = 115; - test_msg->stec_residuals[1].sv_id.constellation = 180; - test_msg->stec_residuals[1].sv_id.satId = 70; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[2].residual = 6049; - test_msg->stec_residuals[2].stddev = 135; - test_msg->stec_residuals[2].sv_id.constellation = 201; - test_msg->stec_residuals[2].sv_id.satId = 78; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[3].residual = 19261; - test_msg->stec_residuals[3].stddev = 178; - test_msg->stec_residuals[3].sv_id.constellation = 98; - test_msg->stec_residuals[3].sv_id.satId = 152; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[4].residual = 14226; - test_msg->stec_residuals[4].stddev = 58; - test_msg->stec_residuals[4].sv_id.constellation = 229; - test_msg->stec_residuals[4].sv_id.satId = 120; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[5].residual = 17894; - test_msg->stec_residuals[5].stddev = 172; - test_msg->stec_residuals[5].sv_id.constellation = 234; - test_msg->stec_residuals[5].sv_id.satId = 169; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[6].residual = 22930; - test_msg->stec_residuals[6].stddev = 150; - test_msg->stec_residuals[6].sv_id.constellation = 127; - test_msg->stec_residuals[6].sv_id.satId = 191; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[7].residual = 10721; - test_msg->stec_residuals[7].stddev = 17; - test_msg->stec_residuals[7].sv_id.constellation = 111; - test_msg->stec_residuals[7].sv_id.satId = 91; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[8].residual = -22874; - test_msg->stec_residuals[8].stddev = 120; - test_msg->stec_residuals[8].sv_id.constellation = 52; - test_msg->stec_residuals[8].sv_id.satId = 119; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[9].residual = 780; - test_msg->stec_residuals[9].stddev = 156; - test_msg->stec_residuals[9].sv_id.constellation = 221; - test_msg->stec_residuals[9].sv_id.satId = 57; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[10].residual = 32547; - test_msg->stec_residuals[10].stddev = 8; - test_msg->stec_residuals[10].sv_id.constellation = 156; - test_msg->stec_residuals[10].sv_id.satId = 70; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[11].residual = 14208; - test_msg->stec_residuals[11].stddev = 115; - test_msg->stec_residuals[11].sv_id.constellation = 58; - test_msg->stec_residuals[11].sv_id.satId = 127; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[12].residual = -26246; - test_msg->stec_residuals[12].stddev = 124; - test_msg->stec_residuals[12].sv_id.constellation = 157; - test_msg->stec_residuals[12].sv_id.satId = 80; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[13].residual = 26466; - test_msg->stec_residuals[13].stddev = 204; - test_msg->stec_residuals[13].sv_id.constellation = 128; - test_msg->stec_residuals[13].sv_id.satId = 27; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[14].residual = -7552; - test_msg->stec_residuals[14].stddev = 148; - test_msg->stec_residuals[14].sv_id.constellation = 238; - test_msg->stec_residuals[14].sv_id.satId = 75; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[15].residual = -12072; - test_msg->stec_residuals[15].stddev = 149; - test_msg->stec_residuals[15].sv_id.constellation = 61; - test_msg->stec_residuals[15].sv_id.satId = 248; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[16].residual = -28632; - test_msg->stec_residuals[16].stddev = 186; - test_msg->stec_residuals[16].sv_id.constellation = 224; - test_msg->stec_residuals[16].sv_id.satId = 167; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[17].residual = -4024; - test_msg->stec_residuals[17].stddev = 100; - test_msg->stec_residuals[17].sv_id.constellation = 227; - test_msg->stec_residuals[17].sv_id.satId = 157; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[18].residual = 2004; - test_msg->stec_residuals[18].stddev = 59; - test_msg->stec_residuals[18].sv_id.constellation = 12; - test_msg->stec_residuals[18].sv_id.satId = 35; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[19].residual = 6998; - test_msg->stec_residuals[19].stddev = 24; - test_msg->stec_residuals[19].sv_id.constellation = 81; - test_msg->stec_residuals[19].sv_id.satId = 176; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[20].residual = -31701; - test_msg->stec_residuals[20].stddev = 45; - test_msg->stec_residuals[20].sv_id.constellation = 67; - test_msg->stec_residuals[20].sv_id.satId = 155; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[21].residual = 28678; - test_msg->stec_residuals[21].stddev = 183; - test_msg->stec_residuals[21].sv_id.constellation = 44; - test_msg->stec_residuals[21].sv_id.satId = 203; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[22].residual = -15793; - test_msg->stec_residuals[22].stddev = 253; - test_msg->stec_residuals[22].sv_id.constellation = 176; - test_msg->stec_residuals[22].sv_id.satId = 231; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[23].residual = -7589; - test_msg->stec_residuals[23].stddev = 116; - test_msg->stec_residuals[23].sv_id.constellation = 103; - test_msg->stec_residuals[23].sv_id.satId = 247; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[24].residual = -7362; - test_msg->stec_residuals[24].stddev = 240; - test_msg->stec_residuals[24].sv_id.constellation = 23; - test_msg->stec_residuals[24].sv_id.satId = 148; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[25].residual = 4813; - test_msg->stec_residuals[25].stddev = 242; - test_msg->stec_residuals[25].sv_id.constellation = 219; - test_msg->stec_residuals[25].sv_id.satId = 29; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[26].residual = 20295; - test_msg->stec_residuals[26].stddev = 37; - test_msg->stec_residuals[26].sv_id.constellation = 72; - test_msg->stec_residuals[26].sv_id.satId = 207; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[27].residual = -13623; - test_msg->stec_residuals[27].stddev = 91; - test_msg->stec_residuals[27].sv_id.constellation = 176; - test_msg->stec_residuals[27].sv_id.satId = 42; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[28].residual = 15250; - test_msg->stec_residuals[28].stddev = 110; - test_msg->stec_residuals[28].sv_id.constellation = 115; - test_msg->stec_residuals[28].sv_id.satId = 105; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[29].residual = -18560; - test_msg->stec_residuals[29].stddev = 185; - test_msg->stec_residuals[29].sv_id.constellation = 109; - test_msg->stec_residuals[29].sv_id.satId = 44; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[30].residual = 23717; - test_msg->stec_residuals[30].stddev = 79; - test_msg->stec_residuals[30].sv_id.constellation = 31; - test_msg->stec_residuals[30].sv_id.satId = 67; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[31].residual = 1886; - test_msg->stec_residuals[31].stddev = 162; - test_msg->stec_residuals[31].sv_id.constellation = 180; - test_msg->stec_residuals[31].sv_id.satId = 189; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[32].residual = 12242; - test_msg->stec_residuals[32].stddev = 7; - test_msg->stec_residuals[32].sv_id.constellation = 156; - test_msg->stec_residuals[32].sv_id.satId = 121; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[33].residual = 10670; - test_msg->stec_residuals[33].stddev = 241; - test_msg->stec_residuals[33].sv_id.constellation = 205; - test_msg->stec_residuals[33].sv_id.satId = 7; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[34].residual = 25899; - test_msg->stec_residuals[34].stddev = 186; - test_msg->stec_residuals[34].sv_id.constellation = 210; - test_msg->stec_residuals[34].sv_id.satId = 129; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[35].residual = -2078; - test_msg->stec_residuals[35].stddev = 187; - test_msg->stec_residuals[35].sv_id.constellation = 195; - test_msg->stec_residuals[35].sv_id.satId = 208; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[36].residual = -16264; - test_msg->stec_residuals[36].stddev = 102; - test_msg->stec_residuals[36].sv_id.constellation = 160; - test_msg->stec_residuals[36].sv_id.satId = 219; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[37].residual = -21002; - test_msg->stec_residuals[37].stddev = 94; - test_msg->stec_residuals[37].sv_id.constellation = 42; - test_msg->stec_residuals[37].sv_id.satId = 166; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[38].residual = 7902; - test_msg->stec_residuals[38].stddev = 35; - test_msg->stec_residuals[38].sv_id.constellation = 156; - test_msg->stec_residuals[38].sv_id.satId = 102; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[39].residual = -30275; - test_msg->stec_residuals[39].stddev = 204; - test_msg->stec_residuals[39].sv_id.constellation = 64; - test_msg->stec_residuals[39].sv_id.satId = 247; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[40].residual = -8633; - test_msg->stec_residuals[40].stddev = 222; - test_msg->stec_residuals[40].sv_id.constellation = 32; - test_msg->stec_residuals[40].sv_id.satId = 220; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[41].residual = 6403; - test_msg->stec_residuals[41].stddev = 45; - test_msg->stec_residuals[41].sv_id.constellation = 246; - test_msg->stec_residuals[41].sv_id.satId = 201; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[42].residual = 22643; - test_msg->stec_residuals[42].stddev = 218; - test_msg->stec_residuals[42].sv_id.constellation = 239; - test_msg->stec_residuals[42].sv_id.satId = 251; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[43].residual = 16760; - test_msg->stec_residuals[43].stddev = 175; - test_msg->stec_residuals[43].sv_id.constellation = 209; - test_msg->stec_residuals[43].sv_id.satId = 10; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[44].residual = -20951; - test_msg->stec_residuals[44].stddev = 137; - test_msg->stec_residuals[44].sv_id.constellation = 194; - test_msg->stec_residuals[44].sv_id.satId = 131; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[45].residual = -740; - test_msg->stec_residuals[45].stddev = 42; - test_msg->stec_residuals[45].sv_id.constellation = 68; - test_msg->stec_residuals[45].sv_id.satId = 17; - test_msg->tropo_delay_correction.hydro = -3035; - test_msg->tropo_delay_correction.stddev = 72; - test_msg->tropo_delay_correction.wet = 78; - - EXPECT_EQ(send_message(0x5fc, 63940, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 63940); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.iod_atmo)>( - reinterpret_cast(&last_msg_->header.iod_atmo)), - 170) - << "incorrect value for header.iod_atmo, expected 170, is " - << last_msg_->header.iod_atmo; - EXPECT_EQ(get_asheader.num_msgs)>( - reinterpret_cast(&last_msg_->header.num_msgs)), - 48535) - << "incorrect value for header.num_msgs, expected 48535, is " - << last_msg_->header.num_msgs; - EXPECT_EQ(get_asheader.seq_num)>( - reinterpret_cast(&last_msg_->header.seq_num)), - 50380) - << "incorrect value for header.seq_num, expected 50380, is " - << last_msg_->header.seq_num; - EXPECT_EQ(get_asheader.tile_id)>( - reinterpret_cast(&last_msg_->header.tile_id)), - 12951) - << "incorrect value for header.tile_id, expected 12951, is " - << last_msg_->header.tile_id; - EXPECT_EQ( - get_asheader.tile_set_id)>( - reinterpret_cast(&last_msg_->header.tile_set_id)), - 3605) - << "incorrect value for header.tile_set_id, expected 3605, is " - << last_msg_->header.tile_set_id; - EXPECT_EQ(get_asheader.time.tow)>( - reinterpret_cast(&last_msg_->header.time.tow)), - 2535294328) - << "incorrect value for header.time.tow, expected 2535294328, is " - << last_msg_->header.time.tow; - EXPECT_EQ(get_asheader.time.wn)>( - reinterpret_cast(&last_msg_->header.time.wn)), - 58798) - << "incorrect value for header.time.wn, expected 58798, is " - << last_msg_->header.time.wn; - EXPECT_EQ(get_asheader.tropo_quality_indicator)>( - reinterpret_cast( - &last_msg_->header.tropo_quality_indicator)), - 120) - << "incorrect value for header.tropo_quality_indicator, expected 120, is " - << last_msg_->header.tropo_quality_indicator; - EXPECT_EQ(get_asheader.update_interval)>( - reinterpret_cast( - &last_msg_->header.update_interval)), - 105) - << "incorrect value for header.update_interval, expected 105, is " - << last_msg_->header.update_interval; - EXPECT_EQ(get_asindex)>( - reinterpret_cast(&last_msg_->index)), - 43413) - << "incorrect value for index, expected 43413, is " << last_msg_->index; - EXPECT_EQ(get_asstec_residuals[0].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[0].residual)), - -21246) - << "incorrect value for stec_residuals[0].residual, expected -21246, is " - << last_msg_->stec_residuals[0].residual; - EXPECT_EQ(get_asstec_residuals[0].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[0].stddev)), - 88) - << "incorrect value for stec_residuals[0].stddev, expected 88, is " - << last_msg_->stec_residuals[0].stddev; - EXPECT_EQ(get_asstec_residuals[0].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[0].sv_id.constellation)), - 101) - << "incorrect value for stec_residuals[0].sv_id.constellation, expected " - "101, is " - << last_msg_->stec_residuals[0].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[0].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[0].sv_id.satId)), - 140) - << "incorrect value for stec_residuals[0].sv_id.satId, expected 140, is " - << last_msg_->stec_residuals[0].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[1].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[1].residual)), - -26570) - << "incorrect value for stec_residuals[1].residual, expected -26570, is " - << last_msg_->stec_residuals[1].residual; - EXPECT_EQ(get_asstec_residuals[1].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[1].stddev)), - 115) - << "incorrect value for stec_residuals[1].stddev, expected 115, is " - << last_msg_->stec_residuals[1].stddev; - EXPECT_EQ(get_asstec_residuals[1].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[1].sv_id.constellation)), - 180) - << "incorrect value for stec_residuals[1].sv_id.constellation, expected " - "180, is " - << last_msg_->stec_residuals[1].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[1].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[1].sv_id.satId)), - 70) - << "incorrect value for stec_residuals[1].sv_id.satId, expected 70, is " - << last_msg_->stec_residuals[1].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[2].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[2].residual)), - 6049) - << "incorrect value for stec_residuals[2].residual, expected 6049, is " - << last_msg_->stec_residuals[2].residual; - EXPECT_EQ(get_asstec_residuals[2].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[2].stddev)), - 135) - << "incorrect value for stec_residuals[2].stddev, expected 135, is " - << last_msg_->stec_residuals[2].stddev; - EXPECT_EQ(get_asstec_residuals[2].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[2].sv_id.constellation)), - 201) - << "incorrect value for stec_residuals[2].sv_id.constellation, expected " - "201, is " - << last_msg_->stec_residuals[2].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[2].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[2].sv_id.satId)), - 78) - << "incorrect value for stec_residuals[2].sv_id.satId, expected 78, is " - << last_msg_->stec_residuals[2].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[3].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[3].residual)), - 19261) - << "incorrect value for stec_residuals[3].residual, expected 19261, is " - << last_msg_->stec_residuals[3].residual; - EXPECT_EQ(get_asstec_residuals[3].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[3].stddev)), - 178) - << "incorrect value for stec_residuals[3].stddev, expected 178, is " - << last_msg_->stec_residuals[3].stddev; - EXPECT_EQ(get_asstec_residuals[3].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[3].sv_id.constellation)), - 98) - << "incorrect value for stec_residuals[3].sv_id.constellation, expected " - "98, is " - << last_msg_->stec_residuals[3].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[3].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[3].sv_id.satId)), - 152) - << "incorrect value for stec_residuals[3].sv_id.satId, expected 152, is " - << last_msg_->stec_residuals[3].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[4].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[4].residual)), - 14226) - << "incorrect value for stec_residuals[4].residual, expected 14226, is " - << last_msg_->stec_residuals[4].residual; - EXPECT_EQ(get_asstec_residuals[4].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[4].stddev)), - 58) - << "incorrect value for stec_residuals[4].stddev, expected 58, is " - << last_msg_->stec_residuals[4].stddev; - EXPECT_EQ(get_asstec_residuals[4].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[4].sv_id.constellation)), - 229) - << "incorrect value for stec_residuals[4].sv_id.constellation, expected " - "229, is " - << last_msg_->stec_residuals[4].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[4].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[4].sv_id.satId)), - 120) - << "incorrect value for stec_residuals[4].sv_id.satId, expected 120, is " - << last_msg_->stec_residuals[4].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[5].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[5].residual)), - 17894) - << "incorrect value for stec_residuals[5].residual, expected 17894, is " - << last_msg_->stec_residuals[5].residual; - EXPECT_EQ(get_asstec_residuals[5].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[5].stddev)), - 172) - << "incorrect value for stec_residuals[5].stddev, expected 172, is " - << last_msg_->stec_residuals[5].stddev; - EXPECT_EQ(get_asstec_residuals[5].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[5].sv_id.constellation)), - 234) - << "incorrect value for stec_residuals[5].sv_id.constellation, expected " - "234, is " - << last_msg_->stec_residuals[5].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[5].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[5].sv_id.satId)), - 169) - << "incorrect value for stec_residuals[5].sv_id.satId, expected 169, is " - << last_msg_->stec_residuals[5].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[6].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[6].residual)), - 22930) - << "incorrect value for stec_residuals[6].residual, expected 22930, is " - << last_msg_->stec_residuals[6].residual; - EXPECT_EQ(get_asstec_residuals[6].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[6].stddev)), - 150) - << "incorrect value for stec_residuals[6].stddev, expected 150, is " - << last_msg_->stec_residuals[6].stddev; - EXPECT_EQ(get_asstec_residuals[6].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[6].sv_id.constellation)), - 127) - << "incorrect value for stec_residuals[6].sv_id.constellation, expected " - "127, is " - << last_msg_->stec_residuals[6].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[6].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[6].sv_id.satId)), - 191) - << "incorrect value for stec_residuals[6].sv_id.satId, expected 191, is " - << last_msg_->stec_residuals[6].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[7].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[7].residual)), - 10721) - << "incorrect value for stec_residuals[7].residual, expected 10721, is " - << last_msg_->stec_residuals[7].residual; - EXPECT_EQ(get_asstec_residuals[7].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[7].stddev)), - 17) - << "incorrect value for stec_residuals[7].stddev, expected 17, is " - << last_msg_->stec_residuals[7].stddev; - EXPECT_EQ(get_asstec_residuals[7].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[7].sv_id.constellation)), - 111) - << "incorrect value for stec_residuals[7].sv_id.constellation, expected " - "111, is " - << last_msg_->stec_residuals[7].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[7].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[7].sv_id.satId)), - 91) - << "incorrect value for stec_residuals[7].sv_id.satId, expected 91, is " - << last_msg_->stec_residuals[7].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[8].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[8].residual)), - -22874) - << "incorrect value for stec_residuals[8].residual, expected -22874, is " - << last_msg_->stec_residuals[8].residual; - EXPECT_EQ(get_asstec_residuals[8].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[8].stddev)), - 120) - << "incorrect value for stec_residuals[8].stddev, expected 120, is " - << last_msg_->stec_residuals[8].stddev; - EXPECT_EQ(get_asstec_residuals[8].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[8].sv_id.constellation)), - 52) - << "incorrect value for stec_residuals[8].sv_id.constellation, expected " - "52, is " - << last_msg_->stec_residuals[8].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[8].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[8].sv_id.satId)), - 119) - << "incorrect value for stec_residuals[8].sv_id.satId, expected 119, is " - << last_msg_->stec_residuals[8].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[9].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[9].residual)), - 780) - << "incorrect value for stec_residuals[9].residual, expected 780, is " - << last_msg_->stec_residuals[9].residual; - EXPECT_EQ(get_asstec_residuals[9].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[9].stddev)), - 156) - << "incorrect value for stec_residuals[9].stddev, expected 156, is " - << last_msg_->stec_residuals[9].stddev; - EXPECT_EQ(get_asstec_residuals[9].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[9].sv_id.constellation)), - 221) - << "incorrect value for stec_residuals[9].sv_id.constellation, expected " - "221, is " - << last_msg_->stec_residuals[9].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[9].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[9].sv_id.satId)), - 57) - << "incorrect value for stec_residuals[9].sv_id.satId, expected 57, is " - << last_msg_->stec_residuals[9].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[10].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[10].residual)), - 32547) - << "incorrect value for stec_residuals[10].residual, expected 32547, is " - << last_msg_->stec_residuals[10].residual; - EXPECT_EQ(get_asstec_residuals[10].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[10].stddev)), - 8) - << "incorrect value for stec_residuals[10].stddev, expected 8, is " - << last_msg_->stec_residuals[10].stddev; - EXPECT_EQ(get_asstec_residuals[10].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[10].sv_id.constellation)), - 156) - << "incorrect value for stec_residuals[10].sv_id.constellation, expected " - "156, is " - << last_msg_->stec_residuals[10].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[10].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[10].sv_id.satId)), - 70) - << "incorrect value for stec_residuals[10].sv_id.satId, expected 70, is " - << last_msg_->stec_residuals[10].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[11].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[11].residual)), - 14208) - << "incorrect value for stec_residuals[11].residual, expected 14208, is " - << last_msg_->stec_residuals[11].residual; - EXPECT_EQ(get_asstec_residuals[11].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[11].stddev)), - 115) - << "incorrect value for stec_residuals[11].stddev, expected 115, is " - << last_msg_->stec_residuals[11].stddev; - EXPECT_EQ(get_asstec_residuals[11].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[11].sv_id.constellation)), - 58) - << "incorrect value for stec_residuals[11].sv_id.constellation, expected " - "58, is " - << last_msg_->stec_residuals[11].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[11].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[11].sv_id.satId)), - 127) - << "incorrect value for stec_residuals[11].sv_id.satId, expected 127, is " - << last_msg_->stec_residuals[11].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[12].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[12].residual)), - -26246) - << "incorrect value for stec_residuals[12].residual, expected -26246, is " - << last_msg_->stec_residuals[12].residual; - EXPECT_EQ(get_asstec_residuals[12].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[12].stddev)), - 124) - << "incorrect value for stec_residuals[12].stddev, expected 124, is " - << last_msg_->stec_residuals[12].stddev; - EXPECT_EQ(get_asstec_residuals[12].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[12].sv_id.constellation)), - 157) - << "incorrect value for stec_residuals[12].sv_id.constellation, expected " - "157, is " - << last_msg_->stec_residuals[12].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[12].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[12].sv_id.satId)), - 80) - << "incorrect value for stec_residuals[12].sv_id.satId, expected 80, is " - << last_msg_->stec_residuals[12].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[13].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[13].residual)), - 26466) - << "incorrect value for stec_residuals[13].residual, expected 26466, is " - << last_msg_->stec_residuals[13].residual; - EXPECT_EQ(get_asstec_residuals[13].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[13].stddev)), - 204) - << "incorrect value for stec_residuals[13].stddev, expected 204, is " - << last_msg_->stec_residuals[13].stddev; - EXPECT_EQ(get_asstec_residuals[13].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[13].sv_id.constellation)), - 128) - << "incorrect value for stec_residuals[13].sv_id.constellation, expected " - "128, is " - << last_msg_->stec_residuals[13].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[13].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[13].sv_id.satId)), - 27) - << "incorrect value for stec_residuals[13].sv_id.satId, expected 27, is " - << last_msg_->stec_residuals[13].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[14].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[14].residual)), - -7552) - << "incorrect value for stec_residuals[14].residual, expected -7552, is " - << last_msg_->stec_residuals[14].residual; - EXPECT_EQ(get_asstec_residuals[14].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[14].stddev)), - 148) - << "incorrect value for stec_residuals[14].stddev, expected 148, is " - << last_msg_->stec_residuals[14].stddev; - EXPECT_EQ(get_asstec_residuals[14].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[14].sv_id.constellation)), - 238) - << "incorrect value for stec_residuals[14].sv_id.constellation, expected " - "238, is " - << last_msg_->stec_residuals[14].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[14].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[14].sv_id.satId)), - 75) - << "incorrect value for stec_residuals[14].sv_id.satId, expected 75, is " - << last_msg_->stec_residuals[14].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[15].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[15].residual)), - -12072) - << "incorrect value for stec_residuals[15].residual, expected -12072, is " - << last_msg_->stec_residuals[15].residual; - EXPECT_EQ(get_asstec_residuals[15].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[15].stddev)), - 149) - << "incorrect value for stec_residuals[15].stddev, expected 149, is " - << last_msg_->stec_residuals[15].stddev; - EXPECT_EQ(get_asstec_residuals[15].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[15].sv_id.constellation)), - 61) - << "incorrect value for stec_residuals[15].sv_id.constellation, expected " - "61, is " - << last_msg_->stec_residuals[15].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[15].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[15].sv_id.satId)), - 248) - << "incorrect value for stec_residuals[15].sv_id.satId, expected 248, is " - << last_msg_->stec_residuals[15].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[16].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[16].residual)), - -28632) - << "incorrect value for stec_residuals[16].residual, expected -28632, is " - << last_msg_->stec_residuals[16].residual; - EXPECT_EQ(get_asstec_residuals[16].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[16].stddev)), - 186) - << "incorrect value for stec_residuals[16].stddev, expected 186, is " - << last_msg_->stec_residuals[16].stddev; - EXPECT_EQ(get_asstec_residuals[16].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[16].sv_id.constellation)), - 224) - << "incorrect value for stec_residuals[16].sv_id.constellation, expected " - "224, is " - << last_msg_->stec_residuals[16].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[16].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[16].sv_id.satId)), - 167) - << "incorrect value for stec_residuals[16].sv_id.satId, expected 167, is " - << last_msg_->stec_residuals[16].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[17].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[17].residual)), - -4024) - << "incorrect value for stec_residuals[17].residual, expected -4024, is " - << last_msg_->stec_residuals[17].residual; - EXPECT_EQ(get_asstec_residuals[17].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[17].stddev)), - 100) - << "incorrect value for stec_residuals[17].stddev, expected 100, is " - << last_msg_->stec_residuals[17].stddev; - EXPECT_EQ(get_asstec_residuals[17].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[17].sv_id.constellation)), - 227) - << "incorrect value for stec_residuals[17].sv_id.constellation, expected " - "227, is " - << last_msg_->stec_residuals[17].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[17].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[17].sv_id.satId)), - 157) - << "incorrect value for stec_residuals[17].sv_id.satId, expected 157, is " - << last_msg_->stec_residuals[17].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[18].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[18].residual)), - 2004) - << "incorrect value for stec_residuals[18].residual, expected 2004, is " - << last_msg_->stec_residuals[18].residual; - EXPECT_EQ(get_asstec_residuals[18].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[18].stddev)), - 59) - << "incorrect value for stec_residuals[18].stddev, expected 59, is " - << last_msg_->stec_residuals[18].stddev; - EXPECT_EQ(get_asstec_residuals[18].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[18].sv_id.constellation)), - 12) - << "incorrect value for stec_residuals[18].sv_id.constellation, expected " - "12, is " - << last_msg_->stec_residuals[18].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[18].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[18].sv_id.satId)), - 35) - << "incorrect value for stec_residuals[18].sv_id.satId, expected 35, is " - << last_msg_->stec_residuals[18].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[19].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[19].residual)), - 6998) - << "incorrect value for stec_residuals[19].residual, expected 6998, is " - << last_msg_->stec_residuals[19].residual; - EXPECT_EQ(get_asstec_residuals[19].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[19].stddev)), - 24) - << "incorrect value for stec_residuals[19].stddev, expected 24, is " - << last_msg_->stec_residuals[19].stddev; - EXPECT_EQ(get_asstec_residuals[19].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[19].sv_id.constellation)), - 81) - << "incorrect value for stec_residuals[19].sv_id.constellation, expected " - "81, is " - << last_msg_->stec_residuals[19].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[19].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[19].sv_id.satId)), - 176) - << "incorrect value for stec_residuals[19].sv_id.satId, expected 176, is " - << last_msg_->stec_residuals[19].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[20].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[20].residual)), - -31701) - << "incorrect value for stec_residuals[20].residual, expected -31701, is " - << last_msg_->stec_residuals[20].residual; - EXPECT_EQ(get_asstec_residuals[20].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[20].stddev)), - 45) - << "incorrect value for stec_residuals[20].stddev, expected 45, is " - << last_msg_->stec_residuals[20].stddev; - EXPECT_EQ(get_asstec_residuals[20].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[20].sv_id.constellation)), - 67) - << "incorrect value for stec_residuals[20].sv_id.constellation, expected " - "67, is " - << last_msg_->stec_residuals[20].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[20].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[20].sv_id.satId)), - 155) - << "incorrect value for stec_residuals[20].sv_id.satId, expected 155, is " - << last_msg_->stec_residuals[20].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[21].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[21].residual)), - 28678) - << "incorrect value for stec_residuals[21].residual, expected 28678, is " - << last_msg_->stec_residuals[21].residual; - EXPECT_EQ(get_asstec_residuals[21].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[21].stddev)), - 183) - << "incorrect value for stec_residuals[21].stddev, expected 183, is " - << last_msg_->stec_residuals[21].stddev; - EXPECT_EQ(get_asstec_residuals[21].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[21].sv_id.constellation)), - 44) - << "incorrect value for stec_residuals[21].sv_id.constellation, expected " - "44, is " - << last_msg_->stec_residuals[21].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[21].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[21].sv_id.satId)), - 203) - << "incorrect value for stec_residuals[21].sv_id.satId, expected 203, is " - << last_msg_->stec_residuals[21].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[22].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[22].residual)), - -15793) - << "incorrect value for stec_residuals[22].residual, expected -15793, is " - << last_msg_->stec_residuals[22].residual; - EXPECT_EQ(get_asstec_residuals[22].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[22].stddev)), - 253) - << "incorrect value for stec_residuals[22].stddev, expected 253, is " - << last_msg_->stec_residuals[22].stddev; - EXPECT_EQ(get_asstec_residuals[22].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[22].sv_id.constellation)), - 176) - << "incorrect value for stec_residuals[22].sv_id.constellation, expected " - "176, is " - << last_msg_->stec_residuals[22].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[22].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[22].sv_id.satId)), - 231) - << "incorrect value for stec_residuals[22].sv_id.satId, expected 231, is " - << last_msg_->stec_residuals[22].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[23].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[23].residual)), - -7589) - << "incorrect value for stec_residuals[23].residual, expected -7589, is " - << last_msg_->stec_residuals[23].residual; - EXPECT_EQ(get_asstec_residuals[23].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[23].stddev)), - 116) - << "incorrect value for stec_residuals[23].stddev, expected 116, is " - << last_msg_->stec_residuals[23].stddev; - EXPECT_EQ(get_asstec_residuals[23].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[23].sv_id.constellation)), - 103) - << "incorrect value for stec_residuals[23].sv_id.constellation, expected " - "103, is " - << last_msg_->stec_residuals[23].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[23].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[23].sv_id.satId)), - 247) - << "incorrect value for stec_residuals[23].sv_id.satId, expected 247, is " - << last_msg_->stec_residuals[23].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[24].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[24].residual)), - -7362) - << "incorrect value for stec_residuals[24].residual, expected -7362, is " - << last_msg_->stec_residuals[24].residual; - EXPECT_EQ(get_asstec_residuals[24].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[24].stddev)), - 240) - << "incorrect value for stec_residuals[24].stddev, expected 240, is " - << last_msg_->stec_residuals[24].stddev; - EXPECT_EQ(get_asstec_residuals[24].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[24].sv_id.constellation)), - 23) - << "incorrect value for stec_residuals[24].sv_id.constellation, expected " - "23, is " - << last_msg_->stec_residuals[24].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[24].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[24].sv_id.satId)), - 148) - << "incorrect value for stec_residuals[24].sv_id.satId, expected 148, is " - << last_msg_->stec_residuals[24].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[25].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[25].residual)), - 4813) - << "incorrect value for stec_residuals[25].residual, expected 4813, is " - << last_msg_->stec_residuals[25].residual; - EXPECT_EQ(get_asstec_residuals[25].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[25].stddev)), - 242) - << "incorrect value for stec_residuals[25].stddev, expected 242, is " - << last_msg_->stec_residuals[25].stddev; - EXPECT_EQ(get_asstec_residuals[25].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[25].sv_id.constellation)), - 219) - << "incorrect value for stec_residuals[25].sv_id.constellation, expected " - "219, is " - << last_msg_->stec_residuals[25].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[25].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[25].sv_id.satId)), - 29) - << "incorrect value for stec_residuals[25].sv_id.satId, expected 29, is " - << last_msg_->stec_residuals[25].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[26].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[26].residual)), - 20295) - << "incorrect value for stec_residuals[26].residual, expected 20295, is " - << last_msg_->stec_residuals[26].residual; - EXPECT_EQ(get_asstec_residuals[26].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[26].stddev)), - 37) - << "incorrect value for stec_residuals[26].stddev, expected 37, is " - << last_msg_->stec_residuals[26].stddev; - EXPECT_EQ(get_asstec_residuals[26].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[26].sv_id.constellation)), - 72) - << "incorrect value for stec_residuals[26].sv_id.constellation, expected " - "72, is " - << last_msg_->stec_residuals[26].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[26].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[26].sv_id.satId)), - 207) - << "incorrect value for stec_residuals[26].sv_id.satId, expected 207, is " - << last_msg_->stec_residuals[26].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[27].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[27].residual)), - -13623) - << "incorrect value for stec_residuals[27].residual, expected -13623, is " - << last_msg_->stec_residuals[27].residual; - EXPECT_EQ(get_asstec_residuals[27].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[27].stddev)), - 91) - << "incorrect value for stec_residuals[27].stddev, expected 91, is " - << last_msg_->stec_residuals[27].stddev; - EXPECT_EQ(get_asstec_residuals[27].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[27].sv_id.constellation)), - 176) - << "incorrect value for stec_residuals[27].sv_id.constellation, expected " - "176, is " - << last_msg_->stec_residuals[27].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[27].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[27].sv_id.satId)), - 42) - << "incorrect value for stec_residuals[27].sv_id.satId, expected 42, is " - << last_msg_->stec_residuals[27].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[28].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[28].residual)), - 15250) - << "incorrect value for stec_residuals[28].residual, expected 15250, is " - << last_msg_->stec_residuals[28].residual; - EXPECT_EQ(get_asstec_residuals[28].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[28].stddev)), - 110) - << "incorrect value for stec_residuals[28].stddev, expected 110, is " - << last_msg_->stec_residuals[28].stddev; - EXPECT_EQ(get_asstec_residuals[28].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[28].sv_id.constellation)), - 115) - << "incorrect value for stec_residuals[28].sv_id.constellation, expected " - "115, is " - << last_msg_->stec_residuals[28].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[28].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[28].sv_id.satId)), - 105) - << "incorrect value for stec_residuals[28].sv_id.satId, expected 105, is " - << last_msg_->stec_residuals[28].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[29].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[29].residual)), - -18560) - << "incorrect value for stec_residuals[29].residual, expected -18560, is " - << last_msg_->stec_residuals[29].residual; - EXPECT_EQ(get_asstec_residuals[29].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[29].stddev)), - 185) - << "incorrect value for stec_residuals[29].stddev, expected 185, is " - << last_msg_->stec_residuals[29].stddev; - EXPECT_EQ(get_asstec_residuals[29].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[29].sv_id.constellation)), - 109) - << "incorrect value for stec_residuals[29].sv_id.constellation, expected " - "109, is " - << last_msg_->stec_residuals[29].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[29].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[29].sv_id.satId)), - 44) - << "incorrect value for stec_residuals[29].sv_id.satId, expected 44, is " - << last_msg_->stec_residuals[29].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[30].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[30].residual)), - 23717) - << "incorrect value for stec_residuals[30].residual, expected 23717, is " - << last_msg_->stec_residuals[30].residual; - EXPECT_EQ(get_asstec_residuals[30].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[30].stddev)), - 79) - << "incorrect value for stec_residuals[30].stddev, expected 79, is " - << last_msg_->stec_residuals[30].stddev; - EXPECT_EQ(get_asstec_residuals[30].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[30].sv_id.constellation)), - 31) - << "incorrect value for stec_residuals[30].sv_id.constellation, expected " - "31, is " - << last_msg_->stec_residuals[30].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[30].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[30].sv_id.satId)), - 67) - << "incorrect value for stec_residuals[30].sv_id.satId, expected 67, is " - << last_msg_->stec_residuals[30].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[31].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[31].residual)), - 1886) - << "incorrect value for stec_residuals[31].residual, expected 1886, is " - << last_msg_->stec_residuals[31].residual; - EXPECT_EQ(get_asstec_residuals[31].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[31].stddev)), - 162) - << "incorrect value for stec_residuals[31].stddev, expected 162, is " - << last_msg_->stec_residuals[31].stddev; - EXPECT_EQ(get_asstec_residuals[31].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[31].sv_id.constellation)), - 180) - << "incorrect value for stec_residuals[31].sv_id.constellation, expected " - "180, is " - << last_msg_->stec_residuals[31].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[31].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[31].sv_id.satId)), - 189) - << "incorrect value for stec_residuals[31].sv_id.satId, expected 189, is " - << last_msg_->stec_residuals[31].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[32].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[32].residual)), - 12242) - << "incorrect value for stec_residuals[32].residual, expected 12242, is " - << last_msg_->stec_residuals[32].residual; - EXPECT_EQ(get_asstec_residuals[32].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[32].stddev)), - 7) - << "incorrect value for stec_residuals[32].stddev, expected 7, is " - << last_msg_->stec_residuals[32].stddev; - EXPECT_EQ(get_asstec_residuals[32].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[32].sv_id.constellation)), - 156) - << "incorrect value for stec_residuals[32].sv_id.constellation, expected " - "156, is " - << last_msg_->stec_residuals[32].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[32].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[32].sv_id.satId)), - 121) - << "incorrect value for stec_residuals[32].sv_id.satId, expected 121, is " - << last_msg_->stec_residuals[32].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[33].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[33].residual)), - 10670) - << "incorrect value for stec_residuals[33].residual, expected 10670, is " - << last_msg_->stec_residuals[33].residual; - EXPECT_EQ(get_asstec_residuals[33].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[33].stddev)), - 241) - << "incorrect value for stec_residuals[33].stddev, expected 241, is " - << last_msg_->stec_residuals[33].stddev; - EXPECT_EQ(get_asstec_residuals[33].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[33].sv_id.constellation)), - 205) - << "incorrect value for stec_residuals[33].sv_id.constellation, expected " - "205, is " - << last_msg_->stec_residuals[33].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[33].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[33].sv_id.satId)), - 7) - << "incorrect value for stec_residuals[33].sv_id.satId, expected 7, is " - << last_msg_->stec_residuals[33].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[34].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[34].residual)), - 25899) - << "incorrect value for stec_residuals[34].residual, expected 25899, is " - << last_msg_->stec_residuals[34].residual; - EXPECT_EQ(get_asstec_residuals[34].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[34].stddev)), - 186) - << "incorrect value for stec_residuals[34].stddev, expected 186, is " - << last_msg_->stec_residuals[34].stddev; - EXPECT_EQ(get_asstec_residuals[34].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[34].sv_id.constellation)), - 210) - << "incorrect value for stec_residuals[34].sv_id.constellation, expected " - "210, is " - << last_msg_->stec_residuals[34].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[34].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[34].sv_id.satId)), - 129) - << "incorrect value for stec_residuals[34].sv_id.satId, expected 129, is " - << last_msg_->stec_residuals[34].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[35].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[35].residual)), - -2078) - << "incorrect value for stec_residuals[35].residual, expected -2078, is " - << last_msg_->stec_residuals[35].residual; - EXPECT_EQ(get_asstec_residuals[35].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[35].stddev)), - 187) - << "incorrect value for stec_residuals[35].stddev, expected 187, is " - << last_msg_->stec_residuals[35].stddev; - EXPECT_EQ(get_asstec_residuals[35].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[35].sv_id.constellation)), - 195) - << "incorrect value for stec_residuals[35].sv_id.constellation, expected " - "195, is " - << last_msg_->stec_residuals[35].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[35].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[35].sv_id.satId)), - 208) - << "incorrect value for stec_residuals[35].sv_id.satId, expected 208, is " - << last_msg_->stec_residuals[35].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[36].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[36].residual)), - -16264) - << "incorrect value for stec_residuals[36].residual, expected -16264, is " - << last_msg_->stec_residuals[36].residual; - EXPECT_EQ(get_asstec_residuals[36].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[36].stddev)), - 102) - << "incorrect value for stec_residuals[36].stddev, expected 102, is " - << last_msg_->stec_residuals[36].stddev; - EXPECT_EQ(get_asstec_residuals[36].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[36].sv_id.constellation)), - 160) - << "incorrect value for stec_residuals[36].sv_id.constellation, expected " - "160, is " - << last_msg_->stec_residuals[36].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[36].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[36].sv_id.satId)), - 219) - << "incorrect value for stec_residuals[36].sv_id.satId, expected 219, is " - << last_msg_->stec_residuals[36].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[37].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[37].residual)), - -21002) - << "incorrect value for stec_residuals[37].residual, expected -21002, is " - << last_msg_->stec_residuals[37].residual; - EXPECT_EQ(get_asstec_residuals[37].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[37].stddev)), - 94) - << "incorrect value for stec_residuals[37].stddev, expected 94, is " - << last_msg_->stec_residuals[37].stddev; - EXPECT_EQ(get_asstec_residuals[37].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[37].sv_id.constellation)), - 42) - << "incorrect value for stec_residuals[37].sv_id.constellation, expected " - "42, is " - << last_msg_->stec_residuals[37].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[37].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[37].sv_id.satId)), - 166) - << "incorrect value for stec_residuals[37].sv_id.satId, expected 166, is " - << last_msg_->stec_residuals[37].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[38].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[38].residual)), - 7902) - << "incorrect value for stec_residuals[38].residual, expected 7902, is " - << last_msg_->stec_residuals[38].residual; - EXPECT_EQ(get_asstec_residuals[38].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[38].stddev)), - 35) - << "incorrect value for stec_residuals[38].stddev, expected 35, is " - << last_msg_->stec_residuals[38].stddev; - EXPECT_EQ(get_asstec_residuals[38].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[38].sv_id.constellation)), - 156) - << "incorrect value for stec_residuals[38].sv_id.constellation, expected " - "156, is " - << last_msg_->stec_residuals[38].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[38].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[38].sv_id.satId)), - 102) - << "incorrect value for stec_residuals[38].sv_id.satId, expected 102, is " - << last_msg_->stec_residuals[38].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[39].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[39].residual)), - -30275) - << "incorrect value for stec_residuals[39].residual, expected -30275, is " - << last_msg_->stec_residuals[39].residual; - EXPECT_EQ(get_asstec_residuals[39].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[39].stddev)), - 204) - << "incorrect value for stec_residuals[39].stddev, expected 204, is " - << last_msg_->stec_residuals[39].stddev; - EXPECT_EQ(get_asstec_residuals[39].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[39].sv_id.constellation)), - 64) - << "incorrect value for stec_residuals[39].sv_id.constellation, expected " - "64, is " - << last_msg_->stec_residuals[39].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[39].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[39].sv_id.satId)), - 247) - << "incorrect value for stec_residuals[39].sv_id.satId, expected 247, is " - << last_msg_->stec_residuals[39].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[40].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[40].residual)), - -8633) - << "incorrect value for stec_residuals[40].residual, expected -8633, is " - << last_msg_->stec_residuals[40].residual; - EXPECT_EQ(get_asstec_residuals[40].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[40].stddev)), - 222) - << "incorrect value for stec_residuals[40].stddev, expected 222, is " - << last_msg_->stec_residuals[40].stddev; - EXPECT_EQ(get_asstec_residuals[40].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[40].sv_id.constellation)), - 32) - << "incorrect value for stec_residuals[40].sv_id.constellation, expected " - "32, is " - << last_msg_->stec_residuals[40].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[40].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[40].sv_id.satId)), - 220) - << "incorrect value for stec_residuals[40].sv_id.satId, expected 220, is " - << last_msg_->stec_residuals[40].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[41].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[41].residual)), - 6403) - << "incorrect value for stec_residuals[41].residual, expected 6403, is " - << last_msg_->stec_residuals[41].residual; - EXPECT_EQ(get_asstec_residuals[41].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[41].stddev)), - 45) - << "incorrect value for stec_residuals[41].stddev, expected 45, is " - << last_msg_->stec_residuals[41].stddev; - EXPECT_EQ(get_asstec_residuals[41].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[41].sv_id.constellation)), - 246) - << "incorrect value for stec_residuals[41].sv_id.constellation, expected " - "246, is " - << last_msg_->stec_residuals[41].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[41].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[41].sv_id.satId)), - 201) - << "incorrect value for stec_residuals[41].sv_id.satId, expected 201, is " - << last_msg_->stec_residuals[41].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[42].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[42].residual)), - 22643) - << "incorrect value for stec_residuals[42].residual, expected 22643, is " - << last_msg_->stec_residuals[42].residual; - EXPECT_EQ(get_asstec_residuals[42].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[42].stddev)), - 218) - << "incorrect value for stec_residuals[42].stddev, expected 218, is " - << last_msg_->stec_residuals[42].stddev; - EXPECT_EQ(get_asstec_residuals[42].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[42].sv_id.constellation)), - 239) - << "incorrect value for stec_residuals[42].sv_id.constellation, expected " - "239, is " - << last_msg_->stec_residuals[42].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[42].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[42].sv_id.satId)), - 251) - << "incorrect value for stec_residuals[42].sv_id.satId, expected 251, is " - << last_msg_->stec_residuals[42].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[43].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[43].residual)), - 16760) - << "incorrect value for stec_residuals[43].residual, expected 16760, is " - << last_msg_->stec_residuals[43].residual; - EXPECT_EQ(get_asstec_residuals[43].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[43].stddev)), - 175) - << "incorrect value for stec_residuals[43].stddev, expected 175, is " - << last_msg_->stec_residuals[43].stddev; - EXPECT_EQ(get_asstec_residuals[43].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[43].sv_id.constellation)), - 209) - << "incorrect value for stec_residuals[43].sv_id.constellation, expected " - "209, is " - << last_msg_->stec_residuals[43].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[43].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[43].sv_id.satId)), - 10) - << "incorrect value for stec_residuals[43].sv_id.satId, expected 10, is " - << last_msg_->stec_residuals[43].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[44].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[44].residual)), - -20951) - << "incorrect value for stec_residuals[44].residual, expected -20951, is " - << last_msg_->stec_residuals[44].residual; - EXPECT_EQ(get_asstec_residuals[44].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[44].stddev)), - 137) - << "incorrect value for stec_residuals[44].stddev, expected 137, is " - << last_msg_->stec_residuals[44].stddev; - EXPECT_EQ(get_asstec_residuals[44].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[44].sv_id.constellation)), - 194) - << "incorrect value for stec_residuals[44].sv_id.constellation, expected " - "194, is " - << last_msg_->stec_residuals[44].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[44].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[44].sv_id.satId)), - 131) - << "incorrect value for stec_residuals[44].sv_id.satId, expected 131, is " - << last_msg_->stec_residuals[44].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[45].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[45].residual)), - -740) - << "incorrect value for stec_residuals[45].residual, expected -740, is " - << last_msg_->stec_residuals[45].residual; - EXPECT_EQ(get_asstec_residuals[45].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[45].stddev)), - 42) - << "incorrect value for stec_residuals[45].stddev, expected 42, is " - << last_msg_->stec_residuals[45].stddev; - EXPECT_EQ(get_asstec_residuals[45].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[45].sv_id.constellation)), - 68) - << "incorrect value for stec_residuals[45].sv_id.constellation, expected " - "68, is " - << last_msg_->stec_residuals[45].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[45].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[45].sv_id.satId)), - 17) - << "incorrect value for stec_residuals[45].sv_id.satId, expected 17, is " - << last_msg_->stec_residuals[45].sv_id.satId; - EXPECT_EQ(get_astropo_delay_correction.hydro)>( - reinterpret_cast( - &last_msg_->tropo_delay_correction.hydro)), - -3035) - << "incorrect value for tropo_delay_correction.hydro, expected -3035, is " - << last_msg_->tropo_delay_correction.hydro; - EXPECT_EQ(get_astropo_delay_correction.stddev)>( - reinterpret_cast( - &last_msg_->tropo_delay_correction.stddev)), - 72) - << "incorrect value for tropo_delay_correction.stddev, expected 72, is " - << last_msg_->tropo_delay_correction.stddev; - EXPECT_EQ(get_astropo_delay_correction.wet)>( - reinterpret_cast( - &last_msg_->tropo_delay_correction.wet)), - 78) - << "incorrect value for tropo_delay_correction.wet, expected 78, is " - << last_msg_->tropo_delay_correction.wet; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds.cc deleted file mode 100644 index e34960e815..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds.cc +++ /dev/null @@ -1,589 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrGriddedCorrectionBounds.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_gridded_correction_bounds_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_gridded_correction_bounds_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds0, Test) { - uint8_t encoded_frame[] = { - 85, 254, 5, 66, 0, 45, 180, 0, 0, 0, 3, 0, 1, 0, - 10, 0, 15, 1, 0, 10, 0, 39, 232, 3, 244, 1, 100, 200, - 150, 100, 150, 100, 2, 5, 10, 16, 0, 17, 18, 19, 20, 21, - 6, 10, 22, 0, 23, 24, 25, 26, 27, 236, 182, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_gridded_correction_bounds_t *test_msg = - (msg_ssr_gridded_correction_bounds_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->grid_point_id = 1000; - test_msg->header.num_msgs = 1; - test_msg->header.seq_num = 0; - test_msg->header.sol_id = 0; - test_msg->header.time.tow = 180; - test_msg->header.time.wn = 3; - test_msg->header.update_interval = 10; - test_msg->n_sats = 2; - test_msg->ssr_iod_atmo = 15; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - test_msg->stec_sat_list[0].stec_bound_mu = 18; - test_msg->stec_sat_list[0].stec_bound_mu_dot = 20; - test_msg->stec_sat_list[0].stec_bound_sig = 19; - test_msg->stec_sat_list[0].stec_bound_sig_dot = 21; - test_msg->stec_sat_list[0].stec_residual.residual = 16; - test_msg->stec_sat_list[0].stec_residual.stddev = 17; - test_msg->stec_sat_list[0].stec_residual.sv_id.constellation = 10; - test_msg->stec_sat_list[0].stec_residual.sv_id.satId = 5; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - test_msg->stec_sat_list[1].stec_bound_mu = 24; - test_msg->stec_sat_list[1].stec_bound_mu_dot = 26; - test_msg->stec_sat_list[1].stec_bound_sig = 25; - test_msg->stec_sat_list[1].stec_bound_sig_dot = 27; - test_msg->stec_sat_list[1].stec_residual.residual = 22; - test_msg->stec_sat_list[1].stec_residual.stddev = 23; - test_msg->stec_sat_list[1].stec_residual.sv_id.constellation = 10; - test_msg->stec_sat_list[1].stec_residual.sv_id.satId = 6; - test_msg->tile_id = 10; - test_msg->tile_set_id = 1; - test_msg->tropo_delay_correction.hydro = 500; - test_msg->tropo_delay_correction.stddev = 200; - test_msg->tropo_delay_correction.wet = 100; - test_msg->tropo_qi = 39; - test_msg->tropo_v_hydro_bound_mu = 150; - test_msg->tropo_v_hydro_bound_sig = 100; - test_msg->tropo_v_wet_bound_mu = 150; - test_msg->tropo_v_wet_bound_sig = 100; - - EXPECT_EQ(send_message(1534, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asgrid_point_id)>( - reinterpret_cast(&last_msg_->grid_point_id)), - 1000) - << "incorrect value for grid_point_id, expected 1000, is " - << last_msg_->grid_point_id; - EXPECT_EQ(get_asheader.num_msgs)>( - reinterpret_cast(&last_msg_->header.num_msgs)), - 1) - << "incorrect value for header.num_msgs, expected 1, is " - << last_msg_->header.num_msgs; - EXPECT_EQ(get_asheader.seq_num)>( - reinterpret_cast(&last_msg_->header.seq_num)), - 0) - << "incorrect value for header.seq_num, expected 0, is " - << last_msg_->header.seq_num; - EXPECT_EQ(get_asheader.sol_id)>( - reinterpret_cast(&last_msg_->header.sol_id)), - 0) - << "incorrect value for header.sol_id, expected 0, is " - << last_msg_->header.sol_id; - EXPECT_EQ(get_asheader.time.tow)>( - reinterpret_cast(&last_msg_->header.time.tow)), - 180) - << "incorrect value for header.time.tow, expected 180, is " - << last_msg_->header.time.tow; - EXPECT_EQ(get_asheader.time.wn)>( - reinterpret_cast(&last_msg_->header.time.wn)), - 3) - << "incorrect value for header.time.wn, expected 3, is " - << last_msg_->header.time.wn; - EXPECT_EQ(get_asheader.update_interval)>( - reinterpret_cast( - &last_msg_->header.update_interval)), - 10) - << "incorrect value for header.update_interval, expected 10, is " - << last_msg_->header.update_interval; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 2) - << "incorrect value for n_sats, expected 2, is " << last_msg_->n_sats; - EXPECT_EQ(get_asssr_iod_atmo)>( - reinterpret_cast(&last_msg_->ssr_iod_atmo)), - 15) - << "incorrect value for ssr_iod_atmo, expected 15, is " - << last_msg_->ssr_iod_atmo; - EXPECT_EQ(get_asstec_sat_list[0].stec_bound_mu)>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_bound_mu)), - 18) - << "incorrect value for stec_sat_list[0].stec_bound_mu, expected 18, is " - << last_msg_->stec_sat_list[0].stec_bound_mu; - EXPECT_EQ(get_asstec_sat_list[0].stec_bound_mu_dot)>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_bound_mu_dot)), - 20) - << "incorrect value for stec_sat_list[0].stec_bound_mu_dot, expected 20, " - "is " - << last_msg_->stec_sat_list[0].stec_bound_mu_dot; - EXPECT_EQ(get_asstec_sat_list[0].stec_bound_sig)>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_bound_sig)), - 19) - << "incorrect value for stec_sat_list[0].stec_bound_sig, expected 19, is " - << last_msg_->stec_sat_list[0].stec_bound_sig; - EXPECT_EQ(get_asstec_sat_list[0].stec_bound_sig_dot)>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_bound_sig_dot)), - 21) - << "incorrect value for stec_sat_list[0].stec_bound_sig_dot, expected " - "21, is " - << last_msg_->stec_sat_list[0].stec_bound_sig_dot; - EXPECT_EQ( - get_asstec_sat_list[0].stec_residual.residual)>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_residual.residual)), - 16) - << "incorrect value for stec_sat_list[0].stec_residual.residual, " - "expected 16, is " - << last_msg_->stec_sat_list[0].stec_residual.residual; - EXPECT_EQ(get_asstec_sat_list[0].stec_residual.stddev)>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_residual.stddev)), - 17) - << "incorrect value for stec_sat_list[0].stec_residual.stddev, expected " - "17, is " - << last_msg_->stec_sat_list[0].stec_residual.stddev; - EXPECT_EQ( - get_asstec_sat_list[0].stec_residual.sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_residual.sv_id.constellation)), - 10) - << "incorrect value for " - "stec_sat_list[0].stec_residual.sv_id.constellation, expected 10, is " - << last_msg_->stec_sat_list[0].stec_residual.sv_id.constellation; - EXPECT_EQ( - get_asstec_sat_list[0].stec_residual.sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_residual.sv_id.satId)), - 5) - << "incorrect value for stec_sat_list[0].stec_residual.sv_id.satId, " - "expected 5, is " - << last_msg_->stec_sat_list[0].stec_residual.sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[1].stec_bound_mu)>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_bound_mu)), - 24) - << "incorrect value for stec_sat_list[1].stec_bound_mu, expected 24, is " - << last_msg_->stec_sat_list[1].stec_bound_mu; - EXPECT_EQ(get_asstec_sat_list[1].stec_bound_mu_dot)>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_bound_mu_dot)), - 26) - << "incorrect value for stec_sat_list[1].stec_bound_mu_dot, expected 26, " - "is " - << last_msg_->stec_sat_list[1].stec_bound_mu_dot; - EXPECT_EQ(get_asstec_sat_list[1].stec_bound_sig)>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_bound_sig)), - 25) - << "incorrect value for stec_sat_list[1].stec_bound_sig, expected 25, is " - << last_msg_->stec_sat_list[1].stec_bound_sig; - EXPECT_EQ(get_asstec_sat_list[1].stec_bound_sig_dot)>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_bound_sig_dot)), - 27) - << "incorrect value for stec_sat_list[1].stec_bound_sig_dot, expected " - "27, is " - << last_msg_->stec_sat_list[1].stec_bound_sig_dot; - EXPECT_EQ( - get_asstec_sat_list[1].stec_residual.residual)>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_residual.residual)), - 22) - << "incorrect value for stec_sat_list[1].stec_residual.residual, " - "expected 22, is " - << last_msg_->stec_sat_list[1].stec_residual.residual; - EXPECT_EQ(get_asstec_sat_list[1].stec_residual.stddev)>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_residual.stddev)), - 23) - << "incorrect value for stec_sat_list[1].stec_residual.stddev, expected " - "23, is " - << last_msg_->stec_sat_list[1].stec_residual.stddev; - EXPECT_EQ( - get_asstec_sat_list[1].stec_residual.sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_residual.sv_id.constellation)), - 10) - << "incorrect value for " - "stec_sat_list[1].stec_residual.sv_id.constellation, expected 10, is " - << last_msg_->stec_sat_list[1].stec_residual.sv_id.constellation; - EXPECT_EQ( - get_asstec_sat_list[1].stec_residual.sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_residual.sv_id.satId)), - 6) - << "incorrect value for stec_sat_list[1].stec_residual.sv_id.satId, " - "expected 6, is " - << last_msg_->stec_sat_list[1].stec_residual.sv_id.satId; - EXPECT_EQ(get_astile_id)>( - reinterpret_cast(&last_msg_->tile_id)), - 10) - << "incorrect value for tile_id, expected 10, is " << last_msg_->tile_id; - EXPECT_EQ(get_astile_set_id)>( - reinterpret_cast(&last_msg_->tile_set_id)), - 1) - << "incorrect value for tile_set_id, expected 1, is " - << last_msg_->tile_set_id; - EXPECT_EQ(get_astropo_delay_correction.hydro)>( - reinterpret_cast( - &last_msg_->tropo_delay_correction.hydro)), - 500) - << "incorrect value for tropo_delay_correction.hydro, expected 500, is " - << last_msg_->tropo_delay_correction.hydro; - EXPECT_EQ(get_astropo_delay_correction.stddev)>( - reinterpret_cast( - &last_msg_->tropo_delay_correction.stddev)), - 200) - << "incorrect value for tropo_delay_correction.stddev, expected 200, is " - << last_msg_->tropo_delay_correction.stddev; - EXPECT_EQ(get_astropo_delay_correction.wet)>( - reinterpret_cast( - &last_msg_->tropo_delay_correction.wet)), - 100) - << "incorrect value for tropo_delay_correction.wet, expected 100, is " - << last_msg_->tropo_delay_correction.wet; - EXPECT_EQ(get_astropo_qi)>( - reinterpret_cast(&last_msg_->tropo_qi)), - 39) - << "incorrect value for tropo_qi, expected 39, is " - << last_msg_->tropo_qi; - EXPECT_EQ(get_astropo_v_hydro_bound_mu)>( - reinterpret_cast( - &last_msg_->tropo_v_hydro_bound_mu)), - 150) - << "incorrect value for tropo_v_hydro_bound_mu, expected 150, is " - << last_msg_->tropo_v_hydro_bound_mu; - EXPECT_EQ(get_astropo_v_hydro_bound_sig)>( - reinterpret_cast( - &last_msg_->tropo_v_hydro_bound_sig)), - 100) - << "incorrect value for tropo_v_hydro_bound_sig, expected 100, is " - << last_msg_->tropo_v_hydro_bound_sig; - EXPECT_EQ( - get_astropo_v_wet_bound_mu)>( - reinterpret_cast(&last_msg_->tropo_v_wet_bound_mu)), - 150) - << "incorrect value for tropo_v_wet_bound_mu, expected 150, is " - << last_msg_->tropo_v_wet_bound_mu; - EXPECT_EQ( - get_astropo_v_wet_bound_sig)>( - reinterpret_cast(&last_msg_->tropo_v_wet_bound_sig)), - 100) - << "incorrect value for tropo_v_wet_bound_sig, expected 100, is " - << last_msg_->tropo_v_wet_bound_sig; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_gridded_correction_bounds_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_gridded_correction_bounds_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionBounds1, Test) { - uint8_t encoded_frame[] = { - 85, 254, 5, 66, 0, 27, 180, 0, 0, 0, 3, 0, - 1, 0, 10, 0, 15, 1, 0, 10, 0, 39, 232, 3, - 244, 1, 100, 200, 150, 100, 150, 100, 0, 155, 36, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_gridded_correction_bounds_t *test_msg = - (msg_ssr_gridded_correction_bounds_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->grid_point_id = 1000; - test_msg->header.num_msgs = 1; - test_msg->header.seq_num = 0; - test_msg->header.sol_id = 0; - test_msg->header.time.tow = 180; - test_msg->header.time.wn = 3; - test_msg->header.update_interval = 10; - test_msg->n_sats = 0; - test_msg->ssr_iod_atmo = 15; - test_msg->tile_id = 10; - test_msg->tile_set_id = 1; - test_msg->tropo_delay_correction.hydro = 500; - test_msg->tropo_delay_correction.stddev = 200; - test_msg->tropo_delay_correction.wet = 100; - test_msg->tropo_qi = 39; - test_msg->tropo_v_hydro_bound_mu = 150; - test_msg->tropo_v_hydro_bound_sig = 100; - test_msg->tropo_v_wet_bound_mu = 150; - test_msg->tropo_v_wet_bound_sig = 100; - - EXPECT_EQ(send_message(1534, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asgrid_point_id)>( - reinterpret_cast(&last_msg_->grid_point_id)), - 1000) - << "incorrect value for grid_point_id, expected 1000, is " - << last_msg_->grid_point_id; - EXPECT_EQ(get_asheader.num_msgs)>( - reinterpret_cast(&last_msg_->header.num_msgs)), - 1) - << "incorrect value for header.num_msgs, expected 1, is " - << last_msg_->header.num_msgs; - EXPECT_EQ(get_asheader.seq_num)>( - reinterpret_cast(&last_msg_->header.seq_num)), - 0) - << "incorrect value for header.seq_num, expected 0, is " - << last_msg_->header.seq_num; - EXPECT_EQ(get_asheader.sol_id)>( - reinterpret_cast(&last_msg_->header.sol_id)), - 0) - << "incorrect value for header.sol_id, expected 0, is " - << last_msg_->header.sol_id; - EXPECT_EQ(get_asheader.time.tow)>( - reinterpret_cast(&last_msg_->header.time.tow)), - 180) - << "incorrect value for header.time.tow, expected 180, is " - << last_msg_->header.time.tow; - EXPECT_EQ(get_asheader.time.wn)>( - reinterpret_cast(&last_msg_->header.time.wn)), - 3) - << "incorrect value for header.time.wn, expected 3, is " - << last_msg_->header.time.wn; - EXPECT_EQ(get_asheader.update_interval)>( - reinterpret_cast( - &last_msg_->header.update_interval)), - 10) - << "incorrect value for header.update_interval, expected 10, is " - << last_msg_->header.update_interval; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 0) - << "incorrect value for n_sats, expected 0, is " << last_msg_->n_sats; - EXPECT_EQ(get_asssr_iod_atmo)>( - reinterpret_cast(&last_msg_->ssr_iod_atmo)), - 15) - << "incorrect value for ssr_iod_atmo, expected 15, is " - << last_msg_->ssr_iod_atmo; - EXPECT_EQ(get_astile_id)>( - reinterpret_cast(&last_msg_->tile_id)), - 10) - << "incorrect value for tile_id, expected 10, is " << last_msg_->tile_id; - EXPECT_EQ(get_astile_set_id)>( - reinterpret_cast(&last_msg_->tile_set_id)), - 1) - << "incorrect value for tile_set_id, expected 1, is " - << last_msg_->tile_set_id; - EXPECT_EQ(get_astropo_delay_correction.hydro)>( - reinterpret_cast( - &last_msg_->tropo_delay_correction.hydro)), - 500) - << "incorrect value for tropo_delay_correction.hydro, expected 500, is " - << last_msg_->tropo_delay_correction.hydro; - EXPECT_EQ(get_astropo_delay_correction.stddev)>( - reinterpret_cast( - &last_msg_->tropo_delay_correction.stddev)), - 200) - << "incorrect value for tropo_delay_correction.stddev, expected 200, is " - << last_msg_->tropo_delay_correction.stddev; - EXPECT_EQ(get_astropo_delay_correction.wet)>( - reinterpret_cast( - &last_msg_->tropo_delay_correction.wet)), - 100) - << "incorrect value for tropo_delay_correction.wet, expected 100, is " - << last_msg_->tropo_delay_correction.wet; - EXPECT_EQ(get_astropo_qi)>( - reinterpret_cast(&last_msg_->tropo_qi)), - 39) - << "incorrect value for tropo_qi, expected 39, is " - << last_msg_->tropo_qi; - EXPECT_EQ(get_astropo_v_hydro_bound_mu)>( - reinterpret_cast( - &last_msg_->tropo_v_hydro_bound_mu)), - 150) - << "incorrect value for tropo_v_hydro_bound_mu, expected 150, is " - << last_msg_->tropo_v_hydro_bound_mu; - EXPECT_EQ(get_astropo_v_hydro_bound_sig)>( - reinterpret_cast( - &last_msg_->tropo_v_hydro_bound_sig)), - 100) - << "incorrect value for tropo_v_hydro_bound_sig, expected 100, is " - << last_msg_->tropo_v_hydro_bound_sig; - EXPECT_EQ( - get_astropo_v_wet_bound_mu)>( - reinterpret_cast(&last_msg_->tropo_v_wet_bound_mu)), - 150) - << "incorrect value for tropo_v_wet_bound_mu, expected 150, is " - << last_msg_->tropo_v_wet_bound_mu; - EXPECT_EQ( - get_astropo_v_wet_bound_sig)>( - reinterpret_cast(&last_msg_->tropo_v_wet_bound_sig)), - 100) - << "incorrect value for tropo_v_wet_bound_sig, expected 100, is " - << last_msg_->tropo_v_wet_bound_sig; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA.cc deleted file mode 100644 index d4c60de72d..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA.cc +++ /dev/null @@ -1,1806 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrGriddedCorrectionDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_gridded_correction_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_gridded_correction_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 250, 5, 108, 106, 254, 164, 217, 44, 53, 98, 93, 63, 147, 104, - 252, 133, 245, 28, 95, 100, 147, 41, 33, 92, 87, 25, 142, 151, 74, - 151, 95, 94, 7, 146, 237, 45, 167, 86, 42, 116, 224, 169, 234, 220, - 23, 176, 18, 13, 178, 79, 160, 160, 110, 15, 53, 206, 151, 158, 22, - 117, 184, 48, 170, 82, 40, 53, 122, 69, 180, 110, 38, 65, 104, 244, - 19, 238, 227, 88, 169, 164, 146, 63, 37, 183, 85, 71, 235, 168, 114, - 211, 105, 221, 156, 60, 18, 230, 2, 142, 172, 16, 39, 33, 126, 106, - 99, 188, 234, 41, 162, 197, 138, 227, 80, 12, 54, 67, 238, 5, 93, - 1, 207, 129, 13, 46, 115, 49, 58, 185, 127, 156, 200, 96, 217, 202, - 15, 245, 55, 198, 81, 218, 132, 70, 73, 82, 147, 26, 255, 14, 134, - 96, 138, 55, 214, 83, 156, 170, 163, 79, 173, 228, 115, 51, 241, 107, - 245, 112, 168, 210, 10, 5, 117, 1, 57, 108, 248, 212, 145, 119, 226, - 165, 5, 141, 202, 106, 0, 60, 36, 61, 243, 203, 216, 215, 12, 137, - 16, 28, 247, 115, 152, 181, 119, 208, 228, 203, 236, 34, 167, 196, 32, - 109, 1, 17, 101, 200, 25, 94, 125, 168, 137, 157, 4, 164, 29, 31, - 48, 132, 72, 229, 126, 186, 68, 76, 133, 21, 0, 180, 139, 164, 148, - 119, 149, 214, 120, 177, 201, 80, 80, 105, 10, 136, 118, 77, 46, 233, - 233, 227, 11, 158, 103, 167, 216, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_gridded_correction_dep_a_t *test_msg = - (msg_ssr_gridded_correction_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.iod_atmo = 245; - test_msg->header.num_msgs = 37695; - test_msg->header.seq_num = 64616; - test_msg->header.time.tow = 892131748; - test_msg->header.time.wn = 23906; - test_msg->header.tropo_quality_indicator = 28; - test_msg->header.update_interval = 133; - test_msg->index = 25695; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[0].residual = -26738; - test_msg->stec_residuals[0].stddev = 74; - test_msg->stec_residuals[0].sv_id.constellation = 25; - test_msg->stec_residuals[0].sv_id.satId = 87; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[1].residual = 1886; - test_msg->stec_residuals[1].stddev = 146; - test_msg->stec_residuals[1].sv_id.constellation = 95; - test_msg->stec_residuals[1].sv_id.satId = 151; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[2].residual = 22183; - test_msg->stec_residuals[2].stddev = 42; - test_msg->stec_residuals[2].sv_id.constellation = 45; - test_msg->stec_residuals[2].sv_id.satId = 237; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[3].residual = -5463; - test_msg->stec_residuals[3].stddev = 220; - test_msg->stec_residuals[3].sv_id.constellation = 224; - test_msg->stec_residuals[3].sv_id.satId = 116; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[4].residual = 3346; - test_msg->stec_residuals[4].stddev = 178; - test_msg->stec_residuals[4].sv_id.constellation = 176; - test_msg->stec_residuals[4].sv_id.satId = 23; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[5].residual = 28320; - test_msg->stec_residuals[5].stddev = 15; - test_msg->stec_residuals[5].sv_id.constellation = 160; - test_msg->stec_residuals[5].sv_id.satId = 79; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[6].residual = -24937; - test_msg->stec_residuals[6].stddev = 22; - test_msg->stec_residuals[6].sv_id.constellation = 206; - test_msg->stec_residuals[6].sv_id.satId = 53; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[7].residual = -21968; - test_msg->stec_residuals[7].stddev = 82; - test_msg->stec_residuals[7].sv_id.constellation = 184; - test_msg->stec_residuals[7].sv_id.satId = 117; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[8].residual = 17786; - test_msg->stec_residuals[8].stddev = 180; - test_msg->stec_residuals[8].sv_id.constellation = 53; - test_msg->stec_residuals[8].sv_id.satId = 40; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[9].residual = 26689; - test_msg->stec_residuals[9].stddev = 244; - test_msg->stec_residuals[9].sv_id.constellation = 38; - test_msg->stec_residuals[9].sv_id.satId = 110; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[10].residual = 22755; - test_msg->stec_residuals[10].stddev = 169; - test_msg->stec_residuals[10].sv_id.constellation = 238; - test_msg->stec_residuals[10].sv_id.satId = 19; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[11].residual = 9535; - test_msg->stec_residuals[11].stddev = 183; - test_msg->stec_residuals[11].sv_id.constellation = 146; - test_msg->stec_residuals[11].sv_id.satId = 164; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[12].residual = -22293; - test_msg->stec_residuals[12].stddev = 114; - test_msg->stec_residuals[12].sv_id.constellation = 71; - test_msg->stec_residuals[12].sv_id.satId = 85; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[13].residual = -25379; - test_msg->stec_residuals[13].stddev = 60; - test_msg->stec_residuals[13].sv_id.constellation = 105; - test_msg->stec_residuals[13].sv_id.satId = 211; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[14].residual = -29182; - test_msg->stec_residuals[14].stddev = 172; - test_msg->stec_residuals[14].sv_id.constellation = 230; - test_msg->stec_residuals[14].sv_id.satId = 18; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[15].residual = 32289; - test_msg->stec_residuals[15].stddev = 106; - test_msg->stec_residuals[15].sv_id.constellation = 39; - test_msg->stec_residuals[15].sv_id.satId = 16; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[16].residual = 10730; - test_msg->stec_residuals[16].stddev = 162; - test_msg->stec_residuals[16].sv_id.constellation = 188; - test_msg->stec_residuals[16].sv_id.satId = 99; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[17].residual = 20707; - test_msg->stec_residuals[17].stddev = 12; - test_msg->stec_residuals[17].sv_id.constellation = 138; - test_msg->stec_residuals[17].sv_id.satId = 197; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[18].residual = 1518; - test_msg->stec_residuals[18].stddev = 93; - test_msg->stec_residuals[18].sv_id.constellation = 67; - test_msg->stec_residuals[18].sv_id.satId = 54; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[19].residual = 3457; - test_msg->stec_residuals[19].stddev = 46; - test_msg->stec_residuals[19].sv_id.constellation = 207; - test_msg->stec_residuals[19].sv_id.satId = 1; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[20].residual = -18118; - test_msg->stec_residuals[20].stddev = 127; - test_msg->stec_residuals[20].sv_id.constellation = 49; - test_msg->stec_residuals[20].sv_id.satId = 115; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[21].residual = -9888; - test_msg->stec_residuals[21].stddev = 202; - test_msg->stec_residuals[21].sv_id.constellation = 200; - test_msg->stec_residuals[21].sv_id.satId = 156; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[22].residual = -14793; - test_msg->stec_residuals[22].stddev = 81; - test_msg->stec_residuals[22].sv_id.constellation = 245; - test_msg->stec_residuals[22].sv_id.satId = 15; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[23].residual = 18758; - test_msg->stec_residuals[23].stddev = 82; - test_msg->stec_residuals[23].sv_id.constellation = 132; - test_msg->stec_residuals[23].sv_id.satId = 218; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[24].residual = 3839; - test_msg->stec_residuals[24].stddev = 134; - test_msg->stec_residuals[24].sv_id.constellation = 26; - test_msg->stec_residuals[24].sv_id.satId = 147; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[25].residual = -10697; - test_msg->stec_residuals[25].stddev = 83; - test_msg->stec_residuals[25].sv_id.constellation = 138; - test_msg->stec_residuals[25].sv_id.satId = 96; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[26].residual = 20387; - test_msg->stec_residuals[26].stddev = 173; - test_msg->stec_residuals[26].sv_id.constellation = 170; - test_msg->stec_residuals[26].sv_id.satId = 156; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[27].residual = -3789; - test_msg->stec_residuals[27].stddev = 107; - test_msg->stec_residuals[27].sv_id.constellation = 115; - test_msg->stec_residuals[27].sv_id.satId = 228; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[28].residual = -11608; - test_msg->stec_residuals[28].stddev = 10; - test_msg->stec_residuals[28].sv_id.constellation = 112; - test_msg->stec_residuals[28].sv_id.satId = 245; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[29].residual = 14593; - test_msg->stec_residuals[29].stddev = 108; - test_msg->stec_residuals[29].sv_id.constellation = 117; - test_msg->stec_residuals[29].sv_id.satId = 5; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[30].residual = 30609; - test_msg->stec_residuals[30].stddev = 226; - test_msg->stec_residuals[30].sv_id.constellation = 212; - test_msg->stec_residuals[30].sv_id.satId = 248; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[31].residual = -13683; - test_msg->stec_residuals[31].stddev = 106; - test_msg->stec_residuals[31].sv_id.constellation = 5; - test_msg->stec_residuals[31].sv_id.satId = 165; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[32].residual = 15652; - test_msg->stec_residuals[32].stddev = 243; - test_msg->stec_residuals[32].sv_id.constellation = 60; - test_msg->stec_residuals[32].sv_id.satId = 0; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[33].residual = 3287; - test_msg->stec_residuals[33].stddev = 137; - test_msg->stec_residuals[33].sv_id.constellation = 216; - test_msg->stec_residuals[33].sv_id.satId = 203; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[34].residual = 29687; - test_msg->stec_residuals[34].stddev = 152; - test_msg->stec_residuals[34].sv_id.constellation = 28; - test_msg->stec_residuals[34].sv_id.satId = 16; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[35].residual = -6960; - test_msg->stec_residuals[35].stddev = 203; - test_msg->stec_residuals[35].sv_id.constellation = 119; - test_msg->stec_residuals[35].sv_id.satId = 181; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[36].residual = -15193; - test_msg->stec_residuals[36].stddev = 32; - test_msg->stec_residuals[36].sv_id.constellation = 34; - test_msg->stec_residuals[36].sv_id.satId = 236; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[37].residual = 25873; - test_msg->stec_residuals[37].stddev = 200; - test_msg->stec_residuals[37].sv_id.constellation = 1; - test_msg->stec_residuals[37].sv_id.satId = 109; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[38].residual = -22403; - test_msg->stec_residuals[38].stddev = 137; - test_msg->stec_residuals[38].sv_id.constellation = 94; - test_msg->stec_residuals[38].sv_id.satId = 25; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[39].residual = 7588; - test_msg->stec_residuals[39].stddev = 31; - test_msg->stec_residuals[39].sv_id.constellation = 4; - test_msg->stec_residuals[39].sv_id.satId = 157; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[40].residual = -6840; - test_msg->stec_residuals[40].stddev = 126; - test_msg->stec_residuals[40].sv_id.constellation = 132; - test_msg->stec_residuals[40].sv_id.satId = 48; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[41].residual = -31412; - test_msg->stec_residuals[41].stddev = 21; - test_msg->stec_residuals[41].sv_id.constellation = 68; - test_msg->stec_residuals[41].sv_id.satId = 186; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[42].residual = -23413; - test_msg->stec_residuals[42].stddev = 148; - test_msg->stec_residuals[42].sv_id.constellation = 180; - test_msg->stec_residuals[42].sv_id.satId = 0; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[43].residual = 30934; - test_msg->stec_residuals[43].stddev = 177; - test_msg->stec_residuals[43].sv_id.constellation = 149; - test_msg->stec_residuals[43].sv_id.satId = 119; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[44].residual = 26960; - test_msg->stec_residuals[44].stddev = 10; - test_msg->stec_residuals[44].sv_id.constellation = 80; - test_msg->stec_residuals[44].sv_id.satId = 201; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[45].residual = 11853; - test_msg->stec_residuals[45].stddev = 233; - test_msg->stec_residuals[45].sv_id.constellation = 118; - test_msg->stec_residuals[45].sv_id.satId = 136; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[46].residual = -25077; - test_msg->stec_residuals[46].stddev = 103; - test_msg->stec_residuals[46].sv_id.constellation = 227; - test_msg->stec_residuals[46].sv_id.satId = 233; - test_msg->tropo_delay_correction.hydro = 10643; - test_msg->tropo_delay_correction.stddev = 92; - test_msg->tropo_delay_correction.wet = 33; - - EXPECT_EQ(send_message(0x5fa, 27244, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 27244); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.iod_atmo)>( - reinterpret_cast(&last_msg_->header.iod_atmo)), - 245) - << "incorrect value for header.iod_atmo, expected 245, is " - << last_msg_->header.iod_atmo; - EXPECT_EQ(get_asheader.num_msgs)>( - reinterpret_cast(&last_msg_->header.num_msgs)), - 37695) - << "incorrect value for header.num_msgs, expected 37695, is " - << last_msg_->header.num_msgs; - EXPECT_EQ(get_asheader.seq_num)>( - reinterpret_cast(&last_msg_->header.seq_num)), - 64616) - << "incorrect value for header.seq_num, expected 64616, is " - << last_msg_->header.seq_num; - EXPECT_EQ(get_asheader.time.tow)>( - reinterpret_cast(&last_msg_->header.time.tow)), - 892131748) - << "incorrect value for header.time.tow, expected 892131748, is " - << last_msg_->header.time.tow; - EXPECT_EQ(get_asheader.time.wn)>( - reinterpret_cast(&last_msg_->header.time.wn)), - 23906) - << "incorrect value for header.time.wn, expected 23906, is " - << last_msg_->header.time.wn; - EXPECT_EQ(get_asheader.tropo_quality_indicator)>( - reinterpret_cast( - &last_msg_->header.tropo_quality_indicator)), - 28) - << "incorrect value for header.tropo_quality_indicator, expected 28, is " - << last_msg_->header.tropo_quality_indicator; - EXPECT_EQ(get_asheader.update_interval)>( - reinterpret_cast( - &last_msg_->header.update_interval)), - 133) - << "incorrect value for header.update_interval, expected 133, is " - << last_msg_->header.update_interval; - EXPECT_EQ(get_asindex)>( - reinterpret_cast(&last_msg_->index)), - 25695) - << "incorrect value for index, expected 25695, is " << last_msg_->index; - EXPECT_EQ(get_asstec_residuals[0].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[0].residual)), - -26738) - << "incorrect value for stec_residuals[0].residual, expected -26738, is " - << last_msg_->stec_residuals[0].residual; - EXPECT_EQ(get_asstec_residuals[0].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[0].stddev)), - 74) - << "incorrect value for stec_residuals[0].stddev, expected 74, is " - << last_msg_->stec_residuals[0].stddev; - EXPECT_EQ(get_asstec_residuals[0].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[0].sv_id.constellation)), - 25) - << "incorrect value for stec_residuals[0].sv_id.constellation, expected " - "25, is " - << last_msg_->stec_residuals[0].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[0].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[0].sv_id.satId)), - 87) - << "incorrect value for stec_residuals[0].sv_id.satId, expected 87, is " - << last_msg_->stec_residuals[0].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[1].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[1].residual)), - 1886) - << "incorrect value for stec_residuals[1].residual, expected 1886, is " - << last_msg_->stec_residuals[1].residual; - EXPECT_EQ(get_asstec_residuals[1].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[1].stddev)), - 146) - << "incorrect value for stec_residuals[1].stddev, expected 146, is " - << last_msg_->stec_residuals[1].stddev; - EXPECT_EQ(get_asstec_residuals[1].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[1].sv_id.constellation)), - 95) - << "incorrect value for stec_residuals[1].sv_id.constellation, expected " - "95, is " - << last_msg_->stec_residuals[1].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[1].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[1].sv_id.satId)), - 151) - << "incorrect value for stec_residuals[1].sv_id.satId, expected 151, is " - << last_msg_->stec_residuals[1].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[2].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[2].residual)), - 22183) - << "incorrect value for stec_residuals[2].residual, expected 22183, is " - << last_msg_->stec_residuals[2].residual; - EXPECT_EQ(get_asstec_residuals[2].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[2].stddev)), - 42) - << "incorrect value for stec_residuals[2].stddev, expected 42, is " - << last_msg_->stec_residuals[2].stddev; - EXPECT_EQ(get_asstec_residuals[2].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[2].sv_id.constellation)), - 45) - << "incorrect value for stec_residuals[2].sv_id.constellation, expected " - "45, is " - << last_msg_->stec_residuals[2].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[2].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[2].sv_id.satId)), - 237) - << "incorrect value for stec_residuals[2].sv_id.satId, expected 237, is " - << last_msg_->stec_residuals[2].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[3].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[3].residual)), - -5463) - << "incorrect value for stec_residuals[3].residual, expected -5463, is " - << last_msg_->stec_residuals[3].residual; - EXPECT_EQ(get_asstec_residuals[3].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[3].stddev)), - 220) - << "incorrect value for stec_residuals[3].stddev, expected 220, is " - << last_msg_->stec_residuals[3].stddev; - EXPECT_EQ(get_asstec_residuals[3].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[3].sv_id.constellation)), - 224) - << "incorrect value for stec_residuals[3].sv_id.constellation, expected " - "224, is " - << last_msg_->stec_residuals[3].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[3].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[3].sv_id.satId)), - 116) - << "incorrect value for stec_residuals[3].sv_id.satId, expected 116, is " - << last_msg_->stec_residuals[3].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[4].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[4].residual)), - 3346) - << "incorrect value for stec_residuals[4].residual, expected 3346, is " - << last_msg_->stec_residuals[4].residual; - EXPECT_EQ(get_asstec_residuals[4].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[4].stddev)), - 178) - << "incorrect value for stec_residuals[4].stddev, expected 178, is " - << last_msg_->stec_residuals[4].stddev; - EXPECT_EQ(get_asstec_residuals[4].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[4].sv_id.constellation)), - 176) - << "incorrect value for stec_residuals[4].sv_id.constellation, expected " - "176, is " - << last_msg_->stec_residuals[4].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[4].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[4].sv_id.satId)), - 23) - << "incorrect value for stec_residuals[4].sv_id.satId, expected 23, is " - << last_msg_->stec_residuals[4].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[5].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[5].residual)), - 28320) - << "incorrect value for stec_residuals[5].residual, expected 28320, is " - << last_msg_->stec_residuals[5].residual; - EXPECT_EQ(get_asstec_residuals[5].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[5].stddev)), - 15) - << "incorrect value for stec_residuals[5].stddev, expected 15, is " - << last_msg_->stec_residuals[5].stddev; - EXPECT_EQ(get_asstec_residuals[5].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[5].sv_id.constellation)), - 160) - << "incorrect value for stec_residuals[5].sv_id.constellation, expected " - "160, is " - << last_msg_->stec_residuals[5].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[5].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[5].sv_id.satId)), - 79) - << "incorrect value for stec_residuals[5].sv_id.satId, expected 79, is " - << last_msg_->stec_residuals[5].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[6].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[6].residual)), - -24937) - << "incorrect value for stec_residuals[6].residual, expected -24937, is " - << last_msg_->stec_residuals[6].residual; - EXPECT_EQ(get_asstec_residuals[6].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[6].stddev)), - 22) - << "incorrect value for stec_residuals[6].stddev, expected 22, is " - << last_msg_->stec_residuals[6].stddev; - EXPECT_EQ(get_asstec_residuals[6].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[6].sv_id.constellation)), - 206) - << "incorrect value for stec_residuals[6].sv_id.constellation, expected " - "206, is " - << last_msg_->stec_residuals[6].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[6].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[6].sv_id.satId)), - 53) - << "incorrect value for stec_residuals[6].sv_id.satId, expected 53, is " - << last_msg_->stec_residuals[6].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[7].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[7].residual)), - -21968) - << "incorrect value for stec_residuals[7].residual, expected -21968, is " - << last_msg_->stec_residuals[7].residual; - EXPECT_EQ(get_asstec_residuals[7].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[7].stddev)), - 82) - << "incorrect value for stec_residuals[7].stddev, expected 82, is " - << last_msg_->stec_residuals[7].stddev; - EXPECT_EQ(get_asstec_residuals[7].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[7].sv_id.constellation)), - 184) - << "incorrect value for stec_residuals[7].sv_id.constellation, expected " - "184, is " - << last_msg_->stec_residuals[7].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[7].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[7].sv_id.satId)), - 117) - << "incorrect value for stec_residuals[7].sv_id.satId, expected 117, is " - << last_msg_->stec_residuals[7].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[8].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[8].residual)), - 17786) - << "incorrect value for stec_residuals[8].residual, expected 17786, is " - << last_msg_->stec_residuals[8].residual; - EXPECT_EQ(get_asstec_residuals[8].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[8].stddev)), - 180) - << "incorrect value for stec_residuals[8].stddev, expected 180, is " - << last_msg_->stec_residuals[8].stddev; - EXPECT_EQ(get_asstec_residuals[8].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[8].sv_id.constellation)), - 53) - << "incorrect value for stec_residuals[8].sv_id.constellation, expected " - "53, is " - << last_msg_->stec_residuals[8].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[8].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[8].sv_id.satId)), - 40) - << "incorrect value for stec_residuals[8].sv_id.satId, expected 40, is " - << last_msg_->stec_residuals[8].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[9].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[9].residual)), - 26689) - << "incorrect value for stec_residuals[9].residual, expected 26689, is " - << last_msg_->stec_residuals[9].residual; - EXPECT_EQ(get_asstec_residuals[9].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[9].stddev)), - 244) - << "incorrect value for stec_residuals[9].stddev, expected 244, is " - << last_msg_->stec_residuals[9].stddev; - EXPECT_EQ(get_asstec_residuals[9].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[9].sv_id.constellation)), - 38) - << "incorrect value for stec_residuals[9].sv_id.constellation, expected " - "38, is " - << last_msg_->stec_residuals[9].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[9].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[9].sv_id.satId)), - 110) - << "incorrect value for stec_residuals[9].sv_id.satId, expected 110, is " - << last_msg_->stec_residuals[9].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[10].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[10].residual)), - 22755) - << "incorrect value for stec_residuals[10].residual, expected 22755, is " - << last_msg_->stec_residuals[10].residual; - EXPECT_EQ(get_asstec_residuals[10].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[10].stddev)), - 169) - << "incorrect value for stec_residuals[10].stddev, expected 169, is " - << last_msg_->stec_residuals[10].stddev; - EXPECT_EQ(get_asstec_residuals[10].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[10].sv_id.constellation)), - 238) - << "incorrect value for stec_residuals[10].sv_id.constellation, expected " - "238, is " - << last_msg_->stec_residuals[10].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[10].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[10].sv_id.satId)), - 19) - << "incorrect value for stec_residuals[10].sv_id.satId, expected 19, is " - << last_msg_->stec_residuals[10].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[11].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[11].residual)), - 9535) - << "incorrect value for stec_residuals[11].residual, expected 9535, is " - << last_msg_->stec_residuals[11].residual; - EXPECT_EQ(get_asstec_residuals[11].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[11].stddev)), - 183) - << "incorrect value for stec_residuals[11].stddev, expected 183, is " - << last_msg_->stec_residuals[11].stddev; - EXPECT_EQ(get_asstec_residuals[11].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[11].sv_id.constellation)), - 146) - << "incorrect value for stec_residuals[11].sv_id.constellation, expected " - "146, is " - << last_msg_->stec_residuals[11].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[11].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[11].sv_id.satId)), - 164) - << "incorrect value for stec_residuals[11].sv_id.satId, expected 164, is " - << last_msg_->stec_residuals[11].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[12].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[12].residual)), - -22293) - << "incorrect value for stec_residuals[12].residual, expected -22293, is " - << last_msg_->stec_residuals[12].residual; - EXPECT_EQ(get_asstec_residuals[12].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[12].stddev)), - 114) - << "incorrect value for stec_residuals[12].stddev, expected 114, is " - << last_msg_->stec_residuals[12].stddev; - EXPECT_EQ(get_asstec_residuals[12].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[12].sv_id.constellation)), - 71) - << "incorrect value for stec_residuals[12].sv_id.constellation, expected " - "71, is " - << last_msg_->stec_residuals[12].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[12].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[12].sv_id.satId)), - 85) - << "incorrect value for stec_residuals[12].sv_id.satId, expected 85, is " - << last_msg_->stec_residuals[12].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[13].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[13].residual)), - -25379) - << "incorrect value for stec_residuals[13].residual, expected -25379, is " - << last_msg_->stec_residuals[13].residual; - EXPECT_EQ(get_asstec_residuals[13].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[13].stddev)), - 60) - << "incorrect value for stec_residuals[13].stddev, expected 60, is " - << last_msg_->stec_residuals[13].stddev; - EXPECT_EQ(get_asstec_residuals[13].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[13].sv_id.constellation)), - 105) - << "incorrect value for stec_residuals[13].sv_id.constellation, expected " - "105, is " - << last_msg_->stec_residuals[13].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[13].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[13].sv_id.satId)), - 211) - << "incorrect value for stec_residuals[13].sv_id.satId, expected 211, is " - << last_msg_->stec_residuals[13].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[14].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[14].residual)), - -29182) - << "incorrect value for stec_residuals[14].residual, expected -29182, is " - << last_msg_->stec_residuals[14].residual; - EXPECT_EQ(get_asstec_residuals[14].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[14].stddev)), - 172) - << "incorrect value for stec_residuals[14].stddev, expected 172, is " - << last_msg_->stec_residuals[14].stddev; - EXPECT_EQ(get_asstec_residuals[14].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[14].sv_id.constellation)), - 230) - << "incorrect value for stec_residuals[14].sv_id.constellation, expected " - "230, is " - << last_msg_->stec_residuals[14].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[14].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[14].sv_id.satId)), - 18) - << "incorrect value for stec_residuals[14].sv_id.satId, expected 18, is " - << last_msg_->stec_residuals[14].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[15].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[15].residual)), - 32289) - << "incorrect value for stec_residuals[15].residual, expected 32289, is " - << last_msg_->stec_residuals[15].residual; - EXPECT_EQ(get_asstec_residuals[15].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[15].stddev)), - 106) - << "incorrect value for stec_residuals[15].stddev, expected 106, is " - << last_msg_->stec_residuals[15].stddev; - EXPECT_EQ(get_asstec_residuals[15].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[15].sv_id.constellation)), - 39) - << "incorrect value for stec_residuals[15].sv_id.constellation, expected " - "39, is " - << last_msg_->stec_residuals[15].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[15].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[15].sv_id.satId)), - 16) - << "incorrect value for stec_residuals[15].sv_id.satId, expected 16, is " - << last_msg_->stec_residuals[15].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[16].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[16].residual)), - 10730) - << "incorrect value for stec_residuals[16].residual, expected 10730, is " - << last_msg_->stec_residuals[16].residual; - EXPECT_EQ(get_asstec_residuals[16].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[16].stddev)), - 162) - << "incorrect value for stec_residuals[16].stddev, expected 162, is " - << last_msg_->stec_residuals[16].stddev; - EXPECT_EQ(get_asstec_residuals[16].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[16].sv_id.constellation)), - 188) - << "incorrect value for stec_residuals[16].sv_id.constellation, expected " - "188, is " - << last_msg_->stec_residuals[16].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[16].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[16].sv_id.satId)), - 99) - << "incorrect value for stec_residuals[16].sv_id.satId, expected 99, is " - << last_msg_->stec_residuals[16].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[17].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[17].residual)), - 20707) - << "incorrect value for stec_residuals[17].residual, expected 20707, is " - << last_msg_->stec_residuals[17].residual; - EXPECT_EQ(get_asstec_residuals[17].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[17].stddev)), - 12) - << "incorrect value for stec_residuals[17].stddev, expected 12, is " - << last_msg_->stec_residuals[17].stddev; - EXPECT_EQ(get_asstec_residuals[17].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[17].sv_id.constellation)), - 138) - << "incorrect value for stec_residuals[17].sv_id.constellation, expected " - "138, is " - << last_msg_->stec_residuals[17].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[17].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[17].sv_id.satId)), - 197) - << "incorrect value for stec_residuals[17].sv_id.satId, expected 197, is " - << last_msg_->stec_residuals[17].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[18].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[18].residual)), - 1518) - << "incorrect value for stec_residuals[18].residual, expected 1518, is " - << last_msg_->stec_residuals[18].residual; - EXPECT_EQ(get_asstec_residuals[18].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[18].stddev)), - 93) - << "incorrect value for stec_residuals[18].stddev, expected 93, is " - << last_msg_->stec_residuals[18].stddev; - EXPECT_EQ(get_asstec_residuals[18].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[18].sv_id.constellation)), - 67) - << "incorrect value for stec_residuals[18].sv_id.constellation, expected " - "67, is " - << last_msg_->stec_residuals[18].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[18].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[18].sv_id.satId)), - 54) - << "incorrect value for stec_residuals[18].sv_id.satId, expected 54, is " - << last_msg_->stec_residuals[18].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[19].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[19].residual)), - 3457) - << "incorrect value for stec_residuals[19].residual, expected 3457, is " - << last_msg_->stec_residuals[19].residual; - EXPECT_EQ(get_asstec_residuals[19].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[19].stddev)), - 46) - << "incorrect value for stec_residuals[19].stddev, expected 46, is " - << last_msg_->stec_residuals[19].stddev; - EXPECT_EQ(get_asstec_residuals[19].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[19].sv_id.constellation)), - 207) - << "incorrect value for stec_residuals[19].sv_id.constellation, expected " - "207, is " - << last_msg_->stec_residuals[19].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[19].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[19].sv_id.satId)), - 1) - << "incorrect value for stec_residuals[19].sv_id.satId, expected 1, is " - << last_msg_->stec_residuals[19].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[20].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[20].residual)), - -18118) - << "incorrect value for stec_residuals[20].residual, expected -18118, is " - << last_msg_->stec_residuals[20].residual; - EXPECT_EQ(get_asstec_residuals[20].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[20].stddev)), - 127) - << "incorrect value for stec_residuals[20].stddev, expected 127, is " - << last_msg_->stec_residuals[20].stddev; - EXPECT_EQ(get_asstec_residuals[20].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[20].sv_id.constellation)), - 49) - << "incorrect value for stec_residuals[20].sv_id.constellation, expected " - "49, is " - << last_msg_->stec_residuals[20].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[20].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[20].sv_id.satId)), - 115) - << "incorrect value for stec_residuals[20].sv_id.satId, expected 115, is " - << last_msg_->stec_residuals[20].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[21].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[21].residual)), - -9888) - << "incorrect value for stec_residuals[21].residual, expected -9888, is " - << last_msg_->stec_residuals[21].residual; - EXPECT_EQ(get_asstec_residuals[21].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[21].stddev)), - 202) - << "incorrect value for stec_residuals[21].stddev, expected 202, is " - << last_msg_->stec_residuals[21].stddev; - EXPECT_EQ(get_asstec_residuals[21].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[21].sv_id.constellation)), - 200) - << "incorrect value for stec_residuals[21].sv_id.constellation, expected " - "200, is " - << last_msg_->stec_residuals[21].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[21].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[21].sv_id.satId)), - 156) - << "incorrect value for stec_residuals[21].sv_id.satId, expected 156, is " - << last_msg_->stec_residuals[21].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[22].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[22].residual)), - -14793) - << "incorrect value for stec_residuals[22].residual, expected -14793, is " - << last_msg_->stec_residuals[22].residual; - EXPECT_EQ(get_asstec_residuals[22].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[22].stddev)), - 81) - << "incorrect value for stec_residuals[22].stddev, expected 81, is " - << last_msg_->stec_residuals[22].stddev; - EXPECT_EQ(get_asstec_residuals[22].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[22].sv_id.constellation)), - 245) - << "incorrect value for stec_residuals[22].sv_id.constellation, expected " - "245, is " - << last_msg_->stec_residuals[22].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[22].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[22].sv_id.satId)), - 15) - << "incorrect value for stec_residuals[22].sv_id.satId, expected 15, is " - << last_msg_->stec_residuals[22].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[23].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[23].residual)), - 18758) - << "incorrect value for stec_residuals[23].residual, expected 18758, is " - << last_msg_->stec_residuals[23].residual; - EXPECT_EQ(get_asstec_residuals[23].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[23].stddev)), - 82) - << "incorrect value for stec_residuals[23].stddev, expected 82, is " - << last_msg_->stec_residuals[23].stddev; - EXPECT_EQ(get_asstec_residuals[23].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[23].sv_id.constellation)), - 132) - << "incorrect value for stec_residuals[23].sv_id.constellation, expected " - "132, is " - << last_msg_->stec_residuals[23].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[23].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[23].sv_id.satId)), - 218) - << "incorrect value for stec_residuals[23].sv_id.satId, expected 218, is " - << last_msg_->stec_residuals[23].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[24].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[24].residual)), - 3839) - << "incorrect value for stec_residuals[24].residual, expected 3839, is " - << last_msg_->stec_residuals[24].residual; - EXPECT_EQ(get_asstec_residuals[24].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[24].stddev)), - 134) - << "incorrect value for stec_residuals[24].stddev, expected 134, is " - << last_msg_->stec_residuals[24].stddev; - EXPECT_EQ(get_asstec_residuals[24].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[24].sv_id.constellation)), - 26) - << "incorrect value for stec_residuals[24].sv_id.constellation, expected " - "26, is " - << last_msg_->stec_residuals[24].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[24].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[24].sv_id.satId)), - 147) - << "incorrect value for stec_residuals[24].sv_id.satId, expected 147, is " - << last_msg_->stec_residuals[24].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[25].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[25].residual)), - -10697) - << "incorrect value for stec_residuals[25].residual, expected -10697, is " - << last_msg_->stec_residuals[25].residual; - EXPECT_EQ(get_asstec_residuals[25].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[25].stddev)), - 83) - << "incorrect value for stec_residuals[25].stddev, expected 83, is " - << last_msg_->stec_residuals[25].stddev; - EXPECT_EQ(get_asstec_residuals[25].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[25].sv_id.constellation)), - 138) - << "incorrect value for stec_residuals[25].sv_id.constellation, expected " - "138, is " - << last_msg_->stec_residuals[25].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[25].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[25].sv_id.satId)), - 96) - << "incorrect value for stec_residuals[25].sv_id.satId, expected 96, is " - << last_msg_->stec_residuals[25].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[26].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[26].residual)), - 20387) - << "incorrect value for stec_residuals[26].residual, expected 20387, is " - << last_msg_->stec_residuals[26].residual; - EXPECT_EQ(get_asstec_residuals[26].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[26].stddev)), - 173) - << "incorrect value for stec_residuals[26].stddev, expected 173, is " - << last_msg_->stec_residuals[26].stddev; - EXPECT_EQ(get_asstec_residuals[26].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[26].sv_id.constellation)), - 170) - << "incorrect value for stec_residuals[26].sv_id.constellation, expected " - "170, is " - << last_msg_->stec_residuals[26].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[26].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[26].sv_id.satId)), - 156) - << "incorrect value for stec_residuals[26].sv_id.satId, expected 156, is " - << last_msg_->stec_residuals[26].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[27].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[27].residual)), - -3789) - << "incorrect value for stec_residuals[27].residual, expected -3789, is " - << last_msg_->stec_residuals[27].residual; - EXPECT_EQ(get_asstec_residuals[27].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[27].stddev)), - 107) - << "incorrect value for stec_residuals[27].stddev, expected 107, is " - << last_msg_->stec_residuals[27].stddev; - EXPECT_EQ(get_asstec_residuals[27].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[27].sv_id.constellation)), - 115) - << "incorrect value for stec_residuals[27].sv_id.constellation, expected " - "115, is " - << last_msg_->stec_residuals[27].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[27].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[27].sv_id.satId)), - 228) - << "incorrect value for stec_residuals[27].sv_id.satId, expected 228, is " - << last_msg_->stec_residuals[27].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[28].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[28].residual)), - -11608) - << "incorrect value for stec_residuals[28].residual, expected -11608, is " - << last_msg_->stec_residuals[28].residual; - EXPECT_EQ(get_asstec_residuals[28].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[28].stddev)), - 10) - << "incorrect value for stec_residuals[28].stddev, expected 10, is " - << last_msg_->stec_residuals[28].stddev; - EXPECT_EQ(get_asstec_residuals[28].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[28].sv_id.constellation)), - 112) - << "incorrect value for stec_residuals[28].sv_id.constellation, expected " - "112, is " - << last_msg_->stec_residuals[28].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[28].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[28].sv_id.satId)), - 245) - << "incorrect value for stec_residuals[28].sv_id.satId, expected 245, is " - << last_msg_->stec_residuals[28].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[29].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[29].residual)), - 14593) - << "incorrect value for stec_residuals[29].residual, expected 14593, is " - << last_msg_->stec_residuals[29].residual; - EXPECT_EQ(get_asstec_residuals[29].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[29].stddev)), - 108) - << "incorrect value for stec_residuals[29].stddev, expected 108, is " - << last_msg_->stec_residuals[29].stddev; - EXPECT_EQ(get_asstec_residuals[29].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[29].sv_id.constellation)), - 117) - << "incorrect value for stec_residuals[29].sv_id.constellation, expected " - "117, is " - << last_msg_->stec_residuals[29].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[29].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[29].sv_id.satId)), - 5) - << "incorrect value for stec_residuals[29].sv_id.satId, expected 5, is " - << last_msg_->stec_residuals[29].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[30].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[30].residual)), - 30609) - << "incorrect value for stec_residuals[30].residual, expected 30609, is " - << last_msg_->stec_residuals[30].residual; - EXPECT_EQ(get_asstec_residuals[30].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[30].stddev)), - 226) - << "incorrect value for stec_residuals[30].stddev, expected 226, is " - << last_msg_->stec_residuals[30].stddev; - EXPECT_EQ(get_asstec_residuals[30].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[30].sv_id.constellation)), - 212) - << "incorrect value for stec_residuals[30].sv_id.constellation, expected " - "212, is " - << last_msg_->stec_residuals[30].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[30].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[30].sv_id.satId)), - 248) - << "incorrect value for stec_residuals[30].sv_id.satId, expected 248, is " - << last_msg_->stec_residuals[30].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[31].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[31].residual)), - -13683) - << "incorrect value for stec_residuals[31].residual, expected -13683, is " - << last_msg_->stec_residuals[31].residual; - EXPECT_EQ(get_asstec_residuals[31].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[31].stddev)), - 106) - << "incorrect value for stec_residuals[31].stddev, expected 106, is " - << last_msg_->stec_residuals[31].stddev; - EXPECT_EQ(get_asstec_residuals[31].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[31].sv_id.constellation)), - 5) - << "incorrect value for stec_residuals[31].sv_id.constellation, expected " - "5, is " - << last_msg_->stec_residuals[31].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[31].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[31].sv_id.satId)), - 165) - << "incorrect value for stec_residuals[31].sv_id.satId, expected 165, is " - << last_msg_->stec_residuals[31].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[32].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[32].residual)), - 15652) - << "incorrect value for stec_residuals[32].residual, expected 15652, is " - << last_msg_->stec_residuals[32].residual; - EXPECT_EQ(get_asstec_residuals[32].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[32].stddev)), - 243) - << "incorrect value for stec_residuals[32].stddev, expected 243, is " - << last_msg_->stec_residuals[32].stddev; - EXPECT_EQ(get_asstec_residuals[32].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[32].sv_id.constellation)), - 60) - << "incorrect value for stec_residuals[32].sv_id.constellation, expected " - "60, is " - << last_msg_->stec_residuals[32].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[32].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[32].sv_id.satId)), - 0) - << "incorrect value for stec_residuals[32].sv_id.satId, expected 0, is " - << last_msg_->stec_residuals[32].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[33].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[33].residual)), - 3287) - << "incorrect value for stec_residuals[33].residual, expected 3287, is " - << last_msg_->stec_residuals[33].residual; - EXPECT_EQ(get_asstec_residuals[33].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[33].stddev)), - 137) - << "incorrect value for stec_residuals[33].stddev, expected 137, is " - << last_msg_->stec_residuals[33].stddev; - EXPECT_EQ(get_asstec_residuals[33].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[33].sv_id.constellation)), - 216) - << "incorrect value for stec_residuals[33].sv_id.constellation, expected " - "216, is " - << last_msg_->stec_residuals[33].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[33].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[33].sv_id.satId)), - 203) - << "incorrect value for stec_residuals[33].sv_id.satId, expected 203, is " - << last_msg_->stec_residuals[33].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[34].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[34].residual)), - 29687) - << "incorrect value for stec_residuals[34].residual, expected 29687, is " - << last_msg_->stec_residuals[34].residual; - EXPECT_EQ(get_asstec_residuals[34].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[34].stddev)), - 152) - << "incorrect value for stec_residuals[34].stddev, expected 152, is " - << last_msg_->stec_residuals[34].stddev; - EXPECT_EQ(get_asstec_residuals[34].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[34].sv_id.constellation)), - 28) - << "incorrect value for stec_residuals[34].sv_id.constellation, expected " - "28, is " - << last_msg_->stec_residuals[34].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[34].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[34].sv_id.satId)), - 16) - << "incorrect value for stec_residuals[34].sv_id.satId, expected 16, is " - << last_msg_->stec_residuals[34].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[35].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[35].residual)), - -6960) - << "incorrect value for stec_residuals[35].residual, expected -6960, is " - << last_msg_->stec_residuals[35].residual; - EXPECT_EQ(get_asstec_residuals[35].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[35].stddev)), - 203) - << "incorrect value for stec_residuals[35].stddev, expected 203, is " - << last_msg_->stec_residuals[35].stddev; - EXPECT_EQ(get_asstec_residuals[35].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[35].sv_id.constellation)), - 119) - << "incorrect value for stec_residuals[35].sv_id.constellation, expected " - "119, is " - << last_msg_->stec_residuals[35].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[35].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[35].sv_id.satId)), - 181) - << "incorrect value for stec_residuals[35].sv_id.satId, expected 181, is " - << last_msg_->stec_residuals[35].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[36].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[36].residual)), - -15193) - << "incorrect value for stec_residuals[36].residual, expected -15193, is " - << last_msg_->stec_residuals[36].residual; - EXPECT_EQ(get_asstec_residuals[36].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[36].stddev)), - 32) - << "incorrect value for stec_residuals[36].stddev, expected 32, is " - << last_msg_->stec_residuals[36].stddev; - EXPECT_EQ(get_asstec_residuals[36].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[36].sv_id.constellation)), - 34) - << "incorrect value for stec_residuals[36].sv_id.constellation, expected " - "34, is " - << last_msg_->stec_residuals[36].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[36].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[36].sv_id.satId)), - 236) - << "incorrect value for stec_residuals[36].sv_id.satId, expected 236, is " - << last_msg_->stec_residuals[36].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[37].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[37].residual)), - 25873) - << "incorrect value for stec_residuals[37].residual, expected 25873, is " - << last_msg_->stec_residuals[37].residual; - EXPECT_EQ(get_asstec_residuals[37].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[37].stddev)), - 200) - << "incorrect value for stec_residuals[37].stddev, expected 200, is " - << last_msg_->stec_residuals[37].stddev; - EXPECT_EQ(get_asstec_residuals[37].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[37].sv_id.constellation)), - 1) - << "incorrect value for stec_residuals[37].sv_id.constellation, expected " - "1, is " - << last_msg_->stec_residuals[37].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[37].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[37].sv_id.satId)), - 109) - << "incorrect value for stec_residuals[37].sv_id.satId, expected 109, is " - << last_msg_->stec_residuals[37].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[38].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[38].residual)), - -22403) - << "incorrect value for stec_residuals[38].residual, expected -22403, is " - << last_msg_->stec_residuals[38].residual; - EXPECT_EQ(get_asstec_residuals[38].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[38].stddev)), - 137) - << "incorrect value for stec_residuals[38].stddev, expected 137, is " - << last_msg_->stec_residuals[38].stddev; - EXPECT_EQ(get_asstec_residuals[38].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[38].sv_id.constellation)), - 94) - << "incorrect value for stec_residuals[38].sv_id.constellation, expected " - "94, is " - << last_msg_->stec_residuals[38].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[38].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[38].sv_id.satId)), - 25) - << "incorrect value for stec_residuals[38].sv_id.satId, expected 25, is " - << last_msg_->stec_residuals[38].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[39].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[39].residual)), - 7588) - << "incorrect value for stec_residuals[39].residual, expected 7588, is " - << last_msg_->stec_residuals[39].residual; - EXPECT_EQ(get_asstec_residuals[39].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[39].stddev)), - 31) - << "incorrect value for stec_residuals[39].stddev, expected 31, is " - << last_msg_->stec_residuals[39].stddev; - EXPECT_EQ(get_asstec_residuals[39].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[39].sv_id.constellation)), - 4) - << "incorrect value for stec_residuals[39].sv_id.constellation, expected " - "4, is " - << last_msg_->stec_residuals[39].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[39].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[39].sv_id.satId)), - 157) - << "incorrect value for stec_residuals[39].sv_id.satId, expected 157, is " - << last_msg_->stec_residuals[39].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[40].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[40].residual)), - -6840) - << "incorrect value for stec_residuals[40].residual, expected -6840, is " - << last_msg_->stec_residuals[40].residual; - EXPECT_EQ(get_asstec_residuals[40].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[40].stddev)), - 126) - << "incorrect value for stec_residuals[40].stddev, expected 126, is " - << last_msg_->stec_residuals[40].stddev; - EXPECT_EQ(get_asstec_residuals[40].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[40].sv_id.constellation)), - 132) - << "incorrect value for stec_residuals[40].sv_id.constellation, expected " - "132, is " - << last_msg_->stec_residuals[40].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[40].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[40].sv_id.satId)), - 48) - << "incorrect value for stec_residuals[40].sv_id.satId, expected 48, is " - << last_msg_->stec_residuals[40].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[41].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[41].residual)), - -31412) - << "incorrect value for stec_residuals[41].residual, expected -31412, is " - << last_msg_->stec_residuals[41].residual; - EXPECT_EQ(get_asstec_residuals[41].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[41].stddev)), - 21) - << "incorrect value for stec_residuals[41].stddev, expected 21, is " - << last_msg_->stec_residuals[41].stddev; - EXPECT_EQ(get_asstec_residuals[41].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[41].sv_id.constellation)), - 68) - << "incorrect value for stec_residuals[41].sv_id.constellation, expected " - "68, is " - << last_msg_->stec_residuals[41].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[41].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[41].sv_id.satId)), - 186) - << "incorrect value for stec_residuals[41].sv_id.satId, expected 186, is " - << last_msg_->stec_residuals[41].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[42].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[42].residual)), - -23413) - << "incorrect value for stec_residuals[42].residual, expected -23413, is " - << last_msg_->stec_residuals[42].residual; - EXPECT_EQ(get_asstec_residuals[42].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[42].stddev)), - 148) - << "incorrect value for stec_residuals[42].stddev, expected 148, is " - << last_msg_->stec_residuals[42].stddev; - EXPECT_EQ(get_asstec_residuals[42].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[42].sv_id.constellation)), - 180) - << "incorrect value for stec_residuals[42].sv_id.constellation, expected " - "180, is " - << last_msg_->stec_residuals[42].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[42].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[42].sv_id.satId)), - 0) - << "incorrect value for stec_residuals[42].sv_id.satId, expected 0, is " - << last_msg_->stec_residuals[42].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[43].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[43].residual)), - 30934) - << "incorrect value for stec_residuals[43].residual, expected 30934, is " - << last_msg_->stec_residuals[43].residual; - EXPECT_EQ(get_asstec_residuals[43].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[43].stddev)), - 177) - << "incorrect value for stec_residuals[43].stddev, expected 177, is " - << last_msg_->stec_residuals[43].stddev; - EXPECT_EQ(get_asstec_residuals[43].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[43].sv_id.constellation)), - 149) - << "incorrect value for stec_residuals[43].sv_id.constellation, expected " - "149, is " - << last_msg_->stec_residuals[43].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[43].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[43].sv_id.satId)), - 119) - << "incorrect value for stec_residuals[43].sv_id.satId, expected 119, is " - << last_msg_->stec_residuals[43].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[44].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[44].residual)), - 26960) - << "incorrect value for stec_residuals[44].residual, expected 26960, is " - << last_msg_->stec_residuals[44].residual; - EXPECT_EQ(get_asstec_residuals[44].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[44].stddev)), - 10) - << "incorrect value for stec_residuals[44].stddev, expected 10, is " - << last_msg_->stec_residuals[44].stddev; - EXPECT_EQ(get_asstec_residuals[44].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[44].sv_id.constellation)), - 80) - << "incorrect value for stec_residuals[44].sv_id.constellation, expected " - "80, is " - << last_msg_->stec_residuals[44].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[44].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[44].sv_id.satId)), - 201) - << "incorrect value for stec_residuals[44].sv_id.satId, expected 201, is " - << last_msg_->stec_residuals[44].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[45].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[45].residual)), - 11853) - << "incorrect value for stec_residuals[45].residual, expected 11853, is " - << last_msg_->stec_residuals[45].residual; - EXPECT_EQ(get_asstec_residuals[45].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[45].stddev)), - 233) - << "incorrect value for stec_residuals[45].stddev, expected 233, is " - << last_msg_->stec_residuals[45].stddev; - EXPECT_EQ(get_asstec_residuals[45].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[45].sv_id.constellation)), - 118) - << "incorrect value for stec_residuals[45].sv_id.constellation, expected " - "118, is " - << last_msg_->stec_residuals[45].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[45].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[45].sv_id.satId)), - 136) - << "incorrect value for stec_residuals[45].sv_id.satId, expected 136, is " - << last_msg_->stec_residuals[45].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[46].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[46].residual)), - -25077) - << "incorrect value for stec_residuals[46].residual, expected -25077, is " - << last_msg_->stec_residuals[46].residual; - EXPECT_EQ(get_asstec_residuals[46].stddev)>( - reinterpret_cast( - &last_msg_->stec_residuals[46].stddev)), - 103) - << "incorrect value for stec_residuals[46].stddev, expected 103, is " - << last_msg_->stec_residuals[46].stddev; - EXPECT_EQ(get_asstec_residuals[46].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[46].sv_id.constellation)), - 227) - << "incorrect value for stec_residuals[46].sv_id.constellation, expected " - "227, is " - << last_msg_->stec_residuals[46].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[46].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[46].sv_id.satId)), - 233) - << "incorrect value for stec_residuals[46].sv_id.satId, expected 233, is " - << last_msg_->stec_residuals[46].sv_id.satId; - EXPECT_EQ(get_astropo_delay_correction.hydro)>( - reinterpret_cast( - &last_msg_->tropo_delay_correction.hydro)), - 10643) - << "incorrect value for tropo_delay_correction.hydro, expected 10643, is " - << last_msg_->tropo_delay_correction.hydro; - EXPECT_EQ(get_astropo_delay_correction.stddev)>( - reinterpret_cast( - &last_msg_->tropo_delay_correction.stddev)), - 92) - << "incorrect value for tropo_delay_correction.stddev, expected 92, is " - << last_msg_->tropo_delay_correction.stddev; - EXPECT_EQ(get_astropo_delay_correction.wet)>( - reinterpret_cast( - &last_msg_->tropo_delay_correction.wet)), - 33) - << "incorrect value for tropo_delay_correction.wet, expected 33, is " - << last_msg_->tropo_delay_correction.wet; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrGriddedCorrectionNoStdDepA.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrGriddedCorrectionNoStdDepA.cc deleted file mode 100644 index e7dc156014..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrGriddedCorrectionNoStdDepA.cc +++ /dev/null @@ -1,1795 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrGriddedCorrectionNoStdDepA.yaml -// by generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionNoStdDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionNoStdDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg( - uint16_t sender_id, uint8_t message_length, - const msg_ssr_gridded_correction_no_std_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_gridded_correction_no_std_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrGriddedCorrectionNoStdDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 240, 5, 102, 28, 254, 179, 240, 33, 169, 236, 34, 117, 245, 67, - 248, 233, 236, 230, 230, 103, 122, 63, 101, 231, 157, 115, 162, 197, 146, - 35, 107, 222, 109, 52, 41, 86, 12, 237, 184, 65, 204, 137, 148, 171, - 183, 11, 0, 180, 203, 172, 53, 196, 85, 186, 115, 203, 92, 166, 30, - 42, 13, 200, 71, 98, 137, 219, 160, 95, 216, 95, 250, 99, 196, 92, - 214, 159, 253, 195, 222, 233, 146, 233, 63, 76, 24, 106, 40, 253, 65, - 9, 183, 40, 215, 188, 59, 117, 69, 97, 115, 60, 56, 0, 141, 207, - 171, 54, 161, 23, 61, 0, 87, 230, 123, 87, 36, 184, 255, 14, 163, - 187, 224, 43, 151, 151, 104, 39, 57, 5, 54, 48, 224, 181, 129, 60, - 92, 171, 114, 109, 109, 12, 23, 118, 8, 64, 159, 54, 216, 33, 20, - 24, 68, 160, 36, 38, 222, 145, 190, 92, 99, 108, 159, 232, 240, 227, - 221, 253, 15, 62, 23, 121, 185, 168, 116, 4, 147, 123, 72, 223, 119, - 226, 242, 161, 204, 180, 202, 137, 166, 58, 24, 124, 19, 181, 188, 16, - 107, 66, 231, 63, 1, 64, 252, 115, 62, 233, 97, 250, 86, 156, 221, - 49, 178, 32, 73, 198, 67, 249, 253, 74, 56, 38, 165, 119, 92, 99, - 44, 95, 131, 89, 192, 225, 55, 95, 171, 88, 205, 21, 116, 231, 83, - 71, 71, 100, 110, 217, 254, 152, 212, 18, 8, 40, 157, 244, 54, 72, - 240, 231, 189, 111, 195, 205, 81, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_gridded_correction_no_std_dep_a_t *test_msg = - (msg_ssr_gridded_correction_no_std_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.iod_atmo = 236; - test_msg->header.num_msgs = 62837; - test_msg->header.seq_num = 63555; - test_msg->header.time.tow = 2837573811; - test_msg->header.time.wn = 8940; - test_msg->header.tropo_quality_indicator = 230; - test_msg->header.update_interval = 233; - test_msg->index = 26598; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[0].residual = -23949; - test_msg->stec_residuals[0].sv_id.constellation = 157; - test_msg->stec_residuals[0].sv_id.satId = 231; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[1].residual = 27427; - test_msg->stec_residuals[1].sv_id.constellation = 146; - test_msg->stec_residuals[1].sv_id.satId = 197; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[2].residual = 10548; - test_msg->stec_residuals[2].sv_id.constellation = 109; - test_msg->stec_residuals[2].sv_id.satId = 222; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[3].residual = -18195; - test_msg->stec_residuals[3].sv_id.constellation = 12; - test_msg->stec_residuals[3].sv_id.satId = 86; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[4].residual = -27511; - test_msg->stec_residuals[4].sv_id.constellation = 204; - test_msg->stec_residuals[4].sv_id.satId = 65; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[5].residual = 11; - test_msg->stec_residuals[5].sv_id.constellation = 183; - test_msg->stec_residuals[5].sv_id.satId = 171; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[6].residual = 13740; - test_msg->stec_residuals[6].sv_id.constellation = 203; - test_msg->stec_residuals[6].sv_id.satId = 180; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[7].residual = 29626; - test_msg->stec_residuals[7].sv_id.constellation = 85; - test_msg->stec_residuals[7].sv_id.satId = 196; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[8].residual = 7846; - test_msg->stec_residuals[8].sv_id.constellation = 92; - test_msg->stec_residuals[8].sv_id.satId = 203; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[9].residual = 18376; - test_msg->stec_residuals[9].sv_id.constellation = 13; - test_msg->stec_residuals[9].sv_id.satId = 42; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[10].residual = -24357; - test_msg->stec_residuals[10].sv_id.constellation = 137; - test_msg->stec_residuals[10].sv_id.satId = 98; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[11].residual = -1441; - test_msg->stec_residuals[11].sv_id.constellation = 216; - test_msg->stec_residuals[11].sv_id.satId = 95; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[12].residual = -10660; - test_msg->stec_residuals[12].sv_id.constellation = 196; - test_msg->stec_residuals[12].sv_id.satId = 99; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[13].residual = -8509; - test_msg->stec_residuals[13].sv_id.constellation = 253; - test_msg->stec_residuals[13].sv_id.satId = 159; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[14].residual = 16361; - test_msg->stec_residuals[14].sv_id.constellation = 146; - test_msg->stec_residuals[14].sv_id.satId = 233; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[15].residual = 10346; - test_msg->stec_residuals[15].sv_id.constellation = 24; - test_msg->stec_residuals[15].sv_id.satId = 76; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[16].residual = -18679; - test_msg->stec_residuals[16].sv_id.constellation = 65; - test_msg->stec_residuals[16].sv_id.satId = 253; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[17].residual = 15292; - test_msg->stec_residuals[17].sv_id.constellation = 215; - test_msg->stec_residuals[17].sv_id.satId = 40; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[18].residual = 29537; - test_msg->stec_residuals[18].sv_id.constellation = 69; - test_msg->stec_residuals[18].sv_id.satId = 117; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[19].residual = -29440; - test_msg->stec_residuals[19].sv_id.constellation = 56; - test_msg->stec_residuals[19].sv_id.satId = 60; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[20].residual = -24266; - test_msg->stec_residuals[20].sv_id.constellation = 171; - test_msg->stec_residuals[20].sv_id.satId = 207; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[21].residual = 22272; - test_msg->stec_residuals[21].sv_id.constellation = 61; - test_msg->stec_residuals[21].sv_id.satId = 23; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[22].residual = 9303; - test_msg->stec_residuals[22].sv_id.constellation = 123; - test_msg->stec_residuals[22].sv_id.satId = 230; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[23].residual = -23794; - test_msg->stec_residuals[23].sv_id.constellation = 255; - test_msg->stec_residuals[23].sv_id.satId = 184; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[24].residual = -26837; - test_msg->stec_residuals[24].sv_id.constellation = 224; - test_msg->stec_residuals[24].sv_id.satId = 187; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[25].residual = 14631; - test_msg->stec_residuals[25].sv_id.constellation = 104; - test_msg->stec_residuals[25].sv_id.satId = 151; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[26].residual = -8144; - test_msg->stec_residuals[26].sv_id.constellation = 54; - test_msg->stec_residuals[26].sv_id.satId = 5; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[27].residual = 23612; - test_msg->stec_residuals[27].sv_id.constellation = 129; - test_msg->stec_residuals[27].sv_id.satId = 181; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[28].residual = 28013; - test_msg->stec_residuals[28].sv_id.constellation = 114; - test_msg->stec_residuals[28].sv_id.satId = 171; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[29].residual = 2166; - test_msg->stec_residuals[29].sv_id.constellation = 23; - test_msg->stec_residuals[29].sv_id.satId = 12; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[30].residual = -10186; - test_msg->stec_residuals[30].sv_id.constellation = 159; - test_msg->stec_residuals[30].sv_id.satId = 64; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[31].residual = 17432; - test_msg->stec_residuals[31].sv_id.constellation = 20; - test_msg->stec_residuals[31].sv_id.satId = 33; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[32].residual = -8666; - test_msg->stec_residuals[32].sv_id.constellation = 36; - test_msg->stec_residuals[32].sv_id.satId = 160; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[33].residual = 25436; - test_msg->stec_residuals[33].sv_id.constellation = 190; - test_msg->stec_residuals[33].sv_id.satId = 145; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[34].residual = -3864; - test_msg->stec_residuals[34].sv_id.constellation = 159; - test_msg->stec_residuals[34].sv_id.satId = 108; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[35].residual = 4093; - test_msg->stec_residuals[35].sv_id.constellation = 221; - test_msg->stec_residuals[35].sv_id.satId = 227; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[36].residual = -18055; - test_msg->stec_residuals[36].sv_id.constellation = 23; - test_msg->stec_residuals[36].sv_id.satId = 62; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[37].residual = -27900; - test_msg->stec_residuals[37].sv_id.constellation = 116; - test_msg->stec_residuals[37].sv_id.satId = 168; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[38].residual = 30687; - test_msg->stec_residuals[38].sv_id.constellation = 72; - test_msg->stec_residuals[38].sv_id.satId = 123; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[39].residual = -13151; - test_msg->stec_residuals[39].sv_id.constellation = 242; - test_msg->stec_residuals[39].sv_id.satId = 226; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[40].residual = -22903; - test_msg->stec_residuals[40].sv_id.constellation = 202; - test_msg->stec_residuals[40].sv_id.satId = 180; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[41].residual = 4988; - test_msg->stec_residuals[41].sv_id.constellation = 24; - test_msg->stec_residuals[41].sv_id.satId = 58; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[42].residual = 27408; - test_msg->stec_residuals[42].sv_id.constellation = 188; - test_msg->stec_residuals[42].sv_id.satId = 181; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[43].residual = 319; - test_msg->stec_residuals[43].sv_id.constellation = 231; - test_msg->stec_residuals[43].sv_id.satId = 66; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[44].residual = 15987; - test_msg->stec_residuals[44].sv_id.constellation = 252; - test_msg->stec_residuals[44].sv_id.satId = 64; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[45].residual = 22266; - test_msg->stec_residuals[45].sv_id.constellation = 97; - test_msg->stec_residuals[45].sv_id.satId = 233; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[46].residual = -19919; - test_msg->stec_residuals[46].sv_id.constellation = 221; - test_msg->stec_residuals[46].sv_id.satId = 156; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[47].residual = 17350; - test_msg->stec_residuals[47].sv_id.constellation = 73; - test_msg->stec_residuals[47].sv_id.satId = 32; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[48].residual = 14410; - test_msg->stec_residuals[48].sv_id.constellation = 253; - test_msg->stec_residuals[48].sv_id.satId = 249; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[49].residual = 23671; - test_msg->stec_residuals[49].sv_id.constellation = 165; - test_msg->stec_residuals[49].sv_id.satId = 38; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[50].residual = -31905; - test_msg->stec_residuals[50].sv_id.constellation = 44; - test_msg->stec_residuals[50].sv_id.satId = 99; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[51].residual = 14305; - test_msg->stec_residuals[51].sv_id.constellation = 192; - test_msg->stec_residuals[51].sv_id.satId = 89; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[52].residual = -12968; - test_msg->stec_residuals[52].sv_id.constellation = 171; - test_msg->stec_residuals[52].sv_id.satId = 95; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[53].residual = 21479; - test_msg->stec_residuals[53].sv_id.constellation = 116; - test_msg->stec_residuals[53].sv_id.satId = 21; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[54].residual = 28260; - test_msg->stec_residuals[54].sv_id.constellation = 71; - test_msg->stec_residuals[54].sv_id.satId = 71; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[55].residual = -11112; - test_msg->stec_residuals[55].sv_id.constellation = 254; - test_msg->stec_residuals[55].sv_id.satId = 217; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[56].residual = -25304; - test_msg->stec_residuals[56].sv_id.constellation = 8; - test_msg->stec_residuals[56].sv_id.satId = 18; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[57].residual = -4024; - test_msg->stec_residuals[57].sv_id.constellation = 54; - test_msg->stec_residuals[57].sv_id.satId = 244; - if (sizeof(test_msg->stec_residuals) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->stec_residuals[0])); - } - test_msg->stec_residuals[58].residual = -15505; - test_msg->stec_residuals[58].sv_id.constellation = 189; - test_msg->stec_residuals[58].sv_id.satId = 231; - test_msg->tropo_delay_correction.hydro = 16250; - test_msg->tropo_delay_correction.wet = 101; - - EXPECT_EQ(send_message(0x5f0, 7270, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 7270); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.iod_atmo)>( - reinterpret_cast(&last_msg_->header.iod_atmo)), - 236) - << "incorrect value for header.iod_atmo, expected 236, is " - << last_msg_->header.iod_atmo; - EXPECT_EQ(get_asheader.num_msgs)>( - reinterpret_cast(&last_msg_->header.num_msgs)), - 62837) - << "incorrect value for header.num_msgs, expected 62837, is " - << last_msg_->header.num_msgs; - EXPECT_EQ(get_asheader.seq_num)>( - reinterpret_cast(&last_msg_->header.seq_num)), - 63555) - << "incorrect value for header.seq_num, expected 63555, is " - << last_msg_->header.seq_num; - EXPECT_EQ(get_asheader.time.tow)>( - reinterpret_cast(&last_msg_->header.time.tow)), - 2837573811) - << "incorrect value for header.time.tow, expected 2837573811, is " - << last_msg_->header.time.tow; - EXPECT_EQ(get_asheader.time.wn)>( - reinterpret_cast(&last_msg_->header.time.wn)), - 8940) - << "incorrect value for header.time.wn, expected 8940, is " - << last_msg_->header.time.wn; - EXPECT_EQ(get_asheader.tropo_quality_indicator)>( - reinterpret_cast( - &last_msg_->header.tropo_quality_indicator)), - 230) - << "incorrect value for header.tropo_quality_indicator, expected 230, is " - << last_msg_->header.tropo_quality_indicator; - EXPECT_EQ(get_asheader.update_interval)>( - reinterpret_cast( - &last_msg_->header.update_interval)), - 233) - << "incorrect value for header.update_interval, expected 233, is " - << last_msg_->header.update_interval; - EXPECT_EQ(get_asindex)>( - reinterpret_cast(&last_msg_->index)), - 26598) - << "incorrect value for index, expected 26598, is " << last_msg_->index; - EXPECT_EQ(get_asstec_residuals[0].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[0].residual)), - -23949) - << "incorrect value for stec_residuals[0].residual, expected -23949, is " - << last_msg_->stec_residuals[0].residual; - EXPECT_EQ(get_asstec_residuals[0].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[0].sv_id.constellation)), - 157) - << "incorrect value for stec_residuals[0].sv_id.constellation, expected " - "157, is " - << last_msg_->stec_residuals[0].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[0].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[0].sv_id.satId)), - 231) - << "incorrect value for stec_residuals[0].sv_id.satId, expected 231, is " - << last_msg_->stec_residuals[0].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[1].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[1].residual)), - 27427) - << "incorrect value for stec_residuals[1].residual, expected 27427, is " - << last_msg_->stec_residuals[1].residual; - EXPECT_EQ(get_asstec_residuals[1].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[1].sv_id.constellation)), - 146) - << "incorrect value for stec_residuals[1].sv_id.constellation, expected " - "146, is " - << last_msg_->stec_residuals[1].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[1].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[1].sv_id.satId)), - 197) - << "incorrect value for stec_residuals[1].sv_id.satId, expected 197, is " - << last_msg_->stec_residuals[1].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[2].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[2].residual)), - 10548) - << "incorrect value for stec_residuals[2].residual, expected 10548, is " - << last_msg_->stec_residuals[2].residual; - EXPECT_EQ(get_asstec_residuals[2].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[2].sv_id.constellation)), - 109) - << "incorrect value for stec_residuals[2].sv_id.constellation, expected " - "109, is " - << last_msg_->stec_residuals[2].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[2].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[2].sv_id.satId)), - 222) - << "incorrect value for stec_residuals[2].sv_id.satId, expected 222, is " - << last_msg_->stec_residuals[2].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[3].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[3].residual)), - -18195) - << "incorrect value for stec_residuals[3].residual, expected -18195, is " - << last_msg_->stec_residuals[3].residual; - EXPECT_EQ(get_asstec_residuals[3].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[3].sv_id.constellation)), - 12) - << "incorrect value for stec_residuals[3].sv_id.constellation, expected " - "12, is " - << last_msg_->stec_residuals[3].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[3].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[3].sv_id.satId)), - 86) - << "incorrect value for stec_residuals[3].sv_id.satId, expected 86, is " - << last_msg_->stec_residuals[3].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[4].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[4].residual)), - -27511) - << "incorrect value for stec_residuals[4].residual, expected -27511, is " - << last_msg_->stec_residuals[4].residual; - EXPECT_EQ(get_asstec_residuals[4].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[4].sv_id.constellation)), - 204) - << "incorrect value for stec_residuals[4].sv_id.constellation, expected " - "204, is " - << last_msg_->stec_residuals[4].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[4].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[4].sv_id.satId)), - 65) - << "incorrect value for stec_residuals[4].sv_id.satId, expected 65, is " - << last_msg_->stec_residuals[4].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[5].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[5].residual)), - 11) - << "incorrect value for stec_residuals[5].residual, expected 11, is " - << last_msg_->stec_residuals[5].residual; - EXPECT_EQ(get_asstec_residuals[5].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[5].sv_id.constellation)), - 183) - << "incorrect value for stec_residuals[5].sv_id.constellation, expected " - "183, is " - << last_msg_->stec_residuals[5].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[5].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[5].sv_id.satId)), - 171) - << "incorrect value for stec_residuals[5].sv_id.satId, expected 171, is " - << last_msg_->stec_residuals[5].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[6].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[6].residual)), - 13740) - << "incorrect value for stec_residuals[6].residual, expected 13740, is " - << last_msg_->stec_residuals[6].residual; - EXPECT_EQ(get_asstec_residuals[6].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[6].sv_id.constellation)), - 203) - << "incorrect value for stec_residuals[6].sv_id.constellation, expected " - "203, is " - << last_msg_->stec_residuals[6].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[6].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[6].sv_id.satId)), - 180) - << "incorrect value for stec_residuals[6].sv_id.satId, expected 180, is " - << last_msg_->stec_residuals[6].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[7].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[7].residual)), - 29626) - << "incorrect value for stec_residuals[7].residual, expected 29626, is " - << last_msg_->stec_residuals[7].residual; - EXPECT_EQ(get_asstec_residuals[7].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[7].sv_id.constellation)), - 85) - << "incorrect value for stec_residuals[7].sv_id.constellation, expected " - "85, is " - << last_msg_->stec_residuals[7].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[7].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[7].sv_id.satId)), - 196) - << "incorrect value for stec_residuals[7].sv_id.satId, expected 196, is " - << last_msg_->stec_residuals[7].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[8].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[8].residual)), - 7846) - << "incorrect value for stec_residuals[8].residual, expected 7846, is " - << last_msg_->stec_residuals[8].residual; - EXPECT_EQ(get_asstec_residuals[8].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[8].sv_id.constellation)), - 92) - << "incorrect value for stec_residuals[8].sv_id.constellation, expected " - "92, is " - << last_msg_->stec_residuals[8].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[8].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[8].sv_id.satId)), - 203) - << "incorrect value for stec_residuals[8].sv_id.satId, expected 203, is " - << last_msg_->stec_residuals[8].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[9].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[9].residual)), - 18376) - << "incorrect value for stec_residuals[9].residual, expected 18376, is " - << last_msg_->stec_residuals[9].residual; - EXPECT_EQ(get_asstec_residuals[9].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[9].sv_id.constellation)), - 13) - << "incorrect value for stec_residuals[9].sv_id.constellation, expected " - "13, is " - << last_msg_->stec_residuals[9].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[9].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[9].sv_id.satId)), - 42) - << "incorrect value for stec_residuals[9].sv_id.satId, expected 42, is " - << last_msg_->stec_residuals[9].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[10].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[10].residual)), - -24357) - << "incorrect value for stec_residuals[10].residual, expected -24357, is " - << last_msg_->stec_residuals[10].residual; - EXPECT_EQ(get_asstec_residuals[10].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[10].sv_id.constellation)), - 137) - << "incorrect value for stec_residuals[10].sv_id.constellation, expected " - "137, is " - << last_msg_->stec_residuals[10].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[10].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[10].sv_id.satId)), - 98) - << "incorrect value for stec_residuals[10].sv_id.satId, expected 98, is " - << last_msg_->stec_residuals[10].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[11].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[11].residual)), - -1441) - << "incorrect value for stec_residuals[11].residual, expected -1441, is " - << last_msg_->stec_residuals[11].residual; - EXPECT_EQ(get_asstec_residuals[11].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[11].sv_id.constellation)), - 216) - << "incorrect value for stec_residuals[11].sv_id.constellation, expected " - "216, is " - << last_msg_->stec_residuals[11].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[11].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[11].sv_id.satId)), - 95) - << "incorrect value for stec_residuals[11].sv_id.satId, expected 95, is " - << last_msg_->stec_residuals[11].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[12].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[12].residual)), - -10660) - << "incorrect value for stec_residuals[12].residual, expected -10660, is " - << last_msg_->stec_residuals[12].residual; - EXPECT_EQ(get_asstec_residuals[12].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[12].sv_id.constellation)), - 196) - << "incorrect value for stec_residuals[12].sv_id.constellation, expected " - "196, is " - << last_msg_->stec_residuals[12].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[12].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[12].sv_id.satId)), - 99) - << "incorrect value for stec_residuals[12].sv_id.satId, expected 99, is " - << last_msg_->stec_residuals[12].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[13].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[13].residual)), - -8509) - << "incorrect value for stec_residuals[13].residual, expected -8509, is " - << last_msg_->stec_residuals[13].residual; - EXPECT_EQ(get_asstec_residuals[13].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[13].sv_id.constellation)), - 253) - << "incorrect value for stec_residuals[13].sv_id.constellation, expected " - "253, is " - << last_msg_->stec_residuals[13].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[13].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[13].sv_id.satId)), - 159) - << "incorrect value for stec_residuals[13].sv_id.satId, expected 159, is " - << last_msg_->stec_residuals[13].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[14].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[14].residual)), - 16361) - << "incorrect value for stec_residuals[14].residual, expected 16361, is " - << last_msg_->stec_residuals[14].residual; - EXPECT_EQ(get_asstec_residuals[14].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[14].sv_id.constellation)), - 146) - << "incorrect value for stec_residuals[14].sv_id.constellation, expected " - "146, is " - << last_msg_->stec_residuals[14].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[14].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[14].sv_id.satId)), - 233) - << "incorrect value for stec_residuals[14].sv_id.satId, expected 233, is " - << last_msg_->stec_residuals[14].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[15].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[15].residual)), - 10346) - << "incorrect value for stec_residuals[15].residual, expected 10346, is " - << last_msg_->stec_residuals[15].residual; - EXPECT_EQ(get_asstec_residuals[15].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[15].sv_id.constellation)), - 24) - << "incorrect value for stec_residuals[15].sv_id.constellation, expected " - "24, is " - << last_msg_->stec_residuals[15].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[15].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[15].sv_id.satId)), - 76) - << "incorrect value for stec_residuals[15].sv_id.satId, expected 76, is " - << last_msg_->stec_residuals[15].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[16].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[16].residual)), - -18679) - << "incorrect value for stec_residuals[16].residual, expected -18679, is " - << last_msg_->stec_residuals[16].residual; - EXPECT_EQ(get_asstec_residuals[16].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[16].sv_id.constellation)), - 65) - << "incorrect value for stec_residuals[16].sv_id.constellation, expected " - "65, is " - << last_msg_->stec_residuals[16].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[16].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[16].sv_id.satId)), - 253) - << "incorrect value for stec_residuals[16].sv_id.satId, expected 253, is " - << last_msg_->stec_residuals[16].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[17].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[17].residual)), - 15292) - << "incorrect value for stec_residuals[17].residual, expected 15292, is " - << last_msg_->stec_residuals[17].residual; - EXPECT_EQ(get_asstec_residuals[17].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[17].sv_id.constellation)), - 215) - << "incorrect value for stec_residuals[17].sv_id.constellation, expected " - "215, is " - << last_msg_->stec_residuals[17].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[17].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[17].sv_id.satId)), - 40) - << "incorrect value for stec_residuals[17].sv_id.satId, expected 40, is " - << last_msg_->stec_residuals[17].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[18].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[18].residual)), - 29537) - << "incorrect value for stec_residuals[18].residual, expected 29537, is " - << last_msg_->stec_residuals[18].residual; - EXPECT_EQ(get_asstec_residuals[18].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[18].sv_id.constellation)), - 69) - << "incorrect value for stec_residuals[18].sv_id.constellation, expected " - "69, is " - << last_msg_->stec_residuals[18].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[18].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[18].sv_id.satId)), - 117) - << "incorrect value for stec_residuals[18].sv_id.satId, expected 117, is " - << last_msg_->stec_residuals[18].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[19].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[19].residual)), - -29440) - << "incorrect value for stec_residuals[19].residual, expected -29440, is " - << last_msg_->stec_residuals[19].residual; - EXPECT_EQ(get_asstec_residuals[19].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[19].sv_id.constellation)), - 56) - << "incorrect value for stec_residuals[19].sv_id.constellation, expected " - "56, is " - << last_msg_->stec_residuals[19].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[19].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[19].sv_id.satId)), - 60) - << "incorrect value for stec_residuals[19].sv_id.satId, expected 60, is " - << last_msg_->stec_residuals[19].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[20].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[20].residual)), - -24266) - << "incorrect value for stec_residuals[20].residual, expected -24266, is " - << last_msg_->stec_residuals[20].residual; - EXPECT_EQ(get_asstec_residuals[20].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[20].sv_id.constellation)), - 171) - << "incorrect value for stec_residuals[20].sv_id.constellation, expected " - "171, is " - << last_msg_->stec_residuals[20].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[20].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[20].sv_id.satId)), - 207) - << "incorrect value for stec_residuals[20].sv_id.satId, expected 207, is " - << last_msg_->stec_residuals[20].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[21].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[21].residual)), - 22272) - << "incorrect value for stec_residuals[21].residual, expected 22272, is " - << last_msg_->stec_residuals[21].residual; - EXPECT_EQ(get_asstec_residuals[21].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[21].sv_id.constellation)), - 61) - << "incorrect value for stec_residuals[21].sv_id.constellation, expected " - "61, is " - << last_msg_->stec_residuals[21].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[21].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[21].sv_id.satId)), - 23) - << "incorrect value for stec_residuals[21].sv_id.satId, expected 23, is " - << last_msg_->stec_residuals[21].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[22].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[22].residual)), - 9303) - << "incorrect value for stec_residuals[22].residual, expected 9303, is " - << last_msg_->stec_residuals[22].residual; - EXPECT_EQ(get_asstec_residuals[22].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[22].sv_id.constellation)), - 123) - << "incorrect value for stec_residuals[22].sv_id.constellation, expected " - "123, is " - << last_msg_->stec_residuals[22].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[22].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[22].sv_id.satId)), - 230) - << "incorrect value for stec_residuals[22].sv_id.satId, expected 230, is " - << last_msg_->stec_residuals[22].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[23].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[23].residual)), - -23794) - << "incorrect value for stec_residuals[23].residual, expected -23794, is " - << last_msg_->stec_residuals[23].residual; - EXPECT_EQ(get_asstec_residuals[23].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[23].sv_id.constellation)), - 255) - << "incorrect value for stec_residuals[23].sv_id.constellation, expected " - "255, is " - << last_msg_->stec_residuals[23].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[23].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[23].sv_id.satId)), - 184) - << "incorrect value for stec_residuals[23].sv_id.satId, expected 184, is " - << last_msg_->stec_residuals[23].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[24].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[24].residual)), - -26837) - << "incorrect value for stec_residuals[24].residual, expected -26837, is " - << last_msg_->stec_residuals[24].residual; - EXPECT_EQ(get_asstec_residuals[24].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[24].sv_id.constellation)), - 224) - << "incorrect value for stec_residuals[24].sv_id.constellation, expected " - "224, is " - << last_msg_->stec_residuals[24].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[24].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[24].sv_id.satId)), - 187) - << "incorrect value for stec_residuals[24].sv_id.satId, expected 187, is " - << last_msg_->stec_residuals[24].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[25].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[25].residual)), - 14631) - << "incorrect value for stec_residuals[25].residual, expected 14631, is " - << last_msg_->stec_residuals[25].residual; - EXPECT_EQ(get_asstec_residuals[25].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[25].sv_id.constellation)), - 104) - << "incorrect value for stec_residuals[25].sv_id.constellation, expected " - "104, is " - << last_msg_->stec_residuals[25].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[25].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[25].sv_id.satId)), - 151) - << "incorrect value for stec_residuals[25].sv_id.satId, expected 151, is " - << last_msg_->stec_residuals[25].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[26].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[26].residual)), - -8144) - << "incorrect value for stec_residuals[26].residual, expected -8144, is " - << last_msg_->stec_residuals[26].residual; - EXPECT_EQ(get_asstec_residuals[26].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[26].sv_id.constellation)), - 54) - << "incorrect value for stec_residuals[26].sv_id.constellation, expected " - "54, is " - << last_msg_->stec_residuals[26].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[26].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[26].sv_id.satId)), - 5) - << "incorrect value for stec_residuals[26].sv_id.satId, expected 5, is " - << last_msg_->stec_residuals[26].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[27].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[27].residual)), - 23612) - << "incorrect value for stec_residuals[27].residual, expected 23612, is " - << last_msg_->stec_residuals[27].residual; - EXPECT_EQ(get_asstec_residuals[27].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[27].sv_id.constellation)), - 129) - << "incorrect value for stec_residuals[27].sv_id.constellation, expected " - "129, is " - << last_msg_->stec_residuals[27].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[27].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[27].sv_id.satId)), - 181) - << "incorrect value for stec_residuals[27].sv_id.satId, expected 181, is " - << last_msg_->stec_residuals[27].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[28].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[28].residual)), - 28013) - << "incorrect value for stec_residuals[28].residual, expected 28013, is " - << last_msg_->stec_residuals[28].residual; - EXPECT_EQ(get_asstec_residuals[28].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[28].sv_id.constellation)), - 114) - << "incorrect value for stec_residuals[28].sv_id.constellation, expected " - "114, is " - << last_msg_->stec_residuals[28].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[28].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[28].sv_id.satId)), - 171) - << "incorrect value for stec_residuals[28].sv_id.satId, expected 171, is " - << last_msg_->stec_residuals[28].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[29].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[29].residual)), - 2166) - << "incorrect value for stec_residuals[29].residual, expected 2166, is " - << last_msg_->stec_residuals[29].residual; - EXPECT_EQ(get_asstec_residuals[29].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[29].sv_id.constellation)), - 23) - << "incorrect value for stec_residuals[29].sv_id.constellation, expected " - "23, is " - << last_msg_->stec_residuals[29].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[29].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[29].sv_id.satId)), - 12) - << "incorrect value for stec_residuals[29].sv_id.satId, expected 12, is " - << last_msg_->stec_residuals[29].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[30].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[30].residual)), - -10186) - << "incorrect value for stec_residuals[30].residual, expected -10186, is " - << last_msg_->stec_residuals[30].residual; - EXPECT_EQ(get_asstec_residuals[30].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[30].sv_id.constellation)), - 159) - << "incorrect value for stec_residuals[30].sv_id.constellation, expected " - "159, is " - << last_msg_->stec_residuals[30].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[30].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[30].sv_id.satId)), - 64) - << "incorrect value for stec_residuals[30].sv_id.satId, expected 64, is " - << last_msg_->stec_residuals[30].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[31].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[31].residual)), - 17432) - << "incorrect value for stec_residuals[31].residual, expected 17432, is " - << last_msg_->stec_residuals[31].residual; - EXPECT_EQ(get_asstec_residuals[31].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[31].sv_id.constellation)), - 20) - << "incorrect value for stec_residuals[31].sv_id.constellation, expected " - "20, is " - << last_msg_->stec_residuals[31].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[31].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[31].sv_id.satId)), - 33) - << "incorrect value for stec_residuals[31].sv_id.satId, expected 33, is " - << last_msg_->stec_residuals[31].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[32].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[32].residual)), - -8666) - << "incorrect value for stec_residuals[32].residual, expected -8666, is " - << last_msg_->stec_residuals[32].residual; - EXPECT_EQ(get_asstec_residuals[32].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[32].sv_id.constellation)), - 36) - << "incorrect value for stec_residuals[32].sv_id.constellation, expected " - "36, is " - << last_msg_->stec_residuals[32].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[32].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[32].sv_id.satId)), - 160) - << "incorrect value for stec_residuals[32].sv_id.satId, expected 160, is " - << last_msg_->stec_residuals[32].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[33].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[33].residual)), - 25436) - << "incorrect value for stec_residuals[33].residual, expected 25436, is " - << last_msg_->stec_residuals[33].residual; - EXPECT_EQ(get_asstec_residuals[33].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[33].sv_id.constellation)), - 190) - << "incorrect value for stec_residuals[33].sv_id.constellation, expected " - "190, is " - << last_msg_->stec_residuals[33].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[33].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[33].sv_id.satId)), - 145) - << "incorrect value for stec_residuals[33].sv_id.satId, expected 145, is " - << last_msg_->stec_residuals[33].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[34].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[34].residual)), - -3864) - << "incorrect value for stec_residuals[34].residual, expected -3864, is " - << last_msg_->stec_residuals[34].residual; - EXPECT_EQ(get_asstec_residuals[34].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[34].sv_id.constellation)), - 159) - << "incorrect value for stec_residuals[34].sv_id.constellation, expected " - "159, is " - << last_msg_->stec_residuals[34].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[34].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[34].sv_id.satId)), - 108) - << "incorrect value for stec_residuals[34].sv_id.satId, expected 108, is " - << last_msg_->stec_residuals[34].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[35].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[35].residual)), - 4093) - << "incorrect value for stec_residuals[35].residual, expected 4093, is " - << last_msg_->stec_residuals[35].residual; - EXPECT_EQ(get_asstec_residuals[35].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[35].sv_id.constellation)), - 221) - << "incorrect value for stec_residuals[35].sv_id.constellation, expected " - "221, is " - << last_msg_->stec_residuals[35].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[35].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[35].sv_id.satId)), - 227) - << "incorrect value for stec_residuals[35].sv_id.satId, expected 227, is " - << last_msg_->stec_residuals[35].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[36].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[36].residual)), - -18055) - << "incorrect value for stec_residuals[36].residual, expected -18055, is " - << last_msg_->stec_residuals[36].residual; - EXPECT_EQ(get_asstec_residuals[36].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[36].sv_id.constellation)), - 23) - << "incorrect value for stec_residuals[36].sv_id.constellation, expected " - "23, is " - << last_msg_->stec_residuals[36].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[36].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[36].sv_id.satId)), - 62) - << "incorrect value for stec_residuals[36].sv_id.satId, expected 62, is " - << last_msg_->stec_residuals[36].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[37].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[37].residual)), - -27900) - << "incorrect value for stec_residuals[37].residual, expected -27900, is " - << last_msg_->stec_residuals[37].residual; - EXPECT_EQ(get_asstec_residuals[37].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[37].sv_id.constellation)), - 116) - << "incorrect value for stec_residuals[37].sv_id.constellation, expected " - "116, is " - << last_msg_->stec_residuals[37].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[37].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[37].sv_id.satId)), - 168) - << "incorrect value for stec_residuals[37].sv_id.satId, expected 168, is " - << last_msg_->stec_residuals[37].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[38].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[38].residual)), - 30687) - << "incorrect value for stec_residuals[38].residual, expected 30687, is " - << last_msg_->stec_residuals[38].residual; - EXPECT_EQ(get_asstec_residuals[38].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[38].sv_id.constellation)), - 72) - << "incorrect value for stec_residuals[38].sv_id.constellation, expected " - "72, is " - << last_msg_->stec_residuals[38].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[38].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[38].sv_id.satId)), - 123) - << "incorrect value for stec_residuals[38].sv_id.satId, expected 123, is " - << last_msg_->stec_residuals[38].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[39].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[39].residual)), - -13151) - << "incorrect value for stec_residuals[39].residual, expected -13151, is " - << last_msg_->stec_residuals[39].residual; - EXPECT_EQ(get_asstec_residuals[39].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[39].sv_id.constellation)), - 242) - << "incorrect value for stec_residuals[39].sv_id.constellation, expected " - "242, is " - << last_msg_->stec_residuals[39].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[39].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[39].sv_id.satId)), - 226) - << "incorrect value for stec_residuals[39].sv_id.satId, expected 226, is " - << last_msg_->stec_residuals[39].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[40].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[40].residual)), - -22903) - << "incorrect value for stec_residuals[40].residual, expected -22903, is " - << last_msg_->stec_residuals[40].residual; - EXPECT_EQ(get_asstec_residuals[40].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[40].sv_id.constellation)), - 202) - << "incorrect value for stec_residuals[40].sv_id.constellation, expected " - "202, is " - << last_msg_->stec_residuals[40].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[40].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[40].sv_id.satId)), - 180) - << "incorrect value for stec_residuals[40].sv_id.satId, expected 180, is " - << last_msg_->stec_residuals[40].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[41].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[41].residual)), - 4988) - << "incorrect value for stec_residuals[41].residual, expected 4988, is " - << last_msg_->stec_residuals[41].residual; - EXPECT_EQ(get_asstec_residuals[41].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[41].sv_id.constellation)), - 24) - << "incorrect value for stec_residuals[41].sv_id.constellation, expected " - "24, is " - << last_msg_->stec_residuals[41].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[41].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[41].sv_id.satId)), - 58) - << "incorrect value for stec_residuals[41].sv_id.satId, expected 58, is " - << last_msg_->stec_residuals[41].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[42].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[42].residual)), - 27408) - << "incorrect value for stec_residuals[42].residual, expected 27408, is " - << last_msg_->stec_residuals[42].residual; - EXPECT_EQ(get_asstec_residuals[42].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[42].sv_id.constellation)), - 188) - << "incorrect value for stec_residuals[42].sv_id.constellation, expected " - "188, is " - << last_msg_->stec_residuals[42].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[42].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[42].sv_id.satId)), - 181) - << "incorrect value for stec_residuals[42].sv_id.satId, expected 181, is " - << last_msg_->stec_residuals[42].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[43].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[43].residual)), - 319) - << "incorrect value for stec_residuals[43].residual, expected 319, is " - << last_msg_->stec_residuals[43].residual; - EXPECT_EQ(get_asstec_residuals[43].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[43].sv_id.constellation)), - 231) - << "incorrect value for stec_residuals[43].sv_id.constellation, expected " - "231, is " - << last_msg_->stec_residuals[43].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[43].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[43].sv_id.satId)), - 66) - << "incorrect value for stec_residuals[43].sv_id.satId, expected 66, is " - << last_msg_->stec_residuals[43].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[44].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[44].residual)), - 15987) - << "incorrect value for stec_residuals[44].residual, expected 15987, is " - << last_msg_->stec_residuals[44].residual; - EXPECT_EQ(get_asstec_residuals[44].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[44].sv_id.constellation)), - 252) - << "incorrect value for stec_residuals[44].sv_id.constellation, expected " - "252, is " - << last_msg_->stec_residuals[44].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[44].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[44].sv_id.satId)), - 64) - << "incorrect value for stec_residuals[44].sv_id.satId, expected 64, is " - << last_msg_->stec_residuals[44].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[45].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[45].residual)), - 22266) - << "incorrect value for stec_residuals[45].residual, expected 22266, is " - << last_msg_->stec_residuals[45].residual; - EXPECT_EQ(get_asstec_residuals[45].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[45].sv_id.constellation)), - 97) - << "incorrect value for stec_residuals[45].sv_id.constellation, expected " - "97, is " - << last_msg_->stec_residuals[45].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[45].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[45].sv_id.satId)), - 233) - << "incorrect value for stec_residuals[45].sv_id.satId, expected 233, is " - << last_msg_->stec_residuals[45].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[46].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[46].residual)), - -19919) - << "incorrect value for stec_residuals[46].residual, expected -19919, is " - << last_msg_->stec_residuals[46].residual; - EXPECT_EQ(get_asstec_residuals[46].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[46].sv_id.constellation)), - 221) - << "incorrect value for stec_residuals[46].sv_id.constellation, expected " - "221, is " - << last_msg_->stec_residuals[46].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[46].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[46].sv_id.satId)), - 156) - << "incorrect value for stec_residuals[46].sv_id.satId, expected 156, is " - << last_msg_->stec_residuals[46].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[47].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[47].residual)), - 17350) - << "incorrect value for stec_residuals[47].residual, expected 17350, is " - << last_msg_->stec_residuals[47].residual; - EXPECT_EQ(get_asstec_residuals[47].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[47].sv_id.constellation)), - 73) - << "incorrect value for stec_residuals[47].sv_id.constellation, expected " - "73, is " - << last_msg_->stec_residuals[47].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[47].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[47].sv_id.satId)), - 32) - << "incorrect value for stec_residuals[47].sv_id.satId, expected 32, is " - << last_msg_->stec_residuals[47].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[48].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[48].residual)), - 14410) - << "incorrect value for stec_residuals[48].residual, expected 14410, is " - << last_msg_->stec_residuals[48].residual; - EXPECT_EQ(get_asstec_residuals[48].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[48].sv_id.constellation)), - 253) - << "incorrect value for stec_residuals[48].sv_id.constellation, expected " - "253, is " - << last_msg_->stec_residuals[48].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[48].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[48].sv_id.satId)), - 249) - << "incorrect value for stec_residuals[48].sv_id.satId, expected 249, is " - << last_msg_->stec_residuals[48].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[49].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[49].residual)), - 23671) - << "incorrect value for stec_residuals[49].residual, expected 23671, is " - << last_msg_->stec_residuals[49].residual; - EXPECT_EQ(get_asstec_residuals[49].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[49].sv_id.constellation)), - 165) - << "incorrect value for stec_residuals[49].sv_id.constellation, expected " - "165, is " - << last_msg_->stec_residuals[49].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[49].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[49].sv_id.satId)), - 38) - << "incorrect value for stec_residuals[49].sv_id.satId, expected 38, is " - << last_msg_->stec_residuals[49].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[50].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[50].residual)), - -31905) - << "incorrect value for stec_residuals[50].residual, expected -31905, is " - << last_msg_->stec_residuals[50].residual; - EXPECT_EQ(get_asstec_residuals[50].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[50].sv_id.constellation)), - 44) - << "incorrect value for stec_residuals[50].sv_id.constellation, expected " - "44, is " - << last_msg_->stec_residuals[50].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[50].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[50].sv_id.satId)), - 99) - << "incorrect value for stec_residuals[50].sv_id.satId, expected 99, is " - << last_msg_->stec_residuals[50].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[51].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[51].residual)), - 14305) - << "incorrect value for stec_residuals[51].residual, expected 14305, is " - << last_msg_->stec_residuals[51].residual; - EXPECT_EQ(get_asstec_residuals[51].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[51].sv_id.constellation)), - 192) - << "incorrect value for stec_residuals[51].sv_id.constellation, expected " - "192, is " - << last_msg_->stec_residuals[51].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[51].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[51].sv_id.satId)), - 89) - << "incorrect value for stec_residuals[51].sv_id.satId, expected 89, is " - << last_msg_->stec_residuals[51].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[52].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[52].residual)), - -12968) - << "incorrect value for stec_residuals[52].residual, expected -12968, is " - << last_msg_->stec_residuals[52].residual; - EXPECT_EQ(get_asstec_residuals[52].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[52].sv_id.constellation)), - 171) - << "incorrect value for stec_residuals[52].sv_id.constellation, expected " - "171, is " - << last_msg_->stec_residuals[52].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[52].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[52].sv_id.satId)), - 95) - << "incorrect value for stec_residuals[52].sv_id.satId, expected 95, is " - << last_msg_->stec_residuals[52].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[53].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[53].residual)), - 21479) - << "incorrect value for stec_residuals[53].residual, expected 21479, is " - << last_msg_->stec_residuals[53].residual; - EXPECT_EQ(get_asstec_residuals[53].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[53].sv_id.constellation)), - 116) - << "incorrect value for stec_residuals[53].sv_id.constellation, expected " - "116, is " - << last_msg_->stec_residuals[53].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[53].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[53].sv_id.satId)), - 21) - << "incorrect value for stec_residuals[53].sv_id.satId, expected 21, is " - << last_msg_->stec_residuals[53].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[54].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[54].residual)), - 28260) - << "incorrect value for stec_residuals[54].residual, expected 28260, is " - << last_msg_->stec_residuals[54].residual; - EXPECT_EQ(get_asstec_residuals[54].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[54].sv_id.constellation)), - 71) - << "incorrect value for stec_residuals[54].sv_id.constellation, expected " - "71, is " - << last_msg_->stec_residuals[54].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[54].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[54].sv_id.satId)), - 71) - << "incorrect value for stec_residuals[54].sv_id.satId, expected 71, is " - << last_msg_->stec_residuals[54].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[55].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[55].residual)), - -11112) - << "incorrect value for stec_residuals[55].residual, expected -11112, is " - << last_msg_->stec_residuals[55].residual; - EXPECT_EQ(get_asstec_residuals[55].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[55].sv_id.constellation)), - 254) - << "incorrect value for stec_residuals[55].sv_id.constellation, expected " - "254, is " - << last_msg_->stec_residuals[55].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[55].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[55].sv_id.satId)), - 217) - << "incorrect value for stec_residuals[55].sv_id.satId, expected 217, is " - << last_msg_->stec_residuals[55].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[56].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[56].residual)), - -25304) - << "incorrect value for stec_residuals[56].residual, expected -25304, is " - << last_msg_->stec_residuals[56].residual; - EXPECT_EQ(get_asstec_residuals[56].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[56].sv_id.constellation)), - 8) - << "incorrect value for stec_residuals[56].sv_id.constellation, expected " - "8, is " - << last_msg_->stec_residuals[56].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[56].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[56].sv_id.satId)), - 18) - << "incorrect value for stec_residuals[56].sv_id.satId, expected 18, is " - << last_msg_->stec_residuals[56].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[57].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[57].residual)), - -4024) - << "incorrect value for stec_residuals[57].residual, expected -4024, is " - << last_msg_->stec_residuals[57].residual; - EXPECT_EQ(get_asstec_residuals[57].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[57].sv_id.constellation)), - 54) - << "incorrect value for stec_residuals[57].sv_id.constellation, expected " - "54, is " - << last_msg_->stec_residuals[57].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[57].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[57].sv_id.satId)), - 244) - << "incorrect value for stec_residuals[57].sv_id.satId, expected 244, is " - << last_msg_->stec_residuals[57].sv_id.satId; - EXPECT_EQ(get_asstec_residuals[58].residual)>( - reinterpret_cast( - &last_msg_->stec_residuals[58].residual)), - -15505) - << "incorrect value for stec_residuals[58].residual, expected -15505, is " - << last_msg_->stec_residuals[58].residual; - EXPECT_EQ(get_asstec_residuals[58].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_residuals[58].sv_id.constellation)), - 189) - << "incorrect value for stec_residuals[58].sv_id.constellation, expected " - "189, is " - << last_msg_->stec_residuals[58].sv_id.constellation; - EXPECT_EQ(get_asstec_residuals[58].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_residuals[58].sv_id.satId)), - 231) - << "incorrect value for stec_residuals[58].sv_id.satId, expected 231, is " - << last_msg_->stec_residuals[58].sv_id.satId; - EXPECT_EQ(get_astropo_delay_correction.hydro)>( - reinterpret_cast( - &last_msg_->tropo_delay_correction.hydro)), - 16250) - << "incorrect value for tropo_delay_correction.hydro, expected 16250, is " - << last_msg_->tropo_delay_correction.hydro; - EXPECT_EQ(get_astropo_delay_correction.wet)>( - reinterpret_cast( - &last_msg_->tropo_delay_correction.wet)), - 101) - << "incorrect value for tropo_delay_correction.wet, expected 101, is " - << last_msg_->tropo_delay_correction.wet; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrOrbitClock.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrOrbitClock.cc deleted file mode 100644 index 45cada52dc..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrOrbitClock.cc +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrOrbitClock.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClock0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClock0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_orbit_clock_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_orbit_clock_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClock0, Test) { - uint8_t encoded_frame[] = { - 85, 221, 5, 53, 229, 50, 83, 208, 102, 207, 164, 29, 203, 212, 236, - 255, 152, 233, 207, 55, 94, 54, 58, 128, 68, 27, 117, 176, 110, 251, - 61, 244, 122, 50, 95, 52, 144, 232, 24, 10, 37, 127, 163, 66, 177, - 105, 156, 245, 10, 249, 107, 218, 17, 186, 56, 72, 14, 22, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_orbit_clock_t *test_msg = (msg_ssr_orbit_clock_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->along = -1334502588; - test_msg->c0 = -174298703; - test_msg->c1 = -630458102; - test_msg->c2 = 1211677201; - test_msg->cross = -197264530; - test_msg->dot_along = 169404560; - test_msg->dot_cross = 1118011173; - test_msg->dot_radial = 878654074; - test_msg->iod = 936372632; - test_msg->iod_ssr = 255; - test_msg->radial = -2143668642; - test_msg->sid.code = 212; - test_msg->sid.sat = 203; - test_msg->time.tow = 3479621715; - test_msg->time.wn = 7588; - test_msg->update_interval = 236; - - EXPECT_EQ(send_message(0x5dd, 58677, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 58677); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asalong)>( - reinterpret_cast(&last_msg_->along)), - -1334502588) - << "incorrect value for along, expected -1334502588, is " - << last_msg_->along; - EXPECT_EQ(get_asc0)>( - reinterpret_cast(&last_msg_->c0)), - -174298703) - << "incorrect value for c0, expected -174298703, is " << last_msg_->c0; - EXPECT_EQ(get_asc1)>( - reinterpret_cast(&last_msg_->c1)), - -630458102) - << "incorrect value for c1, expected -630458102, is " << last_msg_->c1; - EXPECT_EQ(get_asc2)>( - reinterpret_cast(&last_msg_->c2)), - 1211677201) - << "incorrect value for c2, expected 1211677201, is " << last_msg_->c2; - EXPECT_EQ(get_ascross)>( - reinterpret_cast(&last_msg_->cross)), - -197264530) - << "incorrect value for cross, expected -197264530, is " - << last_msg_->cross; - EXPECT_EQ(get_asdot_along)>( - reinterpret_cast(&last_msg_->dot_along)), - 169404560) - << "incorrect value for dot_along, expected 169404560, is " - << last_msg_->dot_along; - EXPECT_EQ(get_asdot_cross)>( - reinterpret_cast(&last_msg_->dot_cross)), - 1118011173) - << "incorrect value for dot_cross, expected 1118011173, is " - << last_msg_->dot_cross; - EXPECT_EQ(get_asdot_radial)>( - reinterpret_cast(&last_msg_->dot_radial)), - 878654074) - << "incorrect value for dot_radial, expected 878654074, is " - << last_msg_->dot_radial; - EXPECT_EQ(get_asiod)>( - reinterpret_cast(&last_msg_->iod)), - 936372632) - << "incorrect value for iod, expected 936372632, is " << last_msg_->iod; - EXPECT_EQ(get_asiod_ssr)>( - reinterpret_cast(&last_msg_->iod_ssr)), - 255) - << "incorrect value for iod_ssr, expected 255, is " << last_msg_->iod_ssr; - EXPECT_EQ(get_asradial)>( - reinterpret_cast(&last_msg_->radial)), - -2143668642) - << "incorrect value for radial, expected -2143668642, is " - << last_msg_->radial; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 212) - << "incorrect value for sid.code, expected 212, is " - << last_msg_->sid.code; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 203) - << "incorrect value for sid.sat, expected 203, is " << last_msg_->sid.sat; - EXPECT_EQ(get_astime.tow)>( - reinterpret_cast(&last_msg_->time.tow)), - 3479621715) - << "incorrect value for time.tow, expected 3479621715, is " - << last_msg_->time.tow; - EXPECT_EQ(get_astime.wn)>( - reinterpret_cast(&last_msg_->time.wn)), - 7588) - << "incorrect value for time.wn, expected 7588, is " - << last_msg_->time.wn; - EXPECT_EQ(get_asupdate_interval)>( - reinterpret_cast(&last_msg_->update_interval)), - 236) - << "incorrect value for update_interval, expected 236, is " - << last_msg_->update_interval; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrOrbitClockBounds.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrOrbitClockBounds.cc deleted file mode 100644 index 354f6a334e..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrOrbitClockBounds.cc +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrOrbitClockBounds.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBounds0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBounds0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_orbit_clock_bounds_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_orbit_clock_bounds_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBounds0, Test) { - uint8_t encoded_frame[] = { - 85, 222, 5, 66, 0, 31, 180, 0, 0, 0, 3, 0, 1, - 2, 3, 48, 15, 1, 2, 24, 39, 38, 37, 1, 2, 3, - 39, 1, 3, 39, 38, 37, 1, 2, 3, 39, 1, 21, 85, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_orbit_clock_bounds_t *test_msg = - (msg_ssr_orbit_clock_bounds_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->const_id = 1; - test_msg->header.num_msgs = 1; - test_msg->header.seq_num = 2; - test_msg->header.sol_id = 48; - test_msg->header.time.tow = 180; - test_msg->header.time.wn = 3; - test_msg->header.update_interval = 3; - test_msg->n_sats = 2; - if (sizeof(test_msg->orbit_clock_bounds) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->orbit_clock_bounds[0])); - } - test_msg->orbit_clock_bounds[0].clock_bound_mu = 39; - test_msg->orbit_clock_bounds[0].clock_bound_sig = 1; - test_msg->orbit_clock_bounds[0].orb_along_bound_mu = 38; - test_msg->orbit_clock_bounds[0].orb_along_bound_sig = 2; - test_msg->orbit_clock_bounds[0].orb_cross_bound_mu = 37; - test_msg->orbit_clock_bounds[0].orb_cross_bound_sig = 3; - test_msg->orbit_clock_bounds[0].orb_radial_bound_mu = 39; - test_msg->orbit_clock_bounds[0].orb_radial_bound_sig = 1; - test_msg->orbit_clock_bounds[0].sat_id = 24; - if (sizeof(test_msg->orbit_clock_bounds) == 0) { - // Cope with variable length arrays - test_msg_len = - (uint8_t)(test_msg_len + sizeof(test_msg->orbit_clock_bounds[0])); - } - test_msg->orbit_clock_bounds[1].clock_bound_mu = 39; - test_msg->orbit_clock_bounds[1].clock_bound_sig = 1; - test_msg->orbit_clock_bounds[1].orb_along_bound_mu = 38; - test_msg->orbit_clock_bounds[1].orb_along_bound_sig = 2; - test_msg->orbit_clock_bounds[1].orb_cross_bound_mu = 37; - test_msg->orbit_clock_bounds[1].orb_cross_bound_sig = 3; - test_msg->orbit_clock_bounds[1].orb_radial_bound_mu = 39; - test_msg->orbit_clock_bounds[1].orb_radial_bound_sig = 1; - test_msg->orbit_clock_bounds[1].sat_id = 3; - test_msg->ssr_iod = 15; - - EXPECT_EQ(send_message(1502, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asconst_id)>( - reinterpret_cast(&last_msg_->const_id)), - 1) - << "incorrect value for const_id, expected 1, is " << last_msg_->const_id; - EXPECT_EQ(get_asheader.num_msgs)>( - reinterpret_cast(&last_msg_->header.num_msgs)), - 1) - << "incorrect value for header.num_msgs, expected 1, is " - << last_msg_->header.num_msgs; - EXPECT_EQ(get_asheader.seq_num)>( - reinterpret_cast(&last_msg_->header.seq_num)), - 2) - << "incorrect value for header.seq_num, expected 2, is " - << last_msg_->header.seq_num; - EXPECT_EQ(get_asheader.sol_id)>( - reinterpret_cast(&last_msg_->header.sol_id)), - 48) - << "incorrect value for header.sol_id, expected 48, is " - << last_msg_->header.sol_id; - EXPECT_EQ(get_asheader.time.tow)>( - reinterpret_cast(&last_msg_->header.time.tow)), - 180) - << "incorrect value for header.time.tow, expected 180, is " - << last_msg_->header.time.tow; - EXPECT_EQ(get_asheader.time.wn)>( - reinterpret_cast(&last_msg_->header.time.wn)), - 3) - << "incorrect value for header.time.wn, expected 3, is " - << last_msg_->header.time.wn; - EXPECT_EQ(get_asheader.update_interval)>( - reinterpret_cast( - &last_msg_->header.update_interval)), - 3) - << "incorrect value for header.update_interval, expected 3, is " - << last_msg_->header.update_interval; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 2) - << "incorrect value for n_sats, expected 2, is " << last_msg_->n_sats; - EXPECT_EQ(get_asorbit_clock_bounds[0].clock_bound_mu)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[0].clock_bound_mu)), - 39) - << "incorrect value for orbit_clock_bounds[0].clock_bound_mu, expected " - "39, is " - << last_msg_->orbit_clock_bounds[0].clock_bound_mu; - EXPECT_EQ(get_asorbit_clock_bounds[0].clock_bound_sig)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[0].clock_bound_sig)), - 1) - << "incorrect value for orbit_clock_bounds[0].clock_bound_sig, expected " - "1, is " - << last_msg_->orbit_clock_bounds[0].clock_bound_sig; - EXPECT_EQ( - get_asorbit_clock_bounds[0].orb_along_bound_mu)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[0].orb_along_bound_mu)), - 38) - << "incorrect value for orbit_clock_bounds[0].orb_along_bound_mu, " - "expected 38, is " - << last_msg_->orbit_clock_bounds[0].orb_along_bound_mu; - EXPECT_EQ( - get_asorbit_clock_bounds[0].orb_along_bound_sig)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[0].orb_along_bound_sig)), - 2) - << "incorrect value for orbit_clock_bounds[0].orb_along_bound_sig, " - "expected 2, is " - << last_msg_->orbit_clock_bounds[0].orb_along_bound_sig; - EXPECT_EQ( - get_asorbit_clock_bounds[0].orb_cross_bound_mu)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[0].orb_cross_bound_mu)), - 37) - << "incorrect value for orbit_clock_bounds[0].orb_cross_bound_mu, " - "expected 37, is " - << last_msg_->orbit_clock_bounds[0].orb_cross_bound_mu; - EXPECT_EQ( - get_asorbit_clock_bounds[0].orb_cross_bound_sig)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[0].orb_cross_bound_sig)), - 3) - << "incorrect value for orbit_clock_bounds[0].orb_cross_bound_sig, " - "expected 3, is " - << last_msg_->orbit_clock_bounds[0].orb_cross_bound_sig; - EXPECT_EQ( - get_asorbit_clock_bounds[0].orb_radial_bound_mu)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[0].orb_radial_bound_mu)), - 39) - << "incorrect value for orbit_clock_bounds[0].orb_radial_bound_mu, " - "expected 39, is " - << last_msg_->orbit_clock_bounds[0].orb_radial_bound_mu; - EXPECT_EQ( - get_asorbit_clock_bounds[0].orb_radial_bound_sig)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[0].orb_radial_bound_sig)), - 1) - << "incorrect value for orbit_clock_bounds[0].orb_radial_bound_sig, " - "expected 1, is " - << last_msg_->orbit_clock_bounds[0].orb_radial_bound_sig; - EXPECT_EQ(get_asorbit_clock_bounds[0].sat_id)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[0].sat_id)), - 24) - << "incorrect value for orbit_clock_bounds[0].sat_id, expected 24, is " - << last_msg_->orbit_clock_bounds[0].sat_id; - EXPECT_EQ(get_asorbit_clock_bounds[1].clock_bound_mu)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[1].clock_bound_mu)), - 39) - << "incorrect value for orbit_clock_bounds[1].clock_bound_mu, expected " - "39, is " - << last_msg_->orbit_clock_bounds[1].clock_bound_mu; - EXPECT_EQ(get_asorbit_clock_bounds[1].clock_bound_sig)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[1].clock_bound_sig)), - 1) - << "incorrect value for orbit_clock_bounds[1].clock_bound_sig, expected " - "1, is " - << last_msg_->orbit_clock_bounds[1].clock_bound_sig; - EXPECT_EQ( - get_asorbit_clock_bounds[1].orb_along_bound_mu)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[1].orb_along_bound_mu)), - 38) - << "incorrect value for orbit_clock_bounds[1].orb_along_bound_mu, " - "expected 38, is " - << last_msg_->orbit_clock_bounds[1].orb_along_bound_mu; - EXPECT_EQ( - get_asorbit_clock_bounds[1].orb_along_bound_sig)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[1].orb_along_bound_sig)), - 2) - << "incorrect value for orbit_clock_bounds[1].orb_along_bound_sig, " - "expected 2, is " - << last_msg_->orbit_clock_bounds[1].orb_along_bound_sig; - EXPECT_EQ( - get_asorbit_clock_bounds[1].orb_cross_bound_mu)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[1].orb_cross_bound_mu)), - 37) - << "incorrect value for orbit_clock_bounds[1].orb_cross_bound_mu, " - "expected 37, is " - << last_msg_->orbit_clock_bounds[1].orb_cross_bound_mu; - EXPECT_EQ( - get_asorbit_clock_bounds[1].orb_cross_bound_sig)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[1].orb_cross_bound_sig)), - 3) - << "incorrect value for orbit_clock_bounds[1].orb_cross_bound_sig, " - "expected 3, is " - << last_msg_->orbit_clock_bounds[1].orb_cross_bound_sig; - EXPECT_EQ( - get_asorbit_clock_bounds[1].orb_radial_bound_mu)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[1].orb_radial_bound_mu)), - 39) - << "incorrect value for orbit_clock_bounds[1].orb_radial_bound_mu, " - "expected 39, is " - << last_msg_->orbit_clock_bounds[1].orb_radial_bound_mu; - EXPECT_EQ( - get_asorbit_clock_bounds[1].orb_radial_bound_sig)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[1].orb_radial_bound_sig)), - 1) - << "incorrect value for orbit_clock_bounds[1].orb_radial_bound_sig, " - "expected 1, is " - << last_msg_->orbit_clock_bounds[1].orb_radial_bound_sig; - EXPECT_EQ(get_asorbit_clock_bounds[1].sat_id)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds[1].sat_id)), - 3) - << "incorrect value for orbit_clock_bounds[1].sat_id, expected 3, is " - << last_msg_->orbit_clock_bounds[1].sat_id; - EXPECT_EQ(get_asssr_iod)>( - reinterpret_cast(&last_msg_->ssr_iod)), - 15) - << "incorrect value for ssr_iod, expected 15, is " << last_msg_->ssr_iod; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrOrbitClockBoundsDegradation.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrOrbitClockBoundsDegradation.cc deleted file mode 100644 index 6491fc0506..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrOrbitClockBoundsDegradation.cc +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrOrbitClockBoundsDegradation.yaml -// by generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBoundsDegradation0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBoundsDegradation0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg( - uint16_t sender_id, uint8_t message_length, - const msg_ssr_orbit_clock_bounds_degradation_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_orbit_clock_bounds_degradation_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClockBoundsDegradation0, - Test) { - uint8_t encoded_frame[] = { - 85, 223, 5, 66, 0, 28, 180, 0, 0, 0, 3, 0, - 1, 2, 3, 48, 15, 1, 10, 0, 0, 0, 0, 0, - 0, 0, 200, 199, 198, 197, 196, 195, 194, 193, 200, 117, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_orbit_clock_bounds_degradation_t *test_msg = - (msg_ssr_orbit_clock_bounds_degradation_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->const_id = 1; - test_msg->header.num_msgs = 1; - test_msg->header.seq_num = 2; - test_msg->header.sol_id = 48; - test_msg->header.time.tow = 180; - test_msg->header.time.wn = 3; - test_msg->header.update_interval = 3; - test_msg->orbit_clock_bounds_degradation.clock_bound_mu_dot = 194; - test_msg->orbit_clock_bounds_degradation.clock_bound_sig_dot = 193; - test_msg->orbit_clock_bounds_degradation.orb_along_bound_mu_dot = 199; - test_msg->orbit_clock_bounds_degradation.orb_along_bound_sig_dot = 196; - test_msg->orbit_clock_bounds_degradation.orb_cross_bound_mu_dot = 198; - test_msg->orbit_clock_bounds_degradation.orb_cross_bound_sig_dot = 195; - test_msg->orbit_clock_bounds_degradation.orb_radial_bound_mu_dot = 200; - test_msg->orbit_clock_bounds_degradation.orb_radial_bound_sig_dot = 197; - test_msg->sat_bitmask = 10; - test_msg->ssr_iod = 15; - - EXPECT_EQ(send_message(1503, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asconst_id)>( - reinterpret_cast(&last_msg_->const_id)), - 1) - << "incorrect value for const_id, expected 1, is " << last_msg_->const_id; - EXPECT_EQ(get_asheader.num_msgs)>( - reinterpret_cast(&last_msg_->header.num_msgs)), - 1) - << "incorrect value for header.num_msgs, expected 1, is " - << last_msg_->header.num_msgs; - EXPECT_EQ(get_asheader.seq_num)>( - reinterpret_cast(&last_msg_->header.seq_num)), - 2) - << "incorrect value for header.seq_num, expected 2, is " - << last_msg_->header.seq_num; - EXPECT_EQ(get_asheader.sol_id)>( - reinterpret_cast(&last_msg_->header.sol_id)), - 48) - << "incorrect value for header.sol_id, expected 48, is " - << last_msg_->header.sol_id; - EXPECT_EQ(get_asheader.time.tow)>( - reinterpret_cast(&last_msg_->header.time.tow)), - 180) - << "incorrect value for header.time.tow, expected 180, is " - << last_msg_->header.time.tow; - EXPECT_EQ(get_asheader.time.wn)>( - reinterpret_cast(&last_msg_->header.time.wn)), - 3) - << "incorrect value for header.time.wn, expected 3, is " - << last_msg_->header.time.wn; - EXPECT_EQ(get_asheader.update_interval)>( - reinterpret_cast( - &last_msg_->header.update_interval)), - 3) - << "incorrect value for header.update_interval, expected 3, is " - << last_msg_->header.update_interval; - EXPECT_EQ( - get_asorbit_clock_bounds_degradation.clock_bound_mu_dot)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds_degradation.clock_bound_mu_dot)), - 194) - << "incorrect value for " - "orbit_clock_bounds_degradation.clock_bound_mu_dot, expected 194, is " - << last_msg_->orbit_clock_bounds_degradation.clock_bound_mu_dot; - EXPECT_EQ( - get_asorbit_clock_bounds_degradation.clock_bound_sig_dot)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds_degradation.clock_bound_sig_dot)), - 193) - << "incorrect value for " - "orbit_clock_bounds_degradation.clock_bound_sig_dot, expected 193, is " - << last_msg_->orbit_clock_bounds_degradation.clock_bound_sig_dot; - EXPECT_EQ( - get_asorbit_clock_bounds_degradation.orb_along_bound_mu_dot)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds_degradation - .orb_along_bound_mu_dot)), - 199) - << "incorrect value for " - "orbit_clock_bounds_degradation.orb_along_bound_mu_dot, expected 199, " - "is " - << last_msg_->orbit_clock_bounds_degradation.orb_along_bound_mu_dot; - EXPECT_EQ( - get_asorbit_clock_bounds_degradation.orb_along_bound_sig_dot)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds_degradation - .orb_along_bound_sig_dot)), - 196) - << "incorrect value for " - "orbit_clock_bounds_degradation.orb_along_bound_sig_dot, expected " - "196, is " - << last_msg_->orbit_clock_bounds_degradation.orb_along_bound_sig_dot; - EXPECT_EQ( - get_asorbit_clock_bounds_degradation.orb_cross_bound_mu_dot)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds_degradation - .orb_cross_bound_mu_dot)), - 198) - << "incorrect value for " - "orbit_clock_bounds_degradation.orb_cross_bound_mu_dot, expected 198, " - "is " - << last_msg_->orbit_clock_bounds_degradation.orb_cross_bound_mu_dot; - EXPECT_EQ( - get_asorbit_clock_bounds_degradation.orb_cross_bound_sig_dot)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds_degradation - .orb_cross_bound_sig_dot)), - 195) - << "incorrect value for " - "orbit_clock_bounds_degradation.orb_cross_bound_sig_dot, expected " - "195, is " - << last_msg_->orbit_clock_bounds_degradation.orb_cross_bound_sig_dot; - EXPECT_EQ( - get_asorbit_clock_bounds_degradation.orb_radial_bound_mu_dot)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds_degradation - .orb_radial_bound_mu_dot)), - 200) - << "incorrect value for " - "orbit_clock_bounds_degradation.orb_radial_bound_mu_dot, expected " - "200, is " - << last_msg_->orbit_clock_bounds_degradation.orb_radial_bound_mu_dot; - EXPECT_EQ( - get_asorbit_clock_bounds_degradation.orb_radial_bound_sig_dot)>( - reinterpret_cast( - &last_msg_->orbit_clock_bounds_degradation - .orb_radial_bound_sig_dot)), - 197) - << "incorrect value for " - "orbit_clock_bounds_degradation.orb_radial_bound_sig_dot, expected " - "197, is " - << last_msg_->orbit_clock_bounds_degradation.orb_radial_bound_sig_dot; - EXPECT_EQ(get_assat_bitmask)>( - reinterpret_cast(&last_msg_->sat_bitmask)), - 10) - << "incorrect value for sat_bitmask, expected 10, is " - << last_msg_->sat_bitmask; - EXPECT_EQ(get_asssr_iod)>( - reinterpret_cast(&last_msg_->ssr_iod)), - 15) - << "incorrect value for ssr_iod, expected 15, is " << last_msg_->ssr_iod; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrOrbitClockDepA.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrOrbitClockDepA.cc deleted file mode 100644 index e85db0267e..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrOrbitClockDepA.cc +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrOrbitClockDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClockDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClockDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_orbit_clock_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_orbit_clock_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrOrbitClockDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 220, 5, 33, 166, 47, 225, 114, 31, 189, 43, 30, 1, 30, - 194, 211, 193, 175, 161, 143, 254, 56, 63, 232, 7, 216, 69, 1, - 110, 165, 124, 196, 189, 27, 116, 88, 4, 61, 3, 151, 18, 171, - 147, 46, 198, 85, 243, 245, 225, 235, 123, 181, 210, 157, 252, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_orbit_clock_dep_a_t *test_msg = - (msg_ssr_orbit_clock_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->along = 132661048; - test_msg->c0 = -970026069; - test_msg->c1 = -503975083; - test_msg->c2 = -759858197; - test_msg->cross = 1845577176; - test_msg->dot_along = 72905755; - test_msg->dot_cross = 311886653; - test_msg->dot_radial = -1111196507; - test_msg->iod = 193; - test_msg->iod_ssr = 211; - test_msg->radial = -24141393; - test_msg->sid.code = 30; - test_msg->sid.sat = 1; - test_msg->time.tow = 3172954849; - test_msg->time.wn = 7723; - test_msg->update_interval = 194; - - EXPECT_EQ(send_message(0x5dc, 42529, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 42529); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asalong)>( - reinterpret_cast(&last_msg_->along)), - 132661048) - << "incorrect value for along, expected 132661048, is " - << last_msg_->along; - EXPECT_EQ(get_asc0)>( - reinterpret_cast(&last_msg_->c0)), - -970026069) - << "incorrect value for c0, expected -970026069, is " << last_msg_->c0; - EXPECT_EQ(get_asc1)>( - reinterpret_cast(&last_msg_->c1)), - -503975083) - << "incorrect value for c1, expected -503975083, is " << last_msg_->c1; - EXPECT_EQ(get_asc2)>( - reinterpret_cast(&last_msg_->c2)), - -759858197) - << "incorrect value for c2, expected -759858197, is " << last_msg_->c2; - EXPECT_EQ(get_ascross)>( - reinterpret_cast(&last_msg_->cross)), - 1845577176) - << "incorrect value for cross, expected 1845577176, is " - << last_msg_->cross; - EXPECT_EQ(get_asdot_along)>( - reinterpret_cast(&last_msg_->dot_along)), - 72905755) - << "incorrect value for dot_along, expected 72905755, is " - << last_msg_->dot_along; - EXPECT_EQ(get_asdot_cross)>( - reinterpret_cast(&last_msg_->dot_cross)), - 311886653) - << "incorrect value for dot_cross, expected 311886653, is " - << last_msg_->dot_cross; - EXPECT_EQ(get_asdot_radial)>( - reinterpret_cast(&last_msg_->dot_radial)), - -1111196507) - << "incorrect value for dot_radial, expected -1111196507, is " - << last_msg_->dot_radial; - EXPECT_EQ(get_asiod)>( - reinterpret_cast(&last_msg_->iod)), - 193) - << "incorrect value for iod, expected 193, is " << last_msg_->iod; - EXPECT_EQ(get_asiod_ssr)>( - reinterpret_cast(&last_msg_->iod_ssr)), - 211) - << "incorrect value for iod_ssr, expected 211, is " << last_msg_->iod_ssr; - EXPECT_EQ(get_asradial)>( - reinterpret_cast(&last_msg_->radial)), - -24141393) - << "incorrect value for radial, expected -24141393, is " - << last_msg_->radial; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 30) - << "incorrect value for sid.code, expected 30, is " - << last_msg_->sid.code; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 1) - << "incorrect value for sid.sat, expected 1, is " << last_msg_->sid.sat; - EXPECT_EQ(get_astime.tow)>( - reinterpret_cast(&last_msg_->time.tow)), - 3172954849) - << "incorrect value for time.tow, expected 3172954849, is " - << last_msg_->time.tow; - EXPECT_EQ(get_astime.wn)>( - reinterpret_cast(&last_msg_->time.wn)), - 7723) - << "incorrect value for time.wn, expected 7723, is " - << last_msg_->time.wn; - EXPECT_EQ(get_asupdate_interval)>( - reinterpret_cast(&last_msg_->update_interval)), - 194) - << "incorrect value for update_interval, expected 194, is " - << last_msg_->update_interval; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrPhaseBiases.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrPhaseBiases.cc deleted file mode 100644 index 396e30fd3c..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrPhaseBiases.cc +++ /dev/null @@ -1,1357 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrPhaseBiases.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrPhaseBiases0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrPhaseBiases0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_phase_biases_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_phase_biases_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrPhaseBiases0, Test) { - uint8_t encoded_frame[] = { - 85, 230, 5, 219, 206, 255, 209, 154, 144, 12, 213, 164, 169, 82, 177, - 230, 98, 209, 249, 22, 17, 29, 250, 245, 193, 219, 30, 212, 177, 207, - 187, 33, 146, 58, 204, 164, 65, 114, 49, 248, 52, 8, 161, 44, 252, - 166, 168, 232, 124, 134, 86, 173, 241, 174, 44, 142, 155, 129, 143, 184, - 161, 211, 15, 36, 189, 208, 194, 221, 152, 16, 203, 87, 34, 188, 141, - 104, 189, 102, 156, 252, 22, 251, 136, 49, 188, 157, 222, 245, 49, 132, - 16, 34, 142, 228, 85, 139, 221, 197, 235, 98, 74, 107, 70, 36, 38, - 239, 251, 112, 188, 124, 246, 141, 164, 150, 104, 7, 213, 44, 21, 244, - 192, 4, 143, 24, 42, 21, 84, 136, 7, 42, 118, 45, 23, 174, 175, - 129, 54, 169, 14, 213, 2, 197, 98, 60, 13, 207, 105, 100, 129, 72, - 136, 240, 140, 129, 9, 114, 172, 151, 150, 17, 210, 127, 115, 151, 3, - 242, 254, 215, 14, 5, 34, 126, 2, 215, 65, 38, 176, 23, 210, 201, - 97, 36, 207, 92, 224, 26, 116, 155, 211, 165, 47, 102, 38, 67, 199, - 55, 117, 36, 169, 33, 1, 230, 201, 183, 21, 42, 62, 147, 173, 173, - 155, 98, 146, 231, 167, 138, 82, 167, 127, 229, 1, 2, 127, 237, 207, - 116, 90, 115, 159, 3, 42, 66, 145, 250, 201, 7, 251, 2, 75, 230, - 26, 213, 181, 56, 64, 97, 88, 255, 6, 147, 16, 89, 203, 27, 68, - 243, 230, 55, 242, 167, 169, 219, 240, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_phase_biases_t *test_msg = (msg_ssr_phase_biases_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[0].bias = -1311498533; - test_msg->biases[0].code = 29; - test_msg->biases[0].discontinuity_counter = 193; - test_msg->biases[0].integer_indicator = 250; - test_msg->biases[0].widelane_integer_indicator = 245; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[1].bias = 1101319226; - test_msg->biases[1].code = 207; - test_msg->biases[1].discontinuity_counter = 146; - test_msg->biases[1].integer_indicator = 187; - test_msg->biases[1].widelane_integer_indicator = 33; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[2].bias = -64184056; - test_msg->biases[2].code = 114; - test_msg->biases[2].discontinuity_counter = 52; - test_msg->biases[2].integer_indicator = 49; - test_msg->biases[2].widelane_integer_indicator = 248; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[3].bias = -240298362; - test_msg->biases[3].code = 166; - test_msg->biases[3].discontinuity_counter = 124; - test_msg->biases[3].integer_indicator = 168; - test_msg->biases[3].widelane_integer_indicator = 232; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[4].bias = -1581740159; - test_msg->biases[4].code = 174; - test_msg->biases[4].discontinuity_counter = 155; - test_msg->biases[4].integer_indicator = 44; - test_msg->biases[4].widelane_integer_indicator = 142; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[5].bias = -1730297136; - test_msg->biases[5].code = 211; - test_msg->biases[5].discontinuity_counter = 189; - test_msg->biases[5].integer_indicator = 15; - test_msg->biases[5].widelane_integer_indicator = 36; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[6].bias = -1117221444; - test_msg->biases[6].code = 16; - test_msg->biases[6].discontinuity_counter = 34; - test_msg->biases[6].integer_indicator = 203; - test_msg->biases[6].widelane_integer_indicator = 87; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[7].bias = -1137604357; - test_msg->biases[7].code = 102; - test_msg->biases[7].discontinuity_counter = 22; - test_msg->biases[7].integer_indicator = 156; - test_msg->biases[7].widelane_integer_indicator = 252; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[8].bias = -1910370172; - test_msg->biases[8].code = 157; - test_msg->biases[8].discontinuity_counter = 49; - test_msg->biases[8].integer_indicator = 222; - test_msg->biases[8].widelane_integer_indicator = 245; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[9].bias = 1247996869; - test_msg->biases[9].code = 228; - test_msg->biases[9].discontinuity_counter = 221; - test_msg->biases[9].integer_indicator = 85; - test_msg->biases[9].widelane_integer_indicator = 139; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[10].bias = -1133446161; - test_msg->biases[10].code = 107; - test_msg->biases[10].discontinuity_counter = 38; - test_msg->biases[10].integer_indicator = 70; - test_msg->biases[10].widelane_integer_indicator = 36; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[11].bias = -720934762; - test_msg->biases[11].code = 124; - test_msg->biases[11].discontinuity_counter = 164; - test_msg->biases[11].integer_indicator = 246; - test_msg->biases[11].widelane_integer_indicator = 141; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[12].bias = 706252548; - test_msg->biases[12].code = 44; - test_msg->biases[12].discontinuity_counter = 192; - test_msg->biases[12].integer_indicator = 21; - test_msg->biases[12].widelane_integer_indicator = 244; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[13].bias = 388855338; - test_msg->biases[13].code = 21; - test_msg->biases[13].discontinuity_counter = 7; - test_msg->biases[13].integer_indicator = 84; - test_msg->biases[13].widelane_integer_indicator = 136; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[14].bias = 47517353; - test_msg->biases[14].code = 174; - test_msg->biases[14].discontinuity_counter = 54; - test_msg->biases[14].integer_indicator = 175; - test_msg->biases[14].widelane_integer_indicator = 129; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[15].bias = -2124125745; - test_msg->biases[15].code = 197; - test_msg->biases[15].discontinuity_counter = 13; - test_msg->biases[15].integer_indicator = 98; - test_msg->biases[15].widelane_integer_indicator = 60; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[16].bias = -1401812607; - test_msg->biases[16].code = 72; - test_msg->biases[16].discontinuity_counter = 140; - test_msg->biases[16].integer_indicator = 136; - test_msg->biases[16].widelane_integer_indicator = 240; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[17].bias = 60257151; - test_msg->biases[17].code = 151; - test_msg->biases[17].discontinuity_counter = 210; - test_msg->biases[17].integer_indicator = 150; - test_msg->biases[17].widelane_integer_indicator = 17; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[18].bias = 41820677; - test_msg->biases[18].code = 242; - test_msg->biases[18].discontinuity_counter = 14; - test_msg->biases[18].integer_indicator = 254; - test_msg->biases[18].widelane_integer_indicator = 215; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[19].bias = 1640616471; - test_msg->biases[19].code = 215; - test_msg->biases[19].discontinuity_counter = 176; - test_msg->biases[19].integer_indicator = 65; - test_msg->biases[19].widelane_integer_indicator = 38; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[20].bias = -744786918; - test_msg->biases[20].code = 36; - test_msg->biases[20].discontinuity_counter = 224; - test_msg->biases[20].integer_indicator = 207; - test_msg->biases[20].widelane_integer_indicator = 92; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[21].bias = 1966589763; - test_msg->biases[21].code = 165; - test_msg->biases[21].discontinuity_counter = 38; - test_msg->biases[21].integer_indicator = 47; - test_msg->biases[21].widelane_integer_indicator = 102; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[22].bias = 364366310; - test_msg->biases[22].code = 36; - test_msg->biases[22].discontinuity_counter = 1; - test_msg->biases[22].integer_indicator = 169; - test_msg->biases[22].widelane_integer_indicator = 33; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[23].bias = -1839031379; - test_msg->biases[23].code = 42; - test_msg->biases[23].discontinuity_counter = 173; - test_msg->biases[23].integer_indicator = 62; - test_msg->biases[23].widelane_integer_indicator = 147; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[24].bias = 31817639; - test_msg->biases[24].code = 231; - test_msg->biases[24].discontinuity_counter = 82; - test_msg->biases[24].integer_indicator = 167; - test_msg->biases[24].widelane_integer_indicator = 138; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[25].bias = -1619830156; - test_msg->biases[25].code = 2; - test_msg->biases[25].discontinuity_counter = 207; - test_msg->biases[25].integer_indicator = 127; - test_msg->biases[25].widelane_integer_indicator = 237; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[26].bias = -83375622; - test_msg->biases[26].code = 3; - test_msg->biases[26].discontinuity_counter = 145; - test_msg->biases[26].integer_indicator = 42; - test_msg->biases[26].widelane_integer_indicator = 66; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[27].bias = 1077458389; - test_msg->biases[27].code = 2; - test_msg->biases[27].discontinuity_counter = 26; - test_msg->biases[27].integer_indicator = 75; - test_msg->biases[27].widelane_integer_indicator = 230; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[28].bias = -883355501; - test_msg->biases[28].code = 97; - test_msg->biases[28].discontinuity_counter = 6; - test_msg->biases[28].integer_indicator = 88; - test_msg->biases[28].widelane_integer_indicator = 255; - if (sizeof(test_msg->biases) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->biases[0])); - } - test_msg->biases[29].bias = -1448611273; - test_msg->biases[29].code = 27; - test_msg->biases[29].discontinuity_counter = 230; - test_msg->biases[29].integer_indicator = 68; - test_msg->biases[29].widelane_integer_indicator = 243; - test_msg->dispersive_bias = 98; - test_msg->iod_ssr = 230; - test_msg->mw_consistency = 209; - test_msg->sid.code = 82; - test_msg->sid.sat = 169; - test_msg->time.tow = 210803409; - test_msg->time.wn = 42197; - test_msg->update_interval = 177; - test_msg->yaw = 5881; - test_msg->yaw_rate = 17; - - EXPECT_EQ(send_message(0x5e6, 52955, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 52955); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asbiases[0].bias)>( - reinterpret_cast(&last_msg_->biases[0].bias)), - -1311498533) - << "incorrect value for biases[0].bias, expected -1311498533, is " - << last_msg_->biases[0].bias; - EXPECT_EQ(get_asbiases[0].code)>( - reinterpret_cast(&last_msg_->biases[0].code)), - 29) - << "incorrect value for biases[0].code, expected 29, is " - << last_msg_->biases[0].code; - EXPECT_EQ(get_asbiases[0].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[0].discontinuity_counter)), - 193) - << "incorrect value for biases[0].discontinuity_counter, expected 193, " - "is " - << last_msg_->biases[0].discontinuity_counter; - EXPECT_EQ(get_asbiases[0].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[0].integer_indicator)), - 250) - << "incorrect value for biases[0].integer_indicator, expected 250, is " - << last_msg_->biases[0].integer_indicator; - EXPECT_EQ(get_asbiases[0].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[0].widelane_integer_indicator)), - 245) - << "incorrect value for biases[0].widelane_integer_indicator, expected " - "245, is " - << last_msg_->biases[0].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[1].bias)>( - reinterpret_cast(&last_msg_->biases[1].bias)), - 1101319226) - << "incorrect value for biases[1].bias, expected 1101319226, is " - << last_msg_->biases[1].bias; - EXPECT_EQ(get_asbiases[1].code)>( - reinterpret_cast(&last_msg_->biases[1].code)), - 207) - << "incorrect value for biases[1].code, expected 207, is " - << last_msg_->biases[1].code; - EXPECT_EQ(get_asbiases[1].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[1].discontinuity_counter)), - 146) - << "incorrect value for biases[1].discontinuity_counter, expected 146, " - "is " - << last_msg_->biases[1].discontinuity_counter; - EXPECT_EQ(get_asbiases[1].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[1].integer_indicator)), - 187) - << "incorrect value for biases[1].integer_indicator, expected 187, is " - << last_msg_->biases[1].integer_indicator; - EXPECT_EQ(get_asbiases[1].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[1].widelane_integer_indicator)), - 33) - << "incorrect value for biases[1].widelane_integer_indicator, expected " - "33, is " - << last_msg_->biases[1].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[2].bias)>( - reinterpret_cast(&last_msg_->biases[2].bias)), - -64184056) - << "incorrect value for biases[2].bias, expected -64184056, is " - << last_msg_->biases[2].bias; - EXPECT_EQ(get_asbiases[2].code)>( - reinterpret_cast(&last_msg_->biases[2].code)), - 114) - << "incorrect value for biases[2].code, expected 114, is " - << last_msg_->biases[2].code; - EXPECT_EQ(get_asbiases[2].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[2].discontinuity_counter)), - 52) - << "incorrect value for biases[2].discontinuity_counter, expected 52, is " - << last_msg_->biases[2].discontinuity_counter; - EXPECT_EQ(get_asbiases[2].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[2].integer_indicator)), - 49) - << "incorrect value for biases[2].integer_indicator, expected 49, is " - << last_msg_->biases[2].integer_indicator; - EXPECT_EQ(get_asbiases[2].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[2].widelane_integer_indicator)), - 248) - << "incorrect value for biases[2].widelane_integer_indicator, expected " - "248, is " - << last_msg_->biases[2].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[3].bias)>( - reinterpret_cast(&last_msg_->biases[3].bias)), - -240298362) - << "incorrect value for biases[3].bias, expected -240298362, is " - << last_msg_->biases[3].bias; - EXPECT_EQ(get_asbiases[3].code)>( - reinterpret_cast(&last_msg_->biases[3].code)), - 166) - << "incorrect value for biases[3].code, expected 166, is " - << last_msg_->biases[3].code; - EXPECT_EQ(get_asbiases[3].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[3].discontinuity_counter)), - 124) - << "incorrect value for biases[3].discontinuity_counter, expected 124, " - "is " - << last_msg_->biases[3].discontinuity_counter; - EXPECT_EQ(get_asbiases[3].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[3].integer_indicator)), - 168) - << "incorrect value for biases[3].integer_indicator, expected 168, is " - << last_msg_->biases[3].integer_indicator; - EXPECT_EQ(get_asbiases[3].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[3].widelane_integer_indicator)), - 232) - << "incorrect value for biases[3].widelane_integer_indicator, expected " - "232, is " - << last_msg_->biases[3].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[4].bias)>( - reinterpret_cast(&last_msg_->biases[4].bias)), - -1581740159) - << "incorrect value for biases[4].bias, expected -1581740159, is " - << last_msg_->biases[4].bias; - EXPECT_EQ(get_asbiases[4].code)>( - reinterpret_cast(&last_msg_->biases[4].code)), - 174) - << "incorrect value for biases[4].code, expected 174, is " - << last_msg_->biases[4].code; - EXPECT_EQ(get_asbiases[4].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[4].discontinuity_counter)), - 155) - << "incorrect value for biases[4].discontinuity_counter, expected 155, " - "is " - << last_msg_->biases[4].discontinuity_counter; - EXPECT_EQ(get_asbiases[4].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[4].integer_indicator)), - 44) - << "incorrect value for biases[4].integer_indicator, expected 44, is " - << last_msg_->biases[4].integer_indicator; - EXPECT_EQ(get_asbiases[4].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[4].widelane_integer_indicator)), - 142) - << "incorrect value for biases[4].widelane_integer_indicator, expected " - "142, is " - << last_msg_->biases[4].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[5].bias)>( - reinterpret_cast(&last_msg_->biases[5].bias)), - -1730297136) - << "incorrect value for biases[5].bias, expected -1730297136, is " - << last_msg_->biases[5].bias; - EXPECT_EQ(get_asbiases[5].code)>( - reinterpret_cast(&last_msg_->biases[5].code)), - 211) - << "incorrect value for biases[5].code, expected 211, is " - << last_msg_->biases[5].code; - EXPECT_EQ(get_asbiases[5].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[5].discontinuity_counter)), - 189) - << "incorrect value for biases[5].discontinuity_counter, expected 189, " - "is " - << last_msg_->biases[5].discontinuity_counter; - EXPECT_EQ(get_asbiases[5].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[5].integer_indicator)), - 15) - << "incorrect value for biases[5].integer_indicator, expected 15, is " - << last_msg_->biases[5].integer_indicator; - EXPECT_EQ(get_asbiases[5].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[5].widelane_integer_indicator)), - 36) - << "incorrect value for biases[5].widelane_integer_indicator, expected " - "36, is " - << last_msg_->biases[5].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[6].bias)>( - reinterpret_cast(&last_msg_->biases[6].bias)), - -1117221444) - << "incorrect value for biases[6].bias, expected -1117221444, is " - << last_msg_->biases[6].bias; - EXPECT_EQ(get_asbiases[6].code)>( - reinterpret_cast(&last_msg_->biases[6].code)), - 16) - << "incorrect value for biases[6].code, expected 16, is " - << last_msg_->biases[6].code; - EXPECT_EQ(get_asbiases[6].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[6].discontinuity_counter)), - 34) - << "incorrect value for biases[6].discontinuity_counter, expected 34, is " - << last_msg_->biases[6].discontinuity_counter; - EXPECT_EQ(get_asbiases[6].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[6].integer_indicator)), - 203) - << "incorrect value for biases[6].integer_indicator, expected 203, is " - << last_msg_->biases[6].integer_indicator; - EXPECT_EQ(get_asbiases[6].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[6].widelane_integer_indicator)), - 87) - << "incorrect value for biases[6].widelane_integer_indicator, expected " - "87, is " - << last_msg_->biases[6].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[7].bias)>( - reinterpret_cast(&last_msg_->biases[7].bias)), - -1137604357) - << "incorrect value for biases[7].bias, expected -1137604357, is " - << last_msg_->biases[7].bias; - EXPECT_EQ(get_asbiases[7].code)>( - reinterpret_cast(&last_msg_->biases[7].code)), - 102) - << "incorrect value for biases[7].code, expected 102, is " - << last_msg_->biases[7].code; - EXPECT_EQ(get_asbiases[7].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[7].discontinuity_counter)), - 22) - << "incorrect value for biases[7].discontinuity_counter, expected 22, is " - << last_msg_->biases[7].discontinuity_counter; - EXPECT_EQ(get_asbiases[7].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[7].integer_indicator)), - 156) - << "incorrect value for biases[7].integer_indicator, expected 156, is " - << last_msg_->biases[7].integer_indicator; - EXPECT_EQ(get_asbiases[7].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[7].widelane_integer_indicator)), - 252) - << "incorrect value for biases[7].widelane_integer_indicator, expected " - "252, is " - << last_msg_->biases[7].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[8].bias)>( - reinterpret_cast(&last_msg_->biases[8].bias)), - -1910370172) - << "incorrect value for biases[8].bias, expected -1910370172, is " - << last_msg_->biases[8].bias; - EXPECT_EQ(get_asbiases[8].code)>( - reinterpret_cast(&last_msg_->biases[8].code)), - 157) - << "incorrect value for biases[8].code, expected 157, is " - << last_msg_->biases[8].code; - EXPECT_EQ(get_asbiases[8].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[8].discontinuity_counter)), - 49) - << "incorrect value for biases[8].discontinuity_counter, expected 49, is " - << last_msg_->biases[8].discontinuity_counter; - EXPECT_EQ(get_asbiases[8].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[8].integer_indicator)), - 222) - << "incorrect value for biases[8].integer_indicator, expected 222, is " - << last_msg_->biases[8].integer_indicator; - EXPECT_EQ(get_asbiases[8].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[8].widelane_integer_indicator)), - 245) - << "incorrect value for biases[8].widelane_integer_indicator, expected " - "245, is " - << last_msg_->biases[8].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[9].bias)>( - reinterpret_cast(&last_msg_->biases[9].bias)), - 1247996869) - << "incorrect value for biases[9].bias, expected 1247996869, is " - << last_msg_->biases[9].bias; - EXPECT_EQ(get_asbiases[9].code)>( - reinterpret_cast(&last_msg_->biases[9].code)), - 228) - << "incorrect value for biases[9].code, expected 228, is " - << last_msg_->biases[9].code; - EXPECT_EQ(get_asbiases[9].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[9].discontinuity_counter)), - 221) - << "incorrect value for biases[9].discontinuity_counter, expected 221, " - "is " - << last_msg_->biases[9].discontinuity_counter; - EXPECT_EQ(get_asbiases[9].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[9].integer_indicator)), - 85) - << "incorrect value for biases[9].integer_indicator, expected 85, is " - << last_msg_->biases[9].integer_indicator; - EXPECT_EQ(get_asbiases[9].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[9].widelane_integer_indicator)), - 139) - << "incorrect value for biases[9].widelane_integer_indicator, expected " - "139, is " - << last_msg_->biases[9].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[10].bias)>( - reinterpret_cast(&last_msg_->biases[10].bias)), - -1133446161) - << "incorrect value for biases[10].bias, expected -1133446161, is " - << last_msg_->biases[10].bias; - EXPECT_EQ(get_asbiases[10].code)>( - reinterpret_cast(&last_msg_->biases[10].code)), - 107) - << "incorrect value for biases[10].code, expected 107, is " - << last_msg_->biases[10].code; - EXPECT_EQ(get_asbiases[10].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[10].discontinuity_counter)), - 38) - << "incorrect value for biases[10].discontinuity_counter, expected 38, " - "is " - << last_msg_->biases[10].discontinuity_counter; - EXPECT_EQ(get_asbiases[10].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[10].integer_indicator)), - 70) - << "incorrect value for biases[10].integer_indicator, expected 70, is " - << last_msg_->biases[10].integer_indicator; - EXPECT_EQ(get_asbiases[10].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[10].widelane_integer_indicator)), - 36) - << "incorrect value for biases[10].widelane_integer_indicator, expected " - "36, is " - << last_msg_->biases[10].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[11].bias)>( - reinterpret_cast(&last_msg_->biases[11].bias)), - -720934762) - << "incorrect value for biases[11].bias, expected -720934762, is " - << last_msg_->biases[11].bias; - EXPECT_EQ(get_asbiases[11].code)>( - reinterpret_cast(&last_msg_->biases[11].code)), - 124) - << "incorrect value for biases[11].code, expected 124, is " - << last_msg_->biases[11].code; - EXPECT_EQ(get_asbiases[11].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[11].discontinuity_counter)), - 164) - << "incorrect value for biases[11].discontinuity_counter, expected 164, " - "is " - << last_msg_->biases[11].discontinuity_counter; - EXPECT_EQ(get_asbiases[11].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[11].integer_indicator)), - 246) - << "incorrect value for biases[11].integer_indicator, expected 246, is " - << last_msg_->biases[11].integer_indicator; - EXPECT_EQ(get_asbiases[11].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[11].widelane_integer_indicator)), - 141) - << "incorrect value for biases[11].widelane_integer_indicator, expected " - "141, is " - << last_msg_->biases[11].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[12].bias)>( - reinterpret_cast(&last_msg_->biases[12].bias)), - 706252548) - << "incorrect value for biases[12].bias, expected 706252548, is " - << last_msg_->biases[12].bias; - EXPECT_EQ(get_asbiases[12].code)>( - reinterpret_cast(&last_msg_->biases[12].code)), - 44) - << "incorrect value for biases[12].code, expected 44, is " - << last_msg_->biases[12].code; - EXPECT_EQ(get_asbiases[12].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[12].discontinuity_counter)), - 192) - << "incorrect value for biases[12].discontinuity_counter, expected 192, " - "is " - << last_msg_->biases[12].discontinuity_counter; - EXPECT_EQ(get_asbiases[12].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[12].integer_indicator)), - 21) - << "incorrect value for biases[12].integer_indicator, expected 21, is " - << last_msg_->biases[12].integer_indicator; - EXPECT_EQ(get_asbiases[12].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[12].widelane_integer_indicator)), - 244) - << "incorrect value for biases[12].widelane_integer_indicator, expected " - "244, is " - << last_msg_->biases[12].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[13].bias)>( - reinterpret_cast(&last_msg_->biases[13].bias)), - 388855338) - << "incorrect value for biases[13].bias, expected 388855338, is " - << last_msg_->biases[13].bias; - EXPECT_EQ(get_asbiases[13].code)>( - reinterpret_cast(&last_msg_->biases[13].code)), - 21) - << "incorrect value for biases[13].code, expected 21, is " - << last_msg_->biases[13].code; - EXPECT_EQ(get_asbiases[13].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[13].discontinuity_counter)), - 7) - << "incorrect value for biases[13].discontinuity_counter, expected 7, is " - << last_msg_->biases[13].discontinuity_counter; - EXPECT_EQ(get_asbiases[13].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[13].integer_indicator)), - 84) - << "incorrect value for biases[13].integer_indicator, expected 84, is " - << last_msg_->biases[13].integer_indicator; - EXPECT_EQ(get_asbiases[13].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[13].widelane_integer_indicator)), - 136) - << "incorrect value for biases[13].widelane_integer_indicator, expected " - "136, is " - << last_msg_->biases[13].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[14].bias)>( - reinterpret_cast(&last_msg_->biases[14].bias)), - 47517353) - << "incorrect value for biases[14].bias, expected 47517353, is " - << last_msg_->biases[14].bias; - EXPECT_EQ(get_asbiases[14].code)>( - reinterpret_cast(&last_msg_->biases[14].code)), - 174) - << "incorrect value for biases[14].code, expected 174, is " - << last_msg_->biases[14].code; - EXPECT_EQ(get_asbiases[14].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[14].discontinuity_counter)), - 54) - << "incorrect value for biases[14].discontinuity_counter, expected 54, " - "is " - << last_msg_->biases[14].discontinuity_counter; - EXPECT_EQ(get_asbiases[14].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[14].integer_indicator)), - 175) - << "incorrect value for biases[14].integer_indicator, expected 175, is " - << last_msg_->biases[14].integer_indicator; - EXPECT_EQ(get_asbiases[14].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[14].widelane_integer_indicator)), - 129) - << "incorrect value for biases[14].widelane_integer_indicator, expected " - "129, is " - << last_msg_->biases[14].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[15].bias)>( - reinterpret_cast(&last_msg_->biases[15].bias)), - -2124125745) - << "incorrect value for biases[15].bias, expected -2124125745, is " - << last_msg_->biases[15].bias; - EXPECT_EQ(get_asbiases[15].code)>( - reinterpret_cast(&last_msg_->biases[15].code)), - 197) - << "incorrect value for biases[15].code, expected 197, is " - << last_msg_->biases[15].code; - EXPECT_EQ(get_asbiases[15].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[15].discontinuity_counter)), - 13) - << "incorrect value for biases[15].discontinuity_counter, expected 13, " - "is " - << last_msg_->biases[15].discontinuity_counter; - EXPECT_EQ(get_asbiases[15].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[15].integer_indicator)), - 98) - << "incorrect value for biases[15].integer_indicator, expected 98, is " - << last_msg_->biases[15].integer_indicator; - EXPECT_EQ(get_asbiases[15].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[15].widelane_integer_indicator)), - 60) - << "incorrect value for biases[15].widelane_integer_indicator, expected " - "60, is " - << last_msg_->biases[15].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[16].bias)>( - reinterpret_cast(&last_msg_->biases[16].bias)), - -1401812607) - << "incorrect value for biases[16].bias, expected -1401812607, is " - << last_msg_->biases[16].bias; - EXPECT_EQ(get_asbiases[16].code)>( - reinterpret_cast(&last_msg_->biases[16].code)), - 72) - << "incorrect value for biases[16].code, expected 72, is " - << last_msg_->biases[16].code; - EXPECT_EQ(get_asbiases[16].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[16].discontinuity_counter)), - 140) - << "incorrect value for biases[16].discontinuity_counter, expected 140, " - "is " - << last_msg_->biases[16].discontinuity_counter; - EXPECT_EQ(get_asbiases[16].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[16].integer_indicator)), - 136) - << "incorrect value for biases[16].integer_indicator, expected 136, is " - << last_msg_->biases[16].integer_indicator; - EXPECT_EQ(get_asbiases[16].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[16].widelane_integer_indicator)), - 240) - << "incorrect value for biases[16].widelane_integer_indicator, expected " - "240, is " - << last_msg_->biases[16].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[17].bias)>( - reinterpret_cast(&last_msg_->biases[17].bias)), - 60257151) - << "incorrect value for biases[17].bias, expected 60257151, is " - << last_msg_->biases[17].bias; - EXPECT_EQ(get_asbiases[17].code)>( - reinterpret_cast(&last_msg_->biases[17].code)), - 151) - << "incorrect value for biases[17].code, expected 151, is " - << last_msg_->biases[17].code; - EXPECT_EQ(get_asbiases[17].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[17].discontinuity_counter)), - 210) - << "incorrect value for biases[17].discontinuity_counter, expected 210, " - "is " - << last_msg_->biases[17].discontinuity_counter; - EXPECT_EQ(get_asbiases[17].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[17].integer_indicator)), - 150) - << "incorrect value for biases[17].integer_indicator, expected 150, is " - << last_msg_->biases[17].integer_indicator; - EXPECT_EQ(get_asbiases[17].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[17].widelane_integer_indicator)), - 17) - << "incorrect value for biases[17].widelane_integer_indicator, expected " - "17, is " - << last_msg_->biases[17].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[18].bias)>( - reinterpret_cast(&last_msg_->biases[18].bias)), - 41820677) - << "incorrect value for biases[18].bias, expected 41820677, is " - << last_msg_->biases[18].bias; - EXPECT_EQ(get_asbiases[18].code)>( - reinterpret_cast(&last_msg_->biases[18].code)), - 242) - << "incorrect value for biases[18].code, expected 242, is " - << last_msg_->biases[18].code; - EXPECT_EQ(get_asbiases[18].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[18].discontinuity_counter)), - 14) - << "incorrect value for biases[18].discontinuity_counter, expected 14, " - "is " - << last_msg_->biases[18].discontinuity_counter; - EXPECT_EQ(get_asbiases[18].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[18].integer_indicator)), - 254) - << "incorrect value for biases[18].integer_indicator, expected 254, is " - << last_msg_->biases[18].integer_indicator; - EXPECT_EQ(get_asbiases[18].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[18].widelane_integer_indicator)), - 215) - << "incorrect value for biases[18].widelane_integer_indicator, expected " - "215, is " - << last_msg_->biases[18].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[19].bias)>( - reinterpret_cast(&last_msg_->biases[19].bias)), - 1640616471) - << "incorrect value for biases[19].bias, expected 1640616471, is " - << last_msg_->biases[19].bias; - EXPECT_EQ(get_asbiases[19].code)>( - reinterpret_cast(&last_msg_->biases[19].code)), - 215) - << "incorrect value for biases[19].code, expected 215, is " - << last_msg_->biases[19].code; - EXPECT_EQ(get_asbiases[19].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[19].discontinuity_counter)), - 176) - << "incorrect value for biases[19].discontinuity_counter, expected 176, " - "is " - << last_msg_->biases[19].discontinuity_counter; - EXPECT_EQ(get_asbiases[19].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[19].integer_indicator)), - 65) - << "incorrect value for biases[19].integer_indicator, expected 65, is " - << last_msg_->biases[19].integer_indicator; - EXPECT_EQ(get_asbiases[19].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[19].widelane_integer_indicator)), - 38) - << "incorrect value for biases[19].widelane_integer_indicator, expected " - "38, is " - << last_msg_->biases[19].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[20].bias)>( - reinterpret_cast(&last_msg_->biases[20].bias)), - -744786918) - << "incorrect value for biases[20].bias, expected -744786918, is " - << last_msg_->biases[20].bias; - EXPECT_EQ(get_asbiases[20].code)>( - reinterpret_cast(&last_msg_->biases[20].code)), - 36) - << "incorrect value for biases[20].code, expected 36, is " - << last_msg_->biases[20].code; - EXPECT_EQ(get_asbiases[20].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[20].discontinuity_counter)), - 224) - << "incorrect value for biases[20].discontinuity_counter, expected 224, " - "is " - << last_msg_->biases[20].discontinuity_counter; - EXPECT_EQ(get_asbiases[20].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[20].integer_indicator)), - 207) - << "incorrect value for biases[20].integer_indicator, expected 207, is " - << last_msg_->biases[20].integer_indicator; - EXPECT_EQ(get_asbiases[20].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[20].widelane_integer_indicator)), - 92) - << "incorrect value for biases[20].widelane_integer_indicator, expected " - "92, is " - << last_msg_->biases[20].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[21].bias)>( - reinterpret_cast(&last_msg_->biases[21].bias)), - 1966589763) - << "incorrect value for biases[21].bias, expected 1966589763, is " - << last_msg_->biases[21].bias; - EXPECT_EQ(get_asbiases[21].code)>( - reinterpret_cast(&last_msg_->biases[21].code)), - 165) - << "incorrect value for biases[21].code, expected 165, is " - << last_msg_->biases[21].code; - EXPECT_EQ(get_asbiases[21].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[21].discontinuity_counter)), - 38) - << "incorrect value for biases[21].discontinuity_counter, expected 38, " - "is " - << last_msg_->biases[21].discontinuity_counter; - EXPECT_EQ(get_asbiases[21].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[21].integer_indicator)), - 47) - << "incorrect value for biases[21].integer_indicator, expected 47, is " - << last_msg_->biases[21].integer_indicator; - EXPECT_EQ(get_asbiases[21].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[21].widelane_integer_indicator)), - 102) - << "incorrect value for biases[21].widelane_integer_indicator, expected " - "102, is " - << last_msg_->biases[21].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[22].bias)>( - reinterpret_cast(&last_msg_->biases[22].bias)), - 364366310) - << "incorrect value for biases[22].bias, expected 364366310, is " - << last_msg_->biases[22].bias; - EXPECT_EQ(get_asbiases[22].code)>( - reinterpret_cast(&last_msg_->biases[22].code)), - 36) - << "incorrect value for biases[22].code, expected 36, is " - << last_msg_->biases[22].code; - EXPECT_EQ(get_asbiases[22].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[22].discontinuity_counter)), - 1) - << "incorrect value for biases[22].discontinuity_counter, expected 1, is " - << last_msg_->biases[22].discontinuity_counter; - EXPECT_EQ(get_asbiases[22].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[22].integer_indicator)), - 169) - << "incorrect value for biases[22].integer_indicator, expected 169, is " - << last_msg_->biases[22].integer_indicator; - EXPECT_EQ(get_asbiases[22].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[22].widelane_integer_indicator)), - 33) - << "incorrect value for biases[22].widelane_integer_indicator, expected " - "33, is " - << last_msg_->biases[22].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[23].bias)>( - reinterpret_cast(&last_msg_->biases[23].bias)), - -1839031379) - << "incorrect value for biases[23].bias, expected -1839031379, is " - << last_msg_->biases[23].bias; - EXPECT_EQ(get_asbiases[23].code)>( - reinterpret_cast(&last_msg_->biases[23].code)), - 42) - << "incorrect value for biases[23].code, expected 42, is " - << last_msg_->biases[23].code; - EXPECT_EQ(get_asbiases[23].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[23].discontinuity_counter)), - 173) - << "incorrect value for biases[23].discontinuity_counter, expected 173, " - "is " - << last_msg_->biases[23].discontinuity_counter; - EXPECT_EQ(get_asbiases[23].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[23].integer_indicator)), - 62) - << "incorrect value for biases[23].integer_indicator, expected 62, is " - << last_msg_->biases[23].integer_indicator; - EXPECT_EQ(get_asbiases[23].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[23].widelane_integer_indicator)), - 147) - << "incorrect value for biases[23].widelane_integer_indicator, expected " - "147, is " - << last_msg_->biases[23].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[24].bias)>( - reinterpret_cast(&last_msg_->biases[24].bias)), - 31817639) - << "incorrect value for biases[24].bias, expected 31817639, is " - << last_msg_->biases[24].bias; - EXPECT_EQ(get_asbiases[24].code)>( - reinterpret_cast(&last_msg_->biases[24].code)), - 231) - << "incorrect value for biases[24].code, expected 231, is " - << last_msg_->biases[24].code; - EXPECT_EQ(get_asbiases[24].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[24].discontinuity_counter)), - 82) - << "incorrect value for biases[24].discontinuity_counter, expected 82, " - "is " - << last_msg_->biases[24].discontinuity_counter; - EXPECT_EQ(get_asbiases[24].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[24].integer_indicator)), - 167) - << "incorrect value for biases[24].integer_indicator, expected 167, is " - << last_msg_->biases[24].integer_indicator; - EXPECT_EQ(get_asbiases[24].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[24].widelane_integer_indicator)), - 138) - << "incorrect value for biases[24].widelane_integer_indicator, expected " - "138, is " - << last_msg_->biases[24].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[25].bias)>( - reinterpret_cast(&last_msg_->biases[25].bias)), - -1619830156) - << "incorrect value for biases[25].bias, expected -1619830156, is " - << last_msg_->biases[25].bias; - EXPECT_EQ(get_asbiases[25].code)>( - reinterpret_cast(&last_msg_->biases[25].code)), - 2) - << "incorrect value for biases[25].code, expected 2, is " - << last_msg_->biases[25].code; - EXPECT_EQ(get_asbiases[25].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[25].discontinuity_counter)), - 207) - << "incorrect value for biases[25].discontinuity_counter, expected 207, " - "is " - << last_msg_->biases[25].discontinuity_counter; - EXPECT_EQ(get_asbiases[25].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[25].integer_indicator)), - 127) - << "incorrect value for biases[25].integer_indicator, expected 127, is " - << last_msg_->biases[25].integer_indicator; - EXPECT_EQ(get_asbiases[25].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[25].widelane_integer_indicator)), - 237) - << "incorrect value for biases[25].widelane_integer_indicator, expected " - "237, is " - << last_msg_->biases[25].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[26].bias)>( - reinterpret_cast(&last_msg_->biases[26].bias)), - -83375622) - << "incorrect value for biases[26].bias, expected -83375622, is " - << last_msg_->biases[26].bias; - EXPECT_EQ(get_asbiases[26].code)>( - reinterpret_cast(&last_msg_->biases[26].code)), - 3) - << "incorrect value for biases[26].code, expected 3, is " - << last_msg_->biases[26].code; - EXPECT_EQ(get_asbiases[26].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[26].discontinuity_counter)), - 145) - << "incorrect value for biases[26].discontinuity_counter, expected 145, " - "is " - << last_msg_->biases[26].discontinuity_counter; - EXPECT_EQ(get_asbiases[26].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[26].integer_indicator)), - 42) - << "incorrect value for biases[26].integer_indicator, expected 42, is " - << last_msg_->biases[26].integer_indicator; - EXPECT_EQ(get_asbiases[26].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[26].widelane_integer_indicator)), - 66) - << "incorrect value for biases[26].widelane_integer_indicator, expected " - "66, is " - << last_msg_->biases[26].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[27].bias)>( - reinterpret_cast(&last_msg_->biases[27].bias)), - 1077458389) - << "incorrect value for biases[27].bias, expected 1077458389, is " - << last_msg_->biases[27].bias; - EXPECT_EQ(get_asbiases[27].code)>( - reinterpret_cast(&last_msg_->biases[27].code)), - 2) - << "incorrect value for biases[27].code, expected 2, is " - << last_msg_->biases[27].code; - EXPECT_EQ(get_asbiases[27].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[27].discontinuity_counter)), - 26) - << "incorrect value for biases[27].discontinuity_counter, expected 26, " - "is " - << last_msg_->biases[27].discontinuity_counter; - EXPECT_EQ(get_asbiases[27].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[27].integer_indicator)), - 75) - << "incorrect value for biases[27].integer_indicator, expected 75, is " - << last_msg_->biases[27].integer_indicator; - EXPECT_EQ(get_asbiases[27].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[27].widelane_integer_indicator)), - 230) - << "incorrect value for biases[27].widelane_integer_indicator, expected " - "230, is " - << last_msg_->biases[27].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[28].bias)>( - reinterpret_cast(&last_msg_->biases[28].bias)), - -883355501) - << "incorrect value for biases[28].bias, expected -883355501, is " - << last_msg_->biases[28].bias; - EXPECT_EQ(get_asbiases[28].code)>( - reinterpret_cast(&last_msg_->biases[28].code)), - 97) - << "incorrect value for biases[28].code, expected 97, is " - << last_msg_->biases[28].code; - EXPECT_EQ(get_asbiases[28].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[28].discontinuity_counter)), - 6) - << "incorrect value for biases[28].discontinuity_counter, expected 6, is " - << last_msg_->biases[28].discontinuity_counter; - EXPECT_EQ(get_asbiases[28].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[28].integer_indicator)), - 88) - << "incorrect value for biases[28].integer_indicator, expected 88, is " - << last_msg_->biases[28].integer_indicator; - EXPECT_EQ(get_asbiases[28].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[28].widelane_integer_indicator)), - 255) - << "incorrect value for biases[28].widelane_integer_indicator, expected " - "255, is " - << last_msg_->biases[28].widelane_integer_indicator; - EXPECT_EQ(get_asbiases[29].bias)>( - reinterpret_cast(&last_msg_->biases[29].bias)), - -1448611273) - << "incorrect value for biases[29].bias, expected -1448611273, is " - << last_msg_->biases[29].bias; - EXPECT_EQ(get_asbiases[29].code)>( - reinterpret_cast(&last_msg_->biases[29].code)), - 27) - << "incorrect value for biases[29].code, expected 27, is " - << last_msg_->biases[29].code; - EXPECT_EQ(get_asbiases[29].discontinuity_counter)>( - reinterpret_cast( - &last_msg_->biases[29].discontinuity_counter)), - 230) - << "incorrect value for biases[29].discontinuity_counter, expected 230, " - "is " - << last_msg_->biases[29].discontinuity_counter; - EXPECT_EQ(get_asbiases[29].integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[29].integer_indicator)), - 68) - << "incorrect value for biases[29].integer_indicator, expected 68, is " - << last_msg_->biases[29].integer_indicator; - EXPECT_EQ(get_asbiases[29].widelane_integer_indicator)>( - reinterpret_cast( - &last_msg_->biases[29].widelane_integer_indicator)), - 243) - << "incorrect value for biases[29].widelane_integer_indicator, expected " - "243, is " - << last_msg_->biases[29].widelane_integer_indicator; - EXPECT_EQ(get_asdispersive_bias)>( - reinterpret_cast(&last_msg_->dispersive_bias)), - 98) - << "incorrect value for dispersive_bias, expected 98, is " - << last_msg_->dispersive_bias; - EXPECT_EQ(get_asiod_ssr)>( - reinterpret_cast(&last_msg_->iod_ssr)), - 230) - << "incorrect value for iod_ssr, expected 230, is " << last_msg_->iod_ssr; - EXPECT_EQ(get_asmw_consistency)>( - reinterpret_cast(&last_msg_->mw_consistency)), - 209) - << "incorrect value for mw_consistency, expected 209, is " - << last_msg_->mw_consistency; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 82) - << "incorrect value for sid.code, expected 82, is " - << last_msg_->sid.code; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 169) - << "incorrect value for sid.sat, expected 169, is " << last_msg_->sid.sat; - EXPECT_EQ(get_astime.tow)>( - reinterpret_cast(&last_msg_->time.tow)), - 210803409) - << "incorrect value for time.tow, expected 210803409, is " - << last_msg_->time.tow; - EXPECT_EQ(get_astime.wn)>( - reinterpret_cast(&last_msg_->time.wn)), - 42197) - << "incorrect value for time.wn, expected 42197, is " - << last_msg_->time.wn; - EXPECT_EQ(get_asupdate_interval)>( - reinterpret_cast(&last_msg_->update_interval)), - 177) - << "incorrect value for update_interval, expected 177, is " - << last_msg_->update_interval; - EXPECT_EQ(get_asyaw)>( - reinterpret_cast(&last_msg_->yaw)), - 5881) - << "incorrect value for yaw, expected 5881, is " << last_msg_->yaw; - EXPECT_EQ(get_asyaw_rate)>( - reinterpret_cast(&last_msg_->yaw_rate)), - 17) - << "incorrect value for yaw_rate, expected 17, is " - << last_msg_->yaw_rate; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrSatelliteApc.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrSatelliteApc.cc deleted file mode 100644 index e25110820c..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrSatelliteApc.cc +++ /dev/null @@ -1,420 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrSatelliteApc.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrSatelliteApc0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrSatelliteApc0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_satellite_apc_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_satellite_apc_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrSatelliteApc0, Test) { - uint8_t encoded_frame[] = { - 85, 5, 6, 0, 0, 41, 127, 58, 9, 0, 174, 8, 1, - 2, 3, 2, 0, 4, 61, 0, 1, 0, 255, 255, 217, 2, - 11, 10, 8, 5, 1, 252, 248, 246, 246, 246, 249, 252, 0, - 6, 12, 22, 30, 41, 41, 41, 41, 144, 161, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_satellite_apc_t *test_msg = - (msg_ssr_satellite_apc_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->apc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0])); - } - if (sizeof(test_msg->apc[0].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pco[0])); - } - test_msg->apc[0].pco[0] = 1; - if (sizeof(test_msg->apc[0].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pco[0])); - } - test_msg->apc[0].pco[1] = -1; - if (sizeof(test_msg->apc[0].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pco[0])); - } - test_msg->apc[0].pco[2] = 729; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[0] = 11; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[1] = 10; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[2] = 8; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[3] = 5; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[4] = 1; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[5] = -4; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[6] = -8; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[7] = -10; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[8] = -10; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[9] = -10; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[10] = -7; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[11] = -4; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[12] = 0; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[13] = 6; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[14] = 12; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[15] = 22; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[16] = 30; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[17] = 41; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[18] = 41; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[19] = 41; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[20] = 41; - test_msg->apc[0].sat_info = 4; - test_msg->apc[0].sid.code = 0; - test_msg->apc[0].sid.sat = 2; - test_msg->apc[0].svn = 61; - test_msg->iod_ssr = 3; - test_msg->sol_id = 2; - test_msg->time.tow = 604799; - test_msg->time.wn = 2222; - test_msg->update_interval = 1; - - EXPECT_EQ(send_message(0x605, 0, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 0); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asapc[0].pco[0])>( - reinterpret_cast(&last_msg_->apc[0].pco[0])), - 1) - << "incorrect value for apc[0].pco[0], expected 1, is " - << last_msg_->apc[0].pco[0]; - EXPECT_EQ(get_asapc[0].pco[1])>( - reinterpret_cast(&last_msg_->apc[0].pco[1])), - -1) - << "incorrect value for apc[0].pco[1], expected -1, is " - << last_msg_->apc[0].pco[1]; - EXPECT_EQ(get_asapc[0].pco[2])>( - reinterpret_cast(&last_msg_->apc[0].pco[2])), - 729) - << "incorrect value for apc[0].pco[2], expected 729, is " - << last_msg_->apc[0].pco[2]; - EXPECT_EQ(get_asapc[0].pcv[0])>( - reinterpret_cast(&last_msg_->apc[0].pcv[0])), - 11) - << "incorrect value for apc[0].pcv[0], expected 11, is " - << last_msg_->apc[0].pcv[0]; - EXPECT_EQ(get_asapc[0].pcv[1])>( - reinterpret_cast(&last_msg_->apc[0].pcv[1])), - 10) - << "incorrect value for apc[0].pcv[1], expected 10, is " - << last_msg_->apc[0].pcv[1]; - EXPECT_EQ(get_asapc[0].pcv[2])>( - reinterpret_cast(&last_msg_->apc[0].pcv[2])), - 8) - << "incorrect value for apc[0].pcv[2], expected 8, is " - << last_msg_->apc[0].pcv[2]; - EXPECT_EQ(get_asapc[0].pcv[3])>( - reinterpret_cast(&last_msg_->apc[0].pcv[3])), - 5) - << "incorrect value for apc[0].pcv[3], expected 5, is " - << last_msg_->apc[0].pcv[3]; - EXPECT_EQ(get_asapc[0].pcv[4])>( - reinterpret_cast(&last_msg_->apc[0].pcv[4])), - 1) - << "incorrect value for apc[0].pcv[4], expected 1, is " - << last_msg_->apc[0].pcv[4]; - EXPECT_EQ(get_asapc[0].pcv[5])>( - reinterpret_cast(&last_msg_->apc[0].pcv[5])), - -4) - << "incorrect value for apc[0].pcv[5], expected -4, is " - << last_msg_->apc[0].pcv[5]; - EXPECT_EQ(get_asapc[0].pcv[6])>( - reinterpret_cast(&last_msg_->apc[0].pcv[6])), - -8) - << "incorrect value for apc[0].pcv[6], expected -8, is " - << last_msg_->apc[0].pcv[6]; - EXPECT_EQ(get_asapc[0].pcv[7])>( - reinterpret_cast(&last_msg_->apc[0].pcv[7])), - -10) - << "incorrect value for apc[0].pcv[7], expected -10, is " - << last_msg_->apc[0].pcv[7]; - EXPECT_EQ(get_asapc[0].pcv[8])>( - reinterpret_cast(&last_msg_->apc[0].pcv[8])), - -10) - << "incorrect value for apc[0].pcv[8], expected -10, is " - << last_msg_->apc[0].pcv[8]; - EXPECT_EQ(get_asapc[0].pcv[9])>( - reinterpret_cast(&last_msg_->apc[0].pcv[9])), - -10) - << "incorrect value for apc[0].pcv[9], expected -10, is " - << last_msg_->apc[0].pcv[9]; - EXPECT_EQ(get_asapc[0].pcv[10])>( - reinterpret_cast(&last_msg_->apc[0].pcv[10])), - -7) - << "incorrect value for apc[0].pcv[10], expected -7, is " - << last_msg_->apc[0].pcv[10]; - EXPECT_EQ(get_asapc[0].pcv[11])>( - reinterpret_cast(&last_msg_->apc[0].pcv[11])), - -4) - << "incorrect value for apc[0].pcv[11], expected -4, is " - << last_msg_->apc[0].pcv[11]; - EXPECT_EQ(get_asapc[0].pcv[12])>( - reinterpret_cast(&last_msg_->apc[0].pcv[12])), - 0) - << "incorrect value for apc[0].pcv[12], expected 0, is " - << last_msg_->apc[0].pcv[12]; - EXPECT_EQ(get_asapc[0].pcv[13])>( - reinterpret_cast(&last_msg_->apc[0].pcv[13])), - 6) - << "incorrect value for apc[0].pcv[13], expected 6, is " - << last_msg_->apc[0].pcv[13]; - EXPECT_EQ(get_asapc[0].pcv[14])>( - reinterpret_cast(&last_msg_->apc[0].pcv[14])), - 12) - << "incorrect value for apc[0].pcv[14], expected 12, is " - << last_msg_->apc[0].pcv[14]; - EXPECT_EQ(get_asapc[0].pcv[15])>( - reinterpret_cast(&last_msg_->apc[0].pcv[15])), - 22) - << "incorrect value for apc[0].pcv[15], expected 22, is " - << last_msg_->apc[0].pcv[15]; - EXPECT_EQ(get_asapc[0].pcv[16])>( - reinterpret_cast(&last_msg_->apc[0].pcv[16])), - 30) - << "incorrect value for apc[0].pcv[16], expected 30, is " - << last_msg_->apc[0].pcv[16]; - EXPECT_EQ(get_asapc[0].pcv[17])>( - reinterpret_cast(&last_msg_->apc[0].pcv[17])), - 41) - << "incorrect value for apc[0].pcv[17], expected 41, is " - << last_msg_->apc[0].pcv[17]; - EXPECT_EQ(get_asapc[0].pcv[18])>( - reinterpret_cast(&last_msg_->apc[0].pcv[18])), - 41) - << "incorrect value for apc[0].pcv[18], expected 41, is " - << last_msg_->apc[0].pcv[18]; - EXPECT_EQ(get_asapc[0].pcv[19])>( - reinterpret_cast(&last_msg_->apc[0].pcv[19])), - 41) - << "incorrect value for apc[0].pcv[19], expected 41, is " - << last_msg_->apc[0].pcv[19]; - EXPECT_EQ(get_asapc[0].pcv[20])>( - reinterpret_cast(&last_msg_->apc[0].pcv[20])), - 41) - << "incorrect value for apc[0].pcv[20], expected 41, is " - << last_msg_->apc[0].pcv[20]; - EXPECT_EQ(get_asapc[0].sat_info)>( - reinterpret_cast(&last_msg_->apc[0].sat_info)), - 4) - << "incorrect value for apc[0].sat_info, expected 4, is " - << last_msg_->apc[0].sat_info; - EXPECT_EQ(get_asapc[0].sid.code)>( - reinterpret_cast(&last_msg_->apc[0].sid.code)), - 0) - << "incorrect value for apc[0].sid.code, expected 0, is " - << last_msg_->apc[0].sid.code; - EXPECT_EQ(get_asapc[0].sid.sat)>( - reinterpret_cast(&last_msg_->apc[0].sid.sat)), - 2) - << "incorrect value for apc[0].sid.sat, expected 2, is " - << last_msg_->apc[0].sid.sat; - EXPECT_EQ(get_asapc[0].svn)>( - reinterpret_cast(&last_msg_->apc[0].svn)), - 61) - << "incorrect value for apc[0].svn, expected 61, is " - << last_msg_->apc[0].svn; - EXPECT_EQ(get_asiod_ssr)>( - reinterpret_cast(&last_msg_->iod_ssr)), - 3) - << "incorrect value for iod_ssr, expected 3, is " << last_msg_->iod_ssr; - EXPECT_EQ(get_assol_id)>( - reinterpret_cast(&last_msg_->sol_id)), - 2) - << "incorrect value for sol_id, expected 2, is " << last_msg_->sol_id; - EXPECT_EQ(get_astime.tow)>( - reinterpret_cast(&last_msg_->time.tow)), - 604799) - << "incorrect value for time.tow, expected 604799, is " - << last_msg_->time.tow; - EXPECT_EQ(get_astime.wn)>( - reinterpret_cast(&last_msg_->time.wn)), - 2222) - << "incorrect value for time.wn, expected 2222, is " - << last_msg_->time.wn; - EXPECT_EQ(get_asupdate_interval)>( - reinterpret_cast(&last_msg_->update_interval)), - 1) - << "incorrect value for update_interval, expected 1, is " - << last_msg_->update_interval; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrSatelliteApcDepA.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrSatelliteApcDepA.cc deleted file mode 100644 index df970581f8..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrSatelliteApcDepA.cc +++ /dev/null @@ -1,2012 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrSatelliteApcDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrSatelliteApcDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrSatelliteApcDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_satellite_apc_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_satellite_apc_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrSatelliteApcDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 4, 6, 56, 19, 224, 203, 169, 240, 78, 4, 213, 171, 254, 214, - 212, 4, 8, 33, 31, 80, 21, 4, 105, 225, 39, 139, 124, 149, 48, - 15, 214, 197, 141, 32, 33, 135, 150, 148, 123, 49, 135, 97, 39, 90, - 20, 169, 239, 47, 153, 175, 35, 145, 145, 123, 194, 2, 102, 74, 149, - 95, 171, 238, 249, 7, 237, 170, 125, 106, 158, 83, 188, 181, 194, 27, - 84, 226, 142, 123, 77, 217, 248, 67, 215, 129, 114, 138, 25, 240, 10, - 56, 76, 61, 161, 216, 22, 181, 174, 33, 13, 252, 236, 230, 196, 128, - 215, 239, 234, 179, 220, 44, 212, 57, 44, 173, 49, 36, 137, 248, 235, - 97, 112, 157, 139, 26, 115, 192, 31, 85, 127, 228, 81, 252, 219, 249, - 110, 147, 8, 161, 215, 212, 180, 25, 83, 144, 247, 12, 27, 199, 173, - 74, 23, 4, 239, 103, 223, 220, 139, 91, 127, 214, 86, 48, 203, 228, - 99, 45, 83, 159, 11, 250, 135, 170, 42, 217, 199, 233, 42, 170, 78, - 206, 41, 43, 81, 247, 99, 198, 144, 2, 132, 2, 224, 220, 148, 58, - 85, 138, 210, 200, 158, 7, 158, 67, 46, 200, 132, 118, 241, 13, 37, - 62, 107, 253, 190, 136, 66, 9, 84, 155, 86, 180, 41, 196, 40, 119, - 101, 252, 223, 144, 153, 50, 13, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_satellite_apc_dep_t *test_msg = - (msg_ssr_satellite_apc_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->apc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0])); - } - if (sizeof(test_msg->apc[0].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pco[0])); - } - test_msg->apc[0].pco[0] = -21547; - if (sizeof(test_msg->apc[0].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pco[0])); - } - test_msg->apc[0].pco[1] = -10498; - if (sizeof(test_msg->apc[0].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pco[0])); - } - test_msg->apc[0].pco[2] = 1236; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[0] = 8; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[1] = 33; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[2] = 31; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[3] = 80; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[4] = 21; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[5] = 4; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[6] = 105; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[7] = -31; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[8] = 39; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[9] = -117; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[10] = 124; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[11] = -107; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[12] = 48; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[13] = 15; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[14] = -42; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[15] = -59; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[16] = -115; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[17] = 32; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[18] = 33; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[19] = -121; - if (sizeof(test_msg->apc[0].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0].pcv[0])); - } - test_msg->apc[0].pcv[20] = -106; - test_msg->apc[0].sat_info = 240; - test_msg->apc[0].sid.code = 169; - test_msg->apc[0].sid.sat = 203; - test_msg->apc[0].svn = 1102; - if (sizeof(test_msg->apc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0])); - } - if (sizeof(test_msg->apc[1].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pco[0])); - } - test_msg->apc[1].pco[0] = 23079; - if (sizeof(test_msg->apc[1].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pco[0])); - } - test_msg->apc[1].pco[1] = -22252; - if (sizeof(test_msg->apc[1].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pco[0])); - } - test_msg->apc[1].pco[2] = 12271; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[0] = -103; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[1] = -81; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[2] = 35; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[3] = -111; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[4] = -111; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[5] = 123; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[6] = -62; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[7] = 2; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[8] = 102; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[9] = 74; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[10] = -107; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[11] = 95; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[12] = -85; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[13] = -18; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[14] = -7; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[15] = 7; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[16] = -19; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[17] = -86; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[18] = 125; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[19] = 106; - if (sizeof(test_msg->apc[1].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[1].pcv[0])); - } - test_msg->apc[1].pcv[20] = -98; - test_msg->apc[1].sat_info = 49; - test_msg->apc[1].sid.code = 123; - test_msg->apc[1].sid.sat = 148; - test_msg->apc[1].svn = 24967; - if (sizeof(test_msg->apc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0])); - } - if (sizeof(test_msg->apc[2].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pco[0])); - } - test_msg->apc[2].pco[0] = -7596; - if (sizeof(test_msg->apc[2].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pco[0])); - } - test_msg->apc[2].pco[1] = 31630; - if (sizeof(test_msg->apc[2].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pco[0])); - } - test_msg->apc[2].pco[2] = -9907; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[0] = -8; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[1] = 67; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[2] = -41; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[3] = -127; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[4] = 114; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[5] = -118; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[6] = 25; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[7] = -16; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[8] = 10; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[9] = 56; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[10] = 76; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[11] = 61; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[12] = -95; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[13] = -40; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[14] = 22; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[15] = -75; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[16] = -82; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[17] = 33; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[18] = 13; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[19] = -4; - if (sizeof(test_msg->apc[2].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[2].pcv[0])); - } - test_msg->apc[2].pcv[20] = -20; - test_msg->apc[2].sat_info = 181; - test_msg->apc[2].sid.code = 188; - test_msg->apc[2].sid.sat = 83; - test_msg->apc[2].svn = 7106; - if (sizeof(test_msg->apc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0])); - } - if (sizeof(test_msg->apc[3].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pco[0])); - } - test_msg->apc[3].pco[0] = -19478; - if (sizeof(test_msg->apc[3].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pco[0])); - } - test_msg->apc[3].pco[1] = 11484; - if (sizeof(test_msg->apc[3].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pco[0])); - } - test_msg->apc[3].pco[2] = 14804; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[0] = 44; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[1] = -83; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[2] = 49; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[3] = 36; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[4] = -119; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[5] = -8; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[6] = -21; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[7] = 97; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[8] = 112; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[9] = -99; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[10] = -117; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[11] = 26; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[12] = 115; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[13] = -64; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[14] = 31; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[15] = 85; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[16] = 127; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[17] = -28; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[18] = 81; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[19] = -4; - if (sizeof(test_msg->apc[3].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[3].pcv[0])); - } - test_msg->apc[3].pcv[20] = -37; - test_msg->apc[3].sat_info = 128; - test_msg->apc[3].sid.code = 196; - test_msg->apc[3].sid.sat = 230; - test_msg->apc[3].svn = 61399; - if (sizeof(test_msg->apc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0])); - } - if (sizeof(test_msg->apc[4].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pco[0])); - } - test_msg->apc[4].pco[0] = -11049; - if (sizeof(test_msg->apc[4].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pco[0])); - } - test_msg->apc[4].pco[1] = 6580; - if (sizeof(test_msg->apc[4].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pco[0])); - } - test_msg->apc[4].pco[2] = -28589; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[0] = -9; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[1] = 12; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[2] = 27; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[3] = -57; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[4] = -83; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[5] = 74; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[6] = 23; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[7] = 4; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[8] = -17; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[9] = 103; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[10] = -33; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[11] = -36; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[12] = -117; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[13] = 91; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[14] = 127; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[15] = -42; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[16] = 86; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[17] = 48; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[18] = -53; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[19] = -28; - if (sizeof(test_msg->apc[4].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[4].pcv[0])); - } - test_msg->apc[4].pcv[20] = 99; - test_msg->apc[4].sat_info = 147; - test_msg->apc[4].sid.code = 110; - test_msg->apc[4].sid.sat = 249; - test_msg->apc[4].svn = 41224; - if (sizeof(test_msg->apc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0])); - } - if (sizeof(test_msg->apc[5].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pco[0])); - } - test_msg->apc[5].pco[0] = -21881; - if (sizeof(test_msg->apc[5].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pco[0])); - } - test_msg->apc[5].pco[1] = -9942; - if (sizeof(test_msg->apc[5].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pco[0])); - } - test_msg->apc[5].pco[2] = -5689; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[0] = 42; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[1] = -86; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[2] = 78; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[3] = -50; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[4] = 41; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[5] = 43; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[6] = 81; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[7] = -9; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[8] = 99; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[9] = -58; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[10] = -112; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[11] = 2; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[12] = -124; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[13] = 2; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[14] = -32; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[15] = -36; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[16] = -108; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[17] = 58; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[18] = 85; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[19] = -118; - if (sizeof(test_msg->apc[5].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[5].pcv[0])); - } - test_msg->apc[5].pcv[20] = -46; - test_msg->apc[5].sat_info = 159; - test_msg->apc[5].sid.code = 83; - test_msg->apc[5].sid.sat = 45; - test_msg->apc[5].svn = 64011; - if (sizeof(test_msg->apc) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[0])); - } - if (sizeof(test_msg->apc[6].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pco[0])); - } - test_msg->apc[6].pco[0] = -14290; - if (sizeof(test_msg->apc[6].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pco[0])); - } - test_msg->apc[6].pco[1] = 30340; - if (sizeof(test_msg->apc[6].pco) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pco[0])); - } - test_msg->apc[6].pco[2] = 3569; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[0] = 37; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[1] = 62; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[2] = 107; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[3] = -3; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[4] = -66; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[5] = -120; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[6] = 66; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[7] = 9; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[8] = 84; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[9] = -101; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[10] = 86; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[11] = -76; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[12] = 41; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[13] = -60; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[14] = 40; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[15] = 119; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[16] = 101; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[17] = -4; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[18] = -33; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[19] = -112; - if (sizeof(test_msg->apc[6].pcv) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->apc[6].pcv[0])); - } - test_msg->apc[6].pcv[20] = -103; - test_msg->apc[6].sat_info = 7; - test_msg->apc[6].sid.code = 158; - test_msg->apc[6].sid.sat = 200; - test_msg->apc[6].svn = 17310; - - EXPECT_EQ(send_message(0x604, 4920, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 4920); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asapc[0].pco[0])>( - reinterpret_cast(&last_msg_->apc[0].pco[0])), - -21547) - << "incorrect value for apc[0].pco[0], expected -21547, is " - << last_msg_->apc[0].pco[0]; - EXPECT_EQ(get_asapc[0].pco[1])>( - reinterpret_cast(&last_msg_->apc[0].pco[1])), - -10498) - << "incorrect value for apc[0].pco[1], expected -10498, is " - << last_msg_->apc[0].pco[1]; - EXPECT_EQ(get_asapc[0].pco[2])>( - reinterpret_cast(&last_msg_->apc[0].pco[2])), - 1236) - << "incorrect value for apc[0].pco[2], expected 1236, is " - << last_msg_->apc[0].pco[2]; - EXPECT_EQ(get_asapc[0].pcv[0])>( - reinterpret_cast(&last_msg_->apc[0].pcv[0])), - 8) - << "incorrect value for apc[0].pcv[0], expected 8, is " - << last_msg_->apc[0].pcv[0]; - EXPECT_EQ(get_asapc[0].pcv[1])>( - reinterpret_cast(&last_msg_->apc[0].pcv[1])), - 33) - << "incorrect value for apc[0].pcv[1], expected 33, is " - << last_msg_->apc[0].pcv[1]; - EXPECT_EQ(get_asapc[0].pcv[2])>( - reinterpret_cast(&last_msg_->apc[0].pcv[2])), - 31) - << "incorrect value for apc[0].pcv[2], expected 31, is " - << last_msg_->apc[0].pcv[2]; - EXPECT_EQ(get_asapc[0].pcv[3])>( - reinterpret_cast(&last_msg_->apc[0].pcv[3])), - 80) - << "incorrect value for apc[0].pcv[3], expected 80, is " - << last_msg_->apc[0].pcv[3]; - EXPECT_EQ(get_asapc[0].pcv[4])>( - reinterpret_cast(&last_msg_->apc[0].pcv[4])), - 21) - << "incorrect value for apc[0].pcv[4], expected 21, is " - << last_msg_->apc[0].pcv[4]; - EXPECT_EQ(get_asapc[0].pcv[5])>( - reinterpret_cast(&last_msg_->apc[0].pcv[5])), - 4) - << "incorrect value for apc[0].pcv[5], expected 4, is " - << last_msg_->apc[0].pcv[5]; - EXPECT_EQ(get_asapc[0].pcv[6])>( - reinterpret_cast(&last_msg_->apc[0].pcv[6])), - 105) - << "incorrect value for apc[0].pcv[6], expected 105, is " - << last_msg_->apc[0].pcv[6]; - EXPECT_EQ(get_asapc[0].pcv[7])>( - reinterpret_cast(&last_msg_->apc[0].pcv[7])), - -31) - << "incorrect value for apc[0].pcv[7], expected -31, is " - << last_msg_->apc[0].pcv[7]; - EXPECT_EQ(get_asapc[0].pcv[8])>( - reinterpret_cast(&last_msg_->apc[0].pcv[8])), - 39) - << "incorrect value for apc[0].pcv[8], expected 39, is " - << last_msg_->apc[0].pcv[8]; - EXPECT_EQ(get_asapc[0].pcv[9])>( - reinterpret_cast(&last_msg_->apc[0].pcv[9])), - -117) - << "incorrect value for apc[0].pcv[9], expected -117, is " - << last_msg_->apc[0].pcv[9]; - EXPECT_EQ(get_asapc[0].pcv[10])>( - reinterpret_cast(&last_msg_->apc[0].pcv[10])), - 124) - << "incorrect value for apc[0].pcv[10], expected 124, is " - << last_msg_->apc[0].pcv[10]; - EXPECT_EQ(get_asapc[0].pcv[11])>( - reinterpret_cast(&last_msg_->apc[0].pcv[11])), - -107) - << "incorrect value for apc[0].pcv[11], expected -107, is " - << last_msg_->apc[0].pcv[11]; - EXPECT_EQ(get_asapc[0].pcv[12])>( - reinterpret_cast(&last_msg_->apc[0].pcv[12])), - 48) - << "incorrect value for apc[0].pcv[12], expected 48, is " - << last_msg_->apc[0].pcv[12]; - EXPECT_EQ(get_asapc[0].pcv[13])>( - reinterpret_cast(&last_msg_->apc[0].pcv[13])), - 15) - << "incorrect value for apc[0].pcv[13], expected 15, is " - << last_msg_->apc[0].pcv[13]; - EXPECT_EQ(get_asapc[0].pcv[14])>( - reinterpret_cast(&last_msg_->apc[0].pcv[14])), - -42) - << "incorrect value for apc[0].pcv[14], expected -42, is " - << last_msg_->apc[0].pcv[14]; - EXPECT_EQ(get_asapc[0].pcv[15])>( - reinterpret_cast(&last_msg_->apc[0].pcv[15])), - -59) - << "incorrect value for apc[0].pcv[15], expected -59, is " - << last_msg_->apc[0].pcv[15]; - EXPECT_EQ(get_asapc[0].pcv[16])>( - reinterpret_cast(&last_msg_->apc[0].pcv[16])), - -115) - << "incorrect value for apc[0].pcv[16], expected -115, is " - << last_msg_->apc[0].pcv[16]; - EXPECT_EQ(get_asapc[0].pcv[17])>( - reinterpret_cast(&last_msg_->apc[0].pcv[17])), - 32) - << "incorrect value for apc[0].pcv[17], expected 32, is " - << last_msg_->apc[0].pcv[17]; - EXPECT_EQ(get_asapc[0].pcv[18])>( - reinterpret_cast(&last_msg_->apc[0].pcv[18])), - 33) - << "incorrect value for apc[0].pcv[18], expected 33, is " - << last_msg_->apc[0].pcv[18]; - EXPECT_EQ(get_asapc[0].pcv[19])>( - reinterpret_cast(&last_msg_->apc[0].pcv[19])), - -121) - << "incorrect value for apc[0].pcv[19], expected -121, is " - << last_msg_->apc[0].pcv[19]; - EXPECT_EQ(get_asapc[0].pcv[20])>( - reinterpret_cast(&last_msg_->apc[0].pcv[20])), - -106) - << "incorrect value for apc[0].pcv[20], expected -106, is " - << last_msg_->apc[0].pcv[20]; - EXPECT_EQ(get_asapc[0].sat_info)>( - reinterpret_cast(&last_msg_->apc[0].sat_info)), - 240) - << "incorrect value for apc[0].sat_info, expected 240, is " - << last_msg_->apc[0].sat_info; - EXPECT_EQ(get_asapc[0].sid.code)>( - reinterpret_cast(&last_msg_->apc[0].sid.code)), - 169) - << "incorrect value for apc[0].sid.code, expected 169, is " - << last_msg_->apc[0].sid.code; - EXPECT_EQ(get_asapc[0].sid.sat)>( - reinterpret_cast(&last_msg_->apc[0].sid.sat)), - 203) - << "incorrect value for apc[0].sid.sat, expected 203, is " - << last_msg_->apc[0].sid.sat; - EXPECT_EQ(get_asapc[0].svn)>( - reinterpret_cast(&last_msg_->apc[0].svn)), - 1102) - << "incorrect value for apc[0].svn, expected 1102, is " - << last_msg_->apc[0].svn; - EXPECT_EQ(get_asapc[1].pco[0])>( - reinterpret_cast(&last_msg_->apc[1].pco[0])), - 23079) - << "incorrect value for apc[1].pco[0], expected 23079, is " - << last_msg_->apc[1].pco[0]; - EXPECT_EQ(get_asapc[1].pco[1])>( - reinterpret_cast(&last_msg_->apc[1].pco[1])), - -22252) - << "incorrect value for apc[1].pco[1], expected -22252, is " - << last_msg_->apc[1].pco[1]; - EXPECT_EQ(get_asapc[1].pco[2])>( - reinterpret_cast(&last_msg_->apc[1].pco[2])), - 12271) - << "incorrect value for apc[1].pco[2], expected 12271, is " - << last_msg_->apc[1].pco[2]; - EXPECT_EQ(get_asapc[1].pcv[0])>( - reinterpret_cast(&last_msg_->apc[1].pcv[0])), - -103) - << "incorrect value for apc[1].pcv[0], expected -103, is " - << last_msg_->apc[1].pcv[0]; - EXPECT_EQ(get_asapc[1].pcv[1])>( - reinterpret_cast(&last_msg_->apc[1].pcv[1])), - -81) - << "incorrect value for apc[1].pcv[1], expected -81, is " - << last_msg_->apc[1].pcv[1]; - EXPECT_EQ(get_asapc[1].pcv[2])>( - reinterpret_cast(&last_msg_->apc[1].pcv[2])), - 35) - << "incorrect value for apc[1].pcv[2], expected 35, is " - << last_msg_->apc[1].pcv[2]; - EXPECT_EQ(get_asapc[1].pcv[3])>( - reinterpret_cast(&last_msg_->apc[1].pcv[3])), - -111) - << "incorrect value for apc[1].pcv[3], expected -111, is " - << last_msg_->apc[1].pcv[3]; - EXPECT_EQ(get_asapc[1].pcv[4])>( - reinterpret_cast(&last_msg_->apc[1].pcv[4])), - -111) - << "incorrect value for apc[1].pcv[4], expected -111, is " - << last_msg_->apc[1].pcv[4]; - EXPECT_EQ(get_asapc[1].pcv[5])>( - reinterpret_cast(&last_msg_->apc[1].pcv[5])), - 123) - << "incorrect value for apc[1].pcv[5], expected 123, is " - << last_msg_->apc[1].pcv[5]; - EXPECT_EQ(get_asapc[1].pcv[6])>( - reinterpret_cast(&last_msg_->apc[1].pcv[6])), - -62) - << "incorrect value for apc[1].pcv[6], expected -62, is " - << last_msg_->apc[1].pcv[6]; - EXPECT_EQ(get_asapc[1].pcv[7])>( - reinterpret_cast(&last_msg_->apc[1].pcv[7])), - 2) - << "incorrect value for apc[1].pcv[7], expected 2, is " - << last_msg_->apc[1].pcv[7]; - EXPECT_EQ(get_asapc[1].pcv[8])>( - reinterpret_cast(&last_msg_->apc[1].pcv[8])), - 102) - << "incorrect value for apc[1].pcv[8], expected 102, is " - << last_msg_->apc[1].pcv[8]; - EXPECT_EQ(get_asapc[1].pcv[9])>( - reinterpret_cast(&last_msg_->apc[1].pcv[9])), - 74) - << "incorrect value for apc[1].pcv[9], expected 74, is " - << last_msg_->apc[1].pcv[9]; - EXPECT_EQ(get_asapc[1].pcv[10])>( - reinterpret_cast(&last_msg_->apc[1].pcv[10])), - -107) - << "incorrect value for apc[1].pcv[10], expected -107, is " - << last_msg_->apc[1].pcv[10]; - EXPECT_EQ(get_asapc[1].pcv[11])>( - reinterpret_cast(&last_msg_->apc[1].pcv[11])), - 95) - << "incorrect value for apc[1].pcv[11], expected 95, is " - << last_msg_->apc[1].pcv[11]; - EXPECT_EQ(get_asapc[1].pcv[12])>( - reinterpret_cast(&last_msg_->apc[1].pcv[12])), - -85) - << "incorrect value for apc[1].pcv[12], expected -85, is " - << last_msg_->apc[1].pcv[12]; - EXPECT_EQ(get_asapc[1].pcv[13])>( - reinterpret_cast(&last_msg_->apc[1].pcv[13])), - -18) - << "incorrect value for apc[1].pcv[13], expected -18, is " - << last_msg_->apc[1].pcv[13]; - EXPECT_EQ(get_asapc[1].pcv[14])>( - reinterpret_cast(&last_msg_->apc[1].pcv[14])), - -7) - << "incorrect value for apc[1].pcv[14], expected -7, is " - << last_msg_->apc[1].pcv[14]; - EXPECT_EQ(get_asapc[1].pcv[15])>( - reinterpret_cast(&last_msg_->apc[1].pcv[15])), - 7) - << "incorrect value for apc[1].pcv[15], expected 7, is " - << last_msg_->apc[1].pcv[15]; - EXPECT_EQ(get_asapc[1].pcv[16])>( - reinterpret_cast(&last_msg_->apc[1].pcv[16])), - -19) - << "incorrect value for apc[1].pcv[16], expected -19, is " - << last_msg_->apc[1].pcv[16]; - EXPECT_EQ(get_asapc[1].pcv[17])>( - reinterpret_cast(&last_msg_->apc[1].pcv[17])), - -86) - << "incorrect value for apc[1].pcv[17], expected -86, is " - << last_msg_->apc[1].pcv[17]; - EXPECT_EQ(get_asapc[1].pcv[18])>( - reinterpret_cast(&last_msg_->apc[1].pcv[18])), - 125) - << "incorrect value for apc[1].pcv[18], expected 125, is " - << last_msg_->apc[1].pcv[18]; - EXPECT_EQ(get_asapc[1].pcv[19])>( - reinterpret_cast(&last_msg_->apc[1].pcv[19])), - 106) - << "incorrect value for apc[1].pcv[19], expected 106, is " - << last_msg_->apc[1].pcv[19]; - EXPECT_EQ(get_asapc[1].pcv[20])>( - reinterpret_cast(&last_msg_->apc[1].pcv[20])), - -98) - << "incorrect value for apc[1].pcv[20], expected -98, is " - << last_msg_->apc[1].pcv[20]; - EXPECT_EQ(get_asapc[1].sat_info)>( - reinterpret_cast(&last_msg_->apc[1].sat_info)), - 49) - << "incorrect value for apc[1].sat_info, expected 49, is " - << last_msg_->apc[1].sat_info; - EXPECT_EQ(get_asapc[1].sid.code)>( - reinterpret_cast(&last_msg_->apc[1].sid.code)), - 123) - << "incorrect value for apc[1].sid.code, expected 123, is " - << last_msg_->apc[1].sid.code; - EXPECT_EQ(get_asapc[1].sid.sat)>( - reinterpret_cast(&last_msg_->apc[1].sid.sat)), - 148) - << "incorrect value for apc[1].sid.sat, expected 148, is " - << last_msg_->apc[1].sid.sat; - EXPECT_EQ(get_asapc[1].svn)>( - reinterpret_cast(&last_msg_->apc[1].svn)), - 24967) - << "incorrect value for apc[1].svn, expected 24967, is " - << last_msg_->apc[1].svn; - EXPECT_EQ(get_asapc[2].pco[0])>( - reinterpret_cast(&last_msg_->apc[2].pco[0])), - -7596) - << "incorrect value for apc[2].pco[0], expected -7596, is " - << last_msg_->apc[2].pco[0]; - EXPECT_EQ(get_asapc[2].pco[1])>( - reinterpret_cast(&last_msg_->apc[2].pco[1])), - 31630) - << "incorrect value for apc[2].pco[1], expected 31630, is " - << last_msg_->apc[2].pco[1]; - EXPECT_EQ(get_asapc[2].pco[2])>( - reinterpret_cast(&last_msg_->apc[2].pco[2])), - -9907) - << "incorrect value for apc[2].pco[2], expected -9907, is " - << last_msg_->apc[2].pco[2]; - EXPECT_EQ(get_asapc[2].pcv[0])>( - reinterpret_cast(&last_msg_->apc[2].pcv[0])), - -8) - << "incorrect value for apc[2].pcv[0], expected -8, is " - << last_msg_->apc[2].pcv[0]; - EXPECT_EQ(get_asapc[2].pcv[1])>( - reinterpret_cast(&last_msg_->apc[2].pcv[1])), - 67) - << "incorrect value for apc[2].pcv[1], expected 67, is " - << last_msg_->apc[2].pcv[1]; - EXPECT_EQ(get_asapc[2].pcv[2])>( - reinterpret_cast(&last_msg_->apc[2].pcv[2])), - -41) - << "incorrect value for apc[2].pcv[2], expected -41, is " - << last_msg_->apc[2].pcv[2]; - EXPECT_EQ(get_asapc[2].pcv[3])>( - reinterpret_cast(&last_msg_->apc[2].pcv[3])), - -127) - << "incorrect value for apc[2].pcv[3], expected -127, is " - << last_msg_->apc[2].pcv[3]; - EXPECT_EQ(get_asapc[2].pcv[4])>( - reinterpret_cast(&last_msg_->apc[2].pcv[4])), - 114) - << "incorrect value for apc[2].pcv[4], expected 114, is " - << last_msg_->apc[2].pcv[4]; - EXPECT_EQ(get_asapc[2].pcv[5])>( - reinterpret_cast(&last_msg_->apc[2].pcv[5])), - -118) - << "incorrect value for apc[2].pcv[5], expected -118, is " - << last_msg_->apc[2].pcv[5]; - EXPECT_EQ(get_asapc[2].pcv[6])>( - reinterpret_cast(&last_msg_->apc[2].pcv[6])), - 25) - << "incorrect value for apc[2].pcv[6], expected 25, is " - << last_msg_->apc[2].pcv[6]; - EXPECT_EQ(get_asapc[2].pcv[7])>( - reinterpret_cast(&last_msg_->apc[2].pcv[7])), - -16) - << "incorrect value for apc[2].pcv[7], expected -16, is " - << last_msg_->apc[2].pcv[7]; - EXPECT_EQ(get_asapc[2].pcv[8])>( - reinterpret_cast(&last_msg_->apc[2].pcv[8])), - 10) - << "incorrect value for apc[2].pcv[8], expected 10, is " - << last_msg_->apc[2].pcv[8]; - EXPECT_EQ(get_asapc[2].pcv[9])>( - reinterpret_cast(&last_msg_->apc[2].pcv[9])), - 56) - << "incorrect value for apc[2].pcv[9], expected 56, is " - << last_msg_->apc[2].pcv[9]; - EXPECT_EQ(get_asapc[2].pcv[10])>( - reinterpret_cast(&last_msg_->apc[2].pcv[10])), - 76) - << "incorrect value for apc[2].pcv[10], expected 76, is " - << last_msg_->apc[2].pcv[10]; - EXPECT_EQ(get_asapc[2].pcv[11])>( - reinterpret_cast(&last_msg_->apc[2].pcv[11])), - 61) - << "incorrect value for apc[2].pcv[11], expected 61, is " - << last_msg_->apc[2].pcv[11]; - EXPECT_EQ(get_asapc[2].pcv[12])>( - reinterpret_cast(&last_msg_->apc[2].pcv[12])), - -95) - << "incorrect value for apc[2].pcv[12], expected -95, is " - << last_msg_->apc[2].pcv[12]; - EXPECT_EQ(get_asapc[2].pcv[13])>( - reinterpret_cast(&last_msg_->apc[2].pcv[13])), - -40) - << "incorrect value for apc[2].pcv[13], expected -40, is " - << last_msg_->apc[2].pcv[13]; - EXPECT_EQ(get_asapc[2].pcv[14])>( - reinterpret_cast(&last_msg_->apc[2].pcv[14])), - 22) - << "incorrect value for apc[2].pcv[14], expected 22, is " - << last_msg_->apc[2].pcv[14]; - EXPECT_EQ(get_asapc[2].pcv[15])>( - reinterpret_cast(&last_msg_->apc[2].pcv[15])), - -75) - << "incorrect value for apc[2].pcv[15], expected -75, is " - << last_msg_->apc[2].pcv[15]; - EXPECT_EQ(get_asapc[2].pcv[16])>( - reinterpret_cast(&last_msg_->apc[2].pcv[16])), - -82) - << "incorrect value for apc[2].pcv[16], expected -82, is " - << last_msg_->apc[2].pcv[16]; - EXPECT_EQ(get_asapc[2].pcv[17])>( - reinterpret_cast(&last_msg_->apc[2].pcv[17])), - 33) - << "incorrect value for apc[2].pcv[17], expected 33, is " - << last_msg_->apc[2].pcv[17]; - EXPECT_EQ(get_asapc[2].pcv[18])>( - reinterpret_cast(&last_msg_->apc[2].pcv[18])), - 13) - << "incorrect value for apc[2].pcv[18], expected 13, is " - << last_msg_->apc[2].pcv[18]; - EXPECT_EQ(get_asapc[2].pcv[19])>( - reinterpret_cast(&last_msg_->apc[2].pcv[19])), - -4) - << "incorrect value for apc[2].pcv[19], expected -4, is " - << last_msg_->apc[2].pcv[19]; - EXPECT_EQ(get_asapc[2].pcv[20])>( - reinterpret_cast(&last_msg_->apc[2].pcv[20])), - -20) - << "incorrect value for apc[2].pcv[20], expected -20, is " - << last_msg_->apc[2].pcv[20]; - EXPECT_EQ(get_asapc[2].sat_info)>( - reinterpret_cast(&last_msg_->apc[2].sat_info)), - 181) - << "incorrect value for apc[2].sat_info, expected 181, is " - << last_msg_->apc[2].sat_info; - EXPECT_EQ(get_asapc[2].sid.code)>( - reinterpret_cast(&last_msg_->apc[2].sid.code)), - 188) - << "incorrect value for apc[2].sid.code, expected 188, is " - << last_msg_->apc[2].sid.code; - EXPECT_EQ(get_asapc[2].sid.sat)>( - reinterpret_cast(&last_msg_->apc[2].sid.sat)), - 83) - << "incorrect value for apc[2].sid.sat, expected 83, is " - << last_msg_->apc[2].sid.sat; - EXPECT_EQ(get_asapc[2].svn)>( - reinterpret_cast(&last_msg_->apc[2].svn)), - 7106) - << "incorrect value for apc[2].svn, expected 7106, is " - << last_msg_->apc[2].svn; - EXPECT_EQ(get_asapc[3].pco[0])>( - reinterpret_cast(&last_msg_->apc[3].pco[0])), - -19478) - << "incorrect value for apc[3].pco[0], expected -19478, is " - << last_msg_->apc[3].pco[0]; - EXPECT_EQ(get_asapc[3].pco[1])>( - reinterpret_cast(&last_msg_->apc[3].pco[1])), - 11484) - << "incorrect value for apc[3].pco[1], expected 11484, is " - << last_msg_->apc[3].pco[1]; - EXPECT_EQ(get_asapc[3].pco[2])>( - reinterpret_cast(&last_msg_->apc[3].pco[2])), - 14804) - << "incorrect value for apc[3].pco[2], expected 14804, is " - << last_msg_->apc[3].pco[2]; - EXPECT_EQ(get_asapc[3].pcv[0])>( - reinterpret_cast(&last_msg_->apc[3].pcv[0])), - 44) - << "incorrect value for apc[3].pcv[0], expected 44, is " - << last_msg_->apc[3].pcv[0]; - EXPECT_EQ(get_asapc[3].pcv[1])>( - reinterpret_cast(&last_msg_->apc[3].pcv[1])), - -83) - << "incorrect value for apc[3].pcv[1], expected -83, is " - << last_msg_->apc[3].pcv[1]; - EXPECT_EQ(get_asapc[3].pcv[2])>( - reinterpret_cast(&last_msg_->apc[3].pcv[2])), - 49) - << "incorrect value for apc[3].pcv[2], expected 49, is " - << last_msg_->apc[3].pcv[2]; - EXPECT_EQ(get_asapc[3].pcv[3])>( - reinterpret_cast(&last_msg_->apc[3].pcv[3])), - 36) - << "incorrect value for apc[3].pcv[3], expected 36, is " - << last_msg_->apc[3].pcv[3]; - EXPECT_EQ(get_asapc[3].pcv[4])>( - reinterpret_cast(&last_msg_->apc[3].pcv[4])), - -119) - << "incorrect value for apc[3].pcv[4], expected -119, is " - << last_msg_->apc[3].pcv[4]; - EXPECT_EQ(get_asapc[3].pcv[5])>( - reinterpret_cast(&last_msg_->apc[3].pcv[5])), - -8) - << "incorrect value for apc[3].pcv[5], expected -8, is " - << last_msg_->apc[3].pcv[5]; - EXPECT_EQ(get_asapc[3].pcv[6])>( - reinterpret_cast(&last_msg_->apc[3].pcv[6])), - -21) - << "incorrect value for apc[3].pcv[6], expected -21, is " - << last_msg_->apc[3].pcv[6]; - EXPECT_EQ(get_asapc[3].pcv[7])>( - reinterpret_cast(&last_msg_->apc[3].pcv[7])), - 97) - << "incorrect value for apc[3].pcv[7], expected 97, is " - << last_msg_->apc[3].pcv[7]; - EXPECT_EQ(get_asapc[3].pcv[8])>( - reinterpret_cast(&last_msg_->apc[3].pcv[8])), - 112) - << "incorrect value for apc[3].pcv[8], expected 112, is " - << last_msg_->apc[3].pcv[8]; - EXPECT_EQ(get_asapc[3].pcv[9])>( - reinterpret_cast(&last_msg_->apc[3].pcv[9])), - -99) - << "incorrect value for apc[3].pcv[9], expected -99, is " - << last_msg_->apc[3].pcv[9]; - EXPECT_EQ(get_asapc[3].pcv[10])>( - reinterpret_cast(&last_msg_->apc[3].pcv[10])), - -117) - << "incorrect value for apc[3].pcv[10], expected -117, is " - << last_msg_->apc[3].pcv[10]; - EXPECT_EQ(get_asapc[3].pcv[11])>( - reinterpret_cast(&last_msg_->apc[3].pcv[11])), - 26) - << "incorrect value for apc[3].pcv[11], expected 26, is " - << last_msg_->apc[3].pcv[11]; - EXPECT_EQ(get_asapc[3].pcv[12])>( - reinterpret_cast(&last_msg_->apc[3].pcv[12])), - 115) - << "incorrect value for apc[3].pcv[12], expected 115, is " - << last_msg_->apc[3].pcv[12]; - EXPECT_EQ(get_asapc[3].pcv[13])>( - reinterpret_cast(&last_msg_->apc[3].pcv[13])), - -64) - << "incorrect value for apc[3].pcv[13], expected -64, is " - << last_msg_->apc[3].pcv[13]; - EXPECT_EQ(get_asapc[3].pcv[14])>( - reinterpret_cast(&last_msg_->apc[3].pcv[14])), - 31) - << "incorrect value for apc[3].pcv[14], expected 31, is " - << last_msg_->apc[3].pcv[14]; - EXPECT_EQ(get_asapc[3].pcv[15])>( - reinterpret_cast(&last_msg_->apc[3].pcv[15])), - 85) - << "incorrect value for apc[3].pcv[15], expected 85, is " - << last_msg_->apc[3].pcv[15]; - EXPECT_EQ(get_asapc[3].pcv[16])>( - reinterpret_cast(&last_msg_->apc[3].pcv[16])), - 127) - << "incorrect value for apc[3].pcv[16], expected 127, is " - << last_msg_->apc[3].pcv[16]; - EXPECT_EQ(get_asapc[3].pcv[17])>( - reinterpret_cast(&last_msg_->apc[3].pcv[17])), - -28) - << "incorrect value for apc[3].pcv[17], expected -28, is " - << last_msg_->apc[3].pcv[17]; - EXPECT_EQ(get_asapc[3].pcv[18])>( - reinterpret_cast(&last_msg_->apc[3].pcv[18])), - 81) - << "incorrect value for apc[3].pcv[18], expected 81, is " - << last_msg_->apc[3].pcv[18]; - EXPECT_EQ(get_asapc[3].pcv[19])>( - reinterpret_cast(&last_msg_->apc[3].pcv[19])), - -4) - << "incorrect value for apc[3].pcv[19], expected -4, is " - << last_msg_->apc[3].pcv[19]; - EXPECT_EQ(get_asapc[3].pcv[20])>( - reinterpret_cast(&last_msg_->apc[3].pcv[20])), - -37) - << "incorrect value for apc[3].pcv[20], expected -37, is " - << last_msg_->apc[3].pcv[20]; - EXPECT_EQ(get_asapc[3].sat_info)>( - reinterpret_cast(&last_msg_->apc[3].sat_info)), - 128) - << "incorrect value for apc[3].sat_info, expected 128, is " - << last_msg_->apc[3].sat_info; - EXPECT_EQ(get_asapc[3].sid.code)>( - reinterpret_cast(&last_msg_->apc[3].sid.code)), - 196) - << "incorrect value for apc[3].sid.code, expected 196, is " - << last_msg_->apc[3].sid.code; - EXPECT_EQ(get_asapc[3].sid.sat)>( - reinterpret_cast(&last_msg_->apc[3].sid.sat)), - 230) - << "incorrect value for apc[3].sid.sat, expected 230, is " - << last_msg_->apc[3].sid.sat; - EXPECT_EQ(get_asapc[3].svn)>( - reinterpret_cast(&last_msg_->apc[3].svn)), - 61399) - << "incorrect value for apc[3].svn, expected 61399, is " - << last_msg_->apc[3].svn; - EXPECT_EQ(get_asapc[4].pco[0])>( - reinterpret_cast(&last_msg_->apc[4].pco[0])), - -11049) - << "incorrect value for apc[4].pco[0], expected -11049, is " - << last_msg_->apc[4].pco[0]; - EXPECT_EQ(get_asapc[4].pco[1])>( - reinterpret_cast(&last_msg_->apc[4].pco[1])), - 6580) - << "incorrect value for apc[4].pco[1], expected 6580, is " - << last_msg_->apc[4].pco[1]; - EXPECT_EQ(get_asapc[4].pco[2])>( - reinterpret_cast(&last_msg_->apc[4].pco[2])), - -28589) - << "incorrect value for apc[4].pco[2], expected -28589, is " - << last_msg_->apc[4].pco[2]; - EXPECT_EQ(get_asapc[4].pcv[0])>( - reinterpret_cast(&last_msg_->apc[4].pcv[0])), - -9) - << "incorrect value for apc[4].pcv[0], expected -9, is " - << last_msg_->apc[4].pcv[0]; - EXPECT_EQ(get_asapc[4].pcv[1])>( - reinterpret_cast(&last_msg_->apc[4].pcv[1])), - 12) - << "incorrect value for apc[4].pcv[1], expected 12, is " - << last_msg_->apc[4].pcv[1]; - EXPECT_EQ(get_asapc[4].pcv[2])>( - reinterpret_cast(&last_msg_->apc[4].pcv[2])), - 27) - << "incorrect value for apc[4].pcv[2], expected 27, is " - << last_msg_->apc[4].pcv[2]; - EXPECT_EQ(get_asapc[4].pcv[3])>( - reinterpret_cast(&last_msg_->apc[4].pcv[3])), - -57) - << "incorrect value for apc[4].pcv[3], expected -57, is " - << last_msg_->apc[4].pcv[3]; - EXPECT_EQ(get_asapc[4].pcv[4])>( - reinterpret_cast(&last_msg_->apc[4].pcv[4])), - -83) - << "incorrect value for apc[4].pcv[4], expected -83, is " - << last_msg_->apc[4].pcv[4]; - EXPECT_EQ(get_asapc[4].pcv[5])>( - reinterpret_cast(&last_msg_->apc[4].pcv[5])), - 74) - << "incorrect value for apc[4].pcv[5], expected 74, is " - << last_msg_->apc[4].pcv[5]; - EXPECT_EQ(get_asapc[4].pcv[6])>( - reinterpret_cast(&last_msg_->apc[4].pcv[6])), - 23) - << "incorrect value for apc[4].pcv[6], expected 23, is " - << last_msg_->apc[4].pcv[6]; - EXPECT_EQ(get_asapc[4].pcv[7])>( - reinterpret_cast(&last_msg_->apc[4].pcv[7])), - 4) - << "incorrect value for apc[4].pcv[7], expected 4, is " - << last_msg_->apc[4].pcv[7]; - EXPECT_EQ(get_asapc[4].pcv[8])>( - reinterpret_cast(&last_msg_->apc[4].pcv[8])), - -17) - << "incorrect value for apc[4].pcv[8], expected -17, is " - << last_msg_->apc[4].pcv[8]; - EXPECT_EQ(get_asapc[4].pcv[9])>( - reinterpret_cast(&last_msg_->apc[4].pcv[9])), - 103) - << "incorrect value for apc[4].pcv[9], expected 103, is " - << last_msg_->apc[4].pcv[9]; - EXPECT_EQ(get_asapc[4].pcv[10])>( - reinterpret_cast(&last_msg_->apc[4].pcv[10])), - -33) - << "incorrect value for apc[4].pcv[10], expected -33, is " - << last_msg_->apc[4].pcv[10]; - EXPECT_EQ(get_asapc[4].pcv[11])>( - reinterpret_cast(&last_msg_->apc[4].pcv[11])), - -36) - << "incorrect value for apc[4].pcv[11], expected -36, is " - << last_msg_->apc[4].pcv[11]; - EXPECT_EQ(get_asapc[4].pcv[12])>( - reinterpret_cast(&last_msg_->apc[4].pcv[12])), - -117) - << "incorrect value for apc[4].pcv[12], expected -117, is " - << last_msg_->apc[4].pcv[12]; - EXPECT_EQ(get_asapc[4].pcv[13])>( - reinterpret_cast(&last_msg_->apc[4].pcv[13])), - 91) - << "incorrect value for apc[4].pcv[13], expected 91, is " - << last_msg_->apc[4].pcv[13]; - EXPECT_EQ(get_asapc[4].pcv[14])>( - reinterpret_cast(&last_msg_->apc[4].pcv[14])), - 127) - << "incorrect value for apc[4].pcv[14], expected 127, is " - << last_msg_->apc[4].pcv[14]; - EXPECT_EQ(get_asapc[4].pcv[15])>( - reinterpret_cast(&last_msg_->apc[4].pcv[15])), - -42) - << "incorrect value for apc[4].pcv[15], expected -42, is " - << last_msg_->apc[4].pcv[15]; - EXPECT_EQ(get_asapc[4].pcv[16])>( - reinterpret_cast(&last_msg_->apc[4].pcv[16])), - 86) - << "incorrect value for apc[4].pcv[16], expected 86, is " - << last_msg_->apc[4].pcv[16]; - EXPECT_EQ(get_asapc[4].pcv[17])>( - reinterpret_cast(&last_msg_->apc[4].pcv[17])), - 48) - << "incorrect value for apc[4].pcv[17], expected 48, is " - << last_msg_->apc[4].pcv[17]; - EXPECT_EQ(get_asapc[4].pcv[18])>( - reinterpret_cast(&last_msg_->apc[4].pcv[18])), - -53) - << "incorrect value for apc[4].pcv[18], expected -53, is " - << last_msg_->apc[4].pcv[18]; - EXPECT_EQ(get_asapc[4].pcv[19])>( - reinterpret_cast(&last_msg_->apc[4].pcv[19])), - -28) - << "incorrect value for apc[4].pcv[19], expected -28, is " - << last_msg_->apc[4].pcv[19]; - EXPECT_EQ(get_asapc[4].pcv[20])>( - reinterpret_cast(&last_msg_->apc[4].pcv[20])), - 99) - << "incorrect value for apc[4].pcv[20], expected 99, is " - << last_msg_->apc[4].pcv[20]; - EXPECT_EQ(get_asapc[4].sat_info)>( - reinterpret_cast(&last_msg_->apc[4].sat_info)), - 147) - << "incorrect value for apc[4].sat_info, expected 147, is " - << last_msg_->apc[4].sat_info; - EXPECT_EQ(get_asapc[4].sid.code)>( - reinterpret_cast(&last_msg_->apc[4].sid.code)), - 110) - << "incorrect value for apc[4].sid.code, expected 110, is " - << last_msg_->apc[4].sid.code; - EXPECT_EQ(get_asapc[4].sid.sat)>( - reinterpret_cast(&last_msg_->apc[4].sid.sat)), - 249) - << "incorrect value for apc[4].sid.sat, expected 249, is " - << last_msg_->apc[4].sid.sat; - EXPECT_EQ(get_asapc[4].svn)>( - reinterpret_cast(&last_msg_->apc[4].svn)), - 41224) - << "incorrect value for apc[4].svn, expected 41224, is " - << last_msg_->apc[4].svn; - EXPECT_EQ(get_asapc[5].pco[0])>( - reinterpret_cast(&last_msg_->apc[5].pco[0])), - -21881) - << "incorrect value for apc[5].pco[0], expected -21881, is " - << last_msg_->apc[5].pco[0]; - EXPECT_EQ(get_asapc[5].pco[1])>( - reinterpret_cast(&last_msg_->apc[5].pco[1])), - -9942) - << "incorrect value for apc[5].pco[1], expected -9942, is " - << last_msg_->apc[5].pco[1]; - EXPECT_EQ(get_asapc[5].pco[2])>( - reinterpret_cast(&last_msg_->apc[5].pco[2])), - -5689) - << "incorrect value for apc[5].pco[2], expected -5689, is " - << last_msg_->apc[5].pco[2]; - EXPECT_EQ(get_asapc[5].pcv[0])>( - reinterpret_cast(&last_msg_->apc[5].pcv[0])), - 42) - << "incorrect value for apc[5].pcv[0], expected 42, is " - << last_msg_->apc[5].pcv[0]; - EXPECT_EQ(get_asapc[5].pcv[1])>( - reinterpret_cast(&last_msg_->apc[5].pcv[1])), - -86) - << "incorrect value for apc[5].pcv[1], expected -86, is " - << last_msg_->apc[5].pcv[1]; - EXPECT_EQ(get_asapc[5].pcv[2])>( - reinterpret_cast(&last_msg_->apc[5].pcv[2])), - 78) - << "incorrect value for apc[5].pcv[2], expected 78, is " - << last_msg_->apc[5].pcv[2]; - EXPECT_EQ(get_asapc[5].pcv[3])>( - reinterpret_cast(&last_msg_->apc[5].pcv[3])), - -50) - << "incorrect value for apc[5].pcv[3], expected -50, is " - << last_msg_->apc[5].pcv[3]; - EXPECT_EQ(get_asapc[5].pcv[4])>( - reinterpret_cast(&last_msg_->apc[5].pcv[4])), - 41) - << "incorrect value for apc[5].pcv[4], expected 41, is " - << last_msg_->apc[5].pcv[4]; - EXPECT_EQ(get_asapc[5].pcv[5])>( - reinterpret_cast(&last_msg_->apc[5].pcv[5])), - 43) - << "incorrect value for apc[5].pcv[5], expected 43, is " - << last_msg_->apc[5].pcv[5]; - EXPECT_EQ(get_asapc[5].pcv[6])>( - reinterpret_cast(&last_msg_->apc[5].pcv[6])), - 81) - << "incorrect value for apc[5].pcv[6], expected 81, is " - << last_msg_->apc[5].pcv[6]; - EXPECT_EQ(get_asapc[5].pcv[7])>( - reinterpret_cast(&last_msg_->apc[5].pcv[7])), - -9) - << "incorrect value for apc[5].pcv[7], expected -9, is " - << last_msg_->apc[5].pcv[7]; - EXPECT_EQ(get_asapc[5].pcv[8])>( - reinterpret_cast(&last_msg_->apc[5].pcv[8])), - 99) - << "incorrect value for apc[5].pcv[8], expected 99, is " - << last_msg_->apc[5].pcv[8]; - EXPECT_EQ(get_asapc[5].pcv[9])>( - reinterpret_cast(&last_msg_->apc[5].pcv[9])), - -58) - << "incorrect value for apc[5].pcv[9], expected -58, is " - << last_msg_->apc[5].pcv[9]; - EXPECT_EQ(get_asapc[5].pcv[10])>( - reinterpret_cast(&last_msg_->apc[5].pcv[10])), - -112) - << "incorrect value for apc[5].pcv[10], expected -112, is " - << last_msg_->apc[5].pcv[10]; - EXPECT_EQ(get_asapc[5].pcv[11])>( - reinterpret_cast(&last_msg_->apc[5].pcv[11])), - 2) - << "incorrect value for apc[5].pcv[11], expected 2, is " - << last_msg_->apc[5].pcv[11]; - EXPECT_EQ(get_asapc[5].pcv[12])>( - reinterpret_cast(&last_msg_->apc[5].pcv[12])), - -124) - << "incorrect value for apc[5].pcv[12], expected -124, is " - << last_msg_->apc[5].pcv[12]; - EXPECT_EQ(get_asapc[5].pcv[13])>( - reinterpret_cast(&last_msg_->apc[5].pcv[13])), - 2) - << "incorrect value for apc[5].pcv[13], expected 2, is " - << last_msg_->apc[5].pcv[13]; - EXPECT_EQ(get_asapc[5].pcv[14])>( - reinterpret_cast(&last_msg_->apc[5].pcv[14])), - -32) - << "incorrect value for apc[5].pcv[14], expected -32, is " - << last_msg_->apc[5].pcv[14]; - EXPECT_EQ(get_asapc[5].pcv[15])>( - reinterpret_cast(&last_msg_->apc[5].pcv[15])), - -36) - << "incorrect value for apc[5].pcv[15], expected -36, is " - << last_msg_->apc[5].pcv[15]; - EXPECT_EQ(get_asapc[5].pcv[16])>( - reinterpret_cast(&last_msg_->apc[5].pcv[16])), - -108) - << "incorrect value for apc[5].pcv[16], expected -108, is " - << last_msg_->apc[5].pcv[16]; - EXPECT_EQ(get_asapc[5].pcv[17])>( - reinterpret_cast(&last_msg_->apc[5].pcv[17])), - 58) - << "incorrect value for apc[5].pcv[17], expected 58, is " - << last_msg_->apc[5].pcv[17]; - EXPECT_EQ(get_asapc[5].pcv[18])>( - reinterpret_cast(&last_msg_->apc[5].pcv[18])), - 85) - << "incorrect value for apc[5].pcv[18], expected 85, is " - << last_msg_->apc[5].pcv[18]; - EXPECT_EQ(get_asapc[5].pcv[19])>( - reinterpret_cast(&last_msg_->apc[5].pcv[19])), - -118) - << "incorrect value for apc[5].pcv[19], expected -118, is " - << last_msg_->apc[5].pcv[19]; - EXPECT_EQ(get_asapc[5].pcv[20])>( - reinterpret_cast(&last_msg_->apc[5].pcv[20])), - -46) - << "incorrect value for apc[5].pcv[20], expected -46, is " - << last_msg_->apc[5].pcv[20]; - EXPECT_EQ(get_asapc[5].sat_info)>( - reinterpret_cast(&last_msg_->apc[5].sat_info)), - 159) - << "incorrect value for apc[5].sat_info, expected 159, is " - << last_msg_->apc[5].sat_info; - EXPECT_EQ(get_asapc[5].sid.code)>( - reinterpret_cast(&last_msg_->apc[5].sid.code)), - 83) - << "incorrect value for apc[5].sid.code, expected 83, is " - << last_msg_->apc[5].sid.code; - EXPECT_EQ(get_asapc[5].sid.sat)>( - reinterpret_cast(&last_msg_->apc[5].sid.sat)), - 45) - << "incorrect value for apc[5].sid.sat, expected 45, is " - << last_msg_->apc[5].sid.sat; - EXPECT_EQ(get_asapc[5].svn)>( - reinterpret_cast(&last_msg_->apc[5].svn)), - 64011) - << "incorrect value for apc[5].svn, expected 64011, is " - << last_msg_->apc[5].svn; - EXPECT_EQ(get_asapc[6].pco[0])>( - reinterpret_cast(&last_msg_->apc[6].pco[0])), - -14290) - << "incorrect value for apc[6].pco[0], expected -14290, is " - << last_msg_->apc[6].pco[0]; - EXPECT_EQ(get_asapc[6].pco[1])>( - reinterpret_cast(&last_msg_->apc[6].pco[1])), - 30340) - << "incorrect value for apc[6].pco[1], expected 30340, is " - << last_msg_->apc[6].pco[1]; - EXPECT_EQ(get_asapc[6].pco[2])>( - reinterpret_cast(&last_msg_->apc[6].pco[2])), - 3569) - << "incorrect value for apc[6].pco[2], expected 3569, is " - << last_msg_->apc[6].pco[2]; - EXPECT_EQ(get_asapc[6].pcv[0])>( - reinterpret_cast(&last_msg_->apc[6].pcv[0])), - 37) - << "incorrect value for apc[6].pcv[0], expected 37, is " - << last_msg_->apc[6].pcv[0]; - EXPECT_EQ(get_asapc[6].pcv[1])>( - reinterpret_cast(&last_msg_->apc[6].pcv[1])), - 62) - << "incorrect value for apc[6].pcv[1], expected 62, is " - << last_msg_->apc[6].pcv[1]; - EXPECT_EQ(get_asapc[6].pcv[2])>( - reinterpret_cast(&last_msg_->apc[6].pcv[2])), - 107) - << "incorrect value for apc[6].pcv[2], expected 107, is " - << last_msg_->apc[6].pcv[2]; - EXPECT_EQ(get_asapc[6].pcv[3])>( - reinterpret_cast(&last_msg_->apc[6].pcv[3])), - -3) - << "incorrect value for apc[6].pcv[3], expected -3, is " - << last_msg_->apc[6].pcv[3]; - EXPECT_EQ(get_asapc[6].pcv[4])>( - reinterpret_cast(&last_msg_->apc[6].pcv[4])), - -66) - << "incorrect value for apc[6].pcv[4], expected -66, is " - << last_msg_->apc[6].pcv[4]; - EXPECT_EQ(get_asapc[6].pcv[5])>( - reinterpret_cast(&last_msg_->apc[6].pcv[5])), - -120) - << "incorrect value for apc[6].pcv[5], expected -120, is " - << last_msg_->apc[6].pcv[5]; - EXPECT_EQ(get_asapc[6].pcv[6])>( - reinterpret_cast(&last_msg_->apc[6].pcv[6])), - 66) - << "incorrect value for apc[6].pcv[6], expected 66, is " - << last_msg_->apc[6].pcv[6]; - EXPECT_EQ(get_asapc[6].pcv[7])>( - reinterpret_cast(&last_msg_->apc[6].pcv[7])), - 9) - << "incorrect value for apc[6].pcv[7], expected 9, is " - << last_msg_->apc[6].pcv[7]; - EXPECT_EQ(get_asapc[6].pcv[8])>( - reinterpret_cast(&last_msg_->apc[6].pcv[8])), - 84) - << "incorrect value for apc[6].pcv[8], expected 84, is " - << last_msg_->apc[6].pcv[8]; - EXPECT_EQ(get_asapc[6].pcv[9])>( - reinterpret_cast(&last_msg_->apc[6].pcv[9])), - -101) - << "incorrect value for apc[6].pcv[9], expected -101, is " - << last_msg_->apc[6].pcv[9]; - EXPECT_EQ(get_asapc[6].pcv[10])>( - reinterpret_cast(&last_msg_->apc[6].pcv[10])), - 86) - << "incorrect value for apc[6].pcv[10], expected 86, is " - << last_msg_->apc[6].pcv[10]; - EXPECT_EQ(get_asapc[6].pcv[11])>( - reinterpret_cast(&last_msg_->apc[6].pcv[11])), - -76) - << "incorrect value for apc[6].pcv[11], expected -76, is " - << last_msg_->apc[6].pcv[11]; - EXPECT_EQ(get_asapc[6].pcv[12])>( - reinterpret_cast(&last_msg_->apc[6].pcv[12])), - 41) - << "incorrect value for apc[6].pcv[12], expected 41, is " - << last_msg_->apc[6].pcv[12]; - EXPECT_EQ(get_asapc[6].pcv[13])>( - reinterpret_cast(&last_msg_->apc[6].pcv[13])), - -60) - << "incorrect value for apc[6].pcv[13], expected -60, is " - << last_msg_->apc[6].pcv[13]; - EXPECT_EQ(get_asapc[6].pcv[14])>( - reinterpret_cast(&last_msg_->apc[6].pcv[14])), - 40) - << "incorrect value for apc[6].pcv[14], expected 40, is " - << last_msg_->apc[6].pcv[14]; - EXPECT_EQ(get_asapc[6].pcv[15])>( - reinterpret_cast(&last_msg_->apc[6].pcv[15])), - 119) - << "incorrect value for apc[6].pcv[15], expected 119, is " - << last_msg_->apc[6].pcv[15]; - EXPECT_EQ(get_asapc[6].pcv[16])>( - reinterpret_cast(&last_msg_->apc[6].pcv[16])), - 101) - << "incorrect value for apc[6].pcv[16], expected 101, is " - << last_msg_->apc[6].pcv[16]; - EXPECT_EQ(get_asapc[6].pcv[17])>( - reinterpret_cast(&last_msg_->apc[6].pcv[17])), - -4) - << "incorrect value for apc[6].pcv[17], expected -4, is " - << last_msg_->apc[6].pcv[17]; - EXPECT_EQ(get_asapc[6].pcv[18])>( - reinterpret_cast(&last_msg_->apc[6].pcv[18])), - -33) - << "incorrect value for apc[6].pcv[18], expected -33, is " - << last_msg_->apc[6].pcv[18]; - EXPECT_EQ(get_asapc[6].pcv[19])>( - reinterpret_cast(&last_msg_->apc[6].pcv[19])), - -112) - << "incorrect value for apc[6].pcv[19], expected -112, is " - << last_msg_->apc[6].pcv[19]; - EXPECT_EQ(get_asapc[6].pcv[20])>( - reinterpret_cast(&last_msg_->apc[6].pcv[20])), - -103) - << "incorrect value for apc[6].pcv[20], expected -103, is " - << last_msg_->apc[6].pcv[20]; - EXPECT_EQ(get_asapc[6].sat_info)>( - reinterpret_cast(&last_msg_->apc[6].sat_info)), - 7) - << "incorrect value for apc[6].sat_info, expected 7, is " - << last_msg_->apc[6].sat_info; - EXPECT_EQ(get_asapc[6].sid.code)>( - reinterpret_cast(&last_msg_->apc[6].sid.code)), - 158) - << "incorrect value for apc[6].sid.code, expected 158, is " - << last_msg_->apc[6].sid.code; - EXPECT_EQ(get_asapc[6].sid.sat)>( - reinterpret_cast(&last_msg_->apc[6].sid.sat)), - 200) - << "incorrect value for apc[6].sid.sat, expected 200, is " - << last_msg_->apc[6].sid.sat; - EXPECT_EQ(get_asapc[6].svn)>( - reinterpret_cast(&last_msg_->apc[6].svn)), - 17310) - << "incorrect value for apc[6].svn, expected 17310, is " - << last_msg_->apc[6].svn; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrStecCorrection.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrStecCorrection.cc deleted file mode 100644 index 313ca4ddf0..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrStecCorrection.cc +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrStecCorrection.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrStecCorrection0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrStecCorrection0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_stec_correction_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_stec_correction_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrStecCorrection0, Test) { - uint8_t encoded_frame[] = { - 85, 253, 5, 66, 0, 38, 180, 0, 0, 0, 3, 0, 1, 1, 10, 0, - 15, 1, 0, 10, 0, 2, 1, 1, 1, 63, 0, 62, 0, 61, 0, 60, - 0, 31, 15, 5, 63, 0, 64, 0, 65, 0, 66, 0, 119, 50, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_stec_correction_t *test_msg = - (msg_ssr_stec_correction_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.num_msgs = 1; - test_msg->header.seq_num = 1; - test_msg->header.sol_id = 0; - test_msg->header.time.tow = 180; - test_msg->header.time.wn = 3; - test_msg->header.update_interval = 10; - test_msg->n_sats = 2; - test_msg->ssr_iod_atmo = 15; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[0].stec_coeff[0])); - } - test_msg->stec_sat_list[0].stec_coeff[0] = 63; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[0].stec_coeff[0])); - } - test_msg->stec_sat_list[0].stec_coeff[1] = 62; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[0].stec_coeff[0])); - } - test_msg->stec_sat_list[0].stec_coeff[2] = 61; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[0].stec_coeff[0])); - } - test_msg->stec_sat_list[0].stec_coeff[3] = 60; - test_msg->stec_sat_list[0].stec_quality_indicator = 1; - test_msg->stec_sat_list[0].sv_id.constellation = 1; - test_msg->stec_sat_list[0].sv_id.satId = 1; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[1].stec_coeff[0])); - } - test_msg->stec_sat_list[1].stec_coeff[0] = 63; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[1].stec_coeff[0])); - } - test_msg->stec_sat_list[1].stec_coeff[1] = 64; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[1].stec_coeff[0])); - } - test_msg->stec_sat_list[1].stec_coeff[2] = 65; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[1].stec_coeff[0])); - } - test_msg->stec_sat_list[1].stec_coeff[3] = 66; - test_msg->stec_sat_list[1].stec_quality_indicator = 5; - test_msg->stec_sat_list[1].sv_id.constellation = 15; - test_msg->stec_sat_list[1].sv_id.satId = 31; - test_msg->tile_id = 10; - test_msg->tile_set_id = 1; - - EXPECT_EQ(send_message(1533, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.num_msgs)>( - reinterpret_cast(&last_msg_->header.num_msgs)), - 1) - << "incorrect value for header.num_msgs, expected 1, is " - << last_msg_->header.num_msgs; - EXPECT_EQ(get_asheader.seq_num)>( - reinterpret_cast(&last_msg_->header.seq_num)), - 1) - << "incorrect value for header.seq_num, expected 1, is " - << last_msg_->header.seq_num; - EXPECT_EQ(get_asheader.sol_id)>( - reinterpret_cast(&last_msg_->header.sol_id)), - 0) - << "incorrect value for header.sol_id, expected 0, is " - << last_msg_->header.sol_id; - EXPECT_EQ(get_asheader.time.tow)>( - reinterpret_cast(&last_msg_->header.time.tow)), - 180) - << "incorrect value for header.time.tow, expected 180, is " - << last_msg_->header.time.tow; - EXPECT_EQ(get_asheader.time.wn)>( - reinterpret_cast(&last_msg_->header.time.wn)), - 3) - << "incorrect value for header.time.wn, expected 3, is " - << last_msg_->header.time.wn; - EXPECT_EQ(get_asheader.update_interval)>( - reinterpret_cast( - &last_msg_->header.update_interval)), - 10) - << "incorrect value for header.update_interval, expected 10, is " - << last_msg_->header.update_interval; - EXPECT_EQ(get_asn_sats)>( - reinterpret_cast(&last_msg_->n_sats)), - 2) - << "incorrect value for n_sats, expected 2, is " << last_msg_->n_sats; - EXPECT_EQ(get_asssr_iod_atmo)>( - reinterpret_cast(&last_msg_->ssr_iod_atmo)), - 15) - << "incorrect value for ssr_iod_atmo, expected 15, is " - << last_msg_->ssr_iod_atmo; - EXPECT_EQ(get_asstec_sat_list[0].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_coeff[0])), - 63) - << "incorrect value for stec_sat_list[0].stec_coeff[0], expected 63, is " - << last_msg_->stec_sat_list[0].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[0].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_coeff[1])), - 62) - << "incorrect value for stec_sat_list[0].stec_coeff[1], expected 62, is " - << last_msg_->stec_sat_list[0].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[0].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_coeff[2])), - 61) - << "incorrect value for stec_sat_list[0].stec_coeff[2], expected 61, is " - << last_msg_->stec_sat_list[0].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[0].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_coeff[3])), - 60) - << "incorrect value for stec_sat_list[0].stec_coeff[3], expected 60, is " - << last_msg_->stec_sat_list[0].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[0].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_quality_indicator)), - 1) - << "incorrect value for stec_sat_list[0].stec_quality_indicator, " - "expected 1, is " - << last_msg_->stec_sat_list[0].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[0].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].sv_id.constellation)), - 1) - << "incorrect value for stec_sat_list[0].sv_id.constellation, expected " - "1, is " - << last_msg_->stec_sat_list[0].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[0].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].sv_id.satId)), - 1) - << "incorrect value for stec_sat_list[0].sv_id.satId, expected 1, is " - << last_msg_->stec_sat_list[0].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[1].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_coeff[0])), - 63) - << "incorrect value for stec_sat_list[1].stec_coeff[0], expected 63, is " - << last_msg_->stec_sat_list[1].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[1].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_coeff[1])), - 64) - << "incorrect value for stec_sat_list[1].stec_coeff[1], expected 64, is " - << last_msg_->stec_sat_list[1].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[1].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_coeff[2])), - 65) - << "incorrect value for stec_sat_list[1].stec_coeff[2], expected 65, is " - << last_msg_->stec_sat_list[1].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[1].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_coeff[3])), - 66) - << "incorrect value for stec_sat_list[1].stec_coeff[3], expected 66, is " - << last_msg_->stec_sat_list[1].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[1].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_quality_indicator)), - 5) - << "incorrect value for stec_sat_list[1].stec_quality_indicator, " - "expected 5, is " - << last_msg_->stec_sat_list[1].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[1].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].sv_id.constellation)), - 15) - << "incorrect value for stec_sat_list[1].sv_id.constellation, expected " - "15, is " - << last_msg_->stec_sat_list[1].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[1].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].sv_id.satId)), - 31) - << "incorrect value for stec_sat_list[1].sv_id.satId, expected 31, is " - << last_msg_->stec_sat_list[1].sv_id.satId; - EXPECT_EQ(get_astile_id)>( - reinterpret_cast(&last_msg_->tile_id)), - 10) - << "incorrect value for tile_id, expected 10, is " << last_msg_->tile_id; - EXPECT_EQ(get_astile_set_id)>( - reinterpret_cast(&last_msg_->tile_set_id)), - 1) - << "incorrect value for tile_set_id, expected 1, is " - << last_msg_->tile_set_id; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrStecCorrectionDep.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrStecCorrectionDep.cc deleted file mode 100644 index 6cdce5b2cb..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrStecCorrectionDep.cc +++ /dev/null @@ -1,1865 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrStecCorrectionDep.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDep0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDep0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_stec_correction_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_stec_correction_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDep0, Test) { - uint8_t encoded_frame[] = { - 85, 251, 5, 204, 151, 245, 158, 228, 114, 117, 50, 158, 156, 42, 119, - 156, 157, 112, 47, 60, 132, 40, 70, 87, 235, 83, 177, 198, 3, 14, - 8, 70, 12, 44, 53, 181, 90, 174, 247, 150, 58, 172, 247, 179, 119, - 176, 125, 4, 177, 229, 113, 14, 77, 153, 185, 23, 53, 222, 187, 146, - 250, 91, 212, 215, 14, 107, 250, 94, 107, 33, 91, 234, 0, 213, 139, - 95, 179, 50, 21, 74, 174, 169, 61, 86, 91, 142, 51, 108, 9, 38, - 225, 146, 101, 73, 139, 56, 117, 82, 37, 213, 108, 205, 93, 18, 19, - 195, 33, 202, 87, 206, 178, 125, 188, 119, 56, 69, 150, 150, 76, 3, - 131, 18, 73, 208, 72, 232, 8, 250, 203, 178, 170, 163, 252, 86, 49, - 247, 178, 166, 56, 31, 10, 119, 213, 241, 212, 164, 1, 162, 42, 18, - 124, 169, 121, 158, 26, 56, 23, 142, 125, 40, 120, 67, 45, 126, 235, - 110, 23, 12, 241, 88, 69, 239, 252, 57, 93, 44, 201, 216, 173, 242, - 178, 17, 5, 223, 169, 192, 3, 77, 107, 2, 144, 233, 14, 88, 32, - 209, 1, 17, 123, 155, 41, 183, 244, 158, 82, 53, 103, 14, 202, 185, - 35, 181, 21, 118, 254, 250, 50, 184, 50, 31, 45, 56, 163, 177, 126, - 217, 79, 171, 239, 237, 188, 238, 112, 201, 118, 141, 18, 163, 103, 35, - 63, 21, 82, 129, 18, 117, 85, 190, 79, 210, 215, 227, 177, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_stec_correction_dep_t *test_msg = - (msg_ssr_stec_correction_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.iod_atmo = 60; - test_msg->header.num_msgs = 157; - test_msg->header.seq_num = 112; - test_msg->header.tile_id = 30066; - test_msg->header.tile_set_id = 58526; - test_msg->header.time.tow = 714907186; - test_msg->header.time.wn = 40055; - test_msg->header.update_interval = 47; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[0].stec_coeff[0])); - } - test_msg->stec_sat_list[0].stec_coeff[0] = -5289; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[0].stec_coeff[0])); - } - test_msg->stec_sat_list[0].stec_coeff[1] = -20141; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[0].stec_coeff[0])); - } - test_msg->stec_sat_list[0].stec_coeff[2] = 966; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[0].stec_coeff[0])); - } - test_msg->stec_sat_list[0].stec_coeff[3] = 2062; - test_msg->stec_sat_list[0].stec_quality_indicator = 70; - test_msg->stec_sat_list[0].sv_id.constellation = 40; - test_msg->stec_sat_list[0].sv_id.satId = 132; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[1].stec_coeff[0])); - } - test_msg->stec_sat_list[1].stec_coeff[0] = -19147; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[1].stec_coeff[0])); - } - test_msg->stec_sat_list[1].stec_coeff[1] = -20902; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[1].stec_coeff[0])); - } - test_msg->stec_sat_list[1].stec_coeff[2] = -26889; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[1].stec_coeff[0])); - } - test_msg->stec_sat_list[1].stec_coeff[3] = -21446; - test_msg->stec_sat_list[1].stec_quality_indicator = 44; - test_msg->stec_sat_list[1].sv_id.constellation = 12; - test_msg->stec_sat_list[1].sv_id.satId = 70; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[2].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[2].stec_coeff[0])); - } - test_msg->stec_sat_list[2].stec_coeff[0] = 32176; - if (sizeof(test_msg->stec_sat_list[2].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[2].stec_coeff[0])); - } - test_msg->stec_sat_list[2].stec_coeff[1] = -20220; - if (sizeof(test_msg->stec_sat_list[2].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[2].stec_coeff[0])); - } - test_msg->stec_sat_list[2].stec_coeff[2] = 29157; - if (sizeof(test_msg->stec_sat_list[2].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[2].stec_coeff[0])); - } - test_msg->stec_sat_list[2].stec_coeff[3] = 19726; - test_msg->stec_sat_list[2].stec_quality_indicator = 119; - test_msg->stec_sat_list[2].sv_id.constellation = 179; - test_msg->stec_sat_list[2].sv_id.satId = 247; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[3].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[3].stec_coeff[0])); - } - test_msg->stec_sat_list[3].stec_coeff[0] = -8651; - if (sizeof(test_msg->stec_sat_list[3].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[3].stec_coeff[0])); - } - test_msg->stec_sat_list[3].stec_coeff[1] = -27973; - if (sizeof(test_msg->stec_sat_list[3].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[3].stec_coeff[0])); - } - test_msg->stec_sat_list[3].stec_coeff[2] = 23546; - if (sizeof(test_msg->stec_sat_list[3].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[3].stec_coeff[0])); - } - test_msg->stec_sat_list[3].stec_coeff[3] = -10284; - test_msg->stec_sat_list[3].stec_quality_indicator = 23; - test_msg->stec_sat_list[3].sv_id.constellation = 185; - test_msg->stec_sat_list[3].sv_id.satId = 153; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[4].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[4].stec_coeff[0])); - } - test_msg->stec_sat_list[4].stec_coeff[0] = 27486; - if (sizeof(test_msg->stec_sat_list[4].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[4].stec_coeff[0])); - } - test_msg->stec_sat_list[4].stec_coeff[1] = 23329; - if (sizeof(test_msg->stec_sat_list[4].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[4].stec_coeff[0])); - } - test_msg->stec_sat_list[4].stec_coeff[2] = 234; - if (sizeof(test_msg->stec_sat_list[4].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[4].stec_coeff[0])); - } - test_msg->stec_sat_list[4].stec_coeff[3] = -29739; - test_msg->stec_sat_list[4].stec_quality_indicator = 250; - test_msg->stec_sat_list[4].sv_id.constellation = 107; - test_msg->stec_sat_list[4].sv_id.satId = 14; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[5].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[5].stec_coeff[0])); - } - test_msg->stec_sat_list[5].stec_coeff[0] = 18965; - if (sizeof(test_msg->stec_sat_list[5].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[5].stec_coeff[0])); - } - test_msg->stec_sat_list[5].stec_coeff[1] = -22098; - if (sizeof(test_msg->stec_sat_list[5].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[5].stec_coeff[0])); - } - test_msg->stec_sat_list[5].stec_coeff[2] = 22077; - if (sizeof(test_msg->stec_sat_list[5].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[5].stec_coeff[0])); - } - test_msg->stec_sat_list[5].stec_coeff[3] = -29093; - test_msg->stec_sat_list[5].stec_quality_indicator = 50; - test_msg->stec_sat_list[5].sv_id.constellation = 179; - test_msg->stec_sat_list[5].sv_id.satId = 95; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[6].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[6].stec_coeff[0])); - } - test_msg->stec_sat_list[6].stec_coeff[0] = -7898; - if (sizeof(test_msg->stec_sat_list[6].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[6].stec_coeff[0])); - } - test_msg->stec_sat_list[6].stec_coeff[1] = 26002; - if (sizeof(test_msg->stec_sat_list[6].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[6].stec_coeff[0])); - } - test_msg->stec_sat_list[6].stec_coeff[2] = -29879; - if (sizeof(test_msg->stec_sat_list[6].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[6].stec_coeff[0])); - } - test_msg->stec_sat_list[6].stec_coeff[3] = 30008; - test_msg->stec_sat_list[6].stec_quality_indicator = 9; - test_msg->stec_sat_list[6].sv_id.constellation = 108; - test_msg->stec_sat_list[6].sv_id.satId = 51; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[7].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[7].stec_coeff[0])); - } - test_msg->stec_sat_list[7].stec_coeff[0] = -12948; - if (sizeof(test_msg->stec_sat_list[7].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[7].stec_coeff[0])); - } - test_msg->stec_sat_list[7].stec_coeff[1] = 4701; - if (sizeof(test_msg->stec_sat_list[7].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[7].stec_coeff[0])); - } - test_msg->stec_sat_list[7].stec_coeff[2] = -15597; - if (sizeof(test_msg->stec_sat_list[7].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[7].stec_coeff[0])); - } - test_msg->stec_sat_list[7].stec_coeff[3] = -13791; - test_msg->stec_sat_list[7].stec_quality_indicator = 213; - test_msg->stec_sat_list[7].sv_id.constellation = 37; - test_msg->stec_sat_list[7].sv_id.satId = 82; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[8].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[8].stec_coeff[0])); - } - test_msg->stec_sat_list[8].stec_coeff[0] = -17283; - if (sizeof(test_msg->stec_sat_list[8].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[8].stec_coeff[0])); - } - test_msg->stec_sat_list[8].stec_coeff[1] = 14455; - if (sizeof(test_msg->stec_sat_list[8].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[8].stec_coeff[0])); - } - test_msg->stec_sat_list[8].stec_coeff[2] = -27067; - if (sizeof(test_msg->stec_sat_list[8].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[8].stec_coeff[0])); - } - test_msg->stec_sat_list[8].stec_coeff[3] = 19606; - test_msg->stec_sat_list[8].stec_quality_indicator = 178; - test_msg->stec_sat_list[8].sv_id.constellation = 206; - test_msg->stec_sat_list[8].sv_id.satId = 87; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[9].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[9].stec_coeff[0])); - } - test_msg->stec_sat_list[9].stec_coeff[0] = -12215; - if (sizeof(test_msg->stec_sat_list[9].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[9].stec_coeff[0])); - } - test_msg->stec_sat_list[9].stec_coeff[1] = -6072; - if (sizeof(test_msg->stec_sat_list[9].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[9].stec_coeff[0])); - } - test_msg->stec_sat_list[9].stec_coeff[2] = -1528; - if (sizeof(test_msg->stec_sat_list[9].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[9].stec_coeff[0])); - } - test_msg->stec_sat_list[9].stec_coeff[3] = -19765; - test_msg->stec_sat_list[9].stec_quality_indicator = 18; - test_msg->stec_sat_list[9].sv_id.constellation = 131; - test_msg->stec_sat_list[9].sv_id.satId = 3; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[10].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[10].stec_coeff[0])); - } - test_msg->stec_sat_list[10].stec_coeff[0] = 12630; - if (sizeof(test_msg->stec_sat_list[10].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[10].stec_coeff[0])); - } - test_msg->stec_sat_list[10].stec_coeff[1] = -19721; - if (sizeof(test_msg->stec_sat_list[10].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[10].stec_coeff[0])); - } - test_msg->stec_sat_list[10].stec_coeff[2] = 14502; - if (sizeof(test_msg->stec_sat_list[10].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[10].stec_coeff[0])); - } - test_msg->stec_sat_list[10].stec_coeff[3] = 2591; - test_msg->stec_sat_list[10].stec_quality_indicator = 252; - test_msg->stec_sat_list[10].sv_id.constellation = 163; - test_msg->stec_sat_list[10].sv_id.satId = 170; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[11].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[11].stec_coeff[0])); - } - test_msg->stec_sat_list[11].stec_coeff[0] = -23340; - if (sizeof(test_msg->stec_sat_list[11].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[11].stec_coeff[0])); - } - test_msg->stec_sat_list[11].stec_coeff[1] = -24063; - if (sizeof(test_msg->stec_sat_list[11].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[11].stec_coeff[0])); - } - test_msg->stec_sat_list[11].stec_coeff[2] = 4650; - if (sizeof(test_msg->stec_sat_list[11].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[11].stec_coeff[0])); - } - test_msg->stec_sat_list[11].stec_coeff[3] = -22148; - test_msg->stec_sat_list[11].stec_quality_indicator = 241; - test_msg->stec_sat_list[11].sv_id.constellation = 213; - test_msg->stec_sat_list[11].sv_id.satId = 119; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[12].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[12].stec_coeff[0])); - } - test_msg->stec_sat_list[12].stec_coeff[0] = 5944; - if (sizeof(test_msg->stec_sat_list[12].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[12].stec_coeff[0])); - } - test_msg->stec_sat_list[12].stec_coeff[1] = 32142; - if (sizeof(test_msg->stec_sat_list[12].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[12].stec_coeff[0])); - } - test_msg->stec_sat_list[12].stec_coeff[2] = 30760; - if (sizeof(test_msg->stec_sat_list[12].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[12].stec_coeff[0])); - } - test_msg->stec_sat_list[12].stec_coeff[3] = 11587; - test_msg->stec_sat_list[12].stec_quality_indicator = 26; - test_msg->stec_sat_list[12].sv_id.constellation = 158; - test_msg->stec_sat_list[12].sv_id.satId = 121; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[13].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[13].stec_coeff[0])); - } - test_msg->stec_sat_list[13].stec_coeff[0] = 3095; - if (sizeof(test_msg->stec_sat_list[13].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[13].stec_coeff[0])); - } - test_msg->stec_sat_list[13].stec_coeff[1] = 22769; - if (sizeof(test_msg->stec_sat_list[13].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[13].stec_coeff[0])); - } - test_msg->stec_sat_list[13].stec_coeff[2] = -4283; - if (sizeof(test_msg->stec_sat_list[13].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[13].stec_coeff[0])); - } - test_msg->stec_sat_list[13].stec_coeff[3] = 14844; - test_msg->stec_sat_list[13].stec_quality_indicator = 110; - test_msg->stec_sat_list[13].sv_id.constellation = 235; - test_msg->stec_sat_list[13].sv_id.satId = 126; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[14].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[14].stec_coeff[0])); - } - test_msg->stec_sat_list[14].stec_coeff[0] = -21032; - if (sizeof(test_msg->stec_sat_list[14].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[14].stec_coeff[0])); - } - test_msg->stec_sat_list[14].stec_coeff[1] = -19726; - if (sizeof(test_msg->stec_sat_list[14].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[14].stec_coeff[0])); - } - test_msg->stec_sat_list[14].stec_coeff[2] = 1297; - if (sizeof(test_msg->stec_sat_list[14].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[14].stec_coeff[0])); - } - test_msg->stec_sat_list[14].stec_coeff[3] = -22049; - test_msg->stec_sat_list[14].stec_quality_indicator = 201; - test_msg->stec_sat_list[14].sv_id.constellation = 44; - test_msg->stec_sat_list[14].sv_id.satId = 93; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[15].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[15].stec_coeff[0])); - } - test_msg->stec_sat_list[15].stec_coeff[0] = 619; - if (sizeof(test_msg->stec_sat_list[15].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[15].stec_coeff[0])); - } - test_msg->stec_sat_list[15].stec_coeff[1] = -5744; - if (sizeof(test_msg->stec_sat_list[15].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[15].stec_coeff[0])); - } - test_msg->stec_sat_list[15].stec_coeff[2] = 22542; - if (sizeof(test_msg->stec_sat_list[15].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[15].stec_coeff[0])); - } - test_msg->stec_sat_list[15].stec_coeff[3] = -12000; - test_msg->stec_sat_list[15].stec_quality_indicator = 77; - test_msg->stec_sat_list[15].sv_id.constellation = 3; - test_msg->stec_sat_list[15].sv_id.satId = 192; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[16].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[16].stec_coeff[0])); - } - test_msg->stec_sat_list[16].stec_coeff[0] = 10651; - if (sizeof(test_msg->stec_sat_list[16].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[16].stec_coeff[0])); - } - test_msg->stec_sat_list[16].stec_coeff[1] = -2889; - if (sizeof(test_msg->stec_sat_list[16].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[16].stec_coeff[0])); - } - test_msg->stec_sat_list[16].stec_coeff[2] = 21150; - if (sizeof(test_msg->stec_sat_list[16].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[16].stec_coeff[0])); - } - test_msg->stec_sat_list[16].stec_coeff[3] = 26421; - test_msg->stec_sat_list[16].stec_quality_indicator = 123; - test_msg->stec_sat_list[16].sv_id.constellation = 17; - test_msg->stec_sat_list[16].sv_id.satId = 1; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[17].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[17].stec_coeff[0])); - } - test_msg->stec_sat_list[17].stec_coeff[0] = -19165; - if (sizeof(test_msg->stec_sat_list[17].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[17].stec_coeff[0])); - } - test_msg->stec_sat_list[17].stec_coeff[1] = 30229; - if (sizeof(test_msg->stec_sat_list[17].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[17].stec_coeff[0])); - } - test_msg->stec_sat_list[17].stec_coeff[2] = -1282; - if (sizeof(test_msg->stec_sat_list[17].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[17].stec_coeff[0])); - } - test_msg->stec_sat_list[17].stec_coeff[3] = -18382; - test_msg->stec_sat_list[17].stec_quality_indicator = 185; - test_msg->stec_sat_list[17].sv_id.constellation = 202; - test_msg->stec_sat_list[17].sv_id.satId = 14; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[18].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[18].stec_coeff[0])); - } - test_msg->stec_sat_list[18].stec_coeff[0] = -23752; - if (sizeof(test_msg->stec_sat_list[18].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[18].stec_coeff[0])); - } - test_msg->stec_sat_list[18].stec_coeff[1] = 32433; - if (sizeof(test_msg->stec_sat_list[18].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[18].stec_coeff[0])); - } - test_msg->stec_sat_list[18].stec_coeff[2] = 20441; - if (sizeof(test_msg->stec_sat_list[18].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[18].stec_coeff[0])); - } - test_msg->stec_sat_list[18].stec_coeff[3] = -4181; - test_msg->stec_sat_list[18].stec_quality_indicator = 45; - test_msg->stec_sat_list[18].sv_id.constellation = 31; - test_msg->stec_sat_list[18].sv_id.satId = 50; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[19].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[19].stec_coeff[0])); - } - test_msg->stec_sat_list[19].stec_coeff[0] = -13968; - if (sizeof(test_msg->stec_sat_list[19].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[19].stec_coeff[0])); - } - test_msg->stec_sat_list[19].stec_coeff[1] = -29322; - if (sizeof(test_msg->stec_sat_list[19].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[19].stec_coeff[0])); - } - test_msg->stec_sat_list[19].stec_coeff[2] = -23790; - if (sizeof(test_msg->stec_sat_list[19].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[19].stec_coeff[0])); - } - test_msg->stec_sat_list[19].stec_coeff[3] = 9063; - test_msg->stec_sat_list[19].stec_quality_indicator = 238; - test_msg->stec_sat_list[19].sv_id.constellation = 188; - test_msg->stec_sat_list[19].sv_id.satId = 237; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[20].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[20].stec_coeff[0])); - } - test_msg->stec_sat_list[20].stec_coeff[0] = 4737; - if (sizeof(test_msg->stec_sat_list[20].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[20].stec_coeff[0])); - } - test_msg->stec_sat_list[20].stec_coeff[1] = 21877; - if (sizeof(test_msg->stec_sat_list[20].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[20].stec_coeff[0])); - } - test_msg->stec_sat_list[20].stec_coeff[2] = 20414; - if (sizeof(test_msg->stec_sat_list[20].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[20].stec_coeff[0])); - } - test_msg->stec_sat_list[20].stec_coeff[3] = -10286; - test_msg->stec_sat_list[20].stec_quality_indicator = 82; - test_msg->stec_sat_list[20].sv_id.constellation = 21; - test_msg->stec_sat_list[20].sv_id.satId = 63; - - EXPECT_EQ(send_message(0x5fb, 38860, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 38860); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.iod_atmo)>( - reinterpret_cast(&last_msg_->header.iod_atmo)), - 60) - << "incorrect value for header.iod_atmo, expected 60, is " - << last_msg_->header.iod_atmo; - EXPECT_EQ(get_asheader.num_msgs)>( - reinterpret_cast(&last_msg_->header.num_msgs)), - 157) - << "incorrect value for header.num_msgs, expected 157, is " - << last_msg_->header.num_msgs; - EXPECT_EQ(get_asheader.seq_num)>( - reinterpret_cast(&last_msg_->header.seq_num)), - 112) - << "incorrect value for header.seq_num, expected 112, is " - << last_msg_->header.seq_num; - EXPECT_EQ(get_asheader.tile_id)>( - reinterpret_cast(&last_msg_->header.tile_id)), - 30066) - << "incorrect value for header.tile_id, expected 30066, is " - << last_msg_->header.tile_id; - EXPECT_EQ( - get_asheader.tile_set_id)>( - reinterpret_cast(&last_msg_->header.tile_set_id)), - 58526) - << "incorrect value for header.tile_set_id, expected 58526, is " - << last_msg_->header.tile_set_id; - EXPECT_EQ(get_asheader.time.tow)>( - reinterpret_cast(&last_msg_->header.time.tow)), - 714907186) - << "incorrect value for header.time.tow, expected 714907186, is " - << last_msg_->header.time.tow; - EXPECT_EQ(get_asheader.time.wn)>( - reinterpret_cast(&last_msg_->header.time.wn)), - 40055) - << "incorrect value for header.time.wn, expected 40055, is " - << last_msg_->header.time.wn; - EXPECT_EQ(get_asheader.update_interval)>( - reinterpret_cast( - &last_msg_->header.update_interval)), - 47) - << "incorrect value for header.update_interval, expected 47, is " - << last_msg_->header.update_interval; - EXPECT_EQ(get_asstec_sat_list[0].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_coeff[0])), - -5289) - << "incorrect value for stec_sat_list[0].stec_coeff[0], expected -5289, " - "is " - << last_msg_->stec_sat_list[0].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[0].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_coeff[1])), - -20141) - << "incorrect value for stec_sat_list[0].stec_coeff[1], expected -20141, " - "is " - << last_msg_->stec_sat_list[0].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[0].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_coeff[2])), - 966) - << "incorrect value for stec_sat_list[0].stec_coeff[2], expected 966, is " - << last_msg_->stec_sat_list[0].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[0].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_coeff[3])), - 2062) - << "incorrect value for stec_sat_list[0].stec_coeff[3], expected 2062, " - "is " - << last_msg_->stec_sat_list[0].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[0].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_quality_indicator)), - 70) - << "incorrect value for stec_sat_list[0].stec_quality_indicator, " - "expected 70, is " - << last_msg_->stec_sat_list[0].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[0].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].sv_id.constellation)), - 40) - << "incorrect value for stec_sat_list[0].sv_id.constellation, expected " - "40, is " - << last_msg_->stec_sat_list[0].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[0].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].sv_id.satId)), - 132) - << "incorrect value for stec_sat_list[0].sv_id.satId, expected 132, is " - << last_msg_->stec_sat_list[0].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[1].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_coeff[0])), - -19147) - << "incorrect value for stec_sat_list[1].stec_coeff[0], expected -19147, " - "is " - << last_msg_->stec_sat_list[1].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[1].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_coeff[1])), - -20902) - << "incorrect value for stec_sat_list[1].stec_coeff[1], expected -20902, " - "is " - << last_msg_->stec_sat_list[1].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[1].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_coeff[2])), - -26889) - << "incorrect value for stec_sat_list[1].stec_coeff[2], expected -26889, " - "is " - << last_msg_->stec_sat_list[1].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[1].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_coeff[3])), - -21446) - << "incorrect value for stec_sat_list[1].stec_coeff[3], expected -21446, " - "is " - << last_msg_->stec_sat_list[1].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[1].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_quality_indicator)), - 44) - << "incorrect value for stec_sat_list[1].stec_quality_indicator, " - "expected 44, is " - << last_msg_->stec_sat_list[1].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[1].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].sv_id.constellation)), - 12) - << "incorrect value for stec_sat_list[1].sv_id.constellation, expected " - "12, is " - << last_msg_->stec_sat_list[1].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[1].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].sv_id.satId)), - 70) - << "incorrect value for stec_sat_list[1].sv_id.satId, expected 70, is " - << last_msg_->stec_sat_list[1].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[2].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[2].stec_coeff[0])), - 32176) - << "incorrect value for stec_sat_list[2].stec_coeff[0], expected 32176, " - "is " - << last_msg_->stec_sat_list[2].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[2].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[2].stec_coeff[1])), - -20220) - << "incorrect value for stec_sat_list[2].stec_coeff[1], expected -20220, " - "is " - << last_msg_->stec_sat_list[2].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[2].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[2].stec_coeff[2])), - 29157) - << "incorrect value for stec_sat_list[2].stec_coeff[2], expected 29157, " - "is " - << last_msg_->stec_sat_list[2].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[2].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[2].stec_coeff[3])), - 19726) - << "incorrect value for stec_sat_list[2].stec_coeff[3], expected 19726, " - "is " - << last_msg_->stec_sat_list[2].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[2].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[2].stec_quality_indicator)), - 119) - << "incorrect value for stec_sat_list[2].stec_quality_indicator, " - "expected 119, is " - << last_msg_->stec_sat_list[2].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[2].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[2].sv_id.constellation)), - 179) - << "incorrect value for stec_sat_list[2].sv_id.constellation, expected " - "179, is " - << last_msg_->stec_sat_list[2].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[2].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[2].sv_id.satId)), - 247) - << "incorrect value for stec_sat_list[2].sv_id.satId, expected 247, is " - << last_msg_->stec_sat_list[2].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[3].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[3].stec_coeff[0])), - -8651) - << "incorrect value for stec_sat_list[3].stec_coeff[0], expected -8651, " - "is " - << last_msg_->stec_sat_list[3].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[3].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[3].stec_coeff[1])), - -27973) - << "incorrect value for stec_sat_list[3].stec_coeff[1], expected -27973, " - "is " - << last_msg_->stec_sat_list[3].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[3].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[3].stec_coeff[2])), - 23546) - << "incorrect value for stec_sat_list[3].stec_coeff[2], expected 23546, " - "is " - << last_msg_->stec_sat_list[3].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[3].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[3].stec_coeff[3])), - -10284) - << "incorrect value for stec_sat_list[3].stec_coeff[3], expected -10284, " - "is " - << last_msg_->stec_sat_list[3].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[3].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[3].stec_quality_indicator)), - 23) - << "incorrect value for stec_sat_list[3].stec_quality_indicator, " - "expected 23, is " - << last_msg_->stec_sat_list[3].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[3].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[3].sv_id.constellation)), - 185) - << "incorrect value for stec_sat_list[3].sv_id.constellation, expected " - "185, is " - << last_msg_->stec_sat_list[3].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[3].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[3].sv_id.satId)), - 153) - << "incorrect value for stec_sat_list[3].sv_id.satId, expected 153, is " - << last_msg_->stec_sat_list[3].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[4].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[4].stec_coeff[0])), - 27486) - << "incorrect value for stec_sat_list[4].stec_coeff[0], expected 27486, " - "is " - << last_msg_->stec_sat_list[4].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[4].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[4].stec_coeff[1])), - 23329) - << "incorrect value for stec_sat_list[4].stec_coeff[1], expected 23329, " - "is " - << last_msg_->stec_sat_list[4].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[4].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[4].stec_coeff[2])), - 234) - << "incorrect value for stec_sat_list[4].stec_coeff[2], expected 234, is " - << last_msg_->stec_sat_list[4].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[4].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[4].stec_coeff[3])), - -29739) - << "incorrect value for stec_sat_list[4].stec_coeff[3], expected -29739, " - "is " - << last_msg_->stec_sat_list[4].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[4].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[4].stec_quality_indicator)), - 250) - << "incorrect value for stec_sat_list[4].stec_quality_indicator, " - "expected 250, is " - << last_msg_->stec_sat_list[4].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[4].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[4].sv_id.constellation)), - 107) - << "incorrect value for stec_sat_list[4].sv_id.constellation, expected " - "107, is " - << last_msg_->stec_sat_list[4].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[4].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[4].sv_id.satId)), - 14) - << "incorrect value for stec_sat_list[4].sv_id.satId, expected 14, is " - << last_msg_->stec_sat_list[4].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[5].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[5].stec_coeff[0])), - 18965) - << "incorrect value for stec_sat_list[5].stec_coeff[0], expected 18965, " - "is " - << last_msg_->stec_sat_list[5].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[5].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[5].stec_coeff[1])), - -22098) - << "incorrect value for stec_sat_list[5].stec_coeff[1], expected -22098, " - "is " - << last_msg_->stec_sat_list[5].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[5].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[5].stec_coeff[2])), - 22077) - << "incorrect value for stec_sat_list[5].stec_coeff[2], expected 22077, " - "is " - << last_msg_->stec_sat_list[5].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[5].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[5].stec_coeff[3])), - -29093) - << "incorrect value for stec_sat_list[5].stec_coeff[3], expected -29093, " - "is " - << last_msg_->stec_sat_list[5].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[5].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[5].stec_quality_indicator)), - 50) - << "incorrect value for stec_sat_list[5].stec_quality_indicator, " - "expected 50, is " - << last_msg_->stec_sat_list[5].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[5].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[5].sv_id.constellation)), - 179) - << "incorrect value for stec_sat_list[5].sv_id.constellation, expected " - "179, is " - << last_msg_->stec_sat_list[5].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[5].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[5].sv_id.satId)), - 95) - << "incorrect value for stec_sat_list[5].sv_id.satId, expected 95, is " - << last_msg_->stec_sat_list[5].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[6].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[6].stec_coeff[0])), - -7898) - << "incorrect value for stec_sat_list[6].stec_coeff[0], expected -7898, " - "is " - << last_msg_->stec_sat_list[6].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[6].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[6].stec_coeff[1])), - 26002) - << "incorrect value for stec_sat_list[6].stec_coeff[1], expected 26002, " - "is " - << last_msg_->stec_sat_list[6].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[6].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[6].stec_coeff[2])), - -29879) - << "incorrect value for stec_sat_list[6].stec_coeff[2], expected -29879, " - "is " - << last_msg_->stec_sat_list[6].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[6].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[6].stec_coeff[3])), - 30008) - << "incorrect value for stec_sat_list[6].stec_coeff[3], expected 30008, " - "is " - << last_msg_->stec_sat_list[6].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[6].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[6].stec_quality_indicator)), - 9) - << "incorrect value for stec_sat_list[6].stec_quality_indicator, " - "expected 9, is " - << last_msg_->stec_sat_list[6].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[6].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[6].sv_id.constellation)), - 108) - << "incorrect value for stec_sat_list[6].sv_id.constellation, expected " - "108, is " - << last_msg_->stec_sat_list[6].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[6].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[6].sv_id.satId)), - 51) - << "incorrect value for stec_sat_list[6].sv_id.satId, expected 51, is " - << last_msg_->stec_sat_list[6].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[7].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[7].stec_coeff[0])), - -12948) - << "incorrect value for stec_sat_list[7].stec_coeff[0], expected -12948, " - "is " - << last_msg_->stec_sat_list[7].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[7].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[7].stec_coeff[1])), - 4701) - << "incorrect value for stec_sat_list[7].stec_coeff[1], expected 4701, " - "is " - << last_msg_->stec_sat_list[7].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[7].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[7].stec_coeff[2])), - -15597) - << "incorrect value for stec_sat_list[7].stec_coeff[2], expected -15597, " - "is " - << last_msg_->stec_sat_list[7].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[7].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[7].stec_coeff[3])), - -13791) - << "incorrect value for stec_sat_list[7].stec_coeff[3], expected -13791, " - "is " - << last_msg_->stec_sat_list[7].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[7].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[7].stec_quality_indicator)), - 213) - << "incorrect value for stec_sat_list[7].stec_quality_indicator, " - "expected 213, is " - << last_msg_->stec_sat_list[7].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[7].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[7].sv_id.constellation)), - 37) - << "incorrect value for stec_sat_list[7].sv_id.constellation, expected " - "37, is " - << last_msg_->stec_sat_list[7].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[7].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[7].sv_id.satId)), - 82) - << "incorrect value for stec_sat_list[7].sv_id.satId, expected 82, is " - << last_msg_->stec_sat_list[7].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[8].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[8].stec_coeff[0])), - -17283) - << "incorrect value for stec_sat_list[8].stec_coeff[0], expected -17283, " - "is " - << last_msg_->stec_sat_list[8].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[8].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[8].stec_coeff[1])), - 14455) - << "incorrect value for stec_sat_list[8].stec_coeff[1], expected 14455, " - "is " - << last_msg_->stec_sat_list[8].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[8].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[8].stec_coeff[2])), - -27067) - << "incorrect value for stec_sat_list[8].stec_coeff[2], expected -27067, " - "is " - << last_msg_->stec_sat_list[8].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[8].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[8].stec_coeff[3])), - 19606) - << "incorrect value for stec_sat_list[8].stec_coeff[3], expected 19606, " - "is " - << last_msg_->stec_sat_list[8].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[8].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[8].stec_quality_indicator)), - 178) - << "incorrect value for stec_sat_list[8].stec_quality_indicator, " - "expected 178, is " - << last_msg_->stec_sat_list[8].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[8].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[8].sv_id.constellation)), - 206) - << "incorrect value for stec_sat_list[8].sv_id.constellation, expected " - "206, is " - << last_msg_->stec_sat_list[8].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[8].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[8].sv_id.satId)), - 87) - << "incorrect value for stec_sat_list[8].sv_id.satId, expected 87, is " - << last_msg_->stec_sat_list[8].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[9].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[9].stec_coeff[0])), - -12215) - << "incorrect value for stec_sat_list[9].stec_coeff[0], expected -12215, " - "is " - << last_msg_->stec_sat_list[9].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[9].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[9].stec_coeff[1])), - -6072) - << "incorrect value for stec_sat_list[9].stec_coeff[1], expected -6072, " - "is " - << last_msg_->stec_sat_list[9].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[9].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[9].stec_coeff[2])), - -1528) - << "incorrect value for stec_sat_list[9].stec_coeff[2], expected -1528, " - "is " - << last_msg_->stec_sat_list[9].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[9].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[9].stec_coeff[3])), - -19765) - << "incorrect value for stec_sat_list[9].stec_coeff[3], expected -19765, " - "is " - << last_msg_->stec_sat_list[9].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[9].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[9].stec_quality_indicator)), - 18) - << "incorrect value for stec_sat_list[9].stec_quality_indicator, " - "expected 18, is " - << last_msg_->stec_sat_list[9].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[9].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[9].sv_id.constellation)), - 131) - << "incorrect value for stec_sat_list[9].sv_id.constellation, expected " - "131, is " - << last_msg_->stec_sat_list[9].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[9].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[9].sv_id.satId)), - 3) - << "incorrect value for stec_sat_list[9].sv_id.satId, expected 3, is " - << last_msg_->stec_sat_list[9].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[10].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[10].stec_coeff[0])), - 12630) - << "incorrect value for stec_sat_list[10].stec_coeff[0], expected 12630, " - "is " - << last_msg_->stec_sat_list[10].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[10].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[10].stec_coeff[1])), - -19721) - << "incorrect value for stec_sat_list[10].stec_coeff[1], expected " - "-19721, is " - << last_msg_->stec_sat_list[10].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[10].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[10].stec_coeff[2])), - 14502) - << "incorrect value for stec_sat_list[10].stec_coeff[2], expected 14502, " - "is " - << last_msg_->stec_sat_list[10].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[10].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[10].stec_coeff[3])), - 2591) - << "incorrect value for stec_sat_list[10].stec_coeff[3], expected 2591, " - "is " - << last_msg_->stec_sat_list[10].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[10].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[10].stec_quality_indicator)), - 252) - << "incorrect value for stec_sat_list[10].stec_quality_indicator, " - "expected 252, is " - << last_msg_->stec_sat_list[10].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[10].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[10].sv_id.constellation)), - 163) - << "incorrect value for stec_sat_list[10].sv_id.constellation, expected " - "163, is " - << last_msg_->stec_sat_list[10].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[10].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[10].sv_id.satId)), - 170) - << "incorrect value for stec_sat_list[10].sv_id.satId, expected 170, is " - << last_msg_->stec_sat_list[10].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[11].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[11].stec_coeff[0])), - -23340) - << "incorrect value for stec_sat_list[11].stec_coeff[0], expected " - "-23340, is " - << last_msg_->stec_sat_list[11].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[11].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[11].stec_coeff[1])), - -24063) - << "incorrect value for stec_sat_list[11].stec_coeff[1], expected " - "-24063, is " - << last_msg_->stec_sat_list[11].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[11].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[11].stec_coeff[2])), - 4650) - << "incorrect value for stec_sat_list[11].stec_coeff[2], expected 4650, " - "is " - << last_msg_->stec_sat_list[11].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[11].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[11].stec_coeff[3])), - -22148) - << "incorrect value for stec_sat_list[11].stec_coeff[3], expected " - "-22148, is " - << last_msg_->stec_sat_list[11].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[11].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[11].stec_quality_indicator)), - 241) - << "incorrect value for stec_sat_list[11].stec_quality_indicator, " - "expected 241, is " - << last_msg_->stec_sat_list[11].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[11].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[11].sv_id.constellation)), - 213) - << "incorrect value for stec_sat_list[11].sv_id.constellation, expected " - "213, is " - << last_msg_->stec_sat_list[11].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[11].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[11].sv_id.satId)), - 119) - << "incorrect value for stec_sat_list[11].sv_id.satId, expected 119, is " - << last_msg_->stec_sat_list[11].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[12].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[12].stec_coeff[0])), - 5944) - << "incorrect value for stec_sat_list[12].stec_coeff[0], expected 5944, " - "is " - << last_msg_->stec_sat_list[12].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[12].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[12].stec_coeff[1])), - 32142) - << "incorrect value for stec_sat_list[12].stec_coeff[1], expected 32142, " - "is " - << last_msg_->stec_sat_list[12].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[12].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[12].stec_coeff[2])), - 30760) - << "incorrect value for stec_sat_list[12].stec_coeff[2], expected 30760, " - "is " - << last_msg_->stec_sat_list[12].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[12].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[12].stec_coeff[3])), - 11587) - << "incorrect value for stec_sat_list[12].stec_coeff[3], expected 11587, " - "is " - << last_msg_->stec_sat_list[12].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[12].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[12].stec_quality_indicator)), - 26) - << "incorrect value for stec_sat_list[12].stec_quality_indicator, " - "expected 26, is " - << last_msg_->stec_sat_list[12].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[12].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[12].sv_id.constellation)), - 158) - << "incorrect value for stec_sat_list[12].sv_id.constellation, expected " - "158, is " - << last_msg_->stec_sat_list[12].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[12].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[12].sv_id.satId)), - 121) - << "incorrect value for stec_sat_list[12].sv_id.satId, expected 121, is " - << last_msg_->stec_sat_list[12].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[13].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[13].stec_coeff[0])), - 3095) - << "incorrect value for stec_sat_list[13].stec_coeff[0], expected 3095, " - "is " - << last_msg_->stec_sat_list[13].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[13].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[13].stec_coeff[1])), - 22769) - << "incorrect value for stec_sat_list[13].stec_coeff[1], expected 22769, " - "is " - << last_msg_->stec_sat_list[13].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[13].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[13].stec_coeff[2])), - -4283) - << "incorrect value for stec_sat_list[13].stec_coeff[2], expected -4283, " - "is " - << last_msg_->stec_sat_list[13].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[13].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[13].stec_coeff[3])), - 14844) - << "incorrect value for stec_sat_list[13].stec_coeff[3], expected 14844, " - "is " - << last_msg_->stec_sat_list[13].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[13].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[13].stec_quality_indicator)), - 110) - << "incorrect value for stec_sat_list[13].stec_quality_indicator, " - "expected 110, is " - << last_msg_->stec_sat_list[13].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[13].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[13].sv_id.constellation)), - 235) - << "incorrect value for stec_sat_list[13].sv_id.constellation, expected " - "235, is " - << last_msg_->stec_sat_list[13].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[13].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[13].sv_id.satId)), - 126) - << "incorrect value for stec_sat_list[13].sv_id.satId, expected 126, is " - << last_msg_->stec_sat_list[13].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[14].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[14].stec_coeff[0])), - -21032) - << "incorrect value for stec_sat_list[14].stec_coeff[0], expected " - "-21032, is " - << last_msg_->stec_sat_list[14].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[14].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[14].stec_coeff[1])), - -19726) - << "incorrect value for stec_sat_list[14].stec_coeff[1], expected " - "-19726, is " - << last_msg_->stec_sat_list[14].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[14].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[14].stec_coeff[2])), - 1297) - << "incorrect value for stec_sat_list[14].stec_coeff[2], expected 1297, " - "is " - << last_msg_->stec_sat_list[14].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[14].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[14].stec_coeff[3])), - -22049) - << "incorrect value for stec_sat_list[14].stec_coeff[3], expected " - "-22049, is " - << last_msg_->stec_sat_list[14].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[14].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[14].stec_quality_indicator)), - 201) - << "incorrect value for stec_sat_list[14].stec_quality_indicator, " - "expected 201, is " - << last_msg_->stec_sat_list[14].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[14].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[14].sv_id.constellation)), - 44) - << "incorrect value for stec_sat_list[14].sv_id.constellation, expected " - "44, is " - << last_msg_->stec_sat_list[14].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[14].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[14].sv_id.satId)), - 93) - << "incorrect value for stec_sat_list[14].sv_id.satId, expected 93, is " - << last_msg_->stec_sat_list[14].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[15].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[15].stec_coeff[0])), - 619) - << "incorrect value for stec_sat_list[15].stec_coeff[0], expected 619, " - "is " - << last_msg_->stec_sat_list[15].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[15].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[15].stec_coeff[1])), - -5744) - << "incorrect value for stec_sat_list[15].stec_coeff[1], expected -5744, " - "is " - << last_msg_->stec_sat_list[15].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[15].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[15].stec_coeff[2])), - 22542) - << "incorrect value for stec_sat_list[15].stec_coeff[2], expected 22542, " - "is " - << last_msg_->stec_sat_list[15].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[15].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[15].stec_coeff[3])), - -12000) - << "incorrect value for stec_sat_list[15].stec_coeff[3], expected " - "-12000, is " - << last_msg_->stec_sat_list[15].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[15].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[15].stec_quality_indicator)), - 77) - << "incorrect value for stec_sat_list[15].stec_quality_indicator, " - "expected 77, is " - << last_msg_->stec_sat_list[15].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[15].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[15].sv_id.constellation)), - 3) - << "incorrect value for stec_sat_list[15].sv_id.constellation, expected " - "3, is " - << last_msg_->stec_sat_list[15].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[15].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[15].sv_id.satId)), - 192) - << "incorrect value for stec_sat_list[15].sv_id.satId, expected 192, is " - << last_msg_->stec_sat_list[15].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[16].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[16].stec_coeff[0])), - 10651) - << "incorrect value for stec_sat_list[16].stec_coeff[0], expected 10651, " - "is " - << last_msg_->stec_sat_list[16].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[16].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[16].stec_coeff[1])), - -2889) - << "incorrect value for stec_sat_list[16].stec_coeff[1], expected -2889, " - "is " - << last_msg_->stec_sat_list[16].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[16].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[16].stec_coeff[2])), - 21150) - << "incorrect value for stec_sat_list[16].stec_coeff[2], expected 21150, " - "is " - << last_msg_->stec_sat_list[16].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[16].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[16].stec_coeff[3])), - 26421) - << "incorrect value for stec_sat_list[16].stec_coeff[3], expected 26421, " - "is " - << last_msg_->stec_sat_list[16].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[16].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[16].stec_quality_indicator)), - 123) - << "incorrect value for stec_sat_list[16].stec_quality_indicator, " - "expected 123, is " - << last_msg_->stec_sat_list[16].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[16].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[16].sv_id.constellation)), - 17) - << "incorrect value for stec_sat_list[16].sv_id.constellation, expected " - "17, is " - << last_msg_->stec_sat_list[16].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[16].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[16].sv_id.satId)), - 1) - << "incorrect value for stec_sat_list[16].sv_id.satId, expected 1, is " - << last_msg_->stec_sat_list[16].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[17].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[17].stec_coeff[0])), - -19165) - << "incorrect value for stec_sat_list[17].stec_coeff[0], expected " - "-19165, is " - << last_msg_->stec_sat_list[17].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[17].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[17].stec_coeff[1])), - 30229) - << "incorrect value for stec_sat_list[17].stec_coeff[1], expected 30229, " - "is " - << last_msg_->stec_sat_list[17].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[17].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[17].stec_coeff[2])), - -1282) - << "incorrect value for stec_sat_list[17].stec_coeff[2], expected -1282, " - "is " - << last_msg_->stec_sat_list[17].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[17].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[17].stec_coeff[3])), - -18382) - << "incorrect value for stec_sat_list[17].stec_coeff[3], expected " - "-18382, is " - << last_msg_->stec_sat_list[17].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[17].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[17].stec_quality_indicator)), - 185) - << "incorrect value for stec_sat_list[17].stec_quality_indicator, " - "expected 185, is " - << last_msg_->stec_sat_list[17].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[17].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[17].sv_id.constellation)), - 202) - << "incorrect value for stec_sat_list[17].sv_id.constellation, expected " - "202, is " - << last_msg_->stec_sat_list[17].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[17].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[17].sv_id.satId)), - 14) - << "incorrect value for stec_sat_list[17].sv_id.satId, expected 14, is " - << last_msg_->stec_sat_list[17].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[18].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[18].stec_coeff[0])), - -23752) - << "incorrect value for stec_sat_list[18].stec_coeff[0], expected " - "-23752, is " - << last_msg_->stec_sat_list[18].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[18].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[18].stec_coeff[1])), - 32433) - << "incorrect value for stec_sat_list[18].stec_coeff[1], expected 32433, " - "is " - << last_msg_->stec_sat_list[18].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[18].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[18].stec_coeff[2])), - 20441) - << "incorrect value for stec_sat_list[18].stec_coeff[2], expected 20441, " - "is " - << last_msg_->stec_sat_list[18].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[18].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[18].stec_coeff[3])), - -4181) - << "incorrect value for stec_sat_list[18].stec_coeff[3], expected -4181, " - "is " - << last_msg_->stec_sat_list[18].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[18].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[18].stec_quality_indicator)), - 45) - << "incorrect value for stec_sat_list[18].stec_quality_indicator, " - "expected 45, is " - << last_msg_->stec_sat_list[18].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[18].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[18].sv_id.constellation)), - 31) - << "incorrect value for stec_sat_list[18].sv_id.constellation, expected " - "31, is " - << last_msg_->stec_sat_list[18].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[18].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[18].sv_id.satId)), - 50) - << "incorrect value for stec_sat_list[18].sv_id.satId, expected 50, is " - << last_msg_->stec_sat_list[18].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[19].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[19].stec_coeff[0])), - -13968) - << "incorrect value for stec_sat_list[19].stec_coeff[0], expected " - "-13968, is " - << last_msg_->stec_sat_list[19].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[19].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[19].stec_coeff[1])), - -29322) - << "incorrect value for stec_sat_list[19].stec_coeff[1], expected " - "-29322, is " - << last_msg_->stec_sat_list[19].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[19].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[19].stec_coeff[2])), - -23790) - << "incorrect value for stec_sat_list[19].stec_coeff[2], expected " - "-23790, is " - << last_msg_->stec_sat_list[19].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[19].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[19].stec_coeff[3])), - 9063) - << "incorrect value for stec_sat_list[19].stec_coeff[3], expected 9063, " - "is " - << last_msg_->stec_sat_list[19].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[19].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[19].stec_quality_indicator)), - 238) - << "incorrect value for stec_sat_list[19].stec_quality_indicator, " - "expected 238, is " - << last_msg_->stec_sat_list[19].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[19].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[19].sv_id.constellation)), - 188) - << "incorrect value for stec_sat_list[19].sv_id.constellation, expected " - "188, is " - << last_msg_->stec_sat_list[19].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[19].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[19].sv_id.satId)), - 237) - << "incorrect value for stec_sat_list[19].sv_id.satId, expected 237, is " - << last_msg_->stec_sat_list[19].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[20].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[20].stec_coeff[0])), - 4737) - << "incorrect value for stec_sat_list[20].stec_coeff[0], expected 4737, " - "is " - << last_msg_->stec_sat_list[20].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[20].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[20].stec_coeff[1])), - 21877) - << "incorrect value for stec_sat_list[20].stec_coeff[1], expected 21877, " - "is " - << last_msg_->stec_sat_list[20].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[20].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[20].stec_coeff[2])), - 20414) - << "incorrect value for stec_sat_list[20].stec_coeff[2], expected 20414, " - "is " - << last_msg_->stec_sat_list[20].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[20].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[20].stec_coeff[3])), - -10286) - << "incorrect value for stec_sat_list[20].stec_coeff[3], expected " - "-10286, is " - << last_msg_->stec_sat_list[20].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[20].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[20].stec_quality_indicator)), - 82) - << "incorrect value for stec_sat_list[20].stec_quality_indicator, " - "expected 82, is " - << last_msg_->stec_sat_list[20].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[20].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[20].sv_id.constellation)), - 21) - << "incorrect value for stec_sat_list[20].sv_id.constellation, expected " - "21, is " - << last_msg_->stec_sat_list[20].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[20].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[20].sv_id.satId)), - 63) - << "incorrect value for stec_sat_list[20].sv_id.satId, expected 63, is " - << last_msg_->stec_sat_list[20].sv_id.satId; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrStecCorrectionDepA.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrStecCorrectionDepA.cc deleted file mode 100644 index 6982ca5280..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrStecCorrectionDepA.cc +++ /dev/null @@ -1,1933 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrStecCorrectionDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_stec_correction_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_stec_correction_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrStecCorrectionDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 235, 5, 39, 7, 252, 70, 81, 196, 232, 185, 43, 147, 123, 39, - 4, 126, 19, 111, 97, 248, 130, 217, 217, 106, 58, 12, 65, 230, 171, - 81, 95, 86, 16, 39, 84, 228, 208, 201, 81, 219, 99, 203, 61, 182, - 66, 125, 203, 3, 193, 44, 100, 220, 125, 60, 21, 93, 218, 247, 158, - 207, 93, 129, 134, 14, 209, 48, 14, 215, 153, 148, 147, 72, 225, 180, - 236, 205, 201, 33, 3, 246, 204, 19, 3, 98, 4, 194, 191, 246, 76, - 219, 31, 191, 113, 79, 177, 15, 251, 33, 19, 96, 54, 58, 146, 210, - 100, 249, 72, 21, 161, 211, 198, 21, 238, 111, 107, 36, 227, 225, 213, - 3, 71, 243, 63, 65, 236, 92, 77, 0, 169, 15, 182, 5, 240, 180, - 9, 122, 86, 232, 6, 103, 104, 254, 189, 81, 110, 2, 49, 202, 84, - 216, 55, 50, 181, 5, 123, 80, 49, 244, 224, 188, 125, 164, 230, 56, - 66, 124, 168, 59, 139, 106, 118, 51, 187, 216, 191, 158, 77, 92, 58, - 253, 132, 150, 165, 9, 154, 189, 218, 61, 209, 1, 82, 181, 196, 23, - 53, 182, 112, 192, 206, 167, 157, 244, 35, 1, 189, 217, 61, 88, 97, - 201, 201, 74, 251, 217, 14, 104, 184, 54, 52, 74, 238, 10, 129, 22, - 178, 226, 109, 88, 157, 30, 196, 175, 26, 76, 34, 116, 220, 154, 232, - 12, 179, 244, 15, 155, 196, 202, 72, 70, 115, 10, 214, 114, 39, 245, - 28, 237, 68, 136, 155, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_stec_correction_dep_a_t *test_msg = - (msg_ssr_stec_correction_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->header.iod_atmo = 4; - test_msg->header.num_msgs = 147; - test_msg->header.seq_num = 123; - test_msg->header.time.tow = 3905179974; - test_msg->header.time.wn = 11193; - test_msg->header.update_interval = 39; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[0].stec_coeff[0])); - } - test_msg->stec_sat_list[0].stec_coeff[0] = -1951; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[0].stec_coeff[0])); - } - test_msg->stec_sat_list[0].stec_coeff[1] = -9854; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[0].stec_coeff[0])); - } - test_msg->stec_sat_list[0].stec_coeff[2] = 27353; - if (sizeof(test_msg->stec_sat_list[0].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[0].stec_coeff[0])); - } - test_msg->stec_sat_list[0].stec_coeff[3] = 3130; - test_msg->stec_sat_list[0].stec_quality_indicator = 111; - test_msg->stec_sat_list[0].sv_id.constellation = 19; - test_msg->stec_sat_list[0].sv_id.satId = 126; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[1].stec_coeff[0])); - } - test_msg->stec_sat_list[1].stec_coeff[0] = 24401; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[1].stec_coeff[0])); - } - test_msg->stec_sat_list[1].stec_coeff[1] = 4182; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[1].stec_coeff[0])); - } - test_msg->stec_sat_list[1].stec_coeff[2] = 21543; - if (sizeof(test_msg->stec_sat_list[1].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[1].stec_coeff[0])); - } - test_msg->stec_sat_list[1].stec_coeff[3] = -12060; - test_msg->stec_sat_list[1].stec_quality_indicator = 171; - test_msg->stec_sat_list[1].sv_id.constellation = 230; - test_msg->stec_sat_list[1].sv_id.satId = 65; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[2].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[2].stec_coeff[0])); - } - test_msg->stec_sat_list[2].stec_coeff[0] = -13469; - if (sizeof(test_msg->stec_sat_list[2].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[2].stec_coeff[0])); - } - test_msg->stec_sat_list[2].stec_coeff[1] = -18883; - if (sizeof(test_msg->stec_sat_list[2].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[2].stec_coeff[0])); - } - test_msg->stec_sat_list[2].stec_coeff[2] = 32066; - if (sizeof(test_msg->stec_sat_list[2].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[2].stec_coeff[0])); - } - test_msg->stec_sat_list[2].stec_coeff[3] = 971; - test_msg->stec_sat_list[2].stec_quality_indicator = 219; - test_msg->stec_sat_list[2].sv_id.constellation = 81; - test_msg->stec_sat_list[2].sv_id.satId = 201; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[3].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[3].stec_coeff[0])); - } - test_msg->stec_sat_list[3].stec_coeff[0] = 32220; - if (sizeof(test_msg->stec_sat_list[3].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[3].stec_coeff[0])); - } - test_msg->stec_sat_list[3].stec_coeff[1] = 5436; - if (sizeof(test_msg->stec_sat_list[3].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[3].stec_coeff[0])); - } - test_msg->stec_sat_list[3].stec_coeff[2] = -9635; - if (sizeof(test_msg->stec_sat_list[3].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[3].stec_coeff[0])); - } - test_msg->stec_sat_list[3].stec_coeff[3] = -24841; - test_msg->stec_sat_list[3].stec_quality_indicator = 100; - test_msg->stec_sat_list[3].sv_id.constellation = 44; - test_msg->stec_sat_list[3].sv_id.satId = 193; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[4].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[4].stec_coeff[0])); - } - test_msg->stec_sat_list[4].stec_coeff[0] = 3718; - if (sizeof(test_msg->stec_sat_list[4].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[4].stec_coeff[0])); - } - test_msg->stec_sat_list[4].stec_coeff[1] = 12497; - if (sizeof(test_msg->stec_sat_list[4].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[4].stec_coeff[0])); - } - test_msg->stec_sat_list[4].stec_coeff[2] = -10482; - if (sizeof(test_msg->stec_sat_list[4].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[4].stec_coeff[0])); - } - test_msg->stec_sat_list[4].stec_coeff[3] = -27495; - test_msg->stec_sat_list[4].stec_quality_indicator = 129; - test_msg->stec_sat_list[4].sv_id.constellation = 93; - test_msg->stec_sat_list[4].sv_id.satId = 207; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[5].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[5].stec_coeff[0])); - } - test_msg->stec_sat_list[5].stec_coeff[0] = -4940; - if (sizeof(test_msg->stec_sat_list[5].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[5].stec_coeff[0])); - } - test_msg->stec_sat_list[5].stec_coeff[1] = -13875; - if (sizeof(test_msg->stec_sat_list[5].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[5].stec_coeff[0])); - } - test_msg->stec_sat_list[5].stec_coeff[2] = 801; - if (sizeof(test_msg->stec_sat_list[5].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[5].stec_coeff[0])); - } - test_msg->stec_sat_list[5].stec_coeff[3] = -13066; - test_msg->stec_sat_list[5].stec_quality_indicator = 225; - test_msg->stec_sat_list[5].sv_id.constellation = 72; - test_msg->stec_sat_list[5].sv_id.satId = 147; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[6].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[6].stec_coeff[0])); - } - test_msg->stec_sat_list[6].stec_coeff[0] = -15868; - if (sizeof(test_msg->stec_sat_list[6].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[6].stec_coeff[0])); - } - test_msg->stec_sat_list[6].stec_coeff[1] = -2369; - if (sizeof(test_msg->stec_sat_list[6].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[6].stec_coeff[0])); - } - test_msg->stec_sat_list[6].stec_coeff[2] = -9396; - if (sizeof(test_msg->stec_sat_list[6].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[6].stec_coeff[0])); - } - test_msg->stec_sat_list[6].stec_coeff[3] = -16609; - test_msg->stec_sat_list[6].stec_quality_indicator = 98; - test_msg->stec_sat_list[6].sv_id.constellation = 3; - test_msg->stec_sat_list[6].sv_id.satId = 19; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[7].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[7].stec_coeff[0])); - } - test_msg->stec_sat_list[7].stec_coeff[0] = -1265; - if (sizeof(test_msg->stec_sat_list[7].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[7].stec_coeff[0])); - } - test_msg->stec_sat_list[7].stec_coeff[1] = 4897; - if (sizeof(test_msg->stec_sat_list[7].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[7].stec_coeff[0])); - } - test_msg->stec_sat_list[7].stec_coeff[2] = 13920; - if (sizeof(test_msg->stec_sat_list[7].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[7].stec_coeff[0])); - } - test_msg->stec_sat_list[7].stec_coeff[3] = -28102; - test_msg->stec_sat_list[7].stec_quality_indicator = 177; - test_msg->stec_sat_list[7].sv_id.constellation = 79; - test_msg->stec_sat_list[7].sv_id.satId = 113; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[8].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[8].stec_coeff[0])); - } - test_msg->stec_sat_list[8].stec_coeff[0] = 5448; - if (sizeof(test_msg->stec_sat_list[8].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[8].stec_coeff[0])); - } - test_msg->stec_sat_list[8].stec_coeff[1] = -11359; - if (sizeof(test_msg->stec_sat_list[8].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[8].stec_coeff[0])); - } - test_msg->stec_sat_list[8].stec_coeff[2] = 5574; - if (sizeof(test_msg->stec_sat_list[8].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[8].stec_coeff[0])); - } - test_msg->stec_sat_list[8].stec_coeff[3] = 28654; - test_msg->stec_sat_list[8].stec_quality_indicator = 249; - test_msg->stec_sat_list[8].sv_id.constellation = 100; - test_msg->stec_sat_list[8].sv_id.satId = 210; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[9].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[9].stec_coeff[0])); - } - test_msg->stec_sat_list[9].stec_coeff[0] = -10783; - if (sizeof(test_msg->stec_sat_list[9].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[9].stec_coeff[0])); - } - test_msg->stec_sat_list[9].stec_coeff[1] = 18179; - if (sizeof(test_msg->stec_sat_list[9].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[9].stec_coeff[0])); - } - test_msg->stec_sat_list[9].stec_coeff[2] = 16371; - if (sizeof(test_msg->stec_sat_list[9].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[9].stec_coeff[0])); - } - test_msg->stec_sat_list[9].stec_coeff[3] = -5055; - test_msg->stec_sat_list[9].stec_quality_indicator = 227; - test_msg->stec_sat_list[9].sv_id.constellation = 36; - test_msg->stec_sat_list[9].sv_id.satId = 107; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[10].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[10].stec_coeff[0])); - } - test_msg->stec_sat_list[10].stec_coeff[0] = 4009; - if (sizeof(test_msg->stec_sat_list[10].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[10].stec_coeff[0])); - } - test_msg->stec_sat_list[10].stec_coeff[1] = 1462; - if (sizeof(test_msg->stec_sat_list[10].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[10].stec_coeff[0])); - } - test_msg->stec_sat_list[10].stec_coeff[2] = -19216; - if (sizeof(test_msg->stec_sat_list[10].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[10].stec_coeff[0])); - } - test_msg->stec_sat_list[10].stec_coeff[3] = 31241; - test_msg->stec_sat_list[10].stec_quality_indicator = 0; - test_msg->stec_sat_list[10].sv_id.constellation = 77; - test_msg->stec_sat_list[10].sv_id.satId = 92; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[11].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[11].stec_coeff[0])); - } - test_msg->stec_sat_list[11].stec_coeff[0] = 26727; - if (sizeof(test_msg->stec_sat_list[11].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[11].stec_coeff[0])); - } - test_msg->stec_sat_list[11].stec_coeff[1] = -16898; - if (sizeof(test_msg->stec_sat_list[11].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[11].stec_coeff[0])); - } - test_msg->stec_sat_list[11].stec_coeff[2] = 28241; - if (sizeof(test_msg->stec_sat_list[11].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[11].stec_coeff[0])); - } - test_msg->stec_sat_list[11].stec_coeff[3] = 12546; - test_msg->stec_sat_list[11].stec_quality_indicator = 6; - test_msg->stec_sat_list[11].sv_id.constellation = 232; - test_msg->stec_sat_list[11].sv_id.satId = 86; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[12].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[12].stec_coeff[0])); - } - test_msg->stec_sat_list[12].stec_coeff[0] = 12855; - if (sizeof(test_msg->stec_sat_list[12].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[12].stec_coeff[0])); - } - test_msg->stec_sat_list[12].stec_coeff[1] = 1461; - if (sizeof(test_msg->stec_sat_list[12].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[12].stec_coeff[0])); - } - test_msg->stec_sat_list[12].stec_coeff[2] = 20603; - if (sizeof(test_msg->stec_sat_list[12].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[12].stec_coeff[0])); - } - test_msg->stec_sat_list[12].stec_coeff[3] = -3023; - test_msg->stec_sat_list[12].stec_quality_indicator = 216; - test_msg->stec_sat_list[12].sv_id.constellation = 84; - test_msg->stec_sat_list[12].sv_id.satId = 202; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[13].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[13].stec_coeff[0])); - } - test_msg->stec_sat_list[13].stec_coeff[0] = -6492; - if (sizeof(test_msg->stec_sat_list[13].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[13].stec_coeff[0])); - } - test_msg->stec_sat_list[13].stec_coeff[1] = 16952; - if (sizeof(test_msg->stec_sat_list[13].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[13].stec_coeff[0])); - } - test_msg->stec_sat_list[13].stec_coeff[2] = -22404; - if (sizeof(test_msg->stec_sat_list[13].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[13].stec_coeff[0])); - } - test_msg->stec_sat_list[13].stec_coeff[3] = -29893; - test_msg->stec_sat_list[13].stec_quality_indicator = 125; - test_msg->stec_sat_list[13].sv_id.constellation = 188; - test_msg->stec_sat_list[13].sv_id.satId = 224; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[14].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[14].stec_coeff[0])); - } - test_msg->stec_sat_list[14].stec_coeff[0] = -10053; - if (sizeof(test_msg->stec_sat_list[14].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[14].stec_coeff[0])); - } - test_msg->stec_sat_list[14].stec_coeff[1] = -24897; - if (sizeof(test_msg->stec_sat_list[14].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[14].stec_coeff[0])); - } - test_msg->stec_sat_list[14].stec_coeff[2] = 23629; - if (sizeof(test_msg->stec_sat_list[14].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[14].stec_coeff[0])); - } - test_msg->stec_sat_list[14].stec_coeff[3] = -710; - test_msg->stec_sat_list[14].stec_quality_indicator = 51; - test_msg->stec_sat_list[14].sv_id.constellation = 118; - test_msg->stec_sat_list[14].sv_id.satId = 106; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[15].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[15].stec_coeff[0])); - } - test_msg->stec_sat_list[15].stec_coeff[0] = -26103; - if (sizeof(test_msg->stec_sat_list[15].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[15].stec_coeff[0])); - } - test_msg->stec_sat_list[15].stec_coeff[1] = -9539; - if (sizeof(test_msg->stec_sat_list[15].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[15].stec_coeff[0])); - } - test_msg->stec_sat_list[15].stec_coeff[2] = -11971; - if (sizeof(test_msg->stec_sat_list[15].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[15].stec_coeff[0])); - } - test_msg->stec_sat_list[15].stec_coeff[3] = 20993; - test_msg->stec_sat_list[15].stec_quality_indicator = 165; - test_msg->stec_sat_list[15].sv_id.constellation = 150; - test_msg->stec_sat_list[15].sv_id.satId = 132; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[16].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[16].stec_coeff[0])); - } - test_msg->stec_sat_list[16].stec_coeff[0] = -18891; - if (sizeof(test_msg->stec_sat_list[16].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[16].stec_coeff[0])); - } - test_msg->stec_sat_list[16].stec_coeff[1] = -16272; - if (sizeof(test_msg->stec_sat_list[16].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[16].stec_coeff[0])); - } - test_msg->stec_sat_list[16].stec_coeff[2] = -22578; - if (sizeof(test_msg->stec_sat_list[16].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[16].stec_coeff[0])); - } - test_msg->stec_sat_list[16].stec_coeff[3] = -2915; - test_msg->stec_sat_list[16].stec_quality_indicator = 23; - test_msg->stec_sat_list[16].sv_id.constellation = 196; - test_msg->stec_sat_list[16].sv_id.satId = 181; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[17].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[17].stec_coeff[0])); - } - test_msg->stec_sat_list[17].stec_coeff[0] = 15833; - if (sizeof(test_msg->stec_sat_list[17].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[17].stec_coeff[0])); - } - test_msg->stec_sat_list[17].stec_coeff[1] = 24920; - if (sizeof(test_msg->stec_sat_list[17].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[17].stec_coeff[0])); - } - test_msg->stec_sat_list[17].stec_coeff[2] = -13879; - if (sizeof(test_msg->stec_sat_list[17].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[17].stec_coeff[0])); - } - test_msg->stec_sat_list[17].stec_coeff[3] = -1206; - test_msg->stec_sat_list[17].stec_quality_indicator = 189; - test_msg->stec_sat_list[17].sv_id.constellation = 1; - test_msg->stec_sat_list[17].sv_id.satId = 35; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[18].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[18].stec_coeff[0])); - } - test_msg->stec_sat_list[18].stec_coeff[0] = 14008; - if (sizeof(test_msg->stec_sat_list[18].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[18].stec_coeff[0])); - } - test_msg->stec_sat_list[18].stec_coeff[1] = 18996; - if (sizeof(test_msg->stec_sat_list[18].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[18].stec_coeff[0])); - } - test_msg->stec_sat_list[18].stec_coeff[2] = 2798; - if (sizeof(test_msg->stec_sat_list[18].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[18].stec_coeff[0])); - } - test_msg->stec_sat_list[18].stec_coeff[3] = 5761; - test_msg->stec_sat_list[18].stec_quality_indicator = 104; - test_msg->stec_sat_list[18].sv_id.constellation = 14; - test_msg->stec_sat_list[18].sv_id.satId = 217; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[19].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[19].stec_coeff[0])); - } - test_msg->stec_sat_list[19].stec_coeff[0] = -25256; - if (sizeof(test_msg->stec_sat_list[19].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[19].stec_coeff[0])); - } - test_msg->stec_sat_list[19].stec_coeff[1] = -15330; - if (sizeof(test_msg->stec_sat_list[19].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[19].stec_coeff[0])); - } - test_msg->stec_sat_list[19].stec_coeff[2] = 6831; - if (sizeof(test_msg->stec_sat_list[19].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[19].stec_coeff[0])); - } - test_msg->stec_sat_list[19].stec_coeff[3] = 8780; - test_msg->stec_sat_list[19].stec_quality_indicator = 109; - test_msg->stec_sat_list[19].sv_id.constellation = 226; - test_msg->stec_sat_list[19].sv_id.satId = 178; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[20].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[20].stec_coeff[0])); - } - test_msg->stec_sat_list[20].stec_coeff[0] = 3304; - if (sizeof(test_msg->stec_sat_list[20].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[20].stec_coeff[0])); - } - test_msg->stec_sat_list[20].stec_coeff[1] = -2893; - if (sizeof(test_msg->stec_sat_list[20].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[20].stec_coeff[0])); - } - test_msg->stec_sat_list[20].stec_coeff[2] = -25841; - if (sizeof(test_msg->stec_sat_list[20].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[20].stec_coeff[0])); - } - test_msg->stec_sat_list[20].stec_coeff[3] = -13628; - test_msg->stec_sat_list[20].stec_quality_indicator = 154; - test_msg->stec_sat_list[20].sv_id.constellation = 220; - test_msg->stec_sat_list[20].sv_id.satId = 116; - if (sizeof(test_msg->stec_sat_list) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->stec_sat_list[0])); - } - if (sizeof(test_msg->stec_sat_list[21].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[21].stec_coeff[0])); - } - test_msg->stec_sat_list[21].stec_coeff[0] = -10742; - if (sizeof(test_msg->stec_sat_list[21].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[21].stec_coeff[0])); - } - test_msg->stec_sat_list[21].stec_coeff[1] = 10098; - if (sizeof(test_msg->stec_sat_list[21].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[21].stec_coeff[0])); - } - test_msg->stec_sat_list[21].stec_coeff[2] = 7413; - if (sizeof(test_msg->stec_sat_list[21].stec_coeff) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + - sizeof(test_msg->stec_sat_list[21].stec_coeff[0])); - } - test_msg->stec_sat_list[21].stec_coeff[3] = 17645; - test_msg->stec_sat_list[21].stec_quality_indicator = 115; - test_msg->stec_sat_list[21].sv_id.constellation = 70; - test_msg->stec_sat_list[21].sv_id.satId = 72; - - EXPECT_EQ(send_message(0x5eb, 1831, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1831); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asheader.iod_atmo)>( - reinterpret_cast(&last_msg_->header.iod_atmo)), - 4) - << "incorrect value for header.iod_atmo, expected 4, is " - << last_msg_->header.iod_atmo; - EXPECT_EQ(get_asheader.num_msgs)>( - reinterpret_cast(&last_msg_->header.num_msgs)), - 147) - << "incorrect value for header.num_msgs, expected 147, is " - << last_msg_->header.num_msgs; - EXPECT_EQ(get_asheader.seq_num)>( - reinterpret_cast(&last_msg_->header.seq_num)), - 123) - << "incorrect value for header.seq_num, expected 123, is " - << last_msg_->header.seq_num; - EXPECT_EQ(get_asheader.time.tow)>( - reinterpret_cast(&last_msg_->header.time.tow)), - 3905179974) - << "incorrect value for header.time.tow, expected 3905179974, is " - << last_msg_->header.time.tow; - EXPECT_EQ(get_asheader.time.wn)>( - reinterpret_cast(&last_msg_->header.time.wn)), - 11193) - << "incorrect value for header.time.wn, expected 11193, is " - << last_msg_->header.time.wn; - EXPECT_EQ(get_asheader.update_interval)>( - reinterpret_cast( - &last_msg_->header.update_interval)), - 39) - << "incorrect value for header.update_interval, expected 39, is " - << last_msg_->header.update_interval; - EXPECT_EQ(get_asstec_sat_list[0].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_coeff[0])), - -1951) - << "incorrect value for stec_sat_list[0].stec_coeff[0], expected -1951, " - "is " - << last_msg_->stec_sat_list[0].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[0].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_coeff[1])), - -9854) - << "incorrect value for stec_sat_list[0].stec_coeff[1], expected -9854, " - "is " - << last_msg_->stec_sat_list[0].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[0].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_coeff[2])), - 27353) - << "incorrect value for stec_sat_list[0].stec_coeff[2], expected 27353, " - "is " - << last_msg_->stec_sat_list[0].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[0].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_coeff[3])), - 3130) - << "incorrect value for stec_sat_list[0].stec_coeff[3], expected 3130, " - "is " - << last_msg_->stec_sat_list[0].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[0].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].stec_quality_indicator)), - 111) - << "incorrect value for stec_sat_list[0].stec_quality_indicator, " - "expected 111, is " - << last_msg_->stec_sat_list[0].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[0].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].sv_id.constellation)), - 19) - << "incorrect value for stec_sat_list[0].sv_id.constellation, expected " - "19, is " - << last_msg_->stec_sat_list[0].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[0].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[0].sv_id.satId)), - 126) - << "incorrect value for stec_sat_list[0].sv_id.satId, expected 126, is " - << last_msg_->stec_sat_list[0].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[1].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_coeff[0])), - 24401) - << "incorrect value for stec_sat_list[1].stec_coeff[0], expected 24401, " - "is " - << last_msg_->stec_sat_list[1].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[1].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_coeff[1])), - 4182) - << "incorrect value for stec_sat_list[1].stec_coeff[1], expected 4182, " - "is " - << last_msg_->stec_sat_list[1].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[1].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_coeff[2])), - 21543) - << "incorrect value for stec_sat_list[1].stec_coeff[2], expected 21543, " - "is " - << last_msg_->stec_sat_list[1].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[1].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_coeff[3])), - -12060) - << "incorrect value for stec_sat_list[1].stec_coeff[3], expected -12060, " - "is " - << last_msg_->stec_sat_list[1].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[1].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].stec_quality_indicator)), - 171) - << "incorrect value for stec_sat_list[1].stec_quality_indicator, " - "expected 171, is " - << last_msg_->stec_sat_list[1].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[1].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].sv_id.constellation)), - 230) - << "incorrect value for stec_sat_list[1].sv_id.constellation, expected " - "230, is " - << last_msg_->stec_sat_list[1].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[1].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[1].sv_id.satId)), - 65) - << "incorrect value for stec_sat_list[1].sv_id.satId, expected 65, is " - << last_msg_->stec_sat_list[1].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[2].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[2].stec_coeff[0])), - -13469) - << "incorrect value for stec_sat_list[2].stec_coeff[0], expected -13469, " - "is " - << last_msg_->stec_sat_list[2].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[2].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[2].stec_coeff[1])), - -18883) - << "incorrect value for stec_sat_list[2].stec_coeff[1], expected -18883, " - "is " - << last_msg_->stec_sat_list[2].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[2].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[2].stec_coeff[2])), - 32066) - << "incorrect value for stec_sat_list[2].stec_coeff[2], expected 32066, " - "is " - << last_msg_->stec_sat_list[2].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[2].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[2].stec_coeff[3])), - 971) - << "incorrect value for stec_sat_list[2].stec_coeff[3], expected 971, is " - << last_msg_->stec_sat_list[2].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[2].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[2].stec_quality_indicator)), - 219) - << "incorrect value for stec_sat_list[2].stec_quality_indicator, " - "expected 219, is " - << last_msg_->stec_sat_list[2].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[2].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[2].sv_id.constellation)), - 81) - << "incorrect value for stec_sat_list[2].sv_id.constellation, expected " - "81, is " - << last_msg_->stec_sat_list[2].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[2].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[2].sv_id.satId)), - 201) - << "incorrect value for stec_sat_list[2].sv_id.satId, expected 201, is " - << last_msg_->stec_sat_list[2].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[3].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[3].stec_coeff[0])), - 32220) - << "incorrect value for stec_sat_list[3].stec_coeff[0], expected 32220, " - "is " - << last_msg_->stec_sat_list[3].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[3].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[3].stec_coeff[1])), - 5436) - << "incorrect value for stec_sat_list[3].stec_coeff[1], expected 5436, " - "is " - << last_msg_->stec_sat_list[3].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[3].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[3].stec_coeff[2])), - -9635) - << "incorrect value for stec_sat_list[3].stec_coeff[2], expected -9635, " - "is " - << last_msg_->stec_sat_list[3].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[3].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[3].stec_coeff[3])), - -24841) - << "incorrect value for stec_sat_list[3].stec_coeff[3], expected -24841, " - "is " - << last_msg_->stec_sat_list[3].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[3].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[3].stec_quality_indicator)), - 100) - << "incorrect value for stec_sat_list[3].stec_quality_indicator, " - "expected 100, is " - << last_msg_->stec_sat_list[3].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[3].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[3].sv_id.constellation)), - 44) - << "incorrect value for stec_sat_list[3].sv_id.constellation, expected " - "44, is " - << last_msg_->stec_sat_list[3].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[3].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[3].sv_id.satId)), - 193) - << "incorrect value for stec_sat_list[3].sv_id.satId, expected 193, is " - << last_msg_->stec_sat_list[3].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[4].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[4].stec_coeff[0])), - 3718) - << "incorrect value for stec_sat_list[4].stec_coeff[0], expected 3718, " - "is " - << last_msg_->stec_sat_list[4].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[4].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[4].stec_coeff[1])), - 12497) - << "incorrect value for stec_sat_list[4].stec_coeff[1], expected 12497, " - "is " - << last_msg_->stec_sat_list[4].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[4].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[4].stec_coeff[2])), - -10482) - << "incorrect value for stec_sat_list[4].stec_coeff[2], expected -10482, " - "is " - << last_msg_->stec_sat_list[4].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[4].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[4].stec_coeff[3])), - -27495) - << "incorrect value for stec_sat_list[4].stec_coeff[3], expected -27495, " - "is " - << last_msg_->stec_sat_list[4].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[4].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[4].stec_quality_indicator)), - 129) - << "incorrect value for stec_sat_list[4].stec_quality_indicator, " - "expected 129, is " - << last_msg_->stec_sat_list[4].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[4].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[4].sv_id.constellation)), - 93) - << "incorrect value for stec_sat_list[4].sv_id.constellation, expected " - "93, is " - << last_msg_->stec_sat_list[4].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[4].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[4].sv_id.satId)), - 207) - << "incorrect value for stec_sat_list[4].sv_id.satId, expected 207, is " - << last_msg_->stec_sat_list[4].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[5].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[5].stec_coeff[0])), - -4940) - << "incorrect value for stec_sat_list[5].stec_coeff[0], expected -4940, " - "is " - << last_msg_->stec_sat_list[5].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[5].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[5].stec_coeff[1])), - -13875) - << "incorrect value for stec_sat_list[5].stec_coeff[1], expected -13875, " - "is " - << last_msg_->stec_sat_list[5].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[5].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[5].stec_coeff[2])), - 801) - << "incorrect value for stec_sat_list[5].stec_coeff[2], expected 801, is " - << last_msg_->stec_sat_list[5].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[5].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[5].stec_coeff[3])), - -13066) - << "incorrect value for stec_sat_list[5].stec_coeff[3], expected -13066, " - "is " - << last_msg_->stec_sat_list[5].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[5].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[5].stec_quality_indicator)), - 225) - << "incorrect value for stec_sat_list[5].stec_quality_indicator, " - "expected 225, is " - << last_msg_->stec_sat_list[5].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[5].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[5].sv_id.constellation)), - 72) - << "incorrect value for stec_sat_list[5].sv_id.constellation, expected " - "72, is " - << last_msg_->stec_sat_list[5].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[5].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[5].sv_id.satId)), - 147) - << "incorrect value for stec_sat_list[5].sv_id.satId, expected 147, is " - << last_msg_->stec_sat_list[5].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[6].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[6].stec_coeff[0])), - -15868) - << "incorrect value for stec_sat_list[6].stec_coeff[0], expected -15868, " - "is " - << last_msg_->stec_sat_list[6].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[6].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[6].stec_coeff[1])), - -2369) - << "incorrect value for stec_sat_list[6].stec_coeff[1], expected -2369, " - "is " - << last_msg_->stec_sat_list[6].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[6].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[6].stec_coeff[2])), - -9396) - << "incorrect value for stec_sat_list[6].stec_coeff[2], expected -9396, " - "is " - << last_msg_->stec_sat_list[6].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[6].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[6].stec_coeff[3])), - -16609) - << "incorrect value for stec_sat_list[6].stec_coeff[3], expected -16609, " - "is " - << last_msg_->stec_sat_list[6].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[6].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[6].stec_quality_indicator)), - 98) - << "incorrect value for stec_sat_list[6].stec_quality_indicator, " - "expected 98, is " - << last_msg_->stec_sat_list[6].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[6].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[6].sv_id.constellation)), - 3) - << "incorrect value for stec_sat_list[6].sv_id.constellation, expected " - "3, is " - << last_msg_->stec_sat_list[6].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[6].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[6].sv_id.satId)), - 19) - << "incorrect value for stec_sat_list[6].sv_id.satId, expected 19, is " - << last_msg_->stec_sat_list[6].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[7].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[7].stec_coeff[0])), - -1265) - << "incorrect value for stec_sat_list[7].stec_coeff[0], expected -1265, " - "is " - << last_msg_->stec_sat_list[7].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[7].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[7].stec_coeff[1])), - 4897) - << "incorrect value for stec_sat_list[7].stec_coeff[1], expected 4897, " - "is " - << last_msg_->stec_sat_list[7].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[7].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[7].stec_coeff[2])), - 13920) - << "incorrect value for stec_sat_list[7].stec_coeff[2], expected 13920, " - "is " - << last_msg_->stec_sat_list[7].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[7].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[7].stec_coeff[3])), - -28102) - << "incorrect value for stec_sat_list[7].stec_coeff[3], expected -28102, " - "is " - << last_msg_->stec_sat_list[7].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[7].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[7].stec_quality_indicator)), - 177) - << "incorrect value for stec_sat_list[7].stec_quality_indicator, " - "expected 177, is " - << last_msg_->stec_sat_list[7].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[7].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[7].sv_id.constellation)), - 79) - << "incorrect value for stec_sat_list[7].sv_id.constellation, expected " - "79, is " - << last_msg_->stec_sat_list[7].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[7].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[7].sv_id.satId)), - 113) - << "incorrect value for stec_sat_list[7].sv_id.satId, expected 113, is " - << last_msg_->stec_sat_list[7].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[8].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[8].stec_coeff[0])), - 5448) - << "incorrect value for stec_sat_list[8].stec_coeff[0], expected 5448, " - "is " - << last_msg_->stec_sat_list[8].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[8].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[8].stec_coeff[1])), - -11359) - << "incorrect value for stec_sat_list[8].stec_coeff[1], expected -11359, " - "is " - << last_msg_->stec_sat_list[8].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[8].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[8].stec_coeff[2])), - 5574) - << "incorrect value for stec_sat_list[8].stec_coeff[2], expected 5574, " - "is " - << last_msg_->stec_sat_list[8].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[8].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[8].stec_coeff[3])), - 28654) - << "incorrect value for stec_sat_list[8].stec_coeff[3], expected 28654, " - "is " - << last_msg_->stec_sat_list[8].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[8].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[8].stec_quality_indicator)), - 249) - << "incorrect value for stec_sat_list[8].stec_quality_indicator, " - "expected 249, is " - << last_msg_->stec_sat_list[8].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[8].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[8].sv_id.constellation)), - 100) - << "incorrect value for stec_sat_list[8].sv_id.constellation, expected " - "100, is " - << last_msg_->stec_sat_list[8].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[8].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[8].sv_id.satId)), - 210) - << "incorrect value for stec_sat_list[8].sv_id.satId, expected 210, is " - << last_msg_->stec_sat_list[8].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[9].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[9].stec_coeff[0])), - -10783) - << "incorrect value for stec_sat_list[9].stec_coeff[0], expected -10783, " - "is " - << last_msg_->stec_sat_list[9].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[9].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[9].stec_coeff[1])), - 18179) - << "incorrect value for stec_sat_list[9].stec_coeff[1], expected 18179, " - "is " - << last_msg_->stec_sat_list[9].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[9].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[9].stec_coeff[2])), - 16371) - << "incorrect value for stec_sat_list[9].stec_coeff[2], expected 16371, " - "is " - << last_msg_->stec_sat_list[9].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[9].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[9].stec_coeff[3])), - -5055) - << "incorrect value for stec_sat_list[9].stec_coeff[3], expected -5055, " - "is " - << last_msg_->stec_sat_list[9].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[9].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[9].stec_quality_indicator)), - 227) - << "incorrect value for stec_sat_list[9].stec_quality_indicator, " - "expected 227, is " - << last_msg_->stec_sat_list[9].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[9].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[9].sv_id.constellation)), - 36) - << "incorrect value for stec_sat_list[9].sv_id.constellation, expected " - "36, is " - << last_msg_->stec_sat_list[9].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[9].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[9].sv_id.satId)), - 107) - << "incorrect value for stec_sat_list[9].sv_id.satId, expected 107, is " - << last_msg_->stec_sat_list[9].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[10].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[10].stec_coeff[0])), - 4009) - << "incorrect value for stec_sat_list[10].stec_coeff[0], expected 4009, " - "is " - << last_msg_->stec_sat_list[10].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[10].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[10].stec_coeff[1])), - 1462) - << "incorrect value for stec_sat_list[10].stec_coeff[1], expected 1462, " - "is " - << last_msg_->stec_sat_list[10].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[10].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[10].stec_coeff[2])), - -19216) - << "incorrect value for stec_sat_list[10].stec_coeff[2], expected " - "-19216, is " - << last_msg_->stec_sat_list[10].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[10].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[10].stec_coeff[3])), - 31241) - << "incorrect value for stec_sat_list[10].stec_coeff[3], expected 31241, " - "is " - << last_msg_->stec_sat_list[10].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[10].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[10].stec_quality_indicator)), - 0) - << "incorrect value for stec_sat_list[10].stec_quality_indicator, " - "expected 0, is " - << last_msg_->stec_sat_list[10].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[10].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[10].sv_id.constellation)), - 77) - << "incorrect value for stec_sat_list[10].sv_id.constellation, expected " - "77, is " - << last_msg_->stec_sat_list[10].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[10].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[10].sv_id.satId)), - 92) - << "incorrect value for stec_sat_list[10].sv_id.satId, expected 92, is " - << last_msg_->stec_sat_list[10].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[11].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[11].stec_coeff[0])), - 26727) - << "incorrect value for stec_sat_list[11].stec_coeff[0], expected 26727, " - "is " - << last_msg_->stec_sat_list[11].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[11].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[11].stec_coeff[1])), - -16898) - << "incorrect value for stec_sat_list[11].stec_coeff[1], expected " - "-16898, is " - << last_msg_->stec_sat_list[11].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[11].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[11].stec_coeff[2])), - 28241) - << "incorrect value for stec_sat_list[11].stec_coeff[2], expected 28241, " - "is " - << last_msg_->stec_sat_list[11].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[11].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[11].stec_coeff[3])), - 12546) - << "incorrect value for stec_sat_list[11].stec_coeff[3], expected 12546, " - "is " - << last_msg_->stec_sat_list[11].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[11].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[11].stec_quality_indicator)), - 6) - << "incorrect value for stec_sat_list[11].stec_quality_indicator, " - "expected 6, is " - << last_msg_->stec_sat_list[11].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[11].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[11].sv_id.constellation)), - 232) - << "incorrect value for stec_sat_list[11].sv_id.constellation, expected " - "232, is " - << last_msg_->stec_sat_list[11].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[11].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[11].sv_id.satId)), - 86) - << "incorrect value for stec_sat_list[11].sv_id.satId, expected 86, is " - << last_msg_->stec_sat_list[11].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[12].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[12].stec_coeff[0])), - 12855) - << "incorrect value for stec_sat_list[12].stec_coeff[0], expected 12855, " - "is " - << last_msg_->stec_sat_list[12].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[12].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[12].stec_coeff[1])), - 1461) - << "incorrect value for stec_sat_list[12].stec_coeff[1], expected 1461, " - "is " - << last_msg_->stec_sat_list[12].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[12].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[12].stec_coeff[2])), - 20603) - << "incorrect value for stec_sat_list[12].stec_coeff[2], expected 20603, " - "is " - << last_msg_->stec_sat_list[12].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[12].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[12].stec_coeff[3])), - -3023) - << "incorrect value for stec_sat_list[12].stec_coeff[3], expected -3023, " - "is " - << last_msg_->stec_sat_list[12].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[12].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[12].stec_quality_indicator)), - 216) - << "incorrect value for stec_sat_list[12].stec_quality_indicator, " - "expected 216, is " - << last_msg_->stec_sat_list[12].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[12].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[12].sv_id.constellation)), - 84) - << "incorrect value for stec_sat_list[12].sv_id.constellation, expected " - "84, is " - << last_msg_->stec_sat_list[12].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[12].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[12].sv_id.satId)), - 202) - << "incorrect value for stec_sat_list[12].sv_id.satId, expected 202, is " - << last_msg_->stec_sat_list[12].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[13].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[13].stec_coeff[0])), - -6492) - << "incorrect value for stec_sat_list[13].stec_coeff[0], expected -6492, " - "is " - << last_msg_->stec_sat_list[13].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[13].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[13].stec_coeff[1])), - 16952) - << "incorrect value for stec_sat_list[13].stec_coeff[1], expected 16952, " - "is " - << last_msg_->stec_sat_list[13].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[13].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[13].stec_coeff[2])), - -22404) - << "incorrect value for stec_sat_list[13].stec_coeff[2], expected " - "-22404, is " - << last_msg_->stec_sat_list[13].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[13].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[13].stec_coeff[3])), - -29893) - << "incorrect value for stec_sat_list[13].stec_coeff[3], expected " - "-29893, is " - << last_msg_->stec_sat_list[13].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[13].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[13].stec_quality_indicator)), - 125) - << "incorrect value for stec_sat_list[13].stec_quality_indicator, " - "expected 125, is " - << last_msg_->stec_sat_list[13].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[13].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[13].sv_id.constellation)), - 188) - << "incorrect value for stec_sat_list[13].sv_id.constellation, expected " - "188, is " - << last_msg_->stec_sat_list[13].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[13].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[13].sv_id.satId)), - 224) - << "incorrect value for stec_sat_list[13].sv_id.satId, expected 224, is " - << last_msg_->stec_sat_list[13].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[14].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[14].stec_coeff[0])), - -10053) - << "incorrect value for stec_sat_list[14].stec_coeff[0], expected " - "-10053, is " - << last_msg_->stec_sat_list[14].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[14].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[14].stec_coeff[1])), - -24897) - << "incorrect value for stec_sat_list[14].stec_coeff[1], expected " - "-24897, is " - << last_msg_->stec_sat_list[14].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[14].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[14].stec_coeff[2])), - 23629) - << "incorrect value for stec_sat_list[14].stec_coeff[2], expected 23629, " - "is " - << last_msg_->stec_sat_list[14].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[14].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[14].stec_coeff[3])), - -710) - << "incorrect value for stec_sat_list[14].stec_coeff[3], expected -710, " - "is " - << last_msg_->stec_sat_list[14].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[14].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[14].stec_quality_indicator)), - 51) - << "incorrect value for stec_sat_list[14].stec_quality_indicator, " - "expected 51, is " - << last_msg_->stec_sat_list[14].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[14].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[14].sv_id.constellation)), - 118) - << "incorrect value for stec_sat_list[14].sv_id.constellation, expected " - "118, is " - << last_msg_->stec_sat_list[14].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[14].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[14].sv_id.satId)), - 106) - << "incorrect value for stec_sat_list[14].sv_id.satId, expected 106, is " - << last_msg_->stec_sat_list[14].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[15].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[15].stec_coeff[0])), - -26103) - << "incorrect value for stec_sat_list[15].stec_coeff[0], expected " - "-26103, is " - << last_msg_->stec_sat_list[15].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[15].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[15].stec_coeff[1])), - -9539) - << "incorrect value for stec_sat_list[15].stec_coeff[1], expected -9539, " - "is " - << last_msg_->stec_sat_list[15].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[15].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[15].stec_coeff[2])), - -11971) - << "incorrect value for stec_sat_list[15].stec_coeff[2], expected " - "-11971, is " - << last_msg_->stec_sat_list[15].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[15].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[15].stec_coeff[3])), - 20993) - << "incorrect value for stec_sat_list[15].stec_coeff[3], expected 20993, " - "is " - << last_msg_->stec_sat_list[15].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[15].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[15].stec_quality_indicator)), - 165) - << "incorrect value for stec_sat_list[15].stec_quality_indicator, " - "expected 165, is " - << last_msg_->stec_sat_list[15].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[15].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[15].sv_id.constellation)), - 150) - << "incorrect value for stec_sat_list[15].sv_id.constellation, expected " - "150, is " - << last_msg_->stec_sat_list[15].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[15].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[15].sv_id.satId)), - 132) - << "incorrect value for stec_sat_list[15].sv_id.satId, expected 132, is " - << last_msg_->stec_sat_list[15].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[16].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[16].stec_coeff[0])), - -18891) - << "incorrect value for stec_sat_list[16].stec_coeff[0], expected " - "-18891, is " - << last_msg_->stec_sat_list[16].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[16].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[16].stec_coeff[1])), - -16272) - << "incorrect value for stec_sat_list[16].stec_coeff[1], expected " - "-16272, is " - << last_msg_->stec_sat_list[16].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[16].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[16].stec_coeff[2])), - -22578) - << "incorrect value for stec_sat_list[16].stec_coeff[2], expected " - "-22578, is " - << last_msg_->stec_sat_list[16].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[16].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[16].stec_coeff[3])), - -2915) - << "incorrect value for stec_sat_list[16].stec_coeff[3], expected -2915, " - "is " - << last_msg_->stec_sat_list[16].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[16].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[16].stec_quality_indicator)), - 23) - << "incorrect value for stec_sat_list[16].stec_quality_indicator, " - "expected 23, is " - << last_msg_->stec_sat_list[16].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[16].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[16].sv_id.constellation)), - 196) - << "incorrect value for stec_sat_list[16].sv_id.constellation, expected " - "196, is " - << last_msg_->stec_sat_list[16].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[16].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[16].sv_id.satId)), - 181) - << "incorrect value for stec_sat_list[16].sv_id.satId, expected 181, is " - << last_msg_->stec_sat_list[16].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[17].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[17].stec_coeff[0])), - 15833) - << "incorrect value for stec_sat_list[17].stec_coeff[0], expected 15833, " - "is " - << last_msg_->stec_sat_list[17].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[17].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[17].stec_coeff[1])), - 24920) - << "incorrect value for stec_sat_list[17].stec_coeff[1], expected 24920, " - "is " - << last_msg_->stec_sat_list[17].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[17].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[17].stec_coeff[2])), - -13879) - << "incorrect value for stec_sat_list[17].stec_coeff[2], expected " - "-13879, is " - << last_msg_->stec_sat_list[17].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[17].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[17].stec_coeff[3])), - -1206) - << "incorrect value for stec_sat_list[17].stec_coeff[3], expected -1206, " - "is " - << last_msg_->stec_sat_list[17].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[17].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[17].stec_quality_indicator)), - 189) - << "incorrect value for stec_sat_list[17].stec_quality_indicator, " - "expected 189, is " - << last_msg_->stec_sat_list[17].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[17].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[17].sv_id.constellation)), - 1) - << "incorrect value for stec_sat_list[17].sv_id.constellation, expected " - "1, is " - << last_msg_->stec_sat_list[17].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[17].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[17].sv_id.satId)), - 35) - << "incorrect value for stec_sat_list[17].sv_id.satId, expected 35, is " - << last_msg_->stec_sat_list[17].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[18].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[18].stec_coeff[0])), - 14008) - << "incorrect value for stec_sat_list[18].stec_coeff[0], expected 14008, " - "is " - << last_msg_->stec_sat_list[18].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[18].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[18].stec_coeff[1])), - 18996) - << "incorrect value for stec_sat_list[18].stec_coeff[1], expected 18996, " - "is " - << last_msg_->stec_sat_list[18].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[18].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[18].stec_coeff[2])), - 2798) - << "incorrect value for stec_sat_list[18].stec_coeff[2], expected 2798, " - "is " - << last_msg_->stec_sat_list[18].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[18].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[18].stec_coeff[3])), - 5761) - << "incorrect value for stec_sat_list[18].stec_coeff[3], expected 5761, " - "is " - << last_msg_->stec_sat_list[18].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[18].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[18].stec_quality_indicator)), - 104) - << "incorrect value for stec_sat_list[18].stec_quality_indicator, " - "expected 104, is " - << last_msg_->stec_sat_list[18].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[18].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[18].sv_id.constellation)), - 14) - << "incorrect value for stec_sat_list[18].sv_id.constellation, expected " - "14, is " - << last_msg_->stec_sat_list[18].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[18].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[18].sv_id.satId)), - 217) - << "incorrect value for stec_sat_list[18].sv_id.satId, expected 217, is " - << last_msg_->stec_sat_list[18].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[19].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[19].stec_coeff[0])), - -25256) - << "incorrect value for stec_sat_list[19].stec_coeff[0], expected " - "-25256, is " - << last_msg_->stec_sat_list[19].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[19].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[19].stec_coeff[1])), - -15330) - << "incorrect value for stec_sat_list[19].stec_coeff[1], expected " - "-15330, is " - << last_msg_->stec_sat_list[19].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[19].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[19].stec_coeff[2])), - 6831) - << "incorrect value for stec_sat_list[19].stec_coeff[2], expected 6831, " - "is " - << last_msg_->stec_sat_list[19].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[19].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[19].stec_coeff[3])), - 8780) - << "incorrect value for stec_sat_list[19].stec_coeff[3], expected 8780, " - "is " - << last_msg_->stec_sat_list[19].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[19].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[19].stec_quality_indicator)), - 109) - << "incorrect value for stec_sat_list[19].stec_quality_indicator, " - "expected 109, is " - << last_msg_->stec_sat_list[19].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[19].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[19].sv_id.constellation)), - 226) - << "incorrect value for stec_sat_list[19].sv_id.constellation, expected " - "226, is " - << last_msg_->stec_sat_list[19].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[19].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[19].sv_id.satId)), - 178) - << "incorrect value for stec_sat_list[19].sv_id.satId, expected 178, is " - << last_msg_->stec_sat_list[19].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[20].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[20].stec_coeff[0])), - 3304) - << "incorrect value for stec_sat_list[20].stec_coeff[0], expected 3304, " - "is " - << last_msg_->stec_sat_list[20].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[20].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[20].stec_coeff[1])), - -2893) - << "incorrect value for stec_sat_list[20].stec_coeff[1], expected -2893, " - "is " - << last_msg_->stec_sat_list[20].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[20].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[20].stec_coeff[2])), - -25841) - << "incorrect value for stec_sat_list[20].stec_coeff[2], expected " - "-25841, is " - << last_msg_->stec_sat_list[20].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[20].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[20].stec_coeff[3])), - -13628) - << "incorrect value for stec_sat_list[20].stec_coeff[3], expected " - "-13628, is " - << last_msg_->stec_sat_list[20].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[20].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[20].stec_quality_indicator)), - 154) - << "incorrect value for stec_sat_list[20].stec_quality_indicator, " - "expected 154, is " - << last_msg_->stec_sat_list[20].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[20].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[20].sv_id.constellation)), - 220) - << "incorrect value for stec_sat_list[20].sv_id.constellation, expected " - "220, is " - << last_msg_->stec_sat_list[20].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[20].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[20].sv_id.satId)), - 116) - << "incorrect value for stec_sat_list[20].sv_id.satId, expected 116, is " - << last_msg_->stec_sat_list[20].sv_id.satId; - EXPECT_EQ(get_asstec_sat_list[21].stec_coeff[0])>( - reinterpret_cast( - &last_msg_->stec_sat_list[21].stec_coeff[0])), - -10742) - << "incorrect value for stec_sat_list[21].stec_coeff[0], expected " - "-10742, is " - << last_msg_->stec_sat_list[21].stec_coeff[0]; - EXPECT_EQ(get_asstec_sat_list[21].stec_coeff[1])>( - reinterpret_cast( - &last_msg_->stec_sat_list[21].stec_coeff[1])), - 10098) - << "incorrect value for stec_sat_list[21].stec_coeff[1], expected 10098, " - "is " - << last_msg_->stec_sat_list[21].stec_coeff[1]; - EXPECT_EQ(get_asstec_sat_list[21].stec_coeff[2])>( - reinterpret_cast( - &last_msg_->stec_sat_list[21].stec_coeff[2])), - 7413) - << "incorrect value for stec_sat_list[21].stec_coeff[2], expected 7413, " - "is " - << last_msg_->stec_sat_list[21].stec_coeff[2]; - EXPECT_EQ(get_asstec_sat_list[21].stec_coeff[3])>( - reinterpret_cast( - &last_msg_->stec_sat_list[21].stec_coeff[3])), - 17645) - << "incorrect value for stec_sat_list[21].stec_coeff[3], expected 17645, " - "is " - << last_msg_->stec_sat_list[21].stec_coeff[3]; - EXPECT_EQ( - get_asstec_sat_list[21].stec_quality_indicator)>( - reinterpret_cast( - &last_msg_->stec_sat_list[21].stec_quality_indicator)), - 115) - << "incorrect value for stec_sat_list[21].stec_quality_indicator, " - "expected 115, is " - << last_msg_->stec_sat_list[21].stec_quality_indicator; - EXPECT_EQ(get_asstec_sat_list[21].sv_id.constellation)>( - reinterpret_cast( - &last_msg_->stec_sat_list[21].sv_id.constellation)), - 70) - << "incorrect value for stec_sat_list[21].sv_id.constellation, expected " - "70, is " - << last_msg_->stec_sat_list[21].sv_id.constellation; - EXPECT_EQ(get_asstec_sat_list[21].sv_id.satId)>( - reinterpret_cast( - &last_msg_->stec_sat_list[21].sv_id.satId)), - 72) - << "incorrect value for stec_sat_list[21].sv_id.satId, expected 72, is " - << last_msg_->stec_sat_list[21].sv_id.satId; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrTileDefinition.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrTileDefinition.cc deleted file mode 100644 index 0752bf7e12..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrTileDefinition.cc +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrTileDefinition.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrTileDefinition0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrTileDefinition0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_tile_definition_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_tile_definition_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrTileDefinition0, Test) { - uint8_t encoded_frame[] = { - 85, 248, 5, 0, 0, 33, 127, 58, 9, 0, 174, 8, 1, 2, - 3, 4, 0, 5, 0, 186, 28, 59, 167, 100, 0, 100, 0, 6, - 0, 6, 0, 210, 2, 150, 73, 0, 0, 0, 0, 204, 94, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_tile_definition_t *test_msg = - (msg_ssr_tile_definition_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->bitmask = 1234567890; - test_msg->cols = 6; - test_msg->corner_nw_lat = 7354; - test_msg->corner_nw_lon = -22725; - test_msg->iod_atmo = 3; - test_msg->rows = 6; - test_msg->sol_id = 2; - test_msg->spacing_lat = 100; - test_msg->spacing_lon = 100; - test_msg->tile_id = 5; - test_msg->tile_set_id = 4; - test_msg->time.tow = 604799; - test_msg->time.wn = 2222; - test_msg->update_interval = 1; - - EXPECT_EQ(send_message(0x5F8, 0, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 0); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asbitmask)>( - reinterpret_cast(&last_msg_->bitmask)), - 1234567890) - << "incorrect value for bitmask, expected 1234567890, is " - << last_msg_->bitmask; - EXPECT_EQ(get_ascols)>( - reinterpret_cast(&last_msg_->cols)), - 6) - << "incorrect value for cols, expected 6, is " << last_msg_->cols; - EXPECT_EQ(get_ascorner_nw_lat)>( - reinterpret_cast(&last_msg_->corner_nw_lat)), - 7354) - << "incorrect value for corner_nw_lat, expected 7354, is " - << last_msg_->corner_nw_lat; - EXPECT_EQ(get_ascorner_nw_lon)>( - reinterpret_cast(&last_msg_->corner_nw_lon)), - -22725) - << "incorrect value for corner_nw_lon, expected -22725, is " - << last_msg_->corner_nw_lon; - EXPECT_EQ(get_asiod_atmo)>( - reinterpret_cast(&last_msg_->iod_atmo)), - 3) - << "incorrect value for iod_atmo, expected 3, is " << last_msg_->iod_atmo; - EXPECT_EQ(get_asrows)>( - reinterpret_cast(&last_msg_->rows)), - 6) - << "incorrect value for rows, expected 6, is " << last_msg_->rows; - EXPECT_EQ(get_assol_id)>( - reinterpret_cast(&last_msg_->sol_id)), - 2) - << "incorrect value for sol_id, expected 2, is " << last_msg_->sol_id; - EXPECT_EQ(get_asspacing_lat)>( - reinterpret_cast(&last_msg_->spacing_lat)), - 100) - << "incorrect value for spacing_lat, expected 100, is " - << last_msg_->spacing_lat; - EXPECT_EQ(get_asspacing_lon)>( - reinterpret_cast(&last_msg_->spacing_lon)), - 100) - << "incorrect value for spacing_lon, expected 100, is " - << last_msg_->spacing_lon; - EXPECT_EQ(get_astile_id)>( - reinterpret_cast(&last_msg_->tile_id)), - 5) - << "incorrect value for tile_id, expected 5, is " << last_msg_->tile_id; - EXPECT_EQ(get_astile_set_id)>( - reinterpret_cast(&last_msg_->tile_set_id)), - 4) - << "incorrect value for tile_set_id, expected 4, is " - << last_msg_->tile_set_id; - EXPECT_EQ(get_astime.tow)>( - reinterpret_cast(&last_msg_->time.tow)), - 604799) - << "incorrect value for time.tow, expected 604799, is " - << last_msg_->time.tow; - EXPECT_EQ(get_astime.wn)>( - reinterpret_cast(&last_msg_->time.wn)), - 2222) - << "incorrect value for time.wn, expected 2222, is " - << last_msg_->time.wn; - EXPECT_EQ(get_asupdate_interval)>( - reinterpret_cast(&last_msg_->update_interval)), - 1) - << "incorrect value for update_interval, expected 1, is " - << last_msg_->update_interval; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrTileDefinitionDepA.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrTileDefinitionDepA.cc deleted file mode 100644 index 55485effa6..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrTileDefinitionDepA.cc +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrTileDefinitionDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_tile_definition_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_tile_definition_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 246, 5, 200, 133, 24, 57, 190, 178, 247, 8, 185, 9, 181, 162, 240, - 65, 19, 255, 143, 21, 191, 239, 205, 171, 0, 0, 0, 0, 0, 65, 154, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_tile_definition_dep_a_t *test_msg = - (msg_ssr_tile_definition_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->bitmask = 11259375; - test_msg->cols = 48917; - test_msg->corner_nw_lat = -18168; - test_msg->corner_nw_lon = -19191; - test_msg->rows = 36863; - test_msg->spacing_lat = 61602; - test_msg->spacing_lon = 4929; - test_msg->tile_id = 63410; - test_msg->tile_set_id = 48697; - - EXPECT_EQ(send_message(0x5f6, 34248, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 34248); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asbitmask)>( - reinterpret_cast(&last_msg_->bitmask)), - 11259375) - << "incorrect value for bitmask, expected 11259375, is " - << last_msg_->bitmask; - EXPECT_EQ(get_ascols)>( - reinterpret_cast(&last_msg_->cols)), - 48917) - << "incorrect value for cols, expected 48917, is " << last_msg_->cols; - EXPECT_EQ(get_ascorner_nw_lat)>( - reinterpret_cast(&last_msg_->corner_nw_lat)), - -18168) - << "incorrect value for corner_nw_lat, expected -18168, is " - << last_msg_->corner_nw_lat; - EXPECT_EQ(get_ascorner_nw_lon)>( - reinterpret_cast(&last_msg_->corner_nw_lon)), - -19191) - << "incorrect value for corner_nw_lon, expected -19191, is " - << last_msg_->corner_nw_lon; - EXPECT_EQ(get_asrows)>( - reinterpret_cast(&last_msg_->rows)), - 36863) - << "incorrect value for rows, expected 36863, is " << last_msg_->rows; - EXPECT_EQ(get_asspacing_lat)>( - reinterpret_cast(&last_msg_->spacing_lat)), - 61602) - << "incorrect value for spacing_lat, expected 61602, is " - << last_msg_->spacing_lat; - EXPECT_EQ(get_asspacing_lon)>( - reinterpret_cast(&last_msg_->spacing_lon)), - 4929) - << "incorrect value for spacing_lon, expected 4929, is " - << last_msg_->spacing_lon; - EXPECT_EQ(get_astile_id)>( - reinterpret_cast(&last_msg_->tile_id)), - 63410) - << "incorrect value for tile_id, expected 63410, is " - << last_msg_->tile_id; - EXPECT_EQ(get_astile_set_id)>( - reinterpret_cast(&last_msg_->tile_set_id)), - 48697) - << "incorrect value for tile_set_id, expected 48697, is " - << last_msg_->tile_set_id; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrTileDefinitionDepB.cc b/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrTileDefinitionDepB.cc deleted file mode 100644 index 7fb0ae1e45..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_ssr_MsgSsrTileDefinitionDepB.cc +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/ssr/test_MsgSsrTileDefinitionDepB.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepB0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepB0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ssr_tile_definition_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ssr_tile_definition_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_ssr_MsgSsrTileDefinitionDepB0, Test) { - uint8_t encoded_frame[] = { - 85, 247, 5, 66, 0, 25, 31, 0, 1, 0, 2, 0, 4, 0, 8, 0, 16, - 0, 32, 0, 64, 0, 128, 210, 2, 150, 73, 0, 0, 0, 0, 214, 71, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ssr_tile_definition_dep_b_t *test_msg = - (msg_ssr_tile_definition_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->bitmask = 1234567890; - test_msg->cols = 32768; - test_msg->corner_nw_lat = 1024; - test_msg->corner_nw_lon = 2048; - test_msg->rows = 16384; - test_msg->spacing_lat = 4096; - test_msg->spacing_lon = 8192; - test_msg->ssr_sol_id = 31; - test_msg->tile_id = 512; - test_msg->tile_set_id = 256; - - EXPECT_EQ(send_message(1527, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asbitmask)>( - reinterpret_cast(&last_msg_->bitmask)), - 1234567890) - << "incorrect value for bitmask, expected 1234567890, is " - << last_msg_->bitmask; - EXPECT_EQ(get_ascols)>( - reinterpret_cast(&last_msg_->cols)), - 32768) - << "incorrect value for cols, expected 32768, is " << last_msg_->cols; - EXPECT_EQ(get_ascorner_nw_lat)>( - reinterpret_cast(&last_msg_->corner_nw_lat)), - 1024) - << "incorrect value for corner_nw_lat, expected 1024, is " - << last_msg_->corner_nw_lat; - EXPECT_EQ(get_ascorner_nw_lon)>( - reinterpret_cast(&last_msg_->corner_nw_lon)), - 2048) - << "incorrect value for corner_nw_lon, expected 2048, is " - << last_msg_->corner_nw_lon; - EXPECT_EQ(get_asrows)>( - reinterpret_cast(&last_msg_->rows)), - 16384) - << "incorrect value for rows, expected 16384, is " << last_msg_->rows; - EXPECT_EQ(get_asspacing_lat)>( - reinterpret_cast(&last_msg_->spacing_lat)), - 4096) - << "incorrect value for spacing_lat, expected 4096, is " - << last_msg_->spacing_lat; - EXPECT_EQ(get_asspacing_lon)>( - reinterpret_cast(&last_msg_->spacing_lon)), - 8192) - << "incorrect value for spacing_lon, expected 8192, is " - << last_msg_->spacing_lon; - EXPECT_EQ(get_asssr_sol_id)>( - reinterpret_cast(&last_msg_->ssr_sol_id)), - 31) - << "incorrect value for ssr_sol_id, expected 31, is " - << last_msg_->ssr_sol_id; - EXPECT_EQ(get_astile_id)>( - reinterpret_cast(&last_msg_->tile_id)), - 512) - << "incorrect value for tile_id, expected 512, is " << last_msg_->tile_id; - EXPECT_EQ(get_astile_set_id)>( - reinterpret_cast(&last_msg_->tile_set_id)), - 256) - << "incorrect value for tile_set_id, expected 256, is " - << last_msg_->tile_set_id; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_system_MsgCsacTelemetry.cc b/c/test/legacy/cpp/auto_check_sbp_system_MsgCsacTelemetry.cc deleted file mode 100644 index d715c1b7d5..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_system_MsgCsacTelemetry.cc +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgCsacTelemetry.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_system_MsgCsacTelemetry0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_system_MsgCsacTelemetry0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_csac_telemetry_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_csac_telemetry_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_system_MsgCsacTelemetry0, Test) { - uint8_t encoded_frame[] = { - 85, 4, 255, 244, 169, 10, 105, 115, 111, - 109, 101, 32, 100, 97, 116, 97, 229, 94, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_csac_telemetry_t *test_msg = (msg_csac_telemetry_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->id = 105; - { - const char assign_string[] = {(char)115, (char)111, (char)109, - (char)101, (char)32, (char)100, - (char)97, (char)116, (char)97}; - memcpy(test_msg->telemetry, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->telemetry) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0xff04, 43508, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 43508); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asid)>( - reinterpret_cast(&last_msg_->id)), - 105) - << "incorrect value for id, expected 105, is " << last_msg_->id; - { - const char check_string[] = {(char)115, (char)111, (char)109, - (char)101, (char)32, (char)100, - (char)97, (char)116, (char)97}; - EXPECT_EQ(memcmp(last_msg_->telemetry, check_string, sizeof(check_string)), - 0) - << "incorrect value for last_msg_->telemetry, expected string '" - << check_string << "', is '" << last_msg_->telemetry << "'"; - } -} diff --git a/c/test/legacy/cpp/auto_check_sbp_system_MsgCsacTelemetryLabels.cc b/c/test/legacy/cpp/auto_check_sbp_system_MsgCsacTelemetryLabels.cc deleted file mode 100644 index 1ab51f6403..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_system_MsgCsacTelemetryLabels.cc +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgCsacTelemetryLabels.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_system_MsgCsacTelemetryLabels0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_system_MsgCsacTelemetryLabels0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_csac_telemetry_labels_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_csac_telemetry_labels_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_system_MsgCsacTelemetryLabels0, Test) { - uint8_t encoded_frame[] = { - 85, 5, 255, 91, 200, 12, 186, 115, 111, 109, - 101, 32, 108, 97, 98, 101, 108, 115, 86, 236, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_csac_telemetry_labels_t *test_msg = - (msg_csac_telemetry_labels_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->id = 186; - { - const char assign_string[] = {(char)115, (char)111, (char)109, (char)101, - (char)32, (char)108, (char)97, (char)98, - (char)101, (char)108, (char)115}; - memcpy(test_msg->telemetry_labels, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->telemetry_labels) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0xff05, 51291, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 51291); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asid)>( - reinterpret_cast(&last_msg_->id)), - 186) - << "incorrect value for id, expected 186, is " << last_msg_->id; - { - const char check_string[] = {(char)115, (char)111, (char)109, (char)101, - (char)32, (char)108, (char)97, (char)98, - (char)101, (char)108, (char)115}; - EXPECT_EQ( - memcmp(last_msg_->telemetry_labels, check_string, sizeof(check_string)), - 0) - << "incorrect value for last_msg_->telemetry_labels, expected string '" - << check_string << "', is '" << last_msg_->telemetry_labels << "'"; - } -} diff --git a/c/test/legacy/cpp/auto_check_sbp_system_MsgDgnssStatus.cc b/c/test/legacy/cpp/auto_check_sbp_system_MsgDgnssStatus.cc deleted file mode 100644 index 00d3ce0aa2..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_system_MsgDgnssStatus.cc +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgDgnssStatus.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_system_MsgDgnssStatus0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_system_MsgDgnssStatus0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_dgnss_status_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_dgnss_status_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_system_MsgDgnssStatus0, Test) { - uint8_t encoded_frame[] = { - 85, 2, 255, 66, 0, 11, 0, 50, 0, 12, - 83, 107, 121, 108, 97, 114, 107, 202, 1, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_dgnss_status_t *test_msg = (msg_dgnss_status_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->latency = 50; - test_msg->num_signals = 12; - { - const char assign_string[] = {(char)83, (char)107, (char)121, (char)108, - (char)97, (char)114, (char)107}; - memcpy(test_msg->source, assign_string, sizeof(assign_string)); - if (sizeof(test_msg->source) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - - EXPECT_EQ(send_message(0xff02, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_aslatency)>( - reinterpret_cast(&last_msg_->latency)), - 50) - << "incorrect value for latency, expected 50, is " << last_msg_->latency; - EXPECT_EQ(get_asnum_signals)>( - reinterpret_cast(&last_msg_->num_signals)), - 12) - << "incorrect value for num_signals, expected 12, is " - << last_msg_->num_signals; - { - const char check_string[] = {(char)83, (char)107, (char)121, (char)108, - (char)97, (char)114, (char)107}; - EXPECT_EQ(memcmp(last_msg_->source, check_string, sizeof(check_string)), 0) - << "incorrect value for last_msg_->source, expected string '" - << check_string << "', is '" << last_msg_->source << "'"; - } -} diff --git a/c/test/legacy/cpp/auto_check_sbp_system_MsgGnssTimeOffset.cc b/c/test/legacy/cpp/auto_check_sbp_system_MsgGnssTimeOffset.cc deleted file mode 100644 index 1edf238fb6..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_system_MsgGnssTimeOffset.cc +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgGnssTimeOffset.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_system_MsgGnssTimeOffset0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_system_MsgGnssTimeOffset0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_gnss_time_offset_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_gnss_time_offset_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_system_MsgGnssTimeOffset0, Test) { - uint8_t encoded_frame[] = { - 85, 7, 255, 22, 15, 9, 9, 58, 82, 83, 9, 103, 22, 37, 221, 84, 100, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_gnss_time_offset_t *test_msg = (msg_gnss_time_offset_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 221; - test_msg->microseconds = 9494; - test_msg->milliseconds = 1728664402; - test_msg->weeks = 14857; - - EXPECT_EQ(send_message(0xff07, 3862, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 3862); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 221) - << "incorrect value for flags, expected 221, is " << last_msg_->flags; - EXPECT_EQ(get_asmicroseconds)>( - reinterpret_cast(&last_msg_->microseconds)), - 9494) - << "incorrect value for microseconds, expected 9494, is " - << last_msg_->microseconds; - EXPECT_EQ(get_asmilliseconds)>( - reinterpret_cast(&last_msg_->milliseconds)), - 1728664402) - << "incorrect value for milliseconds, expected 1728664402, is " - << last_msg_->milliseconds; - EXPECT_EQ(get_asweeks)>( - reinterpret_cast(&last_msg_->weeks)), - 14857) - << "incorrect value for weeks, expected 14857, is " << last_msg_->weeks; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_system_MsgGroupMeta.cc b/c/test/legacy/cpp/auto_check_sbp_system_MsgGroupMeta.cc deleted file mode 100644 index 400fa2f20e..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_system_MsgGroupMeta.cc +++ /dev/null @@ -1,405 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgGroupMeta.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_system_MsgGroupMeta0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_system_MsgGroupMeta0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_group_meta_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_group_meta_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_system_MsgGroupMeta0, Test) { - uint8_t encoded_frame[] = { - 85, 10, 255, 238, 238, 9, 1, 2, 3, 10, 255, 10, 2, 2, 255, 2, 14, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_group_meta_t *test_msg = (msg_group_meta_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 2; - test_msg->group_id = 1; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->group_msgs[0])); - } - test_msg->group_msgs[0] = 65290; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->group_msgs[0])); - } - test_msg->group_msgs[1] = 522; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->group_msgs[0])); - } - test_msg->group_msgs[2] = 65282; - test_msg->n_group_msgs = 3; - - EXPECT_EQ(send_message(0xFF0A, 61166, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 61166); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 2) - << "incorrect value for flags, expected 2, is " << last_msg_->flags; - EXPECT_EQ(get_asgroup_id)>( - reinterpret_cast(&last_msg_->group_id)), - 1) - << "incorrect value for group_id, expected 1, is " << last_msg_->group_id; - EXPECT_EQ(get_asgroup_msgs[0])>( - reinterpret_cast(&last_msg_->group_msgs[0])), - 65290) - << "incorrect value for group_msgs[0], expected 65290, is " - << last_msg_->group_msgs[0]; - EXPECT_EQ(get_asgroup_msgs[1])>( - reinterpret_cast(&last_msg_->group_msgs[1])), - 522) - << "incorrect value for group_msgs[1], expected 522, is " - << last_msg_->group_msgs[1]; - EXPECT_EQ(get_asgroup_msgs[2])>( - reinterpret_cast(&last_msg_->group_msgs[2])), - 65282) - << "incorrect value for group_msgs[2], expected 65282, is " - << last_msg_->group_msgs[2]; - EXPECT_EQ(get_asn_group_msgs)>( - reinterpret_cast(&last_msg_->n_group_msgs)), - 3) - << "incorrect value for n_group_msgs, expected 3, is " - << last_msg_->n_group_msgs; -} -class Test_legacy_auto_check_sbp_system_MsgGroupMeta1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_system_MsgGroupMeta1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_group_meta_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_group_meta_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_system_MsgGroupMeta1, Test) { - uint8_t encoded_frame[] = { - 85, 10, 255, 21, 3, 31, 1, 1, 14, 2, 1, 3, 1, - 10, 2, 17, 2, 9, 2, 20, 2, 14, 2, 18, 2, 13, - 2, 21, 2, 33, 2, 3, 255, 6, 255, 14, 255, 82, 154, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_group_meta_t *test_msg = (msg_group_meta_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 1; - test_msg->group_id = 1; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->group_msgs[0])); - } - test_msg->group_msgs[0] = 258; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->group_msgs[0])); - } - test_msg->group_msgs[1] = 259; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->group_msgs[0])); - } - test_msg->group_msgs[2] = 522; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->group_msgs[0])); - } - test_msg->group_msgs[3] = 529; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->group_msgs[0])); - } - test_msg->group_msgs[4] = 521; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->group_msgs[0])); - } - test_msg->group_msgs[5] = 532; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->group_msgs[0])); - } - test_msg->group_msgs[6] = 526; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->group_msgs[0])); - } - test_msg->group_msgs[7] = 530; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->group_msgs[0])); - } - test_msg->group_msgs[8] = 525; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->group_msgs[0])); - } - test_msg->group_msgs[9] = 533; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->group_msgs[0])); - } - test_msg->group_msgs[10] = 545; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->group_msgs[0])); - } - test_msg->group_msgs[11] = 65283; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->group_msgs[0])); - } - test_msg->group_msgs[12] = 65286; - if (sizeof(test_msg->group_msgs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->group_msgs[0])); - } - test_msg->group_msgs[13] = 65294; - test_msg->n_group_msgs = 14; - - EXPECT_EQ(send_message(0xFF0A, 789, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 789); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_asgroup_id)>( - reinterpret_cast(&last_msg_->group_id)), - 1) - << "incorrect value for group_id, expected 1, is " << last_msg_->group_id; - EXPECT_EQ(get_asgroup_msgs[0])>( - reinterpret_cast(&last_msg_->group_msgs[0])), - 258) - << "incorrect value for group_msgs[0], expected 258, is " - << last_msg_->group_msgs[0]; - EXPECT_EQ(get_asgroup_msgs[1])>( - reinterpret_cast(&last_msg_->group_msgs[1])), - 259) - << "incorrect value for group_msgs[1], expected 259, is " - << last_msg_->group_msgs[1]; - EXPECT_EQ(get_asgroup_msgs[2])>( - reinterpret_cast(&last_msg_->group_msgs[2])), - 522) - << "incorrect value for group_msgs[2], expected 522, is " - << last_msg_->group_msgs[2]; - EXPECT_EQ(get_asgroup_msgs[3])>( - reinterpret_cast(&last_msg_->group_msgs[3])), - 529) - << "incorrect value for group_msgs[3], expected 529, is " - << last_msg_->group_msgs[3]; - EXPECT_EQ(get_asgroup_msgs[4])>( - reinterpret_cast(&last_msg_->group_msgs[4])), - 521) - << "incorrect value for group_msgs[4], expected 521, is " - << last_msg_->group_msgs[4]; - EXPECT_EQ(get_asgroup_msgs[5])>( - reinterpret_cast(&last_msg_->group_msgs[5])), - 532) - << "incorrect value for group_msgs[5], expected 532, is " - << last_msg_->group_msgs[5]; - EXPECT_EQ(get_asgroup_msgs[6])>( - reinterpret_cast(&last_msg_->group_msgs[6])), - 526) - << "incorrect value for group_msgs[6], expected 526, is " - << last_msg_->group_msgs[6]; - EXPECT_EQ(get_asgroup_msgs[7])>( - reinterpret_cast(&last_msg_->group_msgs[7])), - 530) - << "incorrect value for group_msgs[7], expected 530, is " - << last_msg_->group_msgs[7]; - EXPECT_EQ(get_asgroup_msgs[8])>( - reinterpret_cast(&last_msg_->group_msgs[8])), - 525) - << "incorrect value for group_msgs[8], expected 525, is " - << last_msg_->group_msgs[8]; - EXPECT_EQ(get_asgroup_msgs[9])>( - reinterpret_cast(&last_msg_->group_msgs[9])), - 533) - << "incorrect value for group_msgs[9], expected 533, is " - << last_msg_->group_msgs[9]; - EXPECT_EQ(get_asgroup_msgs[10])>( - reinterpret_cast(&last_msg_->group_msgs[10])), - 545) - << "incorrect value for group_msgs[10], expected 545, is " - << last_msg_->group_msgs[10]; - EXPECT_EQ(get_asgroup_msgs[11])>( - reinterpret_cast(&last_msg_->group_msgs[11])), - 65283) - << "incorrect value for group_msgs[11], expected 65283, is " - << last_msg_->group_msgs[11]; - EXPECT_EQ(get_asgroup_msgs[12])>( - reinterpret_cast(&last_msg_->group_msgs[12])), - 65286) - << "incorrect value for group_msgs[12], expected 65286, is " - << last_msg_->group_msgs[12]; - EXPECT_EQ(get_asgroup_msgs[13])>( - reinterpret_cast(&last_msg_->group_msgs[13])), - 65294) - << "incorrect value for group_msgs[13], expected 65294, is " - << last_msg_->group_msgs[13]; - EXPECT_EQ(get_asn_group_msgs)>( - reinterpret_cast(&last_msg_->n_group_msgs)), - 14) - << "incorrect value for n_group_msgs, expected 14, is " - << last_msg_->n_group_msgs; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_system_MsgHeartbeat.cc b/c/test/legacy/cpp/auto_check_sbp_system_MsgHeartbeat.cc deleted file mode 100644 index 558a74de92..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_system_MsgHeartbeat.cc +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgHeartbeat.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_system_MsgHeartbeat0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_system_MsgHeartbeat0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_heartbeat_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_heartbeat_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_system_MsgHeartbeat0, Test) { - uint8_t encoded_frame[] = { - 85, 255, 255, 246, 215, 4, 0, 50, 0, 0, 249, 216, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_heartbeat_t *test_msg = (msg_heartbeat_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 12800; - - EXPECT_EQ(send_message(0xffff, 55286, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 12800) - << "incorrect value for flags, expected 12800, is " << last_msg_->flags; -} -class Test_legacy_auto_check_sbp_system_MsgHeartbeat1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_system_MsgHeartbeat1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_heartbeat_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_heartbeat_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_system_MsgHeartbeat1, Test) { - uint8_t encoded_frame[] = { - 85, 255, 255, 195, 4, 4, 0, 0, 0, 0, 66, 57, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_heartbeat_t *test_msg = (msg_heartbeat_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - - EXPECT_EQ(send_message(0xffff, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_system_MsgInsStatus.cc b/c/test/legacy/cpp/auto_check_sbp_system_MsgInsStatus.cc deleted file mode 100644 index 9a0d67ad43..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_system_MsgInsStatus.cc +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgInsStatus.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_system_MsgInsStatus0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_system_MsgInsStatus0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ins_status_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ins_status_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_system_MsgInsStatus0, Test) { - uint8_t encoded_frame[] = { - 85, 3, 255, 21, 3, 4, 9, 0, 0, 32, 36, 103, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ins_status_t *test_msg = (msg_ins_status_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 536870921; - - EXPECT_EQ(send_message(0xff03, 789, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 789); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 536870921) - << "incorrect value for flags, expected 536870921, is " - << last_msg_->flags; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_system_MsgInsUpdates.cc b/c/test/legacy/cpp/auto_check_sbp_system_MsgInsUpdates.cc deleted file mode 100644 index 3095d77105..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_system_MsgInsUpdates.cc +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgInsUpdates.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_system_MsgInsUpdates0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_system_MsgInsUpdates0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_ins_updates_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_ins_updates_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_system_MsgInsUpdates0, Test) { - uint8_t encoded_frame[] = { - 85, 6, 255, 21, 3, 10, 84, 229, 17, 30, 0, 0, 0, 0, 0, 0, 81, 63, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_ins_updates_t *test_msg = (msg_ins_updates_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->gnsspos = 0; - test_msg->gnssvel = 0; - test_msg->nhc = 0; - test_msg->speed = 0; - test_msg->tow = 504489300; - test_msg->wheelticks = 0; - test_msg->zerovel = 0; - - EXPECT_EQ(send_message(0xff06, 789, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 789); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asgnsspos)>( - reinterpret_cast(&last_msg_->gnsspos)), - 0) - << "incorrect value for gnsspos, expected 0, is " << last_msg_->gnsspos; - EXPECT_EQ(get_asgnssvel)>( - reinterpret_cast(&last_msg_->gnssvel)), - 0) - << "incorrect value for gnssvel, expected 0, is " << last_msg_->gnssvel; - EXPECT_EQ(get_asnhc)>( - reinterpret_cast(&last_msg_->nhc)), - 0) - << "incorrect value for nhc, expected 0, is " << last_msg_->nhc; - EXPECT_EQ(get_asspeed)>( - reinterpret_cast(&last_msg_->speed)), - 0) - << "incorrect value for speed, expected 0, is " << last_msg_->speed; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 504489300) - << "incorrect value for tow, expected 504489300, is " << last_msg_->tow; - EXPECT_EQ(get_aswheelticks)>( - reinterpret_cast(&last_msg_->wheelticks)), - 0) - << "incorrect value for wheelticks, expected 0, is " - << last_msg_->wheelticks; - EXPECT_EQ(get_aszerovel)>( - reinterpret_cast(&last_msg_->zerovel)), - 0) - << "incorrect value for zerovel, expected 0, is " << last_msg_->zerovel; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_system_MsgPpsTime.cc b/c/test/legacy/cpp/auto_check_sbp_system_MsgPpsTime.cc deleted file mode 100644 index 8289d16d47..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_system_MsgPpsTime.cc +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgPpsTime.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_system_MsgPpsTime0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_system_MsgPpsTime0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_pps_time_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_pps_time_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_system_MsgPpsTime0, Test) { - uint8_t encoded_frame[] = { - 85, 8, 255, 222, 209, 9, 140, 146, 133, 197, 160, 0, 0, 0, 255, 125, 149, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_pps_time_t *test_msg = (msg_pps_time_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 255; - test_msg->time = 690508632716; - - EXPECT_EQ(send_message(0xff08, 53726, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 53726); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 255) - << "incorrect value for flags, expected 255, is " << last_msg_->flags; - EXPECT_EQ(get_astime)>( - reinterpret_cast(&last_msg_->time)), - 690508632716) - << "incorrect value for time, expected 690508632716, is " - << last_msg_->time; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_system_MsgSensorAidEvent.cc b/c/test/legacy/cpp/auto_check_sbp_system_MsgSensorAidEvent.cc deleted file mode 100644 index a56ee9de8a..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_system_MsgSensorAidEvent.cc +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgSensorAidEvent.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_system_MsgSensorAidEvent0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_system_MsgSensorAidEvent0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_sensor_aid_event_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_sensor_aid_event_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_system_MsgSensorAidEvent0, Test) { - uint8_t encoded_frame[] = { - 85, 9, 255, 211, 136, 15, 48, 246, 122, 19, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 236, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_sensor_aid_event_t *test_msg = (msg_sensor_aid_event_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 0; - test_msg->n_accepted_meas = 0; - test_msg->n_attempted_meas = 0; - test_msg->n_available_meas = 0; - test_msg->sensor_id = 0; - test_msg->sensor_state = 0; - test_msg->sensor_type = 0; - test_msg->time = 326825520; - - EXPECT_EQ(send_message(0xFF09, 35027, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 0) - << "incorrect value for flags, expected 0, is " << last_msg_->flags; - EXPECT_EQ(get_asn_accepted_meas)>( - reinterpret_cast(&last_msg_->n_accepted_meas)), - 0) - << "incorrect value for n_accepted_meas, expected 0, is " - << last_msg_->n_accepted_meas; - EXPECT_EQ( - get_asn_attempted_meas)>( - reinterpret_cast(&last_msg_->n_attempted_meas)), - 0) - << "incorrect value for n_attempted_meas, expected 0, is " - << last_msg_->n_attempted_meas; - EXPECT_EQ( - get_asn_available_meas)>( - reinterpret_cast(&last_msg_->n_available_meas)), - 0) - << "incorrect value for n_available_meas, expected 0, is " - << last_msg_->n_available_meas; - EXPECT_EQ(get_assensor_id)>( - reinterpret_cast(&last_msg_->sensor_id)), - 0) - << "incorrect value for sensor_id, expected 0, is " - << last_msg_->sensor_id; - EXPECT_EQ(get_assensor_state)>( - reinterpret_cast(&last_msg_->sensor_state)), - 0) - << "incorrect value for sensor_state, expected 0, is " - << last_msg_->sensor_state; - EXPECT_EQ(get_assensor_type)>( - reinterpret_cast(&last_msg_->sensor_type)), - 0) - << "incorrect value for sensor_type, expected 0, is " - << last_msg_->sensor_type; - EXPECT_EQ(get_astime)>( - reinterpret_cast(&last_msg_->time)), - 326825520) - << "incorrect value for time, expected 326825520, is " << last_msg_->time; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_system_MsgStartup.cc b/c/test/legacy/cpp/auto_check_sbp_system_MsgStartup.cc deleted file mode 100644 index aa996a9c99..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_system_MsgStartup.cc +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgStartup.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_system_MsgStartup0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_system_MsgStartup0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_startup_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_startup_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_system_MsgStartup0, Test) { - uint8_t encoded_frame[] = { - 85, 0, 255, 66, 0, 4, 0, 0, 0, 0, 70, 160, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_startup_t *test_msg = (msg_startup_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cause = 0; - test_msg->reserved = 0; - test_msg->startup_type = 0; - - EXPECT_EQ(send_message(0xff00, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascause)>( - reinterpret_cast(&last_msg_->cause)), - 0) - << "incorrect value for cause, expected 0, is " << last_msg_->cause; - EXPECT_EQ(get_asreserved)>( - reinterpret_cast(&last_msg_->reserved)), - 0) - << "incorrect value for reserved, expected 0, is " << last_msg_->reserved; - EXPECT_EQ(get_asstartup_type)>( - reinterpret_cast(&last_msg_->startup_type)), - 0) - << "incorrect value for startup_type, expected 0, is " - << last_msg_->startup_type; -} -class Test_legacy_auto_check_sbp_system_MsgStartup1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_system_MsgStartup1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_startup_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_startup_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_system_MsgStartup1, Test) { - uint8_t encoded_frame[] = { - 85, 0, 255, 195, 4, 4, 0, 0, 0, 0, 127, 181, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_startup_t *test_msg = (msg_startup_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->cause = 0; - test_msg->reserved = 0; - test_msg->startup_type = 0; - - EXPECT_EQ(send_message(0xff00, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascause)>( - reinterpret_cast(&last_msg_->cause)), - 0) - << "incorrect value for cause, expected 0, is " << last_msg_->cause; - EXPECT_EQ(get_asreserved)>( - reinterpret_cast(&last_msg_->reserved)), - 0) - << "incorrect value for reserved, expected 0, is " << last_msg_->reserved; - EXPECT_EQ(get_asstartup_type)>( - reinterpret_cast(&last_msg_->startup_type)), - 0) - << "incorrect value for startup_type, expected 0, is " - << last_msg_->startup_type; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_system_MsgStatusJournal.cc b/c/test/legacy/cpp/auto_check_sbp_system_MsgStatusJournal.cc deleted file mode 100644 index 24cbb8d8ef..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_system_MsgStatusJournal.cc +++ /dev/null @@ -1,387 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgStatusJournal.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_system_MsgStatusJournal0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_system_MsgStatusJournal0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_status_journal_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_status_journal_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_system_MsgStatusJournal0, Test) { - uint8_t encoded_frame[] = { - 85, 253, 255, 211, 136, 33, 1, 0, 1, 4, 100, 0, 0, 0, - 16, 146, 16, 0, 0, 6, 0, 1, 13, 186, 19, 0, 0, 6, - 0, 1, 14, 184, 34, 0, 0, 6, 0, 1, 15, 113, 119, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_status_journal_t *test_msg = (msg_status_journal_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->journal) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->journal[0])); - } - test_msg->journal[0].report.component = 6; - test_msg->journal[0].report.generic = 1; - test_msg->journal[0].report.specific = 13; - test_msg->journal[0].uptime = 4242; - if (sizeof(test_msg->journal) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->journal[0])); - } - test_msg->journal[1].report.component = 6; - test_msg->journal[1].report.generic = 1; - test_msg->journal[1].report.specific = 14; - test_msg->journal[1].uptime = 5050; - if (sizeof(test_msg->journal) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->journal[0])); - } - test_msg->journal[2].report.component = 6; - test_msg->journal[2].report.generic = 1; - test_msg->journal[2].report.specific = 15; - test_msg->journal[2].uptime = 8888; - test_msg->reporting_system = 1; - test_msg->sbp_version = 1025; - test_msg->sequence_descriptor = 16; - test_msg->total_status_reports = 100; - - EXPECT_EQ(send_message(0xFFFD, 35027, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asjournal[0].report.component)>( - reinterpret_cast( - &last_msg_->journal[0].report.component)), - 6) - << "incorrect value for journal[0].report.component, expected 6, is " - << last_msg_->journal[0].report.component; - EXPECT_EQ(get_asjournal[0].report.generic)>( - reinterpret_cast( - &last_msg_->journal[0].report.generic)), - 1) - << "incorrect value for journal[0].report.generic, expected 1, is " - << last_msg_->journal[0].report.generic; - EXPECT_EQ(get_asjournal[0].report.specific)>( - reinterpret_cast( - &last_msg_->journal[0].report.specific)), - 13) - << "incorrect value for journal[0].report.specific, expected 13, is " - << last_msg_->journal[0].report.specific; - EXPECT_EQ( - get_asjournal[0].uptime)>( - reinterpret_cast(&last_msg_->journal[0].uptime)), - 4242) - << "incorrect value for journal[0].uptime, expected 4242, is " - << last_msg_->journal[0].uptime; - EXPECT_EQ(get_asjournal[1].report.component)>( - reinterpret_cast( - &last_msg_->journal[1].report.component)), - 6) - << "incorrect value for journal[1].report.component, expected 6, is " - << last_msg_->journal[1].report.component; - EXPECT_EQ(get_asjournal[1].report.generic)>( - reinterpret_cast( - &last_msg_->journal[1].report.generic)), - 1) - << "incorrect value for journal[1].report.generic, expected 1, is " - << last_msg_->journal[1].report.generic; - EXPECT_EQ(get_asjournal[1].report.specific)>( - reinterpret_cast( - &last_msg_->journal[1].report.specific)), - 14) - << "incorrect value for journal[1].report.specific, expected 14, is " - << last_msg_->journal[1].report.specific; - EXPECT_EQ( - get_asjournal[1].uptime)>( - reinterpret_cast(&last_msg_->journal[1].uptime)), - 5050) - << "incorrect value for journal[1].uptime, expected 5050, is " - << last_msg_->journal[1].uptime; - EXPECT_EQ(get_asjournal[2].report.component)>( - reinterpret_cast( - &last_msg_->journal[2].report.component)), - 6) - << "incorrect value for journal[2].report.component, expected 6, is " - << last_msg_->journal[2].report.component; - EXPECT_EQ(get_asjournal[2].report.generic)>( - reinterpret_cast( - &last_msg_->journal[2].report.generic)), - 1) - << "incorrect value for journal[2].report.generic, expected 1, is " - << last_msg_->journal[2].report.generic; - EXPECT_EQ(get_asjournal[2].report.specific)>( - reinterpret_cast( - &last_msg_->journal[2].report.specific)), - 15) - << "incorrect value for journal[2].report.specific, expected 15, is " - << last_msg_->journal[2].report.specific; - EXPECT_EQ( - get_asjournal[2].uptime)>( - reinterpret_cast(&last_msg_->journal[2].uptime)), - 8888) - << "incorrect value for journal[2].uptime, expected 8888, is " - << last_msg_->journal[2].uptime; - EXPECT_EQ( - get_asreporting_system)>( - reinterpret_cast(&last_msg_->reporting_system)), - 1) - << "incorrect value for reporting_system, expected 1, is " - << last_msg_->reporting_system; - EXPECT_EQ(get_assbp_version)>( - reinterpret_cast(&last_msg_->sbp_version)), - 1025) - << "incorrect value for sbp_version, expected 1025, is " - << last_msg_->sbp_version; - EXPECT_EQ( - get_assequence_descriptor)>( - reinterpret_cast(&last_msg_->sequence_descriptor)), - 16) - << "incorrect value for sequence_descriptor, expected 16, is " - << last_msg_->sequence_descriptor; - EXPECT_EQ( - get_astotal_status_reports)>( - reinterpret_cast(&last_msg_->total_status_reports)), - 100) - << "incorrect value for total_status_reports, expected 100, is " - << last_msg_->total_status_reports; -} -class Test_legacy_auto_check_sbp_system_MsgStatusJournal1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_system_MsgStatusJournal1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_status_journal_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_status_journal_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_system_MsgStatusJournal1, Test) { - uint8_t encoded_frame[] = { - 85, 253, 255, 211, 136, 17, 1, 0, 1, 4, 100, 0, 0, - 0, 16, 146, 16, 0, 0, 6, 0, 1, 13, 144, 121, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_status_journal_t *test_msg = (msg_status_journal_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->journal) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->journal[0])); - } - test_msg->journal[0].report.component = 6; - test_msg->journal[0].report.generic = 1; - test_msg->journal[0].report.specific = 13; - test_msg->journal[0].uptime = 4242; - test_msg->reporting_system = 1; - test_msg->sbp_version = 1025; - test_msg->sequence_descriptor = 16; - test_msg->total_status_reports = 100; - - EXPECT_EQ(send_message(0xFFFD, 35027, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 35027); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asjournal[0].report.component)>( - reinterpret_cast( - &last_msg_->journal[0].report.component)), - 6) - << "incorrect value for journal[0].report.component, expected 6, is " - << last_msg_->journal[0].report.component; - EXPECT_EQ(get_asjournal[0].report.generic)>( - reinterpret_cast( - &last_msg_->journal[0].report.generic)), - 1) - << "incorrect value for journal[0].report.generic, expected 1, is " - << last_msg_->journal[0].report.generic; - EXPECT_EQ(get_asjournal[0].report.specific)>( - reinterpret_cast( - &last_msg_->journal[0].report.specific)), - 13) - << "incorrect value for journal[0].report.specific, expected 13, is " - << last_msg_->journal[0].report.specific; - EXPECT_EQ( - get_asjournal[0].uptime)>( - reinterpret_cast(&last_msg_->journal[0].uptime)), - 4242) - << "incorrect value for journal[0].uptime, expected 4242, is " - << last_msg_->journal[0].uptime; - EXPECT_EQ( - get_asreporting_system)>( - reinterpret_cast(&last_msg_->reporting_system)), - 1) - << "incorrect value for reporting_system, expected 1, is " - << last_msg_->reporting_system; - EXPECT_EQ(get_assbp_version)>( - reinterpret_cast(&last_msg_->sbp_version)), - 1025) - << "incorrect value for sbp_version, expected 1025, is " - << last_msg_->sbp_version; - EXPECT_EQ( - get_assequence_descriptor)>( - reinterpret_cast(&last_msg_->sequence_descriptor)), - 16) - << "incorrect value for sequence_descriptor, expected 16, is " - << last_msg_->sequence_descriptor; - EXPECT_EQ( - get_astotal_status_reports)>( - reinterpret_cast(&last_msg_->total_status_reports)), - 100) - << "incorrect value for total_status_reports, expected 100, is " - << last_msg_->total_status_reports; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_system_MsgStatusReport.cc b/c/test/legacy/cpp/auto_check_sbp_system_MsgStatusReport.cc deleted file mode 100644 index ed56b36c0d..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_system_MsgStatusReport.cc +++ /dev/null @@ -1,1662 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/system/test_MsgStatusReport.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_system_MsgStatusReport0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_system_MsgStatusReport0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_status_report_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_status_report_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_system_MsgStatusReport0, Test) { - uint8_t encoded_frame[] = { - 85, 254, 255, 6, 84, 252, 82, 253, 177, 95, 3, 60, 143, 90, 233, - 21, 208, 98, 247, 203, 221, 198, 156, 207, 217, 238, 162, 136, 154, 11, - 114, 236, 134, 235, 12, 133, 9, 30, 175, 145, 26, 114, 215, 20, 146, - 249, 54, 54, 133, 193, 106, 186, 210, 183, 0, 129, 5, 248, 225, 149, - 135, 127, 2, 26, 88, 92, 10, 103, 73, 3, 103, 68, 76, 184, 33, - 206, 194, 163, 123, 30, 151, 176, 149, 172, 184, 231, 118, 230, 200, 168, - 100, 109, 10, 233, 4, 60, 247, 82, 215, 166, 28, 138, 110, 45, 98, - 218, 244, 179, 126, 107, 92, 124, 94, 157, 42, 187, 124, 6, 97, 247, - 160, 188, 110, 120, 254, 214, 110, 51, 240, 164, 147, 18, 74, 178, 67, - 4, 27, 73, 190, 64, 179, 146, 125, 153, 192, 46, 202, 66, 248, 46, - 40, 161, 173, 242, 214, 3, 11, 1, 118, 70, 162, 61, 178, 27, 156, - 40, 191, 113, 230, 200, 72, 8, 215, 245, 78, 59, 222, 250, 115, 32, - 33, 30, 211, 170, 145, 92, 157, 75, 24, 169, 6, 55, 62, 8, 107, - 82, 140, 49, 179, 122, 90, 71, 28, 88, 103, 51, 177, 72, 93, 39, - 148, 11, 202, 42, 34, 92, 204, 102, 29, 98, 249, 91, 134, 95, 23, - 248, 192, 20, 83, 195, 95, 180, 54, 36, 186, 75, 64, 20, 157, 133, - 12, 149, 28, 14, 185, 129, 101, 239, 74, 248, 245, 30, 228, 88, 142, - 212, 53, 224, 158, 166, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_status_report_t *test_msg = (msg_status_report_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->reporting_system = 64850; - test_msg->sbp_version = 24497; - test_msg->sequence = 1519336451; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[0].component = 52215; - test_msg->status[0].generic = 221; - test_msg->status[0].specific = 198; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[1].component = 53148; - test_msg->status[1].generic = 217; - test_msg->status[1].specific = 238; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[2].component = 34978; - test_msg->status[2].generic = 154; - test_msg->status[2].specific = 11; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[3].component = 60530; - test_msg->status[3].generic = 134; - test_msg->status[3].specific = 235; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[4].component = 34060; - test_msg->status[4].generic = 9; - test_msg->status[4].specific = 30; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[5].component = 37295; - test_msg->status[5].generic = 26; - test_msg->status[5].specific = 114; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[6].component = 5335; - test_msg->status[6].generic = 146; - test_msg->status[6].specific = 249; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[7].component = 13878; - test_msg->status[7].generic = 133; - test_msg->status[7].specific = 193; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[8].component = 47722; - test_msg->status[8].generic = 210; - test_msg->status[8].specific = 183; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[9].component = 33024; - test_msg->status[9].generic = 5; - test_msg->status[9].specific = 248; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[10].component = 38369; - test_msg->status[10].generic = 135; - test_msg->status[10].specific = 127; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[11].component = 6658; - test_msg->status[11].generic = 88; - test_msg->status[11].specific = 92; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[12].component = 26378; - test_msg->status[12].generic = 73; - test_msg->status[12].specific = 3; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[13].component = 17511; - test_msg->status[13].generic = 76; - test_msg->status[13].specific = 184; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[14].component = 52769; - test_msg->status[14].generic = 194; - test_msg->status[14].specific = 163; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[15].component = 7803; - test_msg->status[15].generic = 151; - test_msg->status[15].specific = 176; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[16].component = 44181; - test_msg->status[16].generic = 184; - test_msg->status[16].specific = 231; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[17].component = 58998; - test_msg->status[17].generic = 200; - test_msg->status[17].specific = 168; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[18].component = 28004; - test_msg->status[18].generic = 10; - test_msg->status[18].specific = 233; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[19].component = 15364; - test_msg->status[19].generic = 247; - test_msg->status[19].specific = 82; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[20].component = 42711; - test_msg->status[20].generic = 28; - test_msg->status[20].specific = 138; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[21].component = 11630; - test_msg->status[21].generic = 98; - test_msg->status[21].specific = 218; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[22].component = 46068; - test_msg->status[22].generic = 126; - test_msg->status[22].specific = 107; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[23].component = 31836; - test_msg->status[23].generic = 94; - test_msg->status[23].specific = 157; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[24].component = 47914; - test_msg->status[24].generic = 124; - test_msg->status[24].specific = 6; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[25].component = 63329; - test_msg->status[25].generic = 160; - test_msg->status[25].specific = 188; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[26].component = 30830; - test_msg->status[26].generic = 254; - test_msg->status[26].specific = 214; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[27].component = 13166; - test_msg->status[27].generic = 240; - test_msg->status[27].specific = 164; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[28].component = 4755; - test_msg->status[28].generic = 74; - test_msg->status[28].specific = 178; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[29].component = 1091; - test_msg->status[29].generic = 27; - test_msg->status[29].specific = 73; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[30].component = 16574; - test_msg->status[30].generic = 179; - test_msg->status[30].specific = 146; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[31].component = 39293; - test_msg->status[31].generic = 192; - test_msg->status[31].specific = 46; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[32].component = 17098; - test_msg->status[32].generic = 248; - test_msg->status[32].specific = 46; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[33].component = 41256; - test_msg->status[33].generic = 173; - test_msg->status[33].specific = 242; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[34].component = 982; - test_msg->status[34].generic = 11; - test_msg->status[34].specific = 1; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[35].component = 18038; - test_msg->status[35].generic = 162; - test_msg->status[35].specific = 61; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[36].component = 7090; - test_msg->status[36].generic = 156; - test_msg->status[36].specific = 40; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[37].component = 29119; - test_msg->status[37].generic = 230; - test_msg->status[37].specific = 200; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[38].component = 2120; - test_msg->status[38].generic = 215; - test_msg->status[38].specific = 245; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[39].component = 15182; - test_msg->status[39].generic = 222; - test_msg->status[39].specific = 250; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[40].component = 8307; - test_msg->status[40].generic = 33; - test_msg->status[40].specific = 30; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[41].component = 43731; - test_msg->status[41].generic = 145; - test_msg->status[41].specific = 92; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[42].component = 19357; - test_msg->status[42].generic = 24; - test_msg->status[42].specific = 169; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[43].component = 14086; - test_msg->status[43].generic = 62; - test_msg->status[43].specific = 8; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[44].component = 21099; - test_msg->status[44].generic = 140; - test_msg->status[44].specific = 49; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[45].component = 31411; - test_msg->status[45].generic = 90; - test_msg->status[45].specific = 71; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[46].component = 22556; - test_msg->status[46].generic = 103; - test_msg->status[46].specific = 51; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[47].component = 18609; - test_msg->status[47].generic = 93; - test_msg->status[47].specific = 39; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[48].component = 2964; - test_msg->status[48].generic = 202; - test_msg->status[48].specific = 42; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[49].component = 23586; - test_msg->status[49].generic = 204; - test_msg->status[49].specific = 102; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[50].component = 25117; - test_msg->status[50].generic = 249; - test_msg->status[50].specific = 91; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[51].component = 24454; - test_msg->status[51].generic = 23; - test_msg->status[51].specific = 248; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[52].component = 5312; - test_msg->status[52].generic = 83; - test_msg->status[52].specific = 195; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[53].component = 46175; - test_msg->status[53].generic = 54; - test_msg->status[53].specific = 36; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[54].component = 19386; - test_msg->status[54].generic = 64; - test_msg->status[54].specific = 20; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[55].component = 34205; - test_msg->status[55].generic = 12; - test_msg->status[55].specific = 149; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[56].component = 3612; - test_msg->status[56].generic = 185; - test_msg->status[56].specific = 129; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[57].component = 61285; - test_msg->status[57].generic = 74; - test_msg->status[57].specific = 248; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[58].component = 7925; - test_msg->status[58].generic = 228; - test_msg->status[58].specific = 88; - if (sizeof(test_msg->status) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->status[0])); - } - test_msg->status[59].component = 54414; - test_msg->status[59].generic = 53; - test_msg->status[59].specific = 224; - test_msg->uptime = 1657804265; - - EXPECT_EQ(send_message(0xfffe, 21510, test_msg_len, test_msg_storage), - SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 21510); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ( - get_asreporting_system)>( - reinterpret_cast(&last_msg_->reporting_system)), - 64850) - << "incorrect value for reporting_system, expected 64850, is " - << last_msg_->reporting_system; - EXPECT_EQ(get_assbp_version)>( - reinterpret_cast(&last_msg_->sbp_version)), - 24497) - << "incorrect value for sbp_version, expected 24497, is " - << last_msg_->sbp_version; - EXPECT_EQ(get_assequence)>( - reinterpret_cast(&last_msg_->sequence)), - 1519336451) - << "incorrect value for sequence, expected 1519336451, is " - << last_msg_->sequence; - EXPECT_EQ( - get_asstatus[0].component)>( - reinterpret_cast(&last_msg_->status[0].component)), - 52215) - << "incorrect value for status[0].component, expected 52215, is " - << last_msg_->status[0].component; - EXPECT_EQ( - get_asstatus[0].generic)>( - reinterpret_cast(&last_msg_->status[0].generic)), - 221) - << "incorrect value for status[0].generic, expected 221, is " - << last_msg_->status[0].generic; - EXPECT_EQ( - get_asstatus[0].specific)>( - reinterpret_cast(&last_msg_->status[0].specific)), - 198) - << "incorrect value for status[0].specific, expected 198, is " - << last_msg_->status[0].specific; - EXPECT_EQ( - get_asstatus[1].component)>( - reinterpret_cast(&last_msg_->status[1].component)), - 53148) - << "incorrect value for status[1].component, expected 53148, is " - << last_msg_->status[1].component; - EXPECT_EQ( - get_asstatus[1].generic)>( - reinterpret_cast(&last_msg_->status[1].generic)), - 217) - << "incorrect value for status[1].generic, expected 217, is " - << last_msg_->status[1].generic; - EXPECT_EQ( - get_asstatus[1].specific)>( - reinterpret_cast(&last_msg_->status[1].specific)), - 238) - << "incorrect value for status[1].specific, expected 238, is " - << last_msg_->status[1].specific; - EXPECT_EQ( - get_asstatus[2].component)>( - reinterpret_cast(&last_msg_->status[2].component)), - 34978) - << "incorrect value for status[2].component, expected 34978, is " - << last_msg_->status[2].component; - EXPECT_EQ( - get_asstatus[2].generic)>( - reinterpret_cast(&last_msg_->status[2].generic)), - 154) - << "incorrect value for status[2].generic, expected 154, is " - << last_msg_->status[2].generic; - EXPECT_EQ( - get_asstatus[2].specific)>( - reinterpret_cast(&last_msg_->status[2].specific)), - 11) - << "incorrect value for status[2].specific, expected 11, is " - << last_msg_->status[2].specific; - EXPECT_EQ( - get_asstatus[3].component)>( - reinterpret_cast(&last_msg_->status[3].component)), - 60530) - << "incorrect value for status[3].component, expected 60530, is " - << last_msg_->status[3].component; - EXPECT_EQ( - get_asstatus[3].generic)>( - reinterpret_cast(&last_msg_->status[3].generic)), - 134) - << "incorrect value for status[3].generic, expected 134, is " - << last_msg_->status[3].generic; - EXPECT_EQ( - get_asstatus[3].specific)>( - reinterpret_cast(&last_msg_->status[3].specific)), - 235) - << "incorrect value for status[3].specific, expected 235, is " - << last_msg_->status[3].specific; - EXPECT_EQ( - get_asstatus[4].component)>( - reinterpret_cast(&last_msg_->status[4].component)), - 34060) - << "incorrect value for status[4].component, expected 34060, is " - << last_msg_->status[4].component; - EXPECT_EQ( - get_asstatus[4].generic)>( - reinterpret_cast(&last_msg_->status[4].generic)), - 9) - << "incorrect value for status[4].generic, expected 9, is " - << last_msg_->status[4].generic; - EXPECT_EQ( - get_asstatus[4].specific)>( - reinterpret_cast(&last_msg_->status[4].specific)), - 30) - << "incorrect value for status[4].specific, expected 30, is " - << last_msg_->status[4].specific; - EXPECT_EQ( - get_asstatus[5].component)>( - reinterpret_cast(&last_msg_->status[5].component)), - 37295) - << "incorrect value for status[5].component, expected 37295, is " - << last_msg_->status[5].component; - EXPECT_EQ( - get_asstatus[5].generic)>( - reinterpret_cast(&last_msg_->status[5].generic)), - 26) - << "incorrect value for status[5].generic, expected 26, is " - << last_msg_->status[5].generic; - EXPECT_EQ( - get_asstatus[5].specific)>( - reinterpret_cast(&last_msg_->status[5].specific)), - 114) - << "incorrect value for status[5].specific, expected 114, is " - << last_msg_->status[5].specific; - EXPECT_EQ( - get_asstatus[6].component)>( - reinterpret_cast(&last_msg_->status[6].component)), - 5335) - << "incorrect value for status[6].component, expected 5335, is " - << last_msg_->status[6].component; - EXPECT_EQ( - get_asstatus[6].generic)>( - reinterpret_cast(&last_msg_->status[6].generic)), - 146) - << "incorrect value for status[6].generic, expected 146, is " - << last_msg_->status[6].generic; - EXPECT_EQ( - get_asstatus[6].specific)>( - reinterpret_cast(&last_msg_->status[6].specific)), - 249) - << "incorrect value for status[6].specific, expected 249, is " - << last_msg_->status[6].specific; - EXPECT_EQ( - get_asstatus[7].component)>( - reinterpret_cast(&last_msg_->status[7].component)), - 13878) - << "incorrect value for status[7].component, expected 13878, is " - << last_msg_->status[7].component; - EXPECT_EQ( - get_asstatus[7].generic)>( - reinterpret_cast(&last_msg_->status[7].generic)), - 133) - << "incorrect value for status[7].generic, expected 133, is " - << last_msg_->status[7].generic; - EXPECT_EQ( - get_asstatus[7].specific)>( - reinterpret_cast(&last_msg_->status[7].specific)), - 193) - << "incorrect value for status[7].specific, expected 193, is " - << last_msg_->status[7].specific; - EXPECT_EQ( - get_asstatus[8].component)>( - reinterpret_cast(&last_msg_->status[8].component)), - 47722) - << "incorrect value for status[8].component, expected 47722, is " - << last_msg_->status[8].component; - EXPECT_EQ( - get_asstatus[8].generic)>( - reinterpret_cast(&last_msg_->status[8].generic)), - 210) - << "incorrect value for status[8].generic, expected 210, is " - << last_msg_->status[8].generic; - EXPECT_EQ( - get_asstatus[8].specific)>( - reinterpret_cast(&last_msg_->status[8].specific)), - 183) - << "incorrect value for status[8].specific, expected 183, is " - << last_msg_->status[8].specific; - EXPECT_EQ( - get_asstatus[9].component)>( - reinterpret_cast(&last_msg_->status[9].component)), - 33024) - << "incorrect value for status[9].component, expected 33024, is " - << last_msg_->status[9].component; - EXPECT_EQ( - get_asstatus[9].generic)>( - reinterpret_cast(&last_msg_->status[9].generic)), - 5) - << "incorrect value for status[9].generic, expected 5, is " - << last_msg_->status[9].generic; - EXPECT_EQ( - get_asstatus[9].specific)>( - reinterpret_cast(&last_msg_->status[9].specific)), - 248) - << "incorrect value for status[9].specific, expected 248, is " - << last_msg_->status[9].specific; - EXPECT_EQ( - get_asstatus[10].component)>( - reinterpret_cast(&last_msg_->status[10].component)), - 38369) - << "incorrect value for status[10].component, expected 38369, is " - << last_msg_->status[10].component; - EXPECT_EQ( - get_asstatus[10].generic)>( - reinterpret_cast(&last_msg_->status[10].generic)), - 135) - << "incorrect value for status[10].generic, expected 135, is " - << last_msg_->status[10].generic; - EXPECT_EQ( - get_asstatus[10].specific)>( - reinterpret_cast(&last_msg_->status[10].specific)), - 127) - << "incorrect value for status[10].specific, expected 127, is " - << last_msg_->status[10].specific; - EXPECT_EQ( - get_asstatus[11].component)>( - reinterpret_cast(&last_msg_->status[11].component)), - 6658) - << "incorrect value for status[11].component, expected 6658, is " - << last_msg_->status[11].component; - EXPECT_EQ( - get_asstatus[11].generic)>( - reinterpret_cast(&last_msg_->status[11].generic)), - 88) - << "incorrect value for status[11].generic, expected 88, is " - << last_msg_->status[11].generic; - EXPECT_EQ( - get_asstatus[11].specific)>( - reinterpret_cast(&last_msg_->status[11].specific)), - 92) - << "incorrect value for status[11].specific, expected 92, is " - << last_msg_->status[11].specific; - EXPECT_EQ( - get_asstatus[12].component)>( - reinterpret_cast(&last_msg_->status[12].component)), - 26378) - << "incorrect value for status[12].component, expected 26378, is " - << last_msg_->status[12].component; - EXPECT_EQ( - get_asstatus[12].generic)>( - reinterpret_cast(&last_msg_->status[12].generic)), - 73) - << "incorrect value for status[12].generic, expected 73, is " - << last_msg_->status[12].generic; - EXPECT_EQ( - get_asstatus[12].specific)>( - reinterpret_cast(&last_msg_->status[12].specific)), - 3) - << "incorrect value for status[12].specific, expected 3, is " - << last_msg_->status[12].specific; - EXPECT_EQ( - get_asstatus[13].component)>( - reinterpret_cast(&last_msg_->status[13].component)), - 17511) - << "incorrect value for status[13].component, expected 17511, is " - << last_msg_->status[13].component; - EXPECT_EQ( - get_asstatus[13].generic)>( - reinterpret_cast(&last_msg_->status[13].generic)), - 76) - << "incorrect value for status[13].generic, expected 76, is " - << last_msg_->status[13].generic; - EXPECT_EQ( - get_asstatus[13].specific)>( - reinterpret_cast(&last_msg_->status[13].specific)), - 184) - << "incorrect value for status[13].specific, expected 184, is " - << last_msg_->status[13].specific; - EXPECT_EQ( - get_asstatus[14].component)>( - reinterpret_cast(&last_msg_->status[14].component)), - 52769) - << "incorrect value for status[14].component, expected 52769, is " - << last_msg_->status[14].component; - EXPECT_EQ( - get_asstatus[14].generic)>( - reinterpret_cast(&last_msg_->status[14].generic)), - 194) - << "incorrect value for status[14].generic, expected 194, is " - << last_msg_->status[14].generic; - EXPECT_EQ( - get_asstatus[14].specific)>( - reinterpret_cast(&last_msg_->status[14].specific)), - 163) - << "incorrect value for status[14].specific, expected 163, is " - << last_msg_->status[14].specific; - EXPECT_EQ( - get_asstatus[15].component)>( - reinterpret_cast(&last_msg_->status[15].component)), - 7803) - << "incorrect value for status[15].component, expected 7803, is " - << last_msg_->status[15].component; - EXPECT_EQ( - get_asstatus[15].generic)>( - reinterpret_cast(&last_msg_->status[15].generic)), - 151) - << "incorrect value for status[15].generic, expected 151, is " - << last_msg_->status[15].generic; - EXPECT_EQ( - get_asstatus[15].specific)>( - reinterpret_cast(&last_msg_->status[15].specific)), - 176) - << "incorrect value for status[15].specific, expected 176, is " - << last_msg_->status[15].specific; - EXPECT_EQ( - get_asstatus[16].component)>( - reinterpret_cast(&last_msg_->status[16].component)), - 44181) - << "incorrect value for status[16].component, expected 44181, is " - << last_msg_->status[16].component; - EXPECT_EQ( - get_asstatus[16].generic)>( - reinterpret_cast(&last_msg_->status[16].generic)), - 184) - << "incorrect value for status[16].generic, expected 184, is " - << last_msg_->status[16].generic; - EXPECT_EQ( - get_asstatus[16].specific)>( - reinterpret_cast(&last_msg_->status[16].specific)), - 231) - << "incorrect value for status[16].specific, expected 231, is " - << last_msg_->status[16].specific; - EXPECT_EQ( - get_asstatus[17].component)>( - reinterpret_cast(&last_msg_->status[17].component)), - 58998) - << "incorrect value for status[17].component, expected 58998, is " - << last_msg_->status[17].component; - EXPECT_EQ( - get_asstatus[17].generic)>( - reinterpret_cast(&last_msg_->status[17].generic)), - 200) - << "incorrect value for status[17].generic, expected 200, is " - << last_msg_->status[17].generic; - EXPECT_EQ( - get_asstatus[17].specific)>( - reinterpret_cast(&last_msg_->status[17].specific)), - 168) - << "incorrect value for status[17].specific, expected 168, is " - << last_msg_->status[17].specific; - EXPECT_EQ( - get_asstatus[18].component)>( - reinterpret_cast(&last_msg_->status[18].component)), - 28004) - << "incorrect value for status[18].component, expected 28004, is " - << last_msg_->status[18].component; - EXPECT_EQ( - get_asstatus[18].generic)>( - reinterpret_cast(&last_msg_->status[18].generic)), - 10) - << "incorrect value for status[18].generic, expected 10, is " - << last_msg_->status[18].generic; - EXPECT_EQ( - get_asstatus[18].specific)>( - reinterpret_cast(&last_msg_->status[18].specific)), - 233) - << "incorrect value for status[18].specific, expected 233, is " - << last_msg_->status[18].specific; - EXPECT_EQ( - get_asstatus[19].component)>( - reinterpret_cast(&last_msg_->status[19].component)), - 15364) - << "incorrect value for status[19].component, expected 15364, is " - << last_msg_->status[19].component; - EXPECT_EQ( - get_asstatus[19].generic)>( - reinterpret_cast(&last_msg_->status[19].generic)), - 247) - << "incorrect value for status[19].generic, expected 247, is " - << last_msg_->status[19].generic; - EXPECT_EQ( - get_asstatus[19].specific)>( - reinterpret_cast(&last_msg_->status[19].specific)), - 82) - << "incorrect value for status[19].specific, expected 82, is " - << last_msg_->status[19].specific; - EXPECT_EQ( - get_asstatus[20].component)>( - reinterpret_cast(&last_msg_->status[20].component)), - 42711) - << "incorrect value for status[20].component, expected 42711, is " - << last_msg_->status[20].component; - EXPECT_EQ( - get_asstatus[20].generic)>( - reinterpret_cast(&last_msg_->status[20].generic)), - 28) - << "incorrect value for status[20].generic, expected 28, is " - << last_msg_->status[20].generic; - EXPECT_EQ( - get_asstatus[20].specific)>( - reinterpret_cast(&last_msg_->status[20].specific)), - 138) - << "incorrect value for status[20].specific, expected 138, is " - << last_msg_->status[20].specific; - EXPECT_EQ( - get_asstatus[21].component)>( - reinterpret_cast(&last_msg_->status[21].component)), - 11630) - << "incorrect value for status[21].component, expected 11630, is " - << last_msg_->status[21].component; - EXPECT_EQ( - get_asstatus[21].generic)>( - reinterpret_cast(&last_msg_->status[21].generic)), - 98) - << "incorrect value for status[21].generic, expected 98, is " - << last_msg_->status[21].generic; - EXPECT_EQ( - get_asstatus[21].specific)>( - reinterpret_cast(&last_msg_->status[21].specific)), - 218) - << "incorrect value for status[21].specific, expected 218, is " - << last_msg_->status[21].specific; - EXPECT_EQ( - get_asstatus[22].component)>( - reinterpret_cast(&last_msg_->status[22].component)), - 46068) - << "incorrect value for status[22].component, expected 46068, is " - << last_msg_->status[22].component; - EXPECT_EQ( - get_asstatus[22].generic)>( - reinterpret_cast(&last_msg_->status[22].generic)), - 126) - << "incorrect value for status[22].generic, expected 126, is " - << last_msg_->status[22].generic; - EXPECT_EQ( - get_asstatus[22].specific)>( - reinterpret_cast(&last_msg_->status[22].specific)), - 107) - << "incorrect value for status[22].specific, expected 107, is " - << last_msg_->status[22].specific; - EXPECT_EQ( - get_asstatus[23].component)>( - reinterpret_cast(&last_msg_->status[23].component)), - 31836) - << "incorrect value for status[23].component, expected 31836, is " - << last_msg_->status[23].component; - EXPECT_EQ( - get_asstatus[23].generic)>( - reinterpret_cast(&last_msg_->status[23].generic)), - 94) - << "incorrect value for status[23].generic, expected 94, is " - << last_msg_->status[23].generic; - EXPECT_EQ( - get_asstatus[23].specific)>( - reinterpret_cast(&last_msg_->status[23].specific)), - 157) - << "incorrect value for status[23].specific, expected 157, is " - << last_msg_->status[23].specific; - EXPECT_EQ( - get_asstatus[24].component)>( - reinterpret_cast(&last_msg_->status[24].component)), - 47914) - << "incorrect value for status[24].component, expected 47914, is " - << last_msg_->status[24].component; - EXPECT_EQ( - get_asstatus[24].generic)>( - reinterpret_cast(&last_msg_->status[24].generic)), - 124) - << "incorrect value for status[24].generic, expected 124, is " - << last_msg_->status[24].generic; - EXPECT_EQ( - get_asstatus[24].specific)>( - reinterpret_cast(&last_msg_->status[24].specific)), - 6) - << "incorrect value for status[24].specific, expected 6, is " - << last_msg_->status[24].specific; - EXPECT_EQ( - get_asstatus[25].component)>( - reinterpret_cast(&last_msg_->status[25].component)), - 63329) - << "incorrect value for status[25].component, expected 63329, is " - << last_msg_->status[25].component; - EXPECT_EQ( - get_asstatus[25].generic)>( - reinterpret_cast(&last_msg_->status[25].generic)), - 160) - << "incorrect value for status[25].generic, expected 160, is " - << last_msg_->status[25].generic; - EXPECT_EQ( - get_asstatus[25].specific)>( - reinterpret_cast(&last_msg_->status[25].specific)), - 188) - << "incorrect value for status[25].specific, expected 188, is " - << last_msg_->status[25].specific; - EXPECT_EQ( - get_asstatus[26].component)>( - reinterpret_cast(&last_msg_->status[26].component)), - 30830) - << "incorrect value for status[26].component, expected 30830, is " - << last_msg_->status[26].component; - EXPECT_EQ( - get_asstatus[26].generic)>( - reinterpret_cast(&last_msg_->status[26].generic)), - 254) - << "incorrect value for status[26].generic, expected 254, is " - << last_msg_->status[26].generic; - EXPECT_EQ( - get_asstatus[26].specific)>( - reinterpret_cast(&last_msg_->status[26].specific)), - 214) - << "incorrect value for status[26].specific, expected 214, is " - << last_msg_->status[26].specific; - EXPECT_EQ( - get_asstatus[27].component)>( - reinterpret_cast(&last_msg_->status[27].component)), - 13166) - << "incorrect value for status[27].component, expected 13166, is " - << last_msg_->status[27].component; - EXPECT_EQ( - get_asstatus[27].generic)>( - reinterpret_cast(&last_msg_->status[27].generic)), - 240) - << "incorrect value for status[27].generic, expected 240, is " - << last_msg_->status[27].generic; - EXPECT_EQ( - get_asstatus[27].specific)>( - reinterpret_cast(&last_msg_->status[27].specific)), - 164) - << "incorrect value for status[27].specific, expected 164, is " - << last_msg_->status[27].specific; - EXPECT_EQ( - get_asstatus[28].component)>( - reinterpret_cast(&last_msg_->status[28].component)), - 4755) - << "incorrect value for status[28].component, expected 4755, is " - << last_msg_->status[28].component; - EXPECT_EQ( - get_asstatus[28].generic)>( - reinterpret_cast(&last_msg_->status[28].generic)), - 74) - << "incorrect value for status[28].generic, expected 74, is " - << last_msg_->status[28].generic; - EXPECT_EQ( - get_asstatus[28].specific)>( - reinterpret_cast(&last_msg_->status[28].specific)), - 178) - << "incorrect value for status[28].specific, expected 178, is " - << last_msg_->status[28].specific; - EXPECT_EQ( - get_asstatus[29].component)>( - reinterpret_cast(&last_msg_->status[29].component)), - 1091) - << "incorrect value for status[29].component, expected 1091, is " - << last_msg_->status[29].component; - EXPECT_EQ( - get_asstatus[29].generic)>( - reinterpret_cast(&last_msg_->status[29].generic)), - 27) - << "incorrect value for status[29].generic, expected 27, is " - << last_msg_->status[29].generic; - EXPECT_EQ( - get_asstatus[29].specific)>( - reinterpret_cast(&last_msg_->status[29].specific)), - 73) - << "incorrect value for status[29].specific, expected 73, is " - << last_msg_->status[29].specific; - EXPECT_EQ( - get_asstatus[30].component)>( - reinterpret_cast(&last_msg_->status[30].component)), - 16574) - << "incorrect value for status[30].component, expected 16574, is " - << last_msg_->status[30].component; - EXPECT_EQ( - get_asstatus[30].generic)>( - reinterpret_cast(&last_msg_->status[30].generic)), - 179) - << "incorrect value for status[30].generic, expected 179, is " - << last_msg_->status[30].generic; - EXPECT_EQ( - get_asstatus[30].specific)>( - reinterpret_cast(&last_msg_->status[30].specific)), - 146) - << "incorrect value for status[30].specific, expected 146, is " - << last_msg_->status[30].specific; - EXPECT_EQ( - get_asstatus[31].component)>( - reinterpret_cast(&last_msg_->status[31].component)), - 39293) - << "incorrect value for status[31].component, expected 39293, is " - << last_msg_->status[31].component; - EXPECT_EQ( - get_asstatus[31].generic)>( - reinterpret_cast(&last_msg_->status[31].generic)), - 192) - << "incorrect value for status[31].generic, expected 192, is " - << last_msg_->status[31].generic; - EXPECT_EQ( - get_asstatus[31].specific)>( - reinterpret_cast(&last_msg_->status[31].specific)), - 46) - << "incorrect value for status[31].specific, expected 46, is " - << last_msg_->status[31].specific; - EXPECT_EQ( - get_asstatus[32].component)>( - reinterpret_cast(&last_msg_->status[32].component)), - 17098) - << "incorrect value for status[32].component, expected 17098, is " - << last_msg_->status[32].component; - EXPECT_EQ( - get_asstatus[32].generic)>( - reinterpret_cast(&last_msg_->status[32].generic)), - 248) - << "incorrect value for status[32].generic, expected 248, is " - << last_msg_->status[32].generic; - EXPECT_EQ( - get_asstatus[32].specific)>( - reinterpret_cast(&last_msg_->status[32].specific)), - 46) - << "incorrect value for status[32].specific, expected 46, is " - << last_msg_->status[32].specific; - EXPECT_EQ( - get_asstatus[33].component)>( - reinterpret_cast(&last_msg_->status[33].component)), - 41256) - << "incorrect value for status[33].component, expected 41256, is " - << last_msg_->status[33].component; - EXPECT_EQ( - get_asstatus[33].generic)>( - reinterpret_cast(&last_msg_->status[33].generic)), - 173) - << "incorrect value for status[33].generic, expected 173, is " - << last_msg_->status[33].generic; - EXPECT_EQ( - get_asstatus[33].specific)>( - reinterpret_cast(&last_msg_->status[33].specific)), - 242) - << "incorrect value for status[33].specific, expected 242, is " - << last_msg_->status[33].specific; - EXPECT_EQ( - get_asstatus[34].component)>( - reinterpret_cast(&last_msg_->status[34].component)), - 982) - << "incorrect value for status[34].component, expected 982, is " - << last_msg_->status[34].component; - EXPECT_EQ( - get_asstatus[34].generic)>( - reinterpret_cast(&last_msg_->status[34].generic)), - 11) - << "incorrect value for status[34].generic, expected 11, is " - << last_msg_->status[34].generic; - EXPECT_EQ( - get_asstatus[34].specific)>( - reinterpret_cast(&last_msg_->status[34].specific)), - 1) - << "incorrect value for status[34].specific, expected 1, is " - << last_msg_->status[34].specific; - EXPECT_EQ( - get_asstatus[35].component)>( - reinterpret_cast(&last_msg_->status[35].component)), - 18038) - << "incorrect value for status[35].component, expected 18038, is " - << last_msg_->status[35].component; - EXPECT_EQ( - get_asstatus[35].generic)>( - reinterpret_cast(&last_msg_->status[35].generic)), - 162) - << "incorrect value for status[35].generic, expected 162, is " - << last_msg_->status[35].generic; - EXPECT_EQ( - get_asstatus[35].specific)>( - reinterpret_cast(&last_msg_->status[35].specific)), - 61) - << "incorrect value for status[35].specific, expected 61, is " - << last_msg_->status[35].specific; - EXPECT_EQ( - get_asstatus[36].component)>( - reinterpret_cast(&last_msg_->status[36].component)), - 7090) - << "incorrect value for status[36].component, expected 7090, is " - << last_msg_->status[36].component; - EXPECT_EQ( - get_asstatus[36].generic)>( - reinterpret_cast(&last_msg_->status[36].generic)), - 156) - << "incorrect value for status[36].generic, expected 156, is " - << last_msg_->status[36].generic; - EXPECT_EQ( - get_asstatus[36].specific)>( - reinterpret_cast(&last_msg_->status[36].specific)), - 40) - << "incorrect value for status[36].specific, expected 40, is " - << last_msg_->status[36].specific; - EXPECT_EQ( - get_asstatus[37].component)>( - reinterpret_cast(&last_msg_->status[37].component)), - 29119) - << "incorrect value for status[37].component, expected 29119, is " - << last_msg_->status[37].component; - EXPECT_EQ( - get_asstatus[37].generic)>( - reinterpret_cast(&last_msg_->status[37].generic)), - 230) - << "incorrect value for status[37].generic, expected 230, is " - << last_msg_->status[37].generic; - EXPECT_EQ( - get_asstatus[37].specific)>( - reinterpret_cast(&last_msg_->status[37].specific)), - 200) - << "incorrect value for status[37].specific, expected 200, is " - << last_msg_->status[37].specific; - EXPECT_EQ( - get_asstatus[38].component)>( - reinterpret_cast(&last_msg_->status[38].component)), - 2120) - << "incorrect value for status[38].component, expected 2120, is " - << last_msg_->status[38].component; - EXPECT_EQ( - get_asstatus[38].generic)>( - reinterpret_cast(&last_msg_->status[38].generic)), - 215) - << "incorrect value for status[38].generic, expected 215, is " - << last_msg_->status[38].generic; - EXPECT_EQ( - get_asstatus[38].specific)>( - reinterpret_cast(&last_msg_->status[38].specific)), - 245) - << "incorrect value for status[38].specific, expected 245, is " - << last_msg_->status[38].specific; - EXPECT_EQ( - get_asstatus[39].component)>( - reinterpret_cast(&last_msg_->status[39].component)), - 15182) - << "incorrect value for status[39].component, expected 15182, is " - << last_msg_->status[39].component; - EXPECT_EQ( - get_asstatus[39].generic)>( - reinterpret_cast(&last_msg_->status[39].generic)), - 222) - << "incorrect value for status[39].generic, expected 222, is " - << last_msg_->status[39].generic; - EXPECT_EQ( - get_asstatus[39].specific)>( - reinterpret_cast(&last_msg_->status[39].specific)), - 250) - << "incorrect value for status[39].specific, expected 250, is " - << last_msg_->status[39].specific; - EXPECT_EQ( - get_asstatus[40].component)>( - reinterpret_cast(&last_msg_->status[40].component)), - 8307) - << "incorrect value for status[40].component, expected 8307, is " - << last_msg_->status[40].component; - EXPECT_EQ( - get_asstatus[40].generic)>( - reinterpret_cast(&last_msg_->status[40].generic)), - 33) - << "incorrect value for status[40].generic, expected 33, is " - << last_msg_->status[40].generic; - EXPECT_EQ( - get_asstatus[40].specific)>( - reinterpret_cast(&last_msg_->status[40].specific)), - 30) - << "incorrect value for status[40].specific, expected 30, is " - << last_msg_->status[40].specific; - EXPECT_EQ( - get_asstatus[41].component)>( - reinterpret_cast(&last_msg_->status[41].component)), - 43731) - << "incorrect value for status[41].component, expected 43731, is " - << last_msg_->status[41].component; - EXPECT_EQ( - get_asstatus[41].generic)>( - reinterpret_cast(&last_msg_->status[41].generic)), - 145) - << "incorrect value for status[41].generic, expected 145, is " - << last_msg_->status[41].generic; - EXPECT_EQ( - get_asstatus[41].specific)>( - reinterpret_cast(&last_msg_->status[41].specific)), - 92) - << "incorrect value for status[41].specific, expected 92, is " - << last_msg_->status[41].specific; - EXPECT_EQ( - get_asstatus[42].component)>( - reinterpret_cast(&last_msg_->status[42].component)), - 19357) - << "incorrect value for status[42].component, expected 19357, is " - << last_msg_->status[42].component; - EXPECT_EQ( - get_asstatus[42].generic)>( - reinterpret_cast(&last_msg_->status[42].generic)), - 24) - << "incorrect value for status[42].generic, expected 24, is " - << last_msg_->status[42].generic; - EXPECT_EQ( - get_asstatus[42].specific)>( - reinterpret_cast(&last_msg_->status[42].specific)), - 169) - << "incorrect value for status[42].specific, expected 169, is " - << last_msg_->status[42].specific; - EXPECT_EQ( - get_asstatus[43].component)>( - reinterpret_cast(&last_msg_->status[43].component)), - 14086) - << "incorrect value for status[43].component, expected 14086, is " - << last_msg_->status[43].component; - EXPECT_EQ( - get_asstatus[43].generic)>( - reinterpret_cast(&last_msg_->status[43].generic)), - 62) - << "incorrect value for status[43].generic, expected 62, is " - << last_msg_->status[43].generic; - EXPECT_EQ( - get_asstatus[43].specific)>( - reinterpret_cast(&last_msg_->status[43].specific)), - 8) - << "incorrect value for status[43].specific, expected 8, is " - << last_msg_->status[43].specific; - EXPECT_EQ( - get_asstatus[44].component)>( - reinterpret_cast(&last_msg_->status[44].component)), - 21099) - << "incorrect value for status[44].component, expected 21099, is " - << last_msg_->status[44].component; - EXPECT_EQ( - get_asstatus[44].generic)>( - reinterpret_cast(&last_msg_->status[44].generic)), - 140) - << "incorrect value for status[44].generic, expected 140, is " - << last_msg_->status[44].generic; - EXPECT_EQ( - get_asstatus[44].specific)>( - reinterpret_cast(&last_msg_->status[44].specific)), - 49) - << "incorrect value for status[44].specific, expected 49, is " - << last_msg_->status[44].specific; - EXPECT_EQ( - get_asstatus[45].component)>( - reinterpret_cast(&last_msg_->status[45].component)), - 31411) - << "incorrect value for status[45].component, expected 31411, is " - << last_msg_->status[45].component; - EXPECT_EQ( - get_asstatus[45].generic)>( - reinterpret_cast(&last_msg_->status[45].generic)), - 90) - << "incorrect value for status[45].generic, expected 90, is " - << last_msg_->status[45].generic; - EXPECT_EQ( - get_asstatus[45].specific)>( - reinterpret_cast(&last_msg_->status[45].specific)), - 71) - << "incorrect value for status[45].specific, expected 71, is " - << last_msg_->status[45].specific; - EXPECT_EQ( - get_asstatus[46].component)>( - reinterpret_cast(&last_msg_->status[46].component)), - 22556) - << "incorrect value for status[46].component, expected 22556, is " - << last_msg_->status[46].component; - EXPECT_EQ( - get_asstatus[46].generic)>( - reinterpret_cast(&last_msg_->status[46].generic)), - 103) - << "incorrect value for status[46].generic, expected 103, is " - << last_msg_->status[46].generic; - EXPECT_EQ( - get_asstatus[46].specific)>( - reinterpret_cast(&last_msg_->status[46].specific)), - 51) - << "incorrect value for status[46].specific, expected 51, is " - << last_msg_->status[46].specific; - EXPECT_EQ( - get_asstatus[47].component)>( - reinterpret_cast(&last_msg_->status[47].component)), - 18609) - << "incorrect value for status[47].component, expected 18609, is " - << last_msg_->status[47].component; - EXPECT_EQ( - get_asstatus[47].generic)>( - reinterpret_cast(&last_msg_->status[47].generic)), - 93) - << "incorrect value for status[47].generic, expected 93, is " - << last_msg_->status[47].generic; - EXPECT_EQ( - get_asstatus[47].specific)>( - reinterpret_cast(&last_msg_->status[47].specific)), - 39) - << "incorrect value for status[47].specific, expected 39, is " - << last_msg_->status[47].specific; - EXPECT_EQ( - get_asstatus[48].component)>( - reinterpret_cast(&last_msg_->status[48].component)), - 2964) - << "incorrect value for status[48].component, expected 2964, is " - << last_msg_->status[48].component; - EXPECT_EQ( - get_asstatus[48].generic)>( - reinterpret_cast(&last_msg_->status[48].generic)), - 202) - << "incorrect value for status[48].generic, expected 202, is " - << last_msg_->status[48].generic; - EXPECT_EQ( - get_asstatus[48].specific)>( - reinterpret_cast(&last_msg_->status[48].specific)), - 42) - << "incorrect value for status[48].specific, expected 42, is " - << last_msg_->status[48].specific; - EXPECT_EQ( - get_asstatus[49].component)>( - reinterpret_cast(&last_msg_->status[49].component)), - 23586) - << "incorrect value for status[49].component, expected 23586, is " - << last_msg_->status[49].component; - EXPECT_EQ( - get_asstatus[49].generic)>( - reinterpret_cast(&last_msg_->status[49].generic)), - 204) - << "incorrect value for status[49].generic, expected 204, is " - << last_msg_->status[49].generic; - EXPECT_EQ( - get_asstatus[49].specific)>( - reinterpret_cast(&last_msg_->status[49].specific)), - 102) - << "incorrect value for status[49].specific, expected 102, is " - << last_msg_->status[49].specific; - EXPECT_EQ( - get_asstatus[50].component)>( - reinterpret_cast(&last_msg_->status[50].component)), - 25117) - << "incorrect value for status[50].component, expected 25117, is " - << last_msg_->status[50].component; - EXPECT_EQ( - get_asstatus[50].generic)>( - reinterpret_cast(&last_msg_->status[50].generic)), - 249) - << "incorrect value for status[50].generic, expected 249, is " - << last_msg_->status[50].generic; - EXPECT_EQ( - get_asstatus[50].specific)>( - reinterpret_cast(&last_msg_->status[50].specific)), - 91) - << "incorrect value for status[50].specific, expected 91, is " - << last_msg_->status[50].specific; - EXPECT_EQ( - get_asstatus[51].component)>( - reinterpret_cast(&last_msg_->status[51].component)), - 24454) - << "incorrect value for status[51].component, expected 24454, is " - << last_msg_->status[51].component; - EXPECT_EQ( - get_asstatus[51].generic)>( - reinterpret_cast(&last_msg_->status[51].generic)), - 23) - << "incorrect value for status[51].generic, expected 23, is " - << last_msg_->status[51].generic; - EXPECT_EQ( - get_asstatus[51].specific)>( - reinterpret_cast(&last_msg_->status[51].specific)), - 248) - << "incorrect value for status[51].specific, expected 248, is " - << last_msg_->status[51].specific; - EXPECT_EQ( - get_asstatus[52].component)>( - reinterpret_cast(&last_msg_->status[52].component)), - 5312) - << "incorrect value for status[52].component, expected 5312, is " - << last_msg_->status[52].component; - EXPECT_EQ( - get_asstatus[52].generic)>( - reinterpret_cast(&last_msg_->status[52].generic)), - 83) - << "incorrect value for status[52].generic, expected 83, is " - << last_msg_->status[52].generic; - EXPECT_EQ( - get_asstatus[52].specific)>( - reinterpret_cast(&last_msg_->status[52].specific)), - 195) - << "incorrect value for status[52].specific, expected 195, is " - << last_msg_->status[52].specific; - EXPECT_EQ( - get_asstatus[53].component)>( - reinterpret_cast(&last_msg_->status[53].component)), - 46175) - << "incorrect value for status[53].component, expected 46175, is " - << last_msg_->status[53].component; - EXPECT_EQ( - get_asstatus[53].generic)>( - reinterpret_cast(&last_msg_->status[53].generic)), - 54) - << "incorrect value for status[53].generic, expected 54, is " - << last_msg_->status[53].generic; - EXPECT_EQ( - get_asstatus[53].specific)>( - reinterpret_cast(&last_msg_->status[53].specific)), - 36) - << "incorrect value for status[53].specific, expected 36, is " - << last_msg_->status[53].specific; - EXPECT_EQ( - get_asstatus[54].component)>( - reinterpret_cast(&last_msg_->status[54].component)), - 19386) - << "incorrect value for status[54].component, expected 19386, is " - << last_msg_->status[54].component; - EXPECT_EQ( - get_asstatus[54].generic)>( - reinterpret_cast(&last_msg_->status[54].generic)), - 64) - << "incorrect value for status[54].generic, expected 64, is " - << last_msg_->status[54].generic; - EXPECT_EQ( - get_asstatus[54].specific)>( - reinterpret_cast(&last_msg_->status[54].specific)), - 20) - << "incorrect value for status[54].specific, expected 20, is " - << last_msg_->status[54].specific; - EXPECT_EQ( - get_asstatus[55].component)>( - reinterpret_cast(&last_msg_->status[55].component)), - 34205) - << "incorrect value for status[55].component, expected 34205, is " - << last_msg_->status[55].component; - EXPECT_EQ( - get_asstatus[55].generic)>( - reinterpret_cast(&last_msg_->status[55].generic)), - 12) - << "incorrect value for status[55].generic, expected 12, is " - << last_msg_->status[55].generic; - EXPECT_EQ( - get_asstatus[55].specific)>( - reinterpret_cast(&last_msg_->status[55].specific)), - 149) - << "incorrect value for status[55].specific, expected 149, is " - << last_msg_->status[55].specific; - EXPECT_EQ( - get_asstatus[56].component)>( - reinterpret_cast(&last_msg_->status[56].component)), - 3612) - << "incorrect value for status[56].component, expected 3612, is " - << last_msg_->status[56].component; - EXPECT_EQ( - get_asstatus[56].generic)>( - reinterpret_cast(&last_msg_->status[56].generic)), - 185) - << "incorrect value for status[56].generic, expected 185, is " - << last_msg_->status[56].generic; - EXPECT_EQ( - get_asstatus[56].specific)>( - reinterpret_cast(&last_msg_->status[56].specific)), - 129) - << "incorrect value for status[56].specific, expected 129, is " - << last_msg_->status[56].specific; - EXPECT_EQ( - get_asstatus[57].component)>( - reinterpret_cast(&last_msg_->status[57].component)), - 61285) - << "incorrect value for status[57].component, expected 61285, is " - << last_msg_->status[57].component; - EXPECT_EQ( - get_asstatus[57].generic)>( - reinterpret_cast(&last_msg_->status[57].generic)), - 74) - << "incorrect value for status[57].generic, expected 74, is " - << last_msg_->status[57].generic; - EXPECT_EQ( - get_asstatus[57].specific)>( - reinterpret_cast(&last_msg_->status[57].specific)), - 248) - << "incorrect value for status[57].specific, expected 248, is " - << last_msg_->status[57].specific; - EXPECT_EQ( - get_asstatus[58].component)>( - reinterpret_cast(&last_msg_->status[58].component)), - 7925) - << "incorrect value for status[58].component, expected 7925, is " - << last_msg_->status[58].component; - EXPECT_EQ( - get_asstatus[58].generic)>( - reinterpret_cast(&last_msg_->status[58].generic)), - 228) - << "incorrect value for status[58].generic, expected 228, is " - << last_msg_->status[58].generic; - EXPECT_EQ( - get_asstatus[58].specific)>( - reinterpret_cast(&last_msg_->status[58].specific)), - 88) - << "incorrect value for status[58].specific, expected 88, is " - << last_msg_->status[58].specific; - EXPECT_EQ( - get_asstatus[59].component)>( - reinterpret_cast(&last_msg_->status[59].component)), - 54414) - << "incorrect value for status[59].component, expected 54414, is " - << last_msg_->status[59].component; - EXPECT_EQ( - get_asstatus[59].generic)>( - reinterpret_cast(&last_msg_->status[59].generic)), - 53) - << "incorrect value for status[59].generic, expected 53, is " - << last_msg_->status[59].generic; - EXPECT_EQ( - get_asstatus[59].specific)>( - reinterpret_cast(&last_msg_->status[59].specific)), - 224) - << "incorrect value for status[59].specific, expected 224, is " - << last_msg_->status[59].specific; - EXPECT_EQ(get_asuptime)>( - reinterpret_cast(&last_msg_->uptime)), - 1657804265) - << "incorrect value for uptime, expected 1657804265, is " - << last_msg_->uptime; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_telemetry_MsgTelSv.cc b/c/test/legacy/cpp/auto_check_sbp_telemetry_MsgTelSv.cc deleted file mode 100644 index 7d0a0d9e1c..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_telemetry_MsgTelSv.cc +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/telemetry/test_MsgTelSv.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_telemetry_MsgTelSv0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_telemetry_MsgTelSv0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tel_sv_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tel_sv_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_telemetry_MsgTelSv0, Test) { - uint8_t encoded_frame[] = { - 85, 32, 1, 148, 38, 20, 175, 8, 208, 221, 62, 24, 16, 1, - 40, 50, 5, 226, 255, 1, 0, 1, 1, 1, 33, 12, 39, 105, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tel_sv_t *test_msg = (msg_tel_sv_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->n_obs = 16; - test_msg->origin_flags = 1; - if (sizeof(test_msg->sv_tel) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->sv_tel[0])); - } - test_msg->sv_tel[0].availability_flags = 5; - test_msg->sv_tel[0].az = 40; - test_msg->sv_tel[0].correction_flags = 1; - test_msg->sv_tel[0].el = 50; - test_msg->sv_tel[0].ephemeris_flags = 1; - test_msg->sv_tel[0].outlier_flags = 1; - test_msg->sv_tel[0].phase_residual = 1; - test_msg->sv_tel[0].pseudorange_residual = -30; - test_msg->sv_tel[0].sid.code = 12; - test_msg->sv_tel[0].sid.sat = 33; - test_msg->tow = 406773200; - test_msg->wn = 2223; - - EXPECT_EQ(send_message(0x120, 9876, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 9876); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asn_obs)>( - reinterpret_cast(&last_msg_->n_obs)), - 16) - << "incorrect value for n_obs, expected 16, is " << last_msg_->n_obs; - EXPECT_EQ(get_asorigin_flags)>( - reinterpret_cast(&last_msg_->origin_flags)), - 1) - << "incorrect value for origin_flags, expected 1, is " - << last_msg_->origin_flags; - EXPECT_EQ(get_assv_tel[0].availability_flags)>( - reinterpret_cast( - &last_msg_->sv_tel[0].availability_flags)), - 5) - << "incorrect value for sv_tel[0].availability_flags, expected 5, is " - << last_msg_->sv_tel[0].availability_flags; - EXPECT_EQ(get_assv_tel[0].az)>( - reinterpret_cast(&last_msg_->sv_tel[0].az)), - 40) - << "incorrect value for sv_tel[0].az, expected 40, is " - << last_msg_->sv_tel[0].az; - EXPECT_EQ(get_assv_tel[0].correction_flags)>( - reinterpret_cast( - &last_msg_->sv_tel[0].correction_flags)), - 1) - << "incorrect value for sv_tel[0].correction_flags, expected 1, is " - << last_msg_->sv_tel[0].correction_flags; - EXPECT_EQ(get_assv_tel[0].el)>( - reinterpret_cast(&last_msg_->sv_tel[0].el)), - 50) - << "incorrect value for sv_tel[0].el, expected 50, is " - << last_msg_->sv_tel[0].el; - EXPECT_EQ(get_assv_tel[0].ephemeris_flags)>( - reinterpret_cast( - &last_msg_->sv_tel[0].ephemeris_flags)), - 1) - << "incorrect value for sv_tel[0].ephemeris_flags, expected 1, is " - << last_msg_->sv_tel[0].ephemeris_flags; - EXPECT_EQ(get_assv_tel[0].outlier_flags)>( - reinterpret_cast( - &last_msg_->sv_tel[0].outlier_flags)), - 1) - << "incorrect value for sv_tel[0].outlier_flags, expected 1, is " - << last_msg_->sv_tel[0].outlier_flags; - EXPECT_EQ(get_assv_tel[0].phase_residual)>( - reinterpret_cast( - &last_msg_->sv_tel[0].phase_residual)), - 1) - << "incorrect value for sv_tel[0].phase_residual, expected 1, is " - << last_msg_->sv_tel[0].phase_residual; - EXPECT_EQ(get_assv_tel[0].pseudorange_residual)>( - reinterpret_cast( - &last_msg_->sv_tel[0].pseudorange_residual)), - -30) - << "incorrect value for sv_tel[0].pseudorange_residual, expected -30, is " - << last_msg_->sv_tel[0].pseudorange_residual; - EXPECT_EQ( - get_assv_tel[0].sid.code)>( - reinterpret_cast(&last_msg_->sv_tel[0].sid.code)), - 12) - << "incorrect value for sv_tel[0].sid.code, expected 12, is " - << last_msg_->sv_tel[0].sid.code; - EXPECT_EQ( - get_assv_tel[0].sid.sat)>( - reinterpret_cast(&last_msg_->sv_tel[0].sid.sat)), - 33) - << "incorrect value for sv_tel[0].sid.sat, expected 33, is " - << last_msg_->sv_tel[0].sid.sat; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 406773200) - << "incorrect value for tow, expected 406773200, is " << last_msg_->tow; - EXPECT_EQ(get_aswn)>( - reinterpret_cast(&last_msg_->wn)), - 2223) - << "incorrect value for wn, expected 2223, is " << last_msg_->wn; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgMeasurementState.cc b/c/test/legacy/cpp/auto_check_sbp_tracking_MsgMeasurementState.cc deleted file mode 100644 index 66fdc874fc..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgMeasurementState.cc +++ /dev/null @@ -1,2033 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgMeasurementState.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_tracking_MsgMeasurementState0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgMeasurementState0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_measurement_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_measurement_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgMeasurementState0, Test) { - uint8_t encoded_frame[] = { - 85, 97, 0, 207, 121, 237, 29, 0, 162, 0, 0, 0, 0, 0, 0, - 27, 0, 201, 20, 0, 168, 32, 0, 184, 15, 0, 187, 0, 0, 0, - 18, 0, 210, 16, 0, 167, 0, 0, 0, 23, 0, 213, 10, 0, 223, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 2, 202, - 27, 1, 192, 15, 1, 165, 29, 1, 146, 32, 1, 170, 18, 1, 201, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 1, 212, 10, 1, 205, - 0, 0, 0, 96, 3, 230, 0, 0, 0, 101, 3, 214, 103, 3, 212, - 104, 3, 209, 106, 3, 157, 102, 3, 230, 0, 0, 0, 0, 0, 0, - 101, 4, 189, 96, 4, 207, 106, 4, 164, 104, 4, 193, 0, 0, 0, - 102, 4, 208, 0, 0, 0, 27, 12, 212, 29, 12, 161, 32, 12, 216, - 30, 12, 216, 20, 12, 178, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 36, 14, 203, 0, 0, 0, 5, 14, 158, 4, 14, 194, 11, 14, 192, - 9, 14, 207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 20, 218, - 5, 20, 176, 36, 20, 217, 11, 20, 200, 4, 20, 205, 0, 0, 0, - 0, 0, 0, 35, 54, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_measurement_state_t *test_msg = - (msg_measurement_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[0].cn0 = 162; - test_msg->states[0].mesid.code = 0; - test_msg->states[0].mesid.sat = 29; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[1].cn0 = 0; - test_msg->states[1].mesid.code = 0; - test_msg->states[1].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[2].cn0 = 0; - test_msg->states[2].mesid.code = 0; - test_msg->states[2].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[3].cn0 = 201; - test_msg->states[3].mesid.code = 0; - test_msg->states[3].mesid.sat = 27; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[4].cn0 = 168; - test_msg->states[4].mesid.code = 0; - test_msg->states[4].mesid.sat = 20; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[5].cn0 = 184; - test_msg->states[5].mesid.code = 0; - test_msg->states[5].mesid.sat = 32; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[6].cn0 = 187; - test_msg->states[6].mesid.code = 0; - test_msg->states[6].mesid.sat = 15; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[7].cn0 = 0; - test_msg->states[7].mesid.code = 0; - test_msg->states[7].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[8].cn0 = 210; - test_msg->states[8].mesid.code = 0; - test_msg->states[8].mesid.sat = 18; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[9].cn0 = 167; - test_msg->states[9].mesid.code = 0; - test_msg->states[9].mesid.sat = 16; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[10].cn0 = 0; - test_msg->states[10].mesid.code = 0; - test_msg->states[10].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[11].cn0 = 213; - test_msg->states[11].mesid.code = 0; - test_msg->states[11].mesid.sat = 23; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[12].cn0 = 223; - test_msg->states[12].mesid.code = 0; - test_msg->states[12].mesid.sat = 10; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[13].cn0 = 0; - test_msg->states[13].mesid.code = 0; - test_msg->states[13].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[14].cn0 = 0; - test_msg->states[14].mesid.code = 0; - test_msg->states[14].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[15].cn0 = 0; - test_msg->states[15].mesid.code = 0; - test_msg->states[15].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[16].cn0 = 0; - test_msg->states[16].mesid.code = 0; - test_msg->states[16].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[17].cn0 = 202; - test_msg->states[17].mesid.code = 2; - test_msg->states[17].mesid.sat = 131; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[18].cn0 = 192; - test_msg->states[18].mesid.code = 1; - test_msg->states[18].mesid.sat = 27; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[19].cn0 = 165; - test_msg->states[19].mesid.code = 1; - test_msg->states[19].mesid.sat = 15; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[20].cn0 = 146; - test_msg->states[20].mesid.code = 1; - test_msg->states[20].mesid.sat = 29; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[21].cn0 = 170; - test_msg->states[21].mesid.code = 1; - test_msg->states[21].mesid.sat = 32; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[22].cn0 = 201; - test_msg->states[22].mesid.code = 1; - test_msg->states[22].mesid.sat = 18; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[23].cn0 = 0; - test_msg->states[23].mesid.code = 0; - test_msg->states[23].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[24].cn0 = 0; - test_msg->states[24].mesid.code = 0; - test_msg->states[24].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[25].cn0 = 0; - test_msg->states[25].mesid.code = 0; - test_msg->states[25].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[26].cn0 = 212; - test_msg->states[26].mesid.code = 1; - test_msg->states[26].mesid.sat = 23; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[27].cn0 = 205; - test_msg->states[27].mesid.code = 1; - test_msg->states[27].mesid.sat = 10; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[28].cn0 = 0; - test_msg->states[28].mesid.code = 0; - test_msg->states[28].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[29].cn0 = 230; - test_msg->states[29].mesid.code = 3; - test_msg->states[29].mesid.sat = 96; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[30].cn0 = 0; - test_msg->states[30].mesid.code = 0; - test_msg->states[30].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[31].cn0 = 214; - test_msg->states[31].mesid.code = 3; - test_msg->states[31].mesid.sat = 101; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[32].cn0 = 212; - test_msg->states[32].mesid.code = 3; - test_msg->states[32].mesid.sat = 103; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[33].cn0 = 209; - test_msg->states[33].mesid.code = 3; - test_msg->states[33].mesid.sat = 104; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[34].cn0 = 157; - test_msg->states[34].mesid.code = 3; - test_msg->states[34].mesid.sat = 106; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[35].cn0 = 230; - test_msg->states[35].mesid.code = 3; - test_msg->states[35].mesid.sat = 102; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[36].cn0 = 0; - test_msg->states[36].mesid.code = 0; - test_msg->states[36].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[37].cn0 = 0; - test_msg->states[37].mesid.code = 0; - test_msg->states[37].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[38].cn0 = 189; - test_msg->states[38].mesid.code = 4; - test_msg->states[38].mesid.sat = 101; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[39].cn0 = 207; - test_msg->states[39].mesid.code = 4; - test_msg->states[39].mesid.sat = 96; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[40].cn0 = 164; - test_msg->states[40].mesid.code = 4; - test_msg->states[40].mesid.sat = 106; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[41].cn0 = 193; - test_msg->states[41].mesid.code = 4; - test_msg->states[41].mesid.sat = 104; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[42].cn0 = 0; - test_msg->states[42].mesid.code = 0; - test_msg->states[42].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[43].cn0 = 208; - test_msg->states[43].mesid.code = 4; - test_msg->states[43].mesid.sat = 102; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[44].cn0 = 0; - test_msg->states[44].mesid.code = 0; - test_msg->states[44].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[45].cn0 = 212; - test_msg->states[45].mesid.code = 12; - test_msg->states[45].mesid.sat = 27; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[46].cn0 = 161; - test_msg->states[46].mesid.code = 12; - test_msg->states[46].mesid.sat = 29; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[47].cn0 = 216; - test_msg->states[47].mesid.code = 12; - test_msg->states[47].mesid.sat = 32; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[48].cn0 = 216; - test_msg->states[48].mesid.code = 12; - test_msg->states[48].mesid.sat = 30; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[49].cn0 = 178; - test_msg->states[49].mesid.code = 12; - test_msg->states[49].mesid.sat = 20; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[50].cn0 = 0; - test_msg->states[50].mesid.code = 0; - test_msg->states[50].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[51].cn0 = 0; - test_msg->states[51].mesid.code = 0; - test_msg->states[51].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[52].cn0 = 0; - test_msg->states[52].mesid.code = 0; - test_msg->states[52].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[53].cn0 = 0; - test_msg->states[53].mesid.code = 0; - test_msg->states[53].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[54].cn0 = 0; - test_msg->states[54].mesid.code = 0; - test_msg->states[54].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[55].cn0 = 0; - test_msg->states[55].mesid.code = 0; - test_msg->states[55].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[56].cn0 = 0; - test_msg->states[56].mesid.code = 0; - test_msg->states[56].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[57].cn0 = 0; - test_msg->states[57].mesid.code = 0; - test_msg->states[57].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[58].cn0 = 0; - test_msg->states[58].mesid.code = 0; - test_msg->states[58].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[59].cn0 = 0; - test_msg->states[59].mesid.code = 0; - test_msg->states[59].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[60].cn0 = 0; - test_msg->states[60].mesid.code = 0; - test_msg->states[60].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[61].cn0 = 0; - test_msg->states[61].mesid.code = 0; - test_msg->states[61].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[62].cn0 = 0; - test_msg->states[62].mesid.code = 0; - test_msg->states[62].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[63].cn0 = 203; - test_msg->states[63].mesid.code = 14; - test_msg->states[63].mesid.sat = 36; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[64].cn0 = 0; - test_msg->states[64].mesid.code = 0; - test_msg->states[64].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[65].cn0 = 158; - test_msg->states[65].mesid.code = 14; - test_msg->states[65].mesid.sat = 5; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[66].cn0 = 194; - test_msg->states[66].mesid.code = 14; - test_msg->states[66].mesid.sat = 4; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[67].cn0 = 192; - test_msg->states[67].mesid.code = 14; - test_msg->states[67].mesid.sat = 11; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[68].cn0 = 207; - test_msg->states[68].mesid.code = 14; - test_msg->states[68].mesid.sat = 9; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[69].cn0 = 0; - test_msg->states[69].mesid.code = 0; - test_msg->states[69].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[70].cn0 = 0; - test_msg->states[70].mesid.code = 0; - test_msg->states[70].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[71].cn0 = 0; - test_msg->states[71].mesid.code = 0; - test_msg->states[71].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[72].cn0 = 218; - test_msg->states[72].mesid.code = 20; - test_msg->states[72].mesid.sat = 9; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[73].cn0 = 176; - test_msg->states[73].mesid.code = 20; - test_msg->states[73].mesid.sat = 5; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[74].cn0 = 217; - test_msg->states[74].mesid.code = 20; - test_msg->states[74].mesid.sat = 36; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[75].cn0 = 200; - test_msg->states[75].mesid.code = 20; - test_msg->states[75].mesid.sat = 11; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[76].cn0 = 205; - test_msg->states[76].mesid.code = 20; - test_msg->states[76].mesid.sat = 4; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[77].cn0 = 0; - test_msg->states[77].mesid.code = 0; - test_msg->states[77].mesid.sat = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[78].cn0 = 0; - test_msg->states[78].mesid.code = 0; - test_msg->states[78].mesid.sat = 0; - - EXPECT_EQ(send_message(0x61, 31183, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 31183); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asstates[0].cn0)>( - reinterpret_cast(&last_msg_->states[0].cn0)), - 162) - << "incorrect value for states[0].cn0, expected 162, is " - << last_msg_->states[0].cn0; - EXPECT_EQ( - get_asstates[0].mesid.code)>( - reinterpret_cast(&last_msg_->states[0].mesid.code)), - 0) - << "incorrect value for states[0].mesid.code, expected 0, is " - << last_msg_->states[0].mesid.code; - EXPECT_EQ( - get_asstates[0].mesid.sat)>( - reinterpret_cast(&last_msg_->states[0].mesid.sat)), - 29) - << "incorrect value for states[0].mesid.sat, expected 29, is " - << last_msg_->states[0].mesid.sat; - EXPECT_EQ(get_asstates[1].cn0)>( - reinterpret_cast(&last_msg_->states[1].cn0)), - 0) - << "incorrect value for states[1].cn0, expected 0, is " - << last_msg_->states[1].cn0; - EXPECT_EQ( - get_asstates[1].mesid.code)>( - reinterpret_cast(&last_msg_->states[1].mesid.code)), - 0) - << "incorrect value for states[1].mesid.code, expected 0, is " - << last_msg_->states[1].mesid.code; - EXPECT_EQ( - get_asstates[1].mesid.sat)>( - reinterpret_cast(&last_msg_->states[1].mesid.sat)), - 0) - << "incorrect value for states[1].mesid.sat, expected 0, is " - << last_msg_->states[1].mesid.sat; - EXPECT_EQ(get_asstates[2].cn0)>( - reinterpret_cast(&last_msg_->states[2].cn0)), - 0) - << "incorrect value for states[2].cn0, expected 0, is " - << last_msg_->states[2].cn0; - EXPECT_EQ( - get_asstates[2].mesid.code)>( - reinterpret_cast(&last_msg_->states[2].mesid.code)), - 0) - << "incorrect value for states[2].mesid.code, expected 0, is " - << last_msg_->states[2].mesid.code; - EXPECT_EQ( - get_asstates[2].mesid.sat)>( - reinterpret_cast(&last_msg_->states[2].mesid.sat)), - 0) - << "incorrect value for states[2].mesid.sat, expected 0, is " - << last_msg_->states[2].mesid.sat; - EXPECT_EQ(get_asstates[3].cn0)>( - reinterpret_cast(&last_msg_->states[3].cn0)), - 201) - << "incorrect value for states[3].cn0, expected 201, is " - << last_msg_->states[3].cn0; - EXPECT_EQ( - get_asstates[3].mesid.code)>( - reinterpret_cast(&last_msg_->states[3].mesid.code)), - 0) - << "incorrect value for states[3].mesid.code, expected 0, is " - << last_msg_->states[3].mesid.code; - EXPECT_EQ( - get_asstates[3].mesid.sat)>( - reinterpret_cast(&last_msg_->states[3].mesid.sat)), - 27) - << "incorrect value for states[3].mesid.sat, expected 27, is " - << last_msg_->states[3].mesid.sat; - EXPECT_EQ(get_asstates[4].cn0)>( - reinterpret_cast(&last_msg_->states[4].cn0)), - 168) - << "incorrect value for states[4].cn0, expected 168, is " - << last_msg_->states[4].cn0; - EXPECT_EQ( - get_asstates[4].mesid.code)>( - reinterpret_cast(&last_msg_->states[4].mesid.code)), - 0) - << "incorrect value for states[4].mesid.code, expected 0, is " - << last_msg_->states[4].mesid.code; - EXPECT_EQ( - get_asstates[4].mesid.sat)>( - reinterpret_cast(&last_msg_->states[4].mesid.sat)), - 20) - << "incorrect value for states[4].mesid.sat, expected 20, is " - << last_msg_->states[4].mesid.sat; - EXPECT_EQ(get_asstates[5].cn0)>( - reinterpret_cast(&last_msg_->states[5].cn0)), - 184) - << "incorrect value for states[5].cn0, expected 184, is " - << last_msg_->states[5].cn0; - EXPECT_EQ( - get_asstates[5].mesid.code)>( - reinterpret_cast(&last_msg_->states[5].mesid.code)), - 0) - << "incorrect value for states[5].mesid.code, expected 0, is " - << last_msg_->states[5].mesid.code; - EXPECT_EQ( - get_asstates[5].mesid.sat)>( - reinterpret_cast(&last_msg_->states[5].mesid.sat)), - 32) - << "incorrect value for states[5].mesid.sat, expected 32, is " - << last_msg_->states[5].mesid.sat; - EXPECT_EQ(get_asstates[6].cn0)>( - reinterpret_cast(&last_msg_->states[6].cn0)), - 187) - << "incorrect value for states[6].cn0, expected 187, is " - << last_msg_->states[6].cn0; - EXPECT_EQ( - get_asstates[6].mesid.code)>( - reinterpret_cast(&last_msg_->states[6].mesid.code)), - 0) - << "incorrect value for states[6].mesid.code, expected 0, is " - << last_msg_->states[6].mesid.code; - EXPECT_EQ( - get_asstates[6].mesid.sat)>( - reinterpret_cast(&last_msg_->states[6].mesid.sat)), - 15) - << "incorrect value for states[6].mesid.sat, expected 15, is " - << last_msg_->states[6].mesid.sat; - EXPECT_EQ(get_asstates[7].cn0)>( - reinterpret_cast(&last_msg_->states[7].cn0)), - 0) - << "incorrect value for states[7].cn0, expected 0, is " - << last_msg_->states[7].cn0; - EXPECT_EQ( - get_asstates[7].mesid.code)>( - reinterpret_cast(&last_msg_->states[7].mesid.code)), - 0) - << "incorrect value for states[7].mesid.code, expected 0, is " - << last_msg_->states[7].mesid.code; - EXPECT_EQ( - get_asstates[7].mesid.sat)>( - reinterpret_cast(&last_msg_->states[7].mesid.sat)), - 0) - << "incorrect value for states[7].mesid.sat, expected 0, is " - << last_msg_->states[7].mesid.sat; - EXPECT_EQ(get_asstates[8].cn0)>( - reinterpret_cast(&last_msg_->states[8].cn0)), - 210) - << "incorrect value for states[8].cn0, expected 210, is " - << last_msg_->states[8].cn0; - EXPECT_EQ( - get_asstates[8].mesid.code)>( - reinterpret_cast(&last_msg_->states[8].mesid.code)), - 0) - << "incorrect value for states[8].mesid.code, expected 0, is " - << last_msg_->states[8].mesid.code; - EXPECT_EQ( - get_asstates[8].mesid.sat)>( - reinterpret_cast(&last_msg_->states[8].mesid.sat)), - 18) - << "incorrect value for states[8].mesid.sat, expected 18, is " - << last_msg_->states[8].mesid.sat; - EXPECT_EQ(get_asstates[9].cn0)>( - reinterpret_cast(&last_msg_->states[9].cn0)), - 167) - << "incorrect value for states[9].cn0, expected 167, is " - << last_msg_->states[9].cn0; - EXPECT_EQ( - get_asstates[9].mesid.code)>( - reinterpret_cast(&last_msg_->states[9].mesid.code)), - 0) - << "incorrect value for states[9].mesid.code, expected 0, is " - << last_msg_->states[9].mesid.code; - EXPECT_EQ( - get_asstates[9].mesid.sat)>( - reinterpret_cast(&last_msg_->states[9].mesid.sat)), - 16) - << "incorrect value for states[9].mesid.sat, expected 16, is " - << last_msg_->states[9].mesid.sat; - EXPECT_EQ(get_asstates[10].cn0)>( - reinterpret_cast(&last_msg_->states[10].cn0)), - 0) - << "incorrect value for states[10].cn0, expected 0, is " - << last_msg_->states[10].cn0; - EXPECT_EQ( - get_asstates[10].mesid.code)>( - reinterpret_cast(&last_msg_->states[10].mesid.code)), - 0) - << "incorrect value for states[10].mesid.code, expected 0, is " - << last_msg_->states[10].mesid.code; - EXPECT_EQ( - get_asstates[10].mesid.sat)>( - reinterpret_cast(&last_msg_->states[10].mesid.sat)), - 0) - << "incorrect value for states[10].mesid.sat, expected 0, is " - << last_msg_->states[10].mesid.sat; - EXPECT_EQ(get_asstates[11].cn0)>( - reinterpret_cast(&last_msg_->states[11].cn0)), - 213) - << "incorrect value for states[11].cn0, expected 213, is " - << last_msg_->states[11].cn0; - EXPECT_EQ( - get_asstates[11].mesid.code)>( - reinterpret_cast(&last_msg_->states[11].mesid.code)), - 0) - << "incorrect value for states[11].mesid.code, expected 0, is " - << last_msg_->states[11].mesid.code; - EXPECT_EQ( - get_asstates[11].mesid.sat)>( - reinterpret_cast(&last_msg_->states[11].mesid.sat)), - 23) - << "incorrect value for states[11].mesid.sat, expected 23, is " - << last_msg_->states[11].mesid.sat; - EXPECT_EQ(get_asstates[12].cn0)>( - reinterpret_cast(&last_msg_->states[12].cn0)), - 223) - << "incorrect value for states[12].cn0, expected 223, is " - << last_msg_->states[12].cn0; - EXPECT_EQ( - get_asstates[12].mesid.code)>( - reinterpret_cast(&last_msg_->states[12].mesid.code)), - 0) - << "incorrect value for states[12].mesid.code, expected 0, is " - << last_msg_->states[12].mesid.code; - EXPECT_EQ( - get_asstates[12].mesid.sat)>( - reinterpret_cast(&last_msg_->states[12].mesid.sat)), - 10) - << "incorrect value for states[12].mesid.sat, expected 10, is " - << last_msg_->states[12].mesid.sat; - EXPECT_EQ(get_asstates[13].cn0)>( - reinterpret_cast(&last_msg_->states[13].cn0)), - 0) - << "incorrect value for states[13].cn0, expected 0, is " - << last_msg_->states[13].cn0; - EXPECT_EQ( - get_asstates[13].mesid.code)>( - reinterpret_cast(&last_msg_->states[13].mesid.code)), - 0) - << "incorrect value for states[13].mesid.code, expected 0, is " - << last_msg_->states[13].mesid.code; - EXPECT_EQ( - get_asstates[13].mesid.sat)>( - reinterpret_cast(&last_msg_->states[13].mesid.sat)), - 0) - << "incorrect value for states[13].mesid.sat, expected 0, is " - << last_msg_->states[13].mesid.sat; - EXPECT_EQ(get_asstates[14].cn0)>( - reinterpret_cast(&last_msg_->states[14].cn0)), - 0) - << "incorrect value for states[14].cn0, expected 0, is " - << last_msg_->states[14].cn0; - EXPECT_EQ( - get_asstates[14].mesid.code)>( - reinterpret_cast(&last_msg_->states[14].mesid.code)), - 0) - << "incorrect value for states[14].mesid.code, expected 0, is " - << last_msg_->states[14].mesid.code; - EXPECT_EQ( - get_asstates[14].mesid.sat)>( - reinterpret_cast(&last_msg_->states[14].mesid.sat)), - 0) - << "incorrect value for states[14].mesid.sat, expected 0, is " - << last_msg_->states[14].mesid.sat; - EXPECT_EQ(get_asstates[15].cn0)>( - reinterpret_cast(&last_msg_->states[15].cn0)), - 0) - << "incorrect value for states[15].cn0, expected 0, is " - << last_msg_->states[15].cn0; - EXPECT_EQ( - get_asstates[15].mesid.code)>( - reinterpret_cast(&last_msg_->states[15].mesid.code)), - 0) - << "incorrect value for states[15].mesid.code, expected 0, is " - << last_msg_->states[15].mesid.code; - EXPECT_EQ( - get_asstates[15].mesid.sat)>( - reinterpret_cast(&last_msg_->states[15].mesid.sat)), - 0) - << "incorrect value for states[15].mesid.sat, expected 0, is " - << last_msg_->states[15].mesid.sat; - EXPECT_EQ(get_asstates[16].cn0)>( - reinterpret_cast(&last_msg_->states[16].cn0)), - 0) - << "incorrect value for states[16].cn0, expected 0, is " - << last_msg_->states[16].cn0; - EXPECT_EQ( - get_asstates[16].mesid.code)>( - reinterpret_cast(&last_msg_->states[16].mesid.code)), - 0) - << "incorrect value for states[16].mesid.code, expected 0, is " - << last_msg_->states[16].mesid.code; - EXPECT_EQ( - get_asstates[16].mesid.sat)>( - reinterpret_cast(&last_msg_->states[16].mesid.sat)), - 0) - << "incorrect value for states[16].mesid.sat, expected 0, is " - << last_msg_->states[16].mesid.sat; - EXPECT_EQ(get_asstates[17].cn0)>( - reinterpret_cast(&last_msg_->states[17].cn0)), - 202) - << "incorrect value for states[17].cn0, expected 202, is " - << last_msg_->states[17].cn0; - EXPECT_EQ( - get_asstates[17].mesid.code)>( - reinterpret_cast(&last_msg_->states[17].mesid.code)), - 2) - << "incorrect value for states[17].mesid.code, expected 2, is " - << last_msg_->states[17].mesid.code; - EXPECT_EQ( - get_asstates[17].mesid.sat)>( - reinterpret_cast(&last_msg_->states[17].mesid.sat)), - 131) - << "incorrect value for states[17].mesid.sat, expected 131, is " - << last_msg_->states[17].mesid.sat; - EXPECT_EQ(get_asstates[18].cn0)>( - reinterpret_cast(&last_msg_->states[18].cn0)), - 192) - << "incorrect value for states[18].cn0, expected 192, is " - << last_msg_->states[18].cn0; - EXPECT_EQ( - get_asstates[18].mesid.code)>( - reinterpret_cast(&last_msg_->states[18].mesid.code)), - 1) - << "incorrect value for states[18].mesid.code, expected 1, is " - << last_msg_->states[18].mesid.code; - EXPECT_EQ( - get_asstates[18].mesid.sat)>( - reinterpret_cast(&last_msg_->states[18].mesid.sat)), - 27) - << "incorrect value for states[18].mesid.sat, expected 27, is " - << last_msg_->states[18].mesid.sat; - EXPECT_EQ(get_asstates[19].cn0)>( - reinterpret_cast(&last_msg_->states[19].cn0)), - 165) - << "incorrect value for states[19].cn0, expected 165, is " - << last_msg_->states[19].cn0; - EXPECT_EQ( - get_asstates[19].mesid.code)>( - reinterpret_cast(&last_msg_->states[19].mesid.code)), - 1) - << "incorrect value for states[19].mesid.code, expected 1, is " - << last_msg_->states[19].mesid.code; - EXPECT_EQ( - get_asstates[19].mesid.sat)>( - reinterpret_cast(&last_msg_->states[19].mesid.sat)), - 15) - << "incorrect value for states[19].mesid.sat, expected 15, is " - << last_msg_->states[19].mesid.sat; - EXPECT_EQ(get_asstates[20].cn0)>( - reinterpret_cast(&last_msg_->states[20].cn0)), - 146) - << "incorrect value for states[20].cn0, expected 146, is " - << last_msg_->states[20].cn0; - EXPECT_EQ( - get_asstates[20].mesid.code)>( - reinterpret_cast(&last_msg_->states[20].mesid.code)), - 1) - << "incorrect value for states[20].mesid.code, expected 1, is " - << last_msg_->states[20].mesid.code; - EXPECT_EQ( - get_asstates[20].mesid.sat)>( - reinterpret_cast(&last_msg_->states[20].mesid.sat)), - 29) - << "incorrect value for states[20].mesid.sat, expected 29, is " - << last_msg_->states[20].mesid.sat; - EXPECT_EQ(get_asstates[21].cn0)>( - reinterpret_cast(&last_msg_->states[21].cn0)), - 170) - << "incorrect value for states[21].cn0, expected 170, is " - << last_msg_->states[21].cn0; - EXPECT_EQ( - get_asstates[21].mesid.code)>( - reinterpret_cast(&last_msg_->states[21].mesid.code)), - 1) - << "incorrect value for states[21].mesid.code, expected 1, is " - << last_msg_->states[21].mesid.code; - EXPECT_EQ( - get_asstates[21].mesid.sat)>( - reinterpret_cast(&last_msg_->states[21].mesid.sat)), - 32) - << "incorrect value for states[21].mesid.sat, expected 32, is " - << last_msg_->states[21].mesid.sat; - EXPECT_EQ(get_asstates[22].cn0)>( - reinterpret_cast(&last_msg_->states[22].cn0)), - 201) - << "incorrect value for states[22].cn0, expected 201, is " - << last_msg_->states[22].cn0; - EXPECT_EQ( - get_asstates[22].mesid.code)>( - reinterpret_cast(&last_msg_->states[22].mesid.code)), - 1) - << "incorrect value for states[22].mesid.code, expected 1, is " - << last_msg_->states[22].mesid.code; - EXPECT_EQ( - get_asstates[22].mesid.sat)>( - reinterpret_cast(&last_msg_->states[22].mesid.sat)), - 18) - << "incorrect value for states[22].mesid.sat, expected 18, is " - << last_msg_->states[22].mesid.sat; - EXPECT_EQ(get_asstates[23].cn0)>( - reinterpret_cast(&last_msg_->states[23].cn0)), - 0) - << "incorrect value for states[23].cn0, expected 0, is " - << last_msg_->states[23].cn0; - EXPECT_EQ( - get_asstates[23].mesid.code)>( - reinterpret_cast(&last_msg_->states[23].mesid.code)), - 0) - << "incorrect value for states[23].mesid.code, expected 0, is " - << last_msg_->states[23].mesid.code; - EXPECT_EQ( - get_asstates[23].mesid.sat)>( - reinterpret_cast(&last_msg_->states[23].mesid.sat)), - 0) - << "incorrect value for states[23].mesid.sat, expected 0, is " - << last_msg_->states[23].mesid.sat; - EXPECT_EQ(get_asstates[24].cn0)>( - reinterpret_cast(&last_msg_->states[24].cn0)), - 0) - << "incorrect value for states[24].cn0, expected 0, is " - << last_msg_->states[24].cn0; - EXPECT_EQ( - get_asstates[24].mesid.code)>( - reinterpret_cast(&last_msg_->states[24].mesid.code)), - 0) - << "incorrect value for states[24].mesid.code, expected 0, is " - << last_msg_->states[24].mesid.code; - EXPECT_EQ( - get_asstates[24].mesid.sat)>( - reinterpret_cast(&last_msg_->states[24].mesid.sat)), - 0) - << "incorrect value for states[24].mesid.sat, expected 0, is " - << last_msg_->states[24].mesid.sat; - EXPECT_EQ(get_asstates[25].cn0)>( - reinterpret_cast(&last_msg_->states[25].cn0)), - 0) - << "incorrect value for states[25].cn0, expected 0, is " - << last_msg_->states[25].cn0; - EXPECT_EQ( - get_asstates[25].mesid.code)>( - reinterpret_cast(&last_msg_->states[25].mesid.code)), - 0) - << "incorrect value for states[25].mesid.code, expected 0, is " - << last_msg_->states[25].mesid.code; - EXPECT_EQ( - get_asstates[25].mesid.sat)>( - reinterpret_cast(&last_msg_->states[25].mesid.sat)), - 0) - << "incorrect value for states[25].mesid.sat, expected 0, is " - << last_msg_->states[25].mesid.sat; - EXPECT_EQ(get_asstates[26].cn0)>( - reinterpret_cast(&last_msg_->states[26].cn0)), - 212) - << "incorrect value for states[26].cn0, expected 212, is " - << last_msg_->states[26].cn0; - EXPECT_EQ( - get_asstates[26].mesid.code)>( - reinterpret_cast(&last_msg_->states[26].mesid.code)), - 1) - << "incorrect value for states[26].mesid.code, expected 1, is " - << last_msg_->states[26].mesid.code; - EXPECT_EQ( - get_asstates[26].mesid.sat)>( - reinterpret_cast(&last_msg_->states[26].mesid.sat)), - 23) - << "incorrect value for states[26].mesid.sat, expected 23, is " - << last_msg_->states[26].mesid.sat; - EXPECT_EQ(get_asstates[27].cn0)>( - reinterpret_cast(&last_msg_->states[27].cn0)), - 205) - << "incorrect value for states[27].cn0, expected 205, is " - << last_msg_->states[27].cn0; - EXPECT_EQ( - get_asstates[27].mesid.code)>( - reinterpret_cast(&last_msg_->states[27].mesid.code)), - 1) - << "incorrect value for states[27].mesid.code, expected 1, is " - << last_msg_->states[27].mesid.code; - EXPECT_EQ( - get_asstates[27].mesid.sat)>( - reinterpret_cast(&last_msg_->states[27].mesid.sat)), - 10) - << "incorrect value for states[27].mesid.sat, expected 10, is " - << last_msg_->states[27].mesid.sat; - EXPECT_EQ(get_asstates[28].cn0)>( - reinterpret_cast(&last_msg_->states[28].cn0)), - 0) - << "incorrect value for states[28].cn0, expected 0, is " - << last_msg_->states[28].cn0; - EXPECT_EQ( - get_asstates[28].mesid.code)>( - reinterpret_cast(&last_msg_->states[28].mesid.code)), - 0) - << "incorrect value for states[28].mesid.code, expected 0, is " - << last_msg_->states[28].mesid.code; - EXPECT_EQ( - get_asstates[28].mesid.sat)>( - reinterpret_cast(&last_msg_->states[28].mesid.sat)), - 0) - << "incorrect value for states[28].mesid.sat, expected 0, is " - << last_msg_->states[28].mesid.sat; - EXPECT_EQ(get_asstates[29].cn0)>( - reinterpret_cast(&last_msg_->states[29].cn0)), - 230) - << "incorrect value for states[29].cn0, expected 230, is " - << last_msg_->states[29].cn0; - EXPECT_EQ( - get_asstates[29].mesid.code)>( - reinterpret_cast(&last_msg_->states[29].mesid.code)), - 3) - << "incorrect value for states[29].mesid.code, expected 3, is " - << last_msg_->states[29].mesid.code; - EXPECT_EQ( - get_asstates[29].mesid.sat)>( - reinterpret_cast(&last_msg_->states[29].mesid.sat)), - 96) - << "incorrect value for states[29].mesid.sat, expected 96, is " - << last_msg_->states[29].mesid.sat; - EXPECT_EQ(get_asstates[30].cn0)>( - reinterpret_cast(&last_msg_->states[30].cn0)), - 0) - << "incorrect value for states[30].cn0, expected 0, is " - << last_msg_->states[30].cn0; - EXPECT_EQ( - get_asstates[30].mesid.code)>( - reinterpret_cast(&last_msg_->states[30].mesid.code)), - 0) - << "incorrect value for states[30].mesid.code, expected 0, is " - << last_msg_->states[30].mesid.code; - EXPECT_EQ( - get_asstates[30].mesid.sat)>( - reinterpret_cast(&last_msg_->states[30].mesid.sat)), - 0) - << "incorrect value for states[30].mesid.sat, expected 0, is " - << last_msg_->states[30].mesid.sat; - EXPECT_EQ(get_asstates[31].cn0)>( - reinterpret_cast(&last_msg_->states[31].cn0)), - 214) - << "incorrect value for states[31].cn0, expected 214, is " - << last_msg_->states[31].cn0; - EXPECT_EQ( - get_asstates[31].mesid.code)>( - reinterpret_cast(&last_msg_->states[31].mesid.code)), - 3) - << "incorrect value for states[31].mesid.code, expected 3, is " - << last_msg_->states[31].mesid.code; - EXPECT_EQ( - get_asstates[31].mesid.sat)>( - reinterpret_cast(&last_msg_->states[31].mesid.sat)), - 101) - << "incorrect value for states[31].mesid.sat, expected 101, is " - << last_msg_->states[31].mesid.sat; - EXPECT_EQ(get_asstates[32].cn0)>( - reinterpret_cast(&last_msg_->states[32].cn0)), - 212) - << "incorrect value for states[32].cn0, expected 212, is " - << last_msg_->states[32].cn0; - EXPECT_EQ( - get_asstates[32].mesid.code)>( - reinterpret_cast(&last_msg_->states[32].mesid.code)), - 3) - << "incorrect value for states[32].mesid.code, expected 3, is " - << last_msg_->states[32].mesid.code; - EXPECT_EQ( - get_asstates[32].mesid.sat)>( - reinterpret_cast(&last_msg_->states[32].mesid.sat)), - 103) - << "incorrect value for states[32].mesid.sat, expected 103, is " - << last_msg_->states[32].mesid.sat; - EXPECT_EQ(get_asstates[33].cn0)>( - reinterpret_cast(&last_msg_->states[33].cn0)), - 209) - << "incorrect value for states[33].cn0, expected 209, is " - << last_msg_->states[33].cn0; - EXPECT_EQ( - get_asstates[33].mesid.code)>( - reinterpret_cast(&last_msg_->states[33].mesid.code)), - 3) - << "incorrect value for states[33].mesid.code, expected 3, is " - << last_msg_->states[33].mesid.code; - EXPECT_EQ( - get_asstates[33].mesid.sat)>( - reinterpret_cast(&last_msg_->states[33].mesid.sat)), - 104) - << "incorrect value for states[33].mesid.sat, expected 104, is " - << last_msg_->states[33].mesid.sat; - EXPECT_EQ(get_asstates[34].cn0)>( - reinterpret_cast(&last_msg_->states[34].cn0)), - 157) - << "incorrect value for states[34].cn0, expected 157, is " - << last_msg_->states[34].cn0; - EXPECT_EQ( - get_asstates[34].mesid.code)>( - reinterpret_cast(&last_msg_->states[34].mesid.code)), - 3) - << "incorrect value for states[34].mesid.code, expected 3, is " - << last_msg_->states[34].mesid.code; - EXPECT_EQ( - get_asstates[34].mesid.sat)>( - reinterpret_cast(&last_msg_->states[34].mesid.sat)), - 106) - << "incorrect value for states[34].mesid.sat, expected 106, is " - << last_msg_->states[34].mesid.sat; - EXPECT_EQ(get_asstates[35].cn0)>( - reinterpret_cast(&last_msg_->states[35].cn0)), - 230) - << "incorrect value for states[35].cn0, expected 230, is " - << last_msg_->states[35].cn0; - EXPECT_EQ( - get_asstates[35].mesid.code)>( - reinterpret_cast(&last_msg_->states[35].mesid.code)), - 3) - << "incorrect value for states[35].mesid.code, expected 3, is " - << last_msg_->states[35].mesid.code; - EXPECT_EQ( - get_asstates[35].mesid.sat)>( - reinterpret_cast(&last_msg_->states[35].mesid.sat)), - 102) - << "incorrect value for states[35].mesid.sat, expected 102, is " - << last_msg_->states[35].mesid.sat; - EXPECT_EQ(get_asstates[36].cn0)>( - reinterpret_cast(&last_msg_->states[36].cn0)), - 0) - << "incorrect value for states[36].cn0, expected 0, is " - << last_msg_->states[36].cn0; - EXPECT_EQ( - get_asstates[36].mesid.code)>( - reinterpret_cast(&last_msg_->states[36].mesid.code)), - 0) - << "incorrect value for states[36].mesid.code, expected 0, is " - << last_msg_->states[36].mesid.code; - EXPECT_EQ( - get_asstates[36].mesid.sat)>( - reinterpret_cast(&last_msg_->states[36].mesid.sat)), - 0) - << "incorrect value for states[36].mesid.sat, expected 0, is " - << last_msg_->states[36].mesid.sat; - EXPECT_EQ(get_asstates[37].cn0)>( - reinterpret_cast(&last_msg_->states[37].cn0)), - 0) - << "incorrect value for states[37].cn0, expected 0, is " - << last_msg_->states[37].cn0; - EXPECT_EQ( - get_asstates[37].mesid.code)>( - reinterpret_cast(&last_msg_->states[37].mesid.code)), - 0) - << "incorrect value for states[37].mesid.code, expected 0, is " - << last_msg_->states[37].mesid.code; - EXPECT_EQ( - get_asstates[37].mesid.sat)>( - reinterpret_cast(&last_msg_->states[37].mesid.sat)), - 0) - << "incorrect value for states[37].mesid.sat, expected 0, is " - << last_msg_->states[37].mesid.sat; - EXPECT_EQ(get_asstates[38].cn0)>( - reinterpret_cast(&last_msg_->states[38].cn0)), - 189) - << "incorrect value for states[38].cn0, expected 189, is " - << last_msg_->states[38].cn0; - EXPECT_EQ( - get_asstates[38].mesid.code)>( - reinterpret_cast(&last_msg_->states[38].mesid.code)), - 4) - << "incorrect value for states[38].mesid.code, expected 4, is " - << last_msg_->states[38].mesid.code; - EXPECT_EQ( - get_asstates[38].mesid.sat)>( - reinterpret_cast(&last_msg_->states[38].mesid.sat)), - 101) - << "incorrect value for states[38].mesid.sat, expected 101, is " - << last_msg_->states[38].mesid.sat; - EXPECT_EQ(get_asstates[39].cn0)>( - reinterpret_cast(&last_msg_->states[39].cn0)), - 207) - << "incorrect value for states[39].cn0, expected 207, is " - << last_msg_->states[39].cn0; - EXPECT_EQ( - get_asstates[39].mesid.code)>( - reinterpret_cast(&last_msg_->states[39].mesid.code)), - 4) - << "incorrect value for states[39].mesid.code, expected 4, is " - << last_msg_->states[39].mesid.code; - EXPECT_EQ( - get_asstates[39].mesid.sat)>( - reinterpret_cast(&last_msg_->states[39].mesid.sat)), - 96) - << "incorrect value for states[39].mesid.sat, expected 96, is " - << last_msg_->states[39].mesid.sat; - EXPECT_EQ(get_asstates[40].cn0)>( - reinterpret_cast(&last_msg_->states[40].cn0)), - 164) - << "incorrect value for states[40].cn0, expected 164, is " - << last_msg_->states[40].cn0; - EXPECT_EQ( - get_asstates[40].mesid.code)>( - reinterpret_cast(&last_msg_->states[40].mesid.code)), - 4) - << "incorrect value for states[40].mesid.code, expected 4, is " - << last_msg_->states[40].mesid.code; - EXPECT_EQ( - get_asstates[40].mesid.sat)>( - reinterpret_cast(&last_msg_->states[40].mesid.sat)), - 106) - << "incorrect value for states[40].mesid.sat, expected 106, is " - << last_msg_->states[40].mesid.sat; - EXPECT_EQ(get_asstates[41].cn0)>( - reinterpret_cast(&last_msg_->states[41].cn0)), - 193) - << "incorrect value for states[41].cn0, expected 193, is " - << last_msg_->states[41].cn0; - EXPECT_EQ( - get_asstates[41].mesid.code)>( - reinterpret_cast(&last_msg_->states[41].mesid.code)), - 4) - << "incorrect value for states[41].mesid.code, expected 4, is " - << last_msg_->states[41].mesid.code; - EXPECT_EQ( - get_asstates[41].mesid.sat)>( - reinterpret_cast(&last_msg_->states[41].mesid.sat)), - 104) - << "incorrect value for states[41].mesid.sat, expected 104, is " - << last_msg_->states[41].mesid.sat; - EXPECT_EQ(get_asstates[42].cn0)>( - reinterpret_cast(&last_msg_->states[42].cn0)), - 0) - << "incorrect value for states[42].cn0, expected 0, is " - << last_msg_->states[42].cn0; - EXPECT_EQ( - get_asstates[42].mesid.code)>( - reinterpret_cast(&last_msg_->states[42].mesid.code)), - 0) - << "incorrect value for states[42].mesid.code, expected 0, is " - << last_msg_->states[42].mesid.code; - EXPECT_EQ( - get_asstates[42].mesid.sat)>( - reinterpret_cast(&last_msg_->states[42].mesid.sat)), - 0) - << "incorrect value for states[42].mesid.sat, expected 0, is " - << last_msg_->states[42].mesid.sat; - EXPECT_EQ(get_asstates[43].cn0)>( - reinterpret_cast(&last_msg_->states[43].cn0)), - 208) - << "incorrect value for states[43].cn0, expected 208, is " - << last_msg_->states[43].cn0; - EXPECT_EQ( - get_asstates[43].mesid.code)>( - reinterpret_cast(&last_msg_->states[43].mesid.code)), - 4) - << "incorrect value for states[43].mesid.code, expected 4, is " - << last_msg_->states[43].mesid.code; - EXPECT_EQ( - get_asstates[43].mesid.sat)>( - reinterpret_cast(&last_msg_->states[43].mesid.sat)), - 102) - << "incorrect value for states[43].mesid.sat, expected 102, is " - << last_msg_->states[43].mesid.sat; - EXPECT_EQ(get_asstates[44].cn0)>( - reinterpret_cast(&last_msg_->states[44].cn0)), - 0) - << "incorrect value for states[44].cn0, expected 0, is " - << last_msg_->states[44].cn0; - EXPECT_EQ( - get_asstates[44].mesid.code)>( - reinterpret_cast(&last_msg_->states[44].mesid.code)), - 0) - << "incorrect value for states[44].mesid.code, expected 0, is " - << last_msg_->states[44].mesid.code; - EXPECT_EQ( - get_asstates[44].mesid.sat)>( - reinterpret_cast(&last_msg_->states[44].mesid.sat)), - 0) - << "incorrect value for states[44].mesid.sat, expected 0, is " - << last_msg_->states[44].mesid.sat; - EXPECT_EQ(get_asstates[45].cn0)>( - reinterpret_cast(&last_msg_->states[45].cn0)), - 212) - << "incorrect value for states[45].cn0, expected 212, is " - << last_msg_->states[45].cn0; - EXPECT_EQ( - get_asstates[45].mesid.code)>( - reinterpret_cast(&last_msg_->states[45].mesid.code)), - 12) - << "incorrect value for states[45].mesid.code, expected 12, is " - << last_msg_->states[45].mesid.code; - EXPECT_EQ( - get_asstates[45].mesid.sat)>( - reinterpret_cast(&last_msg_->states[45].mesid.sat)), - 27) - << "incorrect value for states[45].mesid.sat, expected 27, is " - << last_msg_->states[45].mesid.sat; - EXPECT_EQ(get_asstates[46].cn0)>( - reinterpret_cast(&last_msg_->states[46].cn0)), - 161) - << "incorrect value for states[46].cn0, expected 161, is " - << last_msg_->states[46].cn0; - EXPECT_EQ( - get_asstates[46].mesid.code)>( - reinterpret_cast(&last_msg_->states[46].mesid.code)), - 12) - << "incorrect value for states[46].mesid.code, expected 12, is " - << last_msg_->states[46].mesid.code; - EXPECT_EQ( - get_asstates[46].mesid.sat)>( - reinterpret_cast(&last_msg_->states[46].mesid.sat)), - 29) - << "incorrect value for states[46].mesid.sat, expected 29, is " - << last_msg_->states[46].mesid.sat; - EXPECT_EQ(get_asstates[47].cn0)>( - reinterpret_cast(&last_msg_->states[47].cn0)), - 216) - << "incorrect value for states[47].cn0, expected 216, is " - << last_msg_->states[47].cn0; - EXPECT_EQ( - get_asstates[47].mesid.code)>( - reinterpret_cast(&last_msg_->states[47].mesid.code)), - 12) - << "incorrect value for states[47].mesid.code, expected 12, is " - << last_msg_->states[47].mesid.code; - EXPECT_EQ( - get_asstates[47].mesid.sat)>( - reinterpret_cast(&last_msg_->states[47].mesid.sat)), - 32) - << "incorrect value for states[47].mesid.sat, expected 32, is " - << last_msg_->states[47].mesid.sat; - EXPECT_EQ(get_asstates[48].cn0)>( - reinterpret_cast(&last_msg_->states[48].cn0)), - 216) - << "incorrect value for states[48].cn0, expected 216, is " - << last_msg_->states[48].cn0; - EXPECT_EQ( - get_asstates[48].mesid.code)>( - reinterpret_cast(&last_msg_->states[48].mesid.code)), - 12) - << "incorrect value for states[48].mesid.code, expected 12, is " - << last_msg_->states[48].mesid.code; - EXPECT_EQ( - get_asstates[48].mesid.sat)>( - reinterpret_cast(&last_msg_->states[48].mesid.sat)), - 30) - << "incorrect value for states[48].mesid.sat, expected 30, is " - << last_msg_->states[48].mesid.sat; - EXPECT_EQ(get_asstates[49].cn0)>( - reinterpret_cast(&last_msg_->states[49].cn0)), - 178) - << "incorrect value for states[49].cn0, expected 178, is " - << last_msg_->states[49].cn0; - EXPECT_EQ( - get_asstates[49].mesid.code)>( - reinterpret_cast(&last_msg_->states[49].mesid.code)), - 12) - << "incorrect value for states[49].mesid.code, expected 12, is " - << last_msg_->states[49].mesid.code; - EXPECT_EQ( - get_asstates[49].mesid.sat)>( - reinterpret_cast(&last_msg_->states[49].mesid.sat)), - 20) - << "incorrect value for states[49].mesid.sat, expected 20, is " - << last_msg_->states[49].mesid.sat; - EXPECT_EQ(get_asstates[50].cn0)>( - reinterpret_cast(&last_msg_->states[50].cn0)), - 0) - << "incorrect value for states[50].cn0, expected 0, is " - << last_msg_->states[50].cn0; - EXPECT_EQ( - get_asstates[50].mesid.code)>( - reinterpret_cast(&last_msg_->states[50].mesid.code)), - 0) - << "incorrect value for states[50].mesid.code, expected 0, is " - << last_msg_->states[50].mesid.code; - EXPECT_EQ( - get_asstates[50].mesid.sat)>( - reinterpret_cast(&last_msg_->states[50].mesid.sat)), - 0) - << "incorrect value for states[50].mesid.sat, expected 0, is " - << last_msg_->states[50].mesid.sat; - EXPECT_EQ(get_asstates[51].cn0)>( - reinterpret_cast(&last_msg_->states[51].cn0)), - 0) - << "incorrect value for states[51].cn0, expected 0, is " - << last_msg_->states[51].cn0; - EXPECT_EQ( - get_asstates[51].mesid.code)>( - reinterpret_cast(&last_msg_->states[51].mesid.code)), - 0) - << "incorrect value for states[51].mesid.code, expected 0, is " - << last_msg_->states[51].mesid.code; - EXPECT_EQ( - get_asstates[51].mesid.sat)>( - reinterpret_cast(&last_msg_->states[51].mesid.sat)), - 0) - << "incorrect value for states[51].mesid.sat, expected 0, is " - << last_msg_->states[51].mesid.sat; - EXPECT_EQ(get_asstates[52].cn0)>( - reinterpret_cast(&last_msg_->states[52].cn0)), - 0) - << "incorrect value for states[52].cn0, expected 0, is " - << last_msg_->states[52].cn0; - EXPECT_EQ( - get_asstates[52].mesid.code)>( - reinterpret_cast(&last_msg_->states[52].mesid.code)), - 0) - << "incorrect value for states[52].mesid.code, expected 0, is " - << last_msg_->states[52].mesid.code; - EXPECT_EQ( - get_asstates[52].mesid.sat)>( - reinterpret_cast(&last_msg_->states[52].mesid.sat)), - 0) - << "incorrect value for states[52].mesid.sat, expected 0, is " - << last_msg_->states[52].mesid.sat; - EXPECT_EQ(get_asstates[53].cn0)>( - reinterpret_cast(&last_msg_->states[53].cn0)), - 0) - << "incorrect value for states[53].cn0, expected 0, is " - << last_msg_->states[53].cn0; - EXPECT_EQ( - get_asstates[53].mesid.code)>( - reinterpret_cast(&last_msg_->states[53].mesid.code)), - 0) - << "incorrect value for states[53].mesid.code, expected 0, is " - << last_msg_->states[53].mesid.code; - EXPECT_EQ( - get_asstates[53].mesid.sat)>( - reinterpret_cast(&last_msg_->states[53].mesid.sat)), - 0) - << "incorrect value for states[53].mesid.sat, expected 0, is " - << last_msg_->states[53].mesid.sat; - EXPECT_EQ(get_asstates[54].cn0)>( - reinterpret_cast(&last_msg_->states[54].cn0)), - 0) - << "incorrect value for states[54].cn0, expected 0, is " - << last_msg_->states[54].cn0; - EXPECT_EQ( - get_asstates[54].mesid.code)>( - reinterpret_cast(&last_msg_->states[54].mesid.code)), - 0) - << "incorrect value for states[54].mesid.code, expected 0, is " - << last_msg_->states[54].mesid.code; - EXPECT_EQ( - get_asstates[54].mesid.sat)>( - reinterpret_cast(&last_msg_->states[54].mesid.sat)), - 0) - << "incorrect value for states[54].mesid.sat, expected 0, is " - << last_msg_->states[54].mesid.sat; - EXPECT_EQ(get_asstates[55].cn0)>( - reinterpret_cast(&last_msg_->states[55].cn0)), - 0) - << "incorrect value for states[55].cn0, expected 0, is " - << last_msg_->states[55].cn0; - EXPECT_EQ( - get_asstates[55].mesid.code)>( - reinterpret_cast(&last_msg_->states[55].mesid.code)), - 0) - << "incorrect value for states[55].mesid.code, expected 0, is " - << last_msg_->states[55].mesid.code; - EXPECT_EQ( - get_asstates[55].mesid.sat)>( - reinterpret_cast(&last_msg_->states[55].mesid.sat)), - 0) - << "incorrect value for states[55].mesid.sat, expected 0, is " - << last_msg_->states[55].mesid.sat; - EXPECT_EQ(get_asstates[56].cn0)>( - reinterpret_cast(&last_msg_->states[56].cn0)), - 0) - << "incorrect value for states[56].cn0, expected 0, is " - << last_msg_->states[56].cn0; - EXPECT_EQ( - get_asstates[56].mesid.code)>( - reinterpret_cast(&last_msg_->states[56].mesid.code)), - 0) - << "incorrect value for states[56].mesid.code, expected 0, is " - << last_msg_->states[56].mesid.code; - EXPECT_EQ( - get_asstates[56].mesid.sat)>( - reinterpret_cast(&last_msg_->states[56].mesid.sat)), - 0) - << "incorrect value for states[56].mesid.sat, expected 0, is " - << last_msg_->states[56].mesid.sat; - EXPECT_EQ(get_asstates[57].cn0)>( - reinterpret_cast(&last_msg_->states[57].cn0)), - 0) - << "incorrect value for states[57].cn0, expected 0, is " - << last_msg_->states[57].cn0; - EXPECT_EQ( - get_asstates[57].mesid.code)>( - reinterpret_cast(&last_msg_->states[57].mesid.code)), - 0) - << "incorrect value for states[57].mesid.code, expected 0, is " - << last_msg_->states[57].mesid.code; - EXPECT_EQ( - get_asstates[57].mesid.sat)>( - reinterpret_cast(&last_msg_->states[57].mesid.sat)), - 0) - << "incorrect value for states[57].mesid.sat, expected 0, is " - << last_msg_->states[57].mesid.sat; - EXPECT_EQ(get_asstates[58].cn0)>( - reinterpret_cast(&last_msg_->states[58].cn0)), - 0) - << "incorrect value for states[58].cn0, expected 0, is " - << last_msg_->states[58].cn0; - EXPECT_EQ( - get_asstates[58].mesid.code)>( - reinterpret_cast(&last_msg_->states[58].mesid.code)), - 0) - << "incorrect value for states[58].mesid.code, expected 0, is " - << last_msg_->states[58].mesid.code; - EXPECT_EQ( - get_asstates[58].mesid.sat)>( - reinterpret_cast(&last_msg_->states[58].mesid.sat)), - 0) - << "incorrect value for states[58].mesid.sat, expected 0, is " - << last_msg_->states[58].mesid.sat; - EXPECT_EQ(get_asstates[59].cn0)>( - reinterpret_cast(&last_msg_->states[59].cn0)), - 0) - << "incorrect value for states[59].cn0, expected 0, is " - << last_msg_->states[59].cn0; - EXPECT_EQ( - get_asstates[59].mesid.code)>( - reinterpret_cast(&last_msg_->states[59].mesid.code)), - 0) - << "incorrect value for states[59].mesid.code, expected 0, is " - << last_msg_->states[59].mesid.code; - EXPECT_EQ( - get_asstates[59].mesid.sat)>( - reinterpret_cast(&last_msg_->states[59].mesid.sat)), - 0) - << "incorrect value for states[59].mesid.sat, expected 0, is " - << last_msg_->states[59].mesid.sat; - EXPECT_EQ(get_asstates[60].cn0)>( - reinterpret_cast(&last_msg_->states[60].cn0)), - 0) - << "incorrect value for states[60].cn0, expected 0, is " - << last_msg_->states[60].cn0; - EXPECT_EQ( - get_asstates[60].mesid.code)>( - reinterpret_cast(&last_msg_->states[60].mesid.code)), - 0) - << "incorrect value for states[60].mesid.code, expected 0, is " - << last_msg_->states[60].mesid.code; - EXPECT_EQ( - get_asstates[60].mesid.sat)>( - reinterpret_cast(&last_msg_->states[60].mesid.sat)), - 0) - << "incorrect value for states[60].mesid.sat, expected 0, is " - << last_msg_->states[60].mesid.sat; - EXPECT_EQ(get_asstates[61].cn0)>( - reinterpret_cast(&last_msg_->states[61].cn0)), - 0) - << "incorrect value for states[61].cn0, expected 0, is " - << last_msg_->states[61].cn0; - EXPECT_EQ( - get_asstates[61].mesid.code)>( - reinterpret_cast(&last_msg_->states[61].mesid.code)), - 0) - << "incorrect value for states[61].mesid.code, expected 0, is " - << last_msg_->states[61].mesid.code; - EXPECT_EQ( - get_asstates[61].mesid.sat)>( - reinterpret_cast(&last_msg_->states[61].mesid.sat)), - 0) - << "incorrect value for states[61].mesid.sat, expected 0, is " - << last_msg_->states[61].mesid.sat; - EXPECT_EQ(get_asstates[62].cn0)>( - reinterpret_cast(&last_msg_->states[62].cn0)), - 0) - << "incorrect value for states[62].cn0, expected 0, is " - << last_msg_->states[62].cn0; - EXPECT_EQ( - get_asstates[62].mesid.code)>( - reinterpret_cast(&last_msg_->states[62].mesid.code)), - 0) - << "incorrect value for states[62].mesid.code, expected 0, is " - << last_msg_->states[62].mesid.code; - EXPECT_EQ( - get_asstates[62].mesid.sat)>( - reinterpret_cast(&last_msg_->states[62].mesid.sat)), - 0) - << "incorrect value for states[62].mesid.sat, expected 0, is " - << last_msg_->states[62].mesid.sat; - EXPECT_EQ(get_asstates[63].cn0)>( - reinterpret_cast(&last_msg_->states[63].cn0)), - 203) - << "incorrect value for states[63].cn0, expected 203, is " - << last_msg_->states[63].cn0; - EXPECT_EQ( - get_asstates[63].mesid.code)>( - reinterpret_cast(&last_msg_->states[63].mesid.code)), - 14) - << "incorrect value for states[63].mesid.code, expected 14, is " - << last_msg_->states[63].mesid.code; - EXPECT_EQ( - get_asstates[63].mesid.sat)>( - reinterpret_cast(&last_msg_->states[63].mesid.sat)), - 36) - << "incorrect value for states[63].mesid.sat, expected 36, is " - << last_msg_->states[63].mesid.sat; - EXPECT_EQ(get_asstates[64].cn0)>( - reinterpret_cast(&last_msg_->states[64].cn0)), - 0) - << "incorrect value for states[64].cn0, expected 0, is " - << last_msg_->states[64].cn0; - EXPECT_EQ( - get_asstates[64].mesid.code)>( - reinterpret_cast(&last_msg_->states[64].mesid.code)), - 0) - << "incorrect value for states[64].mesid.code, expected 0, is " - << last_msg_->states[64].mesid.code; - EXPECT_EQ( - get_asstates[64].mesid.sat)>( - reinterpret_cast(&last_msg_->states[64].mesid.sat)), - 0) - << "incorrect value for states[64].mesid.sat, expected 0, is " - << last_msg_->states[64].mesid.sat; - EXPECT_EQ(get_asstates[65].cn0)>( - reinterpret_cast(&last_msg_->states[65].cn0)), - 158) - << "incorrect value for states[65].cn0, expected 158, is " - << last_msg_->states[65].cn0; - EXPECT_EQ( - get_asstates[65].mesid.code)>( - reinterpret_cast(&last_msg_->states[65].mesid.code)), - 14) - << "incorrect value for states[65].mesid.code, expected 14, is " - << last_msg_->states[65].mesid.code; - EXPECT_EQ( - get_asstates[65].mesid.sat)>( - reinterpret_cast(&last_msg_->states[65].mesid.sat)), - 5) - << "incorrect value for states[65].mesid.sat, expected 5, is " - << last_msg_->states[65].mesid.sat; - EXPECT_EQ(get_asstates[66].cn0)>( - reinterpret_cast(&last_msg_->states[66].cn0)), - 194) - << "incorrect value for states[66].cn0, expected 194, is " - << last_msg_->states[66].cn0; - EXPECT_EQ( - get_asstates[66].mesid.code)>( - reinterpret_cast(&last_msg_->states[66].mesid.code)), - 14) - << "incorrect value for states[66].mesid.code, expected 14, is " - << last_msg_->states[66].mesid.code; - EXPECT_EQ( - get_asstates[66].mesid.sat)>( - reinterpret_cast(&last_msg_->states[66].mesid.sat)), - 4) - << "incorrect value for states[66].mesid.sat, expected 4, is " - << last_msg_->states[66].mesid.sat; - EXPECT_EQ(get_asstates[67].cn0)>( - reinterpret_cast(&last_msg_->states[67].cn0)), - 192) - << "incorrect value for states[67].cn0, expected 192, is " - << last_msg_->states[67].cn0; - EXPECT_EQ( - get_asstates[67].mesid.code)>( - reinterpret_cast(&last_msg_->states[67].mesid.code)), - 14) - << "incorrect value for states[67].mesid.code, expected 14, is " - << last_msg_->states[67].mesid.code; - EXPECT_EQ( - get_asstates[67].mesid.sat)>( - reinterpret_cast(&last_msg_->states[67].mesid.sat)), - 11) - << "incorrect value for states[67].mesid.sat, expected 11, is " - << last_msg_->states[67].mesid.sat; - EXPECT_EQ(get_asstates[68].cn0)>( - reinterpret_cast(&last_msg_->states[68].cn0)), - 207) - << "incorrect value for states[68].cn0, expected 207, is " - << last_msg_->states[68].cn0; - EXPECT_EQ( - get_asstates[68].mesid.code)>( - reinterpret_cast(&last_msg_->states[68].mesid.code)), - 14) - << "incorrect value for states[68].mesid.code, expected 14, is " - << last_msg_->states[68].mesid.code; - EXPECT_EQ( - get_asstates[68].mesid.sat)>( - reinterpret_cast(&last_msg_->states[68].mesid.sat)), - 9) - << "incorrect value for states[68].mesid.sat, expected 9, is " - << last_msg_->states[68].mesid.sat; - EXPECT_EQ(get_asstates[69].cn0)>( - reinterpret_cast(&last_msg_->states[69].cn0)), - 0) - << "incorrect value for states[69].cn0, expected 0, is " - << last_msg_->states[69].cn0; - EXPECT_EQ( - get_asstates[69].mesid.code)>( - reinterpret_cast(&last_msg_->states[69].mesid.code)), - 0) - << "incorrect value for states[69].mesid.code, expected 0, is " - << last_msg_->states[69].mesid.code; - EXPECT_EQ( - get_asstates[69].mesid.sat)>( - reinterpret_cast(&last_msg_->states[69].mesid.sat)), - 0) - << "incorrect value for states[69].mesid.sat, expected 0, is " - << last_msg_->states[69].mesid.sat; - EXPECT_EQ(get_asstates[70].cn0)>( - reinterpret_cast(&last_msg_->states[70].cn0)), - 0) - << "incorrect value for states[70].cn0, expected 0, is " - << last_msg_->states[70].cn0; - EXPECT_EQ( - get_asstates[70].mesid.code)>( - reinterpret_cast(&last_msg_->states[70].mesid.code)), - 0) - << "incorrect value for states[70].mesid.code, expected 0, is " - << last_msg_->states[70].mesid.code; - EXPECT_EQ( - get_asstates[70].mesid.sat)>( - reinterpret_cast(&last_msg_->states[70].mesid.sat)), - 0) - << "incorrect value for states[70].mesid.sat, expected 0, is " - << last_msg_->states[70].mesid.sat; - EXPECT_EQ(get_asstates[71].cn0)>( - reinterpret_cast(&last_msg_->states[71].cn0)), - 0) - << "incorrect value for states[71].cn0, expected 0, is " - << last_msg_->states[71].cn0; - EXPECT_EQ( - get_asstates[71].mesid.code)>( - reinterpret_cast(&last_msg_->states[71].mesid.code)), - 0) - << "incorrect value for states[71].mesid.code, expected 0, is " - << last_msg_->states[71].mesid.code; - EXPECT_EQ( - get_asstates[71].mesid.sat)>( - reinterpret_cast(&last_msg_->states[71].mesid.sat)), - 0) - << "incorrect value for states[71].mesid.sat, expected 0, is " - << last_msg_->states[71].mesid.sat; - EXPECT_EQ(get_asstates[72].cn0)>( - reinterpret_cast(&last_msg_->states[72].cn0)), - 218) - << "incorrect value for states[72].cn0, expected 218, is " - << last_msg_->states[72].cn0; - EXPECT_EQ( - get_asstates[72].mesid.code)>( - reinterpret_cast(&last_msg_->states[72].mesid.code)), - 20) - << "incorrect value for states[72].mesid.code, expected 20, is " - << last_msg_->states[72].mesid.code; - EXPECT_EQ( - get_asstates[72].mesid.sat)>( - reinterpret_cast(&last_msg_->states[72].mesid.sat)), - 9) - << "incorrect value for states[72].mesid.sat, expected 9, is " - << last_msg_->states[72].mesid.sat; - EXPECT_EQ(get_asstates[73].cn0)>( - reinterpret_cast(&last_msg_->states[73].cn0)), - 176) - << "incorrect value for states[73].cn0, expected 176, is " - << last_msg_->states[73].cn0; - EXPECT_EQ( - get_asstates[73].mesid.code)>( - reinterpret_cast(&last_msg_->states[73].mesid.code)), - 20) - << "incorrect value for states[73].mesid.code, expected 20, is " - << last_msg_->states[73].mesid.code; - EXPECT_EQ( - get_asstates[73].mesid.sat)>( - reinterpret_cast(&last_msg_->states[73].mesid.sat)), - 5) - << "incorrect value for states[73].mesid.sat, expected 5, is " - << last_msg_->states[73].mesid.sat; - EXPECT_EQ(get_asstates[74].cn0)>( - reinterpret_cast(&last_msg_->states[74].cn0)), - 217) - << "incorrect value for states[74].cn0, expected 217, is " - << last_msg_->states[74].cn0; - EXPECT_EQ( - get_asstates[74].mesid.code)>( - reinterpret_cast(&last_msg_->states[74].mesid.code)), - 20) - << "incorrect value for states[74].mesid.code, expected 20, is " - << last_msg_->states[74].mesid.code; - EXPECT_EQ( - get_asstates[74].mesid.sat)>( - reinterpret_cast(&last_msg_->states[74].mesid.sat)), - 36) - << "incorrect value for states[74].mesid.sat, expected 36, is " - << last_msg_->states[74].mesid.sat; - EXPECT_EQ(get_asstates[75].cn0)>( - reinterpret_cast(&last_msg_->states[75].cn0)), - 200) - << "incorrect value for states[75].cn0, expected 200, is " - << last_msg_->states[75].cn0; - EXPECT_EQ( - get_asstates[75].mesid.code)>( - reinterpret_cast(&last_msg_->states[75].mesid.code)), - 20) - << "incorrect value for states[75].mesid.code, expected 20, is " - << last_msg_->states[75].mesid.code; - EXPECT_EQ( - get_asstates[75].mesid.sat)>( - reinterpret_cast(&last_msg_->states[75].mesid.sat)), - 11) - << "incorrect value for states[75].mesid.sat, expected 11, is " - << last_msg_->states[75].mesid.sat; - EXPECT_EQ(get_asstates[76].cn0)>( - reinterpret_cast(&last_msg_->states[76].cn0)), - 205) - << "incorrect value for states[76].cn0, expected 205, is " - << last_msg_->states[76].cn0; - EXPECT_EQ( - get_asstates[76].mesid.code)>( - reinterpret_cast(&last_msg_->states[76].mesid.code)), - 20) - << "incorrect value for states[76].mesid.code, expected 20, is " - << last_msg_->states[76].mesid.code; - EXPECT_EQ( - get_asstates[76].mesid.sat)>( - reinterpret_cast(&last_msg_->states[76].mesid.sat)), - 4) - << "incorrect value for states[76].mesid.sat, expected 4, is " - << last_msg_->states[76].mesid.sat; - EXPECT_EQ(get_asstates[77].cn0)>( - reinterpret_cast(&last_msg_->states[77].cn0)), - 0) - << "incorrect value for states[77].cn0, expected 0, is " - << last_msg_->states[77].cn0; - EXPECT_EQ( - get_asstates[77].mesid.code)>( - reinterpret_cast(&last_msg_->states[77].mesid.code)), - 0) - << "incorrect value for states[77].mesid.code, expected 0, is " - << last_msg_->states[77].mesid.code; - EXPECT_EQ( - get_asstates[77].mesid.sat)>( - reinterpret_cast(&last_msg_->states[77].mesid.sat)), - 0) - << "incorrect value for states[77].mesid.sat, expected 0, is " - << last_msg_->states[77].mesid.sat; - EXPECT_EQ(get_asstates[78].cn0)>( - reinterpret_cast(&last_msg_->states[78].cn0)), - 0) - << "incorrect value for states[78].cn0, expected 0, is " - << last_msg_->states[78].cn0; - EXPECT_EQ( - get_asstates[78].mesid.code)>( - reinterpret_cast(&last_msg_->states[78].mesid.code)), - 0) - << "incorrect value for states[78].mesid.code, expected 0, is " - << last_msg_->states[78].mesid.code; - EXPECT_EQ( - get_asstates[78].mesid.sat)>( - reinterpret_cast(&last_msg_->states[78].mesid.sat)), - 0) - << "incorrect value for states[78].mesid.sat, expected 0, is " - << last_msg_->states[78].mesid.sat; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingIq.cc b/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingIq.cc deleted file mode 100644 index 114b713431..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingIq.cc +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgTrackingIq.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_tracking_MsgTrackingIq0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgTrackingIq0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_iq_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_iq_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgTrackingIq0, Test) { - uint8_t encoded_frame[] = { - 85, 45, 0, 2, 80, 15, 145, 121, 203, 47, 217, 239, - 55, 45, 38, 189, 88, 159, 19, 208, 12, 97, 167, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_iq_t *test_msg = (msg_tracking_iq_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->channel = 145; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->corrs[0])); - } - test_msg->corrs[0].I = -9937; - test_msg->corrs[0].Q = 14319; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->corrs[0])); - } - test_msg->corrs[1].I = 9773; - test_msg->corrs[1].Q = 22717; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->corrs[0])); - } - test_msg->corrs[2].I = 5023; - test_msg->corrs[2].Q = 3280; - test_msg->sid.code = 203; - test_msg->sid.sat = 121; - - EXPECT_EQ(send_message(0x2d, 20482, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 20482); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_aschannel)>( - reinterpret_cast(&last_msg_->channel)), - 145) - << "incorrect value for channel, expected 145, is " << last_msg_->channel; - EXPECT_EQ(get_ascorrs[0].I)>( - reinterpret_cast(&last_msg_->corrs[0].I)), - -9937) - << "incorrect value for corrs[0].I, expected -9937, is " - << last_msg_->corrs[0].I; - EXPECT_EQ(get_ascorrs[0].Q)>( - reinterpret_cast(&last_msg_->corrs[0].Q)), - 14319) - << "incorrect value for corrs[0].Q, expected 14319, is " - << last_msg_->corrs[0].Q; - EXPECT_EQ(get_ascorrs[1].I)>( - reinterpret_cast(&last_msg_->corrs[1].I)), - 9773) - << "incorrect value for corrs[1].I, expected 9773, is " - << last_msg_->corrs[1].I; - EXPECT_EQ(get_ascorrs[1].Q)>( - reinterpret_cast(&last_msg_->corrs[1].Q)), - 22717) - << "incorrect value for corrs[1].Q, expected 22717, is " - << last_msg_->corrs[1].Q; - EXPECT_EQ(get_ascorrs[2].I)>( - reinterpret_cast(&last_msg_->corrs[2].I)), - 5023) - << "incorrect value for corrs[2].I, expected 5023, is " - << last_msg_->corrs[2].I; - EXPECT_EQ(get_ascorrs[2].Q)>( - reinterpret_cast(&last_msg_->corrs[2].Q)), - 3280) - << "incorrect value for corrs[2].Q, expected 3280, is " - << last_msg_->corrs[2].Q; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 203) - << "incorrect value for sid.code, expected 203, is " - << last_msg_->sid.code; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 121) - << "incorrect value for sid.sat, expected 121, is " << last_msg_->sid.sat; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingIqDepA.cc b/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingIqDepA.cc deleted file mode 100644 index 45ea90bab8..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingIqDepA.cc +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgTrackingIqDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_tracking_MsgTrackingIqDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgTrackingIqDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_iq_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_iq_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgTrackingIqDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 28, 0, 184, 67, 29, 139, 28, 250, 15, 0, 99, 90, - 170, 96, 71, 121, 33, 161, 52, 211, 162, 101, 41, 36, 226, - 99, 71, 75, 14, 240, 134, 82, 175, 83, 17, 34, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_iq_dep_a_t *test_msg = - (msg_tracking_iq_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->channel = 139; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->corrs[0])); - } - test_msg->corrs[0].I = 1621776995; - test_msg->corrs[0].Q = -1591641785; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->corrs[0])); - } - test_msg->corrs[1].I = 1705169716; - test_msg->corrs[1].Q = 1675764777; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->corrs[0])); - } - test_msg->corrs[2].I = -267498681; - test_msg->corrs[2].Q = 1403998854; - test_msg->sid.code = 15; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 64028; - - EXPECT_EQ(send_message(0x1c, 17336, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 17336); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_aschannel)>( - reinterpret_cast(&last_msg_->channel)), - 139) - << "incorrect value for channel, expected 139, is " << last_msg_->channel; - EXPECT_EQ(get_ascorrs[0].I)>( - reinterpret_cast(&last_msg_->corrs[0].I)), - 1621776995) - << "incorrect value for corrs[0].I, expected 1621776995, is " - << last_msg_->corrs[0].I; - EXPECT_EQ(get_ascorrs[0].Q)>( - reinterpret_cast(&last_msg_->corrs[0].Q)), - -1591641785) - << "incorrect value for corrs[0].Q, expected -1591641785, is " - << last_msg_->corrs[0].Q; - EXPECT_EQ(get_ascorrs[1].I)>( - reinterpret_cast(&last_msg_->corrs[1].I)), - 1705169716) - << "incorrect value for corrs[1].I, expected 1705169716, is " - << last_msg_->corrs[1].I; - EXPECT_EQ(get_ascorrs[1].Q)>( - reinterpret_cast(&last_msg_->corrs[1].Q)), - 1675764777) - << "incorrect value for corrs[1].Q, expected 1675764777, is " - << last_msg_->corrs[1].Q; - EXPECT_EQ(get_ascorrs[2].I)>( - reinterpret_cast(&last_msg_->corrs[2].I)), - -267498681) - << "incorrect value for corrs[2].I, expected -267498681, is " - << last_msg_->corrs[2].I; - EXPECT_EQ(get_ascorrs[2].Q)>( - reinterpret_cast(&last_msg_->corrs[2].Q)), - 1403998854) - << "incorrect value for corrs[2].Q, expected 1403998854, is " - << last_msg_->corrs[2].Q; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 15) - << "incorrect value for sid.code, expected 15, is " - << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 64028) - << "incorrect value for sid.sat, expected 64028, is " - << last_msg_->sid.sat; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingIqDepB.cc b/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingIqDepB.cc deleted file mode 100644 index 88b0a9266f..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingIqDepB.cc +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgTrackingIqDepB.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_tracking_MsgTrackingIqDepB0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgTrackingIqDepB0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_iq_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_iq_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgTrackingIqDepB0, Test) { - uint8_t encoded_frame[] = { - 85, 44, 0, 39, 101, 27, 45, 188, 183, 72, 185, 157, - 15, 187, 249, 101, 24, 135, 146, 180, 224, 123, 235, 142, - 208, 102, 112, 25, 21, 177, 96, 116, 68, 246, 153, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_iq_dep_b_t *test_msg = - (msg_tracking_iq_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->channel = 45; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->corrs[0])); - } - test_msg->corrs[0].I = 261994824; - test_msg->corrs[0].Q = 409336251; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->corrs[0])); - } - test_msg->corrs[1].I = -525036921; - test_msg->corrs[1].Q = -795939973; - if (sizeof(test_msg->corrs) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->corrs[0])); - } - test_msg->corrs[2].I = 353988710; - test_msg->corrs[2].Q = 1148477617; - test_msg->sid.code = 183; - test_msg->sid.sat = 188; - - EXPECT_EQ(send_message(0x2c, 25895, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 25895); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_aschannel)>( - reinterpret_cast(&last_msg_->channel)), - 45) - << "incorrect value for channel, expected 45, is " << last_msg_->channel; - EXPECT_EQ(get_ascorrs[0].I)>( - reinterpret_cast(&last_msg_->corrs[0].I)), - 261994824) - << "incorrect value for corrs[0].I, expected 261994824, is " - << last_msg_->corrs[0].I; - EXPECT_EQ(get_ascorrs[0].Q)>( - reinterpret_cast(&last_msg_->corrs[0].Q)), - 409336251) - << "incorrect value for corrs[0].Q, expected 409336251, is " - << last_msg_->corrs[0].Q; - EXPECT_EQ(get_ascorrs[1].I)>( - reinterpret_cast(&last_msg_->corrs[1].I)), - -525036921) - << "incorrect value for corrs[1].I, expected -525036921, is " - << last_msg_->corrs[1].I; - EXPECT_EQ(get_ascorrs[1].Q)>( - reinterpret_cast(&last_msg_->corrs[1].Q)), - -795939973) - << "incorrect value for corrs[1].Q, expected -795939973, is " - << last_msg_->corrs[1].Q; - EXPECT_EQ(get_ascorrs[2].I)>( - reinterpret_cast(&last_msg_->corrs[2].I)), - 353988710) - << "incorrect value for corrs[2].I, expected 353988710, is " - << last_msg_->corrs[2].I; - EXPECT_EQ(get_ascorrs[2].Q)>( - reinterpret_cast(&last_msg_->corrs[2].Q)), - 1148477617) - << "incorrect value for corrs[2].Q, expected 1148477617, is " - << last_msg_->corrs[2].Q; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 183) - << "incorrect value for sid.code, expected 183, is " - << last_msg_->sid.code; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 188) - << "incorrect value for sid.sat, expected 188, is " << last_msg_->sid.sat; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingState.cc b/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingState.cc deleted file mode 100644 index 7a8d568955..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingState.cc +++ /dev/null @@ -1,4406 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgTrackingState.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_tracking_MsgTrackingState0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgTrackingState0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgTrackingState0, Test) { - uint8_t encoded_frame[] = { - 85, 65, 0, 55, 129, 252, 117, 184, 3, 102, 38, 106, 140, 141, 25, - 4, 90, 195, 246, 108, 75, 82, 137, 127, 45, 163, 32, 46, 187, 93, - 153, 60, 201, 147, 23, 29, 5, 208, 181, 30, 219, 69, 254, 136, 3, - 121, 33, 98, 144, 215, 133, 182, 14, 56, 169, 77, 218, 62, 242, 84, - 171, 249, 152, 137, 131, 130, 193, 21, 42, 68, 253, 227, 216, 227, 24, - 26, 210, 179, 19, 15, 227, 255, 122, 75, 187, 200, 217, 48, 218, 122, - 187, 238, 142, 149, 238, 55, 251, 212, 128, 160, 194, 104, 113, 255, 141, - 62, 43, 69, 245, 39, 100, 230, 108, 56, 247, 68, 149, 143, 137, 101, - 233, 70, 49, 165, 38, 110, 218, 230, 80, 213, 196, 179, 139, 128, 15, - 178, 196, 171, 8, 212, 97, 194, 83, 233, 79, 99, 55, 90, 31, 180, - 5, 25, 105, 186, 22, 224, 80, 111, 8, 48, 106, 166, 4, 48, 156, - 49, 86, 19, 142, 146, 91, 124, 115, 64, 28, 230, 115, 178, 190, 131, - 16, 242, 105, 59, 182, 113, 192, 180, 48, 179, 166, 31, 172, 211, 77, - 228, 140, 49, 128, 77, 240, 194, 134, 194, 41, 58, 18, 53, 129, 55, - 91, 72, 134, 92, 33, 224, 157, 56, 186, 54, 224, 174, 82, 84, 148, - 190, 236, 54, 62, 67, 52, 215, 57, 254, 16, 133, 36, 174, 219, 172, - 145, 17, 192, 179, 111, 97, 207, 56, 208, 134, 180, 17, 43, 226, 255, - 182, 140, 113, 141, 111, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_t *test_msg = (msg_tracking_state_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[0].cn0 = 102; - test_msg->states[0].fcn = 3; - test_msg->states[0].sid.code = 184; - test_msg->states[0].sid.sat = 117; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[1].cn0 = 141; - test_msg->states[1].fcn = 140; - test_msg->states[1].sid.code = 106; - test_msg->states[1].sid.sat = 38; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[2].cn0 = 195; - test_msg->states[2].fcn = 90; - test_msg->states[2].sid.code = 4; - test_msg->states[2].sid.sat = 25; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[3].cn0 = 82; - test_msg->states[3].fcn = 75; - test_msg->states[3].sid.code = 108; - test_msg->states[3].sid.sat = 246; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[4].cn0 = 163; - test_msg->states[4].fcn = 45; - test_msg->states[4].sid.code = 127; - test_msg->states[4].sid.sat = 137; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[5].cn0 = 93; - test_msg->states[5].fcn = 187; - test_msg->states[5].sid.code = 46; - test_msg->states[5].sid.sat = 32; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[6].cn0 = 147; - test_msg->states[6].fcn = 201; - test_msg->states[6].sid.code = 60; - test_msg->states[6].sid.sat = 153; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[7].cn0 = 208; - test_msg->states[7].fcn = 5; - test_msg->states[7].sid.code = 29; - test_msg->states[7].sid.sat = 23; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[8].cn0 = 69; - test_msg->states[8].fcn = 219; - test_msg->states[8].sid.code = 30; - test_msg->states[8].sid.sat = 181; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[9].cn0 = 121; - test_msg->states[9].fcn = 3; - test_msg->states[9].sid.code = 136; - test_msg->states[9].sid.sat = 254; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[10].cn0 = 215; - test_msg->states[10].fcn = 144; - test_msg->states[10].sid.code = 98; - test_msg->states[10].sid.sat = 33; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[11].cn0 = 56; - test_msg->states[11].fcn = 14; - test_msg->states[11].sid.code = 182; - test_msg->states[11].sid.sat = 133; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[12].cn0 = 62; - test_msg->states[12].fcn = 218; - test_msg->states[12].sid.code = 77; - test_msg->states[12].sid.sat = 169; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[13].cn0 = 249; - test_msg->states[13].fcn = 171; - test_msg->states[13].sid.code = 84; - test_msg->states[13].sid.sat = 242; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[14].cn0 = 130; - test_msg->states[14].fcn = 131; - test_msg->states[14].sid.code = 137; - test_msg->states[14].sid.sat = 152; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[15].cn0 = 68; - test_msg->states[15].fcn = 42; - test_msg->states[15].sid.code = 21; - test_msg->states[15].sid.sat = 193; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[16].cn0 = 227; - test_msg->states[16].fcn = 216; - test_msg->states[16].sid.code = 227; - test_msg->states[16].sid.sat = 253; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[17].cn0 = 179; - test_msg->states[17].fcn = 210; - test_msg->states[17].sid.code = 26; - test_msg->states[17].sid.sat = 24; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[18].cn0 = 255; - test_msg->states[18].fcn = 227; - test_msg->states[18].sid.code = 15; - test_msg->states[18].sid.sat = 19; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[19].cn0 = 200; - test_msg->states[19].fcn = 187; - test_msg->states[19].sid.code = 75; - test_msg->states[19].sid.sat = 122; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[20].cn0 = 122; - test_msg->states[20].fcn = 218; - test_msg->states[20].sid.code = 48; - test_msg->states[20].sid.sat = 217; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[21].cn0 = 149; - test_msg->states[21].fcn = 142; - test_msg->states[21].sid.code = 238; - test_msg->states[21].sid.sat = 187; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[22].cn0 = 212; - test_msg->states[22].fcn = 251; - test_msg->states[22].sid.code = 55; - test_msg->states[22].sid.sat = 238; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[23].cn0 = 104; - test_msg->states[23].fcn = 194; - test_msg->states[23].sid.code = 160; - test_msg->states[23].sid.sat = 128; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[24].cn0 = 62; - test_msg->states[24].fcn = 141; - test_msg->states[24].sid.code = 255; - test_msg->states[24].sid.sat = 113; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[25].cn0 = 39; - test_msg->states[25].fcn = 245; - test_msg->states[25].sid.code = 69; - test_msg->states[25].sid.sat = 43; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[26].cn0 = 56; - test_msg->states[26].fcn = 108; - test_msg->states[26].sid.code = 230; - test_msg->states[26].sid.sat = 100; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[27].cn0 = 143; - test_msg->states[27].fcn = 149; - test_msg->states[27].sid.code = 68; - test_msg->states[27].sid.sat = 247; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[28].cn0 = 70; - test_msg->states[28].fcn = 233; - test_msg->states[28].sid.code = 101; - test_msg->states[28].sid.sat = 137; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[29].cn0 = 110; - test_msg->states[29].fcn = 38; - test_msg->states[29].sid.code = 165; - test_msg->states[29].sid.sat = 49; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[30].cn0 = 213; - test_msg->states[30].fcn = 80; - test_msg->states[30].sid.code = 230; - test_msg->states[30].sid.sat = 218; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[31].cn0 = 128; - test_msg->states[31].fcn = 139; - test_msg->states[31].sid.code = 179; - test_msg->states[31].sid.sat = 196; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[32].cn0 = 171; - test_msg->states[32].fcn = 196; - test_msg->states[32].sid.code = 178; - test_msg->states[32].sid.sat = 15; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[33].cn0 = 194; - test_msg->states[33].fcn = 97; - test_msg->states[33].sid.code = 212; - test_msg->states[33].sid.sat = 8; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[34].cn0 = 99; - test_msg->states[34].fcn = 79; - test_msg->states[34].sid.code = 233; - test_msg->states[34].sid.sat = 83; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[35].cn0 = 180; - test_msg->states[35].fcn = 31; - test_msg->states[35].sid.code = 90; - test_msg->states[35].sid.sat = 55; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[36].cn0 = 186; - test_msg->states[36].fcn = 105; - test_msg->states[36].sid.code = 25; - test_msg->states[36].sid.sat = 5; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[37].cn0 = 111; - test_msg->states[37].fcn = 80; - test_msg->states[37].sid.code = 224; - test_msg->states[37].sid.sat = 22; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[38].cn0 = 166; - test_msg->states[38].fcn = 106; - test_msg->states[38].sid.code = 48; - test_msg->states[38].sid.sat = 8; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[39].cn0 = 49; - test_msg->states[39].fcn = 156; - test_msg->states[39].sid.code = 48; - test_msg->states[39].sid.sat = 4; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[40].cn0 = 146; - test_msg->states[40].fcn = 142; - test_msg->states[40].sid.code = 19; - test_msg->states[40].sid.sat = 86; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[41].cn0 = 64; - test_msg->states[41].fcn = 115; - test_msg->states[41].sid.code = 124; - test_msg->states[41].sid.sat = 91; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[42].cn0 = 178; - test_msg->states[42].fcn = 115; - test_msg->states[42].sid.code = 230; - test_msg->states[42].sid.sat = 28; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[43].cn0 = 242; - test_msg->states[43].fcn = 16; - test_msg->states[43].sid.code = 131; - test_msg->states[43].sid.sat = 190; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[44].cn0 = 113; - test_msg->states[44].fcn = 182; - test_msg->states[44].sid.code = 59; - test_msg->states[44].sid.sat = 105; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[45].cn0 = 179; - test_msg->states[45].fcn = 48; - test_msg->states[45].sid.code = 180; - test_msg->states[45].sid.sat = 192; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[46].cn0 = 211; - test_msg->states[46].fcn = 172; - test_msg->states[46].sid.code = 31; - test_msg->states[46].sid.sat = 166; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[47].cn0 = 49; - test_msg->states[47].fcn = 140; - test_msg->states[47].sid.code = 228; - test_msg->states[47].sid.sat = 77; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[48].cn0 = 194; - test_msg->states[48].fcn = 240; - test_msg->states[48].sid.code = 77; - test_msg->states[48].sid.sat = 128; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[49].cn0 = 58; - test_msg->states[49].fcn = 41; - test_msg->states[49].sid.code = 194; - test_msg->states[49].sid.sat = 134; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[50].cn0 = 55; - test_msg->states[50].fcn = 129; - test_msg->states[50].sid.code = 53; - test_msg->states[50].sid.sat = 18; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[51].cn0 = 92; - test_msg->states[51].fcn = 134; - test_msg->states[51].sid.code = 72; - test_msg->states[51].sid.sat = 91; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[52].cn0 = 56; - test_msg->states[52].fcn = 157; - test_msg->states[52].sid.code = 224; - test_msg->states[52].sid.sat = 33; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[53].cn0 = 174; - test_msg->states[53].fcn = 224; - test_msg->states[53].sid.code = 54; - test_msg->states[53].sid.sat = 186; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[54].cn0 = 190; - test_msg->states[54].fcn = 148; - test_msg->states[54].sid.code = 84; - test_msg->states[54].sid.sat = 82; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[55].cn0 = 67; - test_msg->states[55].fcn = 62; - test_msg->states[55].sid.code = 54; - test_msg->states[55].sid.sat = 236; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[56].cn0 = 254; - test_msg->states[56].fcn = 57; - test_msg->states[56].sid.code = 215; - test_msg->states[56].sid.sat = 52; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[57].cn0 = 174; - test_msg->states[57].fcn = 36; - test_msg->states[57].sid.code = 133; - test_msg->states[57].sid.sat = 16; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[58].cn0 = 17; - test_msg->states[58].fcn = 145; - test_msg->states[58].sid.code = 172; - test_msg->states[58].sid.sat = 219; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[59].cn0 = 97; - test_msg->states[59].fcn = 111; - test_msg->states[59].sid.code = 179; - test_msg->states[59].sid.sat = 192; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[60].cn0 = 134; - test_msg->states[60].fcn = 208; - test_msg->states[60].sid.code = 56; - test_msg->states[60].sid.sat = 207; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[61].cn0 = 226; - test_msg->states[61].fcn = 43; - test_msg->states[61].sid.code = 17; - test_msg->states[61].sid.sat = 180; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[62].cn0 = 113; - test_msg->states[62].fcn = 140; - test_msg->states[62].sid.code = 182; - test_msg->states[62].sid.sat = 255; - - EXPECT_EQ(send_message(0x41, 33079, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 33079); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asstates[0].cn0)>( - reinterpret_cast(&last_msg_->states[0].cn0)), - 102) - << "incorrect value for states[0].cn0, expected 102, is " - << last_msg_->states[0].cn0; - EXPECT_EQ(get_asstates[0].fcn)>( - reinterpret_cast(&last_msg_->states[0].fcn)), - 3) - << "incorrect value for states[0].fcn, expected 3, is " - << last_msg_->states[0].fcn; - EXPECT_EQ( - get_asstates[0].sid.code)>( - reinterpret_cast(&last_msg_->states[0].sid.code)), - 184) - << "incorrect value for states[0].sid.code, expected 184, is " - << last_msg_->states[0].sid.code; - EXPECT_EQ( - get_asstates[0].sid.sat)>( - reinterpret_cast(&last_msg_->states[0].sid.sat)), - 117) - << "incorrect value for states[0].sid.sat, expected 117, is " - << last_msg_->states[0].sid.sat; - EXPECT_EQ(get_asstates[1].cn0)>( - reinterpret_cast(&last_msg_->states[1].cn0)), - 141) - << "incorrect value for states[1].cn0, expected 141, is " - << last_msg_->states[1].cn0; - EXPECT_EQ(get_asstates[1].fcn)>( - reinterpret_cast(&last_msg_->states[1].fcn)), - 140) - << "incorrect value for states[1].fcn, expected 140, is " - << last_msg_->states[1].fcn; - EXPECT_EQ( - get_asstates[1].sid.code)>( - reinterpret_cast(&last_msg_->states[1].sid.code)), - 106) - << "incorrect value for states[1].sid.code, expected 106, is " - << last_msg_->states[1].sid.code; - EXPECT_EQ( - get_asstates[1].sid.sat)>( - reinterpret_cast(&last_msg_->states[1].sid.sat)), - 38) - << "incorrect value for states[1].sid.sat, expected 38, is " - << last_msg_->states[1].sid.sat; - EXPECT_EQ(get_asstates[2].cn0)>( - reinterpret_cast(&last_msg_->states[2].cn0)), - 195) - << "incorrect value for states[2].cn0, expected 195, is " - << last_msg_->states[2].cn0; - EXPECT_EQ(get_asstates[2].fcn)>( - reinterpret_cast(&last_msg_->states[2].fcn)), - 90) - << "incorrect value for states[2].fcn, expected 90, is " - << last_msg_->states[2].fcn; - EXPECT_EQ( - get_asstates[2].sid.code)>( - reinterpret_cast(&last_msg_->states[2].sid.code)), - 4) - << "incorrect value for states[2].sid.code, expected 4, is " - << last_msg_->states[2].sid.code; - EXPECT_EQ( - get_asstates[2].sid.sat)>( - reinterpret_cast(&last_msg_->states[2].sid.sat)), - 25) - << "incorrect value for states[2].sid.sat, expected 25, is " - << last_msg_->states[2].sid.sat; - EXPECT_EQ(get_asstates[3].cn0)>( - reinterpret_cast(&last_msg_->states[3].cn0)), - 82) - << "incorrect value for states[3].cn0, expected 82, is " - << last_msg_->states[3].cn0; - EXPECT_EQ(get_asstates[3].fcn)>( - reinterpret_cast(&last_msg_->states[3].fcn)), - 75) - << "incorrect value for states[3].fcn, expected 75, is " - << last_msg_->states[3].fcn; - EXPECT_EQ( - get_asstates[3].sid.code)>( - reinterpret_cast(&last_msg_->states[3].sid.code)), - 108) - << "incorrect value for states[3].sid.code, expected 108, is " - << last_msg_->states[3].sid.code; - EXPECT_EQ( - get_asstates[3].sid.sat)>( - reinterpret_cast(&last_msg_->states[3].sid.sat)), - 246) - << "incorrect value for states[3].sid.sat, expected 246, is " - << last_msg_->states[3].sid.sat; - EXPECT_EQ(get_asstates[4].cn0)>( - reinterpret_cast(&last_msg_->states[4].cn0)), - 163) - << "incorrect value for states[4].cn0, expected 163, is " - << last_msg_->states[4].cn0; - EXPECT_EQ(get_asstates[4].fcn)>( - reinterpret_cast(&last_msg_->states[4].fcn)), - 45) - << "incorrect value for states[4].fcn, expected 45, is " - << last_msg_->states[4].fcn; - EXPECT_EQ( - get_asstates[4].sid.code)>( - reinterpret_cast(&last_msg_->states[4].sid.code)), - 127) - << "incorrect value for states[4].sid.code, expected 127, is " - << last_msg_->states[4].sid.code; - EXPECT_EQ( - get_asstates[4].sid.sat)>( - reinterpret_cast(&last_msg_->states[4].sid.sat)), - 137) - << "incorrect value for states[4].sid.sat, expected 137, is " - << last_msg_->states[4].sid.sat; - EXPECT_EQ(get_asstates[5].cn0)>( - reinterpret_cast(&last_msg_->states[5].cn0)), - 93) - << "incorrect value for states[5].cn0, expected 93, is " - << last_msg_->states[5].cn0; - EXPECT_EQ(get_asstates[5].fcn)>( - reinterpret_cast(&last_msg_->states[5].fcn)), - 187) - << "incorrect value for states[5].fcn, expected 187, is " - << last_msg_->states[5].fcn; - EXPECT_EQ( - get_asstates[5].sid.code)>( - reinterpret_cast(&last_msg_->states[5].sid.code)), - 46) - << "incorrect value for states[5].sid.code, expected 46, is " - << last_msg_->states[5].sid.code; - EXPECT_EQ( - get_asstates[5].sid.sat)>( - reinterpret_cast(&last_msg_->states[5].sid.sat)), - 32) - << "incorrect value for states[5].sid.sat, expected 32, is " - << last_msg_->states[5].sid.sat; - EXPECT_EQ(get_asstates[6].cn0)>( - reinterpret_cast(&last_msg_->states[6].cn0)), - 147) - << "incorrect value for states[6].cn0, expected 147, is " - << last_msg_->states[6].cn0; - EXPECT_EQ(get_asstates[6].fcn)>( - reinterpret_cast(&last_msg_->states[6].fcn)), - 201) - << "incorrect value for states[6].fcn, expected 201, is " - << last_msg_->states[6].fcn; - EXPECT_EQ( - get_asstates[6].sid.code)>( - reinterpret_cast(&last_msg_->states[6].sid.code)), - 60) - << "incorrect value for states[6].sid.code, expected 60, is " - << last_msg_->states[6].sid.code; - EXPECT_EQ( - get_asstates[6].sid.sat)>( - reinterpret_cast(&last_msg_->states[6].sid.sat)), - 153) - << "incorrect value for states[6].sid.sat, expected 153, is " - << last_msg_->states[6].sid.sat; - EXPECT_EQ(get_asstates[7].cn0)>( - reinterpret_cast(&last_msg_->states[7].cn0)), - 208) - << "incorrect value for states[7].cn0, expected 208, is " - << last_msg_->states[7].cn0; - EXPECT_EQ(get_asstates[7].fcn)>( - reinterpret_cast(&last_msg_->states[7].fcn)), - 5) - << "incorrect value for states[7].fcn, expected 5, is " - << last_msg_->states[7].fcn; - EXPECT_EQ( - get_asstates[7].sid.code)>( - reinterpret_cast(&last_msg_->states[7].sid.code)), - 29) - << "incorrect value for states[7].sid.code, expected 29, is " - << last_msg_->states[7].sid.code; - EXPECT_EQ( - get_asstates[7].sid.sat)>( - reinterpret_cast(&last_msg_->states[7].sid.sat)), - 23) - << "incorrect value for states[7].sid.sat, expected 23, is " - << last_msg_->states[7].sid.sat; - EXPECT_EQ(get_asstates[8].cn0)>( - reinterpret_cast(&last_msg_->states[8].cn0)), - 69) - << "incorrect value for states[8].cn0, expected 69, is " - << last_msg_->states[8].cn0; - EXPECT_EQ(get_asstates[8].fcn)>( - reinterpret_cast(&last_msg_->states[8].fcn)), - 219) - << "incorrect value for states[8].fcn, expected 219, is " - << last_msg_->states[8].fcn; - EXPECT_EQ( - get_asstates[8].sid.code)>( - reinterpret_cast(&last_msg_->states[8].sid.code)), - 30) - << "incorrect value for states[8].sid.code, expected 30, is " - << last_msg_->states[8].sid.code; - EXPECT_EQ( - get_asstates[8].sid.sat)>( - reinterpret_cast(&last_msg_->states[8].sid.sat)), - 181) - << "incorrect value for states[8].sid.sat, expected 181, is " - << last_msg_->states[8].sid.sat; - EXPECT_EQ(get_asstates[9].cn0)>( - reinterpret_cast(&last_msg_->states[9].cn0)), - 121) - << "incorrect value for states[9].cn0, expected 121, is " - << last_msg_->states[9].cn0; - EXPECT_EQ(get_asstates[9].fcn)>( - reinterpret_cast(&last_msg_->states[9].fcn)), - 3) - << "incorrect value for states[9].fcn, expected 3, is " - << last_msg_->states[9].fcn; - EXPECT_EQ( - get_asstates[9].sid.code)>( - reinterpret_cast(&last_msg_->states[9].sid.code)), - 136) - << "incorrect value for states[9].sid.code, expected 136, is " - << last_msg_->states[9].sid.code; - EXPECT_EQ( - get_asstates[9].sid.sat)>( - reinterpret_cast(&last_msg_->states[9].sid.sat)), - 254) - << "incorrect value for states[9].sid.sat, expected 254, is " - << last_msg_->states[9].sid.sat; - EXPECT_EQ(get_asstates[10].cn0)>( - reinterpret_cast(&last_msg_->states[10].cn0)), - 215) - << "incorrect value for states[10].cn0, expected 215, is " - << last_msg_->states[10].cn0; - EXPECT_EQ(get_asstates[10].fcn)>( - reinterpret_cast(&last_msg_->states[10].fcn)), - 144) - << "incorrect value for states[10].fcn, expected 144, is " - << last_msg_->states[10].fcn; - EXPECT_EQ( - get_asstates[10].sid.code)>( - reinterpret_cast(&last_msg_->states[10].sid.code)), - 98) - << "incorrect value for states[10].sid.code, expected 98, is " - << last_msg_->states[10].sid.code; - EXPECT_EQ( - get_asstates[10].sid.sat)>( - reinterpret_cast(&last_msg_->states[10].sid.sat)), - 33) - << "incorrect value for states[10].sid.sat, expected 33, is " - << last_msg_->states[10].sid.sat; - EXPECT_EQ(get_asstates[11].cn0)>( - reinterpret_cast(&last_msg_->states[11].cn0)), - 56) - << "incorrect value for states[11].cn0, expected 56, is " - << last_msg_->states[11].cn0; - EXPECT_EQ(get_asstates[11].fcn)>( - reinterpret_cast(&last_msg_->states[11].fcn)), - 14) - << "incorrect value for states[11].fcn, expected 14, is " - << last_msg_->states[11].fcn; - EXPECT_EQ( - get_asstates[11].sid.code)>( - reinterpret_cast(&last_msg_->states[11].sid.code)), - 182) - << "incorrect value for states[11].sid.code, expected 182, is " - << last_msg_->states[11].sid.code; - EXPECT_EQ( - get_asstates[11].sid.sat)>( - reinterpret_cast(&last_msg_->states[11].sid.sat)), - 133) - << "incorrect value for states[11].sid.sat, expected 133, is " - << last_msg_->states[11].sid.sat; - EXPECT_EQ(get_asstates[12].cn0)>( - reinterpret_cast(&last_msg_->states[12].cn0)), - 62) - << "incorrect value for states[12].cn0, expected 62, is " - << last_msg_->states[12].cn0; - EXPECT_EQ(get_asstates[12].fcn)>( - reinterpret_cast(&last_msg_->states[12].fcn)), - 218) - << "incorrect value for states[12].fcn, expected 218, is " - << last_msg_->states[12].fcn; - EXPECT_EQ( - get_asstates[12].sid.code)>( - reinterpret_cast(&last_msg_->states[12].sid.code)), - 77) - << "incorrect value for states[12].sid.code, expected 77, is " - << last_msg_->states[12].sid.code; - EXPECT_EQ( - get_asstates[12].sid.sat)>( - reinterpret_cast(&last_msg_->states[12].sid.sat)), - 169) - << "incorrect value for states[12].sid.sat, expected 169, is " - << last_msg_->states[12].sid.sat; - EXPECT_EQ(get_asstates[13].cn0)>( - reinterpret_cast(&last_msg_->states[13].cn0)), - 249) - << "incorrect value for states[13].cn0, expected 249, is " - << last_msg_->states[13].cn0; - EXPECT_EQ(get_asstates[13].fcn)>( - reinterpret_cast(&last_msg_->states[13].fcn)), - 171) - << "incorrect value for states[13].fcn, expected 171, is " - << last_msg_->states[13].fcn; - EXPECT_EQ( - get_asstates[13].sid.code)>( - reinterpret_cast(&last_msg_->states[13].sid.code)), - 84) - << "incorrect value for states[13].sid.code, expected 84, is " - << last_msg_->states[13].sid.code; - EXPECT_EQ( - get_asstates[13].sid.sat)>( - reinterpret_cast(&last_msg_->states[13].sid.sat)), - 242) - << "incorrect value for states[13].sid.sat, expected 242, is " - << last_msg_->states[13].sid.sat; - EXPECT_EQ(get_asstates[14].cn0)>( - reinterpret_cast(&last_msg_->states[14].cn0)), - 130) - << "incorrect value for states[14].cn0, expected 130, is " - << last_msg_->states[14].cn0; - EXPECT_EQ(get_asstates[14].fcn)>( - reinterpret_cast(&last_msg_->states[14].fcn)), - 131) - << "incorrect value for states[14].fcn, expected 131, is " - << last_msg_->states[14].fcn; - EXPECT_EQ( - get_asstates[14].sid.code)>( - reinterpret_cast(&last_msg_->states[14].sid.code)), - 137) - << "incorrect value for states[14].sid.code, expected 137, is " - << last_msg_->states[14].sid.code; - EXPECT_EQ( - get_asstates[14].sid.sat)>( - reinterpret_cast(&last_msg_->states[14].sid.sat)), - 152) - << "incorrect value for states[14].sid.sat, expected 152, is " - << last_msg_->states[14].sid.sat; - EXPECT_EQ(get_asstates[15].cn0)>( - reinterpret_cast(&last_msg_->states[15].cn0)), - 68) - << "incorrect value for states[15].cn0, expected 68, is " - << last_msg_->states[15].cn0; - EXPECT_EQ(get_asstates[15].fcn)>( - reinterpret_cast(&last_msg_->states[15].fcn)), - 42) - << "incorrect value for states[15].fcn, expected 42, is " - << last_msg_->states[15].fcn; - EXPECT_EQ( - get_asstates[15].sid.code)>( - reinterpret_cast(&last_msg_->states[15].sid.code)), - 21) - << "incorrect value for states[15].sid.code, expected 21, is " - << last_msg_->states[15].sid.code; - EXPECT_EQ( - get_asstates[15].sid.sat)>( - reinterpret_cast(&last_msg_->states[15].sid.sat)), - 193) - << "incorrect value for states[15].sid.sat, expected 193, is " - << last_msg_->states[15].sid.sat; - EXPECT_EQ(get_asstates[16].cn0)>( - reinterpret_cast(&last_msg_->states[16].cn0)), - 227) - << "incorrect value for states[16].cn0, expected 227, is " - << last_msg_->states[16].cn0; - EXPECT_EQ(get_asstates[16].fcn)>( - reinterpret_cast(&last_msg_->states[16].fcn)), - 216) - << "incorrect value for states[16].fcn, expected 216, is " - << last_msg_->states[16].fcn; - EXPECT_EQ( - get_asstates[16].sid.code)>( - reinterpret_cast(&last_msg_->states[16].sid.code)), - 227) - << "incorrect value for states[16].sid.code, expected 227, is " - << last_msg_->states[16].sid.code; - EXPECT_EQ( - get_asstates[16].sid.sat)>( - reinterpret_cast(&last_msg_->states[16].sid.sat)), - 253) - << "incorrect value for states[16].sid.sat, expected 253, is " - << last_msg_->states[16].sid.sat; - EXPECT_EQ(get_asstates[17].cn0)>( - reinterpret_cast(&last_msg_->states[17].cn0)), - 179) - << "incorrect value for states[17].cn0, expected 179, is " - << last_msg_->states[17].cn0; - EXPECT_EQ(get_asstates[17].fcn)>( - reinterpret_cast(&last_msg_->states[17].fcn)), - 210) - << "incorrect value for states[17].fcn, expected 210, is " - << last_msg_->states[17].fcn; - EXPECT_EQ( - get_asstates[17].sid.code)>( - reinterpret_cast(&last_msg_->states[17].sid.code)), - 26) - << "incorrect value for states[17].sid.code, expected 26, is " - << last_msg_->states[17].sid.code; - EXPECT_EQ( - get_asstates[17].sid.sat)>( - reinterpret_cast(&last_msg_->states[17].sid.sat)), - 24) - << "incorrect value for states[17].sid.sat, expected 24, is " - << last_msg_->states[17].sid.sat; - EXPECT_EQ(get_asstates[18].cn0)>( - reinterpret_cast(&last_msg_->states[18].cn0)), - 255) - << "incorrect value for states[18].cn0, expected 255, is " - << last_msg_->states[18].cn0; - EXPECT_EQ(get_asstates[18].fcn)>( - reinterpret_cast(&last_msg_->states[18].fcn)), - 227) - << "incorrect value for states[18].fcn, expected 227, is " - << last_msg_->states[18].fcn; - EXPECT_EQ( - get_asstates[18].sid.code)>( - reinterpret_cast(&last_msg_->states[18].sid.code)), - 15) - << "incorrect value for states[18].sid.code, expected 15, is " - << last_msg_->states[18].sid.code; - EXPECT_EQ( - get_asstates[18].sid.sat)>( - reinterpret_cast(&last_msg_->states[18].sid.sat)), - 19) - << "incorrect value for states[18].sid.sat, expected 19, is " - << last_msg_->states[18].sid.sat; - EXPECT_EQ(get_asstates[19].cn0)>( - reinterpret_cast(&last_msg_->states[19].cn0)), - 200) - << "incorrect value for states[19].cn0, expected 200, is " - << last_msg_->states[19].cn0; - EXPECT_EQ(get_asstates[19].fcn)>( - reinterpret_cast(&last_msg_->states[19].fcn)), - 187) - << "incorrect value for states[19].fcn, expected 187, is " - << last_msg_->states[19].fcn; - EXPECT_EQ( - get_asstates[19].sid.code)>( - reinterpret_cast(&last_msg_->states[19].sid.code)), - 75) - << "incorrect value for states[19].sid.code, expected 75, is " - << last_msg_->states[19].sid.code; - EXPECT_EQ( - get_asstates[19].sid.sat)>( - reinterpret_cast(&last_msg_->states[19].sid.sat)), - 122) - << "incorrect value for states[19].sid.sat, expected 122, is " - << last_msg_->states[19].sid.sat; - EXPECT_EQ(get_asstates[20].cn0)>( - reinterpret_cast(&last_msg_->states[20].cn0)), - 122) - << "incorrect value for states[20].cn0, expected 122, is " - << last_msg_->states[20].cn0; - EXPECT_EQ(get_asstates[20].fcn)>( - reinterpret_cast(&last_msg_->states[20].fcn)), - 218) - << "incorrect value for states[20].fcn, expected 218, is " - << last_msg_->states[20].fcn; - EXPECT_EQ( - get_asstates[20].sid.code)>( - reinterpret_cast(&last_msg_->states[20].sid.code)), - 48) - << "incorrect value for states[20].sid.code, expected 48, is " - << last_msg_->states[20].sid.code; - EXPECT_EQ( - get_asstates[20].sid.sat)>( - reinterpret_cast(&last_msg_->states[20].sid.sat)), - 217) - << "incorrect value for states[20].sid.sat, expected 217, is " - << last_msg_->states[20].sid.sat; - EXPECT_EQ(get_asstates[21].cn0)>( - reinterpret_cast(&last_msg_->states[21].cn0)), - 149) - << "incorrect value for states[21].cn0, expected 149, is " - << last_msg_->states[21].cn0; - EXPECT_EQ(get_asstates[21].fcn)>( - reinterpret_cast(&last_msg_->states[21].fcn)), - 142) - << "incorrect value for states[21].fcn, expected 142, is " - << last_msg_->states[21].fcn; - EXPECT_EQ( - get_asstates[21].sid.code)>( - reinterpret_cast(&last_msg_->states[21].sid.code)), - 238) - << "incorrect value for states[21].sid.code, expected 238, is " - << last_msg_->states[21].sid.code; - EXPECT_EQ( - get_asstates[21].sid.sat)>( - reinterpret_cast(&last_msg_->states[21].sid.sat)), - 187) - << "incorrect value for states[21].sid.sat, expected 187, is " - << last_msg_->states[21].sid.sat; - EXPECT_EQ(get_asstates[22].cn0)>( - reinterpret_cast(&last_msg_->states[22].cn0)), - 212) - << "incorrect value for states[22].cn0, expected 212, is " - << last_msg_->states[22].cn0; - EXPECT_EQ(get_asstates[22].fcn)>( - reinterpret_cast(&last_msg_->states[22].fcn)), - 251) - << "incorrect value for states[22].fcn, expected 251, is " - << last_msg_->states[22].fcn; - EXPECT_EQ( - get_asstates[22].sid.code)>( - reinterpret_cast(&last_msg_->states[22].sid.code)), - 55) - << "incorrect value for states[22].sid.code, expected 55, is " - << last_msg_->states[22].sid.code; - EXPECT_EQ( - get_asstates[22].sid.sat)>( - reinterpret_cast(&last_msg_->states[22].sid.sat)), - 238) - << "incorrect value for states[22].sid.sat, expected 238, is " - << last_msg_->states[22].sid.sat; - EXPECT_EQ(get_asstates[23].cn0)>( - reinterpret_cast(&last_msg_->states[23].cn0)), - 104) - << "incorrect value for states[23].cn0, expected 104, is " - << last_msg_->states[23].cn0; - EXPECT_EQ(get_asstates[23].fcn)>( - reinterpret_cast(&last_msg_->states[23].fcn)), - 194) - << "incorrect value for states[23].fcn, expected 194, is " - << last_msg_->states[23].fcn; - EXPECT_EQ( - get_asstates[23].sid.code)>( - reinterpret_cast(&last_msg_->states[23].sid.code)), - 160) - << "incorrect value for states[23].sid.code, expected 160, is " - << last_msg_->states[23].sid.code; - EXPECT_EQ( - get_asstates[23].sid.sat)>( - reinterpret_cast(&last_msg_->states[23].sid.sat)), - 128) - << "incorrect value for states[23].sid.sat, expected 128, is " - << last_msg_->states[23].sid.sat; - EXPECT_EQ(get_asstates[24].cn0)>( - reinterpret_cast(&last_msg_->states[24].cn0)), - 62) - << "incorrect value for states[24].cn0, expected 62, is " - << last_msg_->states[24].cn0; - EXPECT_EQ(get_asstates[24].fcn)>( - reinterpret_cast(&last_msg_->states[24].fcn)), - 141) - << "incorrect value for states[24].fcn, expected 141, is " - << last_msg_->states[24].fcn; - EXPECT_EQ( - get_asstates[24].sid.code)>( - reinterpret_cast(&last_msg_->states[24].sid.code)), - 255) - << "incorrect value for states[24].sid.code, expected 255, is " - << last_msg_->states[24].sid.code; - EXPECT_EQ( - get_asstates[24].sid.sat)>( - reinterpret_cast(&last_msg_->states[24].sid.sat)), - 113) - << "incorrect value for states[24].sid.sat, expected 113, is " - << last_msg_->states[24].sid.sat; - EXPECT_EQ(get_asstates[25].cn0)>( - reinterpret_cast(&last_msg_->states[25].cn0)), - 39) - << "incorrect value for states[25].cn0, expected 39, is " - << last_msg_->states[25].cn0; - EXPECT_EQ(get_asstates[25].fcn)>( - reinterpret_cast(&last_msg_->states[25].fcn)), - 245) - << "incorrect value for states[25].fcn, expected 245, is " - << last_msg_->states[25].fcn; - EXPECT_EQ( - get_asstates[25].sid.code)>( - reinterpret_cast(&last_msg_->states[25].sid.code)), - 69) - << "incorrect value for states[25].sid.code, expected 69, is " - << last_msg_->states[25].sid.code; - EXPECT_EQ( - get_asstates[25].sid.sat)>( - reinterpret_cast(&last_msg_->states[25].sid.sat)), - 43) - << "incorrect value for states[25].sid.sat, expected 43, is " - << last_msg_->states[25].sid.sat; - EXPECT_EQ(get_asstates[26].cn0)>( - reinterpret_cast(&last_msg_->states[26].cn0)), - 56) - << "incorrect value for states[26].cn0, expected 56, is " - << last_msg_->states[26].cn0; - EXPECT_EQ(get_asstates[26].fcn)>( - reinterpret_cast(&last_msg_->states[26].fcn)), - 108) - << "incorrect value for states[26].fcn, expected 108, is " - << last_msg_->states[26].fcn; - EXPECT_EQ( - get_asstates[26].sid.code)>( - reinterpret_cast(&last_msg_->states[26].sid.code)), - 230) - << "incorrect value for states[26].sid.code, expected 230, is " - << last_msg_->states[26].sid.code; - EXPECT_EQ( - get_asstates[26].sid.sat)>( - reinterpret_cast(&last_msg_->states[26].sid.sat)), - 100) - << "incorrect value for states[26].sid.sat, expected 100, is " - << last_msg_->states[26].sid.sat; - EXPECT_EQ(get_asstates[27].cn0)>( - reinterpret_cast(&last_msg_->states[27].cn0)), - 143) - << "incorrect value for states[27].cn0, expected 143, is " - << last_msg_->states[27].cn0; - EXPECT_EQ(get_asstates[27].fcn)>( - reinterpret_cast(&last_msg_->states[27].fcn)), - 149) - << "incorrect value for states[27].fcn, expected 149, is " - << last_msg_->states[27].fcn; - EXPECT_EQ( - get_asstates[27].sid.code)>( - reinterpret_cast(&last_msg_->states[27].sid.code)), - 68) - << "incorrect value for states[27].sid.code, expected 68, is " - << last_msg_->states[27].sid.code; - EXPECT_EQ( - get_asstates[27].sid.sat)>( - reinterpret_cast(&last_msg_->states[27].sid.sat)), - 247) - << "incorrect value for states[27].sid.sat, expected 247, is " - << last_msg_->states[27].sid.sat; - EXPECT_EQ(get_asstates[28].cn0)>( - reinterpret_cast(&last_msg_->states[28].cn0)), - 70) - << "incorrect value for states[28].cn0, expected 70, is " - << last_msg_->states[28].cn0; - EXPECT_EQ(get_asstates[28].fcn)>( - reinterpret_cast(&last_msg_->states[28].fcn)), - 233) - << "incorrect value for states[28].fcn, expected 233, is " - << last_msg_->states[28].fcn; - EXPECT_EQ( - get_asstates[28].sid.code)>( - reinterpret_cast(&last_msg_->states[28].sid.code)), - 101) - << "incorrect value for states[28].sid.code, expected 101, is " - << last_msg_->states[28].sid.code; - EXPECT_EQ( - get_asstates[28].sid.sat)>( - reinterpret_cast(&last_msg_->states[28].sid.sat)), - 137) - << "incorrect value for states[28].sid.sat, expected 137, is " - << last_msg_->states[28].sid.sat; - EXPECT_EQ(get_asstates[29].cn0)>( - reinterpret_cast(&last_msg_->states[29].cn0)), - 110) - << "incorrect value for states[29].cn0, expected 110, is " - << last_msg_->states[29].cn0; - EXPECT_EQ(get_asstates[29].fcn)>( - reinterpret_cast(&last_msg_->states[29].fcn)), - 38) - << "incorrect value for states[29].fcn, expected 38, is " - << last_msg_->states[29].fcn; - EXPECT_EQ( - get_asstates[29].sid.code)>( - reinterpret_cast(&last_msg_->states[29].sid.code)), - 165) - << "incorrect value for states[29].sid.code, expected 165, is " - << last_msg_->states[29].sid.code; - EXPECT_EQ( - get_asstates[29].sid.sat)>( - reinterpret_cast(&last_msg_->states[29].sid.sat)), - 49) - << "incorrect value for states[29].sid.sat, expected 49, is " - << last_msg_->states[29].sid.sat; - EXPECT_EQ(get_asstates[30].cn0)>( - reinterpret_cast(&last_msg_->states[30].cn0)), - 213) - << "incorrect value for states[30].cn0, expected 213, is " - << last_msg_->states[30].cn0; - EXPECT_EQ(get_asstates[30].fcn)>( - reinterpret_cast(&last_msg_->states[30].fcn)), - 80) - << "incorrect value for states[30].fcn, expected 80, is " - << last_msg_->states[30].fcn; - EXPECT_EQ( - get_asstates[30].sid.code)>( - reinterpret_cast(&last_msg_->states[30].sid.code)), - 230) - << "incorrect value for states[30].sid.code, expected 230, is " - << last_msg_->states[30].sid.code; - EXPECT_EQ( - get_asstates[30].sid.sat)>( - reinterpret_cast(&last_msg_->states[30].sid.sat)), - 218) - << "incorrect value for states[30].sid.sat, expected 218, is " - << last_msg_->states[30].sid.sat; - EXPECT_EQ(get_asstates[31].cn0)>( - reinterpret_cast(&last_msg_->states[31].cn0)), - 128) - << "incorrect value for states[31].cn0, expected 128, is " - << last_msg_->states[31].cn0; - EXPECT_EQ(get_asstates[31].fcn)>( - reinterpret_cast(&last_msg_->states[31].fcn)), - 139) - << "incorrect value for states[31].fcn, expected 139, is " - << last_msg_->states[31].fcn; - EXPECT_EQ( - get_asstates[31].sid.code)>( - reinterpret_cast(&last_msg_->states[31].sid.code)), - 179) - << "incorrect value for states[31].sid.code, expected 179, is " - << last_msg_->states[31].sid.code; - EXPECT_EQ( - get_asstates[31].sid.sat)>( - reinterpret_cast(&last_msg_->states[31].sid.sat)), - 196) - << "incorrect value for states[31].sid.sat, expected 196, is " - << last_msg_->states[31].sid.sat; - EXPECT_EQ(get_asstates[32].cn0)>( - reinterpret_cast(&last_msg_->states[32].cn0)), - 171) - << "incorrect value for states[32].cn0, expected 171, is " - << last_msg_->states[32].cn0; - EXPECT_EQ(get_asstates[32].fcn)>( - reinterpret_cast(&last_msg_->states[32].fcn)), - 196) - << "incorrect value for states[32].fcn, expected 196, is " - << last_msg_->states[32].fcn; - EXPECT_EQ( - get_asstates[32].sid.code)>( - reinterpret_cast(&last_msg_->states[32].sid.code)), - 178) - << "incorrect value for states[32].sid.code, expected 178, is " - << last_msg_->states[32].sid.code; - EXPECT_EQ( - get_asstates[32].sid.sat)>( - reinterpret_cast(&last_msg_->states[32].sid.sat)), - 15) - << "incorrect value for states[32].sid.sat, expected 15, is " - << last_msg_->states[32].sid.sat; - EXPECT_EQ(get_asstates[33].cn0)>( - reinterpret_cast(&last_msg_->states[33].cn0)), - 194) - << "incorrect value for states[33].cn0, expected 194, is " - << last_msg_->states[33].cn0; - EXPECT_EQ(get_asstates[33].fcn)>( - reinterpret_cast(&last_msg_->states[33].fcn)), - 97) - << "incorrect value for states[33].fcn, expected 97, is " - << last_msg_->states[33].fcn; - EXPECT_EQ( - get_asstates[33].sid.code)>( - reinterpret_cast(&last_msg_->states[33].sid.code)), - 212) - << "incorrect value for states[33].sid.code, expected 212, is " - << last_msg_->states[33].sid.code; - EXPECT_EQ( - get_asstates[33].sid.sat)>( - reinterpret_cast(&last_msg_->states[33].sid.sat)), - 8) - << "incorrect value for states[33].sid.sat, expected 8, is " - << last_msg_->states[33].sid.sat; - EXPECT_EQ(get_asstates[34].cn0)>( - reinterpret_cast(&last_msg_->states[34].cn0)), - 99) - << "incorrect value for states[34].cn0, expected 99, is " - << last_msg_->states[34].cn0; - EXPECT_EQ(get_asstates[34].fcn)>( - reinterpret_cast(&last_msg_->states[34].fcn)), - 79) - << "incorrect value for states[34].fcn, expected 79, is " - << last_msg_->states[34].fcn; - EXPECT_EQ( - get_asstates[34].sid.code)>( - reinterpret_cast(&last_msg_->states[34].sid.code)), - 233) - << "incorrect value for states[34].sid.code, expected 233, is " - << last_msg_->states[34].sid.code; - EXPECT_EQ( - get_asstates[34].sid.sat)>( - reinterpret_cast(&last_msg_->states[34].sid.sat)), - 83) - << "incorrect value for states[34].sid.sat, expected 83, is " - << last_msg_->states[34].sid.sat; - EXPECT_EQ(get_asstates[35].cn0)>( - reinterpret_cast(&last_msg_->states[35].cn0)), - 180) - << "incorrect value for states[35].cn0, expected 180, is " - << last_msg_->states[35].cn0; - EXPECT_EQ(get_asstates[35].fcn)>( - reinterpret_cast(&last_msg_->states[35].fcn)), - 31) - << "incorrect value for states[35].fcn, expected 31, is " - << last_msg_->states[35].fcn; - EXPECT_EQ( - get_asstates[35].sid.code)>( - reinterpret_cast(&last_msg_->states[35].sid.code)), - 90) - << "incorrect value for states[35].sid.code, expected 90, is " - << last_msg_->states[35].sid.code; - EXPECT_EQ( - get_asstates[35].sid.sat)>( - reinterpret_cast(&last_msg_->states[35].sid.sat)), - 55) - << "incorrect value for states[35].sid.sat, expected 55, is " - << last_msg_->states[35].sid.sat; - EXPECT_EQ(get_asstates[36].cn0)>( - reinterpret_cast(&last_msg_->states[36].cn0)), - 186) - << "incorrect value for states[36].cn0, expected 186, is " - << last_msg_->states[36].cn0; - EXPECT_EQ(get_asstates[36].fcn)>( - reinterpret_cast(&last_msg_->states[36].fcn)), - 105) - << "incorrect value for states[36].fcn, expected 105, is " - << last_msg_->states[36].fcn; - EXPECT_EQ( - get_asstates[36].sid.code)>( - reinterpret_cast(&last_msg_->states[36].sid.code)), - 25) - << "incorrect value for states[36].sid.code, expected 25, is " - << last_msg_->states[36].sid.code; - EXPECT_EQ( - get_asstates[36].sid.sat)>( - reinterpret_cast(&last_msg_->states[36].sid.sat)), - 5) - << "incorrect value for states[36].sid.sat, expected 5, is " - << last_msg_->states[36].sid.sat; - EXPECT_EQ(get_asstates[37].cn0)>( - reinterpret_cast(&last_msg_->states[37].cn0)), - 111) - << "incorrect value for states[37].cn0, expected 111, is " - << last_msg_->states[37].cn0; - EXPECT_EQ(get_asstates[37].fcn)>( - reinterpret_cast(&last_msg_->states[37].fcn)), - 80) - << "incorrect value for states[37].fcn, expected 80, is " - << last_msg_->states[37].fcn; - EXPECT_EQ( - get_asstates[37].sid.code)>( - reinterpret_cast(&last_msg_->states[37].sid.code)), - 224) - << "incorrect value for states[37].sid.code, expected 224, is " - << last_msg_->states[37].sid.code; - EXPECT_EQ( - get_asstates[37].sid.sat)>( - reinterpret_cast(&last_msg_->states[37].sid.sat)), - 22) - << "incorrect value for states[37].sid.sat, expected 22, is " - << last_msg_->states[37].sid.sat; - EXPECT_EQ(get_asstates[38].cn0)>( - reinterpret_cast(&last_msg_->states[38].cn0)), - 166) - << "incorrect value for states[38].cn0, expected 166, is " - << last_msg_->states[38].cn0; - EXPECT_EQ(get_asstates[38].fcn)>( - reinterpret_cast(&last_msg_->states[38].fcn)), - 106) - << "incorrect value for states[38].fcn, expected 106, is " - << last_msg_->states[38].fcn; - EXPECT_EQ( - get_asstates[38].sid.code)>( - reinterpret_cast(&last_msg_->states[38].sid.code)), - 48) - << "incorrect value for states[38].sid.code, expected 48, is " - << last_msg_->states[38].sid.code; - EXPECT_EQ( - get_asstates[38].sid.sat)>( - reinterpret_cast(&last_msg_->states[38].sid.sat)), - 8) - << "incorrect value for states[38].sid.sat, expected 8, is " - << last_msg_->states[38].sid.sat; - EXPECT_EQ(get_asstates[39].cn0)>( - reinterpret_cast(&last_msg_->states[39].cn0)), - 49) - << "incorrect value for states[39].cn0, expected 49, is " - << last_msg_->states[39].cn0; - EXPECT_EQ(get_asstates[39].fcn)>( - reinterpret_cast(&last_msg_->states[39].fcn)), - 156) - << "incorrect value for states[39].fcn, expected 156, is " - << last_msg_->states[39].fcn; - EXPECT_EQ( - get_asstates[39].sid.code)>( - reinterpret_cast(&last_msg_->states[39].sid.code)), - 48) - << "incorrect value for states[39].sid.code, expected 48, is " - << last_msg_->states[39].sid.code; - EXPECT_EQ( - get_asstates[39].sid.sat)>( - reinterpret_cast(&last_msg_->states[39].sid.sat)), - 4) - << "incorrect value for states[39].sid.sat, expected 4, is " - << last_msg_->states[39].sid.sat; - EXPECT_EQ(get_asstates[40].cn0)>( - reinterpret_cast(&last_msg_->states[40].cn0)), - 146) - << "incorrect value for states[40].cn0, expected 146, is " - << last_msg_->states[40].cn0; - EXPECT_EQ(get_asstates[40].fcn)>( - reinterpret_cast(&last_msg_->states[40].fcn)), - 142) - << "incorrect value for states[40].fcn, expected 142, is " - << last_msg_->states[40].fcn; - EXPECT_EQ( - get_asstates[40].sid.code)>( - reinterpret_cast(&last_msg_->states[40].sid.code)), - 19) - << "incorrect value for states[40].sid.code, expected 19, is " - << last_msg_->states[40].sid.code; - EXPECT_EQ( - get_asstates[40].sid.sat)>( - reinterpret_cast(&last_msg_->states[40].sid.sat)), - 86) - << "incorrect value for states[40].sid.sat, expected 86, is " - << last_msg_->states[40].sid.sat; - EXPECT_EQ(get_asstates[41].cn0)>( - reinterpret_cast(&last_msg_->states[41].cn0)), - 64) - << "incorrect value for states[41].cn0, expected 64, is " - << last_msg_->states[41].cn0; - EXPECT_EQ(get_asstates[41].fcn)>( - reinterpret_cast(&last_msg_->states[41].fcn)), - 115) - << "incorrect value for states[41].fcn, expected 115, is " - << last_msg_->states[41].fcn; - EXPECT_EQ( - get_asstates[41].sid.code)>( - reinterpret_cast(&last_msg_->states[41].sid.code)), - 124) - << "incorrect value for states[41].sid.code, expected 124, is " - << last_msg_->states[41].sid.code; - EXPECT_EQ( - get_asstates[41].sid.sat)>( - reinterpret_cast(&last_msg_->states[41].sid.sat)), - 91) - << "incorrect value for states[41].sid.sat, expected 91, is " - << last_msg_->states[41].sid.sat; - EXPECT_EQ(get_asstates[42].cn0)>( - reinterpret_cast(&last_msg_->states[42].cn0)), - 178) - << "incorrect value for states[42].cn0, expected 178, is " - << last_msg_->states[42].cn0; - EXPECT_EQ(get_asstates[42].fcn)>( - reinterpret_cast(&last_msg_->states[42].fcn)), - 115) - << "incorrect value for states[42].fcn, expected 115, is " - << last_msg_->states[42].fcn; - EXPECT_EQ( - get_asstates[42].sid.code)>( - reinterpret_cast(&last_msg_->states[42].sid.code)), - 230) - << "incorrect value for states[42].sid.code, expected 230, is " - << last_msg_->states[42].sid.code; - EXPECT_EQ( - get_asstates[42].sid.sat)>( - reinterpret_cast(&last_msg_->states[42].sid.sat)), - 28) - << "incorrect value for states[42].sid.sat, expected 28, is " - << last_msg_->states[42].sid.sat; - EXPECT_EQ(get_asstates[43].cn0)>( - reinterpret_cast(&last_msg_->states[43].cn0)), - 242) - << "incorrect value for states[43].cn0, expected 242, is " - << last_msg_->states[43].cn0; - EXPECT_EQ(get_asstates[43].fcn)>( - reinterpret_cast(&last_msg_->states[43].fcn)), - 16) - << "incorrect value for states[43].fcn, expected 16, is " - << last_msg_->states[43].fcn; - EXPECT_EQ( - get_asstates[43].sid.code)>( - reinterpret_cast(&last_msg_->states[43].sid.code)), - 131) - << "incorrect value for states[43].sid.code, expected 131, is " - << last_msg_->states[43].sid.code; - EXPECT_EQ( - get_asstates[43].sid.sat)>( - reinterpret_cast(&last_msg_->states[43].sid.sat)), - 190) - << "incorrect value for states[43].sid.sat, expected 190, is " - << last_msg_->states[43].sid.sat; - EXPECT_EQ(get_asstates[44].cn0)>( - reinterpret_cast(&last_msg_->states[44].cn0)), - 113) - << "incorrect value for states[44].cn0, expected 113, is " - << last_msg_->states[44].cn0; - EXPECT_EQ(get_asstates[44].fcn)>( - reinterpret_cast(&last_msg_->states[44].fcn)), - 182) - << "incorrect value for states[44].fcn, expected 182, is " - << last_msg_->states[44].fcn; - EXPECT_EQ( - get_asstates[44].sid.code)>( - reinterpret_cast(&last_msg_->states[44].sid.code)), - 59) - << "incorrect value for states[44].sid.code, expected 59, is " - << last_msg_->states[44].sid.code; - EXPECT_EQ( - get_asstates[44].sid.sat)>( - reinterpret_cast(&last_msg_->states[44].sid.sat)), - 105) - << "incorrect value for states[44].sid.sat, expected 105, is " - << last_msg_->states[44].sid.sat; - EXPECT_EQ(get_asstates[45].cn0)>( - reinterpret_cast(&last_msg_->states[45].cn0)), - 179) - << "incorrect value for states[45].cn0, expected 179, is " - << last_msg_->states[45].cn0; - EXPECT_EQ(get_asstates[45].fcn)>( - reinterpret_cast(&last_msg_->states[45].fcn)), - 48) - << "incorrect value for states[45].fcn, expected 48, is " - << last_msg_->states[45].fcn; - EXPECT_EQ( - get_asstates[45].sid.code)>( - reinterpret_cast(&last_msg_->states[45].sid.code)), - 180) - << "incorrect value for states[45].sid.code, expected 180, is " - << last_msg_->states[45].sid.code; - EXPECT_EQ( - get_asstates[45].sid.sat)>( - reinterpret_cast(&last_msg_->states[45].sid.sat)), - 192) - << "incorrect value for states[45].sid.sat, expected 192, is " - << last_msg_->states[45].sid.sat; - EXPECT_EQ(get_asstates[46].cn0)>( - reinterpret_cast(&last_msg_->states[46].cn0)), - 211) - << "incorrect value for states[46].cn0, expected 211, is " - << last_msg_->states[46].cn0; - EXPECT_EQ(get_asstates[46].fcn)>( - reinterpret_cast(&last_msg_->states[46].fcn)), - 172) - << "incorrect value for states[46].fcn, expected 172, is " - << last_msg_->states[46].fcn; - EXPECT_EQ( - get_asstates[46].sid.code)>( - reinterpret_cast(&last_msg_->states[46].sid.code)), - 31) - << "incorrect value for states[46].sid.code, expected 31, is " - << last_msg_->states[46].sid.code; - EXPECT_EQ( - get_asstates[46].sid.sat)>( - reinterpret_cast(&last_msg_->states[46].sid.sat)), - 166) - << "incorrect value for states[46].sid.sat, expected 166, is " - << last_msg_->states[46].sid.sat; - EXPECT_EQ(get_asstates[47].cn0)>( - reinterpret_cast(&last_msg_->states[47].cn0)), - 49) - << "incorrect value for states[47].cn0, expected 49, is " - << last_msg_->states[47].cn0; - EXPECT_EQ(get_asstates[47].fcn)>( - reinterpret_cast(&last_msg_->states[47].fcn)), - 140) - << "incorrect value for states[47].fcn, expected 140, is " - << last_msg_->states[47].fcn; - EXPECT_EQ( - get_asstates[47].sid.code)>( - reinterpret_cast(&last_msg_->states[47].sid.code)), - 228) - << "incorrect value for states[47].sid.code, expected 228, is " - << last_msg_->states[47].sid.code; - EXPECT_EQ( - get_asstates[47].sid.sat)>( - reinterpret_cast(&last_msg_->states[47].sid.sat)), - 77) - << "incorrect value for states[47].sid.sat, expected 77, is " - << last_msg_->states[47].sid.sat; - EXPECT_EQ(get_asstates[48].cn0)>( - reinterpret_cast(&last_msg_->states[48].cn0)), - 194) - << "incorrect value for states[48].cn0, expected 194, is " - << last_msg_->states[48].cn0; - EXPECT_EQ(get_asstates[48].fcn)>( - reinterpret_cast(&last_msg_->states[48].fcn)), - 240) - << "incorrect value for states[48].fcn, expected 240, is " - << last_msg_->states[48].fcn; - EXPECT_EQ( - get_asstates[48].sid.code)>( - reinterpret_cast(&last_msg_->states[48].sid.code)), - 77) - << "incorrect value for states[48].sid.code, expected 77, is " - << last_msg_->states[48].sid.code; - EXPECT_EQ( - get_asstates[48].sid.sat)>( - reinterpret_cast(&last_msg_->states[48].sid.sat)), - 128) - << "incorrect value for states[48].sid.sat, expected 128, is " - << last_msg_->states[48].sid.sat; - EXPECT_EQ(get_asstates[49].cn0)>( - reinterpret_cast(&last_msg_->states[49].cn0)), - 58) - << "incorrect value for states[49].cn0, expected 58, is " - << last_msg_->states[49].cn0; - EXPECT_EQ(get_asstates[49].fcn)>( - reinterpret_cast(&last_msg_->states[49].fcn)), - 41) - << "incorrect value for states[49].fcn, expected 41, is " - << last_msg_->states[49].fcn; - EXPECT_EQ( - get_asstates[49].sid.code)>( - reinterpret_cast(&last_msg_->states[49].sid.code)), - 194) - << "incorrect value for states[49].sid.code, expected 194, is " - << last_msg_->states[49].sid.code; - EXPECT_EQ( - get_asstates[49].sid.sat)>( - reinterpret_cast(&last_msg_->states[49].sid.sat)), - 134) - << "incorrect value for states[49].sid.sat, expected 134, is " - << last_msg_->states[49].sid.sat; - EXPECT_EQ(get_asstates[50].cn0)>( - reinterpret_cast(&last_msg_->states[50].cn0)), - 55) - << "incorrect value for states[50].cn0, expected 55, is " - << last_msg_->states[50].cn0; - EXPECT_EQ(get_asstates[50].fcn)>( - reinterpret_cast(&last_msg_->states[50].fcn)), - 129) - << "incorrect value for states[50].fcn, expected 129, is " - << last_msg_->states[50].fcn; - EXPECT_EQ( - get_asstates[50].sid.code)>( - reinterpret_cast(&last_msg_->states[50].sid.code)), - 53) - << "incorrect value for states[50].sid.code, expected 53, is " - << last_msg_->states[50].sid.code; - EXPECT_EQ( - get_asstates[50].sid.sat)>( - reinterpret_cast(&last_msg_->states[50].sid.sat)), - 18) - << "incorrect value for states[50].sid.sat, expected 18, is " - << last_msg_->states[50].sid.sat; - EXPECT_EQ(get_asstates[51].cn0)>( - reinterpret_cast(&last_msg_->states[51].cn0)), - 92) - << "incorrect value for states[51].cn0, expected 92, is " - << last_msg_->states[51].cn0; - EXPECT_EQ(get_asstates[51].fcn)>( - reinterpret_cast(&last_msg_->states[51].fcn)), - 134) - << "incorrect value for states[51].fcn, expected 134, is " - << last_msg_->states[51].fcn; - EXPECT_EQ( - get_asstates[51].sid.code)>( - reinterpret_cast(&last_msg_->states[51].sid.code)), - 72) - << "incorrect value for states[51].sid.code, expected 72, is " - << last_msg_->states[51].sid.code; - EXPECT_EQ( - get_asstates[51].sid.sat)>( - reinterpret_cast(&last_msg_->states[51].sid.sat)), - 91) - << "incorrect value for states[51].sid.sat, expected 91, is " - << last_msg_->states[51].sid.sat; - EXPECT_EQ(get_asstates[52].cn0)>( - reinterpret_cast(&last_msg_->states[52].cn0)), - 56) - << "incorrect value for states[52].cn0, expected 56, is " - << last_msg_->states[52].cn0; - EXPECT_EQ(get_asstates[52].fcn)>( - reinterpret_cast(&last_msg_->states[52].fcn)), - 157) - << "incorrect value for states[52].fcn, expected 157, is " - << last_msg_->states[52].fcn; - EXPECT_EQ( - get_asstates[52].sid.code)>( - reinterpret_cast(&last_msg_->states[52].sid.code)), - 224) - << "incorrect value for states[52].sid.code, expected 224, is " - << last_msg_->states[52].sid.code; - EXPECT_EQ( - get_asstates[52].sid.sat)>( - reinterpret_cast(&last_msg_->states[52].sid.sat)), - 33) - << "incorrect value for states[52].sid.sat, expected 33, is " - << last_msg_->states[52].sid.sat; - EXPECT_EQ(get_asstates[53].cn0)>( - reinterpret_cast(&last_msg_->states[53].cn0)), - 174) - << "incorrect value for states[53].cn0, expected 174, is " - << last_msg_->states[53].cn0; - EXPECT_EQ(get_asstates[53].fcn)>( - reinterpret_cast(&last_msg_->states[53].fcn)), - 224) - << "incorrect value for states[53].fcn, expected 224, is " - << last_msg_->states[53].fcn; - EXPECT_EQ( - get_asstates[53].sid.code)>( - reinterpret_cast(&last_msg_->states[53].sid.code)), - 54) - << "incorrect value for states[53].sid.code, expected 54, is " - << last_msg_->states[53].sid.code; - EXPECT_EQ( - get_asstates[53].sid.sat)>( - reinterpret_cast(&last_msg_->states[53].sid.sat)), - 186) - << "incorrect value for states[53].sid.sat, expected 186, is " - << last_msg_->states[53].sid.sat; - EXPECT_EQ(get_asstates[54].cn0)>( - reinterpret_cast(&last_msg_->states[54].cn0)), - 190) - << "incorrect value for states[54].cn0, expected 190, is " - << last_msg_->states[54].cn0; - EXPECT_EQ(get_asstates[54].fcn)>( - reinterpret_cast(&last_msg_->states[54].fcn)), - 148) - << "incorrect value for states[54].fcn, expected 148, is " - << last_msg_->states[54].fcn; - EXPECT_EQ( - get_asstates[54].sid.code)>( - reinterpret_cast(&last_msg_->states[54].sid.code)), - 84) - << "incorrect value for states[54].sid.code, expected 84, is " - << last_msg_->states[54].sid.code; - EXPECT_EQ( - get_asstates[54].sid.sat)>( - reinterpret_cast(&last_msg_->states[54].sid.sat)), - 82) - << "incorrect value for states[54].sid.sat, expected 82, is " - << last_msg_->states[54].sid.sat; - EXPECT_EQ(get_asstates[55].cn0)>( - reinterpret_cast(&last_msg_->states[55].cn0)), - 67) - << "incorrect value for states[55].cn0, expected 67, is " - << last_msg_->states[55].cn0; - EXPECT_EQ(get_asstates[55].fcn)>( - reinterpret_cast(&last_msg_->states[55].fcn)), - 62) - << "incorrect value for states[55].fcn, expected 62, is " - << last_msg_->states[55].fcn; - EXPECT_EQ( - get_asstates[55].sid.code)>( - reinterpret_cast(&last_msg_->states[55].sid.code)), - 54) - << "incorrect value for states[55].sid.code, expected 54, is " - << last_msg_->states[55].sid.code; - EXPECT_EQ( - get_asstates[55].sid.sat)>( - reinterpret_cast(&last_msg_->states[55].sid.sat)), - 236) - << "incorrect value for states[55].sid.sat, expected 236, is " - << last_msg_->states[55].sid.sat; - EXPECT_EQ(get_asstates[56].cn0)>( - reinterpret_cast(&last_msg_->states[56].cn0)), - 254) - << "incorrect value for states[56].cn0, expected 254, is " - << last_msg_->states[56].cn0; - EXPECT_EQ(get_asstates[56].fcn)>( - reinterpret_cast(&last_msg_->states[56].fcn)), - 57) - << "incorrect value for states[56].fcn, expected 57, is " - << last_msg_->states[56].fcn; - EXPECT_EQ( - get_asstates[56].sid.code)>( - reinterpret_cast(&last_msg_->states[56].sid.code)), - 215) - << "incorrect value for states[56].sid.code, expected 215, is " - << last_msg_->states[56].sid.code; - EXPECT_EQ( - get_asstates[56].sid.sat)>( - reinterpret_cast(&last_msg_->states[56].sid.sat)), - 52) - << "incorrect value for states[56].sid.sat, expected 52, is " - << last_msg_->states[56].sid.sat; - EXPECT_EQ(get_asstates[57].cn0)>( - reinterpret_cast(&last_msg_->states[57].cn0)), - 174) - << "incorrect value for states[57].cn0, expected 174, is " - << last_msg_->states[57].cn0; - EXPECT_EQ(get_asstates[57].fcn)>( - reinterpret_cast(&last_msg_->states[57].fcn)), - 36) - << "incorrect value for states[57].fcn, expected 36, is " - << last_msg_->states[57].fcn; - EXPECT_EQ( - get_asstates[57].sid.code)>( - reinterpret_cast(&last_msg_->states[57].sid.code)), - 133) - << "incorrect value for states[57].sid.code, expected 133, is " - << last_msg_->states[57].sid.code; - EXPECT_EQ( - get_asstates[57].sid.sat)>( - reinterpret_cast(&last_msg_->states[57].sid.sat)), - 16) - << "incorrect value for states[57].sid.sat, expected 16, is " - << last_msg_->states[57].sid.sat; - EXPECT_EQ(get_asstates[58].cn0)>( - reinterpret_cast(&last_msg_->states[58].cn0)), - 17) - << "incorrect value for states[58].cn0, expected 17, is " - << last_msg_->states[58].cn0; - EXPECT_EQ(get_asstates[58].fcn)>( - reinterpret_cast(&last_msg_->states[58].fcn)), - 145) - << "incorrect value for states[58].fcn, expected 145, is " - << last_msg_->states[58].fcn; - EXPECT_EQ( - get_asstates[58].sid.code)>( - reinterpret_cast(&last_msg_->states[58].sid.code)), - 172) - << "incorrect value for states[58].sid.code, expected 172, is " - << last_msg_->states[58].sid.code; - EXPECT_EQ( - get_asstates[58].sid.sat)>( - reinterpret_cast(&last_msg_->states[58].sid.sat)), - 219) - << "incorrect value for states[58].sid.sat, expected 219, is " - << last_msg_->states[58].sid.sat; - EXPECT_EQ(get_asstates[59].cn0)>( - reinterpret_cast(&last_msg_->states[59].cn0)), - 97) - << "incorrect value for states[59].cn0, expected 97, is " - << last_msg_->states[59].cn0; - EXPECT_EQ(get_asstates[59].fcn)>( - reinterpret_cast(&last_msg_->states[59].fcn)), - 111) - << "incorrect value for states[59].fcn, expected 111, is " - << last_msg_->states[59].fcn; - EXPECT_EQ( - get_asstates[59].sid.code)>( - reinterpret_cast(&last_msg_->states[59].sid.code)), - 179) - << "incorrect value for states[59].sid.code, expected 179, is " - << last_msg_->states[59].sid.code; - EXPECT_EQ( - get_asstates[59].sid.sat)>( - reinterpret_cast(&last_msg_->states[59].sid.sat)), - 192) - << "incorrect value for states[59].sid.sat, expected 192, is " - << last_msg_->states[59].sid.sat; - EXPECT_EQ(get_asstates[60].cn0)>( - reinterpret_cast(&last_msg_->states[60].cn0)), - 134) - << "incorrect value for states[60].cn0, expected 134, is " - << last_msg_->states[60].cn0; - EXPECT_EQ(get_asstates[60].fcn)>( - reinterpret_cast(&last_msg_->states[60].fcn)), - 208) - << "incorrect value for states[60].fcn, expected 208, is " - << last_msg_->states[60].fcn; - EXPECT_EQ( - get_asstates[60].sid.code)>( - reinterpret_cast(&last_msg_->states[60].sid.code)), - 56) - << "incorrect value for states[60].sid.code, expected 56, is " - << last_msg_->states[60].sid.code; - EXPECT_EQ( - get_asstates[60].sid.sat)>( - reinterpret_cast(&last_msg_->states[60].sid.sat)), - 207) - << "incorrect value for states[60].sid.sat, expected 207, is " - << last_msg_->states[60].sid.sat; - EXPECT_EQ(get_asstates[61].cn0)>( - reinterpret_cast(&last_msg_->states[61].cn0)), - 226) - << "incorrect value for states[61].cn0, expected 226, is " - << last_msg_->states[61].cn0; - EXPECT_EQ(get_asstates[61].fcn)>( - reinterpret_cast(&last_msg_->states[61].fcn)), - 43) - << "incorrect value for states[61].fcn, expected 43, is " - << last_msg_->states[61].fcn; - EXPECT_EQ( - get_asstates[61].sid.code)>( - reinterpret_cast(&last_msg_->states[61].sid.code)), - 17) - << "incorrect value for states[61].sid.code, expected 17, is " - << last_msg_->states[61].sid.code; - EXPECT_EQ( - get_asstates[61].sid.sat)>( - reinterpret_cast(&last_msg_->states[61].sid.sat)), - 180) - << "incorrect value for states[61].sid.sat, expected 180, is " - << last_msg_->states[61].sid.sat; - EXPECT_EQ(get_asstates[62].cn0)>( - reinterpret_cast(&last_msg_->states[62].cn0)), - 113) - << "incorrect value for states[62].cn0, expected 113, is " - << last_msg_->states[62].cn0; - EXPECT_EQ(get_asstates[62].fcn)>( - reinterpret_cast(&last_msg_->states[62].fcn)), - 140) - << "incorrect value for states[62].fcn, expected 140, is " - << last_msg_->states[62].fcn; - EXPECT_EQ( - get_asstates[62].sid.code)>( - reinterpret_cast(&last_msg_->states[62].sid.code)), - 182) - << "incorrect value for states[62].sid.code, expected 182, is " - << last_msg_->states[62].sid.code; - EXPECT_EQ( - get_asstates[62].sid.sat)>( - reinterpret_cast(&last_msg_->states[62].sid.sat)), - 255) - << "incorrect value for states[62].sid.sat, expected 255, is " - << last_msg_->states[62].sid.sat; -} -class Test_legacy_auto_check_sbp_tracking_MsgTrackingState1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgTrackingState1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgTrackingState1, Test) { - uint8_t encoded_frame[] = { - 85, 19, 0, 246, 215, 99, 1, 202, 0, 0, 0, 197, 253, 28, - 66, 1, 203, 0, 0, 0, 231, 99, 16, 66, 1, 208, 0, 0, - 0, 212, 129, 22, 66, 1, 212, 0, 0, 0, 58, 21, 28, 66, - 1, 217, 0, 0, 0, 178, 33, 40, 66, 1, 218, 0, 0, 0, - 235, 189, 21, 66, 1, 220, 0, 0, 0, 29, 177, 25, 66, 1, - 222, 0, 0, 0, 43, 169, 27, 66, 1, 225, 0, 0, 0, 137, - 125, 42, 66, 0, 0, 0, 0, 0, 0, 0, 128, 191, 0, 0, - 0, 0, 0, 0, 0, 128, 191, 222, 97, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_dep_b_t *test_msg = - (msg_tracking_state_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[0].cn0 = 39.24782180786133; - test_msg->states[0].sid.code = 0; - test_msg->states[0].sid.reserved = 0; - test_msg->states[0].sid.sat = 202; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[1].cn0 = 36.09756088256836; - test_msg->states[1].sid.code = 0; - test_msg->states[1].sid.reserved = 0; - test_msg->states[1].sid.sat = 203; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[2].cn0 = 37.62678527832031; - test_msg->states[2].sid.code = 0; - test_msg->states[2].sid.reserved = 0; - test_msg->states[2].sid.sat = 208; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[3].cn0 = 39.020729064941406; - test_msg->states[3].sid.code = 0; - test_msg->states[3].sid.reserved = 0; - test_msg->states[3].sid.sat = 212; - test_msg->states[3].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[4].cn0 = 42.03290557861328; - test_msg->states[4].sid.code = 0; - test_msg->states[4].sid.reserved = 0; - test_msg->states[4].sid.sat = 217; - test_msg->states[4].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[5].cn0 = 37.43546676635742; - test_msg->states[5].sid.code = 0; - test_msg->states[5].sid.reserved = 0; - test_msg->states[5].sid.sat = 218; - test_msg->states[5].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[6].cn0 = 38.4229621887207; - test_msg->states[6].sid.code = 0; - test_msg->states[6].sid.reserved = 0; - test_msg->states[6].sid.sat = 220; - test_msg->states[6].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[7].cn0 = 38.91520309448242; - test_msg->states[7].sid.code = 0; - test_msg->states[7].sid.reserved = 0; - test_msg->states[7].sid.sat = 222; - test_msg->states[7].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[8].cn0 = 42.62259292602539; - test_msg->states[8].sid.code = 0; - test_msg->states[8].sid.reserved = 0; - test_msg->states[8].sid.sat = 225; - test_msg->states[8].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[9].cn0 = -1.0; - test_msg->states[9].sid.code = 0; - test_msg->states[9].sid.reserved = 0; - test_msg->states[9].sid.sat = 0; - test_msg->states[9].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[10].cn0 = -1.0; - test_msg->states[10].sid.code = 0; - test_msg->states[10].sid.reserved = 0; - test_msg->states[10].sid.sat = 0; - test_msg->states[10].state = 0; - - EXPECT_EQ(send_message(0x13, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->states[0].cn0 * 100 - 39.2478218079 * 100), 0.05) - << "incorrect value for states[0].cn0, expected 39.2478218079, is " - << last_msg_->states[0].cn0; - EXPECT_EQ( - get_asstates[0].sid.code)>( - reinterpret_cast(&last_msg_->states[0].sid.code)), - 0) - << "incorrect value for states[0].sid.code, expected 0, is " - << last_msg_->states[0].sid.code; - EXPECT_EQ(get_asstates[0].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[0].sid.reserved)), - 0) - << "incorrect value for states[0].sid.reserved, expected 0, is " - << last_msg_->states[0].sid.reserved; - EXPECT_EQ( - get_asstates[0].sid.sat)>( - reinterpret_cast(&last_msg_->states[0].sid.sat)), - 202) - << "incorrect value for states[0].sid.sat, expected 202, is " - << last_msg_->states[0].sid.sat; - EXPECT_EQ(get_asstates[0].state)>( - reinterpret_cast(&last_msg_->states[0].state)), - 1) - << "incorrect value for states[0].state, expected 1, is " - << last_msg_->states[0].state; - EXPECT_LT((last_msg_->states[1].cn0 * 100 - 36.0975608826 * 100), 0.05) - << "incorrect value for states[1].cn0, expected 36.0975608826, is " - << last_msg_->states[1].cn0; - EXPECT_EQ( - get_asstates[1].sid.code)>( - reinterpret_cast(&last_msg_->states[1].sid.code)), - 0) - << "incorrect value for states[1].sid.code, expected 0, is " - << last_msg_->states[1].sid.code; - EXPECT_EQ(get_asstates[1].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[1].sid.reserved)), - 0) - << "incorrect value for states[1].sid.reserved, expected 0, is " - << last_msg_->states[1].sid.reserved; - EXPECT_EQ( - get_asstates[1].sid.sat)>( - reinterpret_cast(&last_msg_->states[1].sid.sat)), - 203) - << "incorrect value for states[1].sid.sat, expected 203, is " - << last_msg_->states[1].sid.sat; - EXPECT_EQ(get_asstates[1].state)>( - reinterpret_cast(&last_msg_->states[1].state)), - 1) - << "incorrect value for states[1].state, expected 1, is " - << last_msg_->states[1].state; - EXPECT_LT((last_msg_->states[2].cn0 * 100 - 37.6267852783 * 100), 0.05) - << "incorrect value for states[2].cn0, expected 37.6267852783, is " - << last_msg_->states[2].cn0; - EXPECT_EQ( - get_asstates[2].sid.code)>( - reinterpret_cast(&last_msg_->states[2].sid.code)), - 0) - << "incorrect value for states[2].sid.code, expected 0, is " - << last_msg_->states[2].sid.code; - EXPECT_EQ(get_asstates[2].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[2].sid.reserved)), - 0) - << "incorrect value for states[2].sid.reserved, expected 0, is " - << last_msg_->states[2].sid.reserved; - EXPECT_EQ( - get_asstates[2].sid.sat)>( - reinterpret_cast(&last_msg_->states[2].sid.sat)), - 208) - << "incorrect value for states[2].sid.sat, expected 208, is " - << last_msg_->states[2].sid.sat; - EXPECT_EQ(get_asstates[2].state)>( - reinterpret_cast(&last_msg_->states[2].state)), - 1) - << "incorrect value for states[2].state, expected 1, is " - << last_msg_->states[2].state; - EXPECT_LT((last_msg_->states[3].cn0 * 100 - 39.0207290649 * 100), 0.05) - << "incorrect value for states[3].cn0, expected 39.0207290649, is " - << last_msg_->states[3].cn0; - EXPECT_EQ( - get_asstates[3].sid.code)>( - reinterpret_cast(&last_msg_->states[3].sid.code)), - 0) - << "incorrect value for states[3].sid.code, expected 0, is " - << last_msg_->states[3].sid.code; - EXPECT_EQ(get_asstates[3].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[3].sid.reserved)), - 0) - << "incorrect value for states[3].sid.reserved, expected 0, is " - << last_msg_->states[3].sid.reserved; - EXPECT_EQ( - get_asstates[3].sid.sat)>( - reinterpret_cast(&last_msg_->states[3].sid.sat)), - 212) - << "incorrect value for states[3].sid.sat, expected 212, is " - << last_msg_->states[3].sid.sat; - EXPECT_EQ(get_asstates[3].state)>( - reinterpret_cast(&last_msg_->states[3].state)), - 1) - << "incorrect value for states[3].state, expected 1, is " - << last_msg_->states[3].state; - EXPECT_LT((last_msg_->states[4].cn0 * 100 - 42.0329055786 * 100), 0.05) - << "incorrect value for states[4].cn0, expected 42.0329055786, is " - << last_msg_->states[4].cn0; - EXPECT_EQ( - get_asstates[4].sid.code)>( - reinterpret_cast(&last_msg_->states[4].sid.code)), - 0) - << "incorrect value for states[4].sid.code, expected 0, is " - << last_msg_->states[4].sid.code; - EXPECT_EQ(get_asstates[4].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[4].sid.reserved)), - 0) - << "incorrect value for states[4].sid.reserved, expected 0, is " - << last_msg_->states[4].sid.reserved; - EXPECT_EQ( - get_asstates[4].sid.sat)>( - reinterpret_cast(&last_msg_->states[4].sid.sat)), - 217) - << "incorrect value for states[4].sid.sat, expected 217, is " - << last_msg_->states[4].sid.sat; - EXPECT_EQ(get_asstates[4].state)>( - reinterpret_cast(&last_msg_->states[4].state)), - 1) - << "incorrect value for states[4].state, expected 1, is " - << last_msg_->states[4].state; - EXPECT_LT((last_msg_->states[5].cn0 * 100 - 37.4354667664 * 100), 0.05) - << "incorrect value for states[5].cn0, expected 37.4354667664, is " - << last_msg_->states[5].cn0; - EXPECT_EQ( - get_asstates[5].sid.code)>( - reinterpret_cast(&last_msg_->states[5].sid.code)), - 0) - << "incorrect value for states[5].sid.code, expected 0, is " - << last_msg_->states[5].sid.code; - EXPECT_EQ(get_asstates[5].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[5].sid.reserved)), - 0) - << "incorrect value for states[5].sid.reserved, expected 0, is " - << last_msg_->states[5].sid.reserved; - EXPECT_EQ( - get_asstates[5].sid.sat)>( - reinterpret_cast(&last_msg_->states[5].sid.sat)), - 218) - << "incorrect value for states[5].sid.sat, expected 218, is " - << last_msg_->states[5].sid.sat; - EXPECT_EQ(get_asstates[5].state)>( - reinterpret_cast(&last_msg_->states[5].state)), - 1) - << "incorrect value for states[5].state, expected 1, is " - << last_msg_->states[5].state; - EXPECT_LT((last_msg_->states[6].cn0 * 100 - 38.4229621887 * 100), 0.05) - << "incorrect value for states[6].cn0, expected 38.4229621887, is " - << last_msg_->states[6].cn0; - EXPECT_EQ( - get_asstates[6].sid.code)>( - reinterpret_cast(&last_msg_->states[6].sid.code)), - 0) - << "incorrect value for states[6].sid.code, expected 0, is " - << last_msg_->states[6].sid.code; - EXPECT_EQ(get_asstates[6].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[6].sid.reserved)), - 0) - << "incorrect value for states[6].sid.reserved, expected 0, is " - << last_msg_->states[6].sid.reserved; - EXPECT_EQ( - get_asstates[6].sid.sat)>( - reinterpret_cast(&last_msg_->states[6].sid.sat)), - 220) - << "incorrect value for states[6].sid.sat, expected 220, is " - << last_msg_->states[6].sid.sat; - EXPECT_EQ(get_asstates[6].state)>( - reinterpret_cast(&last_msg_->states[6].state)), - 1) - << "incorrect value for states[6].state, expected 1, is " - << last_msg_->states[6].state; - EXPECT_LT((last_msg_->states[7].cn0 * 100 - 38.9152030945 * 100), 0.05) - << "incorrect value for states[7].cn0, expected 38.9152030945, is " - << last_msg_->states[7].cn0; - EXPECT_EQ( - get_asstates[7].sid.code)>( - reinterpret_cast(&last_msg_->states[7].sid.code)), - 0) - << "incorrect value for states[7].sid.code, expected 0, is " - << last_msg_->states[7].sid.code; - EXPECT_EQ(get_asstates[7].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[7].sid.reserved)), - 0) - << "incorrect value for states[7].sid.reserved, expected 0, is " - << last_msg_->states[7].sid.reserved; - EXPECT_EQ( - get_asstates[7].sid.sat)>( - reinterpret_cast(&last_msg_->states[7].sid.sat)), - 222) - << "incorrect value for states[7].sid.sat, expected 222, is " - << last_msg_->states[7].sid.sat; - EXPECT_EQ(get_asstates[7].state)>( - reinterpret_cast(&last_msg_->states[7].state)), - 1) - << "incorrect value for states[7].state, expected 1, is " - << last_msg_->states[7].state; - EXPECT_LT((last_msg_->states[8].cn0 * 100 - 42.622592926 * 100), 0.05) - << "incorrect value for states[8].cn0, expected 42.622592926, is " - << last_msg_->states[8].cn0; - EXPECT_EQ( - get_asstates[8].sid.code)>( - reinterpret_cast(&last_msg_->states[8].sid.code)), - 0) - << "incorrect value for states[8].sid.code, expected 0, is " - << last_msg_->states[8].sid.code; - EXPECT_EQ(get_asstates[8].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[8].sid.reserved)), - 0) - << "incorrect value for states[8].sid.reserved, expected 0, is " - << last_msg_->states[8].sid.reserved; - EXPECT_EQ( - get_asstates[8].sid.sat)>( - reinterpret_cast(&last_msg_->states[8].sid.sat)), - 225) - << "incorrect value for states[8].sid.sat, expected 225, is " - << last_msg_->states[8].sid.sat; - EXPECT_EQ(get_asstates[8].state)>( - reinterpret_cast(&last_msg_->states[8].state)), - 1) - << "incorrect value for states[8].state, expected 1, is " - << last_msg_->states[8].state; - EXPECT_LT((last_msg_->states[9].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[9].cn0, expected -1.0, is " - << last_msg_->states[9].cn0; - EXPECT_EQ( - get_asstates[9].sid.code)>( - reinterpret_cast(&last_msg_->states[9].sid.code)), - 0) - << "incorrect value for states[9].sid.code, expected 0, is " - << last_msg_->states[9].sid.code; - EXPECT_EQ(get_asstates[9].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[9].sid.reserved)), - 0) - << "incorrect value for states[9].sid.reserved, expected 0, is " - << last_msg_->states[9].sid.reserved; - EXPECT_EQ( - get_asstates[9].sid.sat)>( - reinterpret_cast(&last_msg_->states[9].sid.sat)), - 0) - << "incorrect value for states[9].sid.sat, expected 0, is " - << last_msg_->states[9].sid.sat; - EXPECT_EQ(get_asstates[9].state)>( - reinterpret_cast(&last_msg_->states[9].state)), - 0) - << "incorrect value for states[9].state, expected 0, is " - << last_msg_->states[9].state; - EXPECT_LT((last_msg_->states[10].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[10].cn0, expected -1.0, is " - << last_msg_->states[10].cn0; - EXPECT_EQ( - get_asstates[10].sid.code)>( - reinterpret_cast(&last_msg_->states[10].sid.code)), - 0) - << "incorrect value for states[10].sid.code, expected 0, is " - << last_msg_->states[10].sid.code; - EXPECT_EQ(get_asstates[10].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[10].sid.reserved)), - 0) - << "incorrect value for states[10].sid.reserved, expected 0, is " - << last_msg_->states[10].sid.reserved; - EXPECT_EQ( - get_asstates[10].sid.sat)>( - reinterpret_cast(&last_msg_->states[10].sid.sat)), - 0) - << "incorrect value for states[10].sid.sat, expected 0, is " - << last_msg_->states[10].sid.sat; - EXPECT_EQ( - get_asstates[10].state)>( - reinterpret_cast(&last_msg_->states[10].state)), - 0) - << "incorrect value for states[10].state, expected 0, is " - << last_msg_->states[10].state; -} -class Test_legacy_auto_check_sbp_tracking_MsgTrackingState2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgTrackingState2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgTrackingState2, Test) { - uint8_t encoded_frame[] = { - 85, 19, 0, 246, 215, 99, 1, 202, 0, 0, 0, 250, 249, 27, - 66, 1, 203, 0, 0, 0, 40, 143, 11, 66, 1, 208, 0, 0, - 0, 190, 200, 21, 66, 1, 212, 0, 0, 0, 251, 233, 26, 66, - 1, 217, 0, 0, 0, 209, 238, 39, 66, 1, 218, 0, 0, 0, - 162, 219, 21, 66, 1, 220, 0, 0, 0, 162, 197, 25, 66, 1, - 222, 0, 0, 0, 14, 35, 28, 66, 1, 225, 0, 0, 0, 9, - 153, 43, 66, 0, 0, 0, 0, 0, 0, 0, 128, 191, 0, 0, - 0, 0, 0, 0, 0, 128, 191, 20, 31, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_dep_b_t *test_msg = - (msg_tracking_state_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[0].cn0 = 38.994117736816406; - test_msg->states[0].sid.code = 0; - test_msg->states[0].sid.reserved = 0; - test_msg->states[0].sid.sat = 202; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[1].cn0 = 34.889801025390625; - test_msg->states[1].sid.code = 0; - test_msg->states[1].sid.reserved = 0; - test_msg->states[1].sid.sat = 203; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[2].cn0 = 37.44603729248047; - test_msg->states[2].sid.code = 0; - test_msg->states[2].sid.reserved = 0; - test_msg->states[2].sid.sat = 208; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[3].cn0 = 38.72849655151367; - test_msg->states[3].sid.code = 0; - test_msg->states[3].sid.reserved = 0; - test_msg->states[3].sid.sat = 212; - test_msg->states[3].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[4].cn0 = 41.983219146728516; - test_msg->states[4].sid.code = 0; - test_msg->states[4].sid.reserved = 0; - test_msg->states[4].sid.sat = 217; - test_msg->states[4].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[5].cn0 = 37.46448516845703; - test_msg->states[5].sid.code = 0; - test_msg->states[5].sid.reserved = 0; - test_msg->states[5].sid.sat = 218; - test_msg->states[5].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[6].cn0 = 38.44300079345703; - test_msg->states[6].sid.code = 0; - test_msg->states[6].sid.reserved = 0; - test_msg->states[6].sid.sat = 220; - test_msg->states[6].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[7].cn0 = 39.03423309326172; - test_msg->states[7].sid.code = 0; - test_msg->states[7].sid.reserved = 0; - test_msg->states[7].sid.sat = 222; - test_msg->states[7].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[8].cn0 = 42.89944839477539; - test_msg->states[8].sid.code = 0; - test_msg->states[8].sid.reserved = 0; - test_msg->states[8].sid.sat = 225; - test_msg->states[8].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[9].cn0 = -1.0; - test_msg->states[9].sid.code = 0; - test_msg->states[9].sid.reserved = 0; - test_msg->states[9].sid.sat = 0; - test_msg->states[9].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[10].cn0 = -1.0; - test_msg->states[10].sid.code = 0; - test_msg->states[10].sid.reserved = 0; - test_msg->states[10].sid.sat = 0; - test_msg->states[10].state = 0; - - EXPECT_EQ(send_message(0x13, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->states[0].cn0 * 100 - 38.9941177368 * 100), 0.05) - << "incorrect value for states[0].cn0, expected 38.9941177368, is " - << last_msg_->states[0].cn0; - EXPECT_EQ( - get_asstates[0].sid.code)>( - reinterpret_cast(&last_msg_->states[0].sid.code)), - 0) - << "incorrect value for states[0].sid.code, expected 0, is " - << last_msg_->states[0].sid.code; - EXPECT_EQ(get_asstates[0].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[0].sid.reserved)), - 0) - << "incorrect value for states[0].sid.reserved, expected 0, is " - << last_msg_->states[0].sid.reserved; - EXPECT_EQ( - get_asstates[0].sid.sat)>( - reinterpret_cast(&last_msg_->states[0].sid.sat)), - 202) - << "incorrect value for states[0].sid.sat, expected 202, is " - << last_msg_->states[0].sid.sat; - EXPECT_EQ(get_asstates[0].state)>( - reinterpret_cast(&last_msg_->states[0].state)), - 1) - << "incorrect value for states[0].state, expected 1, is " - << last_msg_->states[0].state; - EXPECT_LT((last_msg_->states[1].cn0 * 100 - 34.8898010254 * 100), 0.05) - << "incorrect value for states[1].cn0, expected 34.8898010254, is " - << last_msg_->states[1].cn0; - EXPECT_EQ( - get_asstates[1].sid.code)>( - reinterpret_cast(&last_msg_->states[1].sid.code)), - 0) - << "incorrect value for states[1].sid.code, expected 0, is " - << last_msg_->states[1].sid.code; - EXPECT_EQ(get_asstates[1].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[1].sid.reserved)), - 0) - << "incorrect value for states[1].sid.reserved, expected 0, is " - << last_msg_->states[1].sid.reserved; - EXPECT_EQ( - get_asstates[1].sid.sat)>( - reinterpret_cast(&last_msg_->states[1].sid.sat)), - 203) - << "incorrect value for states[1].sid.sat, expected 203, is " - << last_msg_->states[1].sid.sat; - EXPECT_EQ(get_asstates[1].state)>( - reinterpret_cast(&last_msg_->states[1].state)), - 1) - << "incorrect value for states[1].state, expected 1, is " - << last_msg_->states[1].state; - EXPECT_LT((last_msg_->states[2].cn0 * 100 - 37.4460372925 * 100), 0.05) - << "incorrect value for states[2].cn0, expected 37.4460372925, is " - << last_msg_->states[2].cn0; - EXPECT_EQ( - get_asstates[2].sid.code)>( - reinterpret_cast(&last_msg_->states[2].sid.code)), - 0) - << "incorrect value for states[2].sid.code, expected 0, is " - << last_msg_->states[2].sid.code; - EXPECT_EQ(get_asstates[2].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[2].sid.reserved)), - 0) - << "incorrect value for states[2].sid.reserved, expected 0, is " - << last_msg_->states[2].sid.reserved; - EXPECT_EQ( - get_asstates[2].sid.sat)>( - reinterpret_cast(&last_msg_->states[2].sid.sat)), - 208) - << "incorrect value for states[2].sid.sat, expected 208, is " - << last_msg_->states[2].sid.sat; - EXPECT_EQ(get_asstates[2].state)>( - reinterpret_cast(&last_msg_->states[2].state)), - 1) - << "incorrect value for states[2].state, expected 1, is " - << last_msg_->states[2].state; - EXPECT_LT((last_msg_->states[3].cn0 * 100 - 38.7284965515 * 100), 0.05) - << "incorrect value for states[3].cn0, expected 38.7284965515, is " - << last_msg_->states[3].cn0; - EXPECT_EQ( - get_asstates[3].sid.code)>( - reinterpret_cast(&last_msg_->states[3].sid.code)), - 0) - << "incorrect value for states[3].sid.code, expected 0, is " - << last_msg_->states[3].sid.code; - EXPECT_EQ(get_asstates[3].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[3].sid.reserved)), - 0) - << "incorrect value for states[3].sid.reserved, expected 0, is " - << last_msg_->states[3].sid.reserved; - EXPECT_EQ( - get_asstates[3].sid.sat)>( - reinterpret_cast(&last_msg_->states[3].sid.sat)), - 212) - << "incorrect value for states[3].sid.sat, expected 212, is " - << last_msg_->states[3].sid.sat; - EXPECT_EQ(get_asstates[3].state)>( - reinterpret_cast(&last_msg_->states[3].state)), - 1) - << "incorrect value for states[3].state, expected 1, is " - << last_msg_->states[3].state; - EXPECT_LT((last_msg_->states[4].cn0 * 100 - 41.9832191467 * 100), 0.05) - << "incorrect value for states[4].cn0, expected 41.9832191467, is " - << last_msg_->states[4].cn0; - EXPECT_EQ( - get_asstates[4].sid.code)>( - reinterpret_cast(&last_msg_->states[4].sid.code)), - 0) - << "incorrect value for states[4].sid.code, expected 0, is " - << last_msg_->states[4].sid.code; - EXPECT_EQ(get_asstates[4].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[4].sid.reserved)), - 0) - << "incorrect value for states[4].sid.reserved, expected 0, is " - << last_msg_->states[4].sid.reserved; - EXPECT_EQ( - get_asstates[4].sid.sat)>( - reinterpret_cast(&last_msg_->states[4].sid.sat)), - 217) - << "incorrect value for states[4].sid.sat, expected 217, is " - << last_msg_->states[4].sid.sat; - EXPECT_EQ(get_asstates[4].state)>( - reinterpret_cast(&last_msg_->states[4].state)), - 1) - << "incorrect value for states[4].state, expected 1, is " - << last_msg_->states[4].state; - EXPECT_LT((last_msg_->states[5].cn0 * 100 - 37.4644851685 * 100), 0.05) - << "incorrect value for states[5].cn0, expected 37.4644851685, is " - << last_msg_->states[5].cn0; - EXPECT_EQ( - get_asstates[5].sid.code)>( - reinterpret_cast(&last_msg_->states[5].sid.code)), - 0) - << "incorrect value for states[5].sid.code, expected 0, is " - << last_msg_->states[5].sid.code; - EXPECT_EQ(get_asstates[5].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[5].sid.reserved)), - 0) - << "incorrect value for states[5].sid.reserved, expected 0, is " - << last_msg_->states[5].sid.reserved; - EXPECT_EQ( - get_asstates[5].sid.sat)>( - reinterpret_cast(&last_msg_->states[5].sid.sat)), - 218) - << "incorrect value for states[5].sid.sat, expected 218, is " - << last_msg_->states[5].sid.sat; - EXPECT_EQ(get_asstates[5].state)>( - reinterpret_cast(&last_msg_->states[5].state)), - 1) - << "incorrect value for states[5].state, expected 1, is " - << last_msg_->states[5].state; - EXPECT_LT((last_msg_->states[6].cn0 * 100 - 38.4430007935 * 100), 0.05) - << "incorrect value for states[6].cn0, expected 38.4430007935, is " - << last_msg_->states[6].cn0; - EXPECT_EQ( - get_asstates[6].sid.code)>( - reinterpret_cast(&last_msg_->states[6].sid.code)), - 0) - << "incorrect value for states[6].sid.code, expected 0, is " - << last_msg_->states[6].sid.code; - EXPECT_EQ(get_asstates[6].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[6].sid.reserved)), - 0) - << "incorrect value for states[6].sid.reserved, expected 0, is " - << last_msg_->states[6].sid.reserved; - EXPECT_EQ( - get_asstates[6].sid.sat)>( - reinterpret_cast(&last_msg_->states[6].sid.sat)), - 220) - << "incorrect value for states[6].sid.sat, expected 220, is " - << last_msg_->states[6].sid.sat; - EXPECT_EQ(get_asstates[6].state)>( - reinterpret_cast(&last_msg_->states[6].state)), - 1) - << "incorrect value for states[6].state, expected 1, is " - << last_msg_->states[6].state; - EXPECT_LT((last_msg_->states[7].cn0 * 100 - 39.0342330933 * 100), 0.05) - << "incorrect value for states[7].cn0, expected 39.0342330933, is " - << last_msg_->states[7].cn0; - EXPECT_EQ( - get_asstates[7].sid.code)>( - reinterpret_cast(&last_msg_->states[7].sid.code)), - 0) - << "incorrect value for states[7].sid.code, expected 0, is " - << last_msg_->states[7].sid.code; - EXPECT_EQ(get_asstates[7].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[7].sid.reserved)), - 0) - << "incorrect value for states[7].sid.reserved, expected 0, is " - << last_msg_->states[7].sid.reserved; - EXPECT_EQ( - get_asstates[7].sid.sat)>( - reinterpret_cast(&last_msg_->states[7].sid.sat)), - 222) - << "incorrect value for states[7].sid.sat, expected 222, is " - << last_msg_->states[7].sid.sat; - EXPECT_EQ(get_asstates[7].state)>( - reinterpret_cast(&last_msg_->states[7].state)), - 1) - << "incorrect value for states[7].state, expected 1, is " - << last_msg_->states[7].state; - EXPECT_LT((last_msg_->states[8].cn0 * 100 - 42.8994483948 * 100), 0.05) - << "incorrect value for states[8].cn0, expected 42.8994483948, is " - << last_msg_->states[8].cn0; - EXPECT_EQ( - get_asstates[8].sid.code)>( - reinterpret_cast(&last_msg_->states[8].sid.code)), - 0) - << "incorrect value for states[8].sid.code, expected 0, is " - << last_msg_->states[8].sid.code; - EXPECT_EQ(get_asstates[8].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[8].sid.reserved)), - 0) - << "incorrect value for states[8].sid.reserved, expected 0, is " - << last_msg_->states[8].sid.reserved; - EXPECT_EQ( - get_asstates[8].sid.sat)>( - reinterpret_cast(&last_msg_->states[8].sid.sat)), - 225) - << "incorrect value for states[8].sid.sat, expected 225, is " - << last_msg_->states[8].sid.sat; - EXPECT_EQ(get_asstates[8].state)>( - reinterpret_cast(&last_msg_->states[8].state)), - 1) - << "incorrect value for states[8].state, expected 1, is " - << last_msg_->states[8].state; - EXPECT_LT((last_msg_->states[9].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[9].cn0, expected -1.0, is " - << last_msg_->states[9].cn0; - EXPECT_EQ( - get_asstates[9].sid.code)>( - reinterpret_cast(&last_msg_->states[9].sid.code)), - 0) - << "incorrect value for states[9].sid.code, expected 0, is " - << last_msg_->states[9].sid.code; - EXPECT_EQ(get_asstates[9].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[9].sid.reserved)), - 0) - << "incorrect value for states[9].sid.reserved, expected 0, is " - << last_msg_->states[9].sid.reserved; - EXPECT_EQ( - get_asstates[9].sid.sat)>( - reinterpret_cast(&last_msg_->states[9].sid.sat)), - 0) - << "incorrect value for states[9].sid.sat, expected 0, is " - << last_msg_->states[9].sid.sat; - EXPECT_EQ(get_asstates[9].state)>( - reinterpret_cast(&last_msg_->states[9].state)), - 0) - << "incorrect value for states[9].state, expected 0, is " - << last_msg_->states[9].state; - EXPECT_LT((last_msg_->states[10].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[10].cn0, expected -1.0, is " - << last_msg_->states[10].cn0; - EXPECT_EQ( - get_asstates[10].sid.code)>( - reinterpret_cast(&last_msg_->states[10].sid.code)), - 0) - << "incorrect value for states[10].sid.code, expected 0, is " - << last_msg_->states[10].sid.code; - EXPECT_EQ(get_asstates[10].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[10].sid.reserved)), - 0) - << "incorrect value for states[10].sid.reserved, expected 0, is " - << last_msg_->states[10].sid.reserved; - EXPECT_EQ( - get_asstates[10].sid.sat)>( - reinterpret_cast(&last_msg_->states[10].sid.sat)), - 0) - << "incorrect value for states[10].sid.sat, expected 0, is " - << last_msg_->states[10].sid.sat; - EXPECT_EQ( - get_asstates[10].state)>( - reinterpret_cast(&last_msg_->states[10].state)), - 0) - << "incorrect value for states[10].state, expected 0, is " - << last_msg_->states[10].state; -} -class Test_legacy_auto_check_sbp_tracking_MsgTrackingState3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgTrackingState3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgTrackingState3, Test) { - uint8_t encoded_frame[] = { - 85, 19, 0, 246, 215, 99, 1, 202, 0, 0, 0, 123, 209, 27, - 66, 1, 203, 0, 0, 0, 214, 64, 15, 66, 1, 208, 0, 0, - 0, 56, 55, 22, 66, 1, 212, 0, 0, 0, 91, 142, 27, 66, - 1, 217, 0, 0, 0, 253, 154, 41, 66, 1, 218, 0, 0, 0, - 128, 142, 22, 66, 1, 220, 0, 0, 0, 17, 174, 23, 66, 1, - 222, 0, 0, 0, 155, 2, 29, 66, 1, 225, 0, 0, 0, 162, - 100, 42, 66, 0, 0, 0, 0, 0, 0, 0, 128, 191, 0, 0, - 0, 0, 0, 0, 0, 128, 191, 233, 71, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_dep_b_t *test_msg = - (msg_tracking_state_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[0].cn0 = 38.95457077026367; - test_msg->states[0].sid.code = 0; - test_msg->states[0].sid.reserved = 0; - test_msg->states[0].sid.sat = 202; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[1].cn0 = 35.813316345214844; - test_msg->states[1].sid.code = 0; - test_msg->states[1].sid.reserved = 0; - test_msg->states[1].sid.sat = 203; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[2].cn0 = 37.553924560546875; - test_msg->states[2].sid.code = 0; - test_msg->states[2].sid.reserved = 0; - test_msg->states[2].sid.sat = 208; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[3].cn0 = 38.88901901245117; - test_msg->states[3].sid.code = 0; - test_msg->states[3].sid.reserved = 0; - test_msg->states[3].sid.sat = 212; - test_msg->states[3].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[4].cn0 = 42.4013557434082; - test_msg->states[4].sid.code = 0; - test_msg->states[4].sid.reserved = 0; - test_msg->states[4].sid.sat = 217; - test_msg->states[4].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[5].cn0 = 37.63916015625; - test_msg->states[5].sid.code = 0; - test_msg->states[5].sid.reserved = 0; - test_msg->states[5].sid.sat = 218; - test_msg->states[5].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[6].cn0 = 37.919986724853516; - test_msg->states[6].sid.code = 0; - test_msg->states[6].sid.reserved = 0; - test_msg->states[6].sid.sat = 220; - test_msg->states[6].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[7].cn0 = 39.25254440307617; - test_msg->states[7].sid.code = 0; - test_msg->states[7].sid.reserved = 0; - test_msg->states[7].sid.sat = 222; - test_msg->states[7].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[8].cn0 = 42.59827423095703; - test_msg->states[8].sid.code = 0; - test_msg->states[8].sid.reserved = 0; - test_msg->states[8].sid.sat = 225; - test_msg->states[8].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[9].cn0 = -1.0; - test_msg->states[9].sid.code = 0; - test_msg->states[9].sid.reserved = 0; - test_msg->states[9].sid.sat = 0; - test_msg->states[9].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[10].cn0 = -1.0; - test_msg->states[10].sid.code = 0; - test_msg->states[10].sid.reserved = 0; - test_msg->states[10].sid.sat = 0; - test_msg->states[10].state = 0; - - EXPECT_EQ(send_message(0x13, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->states[0].cn0 * 100 - 38.9545707703 * 100), 0.05) - << "incorrect value for states[0].cn0, expected 38.9545707703, is " - << last_msg_->states[0].cn0; - EXPECT_EQ( - get_asstates[0].sid.code)>( - reinterpret_cast(&last_msg_->states[0].sid.code)), - 0) - << "incorrect value for states[0].sid.code, expected 0, is " - << last_msg_->states[0].sid.code; - EXPECT_EQ(get_asstates[0].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[0].sid.reserved)), - 0) - << "incorrect value for states[0].sid.reserved, expected 0, is " - << last_msg_->states[0].sid.reserved; - EXPECT_EQ( - get_asstates[0].sid.sat)>( - reinterpret_cast(&last_msg_->states[0].sid.sat)), - 202) - << "incorrect value for states[0].sid.sat, expected 202, is " - << last_msg_->states[0].sid.sat; - EXPECT_EQ(get_asstates[0].state)>( - reinterpret_cast(&last_msg_->states[0].state)), - 1) - << "incorrect value for states[0].state, expected 1, is " - << last_msg_->states[0].state; - EXPECT_LT((last_msg_->states[1].cn0 * 100 - 35.8133163452 * 100), 0.05) - << "incorrect value for states[1].cn0, expected 35.8133163452, is " - << last_msg_->states[1].cn0; - EXPECT_EQ( - get_asstates[1].sid.code)>( - reinterpret_cast(&last_msg_->states[1].sid.code)), - 0) - << "incorrect value for states[1].sid.code, expected 0, is " - << last_msg_->states[1].sid.code; - EXPECT_EQ(get_asstates[1].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[1].sid.reserved)), - 0) - << "incorrect value for states[1].sid.reserved, expected 0, is " - << last_msg_->states[1].sid.reserved; - EXPECT_EQ( - get_asstates[1].sid.sat)>( - reinterpret_cast(&last_msg_->states[1].sid.sat)), - 203) - << "incorrect value for states[1].sid.sat, expected 203, is " - << last_msg_->states[1].sid.sat; - EXPECT_EQ(get_asstates[1].state)>( - reinterpret_cast(&last_msg_->states[1].state)), - 1) - << "incorrect value for states[1].state, expected 1, is " - << last_msg_->states[1].state; - EXPECT_LT((last_msg_->states[2].cn0 * 100 - 37.5539245605 * 100), 0.05) - << "incorrect value for states[2].cn0, expected 37.5539245605, is " - << last_msg_->states[2].cn0; - EXPECT_EQ( - get_asstates[2].sid.code)>( - reinterpret_cast(&last_msg_->states[2].sid.code)), - 0) - << "incorrect value for states[2].sid.code, expected 0, is " - << last_msg_->states[2].sid.code; - EXPECT_EQ(get_asstates[2].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[2].sid.reserved)), - 0) - << "incorrect value for states[2].sid.reserved, expected 0, is " - << last_msg_->states[2].sid.reserved; - EXPECT_EQ( - get_asstates[2].sid.sat)>( - reinterpret_cast(&last_msg_->states[2].sid.sat)), - 208) - << "incorrect value for states[2].sid.sat, expected 208, is " - << last_msg_->states[2].sid.sat; - EXPECT_EQ(get_asstates[2].state)>( - reinterpret_cast(&last_msg_->states[2].state)), - 1) - << "incorrect value for states[2].state, expected 1, is " - << last_msg_->states[2].state; - EXPECT_LT((last_msg_->states[3].cn0 * 100 - 38.8890190125 * 100), 0.05) - << "incorrect value for states[3].cn0, expected 38.8890190125, is " - << last_msg_->states[3].cn0; - EXPECT_EQ( - get_asstates[3].sid.code)>( - reinterpret_cast(&last_msg_->states[3].sid.code)), - 0) - << "incorrect value for states[3].sid.code, expected 0, is " - << last_msg_->states[3].sid.code; - EXPECT_EQ(get_asstates[3].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[3].sid.reserved)), - 0) - << "incorrect value for states[3].sid.reserved, expected 0, is " - << last_msg_->states[3].sid.reserved; - EXPECT_EQ( - get_asstates[3].sid.sat)>( - reinterpret_cast(&last_msg_->states[3].sid.sat)), - 212) - << "incorrect value for states[3].sid.sat, expected 212, is " - << last_msg_->states[3].sid.sat; - EXPECT_EQ(get_asstates[3].state)>( - reinterpret_cast(&last_msg_->states[3].state)), - 1) - << "incorrect value for states[3].state, expected 1, is " - << last_msg_->states[3].state; - EXPECT_LT((last_msg_->states[4].cn0 * 100 - 42.4013557434 * 100), 0.05) - << "incorrect value for states[4].cn0, expected 42.4013557434, is " - << last_msg_->states[4].cn0; - EXPECT_EQ( - get_asstates[4].sid.code)>( - reinterpret_cast(&last_msg_->states[4].sid.code)), - 0) - << "incorrect value for states[4].sid.code, expected 0, is " - << last_msg_->states[4].sid.code; - EXPECT_EQ(get_asstates[4].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[4].sid.reserved)), - 0) - << "incorrect value for states[4].sid.reserved, expected 0, is " - << last_msg_->states[4].sid.reserved; - EXPECT_EQ( - get_asstates[4].sid.sat)>( - reinterpret_cast(&last_msg_->states[4].sid.sat)), - 217) - << "incorrect value for states[4].sid.sat, expected 217, is " - << last_msg_->states[4].sid.sat; - EXPECT_EQ(get_asstates[4].state)>( - reinterpret_cast(&last_msg_->states[4].state)), - 1) - << "incorrect value for states[4].state, expected 1, is " - << last_msg_->states[4].state; - EXPECT_LT((last_msg_->states[5].cn0 * 100 - 37.6391601562 * 100), 0.05) - << "incorrect value for states[5].cn0, expected 37.6391601562, is " - << last_msg_->states[5].cn0; - EXPECT_EQ( - get_asstates[5].sid.code)>( - reinterpret_cast(&last_msg_->states[5].sid.code)), - 0) - << "incorrect value for states[5].sid.code, expected 0, is " - << last_msg_->states[5].sid.code; - EXPECT_EQ(get_asstates[5].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[5].sid.reserved)), - 0) - << "incorrect value for states[5].sid.reserved, expected 0, is " - << last_msg_->states[5].sid.reserved; - EXPECT_EQ( - get_asstates[5].sid.sat)>( - reinterpret_cast(&last_msg_->states[5].sid.sat)), - 218) - << "incorrect value for states[5].sid.sat, expected 218, is " - << last_msg_->states[5].sid.sat; - EXPECT_EQ(get_asstates[5].state)>( - reinterpret_cast(&last_msg_->states[5].state)), - 1) - << "incorrect value for states[5].state, expected 1, is " - << last_msg_->states[5].state; - EXPECT_LT((last_msg_->states[6].cn0 * 100 - 37.9199867249 * 100), 0.05) - << "incorrect value for states[6].cn0, expected 37.9199867249, is " - << last_msg_->states[6].cn0; - EXPECT_EQ( - get_asstates[6].sid.code)>( - reinterpret_cast(&last_msg_->states[6].sid.code)), - 0) - << "incorrect value for states[6].sid.code, expected 0, is " - << last_msg_->states[6].sid.code; - EXPECT_EQ(get_asstates[6].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[6].sid.reserved)), - 0) - << "incorrect value for states[6].sid.reserved, expected 0, is " - << last_msg_->states[6].sid.reserved; - EXPECT_EQ( - get_asstates[6].sid.sat)>( - reinterpret_cast(&last_msg_->states[6].sid.sat)), - 220) - << "incorrect value for states[6].sid.sat, expected 220, is " - << last_msg_->states[6].sid.sat; - EXPECT_EQ(get_asstates[6].state)>( - reinterpret_cast(&last_msg_->states[6].state)), - 1) - << "incorrect value for states[6].state, expected 1, is " - << last_msg_->states[6].state; - EXPECT_LT((last_msg_->states[7].cn0 * 100 - 39.2525444031 * 100), 0.05) - << "incorrect value for states[7].cn0, expected 39.2525444031, is " - << last_msg_->states[7].cn0; - EXPECT_EQ( - get_asstates[7].sid.code)>( - reinterpret_cast(&last_msg_->states[7].sid.code)), - 0) - << "incorrect value for states[7].sid.code, expected 0, is " - << last_msg_->states[7].sid.code; - EXPECT_EQ(get_asstates[7].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[7].sid.reserved)), - 0) - << "incorrect value for states[7].sid.reserved, expected 0, is " - << last_msg_->states[7].sid.reserved; - EXPECT_EQ( - get_asstates[7].sid.sat)>( - reinterpret_cast(&last_msg_->states[7].sid.sat)), - 222) - << "incorrect value for states[7].sid.sat, expected 222, is " - << last_msg_->states[7].sid.sat; - EXPECT_EQ(get_asstates[7].state)>( - reinterpret_cast(&last_msg_->states[7].state)), - 1) - << "incorrect value for states[7].state, expected 1, is " - << last_msg_->states[7].state; - EXPECT_LT((last_msg_->states[8].cn0 * 100 - 42.598274231 * 100), 0.05) - << "incorrect value for states[8].cn0, expected 42.598274231, is " - << last_msg_->states[8].cn0; - EXPECT_EQ( - get_asstates[8].sid.code)>( - reinterpret_cast(&last_msg_->states[8].sid.code)), - 0) - << "incorrect value for states[8].sid.code, expected 0, is " - << last_msg_->states[8].sid.code; - EXPECT_EQ(get_asstates[8].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[8].sid.reserved)), - 0) - << "incorrect value for states[8].sid.reserved, expected 0, is " - << last_msg_->states[8].sid.reserved; - EXPECT_EQ( - get_asstates[8].sid.sat)>( - reinterpret_cast(&last_msg_->states[8].sid.sat)), - 225) - << "incorrect value for states[8].sid.sat, expected 225, is " - << last_msg_->states[8].sid.sat; - EXPECT_EQ(get_asstates[8].state)>( - reinterpret_cast(&last_msg_->states[8].state)), - 1) - << "incorrect value for states[8].state, expected 1, is " - << last_msg_->states[8].state; - EXPECT_LT((last_msg_->states[9].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[9].cn0, expected -1.0, is " - << last_msg_->states[9].cn0; - EXPECT_EQ( - get_asstates[9].sid.code)>( - reinterpret_cast(&last_msg_->states[9].sid.code)), - 0) - << "incorrect value for states[9].sid.code, expected 0, is " - << last_msg_->states[9].sid.code; - EXPECT_EQ(get_asstates[9].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[9].sid.reserved)), - 0) - << "incorrect value for states[9].sid.reserved, expected 0, is " - << last_msg_->states[9].sid.reserved; - EXPECT_EQ( - get_asstates[9].sid.sat)>( - reinterpret_cast(&last_msg_->states[9].sid.sat)), - 0) - << "incorrect value for states[9].sid.sat, expected 0, is " - << last_msg_->states[9].sid.sat; - EXPECT_EQ(get_asstates[9].state)>( - reinterpret_cast(&last_msg_->states[9].state)), - 0) - << "incorrect value for states[9].state, expected 0, is " - << last_msg_->states[9].state; - EXPECT_LT((last_msg_->states[10].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[10].cn0, expected -1.0, is " - << last_msg_->states[10].cn0; - EXPECT_EQ( - get_asstates[10].sid.code)>( - reinterpret_cast(&last_msg_->states[10].sid.code)), - 0) - << "incorrect value for states[10].sid.code, expected 0, is " - << last_msg_->states[10].sid.code; - EXPECT_EQ(get_asstates[10].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[10].sid.reserved)), - 0) - << "incorrect value for states[10].sid.reserved, expected 0, is " - << last_msg_->states[10].sid.reserved; - EXPECT_EQ( - get_asstates[10].sid.sat)>( - reinterpret_cast(&last_msg_->states[10].sid.sat)), - 0) - << "incorrect value for states[10].sid.sat, expected 0, is " - << last_msg_->states[10].sid.sat; - EXPECT_EQ( - get_asstates[10].state)>( - reinterpret_cast(&last_msg_->states[10].state)), - 0) - << "incorrect value for states[10].state, expected 0, is " - << last_msg_->states[10].state; -} -class Test_legacy_auto_check_sbp_tracking_MsgTrackingState4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgTrackingState4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgTrackingState4, Test) { - uint8_t encoded_frame[] = { - 85, 19, 0, 246, 215, 99, 1, 202, 0, 0, 0, 120, 122, 29, - 66, 1, 203, 0, 0, 0, 66, 22, 18, 66, 1, 208, 0, 0, - 0, 153, 163, 24, 66, 1, 212, 0, 0, 0, 178, 204, 28, 66, - 1, 217, 0, 0, 0, 220, 59, 38, 66, 1, 218, 0, 0, 0, - 161, 27, 20, 66, 1, 220, 0, 0, 0, 125, 107, 24, 66, 1, - 222, 0, 0, 0, 242, 46, 28, 66, 1, 225, 0, 0, 0, 231, - 130, 41, 66, 0, 0, 0, 0, 0, 0, 0, 128, 191, 0, 0, - 0, 0, 0, 0, 0, 128, 191, 73, 193, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_dep_b_t *test_msg = - (msg_tracking_state_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[0].cn0 = 39.369598388671875; - test_msg->states[0].sid.code = 0; - test_msg->states[0].sid.reserved = 0; - test_msg->states[0].sid.sat = 202; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[1].cn0 = 36.52173614501953; - test_msg->states[1].sid.code = 0; - test_msg->states[1].sid.reserved = 0; - test_msg->states[1].sid.sat = 203; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[2].cn0 = 38.15976333618164; - test_msg->states[2].sid.code = 0; - test_msg->states[2].sid.reserved = 0; - test_msg->states[2].sid.sat = 208; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[3].cn0 = 39.19989776611328; - test_msg->states[3].sid.code = 0; - test_msg->states[3].sid.reserved = 0; - test_msg->states[3].sid.sat = 212; - test_msg->states[3].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[4].cn0 = 41.55845642089844; - test_msg->states[4].sid.code = 0; - test_msg->states[4].sid.reserved = 0; - test_msg->states[4].sid.sat = 217; - test_msg->states[4].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[5].cn0 = 37.026981353759766; - test_msg->states[5].sid.code = 0; - test_msg->states[5].sid.reserved = 0; - test_msg->states[5].sid.sat = 218; - test_msg->states[5].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[6].cn0 = 38.1049690246582; - test_msg->states[6].sid.code = 0; - test_msg->states[6].sid.reserved = 0; - test_msg->states[6].sid.sat = 220; - test_msg->states[6].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[7].cn0 = 39.04584503173828; - test_msg->states[7].sid.code = 0; - test_msg->states[7].sid.reserved = 0; - test_msg->states[7].sid.sat = 222; - test_msg->states[7].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[8].cn0 = 42.37783432006836; - test_msg->states[8].sid.code = 0; - test_msg->states[8].sid.reserved = 0; - test_msg->states[8].sid.sat = 225; - test_msg->states[8].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[9].cn0 = -1.0; - test_msg->states[9].sid.code = 0; - test_msg->states[9].sid.reserved = 0; - test_msg->states[9].sid.sat = 0; - test_msg->states[9].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[10].cn0 = -1.0; - test_msg->states[10].sid.code = 0; - test_msg->states[10].sid.reserved = 0; - test_msg->states[10].sid.sat = 0; - test_msg->states[10].state = 0; - - EXPECT_EQ(send_message(0x13, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->states[0].cn0 * 100 - 39.3695983887 * 100), 0.05) - << "incorrect value for states[0].cn0, expected 39.3695983887, is " - << last_msg_->states[0].cn0; - EXPECT_EQ( - get_asstates[0].sid.code)>( - reinterpret_cast(&last_msg_->states[0].sid.code)), - 0) - << "incorrect value for states[0].sid.code, expected 0, is " - << last_msg_->states[0].sid.code; - EXPECT_EQ(get_asstates[0].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[0].sid.reserved)), - 0) - << "incorrect value for states[0].sid.reserved, expected 0, is " - << last_msg_->states[0].sid.reserved; - EXPECT_EQ( - get_asstates[0].sid.sat)>( - reinterpret_cast(&last_msg_->states[0].sid.sat)), - 202) - << "incorrect value for states[0].sid.sat, expected 202, is " - << last_msg_->states[0].sid.sat; - EXPECT_EQ(get_asstates[0].state)>( - reinterpret_cast(&last_msg_->states[0].state)), - 1) - << "incorrect value for states[0].state, expected 1, is " - << last_msg_->states[0].state; - EXPECT_LT((last_msg_->states[1].cn0 * 100 - 36.521736145 * 100), 0.05) - << "incorrect value for states[1].cn0, expected 36.521736145, is " - << last_msg_->states[1].cn0; - EXPECT_EQ( - get_asstates[1].sid.code)>( - reinterpret_cast(&last_msg_->states[1].sid.code)), - 0) - << "incorrect value for states[1].sid.code, expected 0, is " - << last_msg_->states[1].sid.code; - EXPECT_EQ(get_asstates[1].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[1].sid.reserved)), - 0) - << "incorrect value for states[1].sid.reserved, expected 0, is " - << last_msg_->states[1].sid.reserved; - EXPECT_EQ( - get_asstates[1].sid.sat)>( - reinterpret_cast(&last_msg_->states[1].sid.sat)), - 203) - << "incorrect value for states[1].sid.sat, expected 203, is " - << last_msg_->states[1].sid.sat; - EXPECT_EQ(get_asstates[1].state)>( - reinterpret_cast(&last_msg_->states[1].state)), - 1) - << "incorrect value for states[1].state, expected 1, is " - << last_msg_->states[1].state; - EXPECT_LT((last_msg_->states[2].cn0 * 100 - 38.1597633362 * 100), 0.05) - << "incorrect value for states[2].cn0, expected 38.1597633362, is " - << last_msg_->states[2].cn0; - EXPECT_EQ( - get_asstates[2].sid.code)>( - reinterpret_cast(&last_msg_->states[2].sid.code)), - 0) - << "incorrect value for states[2].sid.code, expected 0, is " - << last_msg_->states[2].sid.code; - EXPECT_EQ(get_asstates[2].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[2].sid.reserved)), - 0) - << "incorrect value for states[2].sid.reserved, expected 0, is " - << last_msg_->states[2].sid.reserved; - EXPECT_EQ( - get_asstates[2].sid.sat)>( - reinterpret_cast(&last_msg_->states[2].sid.sat)), - 208) - << "incorrect value for states[2].sid.sat, expected 208, is " - << last_msg_->states[2].sid.sat; - EXPECT_EQ(get_asstates[2].state)>( - reinterpret_cast(&last_msg_->states[2].state)), - 1) - << "incorrect value for states[2].state, expected 1, is " - << last_msg_->states[2].state; - EXPECT_LT((last_msg_->states[3].cn0 * 100 - 39.1998977661 * 100), 0.05) - << "incorrect value for states[3].cn0, expected 39.1998977661, is " - << last_msg_->states[3].cn0; - EXPECT_EQ( - get_asstates[3].sid.code)>( - reinterpret_cast(&last_msg_->states[3].sid.code)), - 0) - << "incorrect value for states[3].sid.code, expected 0, is " - << last_msg_->states[3].sid.code; - EXPECT_EQ(get_asstates[3].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[3].sid.reserved)), - 0) - << "incorrect value for states[3].sid.reserved, expected 0, is " - << last_msg_->states[3].sid.reserved; - EXPECT_EQ( - get_asstates[3].sid.sat)>( - reinterpret_cast(&last_msg_->states[3].sid.sat)), - 212) - << "incorrect value for states[3].sid.sat, expected 212, is " - << last_msg_->states[3].sid.sat; - EXPECT_EQ(get_asstates[3].state)>( - reinterpret_cast(&last_msg_->states[3].state)), - 1) - << "incorrect value for states[3].state, expected 1, is " - << last_msg_->states[3].state; - EXPECT_LT((last_msg_->states[4].cn0 * 100 - 41.5584564209 * 100), 0.05) - << "incorrect value for states[4].cn0, expected 41.5584564209, is " - << last_msg_->states[4].cn0; - EXPECT_EQ( - get_asstates[4].sid.code)>( - reinterpret_cast(&last_msg_->states[4].sid.code)), - 0) - << "incorrect value for states[4].sid.code, expected 0, is " - << last_msg_->states[4].sid.code; - EXPECT_EQ(get_asstates[4].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[4].sid.reserved)), - 0) - << "incorrect value for states[4].sid.reserved, expected 0, is " - << last_msg_->states[4].sid.reserved; - EXPECT_EQ( - get_asstates[4].sid.sat)>( - reinterpret_cast(&last_msg_->states[4].sid.sat)), - 217) - << "incorrect value for states[4].sid.sat, expected 217, is " - << last_msg_->states[4].sid.sat; - EXPECT_EQ(get_asstates[4].state)>( - reinterpret_cast(&last_msg_->states[4].state)), - 1) - << "incorrect value for states[4].state, expected 1, is " - << last_msg_->states[4].state; - EXPECT_LT((last_msg_->states[5].cn0 * 100 - 37.0269813538 * 100), 0.05) - << "incorrect value for states[5].cn0, expected 37.0269813538, is " - << last_msg_->states[5].cn0; - EXPECT_EQ( - get_asstates[5].sid.code)>( - reinterpret_cast(&last_msg_->states[5].sid.code)), - 0) - << "incorrect value for states[5].sid.code, expected 0, is " - << last_msg_->states[5].sid.code; - EXPECT_EQ(get_asstates[5].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[5].sid.reserved)), - 0) - << "incorrect value for states[5].sid.reserved, expected 0, is " - << last_msg_->states[5].sid.reserved; - EXPECT_EQ( - get_asstates[5].sid.sat)>( - reinterpret_cast(&last_msg_->states[5].sid.sat)), - 218) - << "incorrect value for states[5].sid.sat, expected 218, is " - << last_msg_->states[5].sid.sat; - EXPECT_EQ(get_asstates[5].state)>( - reinterpret_cast(&last_msg_->states[5].state)), - 1) - << "incorrect value for states[5].state, expected 1, is " - << last_msg_->states[5].state; - EXPECT_LT((last_msg_->states[6].cn0 * 100 - 38.1049690247 * 100), 0.05) - << "incorrect value for states[6].cn0, expected 38.1049690247, is " - << last_msg_->states[6].cn0; - EXPECT_EQ( - get_asstates[6].sid.code)>( - reinterpret_cast(&last_msg_->states[6].sid.code)), - 0) - << "incorrect value for states[6].sid.code, expected 0, is " - << last_msg_->states[6].sid.code; - EXPECT_EQ(get_asstates[6].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[6].sid.reserved)), - 0) - << "incorrect value for states[6].sid.reserved, expected 0, is " - << last_msg_->states[6].sid.reserved; - EXPECT_EQ( - get_asstates[6].sid.sat)>( - reinterpret_cast(&last_msg_->states[6].sid.sat)), - 220) - << "incorrect value for states[6].sid.sat, expected 220, is " - << last_msg_->states[6].sid.sat; - EXPECT_EQ(get_asstates[6].state)>( - reinterpret_cast(&last_msg_->states[6].state)), - 1) - << "incorrect value for states[6].state, expected 1, is " - << last_msg_->states[6].state; - EXPECT_LT((last_msg_->states[7].cn0 * 100 - 39.0458450317 * 100), 0.05) - << "incorrect value for states[7].cn0, expected 39.0458450317, is " - << last_msg_->states[7].cn0; - EXPECT_EQ( - get_asstates[7].sid.code)>( - reinterpret_cast(&last_msg_->states[7].sid.code)), - 0) - << "incorrect value for states[7].sid.code, expected 0, is " - << last_msg_->states[7].sid.code; - EXPECT_EQ(get_asstates[7].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[7].sid.reserved)), - 0) - << "incorrect value for states[7].sid.reserved, expected 0, is " - << last_msg_->states[7].sid.reserved; - EXPECT_EQ( - get_asstates[7].sid.sat)>( - reinterpret_cast(&last_msg_->states[7].sid.sat)), - 222) - << "incorrect value for states[7].sid.sat, expected 222, is " - << last_msg_->states[7].sid.sat; - EXPECT_EQ(get_asstates[7].state)>( - reinterpret_cast(&last_msg_->states[7].state)), - 1) - << "incorrect value for states[7].state, expected 1, is " - << last_msg_->states[7].state; - EXPECT_LT((last_msg_->states[8].cn0 * 100 - 42.3778343201 * 100), 0.05) - << "incorrect value for states[8].cn0, expected 42.3778343201, is " - << last_msg_->states[8].cn0; - EXPECT_EQ( - get_asstates[8].sid.code)>( - reinterpret_cast(&last_msg_->states[8].sid.code)), - 0) - << "incorrect value for states[8].sid.code, expected 0, is " - << last_msg_->states[8].sid.code; - EXPECT_EQ(get_asstates[8].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[8].sid.reserved)), - 0) - << "incorrect value for states[8].sid.reserved, expected 0, is " - << last_msg_->states[8].sid.reserved; - EXPECT_EQ( - get_asstates[8].sid.sat)>( - reinterpret_cast(&last_msg_->states[8].sid.sat)), - 225) - << "incorrect value for states[8].sid.sat, expected 225, is " - << last_msg_->states[8].sid.sat; - EXPECT_EQ(get_asstates[8].state)>( - reinterpret_cast(&last_msg_->states[8].state)), - 1) - << "incorrect value for states[8].state, expected 1, is " - << last_msg_->states[8].state; - EXPECT_LT((last_msg_->states[9].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[9].cn0, expected -1.0, is " - << last_msg_->states[9].cn0; - EXPECT_EQ( - get_asstates[9].sid.code)>( - reinterpret_cast(&last_msg_->states[9].sid.code)), - 0) - << "incorrect value for states[9].sid.code, expected 0, is " - << last_msg_->states[9].sid.code; - EXPECT_EQ(get_asstates[9].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[9].sid.reserved)), - 0) - << "incorrect value for states[9].sid.reserved, expected 0, is " - << last_msg_->states[9].sid.reserved; - EXPECT_EQ( - get_asstates[9].sid.sat)>( - reinterpret_cast(&last_msg_->states[9].sid.sat)), - 0) - << "incorrect value for states[9].sid.sat, expected 0, is " - << last_msg_->states[9].sid.sat; - EXPECT_EQ(get_asstates[9].state)>( - reinterpret_cast(&last_msg_->states[9].state)), - 0) - << "incorrect value for states[9].state, expected 0, is " - << last_msg_->states[9].state; - EXPECT_LT((last_msg_->states[10].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[10].cn0, expected -1.0, is " - << last_msg_->states[10].cn0; - EXPECT_EQ( - get_asstates[10].sid.code)>( - reinterpret_cast(&last_msg_->states[10].sid.code)), - 0) - << "incorrect value for states[10].sid.code, expected 0, is " - << last_msg_->states[10].sid.code; - EXPECT_EQ(get_asstates[10].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[10].sid.reserved)), - 0) - << "incorrect value for states[10].sid.reserved, expected 0, is " - << last_msg_->states[10].sid.reserved; - EXPECT_EQ( - get_asstates[10].sid.sat)>( - reinterpret_cast(&last_msg_->states[10].sid.sat)), - 0) - << "incorrect value for states[10].sid.sat, expected 0, is " - << last_msg_->states[10].sid.sat; - EXPECT_EQ( - get_asstates[10].state)>( - reinterpret_cast(&last_msg_->states[10].state)), - 0) - << "incorrect value for states[10].state, expected 0, is " - << last_msg_->states[10].state; -} -class Test_legacy_auto_check_sbp_tracking_MsgTrackingState5 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgTrackingState5() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgTrackingState5, Test) { - uint8_t encoded_frame[] = { - 85, 19, 0, 246, 215, 99, 1, 202, 0, 0, 0, 103, 208, 30, - 66, 1, 203, 0, 0, 0, 117, 24, 18, 66, 1, 208, 0, 0, - 0, 200, 173, 20, 66, 1, 212, 0, 0, 0, 137, 68, 27, 66, - 1, 217, 0, 0, 0, 243, 51, 40, 66, 1, 218, 0, 0, 0, - 225, 58, 23, 66, 1, 220, 0, 0, 0, 132, 221, 22, 66, 1, - 222, 0, 0, 0, 157, 29, 26, 66, 1, 225, 0, 0, 0, 133, - 21, 41, 66, 0, 0, 0, 0, 0, 0, 0, 128, 191, 0, 0, - 0, 0, 0, 0, 0, 128, 191, 126, 47, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_dep_b_t *test_msg = - (msg_tracking_state_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[0].cn0 = 39.70351791381836; - test_msg->states[0].sid.code = 0; - test_msg->states[0].sid.reserved = 0; - test_msg->states[0].sid.sat = 202; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[1].cn0 = 36.52388381958008; - test_msg->states[1].sid.code = 0; - test_msg->states[1].sid.reserved = 0; - test_msg->states[1].sid.sat = 203; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[2].cn0 = 37.169708251953125; - test_msg->states[2].sid.code = 0; - test_msg->states[2].sid.reserved = 0; - test_msg->states[2].sid.sat = 208; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[3].cn0 = 38.81692886352539; - test_msg->states[3].sid.code = 0; - test_msg->states[3].sid.reserved = 0; - test_msg->states[3].sid.sat = 212; - test_msg->states[3].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[4].cn0 = 42.05073165893555; - test_msg->states[4].sid.code = 0; - test_msg->states[4].sid.reserved = 0; - test_msg->states[4].sid.sat = 217; - test_msg->states[4].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[5].cn0 = 37.807498931884766; - test_msg->states[5].sid.code = 0; - test_msg->states[5].sid.reserved = 0; - test_msg->states[5].sid.sat = 218; - test_msg->states[5].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[6].cn0 = 37.71632385253906; - test_msg->states[6].sid.code = 0; - test_msg->states[6].sid.reserved = 0; - test_msg->states[6].sid.sat = 220; - test_msg->states[6].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[7].cn0 = 38.5289192199707; - test_msg->states[7].sid.code = 0; - test_msg->states[7].sid.reserved = 0; - test_msg->states[7].sid.sat = 222; - test_msg->states[7].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[8].cn0 = 42.27101516723633; - test_msg->states[8].sid.code = 0; - test_msg->states[8].sid.reserved = 0; - test_msg->states[8].sid.sat = 225; - test_msg->states[8].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[9].cn0 = -1.0; - test_msg->states[9].sid.code = 0; - test_msg->states[9].sid.reserved = 0; - test_msg->states[9].sid.sat = 0; - test_msg->states[9].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[10].cn0 = -1.0; - test_msg->states[10].sid.code = 0; - test_msg->states[10].sid.reserved = 0; - test_msg->states[10].sid.sat = 0; - test_msg->states[10].state = 0; - - EXPECT_EQ(send_message(0x13, 55286, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 55286); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->states[0].cn0 * 100 - 39.7035179138 * 100), 0.05) - << "incorrect value for states[0].cn0, expected 39.7035179138, is " - << last_msg_->states[0].cn0; - EXPECT_EQ( - get_asstates[0].sid.code)>( - reinterpret_cast(&last_msg_->states[0].sid.code)), - 0) - << "incorrect value for states[0].sid.code, expected 0, is " - << last_msg_->states[0].sid.code; - EXPECT_EQ(get_asstates[0].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[0].sid.reserved)), - 0) - << "incorrect value for states[0].sid.reserved, expected 0, is " - << last_msg_->states[0].sid.reserved; - EXPECT_EQ( - get_asstates[0].sid.sat)>( - reinterpret_cast(&last_msg_->states[0].sid.sat)), - 202) - << "incorrect value for states[0].sid.sat, expected 202, is " - << last_msg_->states[0].sid.sat; - EXPECT_EQ(get_asstates[0].state)>( - reinterpret_cast(&last_msg_->states[0].state)), - 1) - << "incorrect value for states[0].state, expected 1, is " - << last_msg_->states[0].state; - EXPECT_LT((last_msg_->states[1].cn0 * 100 - 36.5238838196 * 100), 0.05) - << "incorrect value for states[1].cn0, expected 36.5238838196, is " - << last_msg_->states[1].cn0; - EXPECT_EQ( - get_asstates[1].sid.code)>( - reinterpret_cast(&last_msg_->states[1].sid.code)), - 0) - << "incorrect value for states[1].sid.code, expected 0, is " - << last_msg_->states[1].sid.code; - EXPECT_EQ(get_asstates[1].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[1].sid.reserved)), - 0) - << "incorrect value for states[1].sid.reserved, expected 0, is " - << last_msg_->states[1].sid.reserved; - EXPECT_EQ( - get_asstates[1].sid.sat)>( - reinterpret_cast(&last_msg_->states[1].sid.sat)), - 203) - << "incorrect value for states[1].sid.sat, expected 203, is " - << last_msg_->states[1].sid.sat; - EXPECT_EQ(get_asstates[1].state)>( - reinterpret_cast(&last_msg_->states[1].state)), - 1) - << "incorrect value for states[1].state, expected 1, is " - << last_msg_->states[1].state; - EXPECT_LT((last_msg_->states[2].cn0 * 100 - 37.169708252 * 100), 0.05) - << "incorrect value for states[2].cn0, expected 37.169708252, is " - << last_msg_->states[2].cn0; - EXPECT_EQ( - get_asstates[2].sid.code)>( - reinterpret_cast(&last_msg_->states[2].sid.code)), - 0) - << "incorrect value for states[2].sid.code, expected 0, is " - << last_msg_->states[2].sid.code; - EXPECT_EQ(get_asstates[2].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[2].sid.reserved)), - 0) - << "incorrect value for states[2].sid.reserved, expected 0, is " - << last_msg_->states[2].sid.reserved; - EXPECT_EQ( - get_asstates[2].sid.sat)>( - reinterpret_cast(&last_msg_->states[2].sid.sat)), - 208) - << "incorrect value for states[2].sid.sat, expected 208, is " - << last_msg_->states[2].sid.sat; - EXPECT_EQ(get_asstates[2].state)>( - reinterpret_cast(&last_msg_->states[2].state)), - 1) - << "incorrect value for states[2].state, expected 1, is " - << last_msg_->states[2].state; - EXPECT_LT((last_msg_->states[3].cn0 * 100 - 38.8169288635 * 100), 0.05) - << "incorrect value for states[3].cn0, expected 38.8169288635, is " - << last_msg_->states[3].cn0; - EXPECT_EQ( - get_asstates[3].sid.code)>( - reinterpret_cast(&last_msg_->states[3].sid.code)), - 0) - << "incorrect value for states[3].sid.code, expected 0, is " - << last_msg_->states[3].sid.code; - EXPECT_EQ(get_asstates[3].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[3].sid.reserved)), - 0) - << "incorrect value for states[3].sid.reserved, expected 0, is " - << last_msg_->states[3].sid.reserved; - EXPECT_EQ( - get_asstates[3].sid.sat)>( - reinterpret_cast(&last_msg_->states[3].sid.sat)), - 212) - << "incorrect value for states[3].sid.sat, expected 212, is " - << last_msg_->states[3].sid.sat; - EXPECT_EQ(get_asstates[3].state)>( - reinterpret_cast(&last_msg_->states[3].state)), - 1) - << "incorrect value for states[3].state, expected 1, is " - << last_msg_->states[3].state; - EXPECT_LT((last_msg_->states[4].cn0 * 100 - 42.0507316589 * 100), 0.05) - << "incorrect value for states[4].cn0, expected 42.0507316589, is " - << last_msg_->states[4].cn0; - EXPECT_EQ( - get_asstates[4].sid.code)>( - reinterpret_cast(&last_msg_->states[4].sid.code)), - 0) - << "incorrect value for states[4].sid.code, expected 0, is " - << last_msg_->states[4].sid.code; - EXPECT_EQ(get_asstates[4].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[4].sid.reserved)), - 0) - << "incorrect value for states[4].sid.reserved, expected 0, is " - << last_msg_->states[4].sid.reserved; - EXPECT_EQ( - get_asstates[4].sid.sat)>( - reinterpret_cast(&last_msg_->states[4].sid.sat)), - 217) - << "incorrect value for states[4].sid.sat, expected 217, is " - << last_msg_->states[4].sid.sat; - EXPECT_EQ(get_asstates[4].state)>( - reinterpret_cast(&last_msg_->states[4].state)), - 1) - << "incorrect value for states[4].state, expected 1, is " - << last_msg_->states[4].state; - EXPECT_LT((last_msg_->states[5].cn0 * 100 - 37.8074989319 * 100), 0.05) - << "incorrect value for states[5].cn0, expected 37.8074989319, is " - << last_msg_->states[5].cn0; - EXPECT_EQ( - get_asstates[5].sid.code)>( - reinterpret_cast(&last_msg_->states[5].sid.code)), - 0) - << "incorrect value for states[5].sid.code, expected 0, is " - << last_msg_->states[5].sid.code; - EXPECT_EQ(get_asstates[5].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[5].sid.reserved)), - 0) - << "incorrect value for states[5].sid.reserved, expected 0, is " - << last_msg_->states[5].sid.reserved; - EXPECT_EQ( - get_asstates[5].sid.sat)>( - reinterpret_cast(&last_msg_->states[5].sid.sat)), - 218) - << "incorrect value for states[5].sid.sat, expected 218, is " - << last_msg_->states[5].sid.sat; - EXPECT_EQ(get_asstates[5].state)>( - reinterpret_cast(&last_msg_->states[5].state)), - 1) - << "incorrect value for states[5].state, expected 1, is " - << last_msg_->states[5].state; - EXPECT_LT((last_msg_->states[6].cn0 * 100 - 37.7163238525 * 100), 0.05) - << "incorrect value for states[6].cn0, expected 37.7163238525, is " - << last_msg_->states[6].cn0; - EXPECT_EQ( - get_asstates[6].sid.code)>( - reinterpret_cast(&last_msg_->states[6].sid.code)), - 0) - << "incorrect value for states[6].sid.code, expected 0, is " - << last_msg_->states[6].sid.code; - EXPECT_EQ(get_asstates[6].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[6].sid.reserved)), - 0) - << "incorrect value for states[6].sid.reserved, expected 0, is " - << last_msg_->states[6].sid.reserved; - EXPECT_EQ( - get_asstates[6].sid.sat)>( - reinterpret_cast(&last_msg_->states[6].sid.sat)), - 220) - << "incorrect value for states[6].sid.sat, expected 220, is " - << last_msg_->states[6].sid.sat; - EXPECT_EQ(get_asstates[6].state)>( - reinterpret_cast(&last_msg_->states[6].state)), - 1) - << "incorrect value for states[6].state, expected 1, is " - << last_msg_->states[6].state; - EXPECT_LT((last_msg_->states[7].cn0 * 100 - 38.52891922 * 100), 0.05) - << "incorrect value for states[7].cn0, expected 38.52891922, is " - << last_msg_->states[7].cn0; - EXPECT_EQ( - get_asstates[7].sid.code)>( - reinterpret_cast(&last_msg_->states[7].sid.code)), - 0) - << "incorrect value for states[7].sid.code, expected 0, is " - << last_msg_->states[7].sid.code; - EXPECT_EQ(get_asstates[7].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[7].sid.reserved)), - 0) - << "incorrect value for states[7].sid.reserved, expected 0, is " - << last_msg_->states[7].sid.reserved; - EXPECT_EQ( - get_asstates[7].sid.sat)>( - reinterpret_cast(&last_msg_->states[7].sid.sat)), - 222) - << "incorrect value for states[7].sid.sat, expected 222, is " - << last_msg_->states[7].sid.sat; - EXPECT_EQ(get_asstates[7].state)>( - reinterpret_cast(&last_msg_->states[7].state)), - 1) - << "incorrect value for states[7].state, expected 1, is " - << last_msg_->states[7].state; - EXPECT_LT((last_msg_->states[8].cn0 * 100 - 42.2710151672 * 100), 0.05) - << "incorrect value for states[8].cn0, expected 42.2710151672, is " - << last_msg_->states[8].cn0; - EXPECT_EQ( - get_asstates[8].sid.code)>( - reinterpret_cast(&last_msg_->states[8].sid.code)), - 0) - << "incorrect value for states[8].sid.code, expected 0, is " - << last_msg_->states[8].sid.code; - EXPECT_EQ(get_asstates[8].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[8].sid.reserved)), - 0) - << "incorrect value for states[8].sid.reserved, expected 0, is " - << last_msg_->states[8].sid.reserved; - EXPECT_EQ( - get_asstates[8].sid.sat)>( - reinterpret_cast(&last_msg_->states[8].sid.sat)), - 225) - << "incorrect value for states[8].sid.sat, expected 225, is " - << last_msg_->states[8].sid.sat; - EXPECT_EQ(get_asstates[8].state)>( - reinterpret_cast(&last_msg_->states[8].state)), - 1) - << "incorrect value for states[8].state, expected 1, is " - << last_msg_->states[8].state; - EXPECT_LT((last_msg_->states[9].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[9].cn0, expected -1.0, is " - << last_msg_->states[9].cn0; - EXPECT_EQ( - get_asstates[9].sid.code)>( - reinterpret_cast(&last_msg_->states[9].sid.code)), - 0) - << "incorrect value for states[9].sid.code, expected 0, is " - << last_msg_->states[9].sid.code; - EXPECT_EQ(get_asstates[9].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[9].sid.reserved)), - 0) - << "incorrect value for states[9].sid.reserved, expected 0, is " - << last_msg_->states[9].sid.reserved; - EXPECT_EQ( - get_asstates[9].sid.sat)>( - reinterpret_cast(&last_msg_->states[9].sid.sat)), - 0) - << "incorrect value for states[9].sid.sat, expected 0, is " - << last_msg_->states[9].sid.sat; - EXPECT_EQ(get_asstates[9].state)>( - reinterpret_cast(&last_msg_->states[9].state)), - 0) - << "incorrect value for states[9].state, expected 0, is " - << last_msg_->states[9].state; - EXPECT_LT((last_msg_->states[10].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[10].cn0, expected -1.0, is " - << last_msg_->states[10].cn0; - EXPECT_EQ( - get_asstates[10].sid.code)>( - reinterpret_cast(&last_msg_->states[10].sid.code)), - 0) - << "incorrect value for states[10].sid.code, expected 0, is " - << last_msg_->states[10].sid.code; - EXPECT_EQ(get_asstates[10].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[10].sid.reserved)), - 0) - << "incorrect value for states[10].sid.reserved, expected 0, is " - << last_msg_->states[10].sid.reserved; - EXPECT_EQ( - get_asstates[10].sid.sat)>( - reinterpret_cast(&last_msg_->states[10].sid.sat)), - 0) - << "incorrect value for states[10].sid.sat, expected 0, is " - << last_msg_->states[10].sid.sat; - EXPECT_EQ( - get_asstates[10].state)>( - reinterpret_cast(&last_msg_->states[10].state)), - 0) - << "incorrect value for states[10].state, expected 0, is " - << last_msg_->states[10].state; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingStateDepB.cc b/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingStateDepB.cc deleted file mode 100644 index 56bbdd64af..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingStateDepB.cc +++ /dev/null @@ -1,1136 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgTrackingStateDepB.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDepB0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDepB0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_dep_b_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_dep_b_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDepB0, Test) { - uint8_t encoded_frame[] = { - 85, 19, 0, 242, 241, 252, 115, 183, 227, 63, 68, 154, 1, 183, 69, - 255, 175, 121, 43, 222, 51, 67, 35, 69, 78, 240, 5, 53, 20, 51, - 211, 54, 69, 153, 130, 237, 66, 155, 51, 227, 71, 69, 53, 242, 136, - 161, 190, 205, 188, 6, 70, 153, 125, 255, 142, 149, 154, 217, 184, 69, - 248, 102, 95, 31, 76, 154, 33, 169, 69, 131, 115, 141, 27, 12, 154, - 225, 200, 69, 208, 44, 147, 39, 23, 51, 3, 66, 69, 237, 159, 251, - 49, 203, 51, 99, 102, 69, 70, 214, 87, 128, 206, 154, 121, 186, 69, - 14, 206, 111, 218, 19, 154, 121, 169, 69, 216, 98, 209, 54, 2, 154, - 25, 219, 67, 200, 133, 99, 7, 34, 102, 198, 232, 68, 155, 43, 85, - 135, 46, 154, 177, 170, 69, 155, 3, 83, 171, 201, 154, 241, 232, 69, - 121, 43, 197, 16, 19, 154, 241, 222, 69, 128, 245, 53, 63, 176, 51, - 115, 66, 69, 36, 20, 61, 153, 51, 154, 73, 134, 69, 46, 82, 116, - 140, 22, 51, 147, 37, 69, 177, 67, 146, 96, 143, 205, 76, 107, 68, - 220, 51, 160, 201, 251, 102, 102, 192, 68, 168, 194, 2, 161, 220, 102, - 102, 180, 68, 69, 8, 9, 125, 178, 102, 70, 134, 68, 185, 20, 135, - 186, 171, 51, 163, 4, 69, 18, 124, 155, 85, 170, 205, 208, 13, 70, - 57, 244, 206, 255, 186, 154, 105, 149, 69, 165, 199, 93, 181, 175, 51, - 67, 64, 69, 6, 28, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_dep_b_t *test_msg = - (msg_tracking_state_dep_b_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[0].cn0 = 5856.2001953125; - test_msg->states[0].sid.code = 63; - test_msg->states[0].sid.reserved = 68; - test_msg->states[0].sid.sat = 58295; - test_msg->states[0].state = 115; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[1].cn0 = 2612.199951171875; - test_msg->states[1].sid.code = 43; - test_msg->states[1].sid.reserved = 222; - test_msg->states[1].sid.sat = 31151; - test_msg->states[1].state = 255; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[2].cn0 = 2925.199951171875; - test_msg->states[2].sid.code = 53; - test_msg->states[2].sid.reserved = 20; - test_msg->states[2].sid.sat = 1520; - test_msg->states[2].state = 78; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[3].cn0 = 3198.199951171875; - test_msg->states[3].sid.code = 66; - test_msg->states[3].sid.reserved = 155; - test_msg->states[3].sid.sat = 60802; - test_msg->states[3].state = 153; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[4].cn0 = 8623.2001953125; - test_msg->states[4].sid.code = 161; - test_msg->states[4].sid.reserved = 190; - test_msg->states[4].sid.sat = 35058; - test_msg->states[4].state = 53; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[5].cn0 = 5915.2001953125; - test_msg->states[5].sid.code = 142; - test_msg->states[5].sid.reserved = 149; - test_msg->states[5].sid.sat = 65405; - test_msg->states[5].state = 153; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[6].cn0 = 5412.2001953125; - test_msg->states[6].sid.code = 31; - test_msg->states[6].sid.reserved = 76; - test_msg->states[6].sid.sat = 24422; - test_msg->states[6].state = 248; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[7].cn0 = 6428.2001953125; - test_msg->states[7].sid.code = 27; - test_msg->states[7].sid.reserved = 12; - test_msg->states[7].sid.sat = 36211; - test_msg->states[7].state = 131; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[8].cn0 = 3104.199951171875; - test_msg->states[8].sid.code = 39; - test_msg->states[8].sid.reserved = 23; - test_msg->states[8].sid.sat = 37676; - test_msg->states[8].state = 208; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[9].cn0 = 3686.199951171875; - test_msg->states[9].sid.code = 49; - test_msg->states[9].sid.reserved = 203; - test_msg->states[9].sid.sat = 64415; - test_msg->states[9].state = 237; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[10].cn0 = 5967.2001953125; - test_msg->states[10].sid.code = 128; - test_msg->states[10].sid.reserved = 206; - test_msg->states[10].sid.sat = 22486; - test_msg->states[10].state = 70; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[11].cn0 = 5423.2001953125; - test_msg->states[11].sid.code = 218; - test_msg->states[11].sid.reserved = 19; - test_msg->states[11].sid.sat = 28622; - test_msg->states[11].state = 14; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[12].cn0 = 438.20001220703125; - test_msg->states[12].sid.code = 54; - test_msg->states[12].sid.reserved = 2; - test_msg->states[12].sid.sat = 53602; - test_msg->states[12].state = 216; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[13].cn0 = 1862.199951171875; - test_msg->states[13].sid.code = 7; - test_msg->states[13].sid.reserved = 34; - test_msg->states[13].sid.sat = 25477; - test_msg->states[13].state = 200; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[14].cn0 = 5462.2001953125; - test_msg->states[14].sid.code = 135; - test_msg->states[14].sid.reserved = 46; - test_msg->states[14].sid.sat = 21803; - test_msg->states[14].state = 155; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[15].cn0 = 7454.2001953125; - test_msg->states[15].sid.code = 171; - test_msg->states[15].sid.reserved = 201; - test_msg->states[15].sid.sat = 21251; - test_msg->states[15].state = 155; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[16].cn0 = 7134.2001953125; - test_msg->states[16].sid.code = 16; - test_msg->states[16].sid.reserved = 19; - test_msg->states[16].sid.sat = 50475; - test_msg->states[16].state = 121; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[17].cn0 = 3111.199951171875; - test_msg->states[17].sid.code = 63; - test_msg->states[17].sid.reserved = 176; - test_msg->states[17].sid.sat = 13813; - test_msg->states[17].state = 128; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[18].cn0 = 4297.2001953125; - test_msg->states[18].sid.code = 153; - test_msg->states[18].sid.reserved = 51; - test_msg->states[18].sid.sat = 15636; - test_msg->states[18].state = 36; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[19].cn0 = 2649.199951171875; - test_msg->states[19].sid.code = 140; - test_msg->states[19].sid.reserved = 22; - test_msg->states[19].sid.sat = 29778; - test_msg->states[19].state = 46; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[20].cn0 = 941.2000122070312; - test_msg->states[20].sid.code = 96; - test_msg->states[20].sid.reserved = 143; - test_msg->states[20].sid.sat = 37443; - test_msg->states[20].state = 177; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[21].cn0 = 1539.199951171875; - test_msg->states[21].sid.code = 201; - test_msg->states[21].sid.reserved = 251; - test_msg->states[21].sid.sat = 41011; - test_msg->states[21].state = 220; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[22].cn0 = 1443.199951171875; - test_msg->states[22].sid.code = 161; - test_msg->states[22].sid.reserved = 220; - test_msg->states[22].sid.sat = 706; - test_msg->states[22].state = 168; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[23].cn0 = 1074.199951171875; - test_msg->states[23].sid.code = 125; - test_msg->states[23].sid.reserved = 178; - test_msg->states[23].sid.sat = 2312; - test_msg->states[23].state = 69; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[24].cn0 = 2122.199951171875; - test_msg->states[24].sid.code = 186; - test_msg->states[24].sid.reserved = 171; - test_msg->states[24].sid.sat = 34580; - test_msg->states[24].state = 185; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[25].cn0 = 9076.2001953125; - test_msg->states[25].sid.code = 85; - test_msg->states[25].sid.reserved = 170; - test_msg->states[25].sid.sat = 39804; - test_msg->states[25].state = 18; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[26].cn0 = 4781.2001953125; - test_msg->states[26].sid.code = 255; - test_msg->states[26].sid.reserved = 186; - test_msg->states[26].sid.sat = 52980; - test_msg->states[26].state = 57; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[27].cn0 = 3076.199951171875; - test_msg->states[27].sid.code = 181; - test_msg->states[27].sid.reserved = 175; - test_msg->states[27].sid.sat = 24007; - test_msg->states[27].state = 165; - - EXPECT_EQ(send_message(0x13, 61938, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 61938); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->states[0].cn0 * 100 - 5856.20019531 * 100), 0.05) - << "incorrect value for states[0].cn0, expected 5856.20019531, is " - << last_msg_->states[0].cn0; - EXPECT_EQ( - get_asstates[0].sid.code)>( - reinterpret_cast(&last_msg_->states[0].sid.code)), - 63) - << "incorrect value for states[0].sid.code, expected 63, is " - << last_msg_->states[0].sid.code; - EXPECT_EQ(get_asstates[0].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[0].sid.reserved)), - 68) - << "incorrect value for states[0].sid.reserved, expected 68, is " - << last_msg_->states[0].sid.reserved; - EXPECT_EQ( - get_asstates[0].sid.sat)>( - reinterpret_cast(&last_msg_->states[0].sid.sat)), - 58295) - << "incorrect value for states[0].sid.sat, expected 58295, is " - << last_msg_->states[0].sid.sat; - EXPECT_EQ(get_asstates[0].state)>( - reinterpret_cast(&last_msg_->states[0].state)), - 115) - << "incorrect value for states[0].state, expected 115, is " - << last_msg_->states[0].state; - EXPECT_LT((last_msg_->states[1].cn0 * 100 - 2612.19995117 * 100), 0.05) - << "incorrect value for states[1].cn0, expected 2612.19995117, is " - << last_msg_->states[1].cn0; - EXPECT_EQ( - get_asstates[1].sid.code)>( - reinterpret_cast(&last_msg_->states[1].sid.code)), - 43) - << "incorrect value for states[1].sid.code, expected 43, is " - << last_msg_->states[1].sid.code; - EXPECT_EQ(get_asstates[1].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[1].sid.reserved)), - 222) - << "incorrect value for states[1].sid.reserved, expected 222, is " - << last_msg_->states[1].sid.reserved; - EXPECT_EQ( - get_asstates[1].sid.sat)>( - reinterpret_cast(&last_msg_->states[1].sid.sat)), - 31151) - << "incorrect value for states[1].sid.sat, expected 31151, is " - << last_msg_->states[1].sid.sat; - EXPECT_EQ(get_asstates[1].state)>( - reinterpret_cast(&last_msg_->states[1].state)), - 255) - << "incorrect value for states[1].state, expected 255, is " - << last_msg_->states[1].state; - EXPECT_LT((last_msg_->states[2].cn0 * 100 - 2925.19995117 * 100), 0.05) - << "incorrect value for states[2].cn0, expected 2925.19995117, is " - << last_msg_->states[2].cn0; - EXPECT_EQ( - get_asstates[2].sid.code)>( - reinterpret_cast(&last_msg_->states[2].sid.code)), - 53) - << "incorrect value for states[2].sid.code, expected 53, is " - << last_msg_->states[2].sid.code; - EXPECT_EQ(get_asstates[2].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[2].sid.reserved)), - 20) - << "incorrect value for states[2].sid.reserved, expected 20, is " - << last_msg_->states[2].sid.reserved; - EXPECT_EQ( - get_asstates[2].sid.sat)>( - reinterpret_cast(&last_msg_->states[2].sid.sat)), - 1520) - << "incorrect value for states[2].sid.sat, expected 1520, is " - << last_msg_->states[2].sid.sat; - EXPECT_EQ(get_asstates[2].state)>( - reinterpret_cast(&last_msg_->states[2].state)), - 78) - << "incorrect value for states[2].state, expected 78, is " - << last_msg_->states[2].state; - EXPECT_LT((last_msg_->states[3].cn0 * 100 - 3198.19995117 * 100), 0.05) - << "incorrect value for states[3].cn0, expected 3198.19995117, is " - << last_msg_->states[3].cn0; - EXPECT_EQ( - get_asstates[3].sid.code)>( - reinterpret_cast(&last_msg_->states[3].sid.code)), - 66) - << "incorrect value for states[3].sid.code, expected 66, is " - << last_msg_->states[3].sid.code; - EXPECT_EQ(get_asstates[3].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[3].sid.reserved)), - 155) - << "incorrect value for states[3].sid.reserved, expected 155, is " - << last_msg_->states[3].sid.reserved; - EXPECT_EQ( - get_asstates[3].sid.sat)>( - reinterpret_cast(&last_msg_->states[3].sid.sat)), - 60802) - << "incorrect value for states[3].sid.sat, expected 60802, is " - << last_msg_->states[3].sid.sat; - EXPECT_EQ(get_asstates[3].state)>( - reinterpret_cast(&last_msg_->states[3].state)), - 153) - << "incorrect value for states[3].state, expected 153, is " - << last_msg_->states[3].state; - EXPECT_LT((last_msg_->states[4].cn0 * 100 - 8623.20019531 * 100), 0.05) - << "incorrect value for states[4].cn0, expected 8623.20019531, is " - << last_msg_->states[4].cn0; - EXPECT_EQ( - get_asstates[4].sid.code)>( - reinterpret_cast(&last_msg_->states[4].sid.code)), - 161) - << "incorrect value for states[4].sid.code, expected 161, is " - << last_msg_->states[4].sid.code; - EXPECT_EQ(get_asstates[4].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[4].sid.reserved)), - 190) - << "incorrect value for states[4].sid.reserved, expected 190, is " - << last_msg_->states[4].sid.reserved; - EXPECT_EQ( - get_asstates[4].sid.sat)>( - reinterpret_cast(&last_msg_->states[4].sid.sat)), - 35058) - << "incorrect value for states[4].sid.sat, expected 35058, is " - << last_msg_->states[4].sid.sat; - EXPECT_EQ(get_asstates[4].state)>( - reinterpret_cast(&last_msg_->states[4].state)), - 53) - << "incorrect value for states[4].state, expected 53, is " - << last_msg_->states[4].state; - EXPECT_LT((last_msg_->states[5].cn0 * 100 - 5915.20019531 * 100), 0.05) - << "incorrect value for states[5].cn0, expected 5915.20019531, is " - << last_msg_->states[5].cn0; - EXPECT_EQ( - get_asstates[5].sid.code)>( - reinterpret_cast(&last_msg_->states[5].sid.code)), - 142) - << "incorrect value for states[5].sid.code, expected 142, is " - << last_msg_->states[5].sid.code; - EXPECT_EQ(get_asstates[5].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[5].sid.reserved)), - 149) - << "incorrect value for states[5].sid.reserved, expected 149, is " - << last_msg_->states[5].sid.reserved; - EXPECT_EQ( - get_asstates[5].sid.sat)>( - reinterpret_cast(&last_msg_->states[5].sid.sat)), - 65405) - << "incorrect value for states[5].sid.sat, expected 65405, is " - << last_msg_->states[5].sid.sat; - EXPECT_EQ(get_asstates[5].state)>( - reinterpret_cast(&last_msg_->states[5].state)), - 153) - << "incorrect value for states[5].state, expected 153, is " - << last_msg_->states[5].state; - EXPECT_LT((last_msg_->states[6].cn0 * 100 - 5412.20019531 * 100), 0.05) - << "incorrect value for states[6].cn0, expected 5412.20019531, is " - << last_msg_->states[6].cn0; - EXPECT_EQ( - get_asstates[6].sid.code)>( - reinterpret_cast(&last_msg_->states[6].sid.code)), - 31) - << "incorrect value for states[6].sid.code, expected 31, is " - << last_msg_->states[6].sid.code; - EXPECT_EQ(get_asstates[6].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[6].sid.reserved)), - 76) - << "incorrect value for states[6].sid.reserved, expected 76, is " - << last_msg_->states[6].sid.reserved; - EXPECT_EQ( - get_asstates[6].sid.sat)>( - reinterpret_cast(&last_msg_->states[6].sid.sat)), - 24422) - << "incorrect value for states[6].sid.sat, expected 24422, is " - << last_msg_->states[6].sid.sat; - EXPECT_EQ(get_asstates[6].state)>( - reinterpret_cast(&last_msg_->states[6].state)), - 248) - << "incorrect value for states[6].state, expected 248, is " - << last_msg_->states[6].state; - EXPECT_LT((last_msg_->states[7].cn0 * 100 - 6428.20019531 * 100), 0.05) - << "incorrect value for states[7].cn0, expected 6428.20019531, is " - << last_msg_->states[7].cn0; - EXPECT_EQ( - get_asstates[7].sid.code)>( - reinterpret_cast(&last_msg_->states[7].sid.code)), - 27) - << "incorrect value for states[7].sid.code, expected 27, is " - << last_msg_->states[7].sid.code; - EXPECT_EQ(get_asstates[7].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[7].sid.reserved)), - 12) - << "incorrect value for states[7].sid.reserved, expected 12, is " - << last_msg_->states[7].sid.reserved; - EXPECT_EQ( - get_asstates[7].sid.sat)>( - reinterpret_cast(&last_msg_->states[7].sid.sat)), - 36211) - << "incorrect value for states[7].sid.sat, expected 36211, is " - << last_msg_->states[7].sid.sat; - EXPECT_EQ(get_asstates[7].state)>( - reinterpret_cast(&last_msg_->states[7].state)), - 131) - << "incorrect value for states[7].state, expected 131, is " - << last_msg_->states[7].state; - EXPECT_LT((last_msg_->states[8].cn0 * 100 - 3104.19995117 * 100), 0.05) - << "incorrect value for states[8].cn0, expected 3104.19995117, is " - << last_msg_->states[8].cn0; - EXPECT_EQ( - get_asstates[8].sid.code)>( - reinterpret_cast(&last_msg_->states[8].sid.code)), - 39) - << "incorrect value for states[8].sid.code, expected 39, is " - << last_msg_->states[8].sid.code; - EXPECT_EQ(get_asstates[8].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[8].sid.reserved)), - 23) - << "incorrect value for states[8].sid.reserved, expected 23, is " - << last_msg_->states[8].sid.reserved; - EXPECT_EQ( - get_asstates[8].sid.sat)>( - reinterpret_cast(&last_msg_->states[8].sid.sat)), - 37676) - << "incorrect value for states[8].sid.sat, expected 37676, is " - << last_msg_->states[8].sid.sat; - EXPECT_EQ(get_asstates[8].state)>( - reinterpret_cast(&last_msg_->states[8].state)), - 208) - << "incorrect value for states[8].state, expected 208, is " - << last_msg_->states[8].state; - EXPECT_LT((last_msg_->states[9].cn0 * 100 - 3686.19995117 * 100), 0.05) - << "incorrect value for states[9].cn0, expected 3686.19995117, is " - << last_msg_->states[9].cn0; - EXPECT_EQ( - get_asstates[9].sid.code)>( - reinterpret_cast(&last_msg_->states[9].sid.code)), - 49) - << "incorrect value for states[9].sid.code, expected 49, is " - << last_msg_->states[9].sid.code; - EXPECT_EQ(get_asstates[9].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[9].sid.reserved)), - 203) - << "incorrect value for states[9].sid.reserved, expected 203, is " - << last_msg_->states[9].sid.reserved; - EXPECT_EQ( - get_asstates[9].sid.sat)>( - reinterpret_cast(&last_msg_->states[9].sid.sat)), - 64415) - << "incorrect value for states[9].sid.sat, expected 64415, is " - << last_msg_->states[9].sid.sat; - EXPECT_EQ(get_asstates[9].state)>( - reinterpret_cast(&last_msg_->states[9].state)), - 237) - << "incorrect value for states[9].state, expected 237, is " - << last_msg_->states[9].state; - EXPECT_LT((last_msg_->states[10].cn0 * 100 - 5967.20019531 * 100), 0.05) - << "incorrect value for states[10].cn0, expected 5967.20019531, is " - << last_msg_->states[10].cn0; - EXPECT_EQ( - get_asstates[10].sid.code)>( - reinterpret_cast(&last_msg_->states[10].sid.code)), - 128) - << "incorrect value for states[10].sid.code, expected 128, is " - << last_msg_->states[10].sid.code; - EXPECT_EQ(get_asstates[10].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[10].sid.reserved)), - 206) - << "incorrect value for states[10].sid.reserved, expected 206, is " - << last_msg_->states[10].sid.reserved; - EXPECT_EQ( - get_asstates[10].sid.sat)>( - reinterpret_cast(&last_msg_->states[10].sid.sat)), - 22486) - << "incorrect value for states[10].sid.sat, expected 22486, is " - << last_msg_->states[10].sid.sat; - EXPECT_EQ( - get_asstates[10].state)>( - reinterpret_cast(&last_msg_->states[10].state)), - 70) - << "incorrect value for states[10].state, expected 70, is " - << last_msg_->states[10].state; - EXPECT_LT((last_msg_->states[11].cn0 * 100 - 5423.20019531 * 100), 0.05) - << "incorrect value for states[11].cn0, expected 5423.20019531, is " - << last_msg_->states[11].cn0; - EXPECT_EQ( - get_asstates[11].sid.code)>( - reinterpret_cast(&last_msg_->states[11].sid.code)), - 218) - << "incorrect value for states[11].sid.code, expected 218, is " - << last_msg_->states[11].sid.code; - EXPECT_EQ(get_asstates[11].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[11].sid.reserved)), - 19) - << "incorrect value for states[11].sid.reserved, expected 19, is " - << last_msg_->states[11].sid.reserved; - EXPECT_EQ( - get_asstates[11].sid.sat)>( - reinterpret_cast(&last_msg_->states[11].sid.sat)), - 28622) - << "incorrect value for states[11].sid.sat, expected 28622, is " - << last_msg_->states[11].sid.sat; - EXPECT_EQ( - get_asstates[11].state)>( - reinterpret_cast(&last_msg_->states[11].state)), - 14) - << "incorrect value for states[11].state, expected 14, is " - << last_msg_->states[11].state; - EXPECT_LT((last_msg_->states[12].cn0 * 100 - 438.200012207 * 100), 0.05) - << "incorrect value for states[12].cn0, expected 438.200012207, is " - << last_msg_->states[12].cn0; - EXPECT_EQ( - get_asstates[12].sid.code)>( - reinterpret_cast(&last_msg_->states[12].sid.code)), - 54) - << "incorrect value for states[12].sid.code, expected 54, is " - << last_msg_->states[12].sid.code; - EXPECT_EQ(get_asstates[12].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[12].sid.reserved)), - 2) - << "incorrect value for states[12].sid.reserved, expected 2, is " - << last_msg_->states[12].sid.reserved; - EXPECT_EQ( - get_asstates[12].sid.sat)>( - reinterpret_cast(&last_msg_->states[12].sid.sat)), - 53602) - << "incorrect value for states[12].sid.sat, expected 53602, is " - << last_msg_->states[12].sid.sat; - EXPECT_EQ( - get_asstates[12].state)>( - reinterpret_cast(&last_msg_->states[12].state)), - 216) - << "incorrect value for states[12].state, expected 216, is " - << last_msg_->states[12].state; - EXPECT_LT((last_msg_->states[13].cn0 * 100 - 1862.19995117 * 100), 0.05) - << "incorrect value for states[13].cn0, expected 1862.19995117, is " - << last_msg_->states[13].cn0; - EXPECT_EQ( - get_asstates[13].sid.code)>( - reinterpret_cast(&last_msg_->states[13].sid.code)), - 7) - << "incorrect value for states[13].sid.code, expected 7, is " - << last_msg_->states[13].sid.code; - EXPECT_EQ(get_asstates[13].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[13].sid.reserved)), - 34) - << "incorrect value for states[13].sid.reserved, expected 34, is " - << last_msg_->states[13].sid.reserved; - EXPECT_EQ( - get_asstates[13].sid.sat)>( - reinterpret_cast(&last_msg_->states[13].sid.sat)), - 25477) - << "incorrect value for states[13].sid.sat, expected 25477, is " - << last_msg_->states[13].sid.sat; - EXPECT_EQ( - get_asstates[13].state)>( - reinterpret_cast(&last_msg_->states[13].state)), - 200) - << "incorrect value for states[13].state, expected 200, is " - << last_msg_->states[13].state; - EXPECT_LT((last_msg_->states[14].cn0 * 100 - 5462.20019531 * 100), 0.05) - << "incorrect value for states[14].cn0, expected 5462.20019531, is " - << last_msg_->states[14].cn0; - EXPECT_EQ( - get_asstates[14].sid.code)>( - reinterpret_cast(&last_msg_->states[14].sid.code)), - 135) - << "incorrect value for states[14].sid.code, expected 135, is " - << last_msg_->states[14].sid.code; - EXPECT_EQ(get_asstates[14].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[14].sid.reserved)), - 46) - << "incorrect value for states[14].sid.reserved, expected 46, is " - << last_msg_->states[14].sid.reserved; - EXPECT_EQ( - get_asstates[14].sid.sat)>( - reinterpret_cast(&last_msg_->states[14].sid.sat)), - 21803) - << "incorrect value for states[14].sid.sat, expected 21803, is " - << last_msg_->states[14].sid.sat; - EXPECT_EQ( - get_asstates[14].state)>( - reinterpret_cast(&last_msg_->states[14].state)), - 155) - << "incorrect value for states[14].state, expected 155, is " - << last_msg_->states[14].state; - EXPECT_LT((last_msg_->states[15].cn0 * 100 - 7454.20019531 * 100), 0.05) - << "incorrect value for states[15].cn0, expected 7454.20019531, is " - << last_msg_->states[15].cn0; - EXPECT_EQ( - get_asstates[15].sid.code)>( - reinterpret_cast(&last_msg_->states[15].sid.code)), - 171) - << "incorrect value for states[15].sid.code, expected 171, is " - << last_msg_->states[15].sid.code; - EXPECT_EQ(get_asstates[15].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[15].sid.reserved)), - 201) - << "incorrect value for states[15].sid.reserved, expected 201, is " - << last_msg_->states[15].sid.reserved; - EXPECT_EQ( - get_asstates[15].sid.sat)>( - reinterpret_cast(&last_msg_->states[15].sid.sat)), - 21251) - << "incorrect value for states[15].sid.sat, expected 21251, is " - << last_msg_->states[15].sid.sat; - EXPECT_EQ( - get_asstates[15].state)>( - reinterpret_cast(&last_msg_->states[15].state)), - 155) - << "incorrect value for states[15].state, expected 155, is " - << last_msg_->states[15].state; - EXPECT_LT((last_msg_->states[16].cn0 * 100 - 7134.20019531 * 100), 0.05) - << "incorrect value for states[16].cn0, expected 7134.20019531, is " - << last_msg_->states[16].cn0; - EXPECT_EQ( - get_asstates[16].sid.code)>( - reinterpret_cast(&last_msg_->states[16].sid.code)), - 16) - << "incorrect value for states[16].sid.code, expected 16, is " - << last_msg_->states[16].sid.code; - EXPECT_EQ(get_asstates[16].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[16].sid.reserved)), - 19) - << "incorrect value for states[16].sid.reserved, expected 19, is " - << last_msg_->states[16].sid.reserved; - EXPECT_EQ( - get_asstates[16].sid.sat)>( - reinterpret_cast(&last_msg_->states[16].sid.sat)), - 50475) - << "incorrect value for states[16].sid.sat, expected 50475, is " - << last_msg_->states[16].sid.sat; - EXPECT_EQ( - get_asstates[16].state)>( - reinterpret_cast(&last_msg_->states[16].state)), - 121) - << "incorrect value for states[16].state, expected 121, is " - << last_msg_->states[16].state; - EXPECT_LT((last_msg_->states[17].cn0 * 100 - 3111.19995117 * 100), 0.05) - << "incorrect value for states[17].cn0, expected 3111.19995117, is " - << last_msg_->states[17].cn0; - EXPECT_EQ( - get_asstates[17].sid.code)>( - reinterpret_cast(&last_msg_->states[17].sid.code)), - 63) - << "incorrect value for states[17].sid.code, expected 63, is " - << last_msg_->states[17].sid.code; - EXPECT_EQ(get_asstates[17].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[17].sid.reserved)), - 176) - << "incorrect value for states[17].sid.reserved, expected 176, is " - << last_msg_->states[17].sid.reserved; - EXPECT_EQ( - get_asstates[17].sid.sat)>( - reinterpret_cast(&last_msg_->states[17].sid.sat)), - 13813) - << "incorrect value for states[17].sid.sat, expected 13813, is " - << last_msg_->states[17].sid.sat; - EXPECT_EQ( - get_asstates[17].state)>( - reinterpret_cast(&last_msg_->states[17].state)), - 128) - << "incorrect value for states[17].state, expected 128, is " - << last_msg_->states[17].state; - EXPECT_LT((last_msg_->states[18].cn0 * 100 - 4297.20019531 * 100), 0.05) - << "incorrect value for states[18].cn0, expected 4297.20019531, is " - << last_msg_->states[18].cn0; - EXPECT_EQ( - get_asstates[18].sid.code)>( - reinterpret_cast(&last_msg_->states[18].sid.code)), - 153) - << "incorrect value for states[18].sid.code, expected 153, is " - << last_msg_->states[18].sid.code; - EXPECT_EQ(get_asstates[18].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[18].sid.reserved)), - 51) - << "incorrect value for states[18].sid.reserved, expected 51, is " - << last_msg_->states[18].sid.reserved; - EXPECT_EQ( - get_asstates[18].sid.sat)>( - reinterpret_cast(&last_msg_->states[18].sid.sat)), - 15636) - << "incorrect value for states[18].sid.sat, expected 15636, is " - << last_msg_->states[18].sid.sat; - EXPECT_EQ( - get_asstates[18].state)>( - reinterpret_cast(&last_msg_->states[18].state)), - 36) - << "incorrect value for states[18].state, expected 36, is " - << last_msg_->states[18].state; - EXPECT_LT((last_msg_->states[19].cn0 * 100 - 2649.19995117 * 100), 0.05) - << "incorrect value for states[19].cn0, expected 2649.19995117, is " - << last_msg_->states[19].cn0; - EXPECT_EQ( - get_asstates[19].sid.code)>( - reinterpret_cast(&last_msg_->states[19].sid.code)), - 140) - << "incorrect value for states[19].sid.code, expected 140, is " - << last_msg_->states[19].sid.code; - EXPECT_EQ(get_asstates[19].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[19].sid.reserved)), - 22) - << "incorrect value for states[19].sid.reserved, expected 22, is " - << last_msg_->states[19].sid.reserved; - EXPECT_EQ( - get_asstates[19].sid.sat)>( - reinterpret_cast(&last_msg_->states[19].sid.sat)), - 29778) - << "incorrect value for states[19].sid.sat, expected 29778, is " - << last_msg_->states[19].sid.sat; - EXPECT_EQ( - get_asstates[19].state)>( - reinterpret_cast(&last_msg_->states[19].state)), - 46) - << "incorrect value for states[19].state, expected 46, is " - << last_msg_->states[19].state; - EXPECT_LT((last_msg_->states[20].cn0 * 100 - 941.200012207 * 100), 0.05) - << "incorrect value for states[20].cn0, expected 941.200012207, is " - << last_msg_->states[20].cn0; - EXPECT_EQ( - get_asstates[20].sid.code)>( - reinterpret_cast(&last_msg_->states[20].sid.code)), - 96) - << "incorrect value for states[20].sid.code, expected 96, is " - << last_msg_->states[20].sid.code; - EXPECT_EQ(get_asstates[20].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[20].sid.reserved)), - 143) - << "incorrect value for states[20].sid.reserved, expected 143, is " - << last_msg_->states[20].sid.reserved; - EXPECT_EQ( - get_asstates[20].sid.sat)>( - reinterpret_cast(&last_msg_->states[20].sid.sat)), - 37443) - << "incorrect value for states[20].sid.sat, expected 37443, is " - << last_msg_->states[20].sid.sat; - EXPECT_EQ( - get_asstates[20].state)>( - reinterpret_cast(&last_msg_->states[20].state)), - 177) - << "incorrect value for states[20].state, expected 177, is " - << last_msg_->states[20].state; - EXPECT_LT((last_msg_->states[21].cn0 * 100 - 1539.19995117 * 100), 0.05) - << "incorrect value for states[21].cn0, expected 1539.19995117, is " - << last_msg_->states[21].cn0; - EXPECT_EQ( - get_asstates[21].sid.code)>( - reinterpret_cast(&last_msg_->states[21].sid.code)), - 201) - << "incorrect value for states[21].sid.code, expected 201, is " - << last_msg_->states[21].sid.code; - EXPECT_EQ(get_asstates[21].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[21].sid.reserved)), - 251) - << "incorrect value for states[21].sid.reserved, expected 251, is " - << last_msg_->states[21].sid.reserved; - EXPECT_EQ( - get_asstates[21].sid.sat)>( - reinterpret_cast(&last_msg_->states[21].sid.sat)), - 41011) - << "incorrect value for states[21].sid.sat, expected 41011, is " - << last_msg_->states[21].sid.sat; - EXPECT_EQ( - get_asstates[21].state)>( - reinterpret_cast(&last_msg_->states[21].state)), - 220) - << "incorrect value for states[21].state, expected 220, is " - << last_msg_->states[21].state; - EXPECT_LT((last_msg_->states[22].cn0 * 100 - 1443.19995117 * 100), 0.05) - << "incorrect value for states[22].cn0, expected 1443.19995117, is " - << last_msg_->states[22].cn0; - EXPECT_EQ( - get_asstates[22].sid.code)>( - reinterpret_cast(&last_msg_->states[22].sid.code)), - 161) - << "incorrect value for states[22].sid.code, expected 161, is " - << last_msg_->states[22].sid.code; - EXPECT_EQ(get_asstates[22].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[22].sid.reserved)), - 220) - << "incorrect value for states[22].sid.reserved, expected 220, is " - << last_msg_->states[22].sid.reserved; - EXPECT_EQ( - get_asstates[22].sid.sat)>( - reinterpret_cast(&last_msg_->states[22].sid.sat)), - 706) - << "incorrect value for states[22].sid.sat, expected 706, is " - << last_msg_->states[22].sid.sat; - EXPECT_EQ( - get_asstates[22].state)>( - reinterpret_cast(&last_msg_->states[22].state)), - 168) - << "incorrect value for states[22].state, expected 168, is " - << last_msg_->states[22].state; - EXPECT_LT((last_msg_->states[23].cn0 * 100 - 1074.19995117 * 100), 0.05) - << "incorrect value for states[23].cn0, expected 1074.19995117, is " - << last_msg_->states[23].cn0; - EXPECT_EQ( - get_asstates[23].sid.code)>( - reinterpret_cast(&last_msg_->states[23].sid.code)), - 125) - << "incorrect value for states[23].sid.code, expected 125, is " - << last_msg_->states[23].sid.code; - EXPECT_EQ(get_asstates[23].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[23].sid.reserved)), - 178) - << "incorrect value for states[23].sid.reserved, expected 178, is " - << last_msg_->states[23].sid.reserved; - EXPECT_EQ( - get_asstates[23].sid.sat)>( - reinterpret_cast(&last_msg_->states[23].sid.sat)), - 2312) - << "incorrect value for states[23].sid.sat, expected 2312, is " - << last_msg_->states[23].sid.sat; - EXPECT_EQ( - get_asstates[23].state)>( - reinterpret_cast(&last_msg_->states[23].state)), - 69) - << "incorrect value for states[23].state, expected 69, is " - << last_msg_->states[23].state; - EXPECT_LT((last_msg_->states[24].cn0 * 100 - 2122.19995117 * 100), 0.05) - << "incorrect value for states[24].cn0, expected 2122.19995117, is " - << last_msg_->states[24].cn0; - EXPECT_EQ( - get_asstates[24].sid.code)>( - reinterpret_cast(&last_msg_->states[24].sid.code)), - 186) - << "incorrect value for states[24].sid.code, expected 186, is " - << last_msg_->states[24].sid.code; - EXPECT_EQ(get_asstates[24].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[24].sid.reserved)), - 171) - << "incorrect value for states[24].sid.reserved, expected 171, is " - << last_msg_->states[24].sid.reserved; - EXPECT_EQ( - get_asstates[24].sid.sat)>( - reinterpret_cast(&last_msg_->states[24].sid.sat)), - 34580) - << "incorrect value for states[24].sid.sat, expected 34580, is " - << last_msg_->states[24].sid.sat; - EXPECT_EQ( - get_asstates[24].state)>( - reinterpret_cast(&last_msg_->states[24].state)), - 185) - << "incorrect value for states[24].state, expected 185, is " - << last_msg_->states[24].state; - EXPECT_LT((last_msg_->states[25].cn0 * 100 - 9076.20019531 * 100), 0.05) - << "incorrect value for states[25].cn0, expected 9076.20019531, is " - << last_msg_->states[25].cn0; - EXPECT_EQ( - get_asstates[25].sid.code)>( - reinterpret_cast(&last_msg_->states[25].sid.code)), - 85) - << "incorrect value for states[25].sid.code, expected 85, is " - << last_msg_->states[25].sid.code; - EXPECT_EQ(get_asstates[25].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[25].sid.reserved)), - 170) - << "incorrect value for states[25].sid.reserved, expected 170, is " - << last_msg_->states[25].sid.reserved; - EXPECT_EQ( - get_asstates[25].sid.sat)>( - reinterpret_cast(&last_msg_->states[25].sid.sat)), - 39804) - << "incorrect value for states[25].sid.sat, expected 39804, is " - << last_msg_->states[25].sid.sat; - EXPECT_EQ( - get_asstates[25].state)>( - reinterpret_cast(&last_msg_->states[25].state)), - 18) - << "incorrect value for states[25].state, expected 18, is " - << last_msg_->states[25].state; - EXPECT_LT((last_msg_->states[26].cn0 * 100 - 4781.20019531 * 100), 0.05) - << "incorrect value for states[26].cn0, expected 4781.20019531, is " - << last_msg_->states[26].cn0; - EXPECT_EQ( - get_asstates[26].sid.code)>( - reinterpret_cast(&last_msg_->states[26].sid.code)), - 255) - << "incorrect value for states[26].sid.code, expected 255, is " - << last_msg_->states[26].sid.code; - EXPECT_EQ(get_asstates[26].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[26].sid.reserved)), - 186) - << "incorrect value for states[26].sid.reserved, expected 186, is " - << last_msg_->states[26].sid.reserved; - EXPECT_EQ( - get_asstates[26].sid.sat)>( - reinterpret_cast(&last_msg_->states[26].sid.sat)), - 52980) - << "incorrect value for states[26].sid.sat, expected 52980, is " - << last_msg_->states[26].sid.sat; - EXPECT_EQ( - get_asstates[26].state)>( - reinterpret_cast(&last_msg_->states[26].state)), - 57) - << "incorrect value for states[26].state, expected 57, is " - << last_msg_->states[26].state; - EXPECT_LT((last_msg_->states[27].cn0 * 100 - 3076.19995117 * 100), 0.05) - << "incorrect value for states[27].cn0, expected 3076.19995117, is " - << last_msg_->states[27].cn0; - EXPECT_EQ( - get_asstates[27].sid.code)>( - reinterpret_cast(&last_msg_->states[27].sid.code)), - 181) - << "incorrect value for states[27].sid.code, expected 181, is " - << last_msg_->states[27].sid.code; - EXPECT_EQ(get_asstates[27].sid.reserved)>( - reinterpret_cast( - &last_msg_->states[27].sid.reserved)), - 175) - << "incorrect value for states[27].sid.reserved, expected 175, is " - << last_msg_->states[27].sid.reserved; - EXPECT_EQ( - get_asstates[27].sid.sat)>( - reinterpret_cast(&last_msg_->states[27].sid.sat)), - 24007) - << "incorrect value for states[27].sid.sat, expected 24007, is " - << last_msg_->states[27].sid.sat; - EXPECT_EQ( - get_asstates[27].state)>( - reinterpret_cast(&last_msg_->states[27].state)), - 165) - << "incorrect value for states[27].state, expected 165, is " - << last_msg_->states[27].state; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingStateDetailedDep.cc b/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingStateDetailedDep.cc deleted file mode 100644 index 07ae4500ad..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingStateDetailedDep.cc +++ /dev/null @@ -1,1163 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgTrackingStateDetailedDep.yaml -// by generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_detailed_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_detailed_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep0, Test) { - uint8_t encoded_frame[] = { - 85, 17, 0, 59, 103, 55, 163, 151, 112, 215, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 5, 0, 0, 169, 177, - 208, 54, 15, 0, 0, 0, 85, 61, 0, 0, 39, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 108, 1, 0, 11, 0, 0, 9, 166, 214, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_detailed_dep_t *test_msg = - (msg_tracking_state_detailed_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->L.f = 169; - test_msg->L.i = 1319; - test_msg->P = 0; - test_msg->P_std = 0; - test_msg->acceleration = 108; - test_msg->clock_drift = 0; - test_msg->clock_offset = 0; - test_msg->cn0 = 177; - test_msg->corr_spacing = 40; - test_msg->doppler = 15701; - test_msg->doppler_std = 39; - test_msg->lock = 14032; - test_msg->misc_flags = 9; - test_msg->nav_flags = 0; - test_msg->pset_flags = 0; - test_msg->recv_time = 7909447587; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 15; - test_msg->sync_flags = 1; - test_msg->tot.tow = 0; - test_msg->tot.wn = 0; - test_msg->tow_flags = 0; - test_msg->track_flags = 11; - test_msg->uptime = 1; - - EXPECT_EQ(send_message(0x11, 26427, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 26427); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asL.f)>( - reinterpret_cast(&last_msg_->L.f)), - 169) - << "incorrect value for L.f, expected 169, is " << last_msg_->L.f; - EXPECT_EQ(get_asL.i)>( - reinterpret_cast(&last_msg_->L.i)), - 1319) - << "incorrect value for L.i, expected 1319, is " << last_msg_->L.i; - EXPECT_EQ(get_asP)>( - reinterpret_cast(&last_msg_->P)), - 0) - << "incorrect value for P, expected 0, is " << last_msg_->P; - EXPECT_EQ(get_asP_std)>( - reinterpret_cast(&last_msg_->P_std)), - 0) - << "incorrect value for P_std, expected 0, is " << last_msg_->P_std; - EXPECT_EQ(get_asacceleration)>( - reinterpret_cast(&last_msg_->acceleration)), - 108) - << "incorrect value for acceleration, expected 108, is " - << last_msg_->acceleration; - EXPECT_EQ(get_asclock_drift)>( - reinterpret_cast(&last_msg_->clock_drift)), - 0) - << "incorrect value for clock_drift, expected 0, is " - << last_msg_->clock_drift; - EXPECT_EQ(get_asclock_offset)>( - reinterpret_cast(&last_msg_->clock_offset)), - 0) - << "incorrect value for clock_offset, expected 0, is " - << last_msg_->clock_offset; - EXPECT_EQ(get_ascn0)>( - reinterpret_cast(&last_msg_->cn0)), - 177) - << "incorrect value for cn0, expected 177, is " << last_msg_->cn0; - EXPECT_EQ(get_ascorr_spacing)>( - reinterpret_cast(&last_msg_->corr_spacing)), - 40) - << "incorrect value for corr_spacing, expected 40, is " - << last_msg_->corr_spacing; - EXPECT_EQ(get_asdoppler)>( - reinterpret_cast(&last_msg_->doppler)), - 15701) - << "incorrect value for doppler, expected 15701, is " - << last_msg_->doppler; - EXPECT_EQ(get_asdoppler_std)>( - reinterpret_cast(&last_msg_->doppler_std)), - 39) - << "incorrect value for doppler_std, expected 39, is " - << last_msg_->doppler_std; - EXPECT_EQ(get_aslock)>( - reinterpret_cast(&last_msg_->lock)), - 14032) - << "incorrect value for lock, expected 14032, is " << last_msg_->lock; - EXPECT_EQ(get_asmisc_flags)>( - reinterpret_cast(&last_msg_->misc_flags)), - 9) - << "incorrect value for misc_flags, expected 9, is " - << last_msg_->misc_flags; - EXPECT_EQ(get_asnav_flags)>( - reinterpret_cast(&last_msg_->nav_flags)), - 0) - << "incorrect value for nav_flags, expected 0, is " - << last_msg_->nav_flags; - EXPECT_EQ(get_aspset_flags)>( - reinterpret_cast(&last_msg_->pset_flags)), - 0) - << "incorrect value for pset_flags, expected 0, is " - << last_msg_->pset_flags; - EXPECT_EQ(get_asrecv_time)>( - reinterpret_cast(&last_msg_->recv_time)), - 7909447587) - << "incorrect value for recv_time, expected 7909447587, is " - << last_msg_->recv_time; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 15) - << "incorrect value for sid.sat, expected 15, is " << last_msg_->sid.sat; - EXPECT_EQ(get_assync_flags)>( - reinterpret_cast(&last_msg_->sync_flags)), - 1) - << "incorrect value for sync_flags, expected 1, is " - << last_msg_->sync_flags; - EXPECT_EQ(get_astot.tow)>( - reinterpret_cast(&last_msg_->tot.tow)), - 0) - << "incorrect value for tot.tow, expected 0, is " << last_msg_->tot.tow; - EXPECT_EQ(get_astot.wn)>( - reinterpret_cast(&last_msg_->tot.wn)), - 0) - << "incorrect value for tot.wn, expected 0, is " << last_msg_->tot.wn; - EXPECT_EQ(get_astow_flags)>( - reinterpret_cast(&last_msg_->tow_flags)), - 0) - << "incorrect value for tow_flags, expected 0, is " - << last_msg_->tow_flags; - EXPECT_EQ(get_astrack_flags)>( - reinterpret_cast(&last_msg_->track_flags)), - 11) - << "incorrect value for track_flags, expected 11, is " - << last_msg_->track_flags; - EXPECT_EQ(get_asuptime)>( - reinterpret_cast(&last_msg_->uptime)), - 1) - << "incorrect value for uptime, expected 1, is " << last_msg_->uptime; -} -class Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_detailed_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_detailed_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep1, Test) { - uint8_t encoded_frame[] = { - 85, 17, 0, 59, 103, 55, 97, 251, 61, 245, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 7, 0, 0, 14, 175, - 208, 54, 15, 0, 0, 0, 51, 61, 0, 0, 30, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 224, 1, 0, 11, 0, 0, 9, 136, 179, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_detailed_dep_t *test_msg = - (msg_tracking_state_detailed_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->L.f = 14; - test_msg->L.i = 1810; - test_msg->P = 0; - test_msg->P_std = 0; - test_msg->acceleration = -32; - test_msg->clock_drift = 0; - test_msg->clock_offset = 0; - test_msg->cn0 = 175; - test_msg->corr_spacing = 40; - test_msg->doppler = 15667; - test_msg->doppler_std = 30; - test_msg->lock = 14032; - test_msg->misc_flags = 9; - test_msg->nav_flags = 0; - test_msg->pset_flags = 0; - test_msg->recv_time = 8409447265; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 15; - test_msg->sync_flags = 1; - test_msg->tot.tow = 0; - test_msg->tot.wn = 0; - test_msg->tow_flags = 0; - test_msg->track_flags = 11; - test_msg->uptime = 1; - - EXPECT_EQ(send_message(0x11, 26427, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 26427); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asL.f)>( - reinterpret_cast(&last_msg_->L.f)), - 14) - << "incorrect value for L.f, expected 14, is " << last_msg_->L.f; - EXPECT_EQ(get_asL.i)>( - reinterpret_cast(&last_msg_->L.i)), - 1810) - << "incorrect value for L.i, expected 1810, is " << last_msg_->L.i; - EXPECT_EQ(get_asP)>( - reinterpret_cast(&last_msg_->P)), - 0) - << "incorrect value for P, expected 0, is " << last_msg_->P; - EXPECT_EQ(get_asP_std)>( - reinterpret_cast(&last_msg_->P_std)), - 0) - << "incorrect value for P_std, expected 0, is " << last_msg_->P_std; - EXPECT_EQ(get_asacceleration)>( - reinterpret_cast(&last_msg_->acceleration)), - -32) - << "incorrect value for acceleration, expected -32, is " - << last_msg_->acceleration; - EXPECT_EQ(get_asclock_drift)>( - reinterpret_cast(&last_msg_->clock_drift)), - 0) - << "incorrect value for clock_drift, expected 0, is " - << last_msg_->clock_drift; - EXPECT_EQ(get_asclock_offset)>( - reinterpret_cast(&last_msg_->clock_offset)), - 0) - << "incorrect value for clock_offset, expected 0, is " - << last_msg_->clock_offset; - EXPECT_EQ(get_ascn0)>( - reinterpret_cast(&last_msg_->cn0)), - 175) - << "incorrect value for cn0, expected 175, is " << last_msg_->cn0; - EXPECT_EQ(get_ascorr_spacing)>( - reinterpret_cast(&last_msg_->corr_spacing)), - 40) - << "incorrect value for corr_spacing, expected 40, is " - << last_msg_->corr_spacing; - EXPECT_EQ(get_asdoppler)>( - reinterpret_cast(&last_msg_->doppler)), - 15667) - << "incorrect value for doppler, expected 15667, is " - << last_msg_->doppler; - EXPECT_EQ(get_asdoppler_std)>( - reinterpret_cast(&last_msg_->doppler_std)), - 30) - << "incorrect value for doppler_std, expected 30, is " - << last_msg_->doppler_std; - EXPECT_EQ(get_aslock)>( - reinterpret_cast(&last_msg_->lock)), - 14032) - << "incorrect value for lock, expected 14032, is " << last_msg_->lock; - EXPECT_EQ(get_asmisc_flags)>( - reinterpret_cast(&last_msg_->misc_flags)), - 9) - << "incorrect value for misc_flags, expected 9, is " - << last_msg_->misc_flags; - EXPECT_EQ(get_asnav_flags)>( - reinterpret_cast(&last_msg_->nav_flags)), - 0) - << "incorrect value for nav_flags, expected 0, is " - << last_msg_->nav_flags; - EXPECT_EQ(get_aspset_flags)>( - reinterpret_cast(&last_msg_->pset_flags)), - 0) - << "incorrect value for pset_flags, expected 0, is " - << last_msg_->pset_flags; - EXPECT_EQ(get_asrecv_time)>( - reinterpret_cast(&last_msg_->recv_time)), - 8409447265) - << "incorrect value for recv_time, expected 8409447265, is " - << last_msg_->recv_time; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 15) - << "incorrect value for sid.sat, expected 15, is " << last_msg_->sid.sat; - EXPECT_EQ(get_assync_flags)>( - reinterpret_cast(&last_msg_->sync_flags)), - 1) - << "incorrect value for sync_flags, expected 1, is " - << last_msg_->sync_flags; - EXPECT_EQ(get_astot.tow)>( - reinterpret_cast(&last_msg_->tot.tow)), - 0) - << "incorrect value for tot.tow, expected 0, is " << last_msg_->tot.tow; - EXPECT_EQ(get_astot.wn)>( - reinterpret_cast(&last_msg_->tot.wn)), - 0) - << "incorrect value for tot.wn, expected 0, is " << last_msg_->tot.wn; - EXPECT_EQ(get_astow_flags)>( - reinterpret_cast(&last_msg_->tow_flags)), - 0) - << "incorrect value for tow_flags, expected 0, is " - << last_msg_->tow_flags; - EXPECT_EQ(get_astrack_flags)>( - reinterpret_cast(&last_msg_->track_flags)), - 11) - << "incorrect value for track_flags, expected 11, is " - << last_msg_->track_flags; - EXPECT_EQ(get_asuptime)>( - reinterpret_cast(&last_msg_->uptime)), - 1) - << "incorrect value for uptime, expected 1, is " << last_msg_->uptime; -} -class Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_detailed_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_detailed_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep2, Test) { - uint8_t encoded_frame[] = { - 85, 17, 0, 59, 103, 55, 139, 218, 236, 18, 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 250, 8, 0, 0, 8, 179, - 208, 54, 15, 0, 0, 0, 67, 61, 0, 0, 22, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 27, 1, 0, 11, 0, 2, 9, 217, 159, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_detailed_dep_t *test_msg = - (msg_tracking_state_detailed_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->L.f = 8; - test_msg->L.i = 2298; - test_msg->P = 0; - test_msg->P_std = 0; - test_msg->acceleration = 27; - test_msg->clock_drift = 0; - test_msg->clock_offset = 0; - test_msg->cn0 = 179; - test_msg->corr_spacing = 40; - test_msg->doppler = 15683; - test_msg->doppler_std = 22; - test_msg->lock = 14032; - test_msg->misc_flags = 9; - test_msg->nav_flags = 0; - test_msg->pset_flags = 2; - test_msg->recv_time = 8907446923; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 15; - test_msg->sync_flags = 1; - test_msg->tot.tow = 0; - test_msg->tot.wn = 0; - test_msg->tow_flags = 0; - test_msg->track_flags = 11; - test_msg->uptime = 2; - - EXPECT_EQ(send_message(0x11, 26427, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 26427); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asL.f)>( - reinterpret_cast(&last_msg_->L.f)), - 8) - << "incorrect value for L.f, expected 8, is " << last_msg_->L.f; - EXPECT_EQ(get_asL.i)>( - reinterpret_cast(&last_msg_->L.i)), - 2298) - << "incorrect value for L.i, expected 2298, is " << last_msg_->L.i; - EXPECT_EQ(get_asP)>( - reinterpret_cast(&last_msg_->P)), - 0) - << "incorrect value for P, expected 0, is " << last_msg_->P; - EXPECT_EQ(get_asP_std)>( - reinterpret_cast(&last_msg_->P_std)), - 0) - << "incorrect value for P_std, expected 0, is " << last_msg_->P_std; - EXPECT_EQ(get_asacceleration)>( - reinterpret_cast(&last_msg_->acceleration)), - 27) - << "incorrect value for acceleration, expected 27, is " - << last_msg_->acceleration; - EXPECT_EQ(get_asclock_drift)>( - reinterpret_cast(&last_msg_->clock_drift)), - 0) - << "incorrect value for clock_drift, expected 0, is " - << last_msg_->clock_drift; - EXPECT_EQ(get_asclock_offset)>( - reinterpret_cast(&last_msg_->clock_offset)), - 0) - << "incorrect value for clock_offset, expected 0, is " - << last_msg_->clock_offset; - EXPECT_EQ(get_ascn0)>( - reinterpret_cast(&last_msg_->cn0)), - 179) - << "incorrect value for cn0, expected 179, is " << last_msg_->cn0; - EXPECT_EQ(get_ascorr_spacing)>( - reinterpret_cast(&last_msg_->corr_spacing)), - 40) - << "incorrect value for corr_spacing, expected 40, is " - << last_msg_->corr_spacing; - EXPECT_EQ(get_asdoppler)>( - reinterpret_cast(&last_msg_->doppler)), - 15683) - << "incorrect value for doppler, expected 15683, is " - << last_msg_->doppler; - EXPECT_EQ(get_asdoppler_std)>( - reinterpret_cast(&last_msg_->doppler_std)), - 22) - << "incorrect value for doppler_std, expected 22, is " - << last_msg_->doppler_std; - EXPECT_EQ(get_aslock)>( - reinterpret_cast(&last_msg_->lock)), - 14032) - << "incorrect value for lock, expected 14032, is " << last_msg_->lock; - EXPECT_EQ(get_asmisc_flags)>( - reinterpret_cast(&last_msg_->misc_flags)), - 9) - << "incorrect value for misc_flags, expected 9, is " - << last_msg_->misc_flags; - EXPECT_EQ(get_asnav_flags)>( - reinterpret_cast(&last_msg_->nav_flags)), - 0) - << "incorrect value for nav_flags, expected 0, is " - << last_msg_->nav_flags; - EXPECT_EQ(get_aspset_flags)>( - reinterpret_cast(&last_msg_->pset_flags)), - 2) - << "incorrect value for pset_flags, expected 2, is " - << last_msg_->pset_flags; - EXPECT_EQ(get_asrecv_time)>( - reinterpret_cast(&last_msg_->recv_time)), - 8907446923) - << "incorrect value for recv_time, expected 8907446923, is " - << last_msg_->recv_time; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 15) - << "incorrect value for sid.sat, expected 15, is " << last_msg_->sid.sat; - EXPECT_EQ(get_assync_flags)>( - reinterpret_cast(&last_msg_->sync_flags)), - 1) - << "incorrect value for sync_flags, expected 1, is " - << last_msg_->sync_flags; - EXPECT_EQ(get_astot.tow)>( - reinterpret_cast(&last_msg_->tot.tow)), - 0) - << "incorrect value for tot.tow, expected 0, is " << last_msg_->tot.tow; - EXPECT_EQ(get_astot.wn)>( - reinterpret_cast(&last_msg_->tot.wn)), - 0) - << "incorrect value for tot.wn, expected 0, is " << last_msg_->tot.wn; - EXPECT_EQ(get_astow_flags)>( - reinterpret_cast(&last_msg_->tow_flags)), - 0) - << "incorrect value for tow_flags, expected 0, is " - << last_msg_->tow_flags; - EXPECT_EQ(get_astrack_flags)>( - reinterpret_cast(&last_msg_->track_flags)), - 11) - << "incorrect value for track_flags, expected 11, is " - << last_msg_->track_flags; - EXPECT_EQ(get_asuptime)>( - reinterpret_cast(&last_msg_->uptime)), - 2) - << "incorrect value for uptime, expected 2, is " << last_msg_->uptime; -} -class Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_detailed_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_detailed_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep3, Test) { - uint8_t encoded_frame[] = { - 85, 17, 0, 59, 103, 55, 255, 251, 170, 48, 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 226, 10, 0, 0, 125, 181, - 208, 54, 15, 0, 0, 0, 29, 61, 0, 0, 10, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 220, 1, 0, 11, 0, 3, 9, 66, 95, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_detailed_dep_t *test_msg = - (msg_tracking_state_detailed_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->L.f = 125; - test_msg->L.i = 2786; - test_msg->P = 0; - test_msg->P_std = 0; - test_msg->acceleration = -36; - test_msg->clock_drift = 0; - test_msg->clock_offset = 0; - test_msg->cn0 = 181; - test_msg->corr_spacing = 40; - test_msg->doppler = 15645; - test_msg->doppler_std = 10; - test_msg->lock = 14032; - test_msg->misc_flags = 9; - test_msg->nav_flags = 0; - test_msg->pset_flags = 3; - test_msg->recv_time = 9406446591; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 15; - test_msg->sync_flags = 1; - test_msg->tot.tow = 0; - test_msg->tot.wn = 0; - test_msg->tow_flags = 0; - test_msg->track_flags = 11; - test_msg->uptime = 2; - - EXPECT_EQ(send_message(0x11, 26427, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 26427); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asL.f)>( - reinterpret_cast(&last_msg_->L.f)), - 125) - << "incorrect value for L.f, expected 125, is " << last_msg_->L.f; - EXPECT_EQ(get_asL.i)>( - reinterpret_cast(&last_msg_->L.i)), - 2786) - << "incorrect value for L.i, expected 2786, is " << last_msg_->L.i; - EXPECT_EQ(get_asP)>( - reinterpret_cast(&last_msg_->P)), - 0) - << "incorrect value for P, expected 0, is " << last_msg_->P; - EXPECT_EQ(get_asP_std)>( - reinterpret_cast(&last_msg_->P_std)), - 0) - << "incorrect value for P_std, expected 0, is " << last_msg_->P_std; - EXPECT_EQ(get_asacceleration)>( - reinterpret_cast(&last_msg_->acceleration)), - -36) - << "incorrect value for acceleration, expected -36, is " - << last_msg_->acceleration; - EXPECT_EQ(get_asclock_drift)>( - reinterpret_cast(&last_msg_->clock_drift)), - 0) - << "incorrect value for clock_drift, expected 0, is " - << last_msg_->clock_drift; - EXPECT_EQ(get_asclock_offset)>( - reinterpret_cast(&last_msg_->clock_offset)), - 0) - << "incorrect value for clock_offset, expected 0, is " - << last_msg_->clock_offset; - EXPECT_EQ(get_ascn0)>( - reinterpret_cast(&last_msg_->cn0)), - 181) - << "incorrect value for cn0, expected 181, is " << last_msg_->cn0; - EXPECT_EQ(get_ascorr_spacing)>( - reinterpret_cast(&last_msg_->corr_spacing)), - 40) - << "incorrect value for corr_spacing, expected 40, is " - << last_msg_->corr_spacing; - EXPECT_EQ(get_asdoppler)>( - reinterpret_cast(&last_msg_->doppler)), - 15645) - << "incorrect value for doppler, expected 15645, is " - << last_msg_->doppler; - EXPECT_EQ(get_asdoppler_std)>( - reinterpret_cast(&last_msg_->doppler_std)), - 10) - << "incorrect value for doppler_std, expected 10, is " - << last_msg_->doppler_std; - EXPECT_EQ(get_aslock)>( - reinterpret_cast(&last_msg_->lock)), - 14032) - << "incorrect value for lock, expected 14032, is " << last_msg_->lock; - EXPECT_EQ(get_asmisc_flags)>( - reinterpret_cast(&last_msg_->misc_flags)), - 9) - << "incorrect value for misc_flags, expected 9, is " - << last_msg_->misc_flags; - EXPECT_EQ(get_asnav_flags)>( - reinterpret_cast(&last_msg_->nav_flags)), - 0) - << "incorrect value for nav_flags, expected 0, is " - << last_msg_->nav_flags; - EXPECT_EQ(get_aspset_flags)>( - reinterpret_cast(&last_msg_->pset_flags)), - 3) - << "incorrect value for pset_flags, expected 3, is " - << last_msg_->pset_flags; - EXPECT_EQ(get_asrecv_time)>( - reinterpret_cast(&last_msg_->recv_time)), - 9406446591) - << "incorrect value for recv_time, expected 9406446591, is " - << last_msg_->recv_time; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 15) - << "incorrect value for sid.sat, expected 15, is " << last_msg_->sid.sat; - EXPECT_EQ(get_assync_flags)>( - reinterpret_cast(&last_msg_->sync_flags)), - 1) - << "incorrect value for sync_flags, expected 1, is " - << last_msg_->sync_flags; - EXPECT_EQ(get_astot.tow)>( - reinterpret_cast(&last_msg_->tot.tow)), - 0) - << "incorrect value for tot.tow, expected 0, is " << last_msg_->tot.tow; - EXPECT_EQ(get_astot.wn)>( - reinterpret_cast(&last_msg_->tot.wn)), - 0) - << "incorrect value for tot.wn, expected 0, is " << last_msg_->tot.wn; - EXPECT_EQ(get_astow_flags)>( - reinterpret_cast(&last_msg_->tow_flags)), - 0) - << "incorrect value for tow_flags, expected 0, is " - << last_msg_->tow_flags; - EXPECT_EQ(get_astrack_flags)>( - reinterpret_cast(&last_msg_->track_flags)), - 11) - << "incorrect value for track_flags, expected 11, is " - << last_msg_->track_flags; - EXPECT_EQ(get_asuptime)>( - reinterpret_cast(&last_msg_->uptime)), - 2) - << "incorrect value for uptime, expected 2, is " << last_msg_->uptime; -} -class Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_detailed_dep_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_detailed_dep_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDep4, Test) { - uint8_t encoded_frame[] = { - 85, 17, 0, 59, 103, 55, 189, 95, 120, 78, 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 203, 12, 0, 0, 64, 184, - 208, 54, 15, 0, 0, 0, 24, 61, 0, 0, 4, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 2, 1, 0, 11, 0, 3, 9, 194, 206, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_detailed_dep_t *test_msg = - (msg_tracking_state_detailed_dep_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->L.f = 64; - test_msg->L.i = 3275; - test_msg->P = 0; - test_msg->P_std = 0; - test_msg->acceleration = 2; - test_msg->clock_drift = 0; - test_msg->clock_offset = 0; - test_msg->cn0 = 184; - test_msg->corr_spacing = 40; - test_msg->doppler = 15640; - test_msg->doppler_std = 4; - test_msg->lock = 14032; - test_msg->misc_flags = 9; - test_msg->nav_flags = 0; - test_msg->pset_flags = 3; - test_msg->recv_time = 9906446269; - test_msg->sid.code = 0; - test_msg->sid.reserved = 0; - test_msg->sid.sat = 15; - test_msg->sync_flags = 1; - test_msg->tot.tow = 0; - test_msg->tot.wn = 0; - test_msg->tow_flags = 0; - test_msg->track_flags = 11; - test_msg->uptime = 3; - - EXPECT_EQ(send_message(0x11, 26427, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 26427); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asL.f)>( - reinterpret_cast(&last_msg_->L.f)), - 64) - << "incorrect value for L.f, expected 64, is " << last_msg_->L.f; - EXPECT_EQ(get_asL.i)>( - reinterpret_cast(&last_msg_->L.i)), - 3275) - << "incorrect value for L.i, expected 3275, is " << last_msg_->L.i; - EXPECT_EQ(get_asP)>( - reinterpret_cast(&last_msg_->P)), - 0) - << "incorrect value for P, expected 0, is " << last_msg_->P; - EXPECT_EQ(get_asP_std)>( - reinterpret_cast(&last_msg_->P_std)), - 0) - << "incorrect value for P_std, expected 0, is " << last_msg_->P_std; - EXPECT_EQ(get_asacceleration)>( - reinterpret_cast(&last_msg_->acceleration)), - 2) - << "incorrect value for acceleration, expected 2, is " - << last_msg_->acceleration; - EXPECT_EQ(get_asclock_drift)>( - reinterpret_cast(&last_msg_->clock_drift)), - 0) - << "incorrect value for clock_drift, expected 0, is " - << last_msg_->clock_drift; - EXPECT_EQ(get_asclock_offset)>( - reinterpret_cast(&last_msg_->clock_offset)), - 0) - << "incorrect value for clock_offset, expected 0, is " - << last_msg_->clock_offset; - EXPECT_EQ(get_ascn0)>( - reinterpret_cast(&last_msg_->cn0)), - 184) - << "incorrect value for cn0, expected 184, is " << last_msg_->cn0; - EXPECT_EQ(get_ascorr_spacing)>( - reinterpret_cast(&last_msg_->corr_spacing)), - 40) - << "incorrect value for corr_spacing, expected 40, is " - << last_msg_->corr_spacing; - EXPECT_EQ(get_asdoppler)>( - reinterpret_cast(&last_msg_->doppler)), - 15640) - << "incorrect value for doppler, expected 15640, is " - << last_msg_->doppler; - EXPECT_EQ(get_asdoppler_std)>( - reinterpret_cast(&last_msg_->doppler_std)), - 4) - << "incorrect value for doppler_std, expected 4, is " - << last_msg_->doppler_std; - EXPECT_EQ(get_aslock)>( - reinterpret_cast(&last_msg_->lock)), - 14032) - << "incorrect value for lock, expected 14032, is " << last_msg_->lock; - EXPECT_EQ(get_asmisc_flags)>( - reinterpret_cast(&last_msg_->misc_flags)), - 9) - << "incorrect value for misc_flags, expected 9, is " - << last_msg_->misc_flags; - EXPECT_EQ(get_asnav_flags)>( - reinterpret_cast(&last_msg_->nav_flags)), - 0) - << "incorrect value for nav_flags, expected 0, is " - << last_msg_->nav_flags; - EXPECT_EQ(get_aspset_flags)>( - reinterpret_cast(&last_msg_->pset_flags)), - 3) - << "incorrect value for pset_flags, expected 3, is " - << last_msg_->pset_flags; - EXPECT_EQ(get_asrecv_time)>( - reinterpret_cast(&last_msg_->recv_time)), - 9906446269) - << "incorrect value for recv_time, expected 9906446269, is " - << last_msg_->recv_time; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 0) - << "incorrect value for sid.code, expected 0, is " << last_msg_->sid.code; - EXPECT_EQ(get_assid.reserved)>( - reinterpret_cast(&last_msg_->sid.reserved)), - 0) - << "incorrect value for sid.reserved, expected 0, is " - << last_msg_->sid.reserved; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 15) - << "incorrect value for sid.sat, expected 15, is " << last_msg_->sid.sat; - EXPECT_EQ(get_assync_flags)>( - reinterpret_cast(&last_msg_->sync_flags)), - 1) - << "incorrect value for sync_flags, expected 1, is " - << last_msg_->sync_flags; - EXPECT_EQ(get_astot.tow)>( - reinterpret_cast(&last_msg_->tot.tow)), - 0) - << "incorrect value for tot.tow, expected 0, is " << last_msg_->tot.tow; - EXPECT_EQ(get_astot.wn)>( - reinterpret_cast(&last_msg_->tot.wn)), - 0) - << "incorrect value for tot.wn, expected 0, is " << last_msg_->tot.wn; - EXPECT_EQ(get_astow_flags)>( - reinterpret_cast(&last_msg_->tow_flags)), - 0) - << "incorrect value for tow_flags, expected 0, is " - << last_msg_->tow_flags; - EXPECT_EQ(get_astrack_flags)>( - reinterpret_cast(&last_msg_->track_flags)), - 11) - << "incorrect value for track_flags, expected 11, is " - << last_msg_->track_flags; - EXPECT_EQ(get_asuptime)>( - reinterpret_cast(&last_msg_->uptime)), - 3) - << "incorrect value for uptime, expected 3, is " << last_msg_->uptime; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingStateDetailedDepA.cc b/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingStateDetailedDepA.cc deleted file mode 100644 index b5201afc69..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgTrackingStateDetailedDepA.cc +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgTrackingStateDetailedDepA.yaml -// by generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast( - last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_detailed_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_detailed_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgTrackingStateDetailedDepA0, - Test) { - uint8_t encoded_frame[] = { - 85, 33, 0, 155, 110, 57, 46, 31, 180, 38, 219, 0, 0, - 0, 133, 100, 71, 94, 192, 2, 160, 207, 212, 255, 135, 139, - 62, 62, 179, 83, 227, 245, 134, 160, 204, 78, 95, 255, 38, - 59, 161, 15, 255, 86, 189, 248, 31, 191, 136, 194, 124, 23, - 15, 91, 249, 117, 142, 90, 219, 67, 25, 83, 62, 122, 100, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_detailed_dep_a_t *test_msg = - (msg_tracking_state_detailed_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->L.f = 204; - test_msg->L.i = -1601767965; - test_msg->P = 1044286343; - test_msg->P_std = 21427; - test_msg->acceleration = -114; - test_msg->clock_drift = 23311; - test_msg->clock_offset = 6012; - test_msg->cn0 = 78; - test_msg->corr_spacing = 30201; - test_msg->doppler = 1459556257; - test_msg->doppler_std = 63677; - test_msg->lock = 65375; - test_msg->misc_flags = 62; - test_msg->nav_flags = 25; - test_msg->pset_flags = 83; - test_msg->recv_time = 941247176494; - test_msg->sid.code = 59; - test_msg->sid.sat = 38; - test_msg->sync_flags = 90; - test_msg->tot.ns_residual = -811597120; - test_msg->tot.tow = 1581737093; - test_msg->tot.wn = 65492; - test_msg->tow_flags = 219; - test_msg->track_flags = 67; - test_msg->uptime = 3263741727; - - EXPECT_EQ(send_message(0x21, 28315, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 28315); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asL.f)>( - reinterpret_cast(&last_msg_->L.f)), - 204) - << "incorrect value for L.f, expected 204, is " << last_msg_->L.f; - EXPECT_EQ(get_asL.i)>( - reinterpret_cast(&last_msg_->L.i)), - -1601767965) - << "incorrect value for L.i, expected -1601767965, is " << last_msg_->L.i; - EXPECT_EQ(get_asP)>( - reinterpret_cast(&last_msg_->P)), - 1044286343) - << "incorrect value for P, expected 1044286343, is " << last_msg_->P; - EXPECT_EQ(get_asP_std)>( - reinterpret_cast(&last_msg_->P_std)), - 21427) - << "incorrect value for P_std, expected 21427, is " << last_msg_->P_std; - EXPECT_EQ(get_asacceleration)>( - reinterpret_cast(&last_msg_->acceleration)), - -114) - << "incorrect value for acceleration, expected -114, is " - << last_msg_->acceleration; - EXPECT_EQ(get_asclock_drift)>( - reinterpret_cast(&last_msg_->clock_drift)), - 23311) - << "incorrect value for clock_drift, expected 23311, is " - << last_msg_->clock_drift; - EXPECT_EQ(get_asclock_offset)>( - reinterpret_cast(&last_msg_->clock_offset)), - 6012) - << "incorrect value for clock_offset, expected 6012, is " - << last_msg_->clock_offset; - EXPECT_EQ(get_ascn0)>( - reinterpret_cast(&last_msg_->cn0)), - 78) - << "incorrect value for cn0, expected 78, is " << last_msg_->cn0; - EXPECT_EQ(get_ascorr_spacing)>( - reinterpret_cast(&last_msg_->corr_spacing)), - 30201) - << "incorrect value for corr_spacing, expected 30201, is " - << last_msg_->corr_spacing; - EXPECT_EQ(get_asdoppler)>( - reinterpret_cast(&last_msg_->doppler)), - 1459556257) - << "incorrect value for doppler, expected 1459556257, is " - << last_msg_->doppler; - EXPECT_EQ(get_asdoppler_std)>( - reinterpret_cast(&last_msg_->doppler_std)), - 63677) - << "incorrect value for doppler_std, expected 63677, is " - << last_msg_->doppler_std; - EXPECT_EQ(get_aslock)>( - reinterpret_cast(&last_msg_->lock)), - 65375) - << "incorrect value for lock, expected 65375, is " << last_msg_->lock; - EXPECT_EQ(get_asmisc_flags)>( - reinterpret_cast(&last_msg_->misc_flags)), - 62) - << "incorrect value for misc_flags, expected 62, is " - << last_msg_->misc_flags; - EXPECT_EQ(get_asnav_flags)>( - reinterpret_cast(&last_msg_->nav_flags)), - 25) - << "incorrect value for nav_flags, expected 25, is " - << last_msg_->nav_flags; - EXPECT_EQ(get_aspset_flags)>( - reinterpret_cast(&last_msg_->pset_flags)), - 83) - << "incorrect value for pset_flags, expected 83, is " - << last_msg_->pset_flags; - EXPECT_EQ(get_asrecv_time)>( - reinterpret_cast(&last_msg_->recv_time)), - 941247176494) - << "incorrect value for recv_time, expected 941247176494, is " - << last_msg_->recv_time; - EXPECT_EQ(get_assid.code)>( - reinterpret_cast(&last_msg_->sid.code)), - 59) - << "incorrect value for sid.code, expected 59, is " - << last_msg_->sid.code; - EXPECT_EQ(get_assid.sat)>( - reinterpret_cast(&last_msg_->sid.sat)), - 38) - << "incorrect value for sid.sat, expected 38, is " << last_msg_->sid.sat; - EXPECT_EQ(get_assync_flags)>( - reinterpret_cast(&last_msg_->sync_flags)), - 90) - << "incorrect value for sync_flags, expected 90, is " - << last_msg_->sync_flags; - EXPECT_EQ(get_astot.ns_residual)>( - reinterpret_cast(&last_msg_->tot.ns_residual)), - -811597120) - << "incorrect value for tot.ns_residual, expected -811597120, is " - << last_msg_->tot.ns_residual; - EXPECT_EQ(get_astot.tow)>( - reinterpret_cast(&last_msg_->tot.tow)), - 1581737093) - << "incorrect value for tot.tow, expected 1581737093, is " - << last_msg_->tot.tow; - EXPECT_EQ(get_astot.wn)>( - reinterpret_cast(&last_msg_->tot.wn)), - 65492) - << "incorrect value for tot.wn, expected 65492, is " << last_msg_->tot.wn; - EXPECT_EQ(get_astow_flags)>( - reinterpret_cast(&last_msg_->tow_flags)), - 219) - << "incorrect value for tow_flags, expected 219, is " - << last_msg_->tow_flags; - EXPECT_EQ(get_astrack_flags)>( - reinterpret_cast(&last_msg_->track_flags)), - 67) - << "incorrect value for track_flags, expected 67, is " - << last_msg_->track_flags; - EXPECT_EQ(get_asuptime)>( - reinterpret_cast(&last_msg_->uptime)), - 3263741727) - << "incorrect value for uptime, expected 3263741727, is " - << last_msg_->uptime; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgtrackingStateDepA.cc b/c/test/legacy/cpp/auto_check_sbp_tracking_MsgtrackingStateDepA.cc deleted file mode 100644 index 50d2f295c0..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_tracking_MsgtrackingStateDepA.cc +++ /dev/null @@ -1,1886 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/tracking/test_MsgtrackingStateDepA.yaml by -// generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA0, Test) { - uint8_t encoded_frame[] = { - 85, 22, 0, 195, 4, 66, 1, 0, 204, 177, 51, 65, 1, 2, 198, - 4, 39, 65, 1, 3, 219, 182, 27, 65, 1, 7, 132, 120, 101, 65, - 1, 10, 91, 91, 251, 64, 1, 13, 42, 37, 163, 64, 1, 22, 130, - 184, 215, 64, 1, 30, 115, 53, 75, 65, 1, 31, 16, 74, 126, 65, - 1, 25, 132, 196, 135, 64, 1, 6, 100, 59, 223, 64, 17, 225, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_dep_a_t *test_msg = - (msg_tracking_state_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[0].cn0 = 11.230907440185547; - test_msg->states[0].prn = 0; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[1].cn0 = 10.438665390014648; - test_msg->states[1].prn = 2; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[2].cn0 = 9.732142448425293; - test_msg->states[2].prn = 3; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[3].cn0 = 14.341922760009766; - test_msg->states[3].prn = 7; - test_msg->states[3].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[4].cn0 = 7.8549017906188965; - test_msg->states[4].prn = 10; - test_msg->states[4].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[5].cn0 = 5.0982866287231445; - test_msg->states[5].prn = 13; - test_msg->states[5].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[6].cn0 = 6.741272926330566; - test_msg->states[6].prn = 22; - test_msg->states[6].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[7].cn0 = 12.700549125671387; - test_msg->states[7].prn = 30; - test_msg->states[7].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[8].cn0 = 15.893081665039062; - test_msg->states[8].prn = 31; - test_msg->states[8].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[9].cn0 = 4.242738723754883; - test_msg->states[9].prn = 25; - test_msg->states[9].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[10].cn0 = 6.97599983215332; - test_msg->states[10].prn = 6; - test_msg->states[10].state = 1; - - EXPECT_EQ(send_message(0x16, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->states[0].cn0 * 100 - 11.2309074402 * 100), 0.05) - << "incorrect value for states[0].cn0, expected 11.2309074402, is " - << last_msg_->states[0].cn0; - EXPECT_EQ(get_asstates[0].prn)>( - reinterpret_cast(&last_msg_->states[0].prn)), - 0) - << "incorrect value for states[0].prn, expected 0, is " - << last_msg_->states[0].prn; - EXPECT_EQ(get_asstates[0].state)>( - reinterpret_cast(&last_msg_->states[0].state)), - 1) - << "incorrect value for states[0].state, expected 1, is " - << last_msg_->states[0].state; - EXPECT_LT((last_msg_->states[1].cn0 * 100 - 10.43866539 * 100), 0.05) - << "incorrect value for states[1].cn0, expected 10.43866539, is " - << last_msg_->states[1].cn0; - EXPECT_EQ(get_asstates[1].prn)>( - reinterpret_cast(&last_msg_->states[1].prn)), - 2) - << "incorrect value for states[1].prn, expected 2, is " - << last_msg_->states[1].prn; - EXPECT_EQ(get_asstates[1].state)>( - reinterpret_cast(&last_msg_->states[1].state)), - 1) - << "incorrect value for states[1].state, expected 1, is " - << last_msg_->states[1].state; - EXPECT_LT((last_msg_->states[2].cn0 * 100 - 9.73214244843 * 100), 0.05) - << "incorrect value for states[2].cn0, expected 9.73214244843, is " - << last_msg_->states[2].cn0; - EXPECT_EQ(get_asstates[2].prn)>( - reinterpret_cast(&last_msg_->states[2].prn)), - 3) - << "incorrect value for states[2].prn, expected 3, is " - << last_msg_->states[2].prn; - EXPECT_EQ(get_asstates[2].state)>( - reinterpret_cast(&last_msg_->states[2].state)), - 1) - << "incorrect value for states[2].state, expected 1, is " - << last_msg_->states[2].state; - EXPECT_LT((last_msg_->states[3].cn0 * 100 - 14.34192276 * 100), 0.05) - << "incorrect value for states[3].cn0, expected 14.34192276, is " - << last_msg_->states[3].cn0; - EXPECT_EQ(get_asstates[3].prn)>( - reinterpret_cast(&last_msg_->states[3].prn)), - 7) - << "incorrect value for states[3].prn, expected 7, is " - << last_msg_->states[3].prn; - EXPECT_EQ(get_asstates[3].state)>( - reinterpret_cast(&last_msg_->states[3].state)), - 1) - << "incorrect value for states[3].state, expected 1, is " - << last_msg_->states[3].state; - EXPECT_LT((last_msg_->states[4].cn0 * 100 - 7.85490179062 * 100), 0.05) - << "incorrect value for states[4].cn0, expected 7.85490179062, is " - << last_msg_->states[4].cn0; - EXPECT_EQ(get_asstates[4].prn)>( - reinterpret_cast(&last_msg_->states[4].prn)), - 10) - << "incorrect value for states[4].prn, expected 10, is " - << last_msg_->states[4].prn; - EXPECT_EQ(get_asstates[4].state)>( - reinterpret_cast(&last_msg_->states[4].state)), - 1) - << "incorrect value for states[4].state, expected 1, is " - << last_msg_->states[4].state; - EXPECT_LT((last_msg_->states[5].cn0 * 100 - 5.09828662872 * 100), 0.05) - << "incorrect value for states[5].cn0, expected 5.09828662872, is " - << last_msg_->states[5].cn0; - EXPECT_EQ(get_asstates[5].prn)>( - reinterpret_cast(&last_msg_->states[5].prn)), - 13) - << "incorrect value for states[5].prn, expected 13, is " - << last_msg_->states[5].prn; - EXPECT_EQ(get_asstates[5].state)>( - reinterpret_cast(&last_msg_->states[5].state)), - 1) - << "incorrect value for states[5].state, expected 1, is " - << last_msg_->states[5].state; - EXPECT_LT((last_msg_->states[6].cn0 * 100 - 6.74127292633 * 100), 0.05) - << "incorrect value for states[6].cn0, expected 6.74127292633, is " - << last_msg_->states[6].cn0; - EXPECT_EQ(get_asstates[6].prn)>( - reinterpret_cast(&last_msg_->states[6].prn)), - 22) - << "incorrect value for states[6].prn, expected 22, is " - << last_msg_->states[6].prn; - EXPECT_EQ(get_asstates[6].state)>( - reinterpret_cast(&last_msg_->states[6].state)), - 1) - << "incorrect value for states[6].state, expected 1, is " - << last_msg_->states[6].state; - EXPECT_LT((last_msg_->states[7].cn0 * 100 - 12.7005491257 * 100), 0.05) - << "incorrect value for states[7].cn0, expected 12.7005491257, is " - << last_msg_->states[7].cn0; - EXPECT_EQ(get_asstates[7].prn)>( - reinterpret_cast(&last_msg_->states[7].prn)), - 30) - << "incorrect value for states[7].prn, expected 30, is " - << last_msg_->states[7].prn; - EXPECT_EQ(get_asstates[7].state)>( - reinterpret_cast(&last_msg_->states[7].state)), - 1) - << "incorrect value for states[7].state, expected 1, is " - << last_msg_->states[7].state; - EXPECT_LT((last_msg_->states[8].cn0 * 100 - 15.893081665 * 100), 0.05) - << "incorrect value for states[8].cn0, expected 15.893081665, is " - << last_msg_->states[8].cn0; - EXPECT_EQ(get_asstates[8].prn)>( - reinterpret_cast(&last_msg_->states[8].prn)), - 31) - << "incorrect value for states[8].prn, expected 31, is " - << last_msg_->states[8].prn; - EXPECT_EQ(get_asstates[8].state)>( - reinterpret_cast(&last_msg_->states[8].state)), - 1) - << "incorrect value for states[8].state, expected 1, is " - << last_msg_->states[8].state; - EXPECT_LT((last_msg_->states[9].cn0 * 100 - 4.24273872375 * 100), 0.05) - << "incorrect value for states[9].cn0, expected 4.24273872375, is " - << last_msg_->states[9].cn0; - EXPECT_EQ(get_asstates[9].prn)>( - reinterpret_cast(&last_msg_->states[9].prn)), - 25) - << "incorrect value for states[9].prn, expected 25, is " - << last_msg_->states[9].prn; - EXPECT_EQ(get_asstates[9].state)>( - reinterpret_cast(&last_msg_->states[9].state)), - 1) - << "incorrect value for states[9].state, expected 1, is " - << last_msg_->states[9].state; - EXPECT_LT((last_msg_->states[10].cn0 * 100 - 6.97599983215 * 100), 0.05) - << "incorrect value for states[10].cn0, expected 6.97599983215, is " - << last_msg_->states[10].cn0; - EXPECT_EQ(get_asstates[10].prn)>( - reinterpret_cast(&last_msg_->states[10].prn)), - 6) - << "incorrect value for states[10].prn, expected 6, is " - << last_msg_->states[10].prn; - EXPECT_EQ( - get_asstates[10].state)>( - reinterpret_cast(&last_msg_->states[10].state)), - 1) - << "incorrect value for states[10].state, expected 1, is " - << last_msg_->states[10].state; -} -class Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA1 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA1() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA1, Test) { - uint8_t encoded_frame[] = { - 85, 22, 0, 195, 4, 66, 1, 0, 216, 57, 48, 65, 1, 2, 145, - 41, 46, 65, 1, 3, 4, 26, 34, 65, 1, 7, 177, 67, 109, 65, - 1, 10, 61, 80, 249, 64, 1, 13, 250, 199, 155, 64, 1, 22, 55, - 19, 215, 64, 1, 30, 138, 138, 79, 65, 1, 31, 214, 179, 119, 65, - 1, 25, 53, 138, 120, 64, 1, 6, 183, 247, 129, 64, 168, 173, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_dep_a_t *test_msg = - (msg_tracking_state_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[0].cn0 = 11.014122009277344; - test_msg->states[0].prn = 0; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[1].cn0 = 10.885148048400879; - test_msg->states[1].prn = 2; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[2].cn0 = 10.131351470947266; - test_msg->states[2].prn = 3; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[3].cn0 = 14.829026222229004; - test_msg->states[3].prn = 7; - test_msg->states[3].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[4].cn0 = 7.79104471206665; - test_msg->states[4].prn = 10; - test_msg->states[4].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[5].cn0 = 4.868161201477051; - test_msg->states[5].prn = 13; - test_msg->states[5].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[6].cn0 = 6.721095561981201; - test_msg->states[6].prn = 22; - test_msg->states[6].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[7].cn0 = 12.971323013305664; - test_msg->states[7].prn = 30; - test_msg->states[7].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[8].cn0 = 15.481405258178711; - test_msg->states[8].prn = 31; - test_msg->states[8].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[9].cn0 = 3.8834354877471924; - test_msg->states[9].prn = 25; - test_msg->states[9].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[10].cn0 = 4.061488628387451; - test_msg->states[10].prn = 6; - test_msg->states[10].state = 1; - - EXPECT_EQ(send_message(0x16, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->states[0].cn0 * 100 - 11.0141220093 * 100), 0.05) - << "incorrect value for states[0].cn0, expected 11.0141220093, is " - << last_msg_->states[0].cn0; - EXPECT_EQ(get_asstates[0].prn)>( - reinterpret_cast(&last_msg_->states[0].prn)), - 0) - << "incorrect value for states[0].prn, expected 0, is " - << last_msg_->states[0].prn; - EXPECT_EQ(get_asstates[0].state)>( - reinterpret_cast(&last_msg_->states[0].state)), - 1) - << "incorrect value for states[0].state, expected 1, is " - << last_msg_->states[0].state; - EXPECT_LT((last_msg_->states[1].cn0 * 100 - 10.8851480484 * 100), 0.05) - << "incorrect value for states[1].cn0, expected 10.8851480484, is " - << last_msg_->states[1].cn0; - EXPECT_EQ(get_asstates[1].prn)>( - reinterpret_cast(&last_msg_->states[1].prn)), - 2) - << "incorrect value for states[1].prn, expected 2, is " - << last_msg_->states[1].prn; - EXPECT_EQ(get_asstates[1].state)>( - reinterpret_cast(&last_msg_->states[1].state)), - 1) - << "incorrect value for states[1].state, expected 1, is " - << last_msg_->states[1].state; - EXPECT_LT((last_msg_->states[2].cn0 * 100 - 10.1313514709 * 100), 0.05) - << "incorrect value for states[2].cn0, expected 10.1313514709, is " - << last_msg_->states[2].cn0; - EXPECT_EQ(get_asstates[2].prn)>( - reinterpret_cast(&last_msg_->states[2].prn)), - 3) - << "incorrect value for states[2].prn, expected 3, is " - << last_msg_->states[2].prn; - EXPECT_EQ(get_asstates[2].state)>( - reinterpret_cast(&last_msg_->states[2].state)), - 1) - << "incorrect value for states[2].state, expected 1, is " - << last_msg_->states[2].state; - EXPECT_LT((last_msg_->states[3].cn0 * 100 - 14.8290262222 * 100), 0.05) - << "incorrect value for states[3].cn0, expected 14.8290262222, is " - << last_msg_->states[3].cn0; - EXPECT_EQ(get_asstates[3].prn)>( - reinterpret_cast(&last_msg_->states[3].prn)), - 7) - << "incorrect value for states[3].prn, expected 7, is " - << last_msg_->states[3].prn; - EXPECT_EQ(get_asstates[3].state)>( - reinterpret_cast(&last_msg_->states[3].state)), - 1) - << "incorrect value for states[3].state, expected 1, is " - << last_msg_->states[3].state; - EXPECT_LT((last_msg_->states[4].cn0 * 100 - 7.79104471207 * 100), 0.05) - << "incorrect value for states[4].cn0, expected 7.79104471207, is " - << last_msg_->states[4].cn0; - EXPECT_EQ(get_asstates[4].prn)>( - reinterpret_cast(&last_msg_->states[4].prn)), - 10) - << "incorrect value for states[4].prn, expected 10, is " - << last_msg_->states[4].prn; - EXPECT_EQ(get_asstates[4].state)>( - reinterpret_cast(&last_msg_->states[4].state)), - 1) - << "incorrect value for states[4].state, expected 1, is " - << last_msg_->states[4].state; - EXPECT_LT((last_msg_->states[5].cn0 * 100 - 4.86816120148 * 100), 0.05) - << "incorrect value for states[5].cn0, expected 4.86816120148, is " - << last_msg_->states[5].cn0; - EXPECT_EQ(get_asstates[5].prn)>( - reinterpret_cast(&last_msg_->states[5].prn)), - 13) - << "incorrect value for states[5].prn, expected 13, is " - << last_msg_->states[5].prn; - EXPECT_EQ(get_asstates[5].state)>( - reinterpret_cast(&last_msg_->states[5].state)), - 1) - << "incorrect value for states[5].state, expected 1, is " - << last_msg_->states[5].state; - EXPECT_LT((last_msg_->states[6].cn0 * 100 - 6.72109556198 * 100), 0.05) - << "incorrect value for states[6].cn0, expected 6.72109556198, is " - << last_msg_->states[6].cn0; - EXPECT_EQ(get_asstates[6].prn)>( - reinterpret_cast(&last_msg_->states[6].prn)), - 22) - << "incorrect value for states[6].prn, expected 22, is " - << last_msg_->states[6].prn; - EXPECT_EQ(get_asstates[6].state)>( - reinterpret_cast(&last_msg_->states[6].state)), - 1) - << "incorrect value for states[6].state, expected 1, is " - << last_msg_->states[6].state; - EXPECT_LT((last_msg_->states[7].cn0 * 100 - 12.9713230133 * 100), 0.05) - << "incorrect value for states[7].cn0, expected 12.9713230133, is " - << last_msg_->states[7].cn0; - EXPECT_EQ(get_asstates[7].prn)>( - reinterpret_cast(&last_msg_->states[7].prn)), - 30) - << "incorrect value for states[7].prn, expected 30, is " - << last_msg_->states[7].prn; - EXPECT_EQ(get_asstates[7].state)>( - reinterpret_cast(&last_msg_->states[7].state)), - 1) - << "incorrect value for states[7].state, expected 1, is " - << last_msg_->states[7].state; - EXPECT_LT((last_msg_->states[8].cn0 * 100 - 15.4814052582 * 100), 0.05) - << "incorrect value for states[8].cn0, expected 15.4814052582, is " - << last_msg_->states[8].cn0; - EXPECT_EQ(get_asstates[8].prn)>( - reinterpret_cast(&last_msg_->states[8].prn)), - 31) - << "incorrect value for states[8].prn, expected 31, is " - << last_msg_->states[8].prn; - EXPECT_EQ(get_asstates[8].state)>( - reinterpret_cast(&last_msg_->states[8].state)), - 1) - << "incorrect value for states[8].state, expected 1, is " - << last_msg_->states[8].state; - EXPECT_LT((last_msg_->states[9].cn0 * 100 - 3.88343548775 * 100), 0.05) - << "incorrect value for states[9].cn0, expected 3.88343548775, is " - << last_msg_->states[9].cn0; - EXPECT_EQ(get_asstates[9].prn)>( - reinterpret_cast(&last_msg_->states[9].prn)), - 25) - << "incorrect value for states[9].prn, expected 25, is " - << last_msg_->states[9].prn; - EXPECT_EQ(get_asstates[9].state)>( - reinterpret_cast(&last_msg_->states[9].state)), - 1) - << "incorrect value for states[9].state, expected 1, is " - << last_msg_->states[9].state; - EXPECT_LT((last_msg_->states[10].cn0 * 100 - 4.06148862839 * 100), 0.05) - << "incorrect value for states[10].cn0, expected 4.06148862839, is " - << last_msg_->states[10].cn0; - EXPECT_EQ(get_asstates[10].prn)>( - reinterpret_cast(&last_msg_->states[10].prn)), - 6) - << "incorrect value for states[10].prn, expected 6, is " - << last_msg_->states[10].prn; - EXPECT_EQ( - get_asstates[10].state)>( - reinterpret_cast(&last_msg_->states[10].state)), - 1) - << "incorrect value for states[10].state, expected 1, is " - << last_msg_->states[10].state; -} -class Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA2 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA2() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA2, Test) { - uint8_t encoded_frame[] = { - 85, 22, 0, 195, 4, 66, 1, 0, 141, 76, 60, 65, 1, 2, 69, - 139, 46, 65, 1, 3, 146, 27, 30, 65, 1, 7, 235, 56, 97, 65, - 1, 10, 141, 213, 243, 64, 1, 13, 250, 170, 166, 64, 1, 22, 17, - 101, 201, 64, 1, 30, 172, 183, 83, 65, 1, 31, 238, 193, 120, 65, - 1, 25, 220, 48, 132, 64, 1, 6, 49, 214, 54, 64, 110, 179, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_dep_a_t *test_msg = - (msg_tracking_state_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[0].cn0 = 11.768689155578613; - test_msg->states[0].prn = 0; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[1].cn0 = 10.909001350402832; - test_msg->states[1].prn = 2; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[2].cn0 = 9.881731033325195; - test_msg->states[2].prn = 3; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[3].cn0 = 14.076395988464355; - test_msg->states[3].prn = 7; - test_msg->states[3].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[4].cn0 = 7.619818210601807; - test_msg->states[4].prn = 10; - test_msg->states[4].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[5].cn0 = 5.208371162414551; - test_msg->states[5].prn = 13; - test_msg->states[5].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[6].cn0 = 6.2935872077941895; - test_msg->states[6].prn = 22; - test_msg->states[6].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[7].cn0 = 13.232341766357422; - test_msg->states[7].prn = 30; - test_msg->states[7].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[8].cn0 = 15.547346115112305; - test_msg->states[8].prn = 31; - test_msg->states[8].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[9].cn0 = 4.130964279174805; - test_msg->states[9].prn = 25; - test_msg->states[9].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[10].cn0 = 2.856823205947876; - test_msg->states[10].prn = 6; - test_msg->states[10].state = 1; - - EXPECT_EQ(send_message(0x16, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->states[0].cn0 * 100 - 11.7686891556 * 100), 0.05) - << "incorrect value for states[0].cn0, expected 11.7686891556, is " - << last_msg_->states[0].cn0; - EXPECT_EQ(get_asstates[0].prn)>( - reinterpret_cast(&last_msg_->states[0].prn)), - 0) - << "incorrect value for states[0].prn, expected 0, is " - << last_msg_->states[0].prn; - EXPECT_EQ(get_asstates[0].state)>( - reinterpret_cast(&last_msg_->states[0].state)), - 1) - << "incorrect value for states[0].state, expected 1, is " - << last_msg_->states[0].state; - EXPECT_LT((last_msg_->states[1].cn0 * 100 - 10.9090013504 * 100), 0.05) - << "incorrect value for states[1].cn0, expected 10.9090013504, is " - << last_msg_->states[1].cn0; - EXPECT_EQ(get_asstates[1].prn)>( - reinterpret_cast(&last_msg_->states[1].prn)), - 2) - << "incorrect value for states[1].prn, expected 2, is " - << last_msg_->states[1].prn; - EXPECT_EQ(get_asstates[1].state)>( - reinterpret_cast(&last_msg_->states[1].state)), - 1) - << "incorrect value for states[1].state, expected 1, is " - << last_msg_->states[1].state; - EXPECT_LT((last_msg_->states[2].cn0 * 100 - 9.88173103333 * 100), 0.05) - << "incorrect value for states[2].cn0, expected 9.88173103333, is " - << last_msg_->states[2].cn0; - EXPECT_EQ(get_asstates[2].prn)>( - reinterpret_cast(&last_msg_->states[2].prn)), - 3) - << "incorrect value for states[2].prn, expected 3, is " - << last_msg_->states[2].prn; - EXPECT_EQ(get_asstates[2].state)>( - reinterpret_cast(&last_msg_->states[2].state)), - 1) - << "incorrect value for states[2].state, expected 1, is " - << last_msg_->states[2].state; - EXPECT_LT((last_msg_->states[3].cn0 * 100 - 14.0763959885 * 100), 0.05) - << "incorrect value for states[3].cn0, expected 14.0763959885, is " - << last_msg_->states[3].cn0; - EXPECT_EQ(get_asstates[3].prn)>( - reinterpret_cast(&last_msg_->states[3].prn)), - 7) - << "incorrect value for states[3].prn, expected 7, is " - << last_msg_->states[3].prn; - EXPECT_EQ(get_asstates[3].state)>( - reinterpret_cast(&last_msg_->states[3].state)), - 1) - << "incorrect value for states[3].state, expected 1, is " - << last_msg_->states[3].state; - EXPECT_LT((last_msg_->states[4].cn0 * 100 - 7.6198182106 * 100), 0.05) - << "incorrect value for states[4].cn0, expected 7.6198182106, is " - << last_msg_->states[4].cn0; - EXPECT_EQ(get_asstates[4].prn)>( - reinterpret_cast(&last_msg_->states[4].prn)), - 10) - << "incorrect value for states[4].prn, expected 10, is " - << last_msg_->states[4].prn; - EXPECT_EQ(get_asstates[4].state)>( - reinterpret_cast(&last_msg_->states[4].state)), - 1) - << "incorrect value for states[4].state, expected 1, is " - << last_msg_->states[4].state; - EXPECT_LT((last_msg_->states[5].cn0 * 100 - 5.20837116241 * 100), 0.05) - << "incorrect value for states[5].cn0, expected 5.20837116241, is " - << last_msg_->states[5].cn0; - EXPECT_EQ(get_asstates[5].prn)>( - reinterpret_cast(&last_msg_->states[5].prn)), - 13) - << "incorrect value for states[5].prn, expected 13, is " - << last_msg_->states[5].prn; - EXPECT_EQ(get_asstates[5].state)>( - reinterpret_cast(&last_msg_->states[5].state)), - 1) - << "incorrect value for states[5].state, expected 1, is " - << last_msg_->states[5].state; - EXPECT_LT((last_msg_->states[6].cn0 * 100 - 6.29358720779 * 100), 0.05) - << "incorrect value for states[6].cn0, expected 6.29358720779, is " - << last_msg_->states[6].cn0; - EXPECT_EQ(get_asstates[6].prn)>( - reinterpret_cast(&last_msg_->states[6].prn)), - 22) - << "incorrect value for states[6].prn, expected 22, is " - << last_msg_->states[6].prn; - EXPECT_EQ(get_asstates[6].state)>( - reinterpret_cast(&last_msg_->states[6].state)), - 1) - << "incorrect value for states[6].state, expected 1, is " - << last_msg_->states[6].state; - EXPECT_LT((last_msg_->states[7].cn0 * 100 - 13.2323417664 * 100), 0.05) - << "incorrect value for states[7].cn0, expected 13.2323417664, is " - << last_msg_->states[7].cn0; - EXPECT_EQ(get_asstates[7].prn)>( - reinterpret_cast(&last_msg_->states[7].prn)), - 30) - << "incorrect value for states[7].prn, expected 30, is " - << last_msg_->states[7].prn; - EXPECT_EQ(get_asstates[7].state)>( - reinterpret_cast(&last_msg_->states[7].state)), - 1) - << "incorrect value for states[7].state, expected 1, is " - << last_msg_->states[7].state; - EXPECT_LT((last_msg_->states[8].cn0 * 100 - 15.5473461151 * 100), 0.05) - << "incorrect value for states[8].cn0, expected 15.5473461151, is " - << last_msg_->states[8].cn0; - EXPECT_EQ(get_asstates[8].prn)>( - reinterpret_cast(&last_msg_->states[8].prn)), - 31) - << "incorrect value for states[8].prn, expected 31, is " - << last_msg_->states[8].prn; - EXPECT_EQ(get_asstates[8].state)>( - reinterpret_cast(&last_msg_->states[8].state)), - 1) - << "incorrect value for states[8].state, expected 1, is " - << last_msg_->states[8].state; - EXPECT_LT((last_msg_->states[9].cn0 * 100 - 4.13096427917 * 100), 0.05) - << "incorrect value for states[9].cn0, expected 4.13096427917, is " - << last_msg_->states[9].cn0; - EXPECT_EQ(get_asstates[9].prn)>( - reinterpret_cast(&last_msg_->states[9].prn)), - 25) - << "incorrect value for states[9].prn, expected 25, is " - << last_msg_->states[9].prn; - EXPECT_EQ(get_asstates[9].state)>( - reinterpret_cast(&last_msg_->states[9].state)), - 1) - << "incorrect value for states[9].state, expected 1, is " - << last_msg_->states[9].state; - EXPECT_LT((last_msg_->states[10].cn0 * 100 - 2.85682320595 * 100), 0.05) - << "incorrect value for states[10].cn0, expected 2.85682320595, is " - << last_msg_->states[10].cn0; - EXPECT_EQ(get_asstates[10].prn)>( - reinterpret_cast(&last_msg_->states[10].prn)), - 6) - << "incorrect value for states[10].prn, expected 6, is " - << last_msg_->states[10].prn; - EXPECT_EQ( - get_asstates[10].state)>( - reinterpret_cast(&last_msg_->states[10].state)), - 1) - << "incorrect value for states[10].state, expected 1, is " - << last_msg_->states[10].state; -} -class Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA3 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA3() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA3, Test) { - uint8_t encoded_frame[] = { - 85, 22, 0, 195, 4, 66, 1, 0, 55, 143, 120, 66, 0, 0, 0, - 0, 128, 191, 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, - 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, 0, 0, 0, - 0, 128, 191, 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, - 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, 248, 89, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_dep_a_t *test_msg = - (msg_tracking_state_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[0].cn0 = 62.13985824584961; - test_msg->states[0].prn = 0; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[1].cn0 = -1.0; - test_msg->states[1].prn = 0; - test_msg->states[1].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[2].cn0 = -1.0; - test_msg->states[2].prn = 0; - test_msg->states[2].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[3].cn0 = -1.0; - test_msg->states[3].prn = 0; - test_msg->states[3].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[4].cn0 = -1.0; - test_msg->states[4].prn = 0; - test_msg->states[4].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[5].cn0 = -1.0; - test_msg->states[5].prn = 0; - test_msg->states[5].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[6].cn0 = -1.0; - test_msg->states[6].prn = 0; - test_msg->states[6].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[7].cn0 = -1.0; - test_msg->states[7].prn = 0; - test_msg->states[7].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[8].cn0 = -1.0; - test_msg->states[8].prn = 0; - test_msg->states[8].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[9].cn0 = -1.0; - test_msg->states[9].prn = 0; - test_msg->states[9].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[10].cn0 = -1.0; - test_msg->states[10].prn = 0; - test_msg->states[10].state = 0; - - EXPECT_EQ(send_message(0x16, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->states[0].cn0 * 100 - 62.1398582458 * 100), 0.05) - << "incorrect value for states[0].cn0, expected 62.1398582458, is " - << last_msg_->states[0].cn0; - EXPECT_EQ(get_asstates[0].prn)>( - reinterpret_cast(&last_msg_->states[0].prn)), - 0) - << "incorrect value for states[0].prn, expected 0, is " - << last_msg_->states[0].prn; - EXPECT_EQ(get_asstates[0].state)>( - reinterpret_cast(&last_msg_->states[0].state)), - 1) - << "incorrect value for states[0].state, expected 1, is " - << last_msg_->states[0].state; - EXPECT_LT((last_msg_->states[1].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[1].cn0, expected -1.0, is " - << last_msg_->states[1].cn0; - EXPECT_EQ(get_asstates[1].prn)>( - reinterpret_cast(&last_msg_->states[1].prn)), - 0) - << "incorrect value for states[1].prn, expected 0, is " - << last_msg_->states[1].prn; - EXPECT_EQ(get_asstates[1].state)>( - reinterpret_cast(&last_msg_->states[1].state)), - 0) - << "incorrect value for states[1].state, expected 0, is " - << last_msg_->states[1].state; - EXPECT_LT((last_msg_->states[2].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[2].cn0, expected -1.0, is " - << last_msg_->states[2].cn0; - EXPECT_EQ(get_asstates[2].prn)>( - reinterpret_cast(&last_msg_->states[2].prn)), - 0) - << "incorrect value for states[2].prn, expected 0, is " - << last_msg_->states[2].prn; - EXPECT_EQ(get_asstates[2].state)>( - reinterpret_cast(&last_msg_->states[2].state)), - 0) - << "incorrect value for states[2].state, expected 0, is " - << last_msg_->states[2].state; - EXPECT_LT((last_msg_->states[3].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[3].cn0, expected -1.0, is " - << last_msg_->states[3].cn0; - EXPECT_EQ(get_asstates[3].prn)>( - reinterpret_cast(&last_msg_->states[3].prn)), - 0) - << "incorrect value for states[3].prn, expected 0, is " - << last_msg_->states[3].prn; - EXPECT_EQ(get_asstates[3].state)>( - reinterpret_cast(&last_msg_->states[3].state)), - 0) - << "incorrect value for states[3].state, expected 0, is " - << last_msg_->states[3].state; - EXPECT_LT((last_msg_->states[4].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[4].cn0, expected -1.0, is " - << last_msg_->states[4].cn0; - EXPECT_EQ(get_asstates[4].prn)>( - reinterpret_cast(&last_msg_->states[4].prn)), - 0) - << "incorrect value for states[4].prn, expected 0, is " - << last_msg_->states[4].prn; - EXPECT_EQ(get_asstates[4].state)>( - reinterpret_cast(&last_msg_->states[4].state)), - 0) - << "incorrect value for states[4].state, expected 0, is " - << last_msg_->states[4].state; - EXPECT_LT((last_msg_->states[5].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[5].cn0, expected -1.0, is " - << last_msg_->states[5].cn0; - EXPECT_EQ(get_asstates[5].prn)>( - reinterpret_cast(&last_msg_->states[5].prn)), - 0) - << "incorrect value for states[5].prn, expected 0, is " - << last_msg_->states[5].prn; - EXPECT_EQ(get_asstates[5].state)>( - reinterpret_cast(&last_msg_->states[5].state)), - 0) - << "incorrect value for states[5].state, expected 0, is " - << last_msg_->states[5].state; - EXPECT_LT((last_msg_->states[6].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[6].cn0, expected -1.0, is " - << last_msg_->states[6].cn0; - EXPECT_EQ(get_asstates[6].prn)>( - reinterpret_cast(&last_msg_->states[6].prn)), - 0) - << "incorrect value for states[6].prn, expected 0, is " - << last_msg_->states[6].prn; - EXPECT_EQ(get_asstates[6].state)>( - reinterpret_cast(&last_msg_->states[6].state)), - 0) - << "incorrect value for states[6].state, expected 0, is " - << last_msg_->states[6].state; - EXPECT_LT((last_msg_->states[7].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[7].cn0, expected -1.0, is " - << last_msg_->states[7].cn0; - EXPECT_EQ(get_asstates[7].prn)>( - reinterpret_cast(&last_msg_->states[7].prn)), - 0) - << "incorrect value for states[7].prn, expected 0, is " - << last_msg_->states[7].prn; - EXPECT_EQ(get_asstates[7].state)>( - reinterpret_cast(&last_msg_->states[7].state)), - 0) - << "incorrect value for states[7].state, expected 0, is " - << last_msg_->states[7].state; - EXPECT_LT((last_msg_->states[8].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[8].cn0, expected -1.0, is " - << last_msg_->states[8].cn0; - EXPECT_EQ(get_asstates[8].prn)>( - reinterpret_cast(&last_msg_->states[8].prn)), - 0) - << "incorrect value for states[8].prn, expected 0, is " - << last_msg_->states[8].prn; - EXPECT_EQ(get_asstates[8].state)>( - reinterpret_cast(&last_msg_->states[8].state)), - 0) - << "incorrect value for states[8].state, expected 0, is " - << last_msg_->states[8].state; - EXPECT_LT((last_msg_->states[9].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[9].cn0, expected -1.0, is " - << last_msg_->states[9].cn0; - EXPECT_EQ(get_asstates[9].prn)>( - reinterpret_cast(&last_msg_->states[9].prn)), - 0) - << "incorrect value for states[9].prn, expected 0, is " - << last_msg_->states[9].prn; - EXPECT_EQ(get_asstates[9].state)>( - reinterpret_cast(&last_msg_->states[9].state)), - 0) - << "incorrect value for states[9].state, expected 0, is " - << last_msg_->states[9].state; - EXPECT_LT((last_msg_->states[10].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[10].cn0, expected -1.0, is " - << last_msg_->states[10].cn0; - EXPECT_EQ(get_asstates[10].prn)>( - reinterpret_cast(&last_msg_->states[10].prn)), - 0) - << "incorrect value for states[10].prn, expected 0, is " - << last_msg_->states[10].prn; - EXPECT_EQ( - get_asstates[10].state)>( - reinterpret_cast(&last_msg_->states[10].state)), - 0) - << "incorrect value for states[10].state, expected 0, is " - << last_msg_->states[10].state; -} -class Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA4 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA4() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA4, Test) { - uint8_t encoded_frame[] = { - 85, 22, 0, 195, 4, 66, 1, 0, 218, 14, 19, 66, 1, 2, 210, - 3, 21, 65, 1, 3, 234, 214, 134, 65, 0, 0, 0, 0, 128, 191, - 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, 0, 0, 0, - 0, 128, 191, 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, - 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, 84, 101, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_dep_a_t *test_msg = - (msg_tracking_state_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[0].cn0 = 36.764503479003906; - test_msg->states[0].prn = 0; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[1].cn0 = 9.313432693481445; - test_msg->states[1].prn = 2; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[2].cn0 = 16.854938507080078; - test_msg->states[2].prn = 3; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[3].cn0 = -1.0; - test_msg->states[3].prn = 0; - test_msg->states[3].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[4].cn0 = -1.0; - test_msg->states[4].prn = 0; - test_msg->states[4].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[5].cn0 = -1.0; - test_msg->states[5].prn = 0; - test_msg->states[5].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[6].cn0 = -1.0; - test_msg->states[6].prn = 0; - test_msg->states[6].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[7].cn0 = -1.0; - test_msg->states[7].prn = 0; - test_msg->states[7].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[8].cn0 = -1.0; - test_msg->states[8].prn = 0; - test_msg->states[8].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[9].cn0 = -1.0; - test_msg->states[9].prn = 0; - test_msg->states[9].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[10].cn0 = -1.0; - test_msg->states[10].prn = 0; - test_msg->states[10].state = 0; - - EXPECT_EQ(send_message(0x16, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->states[0].cn0 * 100 - 36.764503479 * 100), 0.05) - << "incorrect value for states[0].cn0, expected 36.764503479, is " - << last_msg_->states[0].cn0; - EXPECT_EQ(get_asstates[0].prn)>( - reinterpret_cast(&last_msg_->states[0].prn)), - 0) - << "incorrect value for states[0].prn, expected 0, is " - << last_msg_->states[0].prn; - EXPECT_EQ(get_asstates[0].state)>( - reinterpret_cast(&last_msg_->states[0].state)), - 1) - << "incorrect value for states[0].state, expected 1, is " - << last_msg_->states[0].state; - EXPECT_LT((last_msg_->states[1].cn0 * 100 - 9.31343269348 * 100), 0.05) - << "incorrect value for states[1].cn0, expected 9.31343269348, is " - << last_msg_->states[1].cn0; - EXPECT_EQ(get_asstates[1].prn)>( - reinterpret_cast(&last_msg_->states[1].prn)), - 2) - << "incorrect value for states[1].prn, expected 2, is " - << last_msg_->states[1].prn; - EXPECT_EQ(get_asstates[1].state)>( - reinterpret_cast(&last_msg_->states[1].state)), - 1) - << "incorrect value for states[1].state, expected 1, is " - << last_msg_->states[1].state; - EXPECT_LT((last_msg_->states[2].cn0 * 100 - 16.8549385071 * 100), 0.05) - << "incorrect value for states[2].cn0, expected 16.8549385071, is " - << last_msg_->states[2].cn0; - EXPECT_EQ(get_asstates[2].prn)>( - reinterpret_cast(&last_msg_->states[2].prn)), - 3) - << "incorrect value for states[2].prn, expected 3, is " - << last_msg_->states[2].prn; - EXPECT_EQ(get_asstates[2].state)>( - reinterpret_cast(&last_msg_->states[2].state)), - 1) - << "incorrect value for states[2].state, expected 1, is " - << last_msg_->states[2].state; - EXPECT_LT((last_msg_->states[3].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[3].cn0, expected -1.0, is " - << last_msg_->states[3].cn0; - EXPECT_EQ(get_asstates[3].prn)>( - reinterpret_cast(&last_msg_->states[3].prn)), - 0) - << "incorrect value for states[3].prn, expected 0, is " - << last_msg_->states[3].prn; - EXPECT_EQ(get_asstates[3].state)>( - reinterpret_cast(&last_msg_->states[3].state)), - 0) - << "incorrect value for states[3].state, expected 0, is " - << last_msg_->states[3].state; - EXPECT_LT((last_msg_->states[4].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[4].cn0, expected -1.0, is " - << last_msg_->states[4].cn0; - EXPECT_EQ(get_asstates[4].prn)>( - reinterpret_cast(&last_msg_->states[4].prn)), - 0) - << "incorrect value for states[4].prn, expected 0, is " - << last_msg_->states[4].prn; - EXPECT_EQ(get_asstates[4].state)>( - reinterpret_cast(&last_msg_->states[4].state)), - 0) - << "incorrect value for states[4].state, expected 0, is " - << last_msg_->states[4].state; - EXPECT_LT((last_msg_->states[5].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[5].cn0, expected -1.0, is " - << last_msg_->states[5].cn0; - EXPECT_EQ(get_asstates[5].prn)>( - reinterpret_cast(&last_msg_->states[5].prn)), - 0) - << "incorrect value for states[5].prn, expected 0, is " - << last_msg_->states[5].prn; - EXPECT_EQ(get_asstates[5].state)>( - reinterpret_cast(&last_msg_->states[5].state)), - 0) - << "incorrect value for states[5].state, expected 0, is " - << last_msg_->states[5].state; - EXPECT_LT((last_msg_->states[6].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[6].cn0, expected -1.0, is " - << last_msg_->states[6].cn0; - EXPECT_EQ(get_asstates[6].prn)>( - reinterpret_cast(&last_msg_->states[6].prn)), - 0) - << "incorrect value for states[6].prn, expected 0, is " - << last_msg_->states[6].prn; - EXPECT_EQ(get_asstates[6].state)>( - reinterpret_cast(&last_msg_->states[6].state)), - 0) - << "incorrect value for states[6].state, expected 0, is " - << last_msg_->states[6].state; - EXPECT_LT((last_msg_->states[7].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[7].cn0, expected -1.0, is " - << last_msg_->states[7].cn0; - EXPECT_EQ(get_asstates[7].prn)>( - reinterpret_cast(&last_msg_->states[7].prn)), - 0) - << "incorrect value for states[7].prn, expected 0, is " - << last_msg_->states[7].prn; - EXPECT_EQ(get_asstates[7].state)>( - reinterpret_cast(&last_msg_->states[7].state)), - 0) - << "incorrect value for states[7].state, expected 0, is " - << last_msg_->states[7].state; - EXPECT_LT((last_msg_->states[8].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[8].cn0, expected -1.0, is " - << last_msg_->states[8].cn0; - EXPECT_EQ(get_asstates[8].prn)>( - reinterpret_cast(&last_msg_->states[8].prn)), - 0) - << "incorrect value for states[8].prn, expected 0, is " - << last_msg_->states[8].prn; - EXPECT_EQ(get_asstates[8].state)>( - reinterpret_cast(&last_msg_->states[8].state)), - 0) - << "incorrect value for states[8].state, expected 0, is " - << last_msg_->states[8].state; - EXPECT_LT((last_msg_->states[9].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[9].cn0, expected -1.0, is " - << last_msg_->states[9].cn0; - EXPECT_EQ(get_asstates[9].prn)>( - reinterpret_cast(&last_msg_->states[9].prn)), - 0) - << "incorrect value for states[9].prn, expected 0, is " - << last_msg_->states[9].prn; - EXPECT_EQ(get_asstates[9].state)>( - reinterpret_cast(&last_msg_->states[9].state)), - 0) - << "incorrect value for states[9].state, expected 0, is " - << last_msg_->states[9].state; - EXPECT_LT((last_msg_->states[10].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[10].cn0, expected -1.0, is " - << last_msg_->states[10].cn0; - EXPECT_EQ(get_asstates[10].prn)>( - reinterpret_cast(&last_msg_->states[10].prn)), - 0) - << "incorrect value for states[10].prn, expected 0, is " - << last_msg_->states[10].prn; - EXPECT_EQ( - get_asstates[10].state)>( - reinterpret_cast(&last_msg_->states[10].state)), - 0) - << "incorrect value for states[10].state, expected 0, is " - << last_msg_->states[10].state; -} -class Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA5 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA5() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_( - reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_tracking_state_dep_a_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_tracking_state_dep_a_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_tracking_MsgtrackingStateDepA5, Test) { - uint8_t encoded_frame[] = { - 85, 22, 0, 195, 4, 66, 1, 0, 98, 39, 219, 65, 1, 2, 0, - 0, 56, 64, 1, 3, 121, 123, 7, 65, 0, 0, 0, 0, 128, 191, - 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, 0, 0, 0, - 0, 128, 191, 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, - 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 128, 191, 37, 123, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_tracking_state_dep_a_t *test_msg = - (msg_tracking_state_dep_a_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[0].cn0 = 27.394229888916016; - test_msg->states[0].prn = 0; - test_msg->states[0].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[1].cn0 = 2.875; - test_msg->states[1].prn = 2; - test_msg->states[1].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[2].cn0 = 8.467644691467285; - test_msg->states[2].prn = 3; - test_msg->states[2].state = 1; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[3].cn0 = -1.0; - test_msg->states[3].prn = 0; - test_msg->states[3].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[4].cn0 = -1.0; - test_msg->states[4].prn = 0; - test_msg->states[4].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[5].cn0 = -1.0; - test_msg->states[5].prn = 0; - test_msg->states[5].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[6].cn0 = -1.0; - test_msg->states[6].prn = 0; - test_msg->states[6].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[7].cn0 = -1.0; - test_msg->states[7].prn = 0; - test_msg->states[7].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[8].cn0 = -1.0; - test_msg->states[8].prn = 0; - test_msg->states[8].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[9].cn0 = -1.0; - test_msg->states[9].prn = 0; - test_msg->states[9].state = 0; - if (sizeof(test_msg->states) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->states[0])); - } - test_msg->states[10].cn0 = -1.0; - test_msg->states[10].prn = 0; - test_msg->states[10].state = 0; - - EXPECT_EQ(send_message(0x16, 1219, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 1219); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_LT((last_msg_->states[0].cn0 * 100 - 27.3942298889 * 100), 0.05) - << "incorrect value for states[0].cn0, expected 27.3942298889, is " - << last_msg_->states[0].cn0; - EXPECT_EQ(get_asstates[0].prn)>( - reinterpret_cast(&last_msg_->states[0].prn)), - 0) - << "incorrect value for states[0].prn, expected 0, is " - << last_msg_->states[0].prn; - EXPECT_EQ(get_asstates[0].state)>( - reinterpret_cast(&last_msg_->states[0].state)), - 1) - << "incorrect value for states[0].state, expected 1, is " - << last_msg_->states[0].state; - EXPECT_LT((last_msg_->states[1].cn0 * 100 - 2.875 * 100), 0.05) - << "incorrect value for states[1].cn0, expected 2.875, is " - << last_msg_->states[1].cn0; - EXPECT_EQ(get_asstates[1].prn)>( - reinterpret_cast(&last_msg_->states[1].prn)), - 2) - << "incorrect value for states[1].prn, expected 2, is " - << last_msg_->states[1].prn; - EXPECT_EQ(get_asstates[1].state)>( - reinterpret_cast(&last_msg_->states[1].state)), - 1) - << "incorrect value for states[1].state, expected 1, is " - << last_msg_->states[1].state; - EXPECT_LT((last_msg_->states[2].cn0 * 100 - 8.46764469147 * 100), 0.05) - << "incorrect value for states[2].cn0, expected 8.46764469147, is " - << last_msg_->states[2].cn0; - EXPECT_EQ(get_asstates[2].prn)>( - reinterpret_cast(&last_msg_->states[2].prn)), - 3) - << "incorrect value for states[2].prn, expected 3, is " - << last_msg_->states[2].prn; - EXPECT_EQ(get_asstates[2].state)>( - reinterpret_cast(&last_msg_->states[2].state)), - 1) - << "incorrect value for states[2].state, expected 1, is " - << last_msg_->states[2].state; - EXPECT_LT((last_msg_->states[3].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[3].cn0, expected -1.0, is " - << last_msg_->states[3].cn0; - EXPECT_EQ(get_asstates[3].prn)>( - reinterpret_cast(&last_msg_->states[3].prn)), - 0) - << "incorrect value for states[3].prn, expected 0, is " - << last_msg_->states[3].prn; - EXPECT_EQ(get_asstates[3].state)>( - reinterpret_cast(&last_msg_->states[3].state)), - 0) - << "incorrect value for states[3].state, expected 0, is " - << last_msg_->states[3].state; - EXPECT_LT((last_msg_->states[4].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[4].cn0, expected -1.0, is " - << last_msg_->states[4].cn0; - EXPECT_EQ(get_asstates[4].prn)>( - reinterpret_cast(&last_msg_->states[4].prn)), - 0) - << "incorrect value for states[4].prn, expected 0, is " - << last_msg_->states[4].prn; - EXPECT_EQ(get_asstates[4].state)>( - reinterpret_cast(&last_msg_->states[4].state)), - 0) - << "incorrect value for states[4].state, expected 0, is " - << last_msg_->states[4].state; - EXPECT_LT((last_msg_->states[5].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[5].cn0, expected -1.0, is " - << last_msg_->states[5].cn0; - EXPECT_EQ(get_asstates[5].prn)>( - reinterpret_cast(&last_msg_->states[5].prn)), - 0) - << "incorrect value for states[5].prn, expected 0, is " - << last_msg_->states[5].prn; - EXPECT_EQ(get_asstates[5].state)>( - reinterpret_cast(&last_msg_->states[5].state)), - 0) - << "incorrect value for states[5].state, expected 0, is " - << last_msg_->states[5].state; - EXPECT_LT((last_msg_->states[6].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[6].cn0, expected -1.0, is " - << last_msg_->states[6].cn0; - EXPECT_EQ(get_asstates[6].prn)>( - reinterpret_cast(&last_msg_->states[6].prn)), - 0) - << "incorrect value for states[6].prn, expected 0, is " - << last_msg_->states[6].prn; - EXPECT_EQ(get_asstates[6].state)>( - reinterpret_cast(&last_msg_->states[6].state)), - 0) - << "incorrect value for states[6].state, expected 0, is " - << last_msg_->states[6].state; - EXPECT_LT((last_msg_->states[7].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[7].cn0, expected -1.0, is " - << last_msg_->states[7].cn0; - EXPECT_EQ(get_asstates[7].prn)>( - reinterpret_cast(&last_msg_->states[7].prn)), - 0) - << "incorrect value for states[7].prn, expected 0, is " - << last_msg_->states[7].prn; - EXPECT_EQ(get_asstates[7].state)>( - reinterpret_cast(&last_msg_->states[7].state)), - 0) - << "incorrect value for states[7].state, expected 0, is " - << last_msg_->states[7].state; - EXPECT_LT((last_msg_->states[8].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[8].cn0, expected -1.0, is " - << last_msg_->states[8].cn0; - EXPECT_EQ(get_asstates[8].prn)>( - reinterpret_cast(&last_msg_->states[8].prn)), - 0) - << "incorrect value for states[8].prn, expected 0, is " - << last_msg_->states[8].prn; - EXPECT_EQ(get_asstates[8].state)>( - reinterpret_cast(&last_msg_->states[8].state)), - 0) - << "incorrect value for states[8].state, expected 0, is " - << last_msg_->states[8].state; - EXPECT_LT((last_msg_->states[9].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[9].cn0, expected -1.0, is " - << last_msg_->states[9].cn0; - EXPECT_EQ(get_asstates[9].prn)>( - reinterpret_cast(&last_msg_->states[9].prn)), - 0) - << "incorrect value for states[9].prn, expected 0, is " - << last_msg_->states[9].prn; - EXPECT_EQ(get_asstates[9].state)>( - reinterpret_cast(&last_msg_->states[9].state)), - 0) - << "incorrect value for states[9].state, expected 0, is " - << last_msg_->states[9].state; - EXPECT_LT((last_msg_->states[10].cn0 * 100 - -1.0 * 100), 0.05) - << "incorrect value for states[10].cn0, expected -1.0, is " - << last_msg_->states[10].cn0; - EXPECT_EQ(get_asstates[10].prn)>( - reinterpret_cast(&last_msg_->states[10].prn)), - 0) - << "incorrect value for states[10].prn, expected 0, is " - << last_msg_->states[10].prn; - EXPECT_EQ( - get_asstates[10].state)>( - reinterpret_cast(&last_msg_->states[10].state)), - 0) - << "incorrect value for states[10].state, expected 0, is " - << last_msg_->states[10].state; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_user_MsgUserData.cc b/c/test/legacy/cpp/auto_check_sbp_user_MsgUserData.cc deleted file mode 100644 index 3ec39ce4f6..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_user_MsgUserData.cc +++ /dev/null @@ -1,2686 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/user/test_MsgUserData.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_user_MsgUserData0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_user_MsgUserData0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_user_data_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_user_data_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_user_MsgUserData0, Test) { - uint8_t encoded_frame[] = { - 85, 0, 8, 126, 33, 255, 53, 5, 172, 138, 50, 49, 206, 234, 149, - 204, 113, 31, 108, 188, 179, 154, 156, 167, 145, 139, 42, 207, 126, 242, - 193, 9, 58, 75, 8, 135, 11, 92, 131, 245, 24, 90, 255, 30, 58, - 31, 109, 148, 56, 178, 140, 30, 159, 70, 17, 170, 50, 148, 1, 99, - 112, 88, 217, 36, 84, 34, 234, 82, 144, 144, 97, 96, 75, 174, 58, - 219, 180, 148, 247, 59, 2, 116, 214, 114, 55, 134, 54, 119, 108, 128, - 73, 181, 20, 233, 23, 23, 73, 119, 136, 231, 189, 26, 174, 128, 93, - 30, 76, 45, 109, 134, 81, 0, 116, 158, 127, 40, 133, 208, 134, 127, - 140, 232, 183, 184, 108, 6, 228, 54, 238, 59, 220, 30, 228, 212, 50, - 182, 97, 20, 41, 76, 227, 88, 12, 95, 112, 209, 183, 127, 4, 165, - 189, 44, 239, 232, 132, 9, 114, 184, 249, 208, 246, 194, 250, 2, 97, - 173, 157, 202, 172, 180, 150, 213, 193, 177, 209, 156, 20, 174, 18, 73, - 132, 215, 115, 128, 175, 169, 116, 132, 100, 72, 45, 25, 14, 205, 213, - 145, 68, 137, 249, 54, 40, 174, 215, 148, 166, 190, 63, 118, 6, 165, - 212, 74, 68, 200, 38, 139, 212, 112, 45, 167, 236, 255, 106, 92, 132, - 59, 61, 233, 3, 246, 158, 83, 134, 246, 154, 17, 0, 6, 56, 216, - 19, 216, 70, 71, 161, 184, 5, 177, 45, 37, 98, 56, 149, 0, 73, - 221, 105, 239, 168, 205, 85, 81, 245, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_user_data_t *test_msg = (msg_user_data_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[0] = 53; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[1] = 5; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[2] = 172; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[3] = 138; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[4] = 50; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[5] = 49; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[6] = 206; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[7] = 234; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[8] = 149; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[9] = 204; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[10] = 113; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[11] = 31; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[12] = 108; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[13] = 188; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[14] = 179; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[15] = 154; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[16] = 156; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[17] = 167; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[18] = 145; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[19] = 139; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[20] = 42; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[21] = 207; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[22] = 126; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[23] = 242; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[24] = 193; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[25] = 9; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[26] = 58; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[27] = 75; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[28] = 8; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[29] = 135; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[30] = 11; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[31] = 92; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[32] = 131; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[33] = 245; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[34] = 24; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[35] = 90; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[36] = 255; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[37] = 30; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[38] = 58; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[39] = 31; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[40] = 109; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[41] = 148; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[42] = 56; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[43] = 178; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[44] = 140; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[45] = 30; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[46] = 159; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[47] = 70; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[48] = 17; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[49] = 170; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[50] = 50; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[51] = 148; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[52] = 1; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[53] = 99; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[54] = 112; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[55] = 88; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[56] = 217; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[57] = 36; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[58] = 84; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[59] = 34; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[60] = 234; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[61] = 82; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[62] = 144; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[63] = 144; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[64] = 97; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[65] = 96; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[66] = 75; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[67] = 174; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[68] = 58; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[69] = 219; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[70] = 180; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[71] = 148; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[72] = 247; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[73] = 59; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[74] = 2; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[75] = 116; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[76] = 214; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[77] = 114; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[78] = 55; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[79] = 134; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[80] = 54; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[81] = 119; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[82] = 108; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[83] = 128; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[84] = 73; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[85] = 181; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[86] = 20; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[87] = 233; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[88] = 23; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[89] = 23; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[90] = 73; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[91] = 119; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[92] = 136; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[93] = 231; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[94] = 189; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[95] = 26; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[96] = 174; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[97] = 128; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[98] = 93; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[99] = 30; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[100] = 76; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[101] = 45; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[102] = 109; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[103] = 134; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[104] = 81; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[105] = 0; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[106] = 116; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[107] = 158; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[108] = 127; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[109] = 40; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[110] = 133; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[111] = 208; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[112] = 134; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[113] = 127; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[114] = 140; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[115] = 232; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[116] = 183; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[117] = 184; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[118] = 108; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[119] = 6; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[120] = 228; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[121] = 54; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[122] = 238; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[123] = 59; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[124] = 220; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[125] = 30; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[126] = 228; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[127] = 212; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[128] = 50; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[129] = 182; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[130] = 97; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[131] = 20; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[132] = 41; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[133] = 76; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[134] = 227; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[135] = 88; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[136] = 12; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[137] = 95; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[138] = 112; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[139] = 209; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[140] = 183; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[141] = 127; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[142] = 4; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[143] = 165; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[144] = 189; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[145] = 44; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[146] = 239; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[147] = 232; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[148] = 132; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[149] = 9; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[150] = 114; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[151] = 184; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[152] = 249; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[153] = 208; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[154] = 246; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[155] = 194; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[156] = 250; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[157] = 2; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[158] = 97; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[159] = 173; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[160] = 157; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[161] = 202; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[162] = 172; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[163] = 180; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[164] = 150; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[165] = 213; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[166] = 193; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[167] = 177; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[168] = 209; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[169] = 156; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[170] = 20; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[171] = 174; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[172] = 18; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[173] = 73; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[174] = 132; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[175] = 215; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[176] = 115; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[177] = 128; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[178] = 175; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[179] = 169; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[180] = 116; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[181] = 132; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[182] = 100; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[183] = 72; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[184] = 45; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[185] = 25; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[186] = 14; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[187] = 205; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[188] = 213; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[189] = 145; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[190] = 68; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[191] = 137; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[192] = 249; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[193] = 54; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[194] = 40; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[195] = 174; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[196] = 215; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[197] = 148; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[198] = 166; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[199] = 190; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[200] = 63; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[201] = 118; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[202] = 6; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[203] = 165; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[204] = 212; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[205] = 74; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[206] = 68; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[207] = 200; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[208] = 38; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[209] = 139; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[210] = 212; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[211] = 112; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[212] = 45; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[213] = 167; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[214] = 236; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[215] = 255; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[216] = 106; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[217] = 92; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[218] = 132; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[219] = 59; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[220] = 61; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[221] = 233; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[222] = 3; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[223] = 246; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[224] = 158; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[225] = 83; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[226] = 134; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[227] = 246; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[228] = 154; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[229] = 17; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[230] = 0; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[231] = 6; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[232] = 56; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[233] = 216; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[234] = 19; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[235] = 216; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[236] = 70; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[237] = 71; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[238] = 161; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[239] = 184; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[240] = 5; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[241] = 177; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[242] = 45; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[243] = 37; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[244] = 98; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[245] = 56; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[246] = 149; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[247] = 0; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[248] = 73; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[249] = 221; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[250] = 105; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[251] = 239; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[252] = 168; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[253] = 205; - if (sizeof(test_msg->contents) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->contents[0])); - } - test_msg->contents[254] = 85; - - EXPECT_EQ(send_message(0x800, 8574, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 8574); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_ascontents[0])>( - reinterpret_cast(&last_msg_->contents[0])), - 53) - << "incorrect value for contents[0], expected 53, is " - << last_msg_->contents[0]; - EXPECT_EQ(get_ascontents[1])>( - reinterpret_cast(&last_msg_->contents[1])), - 5) - << "incorrect value for contents[1], expected 5, is " - << last_msg_->contents[1]; - EXPECT_EQ(get_ascontents[2])>( - reinterpret_cast(&last_msg_->contents[2])), - 172) - << "incorrect value for contents[2], expected 172, is " - << last_msg_->contents[2]; - EXPECT_EQ(get_ascontents[3])>( - reinterpret_cast(&last_msg_->contents[3])), - 138) - << "incorrect value for contents[3], expected 138, is " - << last_msg_->contents[3]; - EXPECT_EQ(get_ascontents[4])>( - reinterpret_cast(&last_msg_->contents[4])), - 50) - << "incorrect value for contents[4], expected 50, is " - << last_msg_->contents[4]; - EXPECT_EQ(get_ascontents[5])>( - reinterpret_cast(&last_msg_->contents[5])), - 49) - << "incorrect value for contents[5], expected 49, is " - << last_msg_->contents[5]; - EXPECT_EQ(get_ascontents[6])>( - reinterpret_cast(&last_msg_->contents[6])), - 206) - << "incorrect value for contents[6], expected 206, is " - << last_msg_->contents[6]; - EXPECT_EQ(get_ascontents[7])>( - reinterpret_cast(&last_msg_->contents[7])), - 234) - << "incorrect value for contents[7], expected 234, is " - << last_msg_->contents[7]; - EXPECT_EQ(get_ascontents[8])>( - reinterpret_cast(&last_msg_->contents[8])), - 149) - << "incorrect value for contents[8], expected 149, is " - << last_msg_->contents[8]; - EXPECT_EQ(get_ascontents[9])>( - reinterpret_cast(&last_msg_->contents[9])), - 204) - << "incorrect value for contents[9], expected 204, is " - << last_msg_->contents[9]; - EXPECT_EQ(get_ascontents[10])>( - reinterpret_cast(&last_msg_->contents[10])), - 113) - << "incorrect value for contents[10], expected 113, is " - << last_msg_->contents[10]; - EXPECT_EQ(get_ascontents[11])>( - reinterpret_cast(&last_msg_->contents[11])), - 31) - << "incorrect value for contents[11], expected 31, is " - << last_msg_->contents[11]; - EXPECT_EQ(get_ascontents[12])>( - reinterpret_cast(&last_msg_->contents[12])), - 108) - << "incorrect value for contents[12], expected 108, is " - << last_msg_->contents[12]; - EXPECT_EQ(get_ascontents[13])>( - reinterpret_cast(&last_msg_->contents[13])), - 188) - << "incorrect value for contents[13], expected 188, is " - << last_msg_->contents[13]; - EXPECT_EQ(get_ascontents[14])>( - reinterpret_cast(&last_msg_->contents[14])), - 179) - << "incorrect value for contents[14], expected 179, is " - << last_msg_->contents[14]; - EXPECT_EQ(get_ascontents[15])>( - reinterpret_cast(&last_msg_->contents[15])), - 154) - << "incorrect value for contents[15], expected 154, is " - << last_msg_->contents[15]; - EXPECT_EQ(get_ascontents[16])>( - reinterpret_cast(&last_msg_->contents[16])), - 156) - << "incorrect value for contents[16], expected 156, is " - << last_msg_->contents[16]; - EXPECT_EQ(get_ascontents[17])>( - reinterpret_cast(&last_msg_->contents[17])), - 167) - << "incorrect value for contents[17], expected 167, is " - << last_msg_->contents[17]; - EXPECT_EQ(get_ascontents[18])>( - reinterpret_cast(&last_msg_->contents[18])), - 145) - << "incorrect value for contents[18], expected 145, is " - << last_msg_->contents[18]; - EXPECT_EQ(get_ascontents[19])>( - reinterpret_cast(&last_msg_->contents[19])), - 139) - << "incorrect value for contents[19], expected 139, is " - << last_msg_->contents[19]; - EXPECT_EQ(get_ascontents[20])>( - reinterpret_cast(&last_msg_->contents[20])), - 42) - << "incorrect value for contents[20], expected 42, is " - << last_msg_->contents[20]; - EXPECT_EQ(get_ascontents[21])>( - reinterpret_cast(&last_msg_->contents[21])), - 207) - << "incorrect value for contents[21], expected 207, is " - << last_msg_->contents[21]; - EXPECT_EQ(get_ascontents[22])>( - reinterpret_cast(&last_msg_->contents[22])), - 126) - << "incorrect value for contents[22], expected 126, is " - << last_msg_->contents[22]; - EXPECT_EQ(get_ascontents[23])>( - reinterpret_cast(&last_msg_->contents[23])), - 242) - << "incorrect value for contents[23], expected 242, is " - << last_msg_->contents[23]; - EXPECT_EQ(get_ascontents[24])>( - reinterpret_cast(&last_msg_->contents[24])), - 193) - << "incorrect value for contents[24], expected 193, is " - << last_msg_->contents[24]; - EXPECT_EQ(get_ascontents[25])>( - reinterpret_cast(&last_msg_->contents[25])), - 9) - << "incorrect value for contents[25], expected 9, is " - << last_msg_->contents[25]; - EXPECT_EQ(get_ascontents[26])>( - reinterpret_cast(&last_msg_->contents[26])), - 58) - << "incorrect value for contents[26], expected 58, is " - << last_msg_->contents[26]; - EXPECT_EQ(get_ascontents[27])>( - reinterpret_cast(&last_msg_->contents[27])), - 75) - << "incorrect value for contents[27], expected 75, is " - << last_msg_->contents[27]; - EXPECT_EQ(get_ascontents[28])>( - reinterpret_cast(&last_msg_->contents[28])), - 8) - << "incorrect value for contents[28], expected 8, is " - << last_msg_->contents[28]; - EXPECT_EQ(get_ascontents[29])>( - reinterpret_cast(&last_msg_->contents[29])), - 135) - << "incorrect value for contents[29], expected 135, is " - << last_msg_->contents[29]; - EXPECT_EQ(get_ascontents[30])>( - reinterpret_cast(&last_msg_->contents[30])), - 11) - << "incorrect value for contents[30], expected 11, is " - << last_msg_->contents[30]; - EXPECT_EQ(get_ascontents[31])>( - reinterpret_cast(&last_msg_->contents[31])), - 92) - << "incorrect value for contents[31], expected 92, is " - << last_msg_->contents[31]; - EXPECT_EQ(get_ascontents[32])>( - reinterpret_cast(&last_msg_->contents[32])), - 131) - << "incorrect value for contents[32], expected 131, is " - << last_msg_->contents[32]; - EXPECT_EQ(get_ascontents[33])>( - reinterpret_cast(&last_msg_->contents[33])), - 245) - << "incorrect value for contents[33], expected 245, is " - << last_msg_->contents[33]; - EXPECT_EQ(get_ascontents[34])>( - reinterpret_cast(&last_msg_->contents[34])), - 24) - << "incorrect value for contents[34], expected 24, is " - << last_msg_->contents[34]; - EXPECT_EQ(get_ascontents[35])>( - reinterpret_cast(&last_msg_->contents[35])), - 90) - << "incorrect value for contents[35], expected 90, is " - << last_msg_->contents[35]; - EXPECT_EQ(get_ascontents[36])>( - reinterpret_cast(&last_msg_->contents[36])), - 255) - << "incorrect value for contents[36], expected 255, is " - << last_msg_->contents[36]; - EXPECT_EQ(get_ascontents[37])>( - reinterpret_cast(&last_msg_->contents[37])), - 30) - << "incorrect value for contents[37], expected 30, is " - << last_msg_->contents[37]; - EXPECT_EQ(get_ascontents[38])>( - reinterpret_cast(&last_msg_->contents[38])), - 58) - << "incorrect value for contents[38], expected 58, is " - << last_msg_->contents[38]; - EXPECT_EQ(get_ascontents[39])>( - reinterpret_cast(&last_msg_->contents[39])), - 31) - << "incorrect value for contents[39], expected 31, is " - << last_msg_->contents[39]; - EXPECT_EQ(get_ascontents[40])>( - reinterpret_cast(&last_msg_->contents[40])), - 109) - << "incorrect value for contents[40], expected 109, is " - << last_msg_->contents[40]; - EXPECT_EQ(get_ascontents[41])>( - reinterpret_cast(&last_msg_->contents[41])), - 148) - << "incorrect value for contents[41], expected 148, is " - << last_msg_->contents[41]; - EXPECT_EQ(get_ascontents[42])>( - reinterpret_cast(&last_msg_->contents[42])), - 56) - << "incorrect value for contents[42], expected 56, is " - << last_msg_->contents[42]; - EXPECT_EQ(get_ascontents[43])>( - reinterpret_cast(&last_msg_->contents[43])), - 178) - << "incorrect value for contents[43], expected 178, is " - << last_msg_->contents[43]; - EXPECT_EQ(get_ascontents[44])>( - reinterpret_cast(&last_msg_->contents[44])), - 140) - << "incorrect value for contents[44], expected 140, is " - << last_msg_->contents[44]; - EXPECT_EQ(get_ascontents[45])>( - reinterpret_cast(&last_msg_->contents[45])), - 30) - << "incorrect value for contents[45], expected 30, is " - << last_msg_->contents[45]; - EXPECT_EQ(get_ascontents[46])>( - reinterpret_cast(&last_msg_->contents[46])), - 159) - << "incorrect value for contents[46], expected 159, is " - << last_msg_->contents[46]; - EXPECT_EQ(get_ascontents[47])>( - reinterpret_cast(&last_msg_->contents[47])), - 70) - << "incorrect value for contents[47], expected 70, is " - << last_msg_->contents[47]; - EXPECT_EQ(get_ascontents[48])>( - reinterpret_cast(&last_msg_->contents[48])), - 17) - << "incorrect value for contents[48], expected 17, is " - << last_msg_->contents[48]; - EXPECT_EQ(get_ascontents[49])>( - reinterpret_cast(&last_msg_->contents[49])), - 170) - << "incorrect value for contents[49], expected 170, is " - << last_msg_->contents[49]; - EXPECT_EQ(get_ascontents[50])>( - reinterpret_cast(&last_msg_->contents[50])), - 50) - << "incorrect value for contents[50], expected 50, is " - << last_msg_->contents[50]; - EXPECT_EQ(get_ascontents[51])>( - reinterpret_cast(&last_msg_->contents[51])), - 148) - << "incorrect value for contents[51], expected 148, is " - << last_msg_->contents[51]; - EXPECT_EQ(get_ascontents[52])>( - reinterpret_cast(&last_msg_->contents[52])), - 1) - << "incorrect value for contents[52], expected 1, is " - << last_msg_->contents[52]; - EXPECT_EQ(get_ascontents[53])>( - reinterpret_cast(&last_msg_->contents[53])), - 99) - << "incorrect value for contents[53], expected 99, is " - << last_msg_->contents[53]; - EXPECT_EQ(get_ascontents[54])>( - reinterpret_cast(&last_msg_->contents[54])), - 112) - << "incorrect value for contents[54], expected 112, is " - << last_msg_->contents[54]; - EXPECT_EQ(get_ascontents[55])>( - reinterpret_cast(&last_msg_->contents[55])), - 88) - << "incorrect value for contents[55], expected 88, is " - << last_msg_->contents[55]; - EXPECT_EQ(get_ascontents[56])>( - reinterpret_cast(&last_msg_->contents[56])), - 217) - << "incorrect value for contents[56], expected 217, is " - << last_msg_->contents[56]; - EXPECT_EQ(get_ascontents[57])>( - reinterpret_cast(&last_msg_->contents[57])), - 36) - << "incorrect value for contents[57], expected 36, is " - << last_msg_->contents[57]; - EXPECT_EQ(get_ascontents[58])>( - reinterpret_cast(&last_msg_->contents[58])), - 84) - << "incorrect value for contents[58], expected 84, is " - << last_msg_->contents[58]; - EXPECT_EQ(get_ascontents[59])>( - reinterpret_cast(&last_msg_->contents[59])), - 34) - << "incorrect value for contents[59], expected 34, is " - << last_msg_->contents[59]; - EXPECT_EQ(get_ascontents[60])>( - reinterpret_cast(&last_msg_->contents[60])), - 234) - << "incorrect value for contents[60], expected 234, is " - << last_msg_->contents[60]; - EXPECT_EQ(get_ascontents[61])>( - reinterpret_cast(&last_msg_->contents[61])), - 82) - << "incorrect value for contents[61], expected 82, is " - << last_msg_->contents[61]; - EXPECT_EQ(get_ascontents[62])>( - reinterpret_cast(&last_msg_->contents[62])), - 144) - << "incorrect value for contents[62], expected 144, is " - << last_msg_->contents[62]; - EXPECT_EQ(get_ascontents[63])>( - reinterpret_cast(&last_msg_->contents[63])), - 144) - << "incorrect value for contents[63], expected 144, is " - << last_msg_->contents[63]; - EXPECT_EQ(get_ascontents[64])>( - reinterpret_cast(&last_msg_->contents[64])), - 97) - << "incorrect value for contents[64], expected 97, is " - << last_msg_->contents[64]; - EXPECT_EQ(get_ascontents[65])>( - reinterpret_cast(&last_msg_->contents[65])), - 96) - << "incorrect value for contents[65], expected 96, is " - << last_msg_->contents[65]; - EXPECT_EQ(get_ascontents[66])>( - reinterpret_cast(&last_msg_->contents[66])), - 75) - << "incorrect value for contents[66], expected 75, is " - << last_msg_->contents[66]; - EXPECT_EQ(get_ascontents[67])>( - reinterpret_cast(&last_msg_->contents[67])), - 174) - << "incorrect value for contents[67], expected 174, is " - << last_msg_->contents[67]; - EXPECT_EQ(get_ascontents[68])>( - reinterpret_cast(&last_msg_->contents[68])), - 58) - << "incorrect value for contents[68], expected 58, is " - << last_msg_->contents[68]; - EXPECT_EQ(get_ascontents[69])>( - reinterpret_cast(&last_msg_->contents[69])), - 219) - << "incorrect value for contents[69], expected 219, is " - << last_msg_->contents[69]; - EXPECT_EQ(get_ascontents[70])>( - reinterpret_cast(&last_msg_->contents[70])), - 180) - << "incorrect value for contents[70], expected 180, is " - << last_msg_->contents[70]; - EXPECT_EQ(get_ascontents[71])>( - reinterpret_cast(&last_msg_->contents[71])), - 148) - << "incorrect value for contents[71], expected 148, is " - << last_msg_->contents[71]; - EXPECT_EQ(get_ascontents[72])>( - reinterpret_cast(&last_msg_->contents[72])), - 247) - << "incorrect value for contents[72], expected 247, is " - << last_msg_->contents[72]; - EXPECT_EQ(get_ascontents[73])>( - reinterpret_cast(&last_msg_->contents[73])), - 59) - << "incorrect value for contents[73], expected 59, is " - << last_msg_->contents[73]; - EXPECT_EQ(get_ascontents[74])>( - reinterpret_cast(&last_msg_->contents[74])), - 2) - << "incorrect value for contents[74], expected 2, is " - << last_msg_->contents[74]; - EXPECT_EQ(get_ascontents[75])>( - reinterpret_cast(&last_msg_->contents[75])), - 116) - << "incorrect value for contents[75], expected 116, is " - << last_msg_->contents[75]; - EXPECT_EQ(get_ascontents[76])>( - reinterpret_cast(&last_msg_->contents[76])), - 214) - << "incorrect value for contents[76], expected 214, is " - << last_msg_->contents[76]; - EXPECT_EQ(get_ascontents[77])>( - reinterpret_cast(&last_msg_->contents[77])), - 114) - << "incorrect value for contents[77], expected 114, is " - << last_msg_->contents[77]; - EXPECT_EQ(get_ascontents[78])>( - reinterpret_cast(&last_msg_->contents[78])), - 55) - << "incorrect value for contents[78], expected 55, is " - << last_msg_->contents[78]; - EXPECT_EQ(get_ascontents[79])>( - reinterpret_cast(&last_msg_->contents[79])), - 134) - << "incorrect value for contents[79], expected 134, is " - << last_msg_->contents[79]; - EXPECT_EQ(get_ascontents[80])>( - reinterpret_cast(&last_msg_->contents[80])), - 54) - << "incorrect value for contents[80], expected 54, is " - << last_msg_->contents[80]; - EXPECT_EQ(get_ascontents[81])>( - reinterpret_cast(&last_msg_->contents[81])), - 119) - << "incorrect value for contents[81], expected 119, is " - << last_msg_->contents[81]; - EXPECT_EQ(get_ascontents[82])>( - reinterpret_cast(&last_msg_->contents[82])), - 108) - << "incorrect value for contents[82], expected 108, is " - << last_msg_->contents[82]; - EXPECT_EQ(get_ascontents[83])>( - reinterpret_cast(&last_msg_->contents[83])), - 128) - << "incorrect value for contents[83], expected 128, is " - << last_msg_->contents[83]; - EXPECT_EQ(get_ascontents[84])>( - reinterpret_cast(&last_msg_->contents[84])), - 73) - << "incorrect value for contents[84], expected 73, is " - << last_msg_->contents[84]; - EXPECT_EQ(get_ascontents[85])>( - reinterpret_cast(&last_msg_->contents[85])), - 181) - << "incorrect value for contents[85], expected 181, is " - << last_msg_->contents[85]; - EXPECT_EQ(get_ascontents[86])>( - reinterpret_cast(&last_msg_->contents[86])), - 20) - << "incorrect value for contents[86], expected 20, is " - << last_msg_->contents[86]; - EXPECT_EQ(get_ascontents[87])>( - reinterpret_cast(&last_msg_->contents[87])), - 233) - << "incorrect value for contents[87], expected 233, is " - << last_msg_->contents[87]; - EXPECT_EQ(get_ascontents[88])>( - reinterpret_cast(&last_msg_->contents[88])), - 23) - << "incorrect value for contents[88], expected 23, is " - << last_msg_->contents[88]; - EXPECT_EQ(get_ascontents[89])>( - reinterpret_cast(&last_msg_->contents[89])), - 23) - << "incorrect value for contents[89], expected 23, is " - << last_msg_->contents[89]; - EXPECT_EQ(get_ascontents[90])>( - reinterpret_cast(&last_msg_->contents[90])), - 73) - << "incorrect value for contents[90], expected 73, is " - << last_msg_->contents[90]; - EXPECT_EQ(get_ascontents[91])>( - reinterpret_cast(&last_msg_->contents[91])), - 119) - << "incorrect value for contents[91], expected 119, is " - << last_msg_->contents[91]; - EXPECT_EQ(get_ascontents[92])>( - reinterpret_cast(&last_msg_->contents[92])), - 136) - << "incorrect value for contents[92], expected 136, is " - << last_msg_->contents[92]; - EXPECT_EQ(get_ascontents[93])>( - reinterpret_cast(&last_msg_->contents[93])), - 231) - << "incorrect value for contents[93], expected 231, is " - << last_msg_->contents[93]; - EXPECT_EQ(get_ascontents[94])>( - reinterpret_cast(&last_msg_->contents[94])), - 189) - << "incorrect value for contents[94], expected 189, is " - << last_msg_->contents[94]; - EXPECT_EQ(get_ascontents[95])>( - reinterpret_cast(&last_msg_->contents[95])), - 26) - << "incorrect value for contents[95], expected 26, is " - << last_msg_->contents[95]; - EXPECT_EQ(get_ascontents[96])>( - reinterpret_cast(&last_msg_->contents[96])), - 174) - << "incorrect value for contents[96], expected 174, is " - << last_msg_->contents[96]; - EXPECT_EQ(get_ascontents[97])>( - reinterpret_cast(&last_msg_->contents[97])), - 128) - << "incorrect value for contents[97], expected 128, is " - << last_msg_->contents[97]; - EXPECT_EQ(get_ascontents[98])>( - reinterpret_cast(&last_msg_->contents[98])), - 93) - << "incorrect value for contents[98], expected 93, is " - << last_msg_->contents[98]; - EXPECT_EQ(get_ascontents[99])>( - reinterpret_cast(&last_msg_->contents[99])), - 30) - << "incorrect value for contents[99], expected 30, is " - << last_msg_->contents[99]; - EXPECT_EQ(get_ascontents[100])>( - reinterpret_cast(&last_msg_->contents[100])), - 76) - << "incorrect value for contents[100], expected 76, is " - << last_msg_->contents[100]; - EXPECT_EQ(get_ascontents[101])>( - reinterpret_cast(&last_msg_->contents[101])), - 45) - << "incorrect value for contents[101], expected 45, is " - << last_msg_->contents[101]; - EXPECT_EQ(get_ascontents[102])>( - reinterpret_cast(&last_msg_->contents[102])), - 109) - << "incorrect value for contents[102], expected 109, is " - << last_msg_->contents[102]; - EXPECT_EQ(get_ascontents[103])>( - reinterpret_cast(&last_msg_->contents[103])), - 134) - << "incorrect value for contents[103], expected 134, is " - << last_msg_->contents[103]; - EXPECT_EQ(get_ascontents[104])>( - reinterpret_cast(&last_msg_->contents[104])), - 81) - << "incorrect value for contents[104], expected 81, is " - << last_msg_->contents[104]; - EXPECT_EQ(get_ascontents[105])>( - reinterpret_cast(&last_msg_->contents[105])), - 0) - << "incorrect value for contents[105], expected 0, is " - << last_msg_->contents[105]; - EXPECT_EQ(get_ascontents[106])>( - reinterpret_cast(&last_msg_->contents[106])), - 116) - << "incorrect value for contents[106], expected 116, is " - << last_msg_->contents[106]; - EXPECT_EQ(get_ascontents[107])>( - reinterpret_cast(&last_msg_->contents[107])), - 158) - << "incorrect value for contents[107], expected 158, is " - << last_msg_->contents[107]; - EXPECT_EQ(get_ascontents[108])>( - reinterpret_cast(&last_msg_->contents[108])), - 127) - << "incorrect value for contents[108], expected 127, is " - << last_msg_->contents[108]; - EXPECT_EQ(get_ascontents[109])>( - reinterpret_cast(&last_msg_->contents[109])), - 40) - << "incorrect value for contents[109], expected 40, is " - << last_msg_->contents[109]; - EXPECT_EQ(get_ascontents[110])>( - reinterpret_cast(&last_msg_->contents[110])), - 133) - << "incorrect value for contents[110], expected 133, is " - << last_msg_->contents[110]; - EXPECT_EQ(get_ascontents[111])>( - reinterpret_cast(&last_msg_->contents[111])), - 208) - << "incorrect value for contents[111], expected 208, is " - << last_msg_->contents[111]; - EXPECT_EQ(get_ascontents[112])>( - reinterpret_cast(&last_msg_->contents[112])), - 134) - << "incorrect value for contents[112], expected 134, is " - << last_msg_->contents[112]; - EXPECT_EQ(get_ascontents[113])>( - reinterpret_cast(&last_msg_->contents[113])), - 127) - << "incorrect value for contents[113], expected 127, is " - << last_msg_->contents[113]; - EXPECT_EQ(get_ascontents[114])>( - reinterpret_cast(&last_msg_->contents[114])), - 140) - << "incorrect value for contents[114], expected 140, is " - << last_msg_->contents[114]; - EXPECT_EQ(get_ascontents[115])>( - reinterpret_cast(&last_msg_->contents[115])), - 232) - << "incorrect value for contents[115], expected 232, is " - << last_msg_->contents[115]; - EXPECT_EQ(get_ascontents[116])>( - reinterpret_cast(&last_msg_->contents[116])), - 183) - << "incorrect value for contents[116], expected 183, is " - << last_msg_->contents[116]; - EXPECT_EQ(get_ascontents[117])>( - reinterpret_cast(&last_msg_->contents[117])), - 184) - << "incorrect value for contents[117], expected 184, is " - << last_msg_->contents[117]; - EXPECT_EQ(get_ascontents[118])>( - reinterpret_cast(&last_msg_->contents[118])), - 108) - << "incorrect value for contents[118], expected 108, is " - << last_msg_->contents[118]; - EXPECT_EQ(get_ascontents[119])>( - reinterpret_cast(&last_msg_->contents[119])), - 6) - << "incorrect value for contents[119], expected 6, is " - << last_msg_->contents[119]; - EXPECT_EQ(get_ascontents[120])>( - reinterpret_cast(&last_msg_->contents[120])), - 228) - << "incorrect value for contents[120], expected 228, is " - << last_msg_->contents[120]; - EXPECT_EQ(get_ascontents[121])>( - reinterpret_cast(&last_msg_->contents[121])), - 54) - << "incorrect value for contents[121], expected 54, is " - << last_msg_->contents[121]; - EXPECT_EQ(get_ascontents[122])>( - reinterpret_cast(&last_msg_->contents[122])), - 238) - << "incorrect value for contents[122], expected 238, is " - << last_msg_->contents[122]; - EXPECT_EQ(get_ascontents[123])>( - reinterpret_cast(&last_msg_->contents[123])), - 59) - << "incorrect value for contents[123], expected 59, is " - << last_msg_->contents[123]; - EXPECT_EQ(get_ascontents[124])>( - reinterpret_cast(&last_msg_->contents[124])), - 220) - << "incorrect value for contents[124], expected 220, is " - << last_msg_->contents[124]; - EXPECT_EQ(get_ascontents[125])>( - reinterpret_cast(&last_msg_->contents[125])), - 30) - << "incorrect value for contents[125], expected 30, is " - << last_msg_->contents[125]; - EXPECT_EQ(get_ascontents[126])>( - reinterpret_cast(&last_msg_->contents[126])), - 228) - << "incorrect value for contents[126], expected 228, is " - << last_msg_->contents[126]; - EXPECT_EQ(get_ascontents[127])>( - reinterpret_cast(&last_msg_->contents[127])), - 212) - << "incorrect value for contents[127], expected 212, is " - << last_msg_->contents[127]; - EXPECT_EQ(get_ascontents[128])>( - reinterpret_cast(&last_msg_->contents[128])), - 50) - << "incorrect value for contents[128], expected 50, is " - << last_msg_->contents[128]; - EXPECT_EQ(get_ascontents[129])>( - reinterpret_cast(&last_msg_->contents[129])), - 182) - << "incorrect value for contents[129], expected 182, is " - << last_msg_->contents[129]; - EXPECT_EQ(get_ascontents[130])>( - reinterpret_cast(&last_msg_->contents[130])), - 97) - << "incorrect value for contents[130], expected 97, is " - << last_msg_->contents[130]; - EXPECT_EQ(get_ascontents[131])>( - reinterpret_cast(&last_msg_->contents[131])), - 20) - << "incorrect value for contents[131], expected 20, is " - << last_msg_->contents[131]; - EXPECT_EQ(get_ascontents[132])>( - reinterpret_cast(&last_msg_->contents[132])), - 41) - << "incorrect value for contents[132], expected 41, is " - << last_msg_->contents[132]; - EXPECT_EQ(get_ascontents[133])>( - reinterpret_cast(&last_msg_->contents[133])), - 76) - << "incorrect value for contents[133], expected 76, is " - << last_msg_->contents[133]; - EXPECT_EQ(get_ascontents[134])>( - reinterpret_cast(&last_msg_->contents[134])), - 227) - << "incorrect value for contents[134], expected 227, is " - << last_msg_->contents[134]; - EXPECT_EQ(get_ascontents[135])>( - reinterpret_cast(&last_msg_->contents[135])), - 88) - << "incorrect value for contents[135], expected 88, is " - << last_msg_->contents[135]; - EXPECT_EQ(get_ascontents[136])>( - reinterpret_cast(&last_msg_->contents[136])), - 12) - << "incorrect value for contents[136], expected 12, is " - << last_msg_->contents[136]; - EXPECT_EQ(get_ascontents[137])>( - reinterpret_cast(&last_msg_->contents[137])), - 95) - << "incorrect value for contents[137], expected 95, is " - << last_msg_->contents[137]; - EXPECT_EQ(get_ascontents[138])>( - reinterpret_cast(&last_msg_->contents[138])), - 112) - << "incorrect value for contents[138], expected 112, is " - << last_msg_->contents[138]; - EXPECT_EQ(get_ascontents[139])>( - reinterpret_cast(&last_msg_->contents[139])), - 209) - << "incorrect value for contents[139], expected 209, is " - << last_msg_->contents[139]; - EXPECT_EQ(get_ascontents[140])>( - reinterpret_cast(&last_msg_->contents[140])), - 183) - << "incorrect value for contents[140], expected 183, is " - << last_msg_->contents[140]; - EXPECT_EQ(get_ascontents[141])>( - reinterpret_cast(&last_msg_->contents[141])), - 127) - << "incorrect value for contents[141], expected 127, is " - << last_msg_->contents[141]; - EXPECT_EQ(get_ascontents[142])>( - reinterpret_cast(&last_msg_->contents[142])), - 4) - << "incorrect value for contents[142], expected 4, is " - << last_msg_->contents[142]; - EXPECT_EQ(get_ascontents[143])>( - reinterpret_cast(&last_msg_->contents[143])), - 165) - << "incorrect value for contents[143], expected 165, is " - << last_msg_->contents[143]; - EXPECT_EQ(get_ascontents[144])>( - reinterpret_cast(&last_msg_->contents[144])), - 189) - << "incorrect value for contents[144], expected 189, is " - << last_msg_->contents[144]; - EXPECT_EQ(get_ascontents[145])>( - reinterpret_cast(&last_msg_->contents[145])), - 44) - << "incorrect value for contents[145], expected 44, is " - << last_msg_->contents[145]; - EXPECT_EQ(get_ascontents[146])>( - reinterpret_cast(&last_msg_->contents[146])), - 239) - << "incorrect value for contents[146], expected 239, is " - << last_msg_->contents[146]; - EXPECT_EQ(get_ascontents[147])>( - reinterpret_cast(&last_msg_->contents[147])), - 232) - << "incorrect value for contents[147], expected 232, is " - << last_msg_->contents[147]; - EXPECT_EQ(get_ascontents[148])>( - reinterpret_cast(&last_msg_->contents[148])), - 132) - << "incorrect value for contents[148], expected 132, is " - << last_msg_->contents[148]; - EXPECT_EQ(get_ascontents[149])>( - reinterpret_cast(&last_msg_->contents[149])), - 9) - << "incorrect value for contents[149], expected 9, is " - << last_msg_->contents[149]; - EXPECT_EQ(get_ascontents[150])>( - reinterpret_cast(&last_msg_->contents[150])), - 114) - << "incorrect value for contents[150], expected 114, is " - << last_msg_->contents[150]; - EXPECT_EQ(get_ascontents[151])>( - reinterpret_cast(&last_msg_->contents[151])), - 184) - << "incorrect value for contents[151], expected 184, is " - << last_msg_->contents[151]; - EXPECT_EQ(get_ascontents[152])>( - reinterpret_cast(&last_msg_->contents[152])), - 249) - << "incorrect value for contents[152], expected 249, is " - << last_msg_->contents[152]; - EXPECT_EQ(get_ascontents[153])>( - reinterpret_cast(&last_msg_->contents[153])), - 208) - << "incorrect value for contents[153], expected 208, is " - << last_msg_->contents[153]; - EXPECT_EQ(get_ascontents[154])>( - reinterpret_cast(&last_msg_->contents[154])), - 246) - << "incorrect value for contents[154], expected 246, is " - << last_msg_->contents[154]; - EXPECT_EQ(get_ascontents[155])>( - reinterpret_cast(&last_msg_->contents[155])), - 194) - << "incorrect value for contents[155], expected 194, is " - << last_msg_->contents[155]; - EXPECT_EQ(get_ascontents[156])>( - reinterpret_cast(&last_msg_->contents[156])), - 250) - << "incorrect value for contents[156], expected 250, is " - << last_msg_->contents[156]; - EXPECT_EQ(get_ascontents[157])>( - reinterpret_cast(&last_msg_->contents[157])), - 2) - << "incorrect value for contents[157], expected 2, is " - << last_msg_->contents[157]; - EXPECT_EQ(get_ascontents[158])>( - reinterpret_cast(&last_msg_->contents[158])), - 97) - << "incorrect value for contents[158], expected 97, is " - << last_msg_->contents[158]; - EXPECT_EQ(get_ascontents[159])>( - reinterpret_cast(&last_msg_->contents[159])), - 173) - << "incorrect value for contents[159], expected 173, is " - << last_msg_->contents[159]; - EXPECT_EQ(get_ascontents[160])>( - reinterpret_cast(&last_msg_->contents[160])), - 157) - << "incorrect value for contents[160], expected 157, is " - << last_msg_->contents[160]; - EXPECT_EQ(get_ascontents[161])>( - reinterpret_cast(&last_msg_->contents[161])), - 202) - << "incorrect value for contents[161], expected 202, is " - << last_msg_->contents[161]; - EXPECT_EQ(get_ascontents[162])>( - reinterpret_cast(&last_msg_->contents[162])), - 172) - << "incorrect value for contents[162], expected 172, is " - << last_msg_->contents[162]; - EXPECT_EQ(get_ascontents[163])>( - reinterpret_cast(&last_msg_->contents[163])), - 180) - << "incorrect value for contents[163], expected 180, is " - << last_msg_->contents[163]; - EXPECT_EQ(get_ascontents[164])>( - reinterpret_cast(&last_msg_->contents[164])), - 150) - << "incorrect value for contents[164], expected 150, is " - << last_msg_->contents[164]; - EXPECT_EQ(get_ascontents[165])>( - reinterpret_cast(&last_msg_->contents[165])), - 213) - << "incorrect value for contents[165], expected 213, is " - << last_msg_->contents[165]; - EXPECT_EQ(get_ascontents[166])>( - reinterpret_cast(&last_msg_->contents[166])), - 193) - << "incorrect value for contents[166], expected 193, is " - << last_msg_->contents[166]; - EXPECT_EQ(get_ascontents[167])>( - reinterpret_cast(&last_msg_->contents[167])), - 177) - << "incorrect value for contents[167], expected 177, is " - << last_msg_->contents[167]; - EXPECT_EQ(get_ascontents[168])>( - reinterpret_cast(&last_msg_->contents[168])), - 209) - << "incorrect value for contents[168], expected 209, is " - << last_msg_->contents[168]; - EXPECT_EQ(get_ascontents[169])>( - reinterpret_cast(&last_msg_->contents[169])), - 156) - << "incorrect value for contents[169], expected 156, is " - << last_msg_->contents[169]; - EXPECT_EQ(get_ascontents[170])>( - reinterpret_cast(&last_msg_->contents[170])), - 20) - << "incorrect value for contents[170], expected 20, is " - << last_msg_->contents[170]; - EXPECT_EQ(get_ascontents[171])>( - reinterpret_cast(&last_msg_->contents[171])), - 174) - << "incorrect value for contents[171], expected 174, is " - << last_msg_->contents[171]; - EXPECT_EQ(get_ascontents[172])>( - reinterpret_cast(&last_msg_->contents[172])), - 18) - << "incorrect value for contents[172], expected 18, is " - << last_msg_->contents[172]; - EXPECT_EQ(get_ascontents[173])>( - reinterpret_cast(&last_msg_->contents[173])), - 73) - << "incorrect value for contents[173], expected 73, is " - << last_msg_->contents[173]; - EXPECT_EQ(get_ascontents[174])>( - reinterpret_cast(&last_msg_->contents[174])), - 132) - << "incorrect value for contents[174], expected 132, is " - << last_msg_->contents[174]; - EXPECT_EQ(get_ascontents[175])>( - reinterpret_cast(&last_msg_->contents[175])), - 215) - << "incorrect value for contents[175], expected 215, is " - << last_msg_->contents[175]; - EXPECT_EQ(get_ascontents[176])>( - reinterpret_cast(&last_msg_->contents[176])), - 115) - << "incorrect value for contents[176], expected 115, is " - << last_msg_->contents[176]; - EXPECT_EQ(get_ascontents[177])>( - reinterpret_cast(&last_msg_->contents[177])), - 128) - << "incorrect value for contents[177], expected 128, is " - << last_msg_->contents[177]; - EXPECT_EQ(get_ascontents[178])>( - reinterpret_cast(&last_msg_->contents[178])), - 175) - << "incorrect value for contents[178], expected 175, is " - << last_msg_->contents[178]; - EXPECT_EQ(get_ascontents[179])>( - reinterpret_cast(&last_msg_->contents[179])), - 169) - << "incorrect value for contents[179], expected 169, is " - << last_msg_->contents[179]; - EXPECT_EQ(get_ascontents[180])>( - reinterpret_cast(&last_msg_->contents[180])), - 116) - << "incorrect value for contents[180], expected 116, is " - << last_msg_->contents[180]; - EXPECT_EQ(get_ascontents[181])>( - reinterpret_cast(&last_msg_->contents[181])), - 132) - << "incorrect value for contents[181], expected 132, is " - << last_msg_->contents[181]; - EXPECT_EQ(get_ascontents[182])>( - reinterpret_cast(&last_msg_->contents[182])), - 100) - << "incorrect value for contents[182], expected 100, is " - << last_msg_->contents[182]; - EXPECT_EQ(get_ascontents[183])>( - reinterpret_cast(&last_msg_->contents[183])), - 72) - << "incorrect value for contents[183], expected 72, is " - << last_msg_->contents[183]; - EXPECT_EQ(get_ascontents[184])>( - reinterpret_cast(&last_msg_->contents[184])), - 45) - << "incorrect value for contents[184], expected 45, is " - << last_msg_->contents[184]; - EXPECT_EQ(get_ascontents[185])>( - reinterpret_cast(&last_msg_->contents[185])), - 25) - << "incorrect value for contents[185], expected 25, is " - << last_msg_->contents[185]; - EXPECT_EQ(get_ascontents[186])>( - reinterpret_cast(&last_msg_->contents[186])), - 14) - << "incorrect value for contents[186], expected 14, is " - << last_msg_->contents[186]; - EXPECT_EQ(get_ascontents[187])>( - reinterpret_cast(&last_msg_->contents[187])), - 205) - << "incorrect value for contents[187], expected 205, is " - << last_msg_->contents[187]; - EXPECT_EQ(get_ascontents[188])>( - reinterpret_cast(&last_msg_->contents[188])), - 213) - << "incorrect value for contents[188], expected 213, is " - << last_msg_->contents[188]; - EXPECT_EQ(get_ascontents[189])>( - reinterpret_cast(&last_msg_->contents[189])), - 145) - << "incorrect value for contents[189], expected 145, is " - << last_msg_->contents[189]; - EXPECT_EQ(get_ascontents[190])>( - reinterpret_cast(&last_msg_->contents[190])), - 68) - << "incorrect value for contents[190], expected 68, is " - << last_msg_->contents[190]; - EXPECT_EQ(get_ascontents[191])>( - reinterpret_cast(&last_msg_->contents[191])), - 137) - << "incorrect value for contents[191], expected 137, is " - << last_msg_->contents[191]; - EXPECT_EQ(get_ascontents[192])>( - reinterpret_cast(&last_msg_->contents[192])), - 249) - << "incorrect value for contents[192], expected 249, is " - << last_msg_->contents[192]; - EXPECT_EQ(get_ascontents[193])>( - reinterpret_cast(&last_msg_->contents[193])), - 54) - << "incorrect value for contents[193], expected 54, is " - << last_msg_->contents[193]; - EXPECT_EQ(get_ascontents[194])>( - reinterpret_cast(&last_msg_->contents[194])), - 40) - << "incorrect value for contents[194], expected 40, is " - << last_msg_->contents[194]; - EXPECT_EQ(get_ascontents[195])>( - reinterpret_cast(&last_msg_->contents[195])), - 174) - << "incorrect value for contents[195], expected 174, is " - << last_msg_->contents[195]; - EXPECT_EQ(get_ascontents[196])>( - reinterpret_cast(&last_msg_->contents[196])), - 215) - << "incorrect value for contents[196], expected 215, is " - << last_msg_->contents[196]; - EXPECT_EQ(get_ascontents[197])>( - reinterpret_cast(&last_msg_->contents[197])), - 148) - << "incorrect value for contents[197], expected 148, is " - << last_msg_->contents[197]; - EXPECT_EQ(get_ascontents[198])>( - reinterpret_cast(&last_msg_->contents[198])), - 166) - << "incorrect value for contents[198], expected 166, is " - << last_msg_->contents[198]; - EXPECT_EQ(get_ascontents[199])>( - reinterpret_cast(&last_msg_->contents[199])), - 190) - << "incorrect value for contents[199], expected 190, is " - << last_msg_->contents[199]; - EXPECT_EQ(get_ascontents[200])>( - reinterpret_cast(&last_msg_->contents[200])), - 63) - << "incorrect value for contents[200], expected 63, is " - << last_msg_->contents[200]; - EXPECT_EQ(get_ascontents[201])>( - reinterpret_cast(&last_msg_->contents[201])), - 118) - << "incorrect value for contents[201], expected 118, is " - << last_msg_->contents[201]; - EXPECT_EQ(get_ascontents[202])>( - reinterpret_cast(&last_msg_->contents[202])), - 6) - << "incorrect value for contents[202], expected 6, is " - << last_msg_->contents[202]; - EXPECT_EQ(get_ascontents[203])>( - reinterpret_cast(&last_msg_->contents[203])), - 165) - << "incorrect value for contents[203], expected 165, is " - << last_msg_->contents[203]; - EXPECT_EQ(get_ascontents[204])>( - reinterpret_cast(&last_msg_->contents[204])), - 212) - << "incorrect value for contents[204], expected 212, is " - << last_msg_->contents[204]; - EXPECT_EQ(get_ascontents[205])>( - reinterpret_cast(&last_msg_->contents[205])), - 74) - << "incorrect value for contents[205], expected 74, is " - << last_msg_->contents[205]; - EXPECT_EQ(get_ascontents[206])>( - reinterpret_cast(&last_msg_->contents[206])), - 68) - << "incorrect value for contents[206], expected 68, is " - << last_msg_->contents[206]; - EXPECT_EQ(get_ascontents[207])>( - reinterpret_cast(&last_msg_->contents[207])), - 200) - << "incorrect value for contents[207], expected 200, is " - << last_msg_->contents[207]; - EXPECT_EQ(get_ascontents[208])>( - reinterpret_cast(&last_msg_->contents[208])), - 38) - << "incorrect value for contents[208], expected 38, is " - << last_msg_->contents[208]; - EXPECT_EQ(get_ascontents[209])>( - reinterpret_cast(&last_msg_->contents[209])), - 139) - << "incorrect value for contents[209], expected 139, is " - << last_msg_->contents[209]; - EXPECT_EQ(get_ascontents[210])>( - reinterpret_cast(&last_msg_->contents[210])), - 212) - << "incorrect value for contents[210], expected 212, is " - << last_msg_->contents[210]; - EXPECT_EQ(get_ascontents[211])>( - reinterpret_cast(&last_msg_->contents[211])), - 112) - << "incorrect value for contents[211], expected 112, is " - << last_msg_->contents[211]; - EXPECT_EQ(get_ascontents[212])>( - reinterpret_cast(&last_msg_->contents[212])), - 45) - << "incorrect value for contents[212], expected 45, is " - << last_msg_->contents[212]; - EXPECT_EQ(get_ascontents[213])>( - reinterpret_cast(&last_msg_->contents[213])), - 167) - << "incorrect value for contents[213], expected 167, is " - << last_msg_->contents[213]; - EXPECT_EQ(get_ascontents[214])>( - reinterpret_cast(&last_msg_->contents[214])), - 236) - << "incorrect value for contents[214], expected 236, is " - << last_msg_->contents[214]; - EXPECT_EQ(get_ascontents[215])>( - reinterpret_cast(&last_msg_->contents[215])), - 255) - << "incorrect value for contents[215], expected 255, is " - << last_msg_->contents[215]; - EXPECT_EQ(get_ascontents[216])>( - reinterpret_cast(&last_msg_->contents[216])), - 106) - << "incorrect value for contents[216], expected 106, is " - << last_msg_->contents[216]; - EXPECT_EQ(get_ascontents[217])>( - reinterpret_cast(&last_msg_->contents[217])), - 92) - << "incorrect value for contents[217], expected 92, is " - << last_msg_->contents[217]; - EXPECT_EQ(get_ascontents[218])>( - reinterpret_cast(&last_msg_->contents[218])), - 132) - << "incorrect value for contents[218], expected 132, is " - << last_msg_->contents[218]; - EXPECT_EQ(get_ascontents[219])>( - reinterpret_cast(&last_msg_->contents[219])), - 59) - << "incorrect value for contents[219], expected 59, is " - << last_msg_->contents[219]; - EXPECT_EQ(get_ascontents[220])>( - reinterpret_cast(&last_msg_->contents[220])), - 61) - << "incorrect value for contents[220], expected 61, is " - << last_msg_->contents[220]; - EXPECT_EQ(get_ascontents[221])>( - reinterpret_cast(&last_msg_->contents[221])), - 233) - << "incorrect value for contents[221], expected 233, is " - << last_msg_->contents[221]; - EXPECT_EQ(get_ascontents[222])>( - reinterpret_cast(&last_msg_->contents[222])), - 3) - << "incorrect value for contents[222], expected 3, is " - << last_msg_->contents[222]; - EXPECT_EQ(get_ascontents[223])>( - reinterpret_cast(&last_msg_->contents[223])), - 246) - << "incorrect value for contents[223], expected 246, is " - << last_msg_->contents[223]; - EXPECT_EQ(get_ascontents[224])>( - reinterpret_cast(&last_msg_->contents[224])), - 158) - << "incorrect value for contents[224], expected 158, is " - << last_msg_->contents[224]; - EXPECT_EQ(get_ascontents[225])>( - reinterpret_cast(&last_msg_->contents[225])), - 83) - << "incorrect value for contents[225], expected 83, is " - << last_msg_->contents[225]; - EXPECT_EQ(get_ascontents[226])>( - reinterpret_cast(&last_msg_->contents[226])), - 134) - << "incorrect value for contents[226], expected 134, is " - << last_msg_->contents[226]; - EXPECT_EQ(get_ascontents[227])>( - reinterpret_cast(&last_msg_->contents[227])), - 246) - << "incorrect value for contents[227], expected 246, is " - << last_msg_->contents[227]; - EXPECT_EQ(get_ascontents[228])>( - reinterpret_cast(&last_msg_->contents[228])), - 154) - << "incorrect value for contents[228], expected 154, is " - << last_msg_->contents[228]; - EXPECT_EQ(get_ascontents[229])>( - reinterpret_cast(&last_msg_->contents[229])), - 17) - << "incorrect value for contents[229], expected 17, is " - << last_msg_->contents[229]; - EXPECT_EQ(get_ascontents[230])>( - reinterpret_cast(&last_msg_->contents[230])), - 0) - << "incorrect value for contents[230], expected 0, is " - << last_msg_->contents[230]; - EXPECT_EQ(get_ascontents[231])>( - reinterpret_cast(&last_msg_->contents[231])), - 6) - << "incorrect value for contents[231], expected 6, is " - << last_msg_->contents[231]; - EXPECT_EQ(get_ascontents[232])>( - reinterpret_cast(&last_msg_->contents[232])), - 56) - << "incorrect value for contents[232], expected 56, is " - << last_msg_->contents[232]; - EXPECT_EQ(get_ascontents[233])>( - reinterpret_cast(&last_msg_->contents[233])), - 216) - << "incorrect value for contents[233], expected 216, is " - << last_msg_->contents[233]; - EXPECT_EQ(get_ascontents[234])>( - reinterpret_cast(&last_msg_->contents[234])), - 19) - << "incorrect value for contents[234], expected 19, is " - << last_msg_->contents[234]; - EXPECT_EQ(get_ascontents[235])>( - reinterpret_cast(&last_msg_->contents[235])), - 216) - << "incorrect value for contents[235], expected 216, is " - << last_msg_->contents[235]; - EXPECT_EQ(get_ascontents[236])>( - reinterpret_cast(&last_msg_->contents[236])), - 70) - << "incorrect value for contents[236], expected 70, is " - << last_msg_->contents[236]; - EXPECT_EQ(get_ascontents[237])>( - reinterpret_cast(&last_msg_->contents[237])), - 71) - << "incorrect value for contents[237], expected 71, is " - << last_msg_->contents[237]; - EXPECT_EQ(get_ascontents[238])>( - reinterpret_cast(&last_msg_->contents[238])), - 161) - << "incorrect value for contents[238], expected 161, is " - << last_msg_->contents[238]; - EXPECT_EQ(get_ascontents[239])>( - reinterpret_cast(&last_msg_->contents[239])), - 184) - << "incorrect value for contents[239], expected 184, is " - << last_msg_->contents[239]; - EXPECT_EQ(get_ascontents[240])>( - reinterpret_cast(&last_msg_->contents[240])), - 5) - << "incorrect value for contents[240], expected 5, is " - << last_msg_->contents[240]; - EXPECT_EQ(get_ascontents[241])>( - reinterpret_cast(&last_msg_->contents[241])), - 177) - << "incorrect value for contents[241], expected 177, is " - << last_msg_->contents[241]; - EXPECT_EQ(get_ascontents[242])>( - reinterpret_cast(&last_msg_->contents[242])), - 45) - << "incorrect value for contents[242], expected 45, is " - << last_msg_->contents[242]; - EXPECT_EQ(get_ascontents[243])>( - reinterpret_cast(&last_msg_->contents[243])), - 37) - << "incorrect value for contents[243], expected 37, is " - << last_msg_->contents[243]; - EXPECT_EQ(get_ascontents[244])>( - reinterpret_cast(&last_msg_->contents[244])), - 98) - << "incorrect value for contents[244], expected 98, is " - << last_msg_->contents[244]; - EXPECT_EQ(get_ascontents[245])>( - reinterpret_cast(&last_msg_->contents[245])), - 56) - << "incorrect value for contents[245], expected 56, is " - << last_msg_->contents[245]; - EXPECT_EQ(get_ascontents[246])>( - reinterpret_cast(&last_msg_->contents[246])), - 149) - << "incorrect value for contents[246], expected 149, is " - << last_msg_->contents[246]; - EXPECT_EQ(get_ascontents[247])>( - reinterpret_cast(&last_msg_->contents[247])), - 0) - << "incorrect value for contents[247], expected 0, is " - << last_msg_->contents[247]; - EXPECT_EQ(get_ascontents[248])>( - reinterpret_cast(&last_msg_->contents[248])), - 73) - << "incorrect value for contents[248], expected 73, is " - << last_msg_->contents[248]; - EXPECT_EQ(get_ascontents[249])>( - reinterpret_cast(&last_msg_->contents[249])), - 221) - << "incorrect value for contents[249], expected 221, is " - << last_msg_->contents[249]; - EXPECT_EQ(get_ascontents[250])>( - reinterpret_cast(&last_msg_->contents[250])), - 105) - << "incorrect value for contents[250], expected 105, is " - << last_msg_->contents[250]; - EXPECT_EQ(get_ascontents[251])>( - reinterpret_cast(&last_msg_->contents[251])), - 239) - << "incorrect value for contents[251], expected 239, is " - << last_msg_->contents[251]; - EXPECT_EQ(get_ascontents[252])>( - reinterpret_cast(&last_msg_->contents[252])), - 168) - << "incorrect value for contents[252], expected 168, is " - << last_msg_->contents[252]; - EXPECT_EQ(get_ascontents[253])>( - reinterpret_cast(&last_msg_->contents[253])), - 205) - << "incorrect value for contents[253], expected 205, is " - << last_msg_->contents[253]; - EXPECT_EQ(get_ascontents[254])>( - reinterpret_cast(&last_msg_->contents[254])), - 85) - << "incorrect value for contents[254], expected 85, is " - << last_msg_->contents[254]; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_vehicle_MsgOdometry.cc b/c/test/legacy/cpp/auto_check_sbp_vehicle_MsgOdometry.cc deleted file mode 100644 index c30c068dd2..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_vehicle_MsgOdometry.cc +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/vehicle/test_MsgOdometry.yaml by generate.py. Do -// not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_vehicle_MsgOdometry0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_vehicle_MsgOdometry0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_odometry_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_odometry_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_vehicle_MsgOdometry0, Test) { - uint8_t encoded_frame[] = { - 85, 3, 9, 66, 0, 9, 8, 0, 0, 0, 7, 0, 0, 0, 1, 52, 99, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_odometry_t *test_msg = (msg_odometry_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 1; - test_msg->tow = 8; - test_msg->velocity = 7; - - EXPECT_EQ(send_message(0x903, 66, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 66); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_astow)>( - reinterpret_cast(&last_msg_->tow)), - 8) - << "incorrect value for tow, expected 8, is " << last_msg_->tow; - EXPECT_EQ(get_asvelocity)>( - reinterpret_cast(&last_msg_->velocity)), - 7) - << "incorrect value for velocity, expected 7, is " << last_msg_->velocity; -} diff --git a/c/test/legacy/cpp/auto_check_sbp_vehicle_MsgWheeltick.cc b/c/test/legacy/cpp/auto_check_sbp_vehicle_MsgWheeltick.cc deleted file mode 100644 index f405c74a23..0000000000 --- a/c/test/legacy/cpp/auto_check_sbp_vehicle_MsgWheeltick.cc +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from -// spec/tests/yaml/swiftnav/sbp/vehicle/test_MsgWheeltick.yaml by generate.py. -// Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template > -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} -class Test_legacy_auto_check_sbp_vehicle_MsgWheeltick0 - : public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler { - public: - Test_legacy_auto_check_sbp_vehicle_MsgWheeltick0() - : ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler(this), - last_msg_storage_(), - last_msg_(reinterpret_cast(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - protected: - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_wheeltick_t &msg) override { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - msg_wheeltick_t *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_auto_check_sbp_vehicle_MsgWheeltick0, Test) { - uint8_t encoded_frame[] = { - 85, 4, 9, 107, 69, 14, 254, 27, 114, 44, 26, - 0, 0, 0, 1, 146, 225, 51, 9, 210, 36, 56, - }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - msg_wheeltick_t *test_msg = (msg_wheeltick_t *)test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - test_msg->flags = 1; - test_msg->source = 146; - test_msg->ticks = -771148831; - test_msg->time = 112414825470; - - EXPECT_EQ(send_message(0x904, 17771, test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, 17771); - EXPECT_EQ(last_msg_len_, test_msg_len); - EXPECT_EQ(get_asflags)>( - reinterpret_cast(&last_msg_->flags)), - 1) - << "incorrect value for flags, expected 1, is " << last_msg_->flags; - EXPECT_EQ(get_assource)>( - reinterpret_cast(&last_msg_->source)), - 146) - << "incorrect value for source, expected 146, is " << last_msg_->source; - EXPECT_EQ(get_asticks)>( - reinterpret_cast(&last_msg_->ticks)), - -771148831) - << "incorrect value for ticks, expected -771148831, is " - << last_msg_->ticks; - EXPECT_EQ(get_astime)>( - reinterpret_cast(&last_msg_->time)), - 112414825470) - << "incorrect value for time, expected 112414825470, is " - << last_msg_->time; -} diff --git a/c/test/legacy/cpp/generate_sbp_data.sh b/c/test/legacy/cpp/generate_sbp_data.sh deleted file mode 100755 index 1b1b5d4332..0000000000 --- a/c/test/legacy/cpp/generate_sbp_data.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -echo "Converting json files in /json_data to sbp files in /sbp_data" -rm -r ./sbp_data/* -for file_path in ./json_data/*.json; do - file_name=$(basename "$file_path" .json) - cat $file_path | json2sbp > "sbp_data/${file_name}.sbp" -done -echo "All done, please commit the results!" diff --git a/c/test/legacy/cpp/json_data/gnss_data.json b/c/test/legacy/cpp/json_data/gnss_data.json deleted file mode 100644 index 4d125d26f8..0000000000 --- a/c/test/legacy/cpp/json_data/gnss_data.json +++ /dev/null @@ -1,3 +0,0 @@ -{"preamble":85,"msg_type":74,"sender":51228,"length":249,"payload":"CKN+CAAAAAAlCCA6z4RIsyyfB4ec96OoDA8KAJ3OhEhHZfAFy3b5qKwMDwoHlHeNR7wthQeKMfEGuAwPDAD0do1HnCPcBdR19PmgDA8MBxOS4j6Z+JsGQyMJ5MQMDw0A45z3PAFfaAZCEgPg0AwPDwD1m/c8Bzb+BGdlAifEDA8PB5tT50P8/yIHzuD5HrwHCxEAsFLnQ9KijwUoOvtAqAcPEQf0E8ZFJ1FVB0re81GcCw8TAIZopURA+jYHyOT/eKQMDxQA9Ak1QGSLvwYar/bUxAwPGAB8CTVAaiNCBR6++DLADA8YB6grdkKMM/wGgooJHLwLDxwA","crc":47977,"header":{"t":{"tow":142517000,"ns_residual":0,"wn":2085},"n_obs":32},"obs":[{"P":1216663354,"L":{"i":127872179,"f":135},"D":{"i":-2148,"f":163},"cn0":168,"lock":12,"flags":15,"sid":{"sat":10,"code":0}},{"P":1216663197,"L":{"i":99640647,"f":203},"D":{"i":-1674,"f":168},"cn0":172,"lock":12,"flags":15,"sid":{"sat":10,"code":7}},{"P":1200453524,"L":{"i":126168508,"f":138},"D":{"i":-3791,"f":6},"cn0":184,"lock":12,"flags":15,"sid":{"sat":12,"code":0}},{"P":1200453364,"L":{"i":98313116,"f":212},"D":{"i":-2955,"f":249},"cn0":160,"lock":12,"flags":15,"sid":{"sat":12,"code":7}},{"P":1055035923,"L":{"i":110885017,"f":67},"D":{"i":2339,"f":228},"cn0":196,"lock":12,"flags":15,"sid":{"sat":13,"code":0}},{"P":1022860515,"L":{"i":107503361,"f":66},"D":{"i":786,"f":224},"cn0":208,"lock":12,"flags":15,"sid":{"sat":15,"code":0}},{"P":1022860277,"L":{"i":83768839,"f":103},"D":{"i":613,"f":39},"cn0":196,"lock":12,"flags":15,"sid":{"sat":15,"code":7}},{"P":1139233691,"L":{"i":119734268,"f":206},"D":{"i":-1568,"f":30},"cn0":188,"lock":7,"flags":11,"sid":{"sat":17,"code":0}},{"P":1139233456,"L":{"i":93299410,"f":40},"D":{"i":-1222,"f":64},"cn0":168,"lock":7,"flags":15,"sid":{"sat":17,"code":7}},{"P":1170609140,"L":{"i":123031847,"f":74},"D":{"i":-3106,"f":81},"cn0":156,"lock":11,"flags":15,"sid":{"sat":19,"code":0}},{"P":1151690886,"L":{"i":121043520,"f":200},"D":{"i":-28,"f":120},"cn0":164,"lock":12,"flags":15,"sid":{"sat":20,"code":0}},{"P":1077217780,"L":{"i":113216356,"f":26},"D":{"i":-2385,"f":212},"cn0":196,"lock":12,"flags":15,"sid":{"sat":24,"code":0}},{"P":1077217660,"L":{"i":88220522,"f":30},"D":{"i":-1858,"f":50},"cn0":192,"lock":12,"flags":15,"sid":{"sat":24,"code":7}},{"P":1115040680,"L":{"i":117191564,"f":130},"D":{"i":2442,"f":28},"cn0":188,"lock":11,"flags":15,"sid":{"sat":28,"code":0}}]} -{"preamble":85,"msg_type":74,"sender":51228,"length":249,"payload":"8KZ+CAAAAAAlCCBuf4RIUCSfB2qd9x2oDA8KANZ+hEi+XvAFvXf5KqgMDwoHsOqMR+0ehQesMfEhuAwPDAAN6oxHEhjcBel29BqcDA8MBw/p4j69AZwGzCQJqcgMDw0AKrr3PBRiaAbFEwO50AwPDwA9ufc8bTj+BA1lAtPADA8PB14Z50Pd+SIHq+H5BrwICxEAchjnQw2ejwUHO/sFpAgPEQeEoMVFBUVVB6Te84KoCw8TAIBnpUQl+jYHquX/IqQMDxQAVrE0QBSCvwYhsPYmxAwPGADnsDRAKBxCBXy++HC8DA8YB2yGdkIXPfwGBIoJnbwLDxwA","crc":57531,"header":{"t":{"tow":142518000,"ns_residual":0,"wn":2085},"n_obs":32},"obs":[{"P":1216642926,"L":{"i":127870032,"f":106},"D":{"i":-2147,"f":29},"cn0":168,"lock":12,"flags":15,"sid":{"sat":10,"code":0}},{"P":1216642774,"L":{"i":99638974,"f":189},"D":{"i":-1673,"f":42},"cn0":168,"lock":12,"flags":15,"sid":{"sat":10,"code":7}},{"P":1200417456,"L":{"i":126164717,"f":172},"D":{"i":-3791,"f":33},"cn0":184,"lock":12,"flags":15,"sid":{"sat":12,"code":0}},{"P":1200417293,"L":{"i":98310162,"f":233},"D":{"i":-2954,"f":26},"cn0":156,"lock":12,"flags":15,"sid":{"sat":12,"code":7}},{"P":1055058191,"L":{"i":110887357,"f":204},"D":{"i":2340,"f":169},"cn0":200,"lock":12,"flags":15,"sid":{"sat":13,"code":0}},{"P":1022868010,"L":{"i":107504148,"f":197},"D":{"i":787,"f":185},"cn0":208,"lock":12,"flags":15,"sid":{"sat":15,"code":0}},{"P":1022867773,"L":{"i":83769453,"f":13},"D":{"i":613,"f":211},"cn0":192,"lock":12,"flags":15,"sid":{"sat":15,"code":7}},{"P":1139218782,"L":{"i":119732701,"f":171},"D":{"i":-1567,"f":6},"cn0":188,"lock":8,"flags":11,"sid":{"sat":17,"code":0}},{"P":1139218546,"L":{"i":93298189,"f":7},"D":{"i":-1221,"f":5},"cn0":164,"lock":8,"flags":15,"sid":{"sat":17,"code":7}},{"P":1170579588,"L":{"i":123028741,"f":164},"D":{"i":-3106,"f":130},"cn0":168,"lock":11,"flags":15,"sid":{"sat":19,"code":0}},{"P":1151690624,"L":{"i":121043493,"f":170},"D":{"i":-27,"f":34},"cn0":164,"lock":12,"flags":15,"sid":{"sat":20,"code":0}},{"P":1077195094,"L":{"i":113213972,"f":33},"D":{"i":-2384,"f":38},"cn0":196,"lock":12,"flags":15,"sid":{"sat":24,"code":0}},{"P":1077194983,"L":{"i":88218664,"f":124},"D":{"i":-1858,"f":112},"cn0":188,"lock":12,"flags":15,"sid":{"sat":24,"code":7}},{"P":1115063916,"L":{"i":117194007,"f":4},"D":{"i":2442,"f":157},"cn0":188,"lock":11,"flags":15,"sid":{"sat":28,"code":0}}]} -{"preamble":85,"msg_type":74,"sender":51228,"length":249,"payload":"2Kp+CAAAAAAlCCCtL4RI7hufB2ie93esDA8KABMvhEg2WPAFf3j5HqwMDwoHzF2MRx4QhQf7MfFUuAwPDAAuXYxHiQzcBRx29D6cDA8MBw5A4z7iCpwGnCQJ5sgMDw0AcNf3PChlaAb2FANp0AwPDwCG1vc80zr+BDtmAlnEDA8PBx3f5kO+8yIHv+H5I7wIDxEAMt7mQ0iZjwUHO/sdpAgPEQcaLcVF5DhVBwze82WoCw8TAIRmpUQL+jYHtOb/fKQMDxQAv1g0QMR4vwbJsPbqxAwPGABXWDRA5xRCBVa/+BS8DA8YBzbhdkKhRvwG14oJ+7wLDxwA","crc":36341,"header":{"t":{"tow":142519000,"ns_residual":0,"wn":2085},"n_obs":32},"obs":[{"P":1216622509,"L":{"i":127867886,"f":104},"D":{"i":-2146,"f":119},"cn0":172,"lock":12,"flags":15,"sid":{"sat":10,"code":0}},{"P":1216622355,"L":{"i":99637302,"f":127},"D":{"i":-1672,"f":30},"cn0":172,"lock":12,"flags":15,"sid":{"sat":10,"code":7}},{"P":1200381388,"L":{"i":126160926,"f":251},"D":{"i":-3791,"f":84},"cn0":184,"lock":12,"flags":15,"sid":{"sat":12,"code":0}},{"P":1200381230,"L":{"i":98307209,"f":28},"D":{"i":-2954,"f":62},"cn0":156,"lock":12,"flags":15,"sid":{"sat":12,"code":7}},{"P":1055080462,"L":{"i":110889698,"f":156},"D":{"i":2340,"f":230},"cn0":200,"lock":12,"flags":15,"sid":{"sat":13,"code":0}},{"P":1022875504,"L":{"i":107504936,"f":246},"D":{"i":788,"f":105},"cn0":208,"lock":12,"flags":15,"sid":{"sat":15,"code":0}},{"P":1022875270,"L":{"i":83770067,"f":59},"D":{"i":614,"f":89},"cn0":196,"lock":12,"flags":15,"sid":{"sat":15,"code":7}},{"P":1139203869,"L":{"i":119731134,"f":191},"D":{"i":-1567,"f":35},"cn0":188,"lock":8,"flags":15,"sid":{"sat":17,"code":0}},{"P":1139203634,"L":{"i":93296968,"f":7},"D":{"i":-1221,"f":29},"cn0":164,"lock":8,"flags":15,"sid":{"sat":17,"code":7}},{"P":1170550042,"L":{"i":123025636,"f":12},"D":{"i":-3106,"f":101},"cn0":168,"lock":11,"flags":15,"sid":{"sat":19,"code":0}},{"P":1151690372,"L":{"i":121043467,"f":180},"D":{"i":-26,"f":124},"cn0":164,"lock":12,"flags":15,"sid":{"sat":20,"code":0}},{"P":1077172415,"L":{"i":113211588,"f":201},"D":{"i":-2384,"f":234},"cn0":196,"lock":12,"flags":15,"sid":{"sat":24,"code":0}},{"P":1077172311,"L":{"i":88216807,"f":86},"D":{"i":-1857,"f":20},"cn0":188,"lock":12,"flags":15,"sid":{"sat":24,"code":7}},{"P":1115087158,"L":{"i":117196449,"f":215},"D":{"i":2442,"f":251},"cn0":188,"lock":11,"flags":15,"sid":{"sat":28,"code":0}}]} diff --git a/c/test/legacy/cpp/sbp_data/gnss_data.sbp b/c/test/legacy/cpp/sbp_data/gnss_data.sbp deleted file mode 100644 index 20980f99f6..0000000000 Binary files a/c/test/legacy/cpp/sbp_data/gnss_data.sbp and /dev/null differ diff --git a/c/test/legacy/cpp/test_sbp_stdio.cc b/c/test/legacy/cpp/test_sbp_stdio.cc deleted file mode 100644 index 5fd56cb637..0000000000 --- a/c/test/legacy/cpp/test_sbp_stdio.cc +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Copyright (C) 2020-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -#include - -#include -// Obviously we don't normally want to silence this message, but we also need to -// still test the legacy implementation for as long as it exists. By silencing -// these messages here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include - -namespace { - -struct SbpHeaderParams { - uint16_t sender_id; - uint16_t msg_type; - uint8_t payload_len; - uint8_t payload[SBP_MAX_PAYLOAD_LEN]; -}; - -class MsgObsHandler : private sbp::PayloadHandler { - public: - explicit MsgObsHandler(sbp::LegacyState *state) - : sbp::PayloadHandler(state), state_(state) {} - - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, - const msg_obs_t &msg) override { - header_params_.sender_id = sender_id; - header_params_.msg_type = SBP_MSG_OBS; - header_params_.payload_len = message_length; - memcpy(&header_params_.payload[0], &msg, message_length); - } - - void write_message() const { - state_->send_message( - header_params_.msg_type, header_params_.sender_id, - header_params_.payload_len, - // NOLINTNEXTLINE - reinterpret_cast(&header_params_.payload)); - } - - SbpHeaderParams get_header_params() { return header_params_; } - - private: - SbpHeaderParams header_params_; - sbp::LegacyState *state_; -}; - -class SbpStdioTest : public ::testing::Test { - protected: - static int num_entries_in_file(const std::string &input_file) { - sbp::SbpFileReader reader = sbp::SbpFileReader(input_file.data()); - sbp::LegacyState state; - state.set_reader(&reader); - MsgObsHandler handler(&state); - - int count = 0; - while (true) { - s8 status = state.process(); - if (status < SBP_OK) { - break; - } - if (status == SBP_OK_CALLBACK_EXECUTED) { - count++; - } - } - return count; - } - - static void write_to_file(const std::string &input_file, - const std::string &output_file) { - sbp::SbpFileReader reader = sbp::SbpFileReader(input_file.data()); - sbp::SbpFileWriter writer = sbp::SbpFileWriter(output_file.data()); - sbp::LegacyState state; - state.set_reader(&reader); - state.set_writer(&writer); - MsgObsHandler handler(&state); - while (true) { - s8 status = state.process(); - if (status < SBP_OK) { - break; - } - if (status == SBP_OK_CALLBACK_EXECUTED) { - handler.write_message(); - handler.write_message(); - handler.write_message(); - } - } - } -}; - -TEST_F(SbpStdioTest, ReadsSbpFiles) { - EXPECT_EQ(num_entries_in_file("c/test/legacy/cpp/sbp_data/gnss_data.sbp"), 3); -} - -TEST_F(SbpStdioTest, WritesToSbpFiles) { - write_to_file("c/test/legacy/cpp/sbp_data/gnss_data.sbp", - "gnss_data_output.sbp"); - EXPECT_EQ(num_entries_in_file("gnss_data_output.sbp"), 9); -} - -} // namespace diff --git a/c/test_package/CMakeLists.txt b/c/test_package/CMakeLists.txt index 02b9122895..d6c0be07dd 100644 --- a/c/test_package/CMakeLists.txt +++ b/c/test_package/CMakeLists.txt @@ -17,20 +17,6 @@ if (NOT SBP_INCLUDE_DIRS) message(FATAL_ERROR "SBP header folder was not found") endif() -if (NOT WIN32) - add_executable(legacy_c legacy.c) - target_compile_features(legacy_c PRIVATE c_std_11) - target_link_libraries(legacy_c PRIVATE ${SBP_LIBRARY}) - target_include_directories(legacy_c PRIVATE ${SBP_INCLUDE_DIRS}) - target_compile_definitions(legacy_c PRIVATE SBP_FILE="${SBP_FILE}") - - add_executable(legacy_cxx legacy.cc) - target_compile_features(legacy_cxx PRIVATE cxx_std_14) - target_link_libraries(legacy_cxx PRIVATE ${SBP_LIBRARY}) - target_include_directories(legacy_cxx PRIVATE ${SBP_INCLUDE_DIRS}) - target_compile_definitions(legacy_cxx PRIVATE SBP_FILE="${SBP_FILE}") -endif() - add_executable(libsbp_c api.c) target_compile_features(libsbp_c PRIVATE c_std_11) target_link_libraries(libsbp_c PRIVATE ${SBP_LIBRARY}) diff --git a/c/test_package/legacy.c b/c/test_package/legacy.c deleted file mode 100644 index 2fd78dbaaf..0000000000 --- a/c/test_package/legacy.c +++ /dev/null @@ -1,95 +0,0 @@ -#include -#include -#include -#include - -struct Context { - FILE *input_file; - FILE *output_file; - sbp_state_t input_state; - sbp_state_t output_state; - sbp_msg_callbacks_node_t message_callback; -}; - -static s32 input_file_reader(u8 *buffer, u32 buffer_size, void *context) { - struct Context *ctx = (struct Context *) context; - if (feof(ctx->input_file)) { - return -1; - } - size_t count = fread(buffer, 1, buffer_size, ctx->input_file); - return (s32) count; -} - -static s32 output_file_writer(u8 *buffer, u32 buffer_size, void *context) { - struct Context *ctx = (struct Context *) context; - if (feof(ctx->output_file)) { - return -1; - } - size_t count = fwrite(buffer, 1, buffer_size, ctx->output_file); - return (s32) count; -} - -static void -input_file_payload_handler(u16 sender_id, u16 message_type, u8 payload_length, u8 payload[], u16 frame_length, - u8 frame[], void *context) { - (void) frame_length; - (void) frame; - - struct Context *ctx = (struct Context *) context; - sbp_payload_send(&ctx->output_state, message_type, sender_id, payload_length, payload, output_file_writer); -} - -int main() { - int exit_code = EXIT_SUCCESS; - struct Context context = {0}; - - context.input_file = fopen(SBP_FILE, "r"); - if (!context.input_file) { - fprintf(stderr, "Unable to open up input file\n"); - exit_code = EXIT_FAILURE; - goto bail; - } - - context.output_file = tmpfile(); - if (!context.output_file) { - fprintf(stderr, "Unable to open up output file\n"); - exit_code = EXIT_FAILURE; - goto bail; - } - - sbp_state_init(&context.input_state); - sbp_state_set_io_context(&context.input_state, &context); - sbp_all_payload_callback_register(&context.input_state, input_file_payload_handler, &context, - &context.message_callback); - - sbp_state_init(&context.output_state); - sbp_state_set_io_context(&context.output_state, &context); - - s8 ret = 0; - do { - ret = sbp_process(&context.input_state, input_file_reader); - } while (ret >= 0); - - rewind(context.input_file); - rewind(context.output_file); - - int input_char = 0; - int output_char = 0; - - do { - input_char = getc(context.input_file); - output_char = getc(context.output_file); - } while (input_char != EOF && output_char != EOF); - - if (input_char != output_char) { - fprintf(stderr, "File mismatch\n"); - exit_code = EXIT_FAILURE; - goto bail; - } - - bail: - fclose(context.input_file); - fclose(context.output_file); - - return exit_code; -} \ No newline at end of file diff --git a/c/test_package/legacy.cc b/c/test_package/legacy.cc deleted file mode 100644 index b9581a1d56..0000000000 --- a/c/test_package/legacy.cc +++ /dev/null @@ -1,110 +0,0 @@ -#include -#include - -#include -#include - -struct FileBase { - explicit FileBase(FILE *file) : file_(file) {} - - ~FileBase() { fclose(file_); } - - operator bool() const { - return file_; - } - - void rewind() { - ::rewind(file_); - } - - int getc() { - return ::getc(file_); - } - - FILE *const file_; -}; - -class FileReader : public FileBase, public sbp::IReader { -public: - explicit FileReader(FILE *file) : FileBase(file), sbp::IReader() {} - - s32 read(u8 *buffer, u32 buffer_length) override { - if (feof(file_)) { - return -1; - } - size_t count = fread(buffer, 1, buffer_length, file_); - return (s32) count; - } -}; - -class FileWriter : public FileBase, public sbp::IWriter { -public: - explicit FileWriter(FILE *file) : FileBase(file), sbp::IWriter() {} - - s32 write(const u8 *buffer, u32 buffer_length) override { - if (feof(file_)) { - return -1; - } - size_t count = fwrite(buffer, 1, buffer_length, file_); - return (s32) count; - } -}; - -class MessageHandler : public sbp::AllFrameHandler { -public: - MessageHandler(sbp::LegacyState *input_state, sbp::LegacyState *output_state) : AllFrameHandler(input_state), - output_state_(output_state) {} - - void handle_sbp_frame(uint16_t sender_id, uint16_t message_type, uint8_t payload_length, uint8_t *payload, - uint16_t frame_length, uint8_t *frame) override { - (void) frame_length; - (void) frame; - - output_state_->send_message(message_type, sender_id, payload_length, payload); - } - -private: - sbp::LegacyState *const output_state_; -}; - -int main() { - FileReader input_file(fopen(SBP_FILE, "r")); - FileWriter output_file(tmpfile()); - - if (!input_file) { - std::cerr << "Unable to open up input file\n"; - return EXIT_FAILURE; - } - - if (!output_file) { - std::cerr << "Unable to open up output file\n"; - return EXIT_FAILURE; - } - - sbp::LegacyState input_state(&input_file, nullptr); - sbp::LegacyState output_state(nullptr, &output_file); - MessageHandler message_handler(&input_state, &output_state); - - s8 ret = 0; - do { - ret = input_state.process(); - } while (ret >= 0); - - input_file.rewind(); - output_file.rewind(); - - int input_char = 0; - int output_char = 0; - - do { - input_char = input_file.getc(); - output_char = output_file.getc(); - } while (input_char != EOF && output_char != EOF); - - if (input_char != output_char) { - std::cerr << "File mismatch\n"; - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -} diff --git a/generator/sbpg/generator.py b/generator/sbpg/generator.py index 43c7f2a56a..6c926793e2 100755 --- a/generator/sbpg/generator.py +++ b/generator/sbpg/generator.py @@ -170,12 +170,7 @@ def main(): with open(os.path.join(output_dir, "RELEASE-VERSION"), 'w') as ver_file: ver_file.write(release.full_version) js.render_source(output_dir, parsed) - elif args.c: - import sbpg.targets.legacy_c as legacy_c - legacy_c.render_source(output_dir + "/include/libsbp", parsed) elif args.test_c: - import sbpg.targets.test_legacy_c as test_legacy_c - test_legacy_c.render_source(output_dir, parsed) import sbpg.targets.test_c as test_c test_c.render_source(output_dir, parsed) elif args.haskell: @@ -210,7 +205,6 @@ def main(): import sbpg.targets.c as c c.render_version(output_dir, release) parsed = [yaml.parse_spec(spec) for _, spec in file_index_items] - legacy_c.render_traits(output_dir + "/include/libsbp", parsed) c.render_all(output_dir, parsed) elif args.python: py.render_version(output_dir, release) diff --git a/generator/sbpg/targets/c.py b/generator/sbpg/targets/c.py index 3bb185c517..d227739ba4 100644 --- a/generator/sbpg/targets/c.py +++ b/generator/sbpg/targets/c.py @@ -10,7 +10,7 @@ # WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. """ -Generator for c target (V4 API). +Generator for c target """ import re @@ -20,7 +20,6 @@ SBP_MESSAGES_TEMPLATE_NAME = "c/include/libsbp/package/sbp_messages_template.h" SBP_PACKAGE_TEMPLATE_NAME = "c/include/libsbp/sbp_package_template.h" -SBP_OLD_PACKAGE_TEMPLATE_NAME = "c/include/libsbp/v4/sbp_package_template.h" SBP_MSG_TEMPLATE_NAME = "c/include/libsbp/sbp_msg_template.h" VERSION_TEMPLATE_NAME = "c/include/libsbp/sbp_version_template.h" MESSAGE_TRAITS_TEMPLATE_NAME = "c/include/libsbp/cpp/message_traits_template.h" @@ -47,22 +46,20 @@ } TO_GNSS = { - "MSG_GPS_TIME" : "MSG_GPS_TIME_GNSS", - "MSG_UTC_TIME" : "MSG_UTC_TIME_GNSS", - "MSG_POS_LLH" : "MSG_POS_LLH_GNSS", - "MSG_POS_ECEF" : "MSG_POS_ECEF_GNSS", - "MSG_VEL_NED" : "MSG_VEL_NED_GNSS", - "MSG_VEL_ECEF" : "MSG_VEL_ECEF_GNSS", - "MSG_POS_ECEF_COV" : "MSG_POS_ECEF_COV_GNSS", - "MSG_VEL_ECEF_COV" : "MSG_VEL_ECEF_COV_GNSS", - "MSG_POS_LLH_COV" : "MSG_POS_LLH_COV_GNSS", - "MSG_VEL_NED_COV" : "MSG_VEL_NED_COV_GNSS" - } + "MSG_GPS_TIME": "MSG_GPS_TIME_GNSS", + "MSG_UTC_TIME": "MSG_UTC_TIME_GNSS", + "MSG_POS_LLH": "MSG_POS_LLH_GNSS", + "MSG_POS_ECEF": "MSG_POS_ECEF_GNSS", + "MSG_VEL_NED": "MSG_VEL_NED_GNSS", + "MSG_VEL_ECEF": "MSG_VEL_ECEF_GNSS", + "MSG_POS_ECEF_COV": "MSG_POS_ECEF_COV_GNSS", + "MSG_VEL_ECEF_COV": "MSG_VEL_ECEF_COV_GNSS", + "MSG_POS_LLH_COV": "MSG_POS_LLH_COV_GNSS", + "MSG_VEL_NED_COV": "MSG_VEL_NED_COV_GNSS", +} TO_NON_GNSS = {v: k for k, v in TO_GNSS.items()} -COLLISIONS = set(["GnssSignal", "GPSTime"]) - def commentify(value): """ @@ -82,53 +79,39 @@ def camel_case(value): return "".join(ele.title() for ele in value.split("_")) -def get_v4_basename(identifier): +def get_basename(identifier): """ - Convert an identifier from the SBP spec to the base component used to construct other related identifiers in the V4 schema + Convert an identifier from the SBP spec to the base component used to construct other related identifiers - The basename is the identifier from the SBP spec convertered to snake_case and prefixed with either: - "sbp_v4_" for types in the collisions list - "sbp_" for everything else + The basename is the identifier from the SBP spec convertered to snake_case and prefixed with "sbp_" """ s0 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", identifier) s1 = re.sub("([a-z0-9])([A-Z])", r"\1_\2", s0).lower() - s2 = "sbp_v4_" + s1 if identifier in COLLISIONS else "sbp_" + s1 - return s2 + return "sbp_" + s1 def get_union_member_name(identifier): """Convert an identifier to the appropriate name for use in the `sbp_msg_t` union Only works for real messages, calling this with any other typename will assert """ - basename = get_v4_basename(identifier) + basename = get_basename(identifier) dropped = basename[:8] assert dropped == "sbp_msg_" return basename[8:] -def get_v4_typename(identifier): +def get_typename(identifier): """ - Convert an SBP spec identifier in to the correct typename according to the V4 API + Convert an SBP spec identifier in to the correct typename """ if identifier in PRIMITIVE_TYPES: return identifier - return get_v4_basename(identifier) + "_t" - - -def get_legacy_typename(identifier): - """ - Convert an SBP spec identifier in to the correct typename according to the legacy API - """ - typename = get_v4_typename(identifier) - if typename[:7] == "sbp_v4_": - return "sbp_" + typename[7:] - assert typename[:4] == "sbp_" - return typename[4:] + return get_basename(identifier) + "_t" -def get_v4_msg_type(identifier): +def get_msg_type(identifier): """ - Convert an SBP spec identifier to the msg_type identifier according to the V4 API + Convert an SBP spec identifier to the msg_type identifier Only works for real messages will assert when called for any other type """ @@ -136,16 +119,6 @@ def get_v4_msg_type(identifier): return camel_case("sbp_" + identifier.lower()) -def get_legacy_msg_type(identifier): - """ - Convert an SBP spec identifier to the message type #define identifier according to the legacy API - Only works for real messages, will assert when called for any other type - """ - - assert identifier[:4] == "MSG_" - return "SBP_" + identifier - - def get_public_encode_fn(typename): """ Get the name of the public function which can encode a given type @@ -215,7 +188,7 @@ def get_field_encoded_len(field, package_specs): if field.type_id == "array": if "size" in field.options: return field.options["size"].value * get_encoded_len_value( - get_v4_typename(field.options["fill"].value), package_specs + get_typename(field.options["fill"].value), package_specs ) # Variable length array, can't calculate a length. This will later cause an assert if it's being used from an embedded type return 0 @@ -223,7 +196,7 @@ def get_field_encoded_len(field, package_specs): if "size" in field.options: return field.options["size"].value return 0 - return get_encoded_len_value(get_v4_typename(field.type_id), package_specs) + return get_encoded_len_value(get_typename(field.type_id), package_specs) def get_encoded_len_macro(typename, is_fixed_size): @@ -248,7 +221,7 @@ def get_encoded_len_value(typename, package_specs): encoded_len = 0 for package in package_specs: for msg in package.definitions: - if get_v4_typename(msg.identifier) == typename: + if get_typename(msg.identifier) == typename: for f in msg.fields: encoded_len = encoded_len + get_field_encoded_len(f, package_specs) return encoded_len @@ -284,7 +257,7 @@ def get_max_possible_items(msg, field, package_specs): if field.type_id == "string": return available_space elem_size = get_encoded_len_value( - get_v4_typename(field.options["fill"].value), package_specs + get_typename(field.options["fill"].value), package_specs ) return int(available_space / elem_size) @@ -294,9 +267,7 @@ def get_max_possible_items_macro(msg, field): Get the name of the macro which will define the maximum number of items that can be stored in a field """ assert field.type_id == "array" or field.type_id == "string" - macro_name = get_v4_basename(msg.identifier) - if macro_name[:7] == "sbp_v4_": - macro_name = "sbp_" + macro_name[7:] + macro_name = get_basename(msg.identifier) macro_name = macro_name + "_" + field.identifier + "_MAX" return macro_name.upper() @@ -324,7 +295,11 @@ def create_bitfield_macros(field, msg): """#define {}_GET(flags) \\ (({})(({})((flags) >> {}_SHIFT) \\ & {}_MASK))""".format( - base_string, field.basetype, field.basetype, base_string, base_string + base_string, + field.basetype, + field.basetype, + base_string, + base_string, ) ) ret_list.append( @@ -333,7 +308,12 @@ def create_bitfield_macros(field, msg): (((val) & ({}_MASK)) \\ << ({}_SHIFT)));}} while(0) """.format( - base_string, field.basetype, base_string, base_string, base_string, base_string + base_string, + field.basetype, + base_string, + base_string, + base_string, + base_string, ) ) ret_list.append("") @@ -383,7 +363,7 @@ def __init__(self, msg, package_specs, field): type_id = field.type_id self.units = field.units self.desc = field.desc - self.fn_prefix = get_v4_basename(msg.identifier) + "_" + field.identifier + self.fn_prefix = get_basename(msg.identifier) + "_" + field.identifier if type_id == "string" and "size" in field.options: self.packing = "fixed-array" @@ -408,7 +388,7 @@ def __init__(self, msg, package_specs, field): elif type_id == "array" and "size" in field.options: self.packing = "fixed-array" self.basetype_from_spec = field.options["fill"].value - self.basetype = get_v4_typename(field.options["fill"].value) + self.basetype = get_typename(field.options["fill"].value) self.encode_fn = get_internal_encode_fn(self.basetype) self.decode_fn = get_internal_decode_fn(self.basetype) self.cmp_fn = get_cmp_fn(self.basetype) @@ -421,7 +401,7 @@ def __init__(self, msg, package_specs, field): elif type_id == "array": self.packing = "variable-array" self.basetype_from_spec = field.options["fill"].value - self.basetype = get_v4_typename(field.options["fill"].value) + self.basetype = get_typename(field.options["fill"].value) self.encode_fn = get_internal_encode_fn(self.basetype) self.decode_fn = get_internal_decode_fn(self.basetype) self.cmp_fn = get_cmp_fn(self.basetype) @@ -440,7 +420,7 @@ def __init__(self, msg, package_specs, field): else: self.packing = "single" self.basetype_from_spec = type_id - self.basetype = get_v4_typename(type_id) + self.basetype = get_typename(type_id) self.encode_fn = get_internal_encode_fn(self.basetype) self.decode_fn = get_internal_decode_fn(self.basetype) self.cmp_fn = get_cmp_fn(self.basetype) @@ -473,16 +453,14 @@ class MsgItem(object): def __init__(self, msg, package, package_specs): self.name = msg.identifier - self.basename = get_v4_basename(msg.identifier) - self.type_name = get_v4_typename(msg.identifier) - self.legacy_type_name = get_legacy_typename(msg.identifier) + self.basename = get_basename(msg.identifier) + self.type_name = get_typename(msg.identifier) self.is_real_message = msg.is_real_message self.package_name = package.name self.package_filepath = package.filepath self.package_includes = package.includes if self.is_real_message: - self.v4_msg_type = get_v4_msg_type(msg.identifier) - self.legacy_msg_type = get_legacy_msg_type(msg.identifier) + self.msg_type = get_msg_type(msg.identifier) self.union_member_name = get_union_member_name(msg.identifier) self.send_fn = get_send_fn(self.type_name) self.public_encode_fn = get_public_encode_fn(self.type_name) @@ -501,11 +479,13 @@ def __init__(self, msg, package, package_specs): self.non_gnss_type_name = "" self.return_union_member_name = "" if self.name in TO_GNSS: - self.gnss_type_name = get_v4_typename(TO_GNSS[self.name]) + self.gnss_type_name = get_typename(TO_GNSS[self.name]) self.return_union_member_name = get_union_member_name(TO_GNSS[self.name]) if self.name in TO_NON_GNSS: - self.non_gnss_type_name = get_v4_typename(TO_NON_GNSS[self.name]) - self.return_union_member_name = get_union_member_name(TO_NON_GNSS[self.name]) + self.non_gnss_type_name = get_typename(TO_NON_GNSS[self.name]) + self.return_union_member_name = get_union_member_name( + TO_NON_GNSS[self.name] + ) for f in msg.fields: new_field = FieldItem(msg, package_specs, f) if not new_field.is_fixed_size: @@ -528,7 +508,7 @@ def __init__(self, msg, package, package_specs): self.encoded_len_value = get_encoded_len_value(self.type_name, package_specs) def render(self, output_dir): - # Public header for V4 API - include/libsbp//.h + # Public header - include/libsbp//.h destination_filename = "%s/include/libsbp/%s/%s.h" % ( output_dir, self.package_name, @@ -578,22 +558,9 @@ def render(self, output_dir): "package": self, }, ) - # - # Old public header for the package - include/libsbp/v4/.h - # Generates a compile time message and includes the real public header - include/libsbp/.h - # To be removed in version 6 - destination_filename = "%s/include/libsbp/v4/%s.h" % (output_dir, self.name) - render_file( - SBP_OLD_PACKAGE_TEMPLATE_NAME, - destination_filename, - { - "package": self, - }, - ) # Public macros header - include/libsbp/_macros.h - # Declares certain symbols shared between legacy and V4 APIs such as - # message type #define and bitfield macros + # Declares certain constants and symbols such as bitfield macros destination_filename = "%s/include/libsbp/%s_macros.h" % (output_dir, self.name) render_file( SBP_MESSAGES_MACROS_TEMPLATE_NAME, @@ -661,7 +628,7 @@ def render_all(output_dir, package_specs): for p in all_packages: p.render(output_dir) - # Render sbp_msg_t type, union of all real messages in V4 API + # Render sbp_msg_t type, union of all real messages destination_filename = "%s/include/libsbp/sbp_msg.h" % (output_dir) render_file( SBP_MSG_TEMPLATE_NAME, @@ -672,7 +639,7 @@ def render_all(output_dir, package_specs): }, ) - # Render sbp_msg_type_t type, V4 message type enum + # Render sbp_msg_type_t type destination_filename = "%s/include/libsbp/sbp_msg_type.h" % (output_dir) render_file( SBP_MSG_TYPE_TEMPLATE_NAME, @@ -683,7 +650,7 @@ def render_all(output_dir, package_specs): }, ) - # C++ message traits for V4 API + # C++ message traits destination_filename = "%s/include/libsbp/cpp/message_traits.h" % (output_dir) render_file( MESSAGE_TRAITS_TEMPLATE_NAME, diff --git a/generator/sbpg/targets/resources/c/include/libsbp/cpp/message_traits_template.h b/generator/sbpg/targets/resources/c/include/libsbp/cpp/message_traits_template.h index 49f1ef9a11..67af67ce7d 100644 --- a/generator/sbpg/targets/resources/c/include/libsbp/cpp/message_traits_template.h +++ b/generator/sbpg/targets/resources/c/include/libsbp/cpp/message_traits_template.h @@ -37,7 +37,7 @@ struct MessageTraits; ((* for m in real_messages *)) template<> struct MessageTraits<(((m.type_name)))> { - static constexpr sbp_msg_type_t id = (((m.v4_msg_type))); + static constexpr sbp_msg_type_t id = (((m.msg_type))); static constexpr const char *name = "(((m.name)))"; static const (((m.type_name)))& get(const sbp_msg_t &msg) { return msg.(((m.union_member_name))); diff --git a/generator/sbpg/targets/resources/c/include/libsbp/legacy/cpp/message_traits_template.h b/generator/sbpg/targets/resources/c/include/libsbp/legacy/cpp/message_traits_template.h deleted file mode 100644 index 8a1ce300c6..0000000000 --- a/generator/sbpg/targets/resources/c/include/libsbp/legacy/cpp/message_traits_template.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (C) 2019-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifndef SBP_CPP_MESSAGE_TRAITS_H -#define SBP_CPP_MESSAGE_TRAITS_H - -((*- for i in includes *)) -#include -((*- endfor *)) - -namespace sbp { - -/** - * Type traits containing meta-information for each SBP message type. - * - * These are only meant to be used by the C++ library at compile time. - * These are automatically generated, DO NOT EDIT. - */ -template -struct MessageTraits; - -((* for m in msgs *)) -((*- if m.fields *)) -template<> -struct MessageTraits<(((m.identifier|convert)))> { - static constexpr u16 id = (((m.sbp_id))); -}; -((* endif *)) -((* endfor *)) - - -} // namespace sbp - -#endif //SBP_CPP_MESSAGE_TRAITS_H diff --git a/generator/sbpg/targets/resources/c/include/libsbp/legacy/sbp_messages_template.h b/generator/sbpg/targets/resources/c/include/libsbp/legacy/sbp_messages_template.h deleted file mode 100644 index 9466ff5d33..0000000000 --- a/generator/sbpg/targets/resources/c/include/libsbp/legacy/sbp_messages_template.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/(((filepath))) - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -/** \defgroup (((pkg_name))) (((pkg_name|capitalize))) - * -(((description|commentify))) - * \{ */ - -#ifndef LIBSBP_LEGACY_(((pkg_name|upper)))_MESSAGES_H -#define LIBSBP_LEGACY_(((pkg_name|upper)))_MESSAGES_H - -#include - -SBP_MESSAGE( - "The legacy libsbp API has been deprecated. This file and all symbols contained will " - "be removed in version 6. You should immediately switch over to the modern libsbp API.") - -#include -((*- for i in include *)) -#include -((*- endfor *)) - -SBP_PACK_START - -((* for m in msgs *)) -((*- if m.desc *)) -/** (((m.short_desc))) - * -(((m.desc|commentify))) - */ -((*- endif *)) -((*- if m.fields *)) - -typedef struct SBP_ATTR_PACKED SBP_DEPRECATED { - ((*- for f in m.fields *)) - ((*- if f.desc *)) - (((f|mk_id))) ((((f|mk_size).ljust(m.max_fid_len+4)))) /**< ((( f.desc|commentify_field(f,m) ))) ((* if f.units *))[(((f.units)))] ((* endif *))*/ - ((*- else *)) - (((f|mk_id))) ((((f|mk_size).ljust(m.max_fid_len+4)))) - ((*- endif *)) - ((*- endfor *)) -} (((m.identifier|convert))); -((*- endif *)) - -((* endfor *)) -/** \} */ - -SBP_PACK_END - -#endif /* LIBSBP_LEGACY_(((pkg_name|upper)))_MESSAGES_H */ diff --git a/generator/sbpg/targets/resources/c/include/libsbp/sbp_messages_macros_template.h b/generator/sbpg/targets/resources/c/include/libsbp/sbp_messages_macros_template.h index 08ba204cfc..d09141f399 100644 --- a/generator/sbpg/targets/resources/c/include/libsbp/sbp_messages_macros_template.h +++ b/generator/sbpg/targets/resources/c/include/libsbp/sbp_messages_macros_template.h @@ -19,31 +19,26 @@ #define LIBSBP_(((package.name|upper)))_MACROS_H ((* for m in package.msgs *)) -((*- if m.is_real_message *)) -#define SBP_(((m.name))) ((('0x%04X'|format(m.sbp_id)))) -((*- endif *)) ((*- for f in m.fields *)) ((*- if f.options.fields *)) (((f|create_bitfield_macros(m.name)))) ((*- endif*)) ((*- if f.packing != "single" *)) /** - * The maximum number of items that can be stored in (((m.type_name)))::(((f.name))) (V4 API) or (((m.legacy_type_name)))::(((f.name))) (legacy API) before the maximum SBP message size is exceeded + * The maximum number of items that can be stored in (((m.type_name)))::(((f.name))) before the maximum SBP message size is exceeded */ #define (((f.max_items_macro))) (((f.max_items)))u ((* endif *)) ((*- endfor *)) /** - * Encoded length of (((m.type_name))) (V4 API) and - * (((m.legacy_type_name))) (legacy API) + * Encoded length of (((m.type_name))) (V4 API) ((*- if not m.is_fixed_size *)) * * This type is not fixed size and an instance of this message may be longer * than the value indicated by this symbol. Users of the V4 API should call * #(((m.encoded_len_fn))) to determine the actual size of an instance - * of this message. Users of the legacy API are required to track the encoded - * message length when interacting with the legacy type. + * of this message. * * See the documentation for libsbp for more details regarding the message * structure and its variable length component(s) diff --git a/generator/sbpg/targets/resources/c/include/libsbp/sbp_msg_template.h b/generator/sbpg/targets/resources/c/include/libsbp/sbp_msg_template.h index 1767156313..e4bc3f1597 100644 --- a/generator/sbpg/targets/resources/c/include/libsbp/sbp_msg_template.h +++ b/generator/sbpg/targets/resources/c/include/libsbp/sbp_msg_template.h @@ -15,8 +15,8 @@ * with generate.py. Please do not hand edit! *****************************************************************************/ -#ifndef LIBSBP_V4_SBP_MSG_H -#define LIBSBP_V4_SBP_MSG_H +#ifndef LIBSBP_SBP_MSG_H +#define LIBSBP_SBP_MSG_H #include #include @@ -57,7 +57,7 @@ typedef union { static inline s8 sbp_message_encode(uint8_t *buf, uint8_t len, uint8_t *n_written, sbp_msg_type_t msg_type, const sbp_msg_t *msg) { switch(msg_type) { ((*- for m in real_messages *)) - case (((m.v4_msg_type))): + case (((m.msg_type))): return (((m.public_encode_fn)))(buf, len, n_written, &msg->(((m.union_member_name)))); ((*- endfor *)) case SbpMsgAll: @@ -82,7 +82,7 @@ static inline s8 sbp_message_encode(uint8_t *buf, uint8_t len, uint8_t *n_writte static inline s8 sbp_message_decode(const uint8_t *buf, uint8_t len, uint8_t *n_read, sbp_msg_type_t msg_type, sbp_msg_t *msg) { switch(msg_type) { ((*- for m in real_messages *)) - case (((m.v4_msg_type))): + case (((m.msg_type))): return (((m.public_decode_fn)))(buf, len, n_read, &msg->(((m.union_member_name)))); ((*- endfor *)) case SbpMsgAll: @@ -102,7 +102,7 @@ static inline s8 sbp_message_decode(const uint8_t *buf, uint8_t len, uint8_t *n_ static inline size_t sbp_message_encoded_len(sbp_msg_type_t msg_type, const sbp_msg_t *msg) { switch(msg_type) { ((*- for m in real_messages *)) - case (((m.v4_msg_type))): + case (((m.msg_type))): return (((m.encoded_len_fn)))(&msg->(((m.union_member_name)))); ((*- endfor *)) case SbpMsgAll: @@ -125,7 +125,7 @@ static inline size_t sbp_message_encoded_len(sbp_msg_type_t msg_type, const sbp_ static inline int sbp_message_cmp(sbp_msg_type_t msg_type, const sbp_msg_t *a, const sbp_msg_t *b) { switch(msg_type) { ((*- for m in real_messages *)) - case (((m.v4_msg_type))): + case (((m.msg_type))): return (((m.cmp_fn)))(&a->(((m.union_member_name))), &b->(((m.union_member_name)))); ((*- endfor *)) case SbpMsgAll: @@ -140,5 +140,5 @@ static inline int sbp_message_cmp(sbp_msg_type_t msg_type, const sbp_msg_t *a, c } #endif -#endif /* LIBSBP_V4_SBP_MSG_H */ +#endif /* LIBSBP_SBP_MSG_H */ diff --git a/generator/sbpg/targets/resources/c/include/libsbp/sbp_msg_type_template.h b/generator/sbpg/targets/resources/c/include/libsbp/sbp_msg_type_template.h index bd62e1494d..6e980ca33b 100644 --- a/generator/sbpg/targets/resources/c/include/libsbp/sbp_msg_type_template.h +++ b/generator/sbpg/targets/resources/c/include/libsbp/sbp_msg_type_template.h @@ -26,21 +26,18 @@ extern "C" { #endif -/** SBP_MSG_ID to use to register frame callback for ALL messages. */ -#define SBP_MSG_ALL 0 - typedef enum { ((*- for m in real_messages *)) - (((m.v4_msg_type))) = (((m.legacy_msg_type))), + (((m.msg_type))) = ((('0x%04X'|format(m.sbp_id)))), ((*- endfor *)) - SbpMsgAll = SBP_MSG_ALL, - SbpMsgUnknown = SBP_MSG_ALL, + SbpMsgAll = 0, + SbpMsgUnknown = 0, } sbp_msg_type_t; static inline const char *sbp_msg_type_to_string(sbp_msg_type_t msg_type) { switch(msg_type) { ((*- for m in real_messages *)) - case (((m.v4_msg_type))): + case (((m.msg_type))): return "(((m.name)))"; ((*- endfor *)) case SbpMsgAll: diff --git a/generator/sbpg/targets/resources/c/include/libsbp/v4/sbp_package_template.h b/generator/sbpg/targets/resources/c/include/libsbp/v4/sbp_package_template.h deleted file mode 100644 index f0a2938e18..0000000000 --- a/generator/sbpg/targets/resources/c/include/libsbp/v4/sbp_package_template.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -/***************************************************************************** - * Automatically generated from yaml/(((filepath))) - * with generate.py. Please do not hand edit! - *****************************************************************************/ - -#ifndef LIBSBP_(((package.name|upper)))_MESSAGES_H -#define LIBSBP_(((package.name|upper)))_MESSAGES_H - -#include - -SBP_MESSAGE( - "SBP message definitions have moved. To continue using these types include " - "`libsbp/(((package.name))).h instead. Access to SBP types via this header file " - " will be removed in version 6.") - -#include - -#endif /* LIBSBP_(((package.name|upper)))_MESSAGES_H */ diff --git a/generator/sbpg/targets/resources/c/src/sbp_messages_template.c b/generator/sbpg/targets/resources/c/src/sbp_messages_template.c index d7232dc992..8ce9294710 100644 --- a/generator/sbpg/targets/resources/c/src/sbp_messages_template.c +++ b/generator/sbpg/targets/resources/c/src/sbp_messages_template.c @@ -253,7 +253,7 @@ s8 (((m.send_fn)))(sbp_state_t *s, u16 sender_id, const (((m.type_name))) *msg, uint8_t payload_len; s8 ret = (((m.public_encode_fn)))(payload, sizeof(payload), &payload_len, msg); if (ret != SBP_OK) { return ret; } - return sbp_internal_forward_payload(s, (((m.legacy_msg_type))), sender_id, payload_len, payload, write); + return sbp_internal_forward_payload(s, (((m.msg_type))), sender_id, payload_len, payload, write); } ((*- endif *)) diff --git a/generator/sbpg/targets/resources/c/test/legacy/sbp_c_test.c.j2 b/generator/sbpg/targets/resources/c/test/legacy/sbp_c_test.c.j2 deleted file mode 100644 index 2d422f6cb2..0000000000 --- a/generator/sbpg/targets/resources/c/test/legacy/sbp_c_test.c.j2 +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from (((s.src_filename))) by generate.py. Do not modify by hand! - -#include -#include // for debugging -#include // for malloc -#include - -// Obviously we don't normally want to silence this message, but we also need to still -// test the legacy implementation for as long as it exists. By silencing these messages -// here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u8 len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - void *context; -} last_msg; - -static struct { - u32 n_callbacks_logged; - u16 sender_id; - u16 msg_type; - u8 msg_len; - u8 msg[SBP_MAX_PAYLOAD_LEN]; - u16 frame_len; - u8 frame[SBP_MAX_FRAME_LEN]; - void *context; -} last_frame; - -static u32 dummy_wr = 0; -static u32 dummy_rd = 0; -static u8 dummy_buff[1024]; -static void* last_io_context; - -static int DUMMY_MEMORY_FOR_CALLBACKS = 0xdeadbeef; -static int DUMMY_MEMORY_FOR_IO = 0xdead0000; - -static void dummy_reset() -{ - dummy_rd = dummy_wr = 0; - memset(dummy_buff, 0, sizeof(dummy_buff)); -} - -static s32 dummy_write(u8 *buff, u32 n, void* context) -{ - last_io_context = context; - u32 real_n = n;//(dummy_n > n) ? n : dummy_n; - memcpy(dummy_buff + dummy_wr, buff, real_n); - dummy_wr += real_n; - return real_n; -} - -static s32 dummy_read(u8 *buff, u32 n, void* context) -{ - last_io_context = context; - u32 real_n = n;//(dummy_n > n) ? n : dummy_n; - memcpy(buff, dummy_buff + dummy_rd, real_n); - dummy_rd += real_n; - return real_n; -} - -static void logging_reset() -{ - memset(&last_msg, 0, sizeof(last_msg)); - memset(&last_frame, 0, sizeof(last_frame)); -} - -static void msg_callback(u16 sender_id, u8 len, u8 msg[], void* context) -{ - last_msg.n_callbacks_logged++; - last_msg.sender_id = sender_id; - last_msg.len = len; - last_msg.context = context; - memcpy(last_msg.msg, msg, len); -} - -static void frame_callback(u16 sender_id, u16 msg_type, u8 msg_len, u8 msg[], u16 frame_len, u8 frame[], void *context) -{ - last_frame.n_callbacks_logged++; - last_frame.sender_id = sender_id; - last_frame.msg_type = msg_type; - last_frame.msg_len = msg_len; - memcpy(last_frame.msg, msg, msg_len); - last_frame.frame_len = frame_len; - memcpy(last_frame.frame, frame, frame_len); - last_frame.context = context; -} - -START_TEST( test_legacy_(((s.suite_name))) ) -{ - static sbp_msg_callbacks_node_t n; - static sbp_msg_callbacks_node_t n2; - - // State of the SBP message parser. - // Must be statically allocated. - sbp_state_t sbp_state; - - // - // Run tests: - // - - ((*- macro compare_value(prefix, value) *)) - ((*- if value is string_type *)) - { - const char check_string[] = { (((value|str_escape))) }; - ck_assert_msg(memcmp(check_msg->(((prefix))), check_string, sizeof(check_string)) == 0, "incorrect value for check_msg->(((prefix))), expected string '%s', is '%s'", check_string, check_msg->(((prefix)))); - } - ((*- elif value is array_type *)) - ((*- for ff in value *))((( compare_value( (((prefix))) + '[' + (((loop.index0|to_str))) + ']', (((ff))) ) )))((*- endfor *)) - ((*- elif value is dict_type *)) - ((*- for k in (((value|sorted))) *))((( compare_value( (((prefix))) + '.' + (((k))), (((value[k]))) ) )))((*- endfor *)) - ((*- elif value is float_type *))((= - Note: the ("%.12g"|format(value)|float) filter is intended to keep float - literal precision unchanged whether generated under Python 2.7 or 3.x. =)) - ck_assert_msg((check_msg->(((prefix)))*100 - ((("%.12g"|format(value)|float)))*100) < 0.05, "incorrect value for (((prefix))), expected ((("%.12g"|format(value)|float))), is %f", check_msg->(((prefix)))); - ((*- else *)) - ck_assert_msg(check_msg->(((prefix))) == (((value))), "incorrect value for (((prefix))), expected (((value))), is %d", check_msg->(((prefix)))); - ((*- endif *)) - ((*- endmacro *)) - - ((*- macro assign_value(prefix, value) *)) - ((*- if value is string_type *)) - { - const char assign_string[] = { (((value|str_escape))) }; - memcpy(test_msg->(((prefix))), assign_string, sizeof(assign_string)); - if (sizeof(test_msg->(((prefix)))) == 0) { - test_msg_len += sizeof(assign_string); - } - } - ((*- elif value is array_type *)) - ((*- for ff in value *)) - if (sizeof(test_msg->(((prefix)))) == 0) { - // Cope with variable length arrays - test_msg_len += sizeof(test_msg->(((prefix)))[0]); - } - (((- assign_value( (((prefix))) + '[' + (((loop.index0|to_str))) + ']', (((ff))) ) -))) - ((*- endfor *)) - ((*- elif value is dict_type *)) - ((*- for k in (((value|sorted))) *))((( assign_value( (((prefix))) + '.' + (((k))), (((value[k]))) ) )))((*- endfor *)) - ((*- else *)) - test_msg->(((prefix))) = (((value))); - ((*- endif *)) - ((*- endmacro *)) - - ((*- for t in s.tests *)) - // Test successful parsing of a message - { - // SBP parser state must be initialized before sbp_process is called. - // We re-initialize before every test so that callbacks for the same message types can be - // allocated multiple times across different tests. - sbp_state_init(&sbp_state); - - sbp_state_set_io_context(&sbp_state, &DUMMY_MEMORY_FOR_IO); - - logging_reset(); - - sbp_payload_callback_register(&sbp_state, (((t.msg_type))), &msg_callback, &DUMMY_MEMORY_FOR_CALLBACKS, &n); - sbp_frame_callback_register(&sbp_state, (((t.msg_type))), &frame_callback, &DUMMY_MEMORY_FOR_CALLBACKS, &n2); - - u8 encoded_frame[] = { ((*- for p in t.packet_as_byte_array *))(((p))),((*- endfor *)) }; - - dummy_reset(); - - u8 test_msg_storage[SBP_MAX_PAYLOAD_LEN]; - memset(test_msg_storage, 0, sizeof(test_msg_storage)); - u8 test_msg_len = 0; - ((*- if t.fields *)) - (((t.msg_type_name|convert)))* test_msg = ( (((t.msg_type_name|convert)))* )test_msg_storage; - test_msg_len = sizeof(*test_msg); - ((*- for f in t.fieldskeys *))(((assign_value( (((f))), (((t.fields[f]))) ))))((*- endfor *)) - ((*- endif *)) - sbp_payload_send(&sbp_state, (((t.msg_type))), (((t.raw_json_obj.sender))), test_msg_len, test_msg_storage, &dummy_write); - - ck_assert_msg(test_msg_len == sizeof(encoded_frame) - 8, - "Test message has not been generated correctly, or the encoded frame from the spec is badly defined. Check your test spec"); - - ck_assert_msg(dummy_wr == sizeof(encoded_frame), - "not enough data was written to dummy_buff"); - ck_assert_msg(memcmp(dummy_buff, encoded_frame, sizeof(encoded_frame)) == 0, - "frame was not encoded properly"); - - while (dummy_rd < dummy_wr) { - ck_assert_msg(sbp_process(&sbp_state, &dummy_read) >= SBP_OK, - "sbp_process threw an error!"); - } - - ck_assert_msg(last_msg.n_callbacks_logged == 1, - "msg_callback: one callback should have been logged"); - ck_assert_msg(last_msg.sender_id == (((t.raw_json_obj.sender))), - "msg_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_msg.len == sizeof(encoded_frame) - 8, - "msg_callback: len decoded incorrectly"); - ck_assert_msg(memcmp(last_msg.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) - == 0, - "msg_callback: test data decoded incorrectly"); - ck_assert_msg(last_msg.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - ck_assert_msg(last_frame.n_callbacks_logged == 1, - "frame_callback: one callback should have been logged"); - ck_assert_msg(last_frame.sender_id == (((t.raw_json_obj.sender))), - "frame_callback: sender_id decoded incorrectly"); - ck_assert_msg(last_frame.msg_type == (((t.msg_type))), - "frame_callback: msg_type decoded incorrectly"); - ck_assert_msg(last_frame.msg_len == sizeof(encoded_frame) - 8, - "frame_callback: msg_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.msg, encoded_frame + 6, sizeof(encoded_frame) - 8) == 0, - "frame_callback: test data decoded incorrectly"); - ck_assert_msg(last_frame.frame_len == sizeof(encoded_frame), - "frame_callback: frame_len decoded incorrectly"); - ck_assert_msg(memcmp(last_frame.frame, encoded_frame, sizeof(encoded_frame)) == 0, - "frame_callback: frame decoded incorrectly"); - ck_assert_msg(last_frame.context == &DUMMY_MEMORY_FOR_CALLBACKS, - "frame_callback: context pointer incorrectly passed"); - - // Cast to expected message type - the +6 byte offset is where the payload starts - ((*- if t.fields *)) - (((t.msg_type_name|convert)))* check_msg = ( (((t.msg_type_name|convert))) *)((void *)last_msg.msg); - // Run tests against fields - ck_assert_msg(check_msg != 0, "stub to prevent warnings if msg isn't used"); - ((*- for f in t.fieldskeys *))(((compare_value( (((f))), (((t.fields[f]))) ))))((*- endfor *)) - ((*- endif *)) - } - ((*- endfor *)) -} -END_TEST - -Suite* legacy_(((s.suite_name)))_suite(void) -{ - Suite *s = suite_create("SBP generated test suite: legacy_(((s.suite_name)))"); - TCase *tc_acq = tcase_create("Automated_Suite_legacy_(((s.suite_name)))"); - tcase_add_test(tc_acq, test_legacy_(((s.suite_name)))); - suite_add_tcase(s, tc_acq); - return s; -} diff --git a/generator/sbpg/targets/resources/c/test/legacy/sbp_cpp_test.cc.j2 b/generator/sbpg/targets/resources/c/test/legacy/sbp_cpp_test.cc.j2 deleted file mode 100644 index 4bb7923e20..0000000000 --- a/generator/sbpg/targets/resources/c/test/legacy/sbp_cpp_test.cc.j2 +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) 2015-2021 Swift Navigation Inc. - * Contact: https://support.swiftnav.com - * - * This source is subject to the license found in the file 'LICENSE' which must - * be be distributed together with this source. All other rights reserved. - * - * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, - * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. - */ - -// This file was auto-generated from (((s.src_filename))) by generate.py. Do not modify by hand! - -#include - -#include - -// Obviously we don't normally want to silence this message, but we also need to still -// test the legacy implementation for as long as it exists. By silencing these messages -// here we can get a less noisy build in libsbp -#ifdef SBP_MESSAGE -#undef SBP_MESSAGE -#define SBP_MESSAGE(x) -#endif -#include -#include -#include -#include - -template> -U get_as(const uint8_t *buf) { - U v; - memcpy(&v, buf, sizeof(T)); - return v; -} - -((*- for t in s.tests *)) -((*- if t.fields *)) -class Test_legacy_(((s.suite_name)))(((loop.index0))) : - public ::testing::Test, - public sbp::LegacyState, - public sbp::IReader, - public sbp::IWriter, - sbp::PayloadHandler<(((t.msg_type_name|convert)))> -{ -public: - Test_legacy_(((s.suite_name)))(((loop.index0)))() : - ::testing::Test(), - sbp::LegacyState(), - sbp::IReader(), - sbp::IWriter(), - sbp::PayloadHandler<(((t.msg_type_name|convert)))>(this), - last_msg_storage_(), - last_msg_(reinterpret_cast<(((t.msg_type_name|convert)))*>(last_msg_storage_)), - last_msg_len_(), - last_sender_id_(), - n_callbacks_logged_(), - dummy_wr_(), - dummy_rd_(), - dummy_buff_() - { - set_reader(this); - set_writer(this); - } - - s32 read(uint8_t *buf, const uint32_t n) override - { - uint32_t real_n = n; - memcpy(buf, dummy_buff_ + dummy_rd_, real_n); - dummy_rd_ += real_n; - return (s32)real_n; - } - - s32 write(const uint8_t *buf, uint32_t n) override - { - uint32_t real_n = n; - memcpy(dummy_buff_ + dummy_wr_, buf, real_n); - dummy_wr_ += real_n; - return (s32)real_n; - } - - -protected: - - void handle_sbp_msg(uint16_t sender_id, uint8_t message_length, const (((t.msg_type_name|convert))) &msg) override - { - memcpy(last_msg_storage_, &msg, message_length); - last_msg_len_ = message_length; - last_sender_id_ = sender_id; - n_callbacks_logged_++; - } - - uint8_t last_msg_storage_[SBP_MAX_PAYLOAD_LEN]; - (((t.msg_type_name|convert))) *last_msg_; - uint8_t last_msg_len_; - uint16_t last_sender_id_; - size_t n_callbacks_logged_; - uint32_t dummy_wr_; - uint32_t dummy_rd_; - uint8_t dummy_buff_[1024]; -}; - -TEST_F(Test_legacy_(((s.suite_name)))(((loop.index0))), Test) -{ - ((*- macro compare_value(prefix, value) *)) - ((*- if value is string_type *)) - { - const char check_string[] = { (((value|str_escape))) }; - EXPECT_EQ(memcmp(last_msg_->(((prefix))), check_string, sizeof(check_string)), 0) << "incorrect value for last_msg_->(((prefix))), expected string '" << check_string << "', is '" << last_msg_->(((prefix))) << "'"; - } - ((*- elif value is array_type *)) - ((*- for ff in value *))((( compare_value( (((prefix))) + '[' + (((loop.index0|to_str))) + ']', (((ff))) ) )))((*- endfor *)) - ((*- elif value is dict_type *)) - ((*- for k in (((value|sorted))) *))((( compare_value( (((prefix))) + '.' + (((k))), (((value[k]))) ) )))((*- endfor *)) - ((*- elif value is float_type *))((= - Note: the ("%.12g"|format(value)|float) filter is intended to keep float - literal precision unchanged whether generated under Python 2.7 or 3.x. =)) - EXPECT_LT((last_msg_->(((prefix)))*100 - ((("%.12g"|format(value)|float)))*100), 0.05) << "incorrect value for (((prefix))), expected ((("%.12g"|format(value)|float))), is " << last_msg_->(((prefix))); - ((*- else *)) - EXPECT_EQ(get_as(((prefix))))>(reinterpret_cast(&last_msg_->(((prefix))))), (((value)))) << "incorrect value for (((prefix))), expected (((value))), is " << last_msg_->(((prefix))); - ((*- endif *)) - ((*- endmacro *)) - - ((*- macro assign_value(prefix, value) *)) - ((*- if value is string_type *)) - { - const char assign_string[] = { (((value|str_escape))) }; - memcpy(test_msg->(((prefix))), assign_string, sizeof(assign_string)); - if (sizeof(test_msg->(((prefix)))) == 0) { - test_msg_len = (uint8_t)(test_msg_len + sizeof(assign_string)); - } - } - ((*- elif value is array_type *)) - ((*- for ff in value *)) - if (sizeof(test_msg->(((prefix)))) == 0) { - // Cope with variable length arrays - test_msg_len = (uint8_t)(test_msg_len + sizeof(test_msg->(((prefix)))[0])); - } - (((- assign_value( (((prefix))) + '[' + (((loop.index0|to_str))) + ']', (((ff))) ) -))) - ((*- endfor *)) - ((*- elif value is dict_type *)) - ((*- for k in (((value|sorted))) *))((( assign_value( (((prefix))) + '.' + (((k))), (((value[k]))) ) )))((*- endfor *)) - ((*- else *)) - test_msg->(((prefix))) = (((value))); - ((*- endif *)) - ((*- endmacro *)) - - uint8_t encoded_frame[] = { ((*- for p in t.packet_as_byte_array *))(((p))),((*- endfor *)) }; - - uint8_t test_msg_storage[SBP_MAX_PAYLOAD_LEN]{}; - uint8_t test_msg_len = 0; - ((*- if t.fields *)) - (((t.msg_type_name|convert)))* test_msg = ( (((t.msg_type_name|convert)))* )test_msg_storage; - test_msg_len = (uint8_t)sizeof(*test_msg); - ((*- for f in t.fieldskeys *))(((assign_value( (((f))), (((t.fields[f]))) ))))((*- endfor *)) - ((*- endif *)) - - EXPECT_EQ(send_message( (((t.msg_type))), (((t.raw_json_obj.sender))), test_msg_len, test_msg_storage), SBP_OK); - - EXPECT_EQ(dummy_wr_, sizeof(encoded_frame)); - EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0); - - while (dummy_rd_ < dummy_wr_) { - process(); - } - - EXPECT_EQ(n_callbacks_logged_, 1); - EXPECT_EQ(last_sender_id_, (((t.raw_json_obj.sender)))); - EXPECT_EQ(last_msg_len_, test_msg_len); - - ((*- if t.fields *)) - ((*- for f in t.fieldskeys *))(((compare_value( (((f))), (((t.fields[f]))) ))))((*- endfor *)) - ((*- endif *)) -} -((*- endif *)) -((*- endfor *)) - diff --git a/generator/sbpg/targets/resources/c/test/sbp_c_main.c.j2 b/generator/sbpg/targets/resources/c/test/sbp_c_main.c.j2 index 59cb4af1f0..d5093a85a4 100644 --- a/generator/sbpg/targets/resources/c/test/sbp_c_main.c.j2 +++ b/generator/sbpg/targets/resources/c/test/sbp_c_main.c.j2 @@ -15,11 +15,7 @@ #include #include -((*- if test_type == 'legacy' *)) -#include "check_suites_legacy.h" -((*- else *)) #include "check_suites.h" -((*- endif *)) int main(void) { @@ -33,12 +29,8 @@ int main(void) // auto-generated tests: ((*- for s in package_suites *)) ((*- if s.tests|length > 0 *)) - ((*- if test_type == 'legacy' *)) - srunner_add_suite(sr, legacy_(((s.suite_name)))_suite()); - ((*- else *)) srunner_add_suite(sr, (((s.suite_name)))_suite()); ((*- endif *)) - ((*- endif *)) ((*- endfor *)) srunner_set_fork_status(sr, CK_NOFORK); diff --git a/generator/sbpg/targets/resources/c/test/sbp_c_suites.h.j2 b/generator/sbpg/targets/resources/c/test/sbp_c_suites.h.j2 index 65afcf1aeb..9cc699133d 100644 --- a/generator/sbpg/targets/resources/c/test/sbp_c_suites.h.j2 +++ b/generator/sbpg/targets/resources/c/test/sbp_c_suites.h.j2 @@ -21,12 +21,8 @@ Suite* bitfield_macros_suite(void); ((*- for s in package_suites *)) ((*- if s.tests|length > 0 *)) -((*- if test_type == 'legacy' *)) -Suite* legacy_(((s.suite_name)))_suite(void); -((*- else *)) Suite* (((s.suite_name)))_suite(void); ((*- endif *)) -((*- endif *)) ((*- endfor *)) #endif /* CHECK_SUITES_H */ diff --git a/generator/sbpg/targets/resources/c/test/v4/sbp_c_test.c.j2 b/generator/sbpg/targets/resources/c/test/sbp_c_test.c.j2 similarity index 100% rename from generator/sbpg/targets/resources/c/test/v4/sbp_c_test.c.j2 rename to generator/sbpg/targets/resources/c/test/sbp_c_test.c.j2 diff --git a/generator/sbpg/targets/resources/c/test/v4/sbp_cpp_test.cc.j2 b/generator/sbpg/targets/resources/c/test/sbp_cpp_test.cc.j2 similarity index 100% rename from generator/sbpg/targets/resources/c/test/v4/sbp_cpp_test.cc.j2 rename to generator/sbpg/targets/resources/c/test/sbp_cpp_test.cc.j2 diff --git a/generator/sbpg/targets/test_c.py b/generator/sbpg/targets/test_c.py index 947eba58cb..58a5eecf9f 100644 --- a/generator/sbpg/targets/test_c.py +++ b/generator/sbpg/targets/test_c.py @@ -13,7 +13,7 @@ Generator for c tests target. """ -from sbpg.targets.c import get_union_member_name, get_v4_typename, get_v4_msg_type +from sbpg.targets.c import get_union_member_name, get_typename, get_msg_type from sbpg.targets.common import ( array_type, dict_type, @@ -25,8 +25,8 @@ from sbpg.targets.templating import JENV import re -TEST_TEMPLATE_NAME = "c/test/v4/sbp_c_test.c.j2" -CPP_TEST_TEMPLATE_NAME = "c/test/v4/sbp_cpp_test.cc.j2" +TEST_TEMPLATE_NAME = "c/test/sbp_c_test.c.j2" +CPP_TEST_TEMPLATE_NAME = "c/test/sbp_cpp_test.cc.j2" CHECK_SUITES_TEMPLATE_NAME = "c/test/sbp_c_suites.h.j2" CHECK_MAIN_TEMPLATE_NAME = "c/test/sbp_c_main.c.j2" @@ -35,24 +35,24 @@ def str_escape(value): return ",".join(["(char)" + str(ord(ch)) for ch in value]) -def convert_v4_msg_type(value): +def convert_msg_type(value): """ Get the `sbp_msg_type_t` value for the given type. In the SBP test spec types are given in CamelCase (eg MsgSettingsReadByIndexDone) in contrast to the all caps version used in the main SBP spec - (eg MSG_SETTINGS_READ_BY_INDEX_DONE). `get_v4_msg_type` in the C generator + (eg MSG_SETTINGS_READ_BY_INDEX_DONE). `get_msg_type` in the C generator expects the all caps version so we have to convert it to all caps before passing - it in to c.get_v4_msg_type + it in to c.get_msg_type """ s0 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", value) s1 = re.sub("([a-z0-9])([A-Z])", r"\1_\2", s0) - return get_v4_msg_type(s1.upper()) + return get_msg_type(s1.upper()) -JENV.filters["convert_unpacked"] = get_v4_typename +JENV.filters["convert_unpacked"] = get_typename JENV.filters["convert_unpacked_union"] = get_union_member_name -JENV.filters["convert_upper"] = convert_v4_msg_type +JENV.filters["convert_upper"] = convert_msg_type JENV.filters["type"] = type JENV.filters["str_escape"] = str_escape JENV.filters["to_str"] = to_str diff --git a/spec/tests/yaml/swiftnav/sbp/gnss/test_gnss_structs.yaml b/spec/tests/yaml/swiftnav/sbp/gnss/test_gnss_structs.yaml index b894493d55..2b60a0d30e 100644 --- a/spec/tests/yaml/swiftnav/sbp/gnss/test_gnss_structs.yaml +++ b/spec/tests/yaml/swiftnav/sbp/gnss/test_gnss_structs.yaml @@ -9,7 +9,7 @@ struct_tests: sat: 162 code: 244 module: sbp.gnss - name: V4GnssSignal + name: GnssSignal - encoded: siw= fields: @@ -46,7 +46,7 @@ struct_tests: wn: 47135 ns_residual: 471708190 module: sbp.gnss - name: V4GpsTime + name: GpsTime - encoded: ItSwh3o= fields: